From 822326eea9734a25a7dd36fd9367b7e0af71fc8e Mon Sep 17 00:00:00 2001 From: EmptyChaos Date: Sun, 26 Jun 2016 05:25:29 +0000 Subject: [PATCH] Update wxWidgets to 3.1.0 From wxWidgets master 81570ae070b35c9d52de47b1f14897f3ff1a66c7. include/wx/defs.h -- __w64 warning disable patch by comex brought forward. include/wx/msw/window.h -- added GetContentScaleFactor() which was not implemented on Windows but is necessary for wxBitmap scaling on Mac OS X so it needs to work to avoid #ifdef-ing the code. src/gtk/window.cpp -- Modified DoSetClientSize() to direct call wxWindowGTK::DoSetSize() instead of using public wxWindowBase::SetSize() which now prevents derived classes (like wxAuiToolbar) intercepting the call and breaking it. This matches Windows which does NOT need to call DoSetSize internally. End result is this fixes Dolphin's debug tools toolbars on Linux. src/osx/window_osx.cpp -- Same fix as for GTK since it has the same issue. src/msw/radiobox.cpp -- Hacked to fix display in HiDPI (was clipping off end of text). Updated CMakeLists for Linux and Mac OS X. Small code changes to Dolphin to fix debug error boxes, deprecation warnings, and retain previous UI behavior on Windows. --- CMakeLists.txt | 5 +- Externals/wxWidgets3/CMakeLists.txt | 151 +- Externals/wxWidgets3/art/addbookm.xpm | 48 +- Externals/wxWidgets3/art/back.xpm | 42 +- Externals/wxWidgets3/art/cdrom.xpm | 114 +- Externals/wxWidgets3/art/copy.xpm | 88 +- Externals/wxWidgets3/art/cross.xpm | 34 +- Externals/wxWidgets3/art/cut.xpm | 92 +- Externals/wxWidgets3/art/deffile.xpm | 108 +- Externals/wxWidgets3/art/delbookm.xpm | 48 +- Externals/wxWidgets3/art/delete.xpm | 84 +- Externals/wxWidgets3/art/dir_up.xpm | 104 +- Externals/wxWidgets3/art/down.xpm | 42 +- Externals/wxWidgets3/art/edit.xpm | 22 + Externals/wxWidgets3/art/exefile.xpm | 146 +- Externals/wxWidgets3/art/fileopen.xpm | 114 +- Externals/wxWidgets3/art/filesave.xpm | 84 +- Externals/wxWidgets3/art/filesaveas.xpm | 88 +- Externals/wxWidgets3/art/find.xpm | 124 +- Externals/wxWidgets3/art/findrepl.xpm | 126 +- Externals/wxWidgets3/art/floppy.xpm | 78 +- Externals/wxWidgets3/art/folder.xpm | 86 +- Externals/wxWidgets3/art/folder_open.xpm | 104 +- Externals/wxWidgets3/art/forward.xpm | 42 +- Externals/wxWidgets3/art/fullscreen.xpm | 70 + Externals/wxWidgets3/art/gtk/error.xpm | 116 +- Externals/wxWidgets3/art/gtk/info.xpm | 126 +- Externals/wxWidgets3/art/gtk/question.xpm | 150 +- Externals/wxWidgets3/art/gtk/warning.xpm | 126 +- Externals/wxWidgets3/art/harddisk.xpm | 120 +- Externals/wxWidgets3/art/helpicon.xpm | 88 +- Externals/wxWidgets3/art/home.xpm | 48 +- Externals/wxWidgets3/art/htmbook.xpm | 50 +- Externals/wxWidgets3/art/htmfoldr.xpm | 50 +- Externals/wxWidgets3/art/htmoptns.xpm | 40 +- Externals/wxWidgets3/art/htmpage.xpm | 46 +- Externals/wxWidgets3/art/htmsidep.xpm | 54 +- Externals/wxWidgets3/art/listview.xpm | 50 +- Externals/wxWidgets3/art/missimg.xpm | 86 +- Externals/wxWidgets3/art/motif/error.xpm | 116 +- Externals/wxWidgets3/art/motif/info.xpm | 126 +- Externals/wxWidgets3/art/motif/question.xpm | 150 +- Externals/wxWidgets3/art/motif/warning.xpm | 126 +- Externals/wxWidgets3/art/new.xpm | 100 +- Externals/wxWidgets3/art/new_dir.xpm | 86 +- Externals/wxWidgets3/art/osx/README | 2 - Externals/wxWidgets3/art/osx/close.png | Bin 400 -> 0 bytes .../wxWidgets3/art/osx/close_current.png | Bin 421 -> 0 bytes .../wxWidgets3/art/osx/close_pressed.png | Bin 458 -> 0 bytes Externals/wxWidgets3/art/paste.xpm | 92 +- Externals/wxWidgets3/art/print.xpm | 120 +- Externals/wxWidgets3/art/quit.xpm | 180 +- Externals/wxWidgets3/art/redo.xpm | 116 +- Externals/wxWidgets3/art/removable.xpm | 88 +- Externals/wxWidgets3/art/repview.xpm | 48 +- Externals/wxWidgets3/art/tango/fullscreen.h | 206 + Externals/wxWidgets3/art/tick.xpm | 34 +- Externals/wxWidgets3/art/tipicon.xpm | 94 +- Externals/wxWidgets3/art/toparent.xpm | 42 +- Externals/wxWidgets3/art/undo.xpm | 116 +- Externals/wxWidgets3/art/up.xpm | 42 +- Externals/wxWidgets3/art/wxwin16x16.xpm | 322 +- Externals/wxWidgets3/art/wxwin32x32.xpm | 884 ++-- .../wxWidgets3/build/msw/wx_base.vcxproj | 120 +- .../build/msw/wx_base.vcxproj.filters | 204 +- Externals/wxWidgets3/build_wx.sh | 7 +- Externals/wxWidgets3/include/msvc/wx/setup.h | 27 +- Externals/wxWidgets3/include/wx/accel.h | 8 +- Externals/wxWidgets3/include/wx/access.h | 20 +- .../wxWidgets3/include/wx/activityindicator.h | 60 + .../wxWidgets3/include/wx/addremovectrl.h | 109 + .../wxWidgets3/include/wx/affinematrix2d.h | 22 +- Externals/wxWidgets3/include/wx/afterstd.h | 19 +- Externals/wxWidgets3/include/wx/anidecod.h | 20 +- Externals/wxWidgets3/include/wx/animate.h | 4 +- Externals/wxWidgets3/include/wx/any.h | 159 +- Externals/wxWidgets3/include/wx/anybutton.h | 21 +- Externals/wxWidgets3/include/wx/anystr.h | 2 +- Externals/wxWidgets3/include/wx/app.h | 69 +- Externals/wxWidgets3/include/wx/appprogress.h | 54 + Externals/wxWidgets3/include/wx/apptrait.h | 50 +- Externals/wxWidgets3/include/wx/archive.h | 10 +- Externals/wxWidgets3/include/wx/arrstr.h | 87 +- Externals/wxWidgets3/include/wx/artprov.h | 18 +- Externals/wxWidgets3/include/wx/atomic.h | 2 +- Externals/wxWidgets3/include/wx/aui/auibar.h | 74 +- Externals/wxWidgets3/include/wx/aui/auibook.h | 61 +- .../wxWidgets3/include/wx/aui/barartmsw.h | 86 + .../wxWidgets3/include/wx/aui/floatpane.h | 7 +- .../wxWidgets3/include/wx/aui/framemanager.h | 8 +- Externals/wxWidgets3/include/wx/aui/tabart.h | 78 +- .../wxWidgets3/include/wx/aui/tabartgtk.h | 18 +- .../wxWidgets3/include/wx/aui/tabartmsw.h | 90 + Externals/wxWidgets3/include/wx/aui/tabmdi.h | 32 +- .../wxWidgets3/include/wx/bannerwindow.h | 2 +- Externals/wxWidgets3/include/wx/base64.h | 2 + Externals/wxWidgets3/include/wx/beforestd.h | 29 +- Externals/wxWidgets3/include/wx/bitmap.h | 30 +- Externals/wxWidgets3/include/wx/bmpbuttn.h | 20 +- Externals/wxWidgets3/include/wx/bmpcbox.h | 1 + Externals/wxWidgets3/include/wx/bookctrl.h | 28 +- Externals/wxWidgets3/include/wx/brush.h | 21 +- Externals/wxWidgets3/include/wx/buffer.h | 18 +- Externals/wxWidgets3/include/wx/build.h | 36 +- Externals/wxWidgets3/include/wx/busyinfo.h | 58 + Externals/wxWidgets3/include/wx/button.h | 10 +- Externals/wxWidgets3/include/wx/cairo.h | 29 - Externals/wxWidgets3/include/wx/calctrl.h | 9 +- Externals/wxWidgets3/include/wx/chartype.h | 72 +- Externals/wxWidgets3/include/wx/checkbox.h | 13 +- Externals/wxWidgets3/include/wx/checklst.h | 16 +- Externals/wxWidgets3/include/wx/chkconf.h | 136 +- Externals/wxWidgets3/include/wx/choice.h | 14 +- Externals/wxWidgets3/include/wx/choicebk.h | 34 +- Externals/wxWidgets3/include/wx/clipbrd.h | 10 +- Externals/wxWidgets3/include/wx/clrpicker.h | 17 +- Externals/wxWidgets3/include/wx/cmdargs.h | 3 +- Externals/wxWidgets3/include/wx/cmdline.h | 90 + Externals/wxWidgets3/include/wx/cmdproc.h | 4 +- Externals/wxWidgets3/include/wx/cmndata.h | 9 +- .../include/wx/cocoa/NSApplication.h | 67 - Externals/wxWidgets3/include/wx/cocoa/NSBox.h | 25 - .../wxWidgets3/include/wx/cocoa/NSButton.h | 38 - .../wxWidgets3/include/wx/cocoa/NSControl.h | 31 - .../wxWidgets3/include/wx/cocoa/NSMenu.h | 48 - .../wxWidgets3/include/wx/cocoa/NSPanel.h | 24 - .../wxWidgets3/include/wx/cocoa/NSScroller.h | 40 - .../wxWidgets3/include/wx/cocoa/NSSlider.h | 46 - .../wxWidgets3/include/wx/cocoa/NSTabView.h | 35 - .../include/wx/cocoa/NSTableDataSource.h | 34 - .../wxWidgets3/include/wx/cocoa/NSTableView.h | 29 - .../wxWidgets3/include/wx/cocoa/NSTextField.h | 26 - .../wxWidgets3/include/wx/cocoa/NSView.h | 80 - .../wxWidgets3/include/wx/cocoa/NSWindow.h | 54 - .../include/wx/cocoa/ObjcAssociate.h | 77 - .../wxWidgets3/include/wx/cocoa/ObjcRef.h | 235 - Externals/wxWidgets3/include/wx/cocoa/app.h | 73 - .../wxWidgets3/include/wx/cocoa/autorelease.h | 31 - .../wxWidgets3/include/wx/cocoa/bitmap.h | 164 - .../wxWidgets3/include/wx/cocoa/bmpbuttn.h | 61 - Externals/wxWidgets3/include/wx/cocoa/brush.h | 70 - .../wxWidgets3/include/wx/cocoa/button.h | 64 - .../wxWidgets3/include/wx/cocoa/checkbox.h | 68 - .../wxWidgets3/include/wx/cocoa/checklst.h | 79 - .../wxWidgets3/include/wx/cocoa/chkconf.h | 21 - .../wxWidgets3/include/wx/cocoa/choice.h | 100 - .../wxWidgets3/include/wx/cocoa/clipbrd.h | 51 - .../wxWidgets3/include/wx/cocoa/colordlg.h | 1 - .../wxWidgets3/include/wx/cocoa/colour.h | 92 - .../wxWidgets3/include/wx/cocoa/combobox.h | 157 - .../wxWidgets3/include/wx/cocoa/control.h | 77 - .../wxWidgets3/include/wx/cocoa/cursor.h | 64 - .../wxWidgets3/include/wx/cocoa/dataform.h | 50 - .../wxWidgets3/include/wx/cocoa/dataobj.h | 23 - Externals/wxWidgets3/include/wx/cocoa/dc.h | 174 - .../wxWidgets3/include/wx/cocoa/dcclient.h | 69 - .../wxWidgets3/include/wx/cocoa/dcmemory.h | 54 - .../wxWidgets3/include/wx/cocoa/dcscreen.h | 31 - .../wxWidgets3/include/wx/cocoa/dialog.h | 94 - .../wxWidgets3/include/wx/cocoa/dirdlg.h | 50 - .../wxWidgets3/include/wx/cocoa/drawer.h | 1 - .../wxWidgets3/include/wx/cocoa/evtloop.h | 38 - .../wxWidgets3/include/wx/cocoa/filedlg.h | 52 - .../wxWidgets3/include/wx/cocoa/fontdlg.h | 1 - Externals/wxWidgets3/include/wx/cocoa/frame.h | 106 - Externals/wxWidgets3/include/wx/cocoa/gauge.h | 73 - .../wxWidgets3/include/wx/cocoa/glcanvas.h | 97 - Externals/wxWidgets3/include/wx/cocoa/icon.h | 63 - .../wxWidgets3/include/wx/cocoa/listbox.h | 114 - Externals/wxWidgets3/include/wx/cocoa/log.h | 21 - .../wxWidgets3/include/wx/cocoa/mbarman.h | 70 - Externals/wxWidgets3/include/wx/cocoa/mdi.h | 163 - Externals/wxWidgets3/include/wx/cocoa/menu.h | 185 - .../wxWidgets3/include/wx/cocoa/menuitem.h | 99 - .../wxWidgets3/include/wx/cocoa/msgdlg.h | 70 - .../wxWidgets3/include/wx/cocoa/notebook.h | 104 - .../wxWidgets3/include/wx/cocoa/objc/NSMenu.h | 30 - .../include/wx/cocoa/objc/NSSlider.h | 36 - .../wxWidgets3/include/wx/cocoa/objc/NSView.h | 44 - .../include/wx/cocoa/objc/NSWindow.h | 39 - .../include/wx/cocoa/objc/objc_uniquifying.h | 364 -- Externals/wxWidgets3/include/wx/cocoa/pen.h | 72 - .../include/wx/cocoa/private/fontfactory.h | 27 - .../include/wx/cocoa/private/scrollview.h | 128 - .../include/wx/cocoa/private/timer.h | 42 - .../wxWidgets3/include/wx/cocoa/radiobox.h | 137 - .../wxWidgets3/include/wx/cocoa/radiobut.h | 73 - .../wxWidgets3/include/wx/cocoa/region.h | 75 - .../wxWidgets3/include/wx/cocoa/scrolbar.h | 74 - .../wxWidgets3/include/wx/cocoa/slider.h | 107 - Externals/wxWidgets3/include/wx/cocoa/sound.h | 51 - .../wxWidgets3/include/wx/cocoa/spinbutt.h | 63 - .../wxWidgets3/include/wx/cocoa/statbmp.h | 59 - .../wxWidgets3/include/wx/cocoa/statbox.h | 60 - .../wxWidgets3/include/wx/cocoa/statline.h | 55 - .../wxWidgets3/include/wx/cocoa/stattext.h | 58 - .../wxWidgets3/include/wx/cocoa/string.h | 52 - .../wxWidgets3/include/wx/cocoa/taskbar.h | 47 - .../wxWidgets3/include/wx/cocoa/textctrl.h | 122 - .../wxWidgets3/include/wx/cocoa/toolbar.h | 120 - .../wxWidgets3/include/wx/cocoa/tooltip.h | 54 - .../wxWidgets3/include/wx/cocoa/toplevel.h | 130 - .../include/wx/cocoa/trackingrectmanager.h | 40 - .../wxWidgets3/include/wx/cocoa/window.h | 226 - .../wxWidgets3/include/wx/collheaderctrl.h | 106 + Externals/wxWidgets3/include/wx/collpane.h | 4 +- Externals/wxWidgets3/include/wx/colordlg.h | 4 +- Externals/wxWidgets3/include/wx/colour.h | 20 +- Externals/wxWidgets3/include/wx/colourdata.h | 7 +- Externals/wxWidgets3/include/wx/combo.h | 83 +- Externals/wxWidgets3/include/wx/combobox.h | 12 +- .../wxWidgets3/include/wx/commandlinkbutton.h | 2 +- Externals/wxWidgets3/include/wx/compiler.h | 75 +- .../wxWidgets3/include/wx/compositewin.h | 58 +- Externals/wxWidgets3/include/wx/confbase.h | 12 +- Externals/wxWidgets3/include/wx/config.h | 3 - Externals/wxWidgets3/include/wx/containr.h | 2 +- Externals/wxWidgets3/include/wx/control.h | 43 +- Externals/wxWidgets3/include/wx/convauto.h | 8 +- Externals/wxWidgets3/include/wx/cpp.h | 73 +- Externals/wxWidgets3/include/wx/cppunit.h | 53 +- Externals/wxWidgets3/include/wx/cshelp.h | 33 +- Externals/wxWidgets3/include/wx/ctrlsub.h | 29 +- Externals/wxWidgets3/include/wx/cursor.h | 36 +- Externals/wxWidgets3/include/wx/custombgwin.h | 4 + Externals/wxWidgets3/include/wx/dataobj.h | 84 +- Externals/wxWidgets3/include/wx/dataview.h | 114 +- Externals/wxWidgets3/include/wx/datectrl.h | 2 +- Externals/wxWidgets3/include/wx/dateevt.h | 4 +- Externals/wxWidgets3/include/wx/datetime.h | 47 +- Externals/wxWidgets3/include/wx/dc.h | 71 +- Externals/wxWidgets3/include/wx/dcbuffer.h | 6 +- Externals/wxWidgets3/include/wx/dcclient.h | 6 +- Externals/wxWidgets3/include/wx/dcgraph.h | 117 +- Externals/wxWidgets3/include/wx/dcmemory.h | 2 +- Externals/wxWidgets3/include/wx/dcmirror.h | 90 +- Externals/wxWidgets3/include/wx/dcprint.h | 4 +- Externals/wxWidgets3/include/wx/dcscreen.h | 2 +- Externals/wxWidgets3/include/wx/dcsvg.h | 129 +- Externals/wxWidgets3/include/wx/debug.h | 48 +- Externals/wxWidgets3/include/wx/debugrpt.h | 6 +- Externals/wxWidgets3/include/wx/defs.h | 542 +-- Externals/wxWidgets3/include/wx/dialog.h | 30 +- Externals/wxWidgets3/include/wx/dirdlg.h | 29 +- Externals/wxWidgets3/include/wx/dlimpexp.h | 66 +- Externals/wxWidgets3/include/wx/dlist.h | 2 - Externals/wxWidgets3/include/wx/dnd.h | 8 +- Externals/wxWidgets3/include/wx/docmdi.h | 16 +- Externals/wxWidgets3/include/wx/docview.h | 61 +- Externals/wxWidgets3/include/wx/dragimag.h | 2 +- Externals/wxWidgets3/include/wx/dvrenderers.h | 93 +- Externals/wxWidgets3/include/wx/dynarray.h | 2 +- Externals/wxWidgets3/include/wx/dynlib.h | 16 +- Externals/wxWidgets3/include/wx/editlbox.h | 4 +- Externals/wxWidgets3/include/wx/effects.h | 2 +- Externals/wxWidgets3/include/wx/encconv.h | 1 - Externals/wxWidgets3/include/wx/encinfo.h | 3 +- Externals/wxWidgets3/include/wx/event.h | 401 +- Externals/wxWidgets3/include/wx/evtloop.h | 49 +- Externals/wxWidgets3/include/wx/evtloopsrc.h | 3 +- Externals/wxWidgets3/include/wx/fdrepdlg.h | 6 +- Externals/wxWidgets3/include/wx/features.h | 39 +- Externals/wxWidgets3/include/wx/fileconf.h | 46 +- Externals/wxWidgets3/include/wx/filectrl.h | 6 +- Externals/wxWidgets3/include/wx/filedlg.h | 41 +- Externals/wxWidgets3/include/wx/filefn.h | 252 +- Externals/wxWidgets3/include/wx/filehistory.h | 18 +- Externals/wxWidgets3/include/wx/filename.h | 19 +- Externals/wxWidgets3/include/wx/filepicker.h | 36 +- Externals/wxWidgets3/include/wx/filesys.h | 14 +- Externals/wxWidgets3/include/wx/font.h | 133 +- Externals/wxWidgets3/include/wx/fontdata.h | 2 +- Externals/wxWidgets3/include/wx/fontdlg.h | 22 +- Externals/wxWidgets3/include/wx/fontpicker.h | 30 +- Externals/wxWidgets3/include/wx/fontutil.h | 26 +- Externals/wxWidgets3/include/wx/frame.h | 20 +- Externals/wxWidgets3/include/wx/fs_arc.h | 10 +- Externals/wxWidgets3/include/wx/fs_filter.h | 8 +- Externals/wxWidgets3/include/wx/fs_inet.h | 4 +- Externals/wxWidgets3/include/wx/fs_mem.h | 8 +- Externals/wxWidgets3/include/wx/fswatcher.h | 12 +- Externals/wxWidgets3/include/wx/gauge.h | 57 +- Externals/wxWidgets3/include/wx/gbsizer.h | 10 +- Externals/wxWidgets3/include/wx/gdicmn.h | 68 +- Externals/wxWidgets3/include/wx/gdiobj.h | 10 +- .../wxWidgets3/include/wx/generic/accel.h | 6 +- .../include/wx/generic/activityindicator.h | 67 + .../wxWidgets3/include/wx/generic/animate.h | 28 +- .../wxWidgets3/include/wx/generic/bmpcbox.h | 28 +- .../wxWidgets3/include/wx/generic/busyinfo.h | 12 +- .../wxWidgets3/include/wx/generic/buttonbar.h | 26 +- .../wxWidgets3/include/wx/generic/calctrlg.h | 65 +- .../wxWidgets3/include/wx/generic/caret.h | 14 +- .../wxWidgets3/include/wx/generic/choicdgg.h | 20 +- .../include/wx/generic/clrpickerg.h | 2 +- .../include/wx/generic/collheaderctrl.h | 83 + .../wxWidgets3/include/wx/generic/collpaneg.h | 34 +- .../wxWidgets3/include/wx/generic/colour.h | 2 +- .../wxWidgets3/include/wx/generic/colrdlgg.h | 49 +- .../wxWidgets3/include/wx/generic/combo.h | 18 +- .../include/wx/generic/custombgwin.h | 3 + .../wxWidgets3/include/wx/generic/dataview.h | 29 +- .../wxWidgets3/include/wx/generic/datectrl.h | 18 +- .../wxWidgets3/include/wx/generic/dcpsg.h | 100 +- .../wxWidgets3/include/wx/generic/dirctrlg.h | 36 +- .../wxWidgets3/include/wx/generic/dirdlgg.h | 18 +- .../wxWidgets3/include/wx/generic/dragimgg.h | 14 +- .../include/wx/generic/dvrenderer.h | 2 +- .../include/wx/generic/dvrenderers.h | 64 +- .../wxWidgets3/include/wx/generic/fdrepdlg.h | 4 +- .../wxWidgets3/include/wx/generic/filectrlg.h | 36 +- .../wxWidgets3/include/wx/generic/filedlgg.h | 42 +- .../include/wx/generic/filepickerg.h | 24 +- .../wxWidgets3/include/wx/generic/fontdlgg.h | 24 +- .../include/wx/generic/fontpickerg.h | 8 +- .../wxWidgets3/include/wx/generic/grid.h | 129 +- .../wxWidgets3/include/wx/generic/gridctrl.h | 60 +- .../include/wx/generic/grideditors.h | 128 +- .../include/wx/generic/headerctrlg.h | 16 +- .../wxWidgets3/include/wx/generic/helpext.h | 28 +- .../wxWidgets3/include/wx/generic/icon.h | 4 +- .../wxWidgets3/include/wx/generic/imaglist.h | 7 +- .../wxWidgets3/include/wx/generic/infobar.h | 20 +- .../wxWidgets3/include/wx/generic/laywin.h | 12 +- .../wxWidgets3/include/wx/generic/listctrl.h | 79 +- .../wxWidgets3/include/wx/generic/logg.h | 8 +- .../wxWidgets3/include/wx/generic/mask.h | 2 +- .../wxWidgets3/include/wx/generic/mdig.h | 10 +- .../wxWidgets3/include/wx/generic/msgdlgg.h | 6 +- .../wxWidgets3/include/wx/generic/notebook.h | 4 +- .../wxWidgets3/include/wx/generic/notifmsg.h | 33 +- .../wxWidgets3/include/wx/generic/numdlgg.h | 21 +- .../wxWidgets3/include/wx/generic/paletteg.h | 8 +- .../wxWidgets3/include/wx/generic/printps.h | 14 +- .../wx/generic/private/addremovectrl.h | 65 + .../include/wx/generic/private/grid.h | 174 +- .../include/wx/generic/private/listctrl.h | 40 +- .../include/wx/generic/private/notifmsg.h | 52 + .../include/wx/generic/private/widthcalc.h | 123 + .../wxWidgets3/include/wx/generic/prntdlgg.h | 44 +- .../wxWidgets3/include/wx/generic/progdlgg.h | 10 +- .../wxWidgets3/include/wx/generic/propdlg.h | 18 +- .../include/wx/generic/richmsgdlgg.h | 12 +- .../wxWidgets3/include/wx/generic/sashwin.h | 24 +- .../wxWidgets3/include/wx/generic/scrolwin.h | 3 + .../wxWidgets3/include/wx/generic/spinctlg.h | 35 +- .../wxWidgets3/include/wx/generic/splash.h | 8 +- .../wxWidgets3/include/wx/generic/splitter.h | 16 +- .../wxWidgets3/include/wx/generic/srchctlg.h | 128 +- .../wxWidgets3/include/wx/generic/statbmpg.h | 18 +- .../wxWidgets3/include/wx/generic/statline.h | 2 +- .../wxWidgets3/include/wx/generic/stattextg.h | 16 +- .../wxWidgets3/include/wx/generic/statusbr.h | 18 +- .../wxWidgets3/include/wx/generic/tabg.h | 14 +- .../wxWidgets3/include/wx/generic/textdlgg.h | 29 +- .../wxWidgets3/include/wx/generic/treectlg.h | 161 +- .../wxWidgets3/include/wx/generic/wizard.h | 21 +- Externals/wxWidgets3/include/wx/geometry.h | 22 +- Externals/wxWidgets3/include/wx/gifdecod.h | 20 +- Externals/wxWidgets3/include/wx/glcanvas.h | 149 +- Externals/wxWidgets3/include/wx/graphics.h | 43 +- .../include/wx/gtk/activityindicator.h | 66 + Externals/wxWidgets3/include/wx/gtk/animate.h | 40 +- .../wxWidgets3/include/wx/gtk/anybutton.h | 18 +- Externals/wxWidgets3/include/wx/gtk/app.h | 29 +- Externals/wxWidgets3/include/wx/gtk/bitmap.h | 57 +- .../wxWidgets3/include/wx/gtk/bmpbuttn.h | 2 +- Externals/wxWidgets3/include/wx/gtk/bmpcbox.h | 42 +- Externals/wxWidgets3/include/wx/gtk/brush.h | 32 +- Externals/wxWidgets3/include/wx/gtk/button.h | 12 +- Externals/wxWidgets3/include/wx/gtk/calctrl.h | 14 +- .../wxWidgets3/include/wx/gtk/checkbox.h | 18 +- .../wxWidgets3/include/wx/gtk/checklst.h | 6 +- Externals/wxWidgets3/include/wx/gtk/choice.h | 36 +- Externals/wxWidgets3/include/wx/gtk/clipbrd.h | 20 +- .../wxWidgets3/include/wx/gtk/clrpicker.h | 4 +- .../wxWidgets3/include/wx/gtk/collpane.h | 20 +- .../wxWidgets3/include/wx/gtk/colordlg.h | 8 +- Externals/wxWidgets3/include/wx/gtk/colour.h | 14 +- .../wxWidgets3/include/wx/gtk/combobox.h | 44 +- Externals/wxWidgets3/include/wx/gtk/control.h | 8 +- Externals/wxWidgets3/include/wx/gtk/cursor.h | 15 +- .../wxWidgets3/include/wx/gtk/dataobj2.h | 26 +- .../wxWidgets3/include/wx/gtk/dataview.h | 120 +- Externals/wxWidgets3/include/wx/gtk/dc.h | 45 +- .../wxWidgets3/include/wx/gtk/dcclient.h | 94 +- .../wxWidgets3/include/wx/gtk/dcmemory.h | 24 +- .../wxWidgets3/include/wx/gtk/dcscreen.h | 4 +- Externals/wxWidgets3/include/wx/gtk/dialog.h | 10 +- Externals/wxWidgets3/include/wx/gtk/dirdlg.h | 8 +- Externals/wxWidgets3/include/wx/gtk/dnd.h | 10 +- .../wxWidgets3/include/wx/gtk/dvrenderer.h | 53 +- .../wxWidgets3/include/wx/gtk/dvrenderers.h | 106 +- Externals/wxWidgets3/include/wx/gtk/evtloop.h | 14 +- .../wxWidgets3/include/wx/gtk/filectrl.h | 30 +- Externals/wxWidgets3/include/wx/gtk/filedlg.h | 34 +- .../wxWidgets3/include/wx/gtk/filehistory.h | 4 +- .../wxWidgets3/include/wx/gtk/filepicker.h | 18 +- Externals/wxWidgets3/include/wx/gtk/font.h | 69 +- Externals/wxWidgets3/include/wx/gtk/fontdlg.h | 15 +- .../wxWidgets3/include/wx/gtk/fontpicker.h | 30 +- Externals/wxWidgets3/include/wx/gtk/frame.h | 25 +- Externals/wxWidgets3/include/wx/gtk/gauge.h | 11 +- .../wxWidgets3/include/wx/gtk/glcanvas.h | 27 +- .../wxWidgets3/include/wx/gtk/gnome/gprint.h | 0 .../include/wx/gtk/hildon/notifmsg.h | 58 - .../wxWidgets3/include/wx/gtk/hyperlink.h | 63 +- Externals/wxWidgets3/include/wx/gtk/infobar.h | 14 +- Externals/wxWidgets3/include/wx/gtk/listbox.h | 48 +- Externals/wxWidgets3/include/wx/gtk/mdi.h | 32 +- Externals/wxWidgets3/include/wx/gtk/menu.h | 46 +- .../wxWidgets3/include/wx/gtk/menuitem.h | 10 +- .../wxWidgets3/include/wx/gtk/minifram.h | 8 +- Externals/wxWidgets3/include/wx/gtk/msgdlg.h | 22 +- .../wxWidgets3/include/wx/gtk/nonownedwnd.h | 8 +- .../wxWidgets3/include/wx/gtk/notebook.h | 44 +- .../wxWidgets3/include/wx/gtk/notifmsg.h | 51 - Externals/wxWidgets3/include/wx/gtk/pen.h | 49 +- .../wxWidgets3/include/wx/gtk/popupwin.h | 12 +- Externals/wxWidgets3/include/wx/gtk/print.h | 192 +- .../include/wx/gtk/private/addremovectrl.h | 80 + .../include/wx/gtk/private/eventsdisabler.h | 41 + .../include/wx/gtk/private/gtk2-compat.h | 19 + .../include/wx/gtk/private/gtk3-compat.h | 35 + .../include/wx/gtk/private/treeview.h | 62 + .../wxWidgets3/include/wx/gtk/private/value.h | 43 + .../wxWidgets3/include/wx/gtk/radiobox.h | 46 +- .../wxWidgets3/include/wx/gtk/radiobut.h | 12 +- Externals/wxWidgets3/include/wx/gtk/region.h | 32 +- .../wxWidgets3/include/wx/gtk/scrolbar.h | 14 +- Externals/wxWidgets3/include/wx/gtk/setup0.h | 199 +- Externals/wxWidgets3/include/wx/gtk/slider.h | 26 +- .../wxWidgets3/include/wx/gtk/spinbutt.h | 18 +- .../wxWidgets3/include/wx/gtk/spinctrl.h | 34 +- Externals/wxWidgets3/include/wx/gtk/statbmp.h | 10 +- Externals/wxWidgets3/include/wx/gtk/statbox.h | 16 +- .../wxWidgets3/include/wx/gtk/statline.h | 2 +- .../wxWidgets3/include/wx/gtk/stattext.h | 18 +- Externals/wxWidgets3/include/wx/gtk/taskbar.h | 10 +- .../wxWidgets3/include/wx/gtk/textctrl.h | 97 +- .../wxWidgets3/include/wx/gtk/textentry.h | 57 +- Externals/wxWidgets3/include/wx/gtk/tglbtn.h | 20 +- Externals/wxWidgets3/include/wx/gtk/toolbar.h | 46 +- Externals/wxWidgets3/include/wx/gtk/tooltip.h | 2 +- .../wxWidgets3/include/wx/gtk/toplevel.h | 58 +- .../wxWidgets3/include/wx/gtk/treeentry_gtk.h | 76 - .../include/wx/gtk/webview_webkit.h | 104 +- Externals/wxWidgets3/include/wx/gtk/window.h | 153 +- Externals/wxWidgets3/include/wx/hash.h | 4 +- Externals/wxWidgets3/include/wx/hashmap.h | 4 - Externals/wxWidgets3/include/wx/headercol.h | 32 +- Externals/wxWidgets3/include/wx/headerctrl.h | 16 +- Externals/wxWidgets3/include/wx/help.h | 6 +- Externals/wxWidgets3/include/wx/helpbase.h | 2 +- Externals/wxWidgets3/include/wx/helpwin.h | 2 - Externals/wxWidgets3/include/wx/htmllbox.h | 73 +- Externals/wxWidgets3/include/wx/hyperlink.h | 8 +- Externals/wxWidgets3/include/wx/icon.h | 9 +- Externals/wxWidgets3/include/wx/iconbndl.h | 6 +- Externals/wxWidgets3/include/wx/imagbmp.h | 34 +- Externals/wxWidgets3/include/wx/image.h | 24 +- Externals/wxWidgets3/include/wx/imaggif.h | 10 +- Externals/wxWidgets3/include/wx/imagiff.h | 8 +- Externals/wxWidgets3/include/wx/imagjpeg.h | 8 +- Externals/wxWidgets3/include/wx/imagpcx.h | 8 +- Externals/wxWidgets3/include/wx/imagpng.h | 8 +- Externals/wxWidgets3/include/wx/imagpnm.h | 8 +- Externals/wxWidgets3/include/wx/imagtga.h | 8 +- Externals/wxWidgets3/include/wx/imagtiff.h | 10 +- Externals/wxWidgets3/include/wx/imagxpm.h | 8 +- Externals/wxWidgets3/include/wx/infobar.h | 5 + Externals/wxWidgets3/include/wx/init.h | 10 +- Externals/wxWidgets3/include/wx/intl.h | 11 + Externals/wxWidgets3/include/wx/ipcbase.h | 10 +- Externals/wxWidgets3/include/wx/joystick.h | 4 +- Externals/wxWidgets3/include/wx/language.h | 11 +- Externals/wxWidgets3/include/wx/layout.h | 4 +- Externals/wxWidgets3/include/wx/list.h | 47 +- Externals/wxWidgets3/include/wx/listbase.h | 36 +- Externals/wxWidgets3/include/wx/listbook.h | 32 +- Externals/wxWidgets3/include/wx/listbox.h | 17 +- Externals/wxWidgets3/include/wx/listctrl.h | 6 +- Externals/wxWidgets3/include/wx/log.h | 165 +- Externals/wxWidgets3/include/wx/longlong.h | 27 +- Externals/wxWidgets3/include/wx/math.h | 18 +- Externals/wxWidgets3/include/wx/mdi.h | 83 +- Externals/wxWidgets3/include/wx/mediactrl.h | 22 +- Externals/wxWidgets3/include/wx/memory.h | 20 +- Externals/wxWidgets3/include/wx/menu.h | 41 +- Externals/wxWidgets3/include/wx/menuitem.h | 6 +- Externals/wxWidgets3/include/wx/meta/if.h | 18 +- .../include/wx/meta/implicitconversion.h | 14 +- .../wxWidgets3/include/wx/meta/movable.h | 4 +- Externals/wxWidgets3/include/wx/meta/pod.h | 22 +- .../wxWidgets3/include/wx/meta/removeref.h | 9 +- Externals/wxWidgets3/include/wx/metafile.h | 2 - Externals/wxWidgets3/include/wx/mimetype.h | 46 +- Externals/wxWidgets3/include/wx/minifram.h | 6 +- Externals/wxWidgets3/include/wx/module.h | 2 +- .../wxWidgets3/include/wx/mousemanager.h | 2 +- Externals/wxWidgets3/include/wx/msgdlg.h | 15 +- Externals/wxWidgets3/include/wx/msgout.h | 77 +- Externals/wxWidgets3/include/wx/mstream.h | 43 +- Externals/wxWidgets3/include/wx/msw/accel.h | 2 +- .../wxWidgets3/include/wx/msw/anybutton.h | 3 +- Externals/wxWidgets3/include/wx/msw/app.h | 41 +- .../wxWidgets3/include/wx/msw/appprogress.h | 39 + .../wxWidgets3/include/wx/msw/apptbase.h | 2 - .../wxWidgets3/include/wx/msw/apptrait.h | 14 +- Externals/wxWidgets3/include/wx/msw/bitmap.h | 28 +- .../wxWidgets3/include/wx/msw/bmpbuttn.h | 4 +- Externals/wxWidgets3/include/wx/msw/bmpcbox.h | 4 +- Externals/wxWidgets3/include/wx/msw/brush.h | 15 +- Externals/wxWidgets3/include/wx/msw/calctrl.h | 2 +- .../wxWidgets3/include/wx/msw/checkbox.h | 35 +- .../wxWidgets3/include/wx/msw/checklst.h | 4 +- Externals/wxWidgets3/include/wx/msw/chkconf.h | 145 +- Externals/wxWidgets3/include/wx/msw/choice.h | 6 +- Externals/wxWidgets3/include/wx/msw/clipbrd.h | 2 +- .../wxWidgets3/include/wx/msw/colordlg.h | 4 +- Externals/wxWidgets3/include/wx/msw/colour.h | 2 +- Externals/wxWidgets3/include/wx/msw/combo.h | 10 +- .../wxWidgets3/include/wx/msw/combobox.h | 6 +- Externals/wxWidgets3/include/wx/msw/control.h | 9 +- Externals/wxWidgets3/include/wx/msw/ctrlsub.h | 2 +- Externals/wxWidgets3/include/wx/msw/cursor.h | 9 +- .../wxWidgets3/include/wx/msw/datectrl.h | 5 +- Externals/wxWidgets3/include/wx/msw/dc.h | 4 +- .../wxWidgets3/include/wx/msw/dcclient.h | 8 +- .../wxWidgets3/include/wx/msw/dcmemory.h | 2 +- Externals/wxWidgets3/include/wx/msw/dcprint.h | 2 +- .../wxWidgets3/include/wx/msw/dcscreen.h | 2 +- Externals/wxWidgets3/include/wx/msw/dde.h | 6 +- .../wxWidgets3/include/wx/msw/debughlp.h | 269 +- Externals/wxWidgets3/include/wx/msw/dialog.h | 49 +- Externals/wxWidgets3/include/wx/msw/dib.h | 21 +- Externals/wxWidgets3/include/wx/msw/dirdlg.h | 2 +- .../wxWidgets3/include/wx/msw/dragimag.h | 2 +- Externals/wxWidgets3/include/wx/msw/enhmeta.h | 14 +- Externals/wxWidgets3/include/wx/msw/evtloop.h | 3 +- .../include/wx/msw/evtloopconsole.h | 23 +- .../wxWidgets3/include/wx/msw/fdrepdlg.h | 2 +- Externals/wxWidgets3/include/wx/msw/filedlg.h | 6 +- Externals/wxWidgets3/include/wx/msw/font.h | 54 +- Externals/wxWidgets3/include/wx/msw/fontdlg.h | 13 +- Externals/wxWidgets3/include/wx/msw/frame.h | 29 +- Externals/wxWidgets3/include/wx/msw/gauge.h | 4 +- Externals/wxWidgets3/include/wx/msw/gccpriv.h | 101 +- .../wxWidgets3/include/wx/msw/gdiimage.h | 2 +- .../wxWidgets3/include/wx/msw/glcanvas.h | 38 +- .../wxWidgets3/include/wx/msw/helpbest.h | 2 +- Externals/wxWidgets3/include/wx/msw/helpchm.h | 2 +- Externals/wxWidgets3/include/wx/msw/helpwin.h | 2 +- Externals/wxWidgets3/include/wx/msw/icon.h | 2 +- .../wxWidgets3/include/wx/msw/imaglist.h | 6 +- Externals/wxWidgets3/include/wx/msw/iniconf.h | 2 +- Externals/wxWidgets3/include/wx/msw/init.h | 9 +- .../wxWidgets3/include/wx/msw/joystick.h | 4 +- .../wxWidgets3/include/wx/msw/libraries.h | 3 +- Externals/wxWidgets3/include/wx/msw/listbox.h | 11 +- .../wxWidgets3/include/wx/msw/listctrl.h | 18 +- Externals/wxWidgets3/include/wx/msw/mdi.h | 23 +- Externals/wxWidgets3/include/wx/msw/menu.h | 56 +- .../wxWidgets3/include/wx/msw/menuitem.h | 65 +- .../wxWidgets3/include/wx/msw/metafile.h | 6 +- .../wxWidgets3/include/wx/msw/microwin.h | 234 - .../wxWidgets3/include/wx/msw/mimetype.h | 33 +- .../wxWidgets3/include/wx/msw/minifram.h | 2 +- Externals/wxWidgets3/include/wx/msw/missing.h | 298 +- Externals/wxWidgets3/include/wx/msw/mslu.h | 22 - Externals/wxWidgets3/include/wx/msw/msvcrt.h | 2 +- .../wxWidgets3/include/wx/msw/notebook.h | 12 +- .../wxWidgets3/include/wx/msw/notifmsg.h | 74 - .../wxWidgets3/include/wx/msw/ole/activex.h | 2 - .../wxWidgets3/include/wx/msw/ole/oleutils.h | 39 +- .../wxWidgets3/include/wx/msw/ole/safearray.h | 4 +- .../wxWidgets3/include/wx/msw/ole/uuid.h | 2 - .../include/wx/msw/ownerdrawnbutton.h | 139 + Externals/wxWidgets3/include/wx/msw/palette.h | 4 +- Externals/wxWidgets3/include/wx/msw/pen.h | 16 +- .../wxWidgets3/include/wx/msw/popupwin.h | 5 +- .../wxWidgets3/include/wx/msw/printdlg.h | 6 +- .../wxWidgets3/include/wx/msw/printwin.h | 4 +- Externals/wxWidgets3/include/wx/msw/private.h | 196 +- .../wxWidgets3/include/wx/msw/private/event.h | 104 + .../include/wx/msw/private/fswatcher.h | 80 +- .../include/wx/msw/private/msgdlg.h | 7 +- .../include/wx/msw/private/sockmsw.h | 2 +- .../wxWidgets3/include/wx/msw/radiobox.h | 6 +- .../wxWidgets3/include/wx/msw/radiobut.h | 19 +- Externals/wxWidgets3/include/wx/msw/regconf.h | 2 +- Externals/wxWidgets3/include/wx/msw/region.h | 4 +- .../wxWidgets3/include/wx/msw/registry.h | 4 +- .../wxWidgets3/include/wx/msw/richmsgdlg.h | 4 +- .../wxWidgets3/include/wx/msw/rightarr.cur | Bin 326 -> 0 bytes .../include/wx/msw/rt/private/notifmsg.h | 26 + .../wxWidgets3/include/wx/msw/rt/utils.h | 84 + .../wxWidgets3/include/wx/msw/scrolbar.h | 2 +- Externals/wxWidgets3/include/wx/msw/seh.h | 17 +- Externals/wxWidgets3/include/wx/msw/setup0.h | 199 +- .../wxWidgets3/include/wx/msw/setup_inc.h | 67 +- Externals/wxWidgets3/include/wx/msw/slider.h | 10 +- .../wxWidgets3/include/wx/msw/spinbutt.h | 2 +- .../wxWidgets3/include/wx/msw/spinctrl.h | 7 +- .../wxWidgets3/include/wx/msw/stackwalk.h | 9 +- Externals/wxWidgets3/include/wx/msw/statbmp.h | 17 +- Externals/wxWidgets3/include/wx/msw/statbox.h | 4 +- .../wxWidgets3/include/wx/msw/statline.h | 2 +- .../wxWidgets3/include/wx/msw/stattext.h | 2 +- .../wxWidgets3/include/wx/msw/statusbar.h | 2 +- .../wxWidgets3/include/wx/msw/stdpaths.h | 6 +- Externals/wxWidgets3/include/wx/msw/subwin.h | 37 +- Externals/wxWidgets3/include/wx/msw/taskbar.h | 5 +- .../wxWidgets3/include/wx/msw/taskbarbutton.h | 75 + .../wxWidgets3/include/wx/msw/textctrl.h | 40 +- .../wxWidgets3/include/wx/msw/textentry.h | 4 + Externals/wxWidgets3/include/wx/msw/tglbtn.h | 8 +- Externals/wxWidgets3/include/wx/msw/tls.h | 9 +- Externals/wxWidgets3/include/wx/msw/toolbar.h | 12 +- Externals/wxWidgets3/include/wx/msw/tooltip.h | 15 +- .../wxWidgets3/include/wx/msw/toplevel.h | 77 +- .../wxWidgets3/include/wx/msw/treectrl.h | 11 +- Externals/wxWidgets3/include/wx/msw/uxtheme.h | 23 + .../wxWidgets3/include/wx/msw/webview_ie.h | 2 +- .../include/wx/msw/webview_missing.h | 4 +- .../include/wx/msw/wince/checklst.h | 90 - .../wxWidgets3/include/wx/msw/wince/chkconf.h | 150 - .../include/wx/msw/wince/choicece.h | 140 - .../wxWidgets3/include/wx/msw/wince/helpwce.h | 57 - .../include/wx/msw/wince/libraries.h | 53 - .../wxWidgets3/include/wx/msw/wince/missing.h | 139 - .../wxWidgets3/include/wx/msw/wince/net.h | 20 - .../include/wx/msw/wince/resources.h | 26 - .../wxWidgets3/include/wx/msw/wince/setup.h | 1596 ------- .../include/wx/msw/wince/smartphone.rc | 64 - .../wxWidgets3/include/wx/msw/wince/tbarwce.h | 169 - .../include/wx/msw/wince/textctrlce.h | 235 - .../wxWidgets3/include/wx/msw/wince/time.h | 53 - .../wxWidgets3/include/wx/msw/wince/wince.rc | 15 - Externals/wxWidgets3/include/wx/msw/window.h | 68 +- .../wxWidgets3/include/wx/msw/winundef.h | 21 +- .../wxWidgets3/include/wx/msw/wrapcctl.h | 6 +- .../wxWidgets3/include/wx/msw/wrapcdlg.h | 2 +- .../wxWidgets3/include/wx/msw/wrapgdip.h | 13 + Externals/wxWidgets3/include/wx/msw/wrapshl.h | 7 - Externals/wxWidgets3/include/wx/msw/wrapwin.h | 63 +- Externals/wxWidgets3/include/wx/msw/wx.rc | 12 +- Externals/wxWidgets3/include/wx/nativewin.h | 112 +- Externals/wxWidgets3/include/wx/nonownedwnd.h | 6 +- Externals/wxWidgets3/include/wx/notebook.h | 12 +- Externals/wxWidgets3/include/wx/notifmsg.h | 151 +- Externals/wxWidgets3/include/wx/object.h | 31 +- Externals/wxWidgets3/include/wx/odcombo.h | 78 +- Externals/wxWidgets3/include/wx/osx/accel.h | 2 +- .../include/wx/osx/activityindicator.h | 59 + .../wxWidgets3/include/wx/osx/anybutton.h | 16 +- Externals/wxWidgets3/include/wx/osx/app.h | 29 +- .../wxWidgets3/include/wx/osx/appprogress.h | 36 + Externals/wxWidgets3/include/wx/osx/bitmap.h | 4 +- .../wxWidgets3/include/wx/osx/bmpbuttn.h | 2 +- Externals/wxWidgets3/include/wx/osx/brush.h | 15 +- Externals/wxWidgets3/include/wx/osx/button.h | 38 +- .../include/wx/osx/carbon/chkconf.h | 44 - .../include/wx/osx/carbon/dataview.h | 478 -- .../wxWidgets3/include/wx/osx/carbon/drawer.h | 65 - .../include/wx/osx/carbon/evtloop.h | 34 - .../include/wx/osx/carbon/mimetype.h | 117 - .../include/wx/osx/carbon/private.h | 1045 ----- .../include/wx/osx/carbon/private/mactext.h | 52 - .../include/wx/osx/carbon/private/print.h | 19 +- .../include/wx/osx/carbon/private/timer.h | 32 - .../wxWidgets3/include/wx/osx/carbon/region.h | 4 +- .../include/wx/osx/carbon/statbmp.h | 64 - .../wxWidgets3/include/wx/osx/carbon/uma.h | 43 - .../wxWidgets3/include/wx/osx/checkbox.h | 4 +- .../wxWidgets3/include/wx/osx/checklst.h | 18 +- Externals/wxWidgets3/include/wx/osx/chkconf.h | 19 +- Externals/wxWidgets3/include/wx/osx/choice.h | 2 +- Externals/wxWidgets3/include/wx/osx/clipbrd.h | 2 +- .../wxWidgets3/include/wx/osx/cocoa/chkconf.h | 10 + .../include/wx/osx/cocoa/dataview.h | 6 +- .../wxWidgets3/include/wx/osx/cocoa/private.h | 111 +- .../include/wx/osx/cocoa/private/textimpl.h | 16 +- .../include/wx/osx/cocoa/stdpaths.h | 43 + .../wxWidgets3/include/wx/osx/colordlg.h | 2 +- .../wxWidgets3/include/wx/osx/combobox.h | 53 +- .../wxWidgets3/include/wx/osx/config_xcode.h | 18 +- Externals/wxWidgets3/include/wx/osx/control.h | 2 +- .../wxWidgets3/include/wx/osx/core/cfstring.h | 6 +- .../wxWidgets3/include/wx/osx/core/colour.h | 7 +- .../wxWidgets3/include/wx/osx/core/dataview.h | 4 - .../wxWidgets3/include/wx/osx/core/evtloop.h | 12 +- .../wxWidgets3/include/wx/osx/core/joystick.h | 2 +- .../wxWidgets3/include/wx/osx/core/mimetype.h | 3 + .../wxWidgets3/include/wx/osx/core/private.h | 44 +- .../wx/osx/core/private/datetimectrl.h | 6 - .../wxWidgets3/include/wx/osx/core/stdpaths.h | 69 - Externals/wxWidgets3/include/wx/osx/cursor.h | 4 +- .../wxWidgets3/include/wx/osx/dataview.h | 72 +- .../wxWidgets3/include/wx/osx/dcclient.h | 6 +- .../wxWidgets3/include/wx/osx/dcmemory.h | 2 +- Externals/wxWidgets3/include/wx/osx/dcprint.h | 2 +- .../wxWidgets3/include/wx/osx/dcscreen.h | 2 +- Externals/wxWidgets3/include/wx/osx/dialog.h | 2 +- Externals/wxWidgets3/include/wx/osx/dirdlg.h | 2 +- .../wxWidgets3/include/wx/osx/dvrenderer.h | 33 +- .../wxWidgets3/include/wx/osx/dvrenderers.h | 48 +- Externals/wxWidgets3/include/wx/osx/evtloop.h | 8 +- Externals/wxWidgets3/include/wx/osx/filedlg.h | 2 +- Externals/wxWidgets3/include/wx/osx/font.h | 35 +- Externals/wxWidgets3/include/wx/osx/fontdlg.h | 6 +- Externals/wxWidgets3/include/wx/osx/frame.h | 33 +- .../include/wx/osx/fswatcher_fsevents.h | 88 + Externals/wxWidgets3/include/wx/osx/gauge.h | 6 +- .../wxWidgets3/include/wx/osx/glcanvas.h | 58 +- .../wxWidgets3/include/wx/osx/helpxxxx.h | 48 - Externals/wxWidgets3/include/wx/osx/icon.h | 8 +- .../wxWidgets3/include/wx/osx/imaglist.h | 3 +- .../include/wx/osx/iphone/chkconf.h | 7 + .../include/wx/osx/iphone/private.h | 13 +- .../wxWidgets3/include/wx/osx/joystick.h | 4 +- Externals/wxWidgets3/include/wx/osx/listbox.h | 48 +- .../wxWidgets3/include/wx/osx/listctrl.h | 16 +- Externals/wxWidgets3/include/wx/osx/mdi.h | 24 +- Externals/wxWidgets3/include/wx/osx/menu.h | 11 +- .../wxWidgets3/include/wx/osx/menuitem.h | 2 +- .../wxWidgets3/include/wx/osx/metafile.h | 6 +- .../wxWidgets3/include/wx/osx/minifram.h | 6 +- Externals/wxWidgets3/include/wx/osx/msgdlg.h | 2 +- .../wxWidgets3/include/wx/osx/nonownedwnd.h | 4 +- .../wxWidgets3/include/wx/osx/notebook.h | 45 +- Externals/wxWidgets3/include/wx/osx/palette.h | 2 +- Externals/wxWidgets3/include/wx/osx/pen.h | 15 +- Externals/wxWidgets3/include/wx/osx/pnghand.h | 38 - Externals/wxWidgets3/include/wx/osx/pngread.h | 287 -- .../wxWidgets3/include/wx/osx/popupwin.h | 4 +- .../wxWidgets3/include/wx/osx/printdlg.h | 6 +- .../wxWidgets3/include/wx/osx/printmac.h | 8 +- Externals/wxWidgets3/include/wx/osx/private.h | 2 - .../include/wx/osx/private/addremovectrl.h | 117 + .../include/wx/osx/private/glgrab.h | 13 - .../wxWidgets3/include/wx/osx/private/print.h | 4 - .../wxWidgets3/include/wx/osx/private/timer.h | 8 - .../wxWidgets3/include/wx/osx/radiobox.h | 50 +- .../wxWidgets3/include/wx/osx/radiobut.h | 20 +- .../wxWidgets3/include/wx/osx/scrolbar.h | 24 +- Externals/wxWidgets3/include/wx/osx/setup0.h | 136 +- Externals/wxWidgets3/include/wx/osx/slider.h | 74 +- Externals/wxWidgets3/include/wx/osx/sound.h | 6 +- .../wxWidgets3/include/wx/osx/spinbutt.h | 2 +- .../wxWidgets3/include/wx/osx/spinctrl.h | 192 - .../wxWidgets3/include/wx/osx/srchctrl.h | 22 +- Externals/wxWidgets3/include/wx/osx/statbmp.h | 4 - Externals/wxWidgets3/include/wx/osx/statbox.h | 13 +- .../wxWidgets3/include/wx/osx/statline.h | 2 +- .../wxWidgets3/include/wx/osx/stattext.h | 2 +- .../wxWidgets3/include/wx/osx/statusbr.h | 12 +- .../wxWidgets3/include/wx/osx/taskbarosx.h | 2 +- .../wxWidgets3/include/wx/osx/textctrl.h | 50 +- .../wxWidgets3/include/wx/osx/textentry.h | 2 + Externals/wxWidgets3/include/wx/osx/tglbtn.h | 4 +- Externals/wxWidgets3/include/wx/osx/toolbar.h | 60 +- Externals/wxWidgets3/include/wx/osx/tooltip.h | 2 +- .../wxWidgets3/include/wx/osx/toplevel.h | 51 +- .../wxWidgets3/include/wx/osx/treectrl.h | 306 -- Externals/wxWidgets3/include/wx/osx/uma.h | 3 - .../include/wx/osx/webview_webkit.h | 110 +- .../wx/osx/webviewhistoryitem_webkit.h | 5 +- Externals/wxWidgets3/include/wx/osx/window.h | 135 +- Externals/wxWidgets3/include/wx/overlay.h | 4 +- Externals/wxWidgets3/include/wx/ownerdrw.h | 2 - Externals/wxWidgets3/include/wx/palette.h | 6 +- Externals/wxWidgets3/include/wx/panel.h | 2 +- Externals/wxWidgets3/include/wx/paper.h | 4 +- Externals/wxWidgets3/include/wx/pen.h | 20 +- Externals/wxWidgets3/include/wx/persist.h | 13 +- .../wxWidgets3/include/wx/persist/bookctrl.h | 6 +- .../wxWidgets3/include/wx/persist/splitter.h | 6 +- .../wxWidgets3/include/wx/persist/toplevel.h | 23 +- .../wxWidgets3/include/wx/persist/treebook.h | 6 +- .../wxWidgets3/include/wx/persist/window.h | 9 +- Externals/wxWidgets3/include/wx/pickerbase.h | 26 +- Externals/wxWidgets3/include/wx/platform.h | 199 +- Externals/wxWidgets3/include/wx/platinfo.h | 74 +- Externals/wxWidgets3/include/wx/popupwin.h | 18 +- Externals/wxWidgets3/include/wx/power.h | 45 +- Externals/wxWidgets3/include/wx/preferences.h | 4 +- Externals/wxWidgets3/include/wx/print.h | 4 +- Externals/wxWidgets3/include/wx/printdlg.h | 8 +- .../include/wx/private/addremovectrl.h | 154 + .../wx/private/eventloopsourcesmanager.h | 8 +- .../include/wx/private/fdiodispatcher.h | 6 +- .../wx/private/fdioeventloopsourcehandler.h | 6 +- .../wxWidgets3/include/wx/private/fileback.h | 10 +- .../wxWidgets3/include/wx/private/fswatcher.h | 10 +- .../include/wx/private/launchbrowser.h | 43 + .../include/wx/private/markupparserattr.h | 32 +- .../wxWidgets3/include/wx/private/notifmsg.h | 76 + .../include/wx/private/pipestream.h | 4 +- .../wxWidgets3/include/wx/private/sckaddr.h | 13 +- .../include/wx/private/selectdispatcher.h | 25 +- .../wxWidgets3/include/wx/private/socket.h | 9 +- .../include/wx/private/textmeasure.h | 22 +- .../wxWidgets3/include/wx/private/wxprintf.h | 9 +- Externals/wxWidgets3/include/wx/prntbase.h | 122 +- Externals/wxWidgets3/include/wx/process.h | 12 +- Externals/wxWidgets3/include/wx/progdlg.h | 16 +- .../wxWidgets3/include/wx/protocol/file.h | 8 +- .../wxWidgets3/include/wx/protocol/ftp.h | 14 +- .../wxWidgets3/include/wx/protocol/http.h | 12 +- .../wxWidgets3/include/wx/protocol/protocol.h | 12 +- Externals/wxWidgets3/include/wx/quantize.h | 2 +- Externals/wxWidgets3/include/wx/radiobox.h | 6 +- Externals/wxWidgets3/include/wx/radiobut.h | 6 +- Externals/wxWidgets3/include/wx/rawbmp.h | 47 +- .../wxWidgets3/include/wx/rearrangectrl.h | 8 +- Externals/wxWidgets3/include/wx/region.h | 9 +- Externals/wxWidgets3/include/wx/renderer.h | 55 + Externals/wxWidgets3/include/wx/richmsgdlg.h | 4 +- Externals/wxWidgets3/include/wx/rtti.h | 4 +- Externals/wxWidgets3/include/wx/sckaddr.h | 30 +- Externals/wxWidgets3/include/wx/sckipc.h | 30 +- Externals/wxWidgets3/include/wx/sckstrm.h | 12 +- Externals/wxWidgets3/include/wx/scopedarray.h | 3 +- Externals/wxWidgets3/include/wx/scopedptr.h | 2 +- Externals/wxWidgets3/include/wx/scopeguard.h | 26 - Externals/wxWidgets3/include/wx/scrolbar.h | 6 +- Externals/wxWidgets3/include/wx/scrolwin.h | 31 +- Externals/wxWidgets3/include/wx/selstore.h | 30 +- .../wxWidgets3/include/wx/setup_gccxml.h | 23 - Externals/wxWidgets3/include/wx/setup_inc.h | 132 +- Externals/wxWidgets3/include/wx/simplebook.h | 38 +- Externals/wxWidgets3/include/wx/sizer.h | 97 +- Externals/wxWidgets3/include/wx/slider.h | 13 +- Externals/wxWidgets3/include/wx/socket.h | 14 +- Externals/wxWidgets3/include/wx/sound.h | 4 - Externals/wxWidgets3/include/wx/spinbutt.h | 10 +- Externals/wxWidgets3/include/wx/spinctrl.h | 13 +- Externals/wxWidgets3/include/wx/splitter.h | 6 - Externals/wxWidgets3/include/wx/srchctrl.h | 2 +- Externals/wxWidgets3/include/wx/sstream.h | 16 +- Externals/wxWidgets3/include/wx/statbmp.h | 24 +- Externals/wxWidgets3/include/wx/statbox.h | 12 +- Externals/wxWidgets3/include/wx/statline.h | 12 +- Externals/wxWidgets3/include/wx/stattext.h | 23 +- Externals/wxWidgets3/include/wx/statusbr.h | 10 +- Externals/wxWidgets3/include/wx/stdpaths.h | 25 +- Externals/wxWidgets3/include/wx/stdstream.h | 26 +- Externals/wxWidgets3/include/wx/stopwatch.h | 12 - Externals/wxWidgets3/include/wx/strconv.h | 141 +- Externals/wxWidgets3/include/wx/stream.h | 101 +- Externals/wxWidgets3/include/wx/string.h | 237 +- Externals/wxWidgets3/include/wx/stringimpl.h | 13 +- Externals/wxWidgets3/include/wx/strvararg.h | 69 +- .../wxWidgets3/include/wx/systhemectrl.h | 66 + Externals/wxWidgets3/include/wx/tarstrm.h | 88 +- Externals/wxWidgets3/include/wx/taskbar.h | 10 +- .../wxWidgets3/include/wx/taskbarbutton.h | 253 ++ Externals/wxWidgets3/include/wx/tbarbase.h | 14 +- Externals/wxWidgets3/include/wx/testing.h | 223 +- Externals/wxWidgets3/include/wx/textctrl.h | 69 +- Externals/wxWidgets3/include/wx/textentry.h | 16 +- Externals/wxWidgets3/include/wx/textfile.h | 10 +- Externals/wxWidgets3/include/wx/textwrapper.h | 2 +- Externals/wxWidgets3/include/wx/tglbtn.h | 20 +- Externals/wxWidgets3/include/wx/thread.h | 31 +- Externals/wxWidgets3/include/wx/thrimpl.cpp | 4 +- Externals/wxWidgets3/include/wx/time.h | 4 +- Externals/wxWidgets3/include/wx/timer.h | 6 +- Externals/wxWidgets3/include/wx/tipdlg.h | 11 +- Externals/wxWidgets3/include/wx/tipwin.h | 4 +- Externals/wxWidgets3/include/wx/tls.h | 8 +- Externals/wxWidgets3/include/wx/tokenzr.h | 5 + Externals/wxWidgets3/include/wx/toolbar.h | 12 +- Externals/wxWidgets3/include/wx/toolbook.h | 32 +- Externals/wxWidgets3/include/wx/tooltip.h | 6 +- Externals/wxWidgets3/include/wx/toplevel.h | 87 +- Externals/wxWidgets3/include/wx/translation.h | 10 +- Externals/wxWidgets3/include/wx/treebase.h | 24 +- Externals/wxWidgets3/include/wx/treebook.h | 34 +- Externals/wxWidgets3/include/wx/treectrl.h | 25 +- Externals/wxWidgets3/include/wx/treelist.h | 5 +- Externals/wxWidgets3/include/wx/txtstrm.h | 46 +- Externals/wxWidgets3/include/wx/uiaction.h | 3 + Externals/wxWidgets3/include/wx/unichar.h | 30 + Externals/wxWidgets3/include/wx/unix/app.h | 2 +- .../wxWidgets3/include/wx/unix/apptbase.h | 2 +- .../wxWidgets3/include/wx/unix/apptrait.h | 37 +- .../wxWidgets3/include/wx/unix/evtloop.h | 14 +- .../wxWidgets3/include/wx/unix/fontutil.h | 6 +- Externals/wxWidgets3/include/wx/unix/glx11.h | 39 +- .../wxWidgets3/include/wx/unix/joystick.h | 4 +- .../wxWidgets3/include/wx/unix/mimetype.h | 3 +- .../include/wx/unix/{ => private}/execute.h | 2 +- .../include/wx/unix/private/wakeuppipe.h | 10 +- Externals/wxWidgets3/include/wx/unix/sound.h | 2 +- .../wxWidgets3/include/wx/unix/stackwalk.h | 6 +- .../wxWidgets3/include/wx/unix/stdpaths.h | 18 +- .../wxWidgets3/include/wx/unix/taskbarx11.h | 8 +- .../wxWidgets3/include/wx/unix/utilsx11.h | 7 + Externals/wxWidgets3/include/wx/uri.h | 8 +- Externals/wxWidgets3/include/wx/url.h | 6 +- Externals/wxWidgets3/include/wx/ustring.h | 100 +- Externals/wxWidgets3/include/wx/utils.h | 29 +- Externals/wxWidgets3/include/wx/valgen.h | 10 +- Externals/wxWidgets3/include/wx/validate.h | 5 +- Externals/wxWidgets3/include/wx/valnum.h | 12 +- Externals/wxWidgets3/include/wx/valtext.h | 12 +- Externals/wxWidgets3/include/wx/variant.h | 20 +- Externals/wxWidgets3/include/wx/variantbase.h | 12 +- Externals/wxWidgets3/include/wx/vector.h | 9 +- Externals/wxWidgets3/include/wx/version.h | 4 +- Externals/wxWidgets3/include/wx/vlbox.h | 10 +- Externals/wxWidgets3/include/wx/vscroll.h | 44 +- Externals/wxWidgets3/include/wx/weakref.h | 253 +- Externals/wxWidgets3/include/wx/webview.h | 6 +- .../include/wx/webviewarchivehandler.h | 2 +- .../wxWidgets3/include/wx/webviewfshandler.h | 2 +- Externals/wxWidgets3/include/wx/wfstream.h | 88 +- Externals/wxWidgets3/include/wx/window.h | 147 +- Externals/wxWidgets3/include/wx/wizard.h | 24 +- Externals/wxWidgets3/include/wx/wrapsizer.h | 8 +- Externals/wxWidgets3/include/wx/wx_cw.h | 65 - Externals/wxWidgets3/include/wx/wx_cw_cm.h | 88 - Externals/wxWidgets3/include/wx/wx_cw_d.h | 46 - Externals/wxWidgets3/include/wx/wx_cwc.h | 49 - Externals/wxWidgets3/include/wx/wx_cwc_d.h | 38 - Externals/wxWidgets3/include/wx/wx_cwcocoa.h | 66 - .../wxWidgets3/include/wx/wx_cwcocoa_cm.h | 85 - .../wxWidgets3/include/wx/wx_cwcocoa_d.h | 47 - Externals/wxWidgets3/include/wx/wx_cwu_d.h | 46 - Externals/wxWidgets3/include/wx/wxcrt.h | 18 +- Externals/wxWidgets3/include/wx/wxcrtbase.h | 228 +- Externals/wxWidgets3/include/wx/wxcrtvararg.h | 44 +- Externals/wxWidgets3/include/wx/wxprec.h | 18 +- Externals/wxWidgets3/include/wx/wxshlb_cw.h | 65 - Externals/wxWidgets3/include/wx/wxshlb_cw_d.h | 46 - Externals/wxWidgets3/include/wx/wxshlb_cwc.h | 45 - .../wxWidgets3/include/wx/wxshlb_cwc_d.h | 38 - Externals/wxWidgets3/include/wx/wxshlba_cw.h | 65 - .../wxWidgets3/include/wx/wxshlba_cw_d.h | 46 - Externals/wxWidgets3/include/wx/wxshlba_cwc.h | 45 - .../wxWidgets3/include/wx/wxshlba_cwc_d.h | 38 - Externals/wxWidgets3/include/wx/x11/app.h | 105 + Externals/wxWidgets3/include/wx/x11/bitmap.h | 148 + Externals/wxWidgets3/include/wx/x11/brush.h | 63 + Externals/wxWidgets3/include/wx/x11/chkconf.h | 30 + Externals/wxWidgets3/include/wx/x11/clipbrd.h | 76 + Externals/wxWidgets3/include/wx/x11/colour.h | 70 + Externals/wxWidgets3/include/wx/x11/cursor.h | 53 + .../wxWidgets3/include/wx/x11/dataform.h | 63 + Externals/wxWidgets3/include/wx/x11/dataobj.h | 28 + .../include/wx/{cocoa => x11}/dataobj2.h | 68 +- Externals/wxWidgets3/include/wx/x11/dc.h | 52 + .../wxWidgets3/include/wx/x11/dcclient.h | 180 + .../wxWidgets3/include/wx/x11/dcmemory.h | 44 + Externals/wxWidgets3/include/wx/x11/dcprint.h | 28 + .../wxWidgets3/include/wx/x11/dcscreen.h | 36 + Externals/wxWidgets3/include/wx/x11/dnd.h | 171 + .../include/wx/{cocoa => x11}/font.h | 145 +- .../wxWidgets3/include/wx/x11/glcanvas.h | 68 + .../wxWidgets3/include/wx/x11/joystick.h | 88 + .../wxWidgets3/include/wx/x11/minifram.h | 41 + .../include/wx/x11/nanox/X11/Xatom.h | 6 + .../include/wx/x11/nanox/X11/Xlib.h | 356 ++ .../include/wx/x11/nanox/X11/Xutil.h | 5 + Externals/wxWidgets3/include/wx/x11/palette.h | 75 + Externals/wxWidgets3/include/wx/x11/pen.h | 76 + .../wxWidgets3/include/wx/x11/popupwin.h | 45 + Externals/wxWidgets3/include/wx/x11/print.h | 51 + Externals/wxWidgets3/include/wx/x11/private.h | 83 + Externals/wxWidgets3/include/wx/x11/privx.h | 169 + Externals/wxWidgets3/include/wx/x11/region.h | 122 + .../wxWidgets3/include/wx/x11/reparent.h | 66 + .../wxWidgets3/include/wx/x11/textctrl.h | 384 ++ .../wxWidgets3/include/wx/x11/toplevel.h | 116 + Externals/wxWidgets3/include/wx/x11/window.h | 221 + Externals/wxWidgets3/include/wx/xlocale.h | 8 +- Externals/wxWidgets3/include/wx/xpmhand.h | 7 +- Externals/wxWidgets3/include/wx/xti.h | 2 +- Externals/wxWidgets3/include/wx/xti2.h | 4 +- Externals/wxWidgets3/include/wx/xtiprop.h | 8 +- Externals/wxWidgets3/include/wx/zipstrm.h | 102 +- Externals/wxWidgets3/include/wx/zstream.h | 46 +- Externals/wxWidgets3/src/aui/auibar.cpp | 121 +- Externals/wxWidgets3/src/aui/auibook.cpp | 83 +- Externals/wxWidgets3/src/aui/barartmsw.cpp | 506 +++ Externals/wxWidgets3/src/aui/dockart.cpp | 48 +- Externals/wxWidgets3/src/aui/floatpane.cpp | 22 +- Externals/wxWidgets3/src/aui/framemanager.cpp | 76 +- Externals/wxWidgets3/src/aui/tabart.cpp | 31 +- Externals/wxWidgets3/src/aui/tabartmsw.cpp | 501 +++ Externals/wxWidgets3/src/aui/tabmdi.cpp | 18 +- Externals/wxWidgets3/src/common/accelcmn.cpp | 139 +- .../wxWidgets3/src/common/addremovectrl.cpp | 92 + .../wxWidgets3/src/common/animatecmn.cpp | 4 +- Externals/wxWidgets3/src/common/any.cpp | 28 +- Externals/wxWidgets3/src/common/appbase.cpp | 172 +- Externals/wxWidgets3/src/common/appcmn.cpp | 9 +- Externals/wxWidgets3/src/common/archive.cpp | 4 +- Externals/wxWidgets3/src/common/arrstr.cpp | 32 +- Externals/wxWidgets3/src/common/artprov.cpp | 70 +- Externals/wxWidgets3/src/common/artstd.cpp | 6 +- Externals/wxWidgets3/src/common/arttango.cpp | 6 +- Externals/wxWidgets3/src/common/base64.cpp | 2 +- Externals/wxWidgets3/src/common/bmpbase.cpp | 14 +- Externals/wxWidgets3/src/common/bmpbtncmn.cpp | 7 +- Externals/wxWidgets3/src/common/bookctrl.cpp | 20 +- Externals/wxWidgets3/src/common/btncmn.cpp | 2 +- Externals/wxWidgets3/src/common/cairo.cpp | 39 +- .../wxWidgets3/src/common/calctrlcmn.cpp | 6 +- .../wxWidgets3/src/common/checkboxcmn.cpp | 2 +- .../wxWidgets3/src/common/checklstcmn.cpp | 2 +- Externals/wxWidgets3/src/common/choiccmn.cpp | 2 +- Externals/wxWidgets3/src/common/clipcmn.cpp | 10 +- .../wxWidgets3/src/common/clrpickercmn.cpp | 4 +- Externals/wxWidgets3/src/common/cmdline.cpp | 417 +- Externals/wxWidgets3/src/common/cmdproc.cpp | 7 +- Externals/wxWidgets3/src/common/cmndata.cpp | 6 +- Externals/wxWidgets3/src/common/colourcmn.cpp | 19 +- .../wxWidgets3/src/common/colourdata.cpp | 15 +- Externals/wxWidgets3/src/common/combocmn.cpp | 110 +- Externals/wxWidgets3/src/common/config.cpp | 8 +- Externals/wxWidgets3/src/common/containr.cpp | 2 +- Externals/wxWidgets3/src/common/cshelp.cpp | 35 +- Externals/wxWidgets3/src/common/ctrlcmn.cpp | 3 + Externals/wxWidgets3/src/common/ctrlsub.cpp | 4 +- Externals/wxWidgets3/src/common/datavcmn.cpp | 526 ++- Externals/wxWidgets3/src/common/datetime.cpp | 97 +- .../wxWidgets3/src/common/datetimefmt.cpp | 83 +- Externals/wxWidgets3/src/common/dcbase.cpp | 319 +- Externals/wxWidgets3/src/common/dcbufcmn.cpp | 43 +- Externals/wxWidgets3/src/common/dcgraph.cpp | 239 +- Externals/wxWidgets3/src/common/dcsvg.cpp | 213 +- Externals/wxWidgets3/src/common/debugrpt.cpp | 7 +- Externals/wxWidgets3/src/common/descrip.mms | 15 +- Externals/wxWidgets3/src/common/dircmn.cpp | 20 +- .../wxWidgets3/src/common/dirctrlcmn.cpp | 2 +- Externals/wxWidgets3/src/common/dlgcmn.cpp | 81 +- Externals/wxWidgets3/src/common/dobjcmn.cpp | 4 +- Externals/wxWidgets3/src/common/docmdi.cpp | 4 +- Externals/wxWidgets3/src/common/docview.cpp | 88 +- Externals/wxWidgets3/src/common/dpycmn.cpp | 20 +- Externals/wxWidgets3/src/common/dummy.cpp | 4 - Externals/wxWidgets3/src/common/dynlib.cpp | 44 +- Externals/wxWidgets3/src/common/dynload.cpp | 8 +- Externals/wxWidgets3/src/common/effects.cpp | 2 +- Externals/wxWidgets3/src/common/emptydmy.cpp | 3 - Externals/wxWidgets3/src/common/encconv.cpp | 34 +- Externals/wxWidgets3/src/common/event.cpp | 337 +- .../wxWidgets3/src/common/evtloopcmn.cpp | 96 +- Externals/wxWidgets3/src/common/execcmn.cpp | 126 - Externals/wxWidgets3/src/common/extended.c | 12 - Externals/wxWidgets3/src/common/fddlgcmn.cpp | 2 +- .../wxWidgets3/src/common/fdiodispatcher.cpp | 8 +- Externals/wxWidgets3/src/common/ffile.cpp | 38 +- Externals/wxWidgets3/src/common/file.cpp | 78 +- Externals/wxWidgets3/src/common/fileconf.cpp | 16 +- .../wxWidgets3/src/common/filectrlcmn.cpp | 4 +- Externals/wxWidgets3/src/common/filefn.cpp | 264 +- .../wxWidgets3/src/common/filehistorycmn.cpp | 35 +- Externals/wxWidgets3/src/common/filename.cpp | 391 +- .../wxWidgets3/src/common/filepickercmn.cpp | 6 +- Externals/wxWidgets3/src/common/filesys.cpp | 94 +- Externals/wxWidgets3/src/common/fldlgcmn.cpp | 80 +- Externals/wxWidgets3/src/common/fmapbase.cpp | 8 +- Externals/wxWidgets3/src/common/fontcmn.cpp | 30 +- Externals/wxWidgets3/src/common/fontdata.cpp | 2 +- .../wxWidgets3/src/common/fontenumcmn.cpp | 6 +- .../wxWidgets3/src/common/fontmgrcmn.cpp | 7 +- .../wxWidgets3/src/common/fontpickercmn.cpp | 14 +- Externals/wxWidgets3/src/common/framecmn.cpp | 33 +- Externals/wxWidgets3/src/common/fs_arc.cpp | 14 +- Externals/wxWidgets3/src/common/fs_inet.cpp | 8 +- .../wxWidgets3/src/common/fswatchercmn.cpp | 21 +- Externals/wxWidgets3/src/common/ftp.cpp | 20 +- Externals/wxWidgets3/src/common/gaugecmn.cpp | 65 +- Externals/wxWidgets3/src/common/gbsizer.cpp | 4 +- Externals/wxWidgets3/src/common/gdicmn.cpp | 82 +- Externals/wxWidgets3/src/common/gifdecod.cpp | 44 +- Externals/wxWidgets3/src/common/glcmn.cpp | 234 +- Externals/wxWidgets3/src/common/graphcmn.cpp | 33 +- Externals/wxWidgets3/src/common/gridcmn.cpp | 2 +- .../wxWidgets3/src/common/headerctrlcmn.cpp | 44 +- Externals/wxWidgets3/src/common/helpbase.cpp | 2 +- Externals/wxWidgets3/src/common/http.cpp | 30 +- .../wxWidgets3/src/common/hyperlnkcmn.cpp | 4 +- Externals/wxWidgets3/src/common/iconbndl.cpp | 11 +- Externals/wxWidgets3/src/common/imagbmp.cpp | 449 +- Externals/wxWidgets3/src/common/image.cpp | 76 +- Externals/wxWidgets3/src/common/imaggif.cpp | 82 +- Externals/wxWidgets3/src/common/imagiff.cpp | 3 +- Externals/wxWidgets3/src/common/imagjpeg.cpp | 23 +- Externals/wxWidgets3/src/common/imagpcx.cpp | 2 +- Externals/wxWidgets3/src/common/imagpng.cpp | 288 +- Externals/wxWidgets3/src/common/imagpnm.cpp | 2 +- Externals/wxWidgets3/src/common/imagtga.cpp | 14 +- Externals/wxWidgets3/src/common/imagtiff.cpp | 9 +- Externals/wxWidgets3/src/common/imagxpm.cpp | 2 +- Externals/wxWidgets3/src/common/init.cpp | 51 +- Externals/wxWidgets3/src/common/intl.cpp | 318 +- .../wxWidgets3/src/common/languageinfo.cpp | 13 +- Externals/wxWidgets3/src/common/layout.cpp | 4 +- Externals/wxWidgets3/src/common/lboxcmn.cpp | 31 +- Externals/wxWidgets3/src/common/list.cpp | 9 - .../wxWidgets3/src/common/listctrlcmn.cpp | 14 +- Externals/wxWidgets3/src/common/log.cpp | 26 +- Externals/wxWidgets3/src/common/longlong.cpp | 16 - .../wxWidgets3/src/common/markupparser.cpp | 36 +- .../wxWidgets3/src/common/mediactrlcmn.cpp | 19 +- Externals/wxWidgets3/src/common/memory.cpp | 18 +- Externals/wxWidgets3/src/common/menucmn.cpp | 84 +- Externals/wxWidgets3/src/common/mimecmn.cpp | 20 +- .../wxWidgets3/src/common/mousemanager.cpp | 4 +- Externals/wxWidgets3/src/common/msgout.cpp | 9 +- Externals/wxWidgets3/src/common/mstream.cpp | 4 +- Externals/wxWidgets3/src/common/nbkbase.cpp | 4 +- .../wxWidgets3/src/common/notifmsgcmn.cpp | 103 + .../wxWidgets3/src/common/numformatter.cpp | 16 +- Externals/wxWidgets3/src/common/object.cpp | 29 +- .../wxWidgets3/src/common/overlaycmn.cpp | 11 +- Externals/wxWidgets3/src/common/panelcmn.cpp | 7 +- Externals/wxWidgets3/src/common/paper.cpp | 14 +- .../wxWidgets3/src/common/pickerbase.cpp | 2 +- Externals/wxWidgets3/src/common/platinfo.cpp | 33 +- Externals/wxWidgets3/src/common/popupcmn.cpp | 30 +- Externals/wxWidgets3/src/common/powercmn.cpp | 18 +- .../wxWidgets3/src/common/preferencescmn.cpp | 9 +- Externals/wxWidgets3/src/common/prntbase.cpp | 112 +- Externals/wxWidgets3/src/common/process.cpp | 18 +- Externals/wxWidgets3/src/common/protocol.cpp | 12 +- Externals/wxWidgets3/src/common/quantize.cpp | 124 +- .../wxWidgets3/src/common/radiobtncmn.cpp | 2 +- Externals/wxWidgets3/src/common/radiocmn.cpp | 4 +- .../wxWidgets3/src/common/rearrangectrl.cpp | 34 +- Externals/wxWidgets3/src/common/regex.cpp | 9 +- Externals/wxWidgets3/src/common/sckaddr.cpp | 65 +- Externals/wxWidgets3/src/common/sckfile.cpp | 2 +- Externals/wxWidgets3/src/common/sckipc.cpp | 20 +- .../wxWidgets3/src/common/scrolbarcmn.cpp | 2 +- .../src/common/selectdispatcher.cpp | 6 + Externals/wxWidgets3/src/common/sizer.cpp | 219 +- Externals/wxWidgets3/src/common/slidercmn.cpp | 2 +- Externals/wxWidgets3/src/common/socket.cpp | 24 +- .../wxWidgets3/src/common/spinbtncmn.cpp | 4 +- .../wxWidgets3/src/common/spinctrlcmn.cpp | 2 +- Externals/wxWidgets3/src/common/statbar.cpp | 2 +- .../wxWidgets3/src/common/statbmpcmn.cpp | 2 +- .../wxWidgets3/src/common/statboxcmn.cpp | 2 +- .../wxWidgets3/src/common/statlinecmn.cpp | 2 +- .../wxWidgets3/src/common/stattextcmn.cpp | 17 +- Externals/wxWidgets3/src/common/stdpbase.cpp | 10 +- Externals/wxWidgets3/src/common/stdstream.cpp | 25 - Externals/wxWidgets3/src/common/stopwatch.cpp | 64 +- Externals/wxWidgets3/src/common/strconv.cpp | 363 +- Externals/wxWidgets3/src/common/stream.cpp | 33 +- Externals/wxWidgets3/src/common/string.cpp | 78 +- .../wxWidgets3/src/common/stringimpl.cpp | 38 +- Externals/wxWidgets3/src/common/stringops.cpp | 2 +- Externals/wxWidgets3/src/common/strvararg.cpp | 58 +- Externals/wxWidgets3/src/common/tarstrm.cpp | 8 +- .../wxWidgets3/src/common/taskbarcmn.cpp | 4 +- Externals/wxWidgets3/src/common/tbarbase.cpp | 14 +- Externals/wxWidgets3/src/common/textbuf.cpp | 8 +- Externals/wxWidgets3/src/common/textcmn.cpp | 47 +- .../wxWidgets3/src/common/textentrycmn.cpp | 72 +- Externals/wxWidgets3/src/common/textfile.cpp | 122 +- .../wxWidgets3/src/common/threadinfo.cpp | 23 +- Externals/wxWidgets3/src/common/time.cpp | 58 +- Externals/wxWidgets3/src/common/timercmn.cpp | 2 +- Externals/wxWidgets3/src/common/tokenzr.cpp | 30 +- Externals/wxWidgets3/src/common/toplvcmn.cpp | 44 +- .../wxWidgets3/src/common/translation.cpp | 59 +- Externals/wxWidgets3/src/common/treebase.cpp | 6 +- Externals/wxWidgets3/src/common/txtstrm.cpp | 195 +- .../wxWidgets3/src/common/uiactioncmn.cpp | 160 +- Externals/wxWidgets3/src/common/uri.cpp | 71 +- Externals/wxWidgets3/src/common/url.cpp | 16 +- Externals/wxWidgets3/src/common/utilscmn.cpp | 261 +- Externals/wxWidgets3/src/common/valgen.cpp | 2 +- Externals/wxWidgets3/src/common/validate.cpp | 2 +- Externals/wxWidgets3/src/common/valnum.cpp | 4 +- Externals/wxWidgets3/src/common/valtext.cpp | 61 +- Externals/wxWidgets3/src/common/variant.cpp | 188 +- Externals/wxWidgets3/src/common/webview.cpp | 2 +- Externals/wxWidgets3/src/common/wincmn.cpp | 152 +- Externals/wxWidgets3/src/common/windowid.cpp | 17 - Externals/wxWidgets3/src/common/wrapsizer.cpp | 46 +- Externals/wxWidgets3/src/common/wxcrt.cpp | 198 +- Externals/wxWidgets3/src/common/xlocale.cpp | 10 +- Externals/wxWidgets3/src/common/xtistrm.cpp | 42 +- Externals/wxWidgets3/src/common/zipstrm.cpp | 467 +- Externals/wxWidgets3/src/common/zstream.cpp | 8 +- Externals/wxWidgets3/src/generic/accel.cpp | 2 +- .../src/generic/activityindicator.cpp | 261 ++ Externals/wxWidgets3/src/generic/animateg.cpp | 18 +- .../wxWidgets3/src/generic/bannerwindow.cpp | 4 +- Externals/wxWidgets3/src/generic/bmpcboxg.cpp | 13 +- Externals/wxWidgets3/src/generic/busyinfo.cpp | 189 +- .../wxWidgets3/src/generic/buttonbar.cpp | 6 +- Externals/wxWidgets3/src/generic/calctrlg.cpp | 75 +- Externals/wxWidgets3/src/generic/choicbkg.cpp | 22 +- Externals/wxWidgets3/src/generic/choicdgg.cpp | 176 +- .../wxWidgets3/src/generic/clrpickerg.cpp | 2 +- .../src/generic/collheaderctrlg.cpp | 197 + .../wxWidgets3/src/generic/collpaneg.cpp | 69 +- Externals/wxWidgets3/src/generic/colrdlgg.cpp | 367 +- Externals/wxWidgets3/src/generic/combog.cpp | 15 +- .../src/generic/commandlinkbuttong.cpp | 2 +- Externals/wxWidgets3/src/generic/datavgen.cpp | 1380 +++--- Externals/wxWidgets3/src/generic/datectlg.cpp | 42 +- Externals/wxWidgets3/src/generic/dbgrptg.cpp | 20 +- Externals/wxWidgets3/src/generic/dcpsg.cpp | 55 +- Externals/wxWidgets3/src/generic/descrip.mms | 7 +- Externals/wxWidgets3/src/generic/dirctrlg.cpp | 239 +- Externals/wxWidgets3/src/generic/dirdlgg.cpp | 35 +- Externals/wxWidgets3/src/generic/dragimgg.cpp | 51 +- Externals/wxWidgets3/src/generic/editlbox.cpp | 138 +- Externals/wxWidgets3/src/generic/fdrepdlg.cpp | 6 +- .../wxWidgets3/src/generic/filectrlg.cpp | 124 +- Externals/wxWidgets3/src/generic/filedlgg.cpp | 68 +- .../wxWidgets3/src/generic/filepickerg.cpp | 4 +- Externals/wxWidgets3/src/generic/fontdlgg.cpp | 84 +- .../wxWidgets3/src/generic/fontpickerg.cpp | 5 +- Externals/wxWidgets3/src/generic/graphicc.cpp | 281 +- Externals/wxWidgets3/src/generic/grid.cpp | 309 +- Externals/wxWidgets3/src/generic/gridctrl.cpp | 59 +- .../wxWidgets3/src/generic/grideditors.cpp | 6 + Externals/wxWidgets3/src/generic/gridsel.cpp | 2 +- .../wxWidgets3/src/generic/headerctrlg.cpp | 4 +- Externals/wxWidgets3/src/generic/helpext.cpp | 10 +- Externals/wxWidgets3/src/generic/htmllbox.cpp | 89 +- .../wxWidgets3/src/generic/hyperlinkg.cpp | 2 +- Externals/wxWidgets3/src/generic/icon.cpp | 2 +- Externals/wxWidgets3/src/generic/imaglist.cpp | 16 +- Externals/wxWidgets3/src/generic/infobar.cpp | 119 +- Externals/wxWidgets3/src/generic/laywin.cpp | 10 +- Externals/wxWidgets3/src/generic/listbkg.cpp | 37 +- Externals/wxWidgets3/src/generic/listctrl.cpp | 320 +- Externals/wxWidgets3/src/generic/logg.cpp | 48 +- .../wxWidgets3/src/generic/markuptext.cpp | 12 +- Externals/wxWidgets3/src/generic/mask.cpp | 2 +- Externals/wxWidgets3/src/generic/mdig.cpp | 14 +- Externals/wxWidgets3/src/generic/msgdlgg.cpp | 10 +- Externals/wxWidgets3/src/generic/notebook.cpp | 8 +- .../wxWidgets3/src/generic/notifmsgg.cpp | 525 ++- Externals/wxWidgets3/src/generic/numdlgg.cpp | 24 +- Externals/wxWidgets3/src/generic/odcombo.cpp | 10 +- Externals/wxWidgets3/src/generic/paletteg.cpp | 2 +- .../wxWidgets3/src/generic/preferencesg.cpp | 9 +- Externals/wxWidgets3/src/generic/printps.cpp | 4 +- Externals/wxWidgets3/src/generic/prntdlgg.cpp | 20 +- Externals/wxWidgets3/src/generic/progdlgg.cpp | 91 +- Externals/wxWidgets3/src/generic/propdlg.cpp | 59 +- Externals/wxWidgets3/src/generic/regiong.cpp | 52 +- Externals/wxWidgets3/src/generic/renderg.cpp | 258 +- .../wxWidgets3/src/generic/richmsgdlgg.cpp | 4 +- .../wxWidgets3/src/generic/richtooltipg.cpp | 2 +- Externals/wxWidgets3/src/generic/sashwin.cpp | 8 +- Externals/wxWidgets3/src/generic/scrlwing.cpp | 24 +- Externals/wxWidgets3/src/generic/selstore.cpp | 102 + Externals/wxWidgets3/src/generic/spinctlg.cpp | 79 +- Externals/wxWidgets3/src/generic/splash.cpp | 10 +- Externals/wxWidgets3/src/generic/splitter.cpp | 33 +- Externals/wxWidgets3/src/generic/srchctlg.cpp | 157 +- Externals/wxWidgets3/src/generic/statbmpg.cpp | 61 +- .../wxWidgets3/src/generic/stattextg.cpp | 24 +- Externals/wxWidgets3/src/generic/statusbr.cpp | 41 +- Externals/wxWidgets3/src/generic/tabg.cpp | 20 +- Externals/wxWidgets3/src/generic/textdlgg.cpp | 65 +- .../wxWidgets3/src/generic/timectrlg.cpp | 10 +- Externals/wxWidgets3/src/generic/timer.cpp | 4 +- Externals/wxWidgets3/src/generic/tipdlg.cpp | 72 +- Externals/wxWidgets3/src/generic/tipwin.cpp | 10 +- Externals/wxWidgets3/src/generic/toolbkg.cpp | 26 +- Externals/wxWidgets3/src/generic/treebkg.cpp | 6 +- Externals/wxWidgets3/src/generic/treectlg.cpp | 94 +- Externals/wxWidgets3/src/generic/treelist.cpp | 72 +- Externals/wxWidgets3/src/generic/vlbox.cpp | 12 +- Externals/wxWidgets3/src/generic/vscroll.cpp | 8 +- Externals/wxWidgets3/src/generic/wizard.cpp | 25 +- Externals/wxWidgets3/src/gtk/aboutdlg.cpp | 9 +- .../wxWidgets3/src/gtk/activityindicator.cpp | 168 + Externals/wxWidgets3/src/gtk/animate.cpp | 8 +- Externals/wxWidgets3/src/gtk/anybutton.cpp | 45 +- Externals/wxWidgets3/src/gtk/app.cpp | 88 +- Externals/wxWidgets3/src/gtk/artgtk.cpp | 14 +- .../wxWidgets3/src/gtk/assertdlg_gtk.cpp | 3 +- Externals/wxWidgets3/src/gtk/bitmap.cpp | 77 +- Externals/wxWidgets3/src/gtk/bmpcbox.cpp | 2 +- Externals/wxWidgets3/src/gtk/brush.cpp | 4 +- Externals/wxWidgets3/src/gtk/checkbox.cpp | 10 +- Externals/wxWidgets3/src/gtk/checklst.cpp | 8 +- Externals/wxWidgets3/src/gtk/choice.cpp | 9 +- Externals/wxWidgets3/src/gtk/clipbrd.cpp | 6 +- Externals/wxWidgets3/src/gtk/clrpicker.cpp | 5 +- Externals/wxWidgets3/src/gtk/collpane.cpp | 21 +- Externals/wxWidgets3/src/gtk/colordlg.cpp | 106 +- Externals/wxWidgets3/src/gtk/combobox.cpp | 27 +- Externals/wxWidgets3/src/gtk/control.cpp | 39 +- Externals/wxWidgets3/src/gtk/cursor.cpp | 135 +- Externals/wxWidgets3/src/gtk/dataobj.cpp | 38 +- Externals/wxWidgets3/src/gtk/dataview.cpp | 594 +-- Externals/wxWidgets3/src/gtk/dc.cpp | 41 +- Externals/wxWidgets3/src/gtk/dcclient.cpp | 73 +- Externals/wxWidgets3/src/gtk/dcmemory.cpp | 2 +- Externals/wxWidgets3/src/gtk/dcscreen.cpp | 2 +- Externals/wxWidgets3/src/gtk/descrip.mms | 8 +- Externals/wxWidgets3/src/gtk/dialog.cpp | 18 +- Externals/wxWidgets3/src/gtk/dirdlg.cpp | 19 +- Externals/wxWidgets3/src/gtk/display.cpp | 239 + Externals/wxWidgets3/src/gtk/evtloop.cpp | 64 +- Externals/wxWidgets3/src/gtk/filectrl.cpp | 2 +- Externals/wxWidgets3/src/gtk/filedlg.cpp | 22 +- Externals/wxWidgets3/src/gtk/filepicker.cpp | 75 +- Externals/wxWidgets3/src/gtk/font.cpp | 27 +- Externals/wxWidgets3/src/gtk/fontdlg.cpp | 11 +- Externals/wxWidgets3/src/gtk/fontpicker.cpp | 6 +- Externals/wxWidgets3/src/gtk/frame.cpp | 48 +- Externals/wxWidgets3/src/gtk/glcanvas.cpp | 37 +- Externals/wxWidgets3/src/gtk/gnome/gprint.cpp | 0 Externals/wxWidgets3/src/gtk/gnome/gvfs.cpp | 4 +- .../wxWidgets3/src/gtk/hildon/notifmsg.cpp | 131 - Externals/wxWidgets3/src/gtk/hyperlink.cpp | 212 +- Externals/wxWidgets3/src/gtk/infobar.cpp | 37 + Externals/wxWidgets3/src/gtk/listbox.cpp | 107 +- Externals/wxWidgets3/src/gtk/mdi.cpp | 10 +- Externals/wxWidgets3/src/gtk/menu.cpp | 93 +- Externals/wxWidgets3/src/gtk/minifram.cpp | 77 +- Externals/wxWidgets3/src/gtk/msgdlg.cpp | 68 +- Externals/wxWidgets3/src/gtk/nativewin.cpp | 42 + Externals/wxWidgets3/src/gtk/nonownedwnd.cpp | 12 +- Externals/wxWidgets3/src/gtk/notebook.cpp | 10 +- Externals/wxWidgets3/src/gtk/notifmsg.cpp | 357 +- Externals/wxWidgets3/src/gtk/pen.cpp | 4 +- Externals/wxWidgets3/src/gtk/popupwin.cpp | 25 +- Externals/wxWidgets3/src/gtk/print.cpp | 487 +- Externals/wxWidgets3/src/gtk/private.cpp | 8 +- Externals/wxWidgets3/src/gtk/radiobox.cpp | 2 +- Externals/wxWidgets3/src/gtk/region.cpp | 4 +- Externals/wxWidgets3/src/gtk/renderer.cpp | 48 +- Externals/wxWidgets3/src/gtk/scrolbar.cpp | 7 +- Externals/wxWidgets3/src/gtk/scrolwin.cpp | 28 +- Externals/wxWidgets3/src/gtk/settings.cpp | 39 +- Externals/wxWidgets3/src/gtk/slider.cpp | 20 +- Externals/wxWidgets3/src/gtk/sockgtk.cpp | 11 +- Externals/wxWidgets3/src/gtk/spinbutt.cpp | 10 +- Externals/wxWidgets3/src/gtk/spinctrl.cpp | 9 +- Externals/wxWidgets3/src/gtk/statbmp.cpp | 12 +- Externals/wxWidgets3/src/gtk/statbox.cpp | 18 +- Externals/wxWidgets3/src/gtk/stattext.cpp | 48 +- Externals/wxWidgets3/src/gtk/taskbar.cpp | 2 +- Externals/wxWidgets3/src/gtk/textctrl.cpp | 112 +- Externals/wxWidgets3/src/gtk/textentry.cpp | 141 +- Externals/wxWidgets3/src/gtk/tglbtn.cpp | 28 +- Externals/wxWidgets3/src/gtk/toolbar.cpp | 23 +- Externals/wxWidgets3/src/gtk/tooltip.cpp | 2 +- Externals/wxWidgets3/src/gtk/toplevel.cpp | 343 +- Externals/wxWidgets3/src/gtk/utilsgtk.cpp | 96 +- .../wxWidgets3/src/gtk/webview_webkit.cpp | 17 +- Externals/wxWidgets3/src/gtk/win_gtk.cpp | 37 +- Externals/wxWidgets3/src/gtk/window.cpp | 823 +++- Externals/wxWidgets3/src/msw/accel.cpp | 2 +- Externals/wxWidgets3/src/msw/anybutton.cpp | 227 +- Externals/wxWidgets3/src/msw/app.cpp | 200 +- Externals/wxWidgets3/src/msw/appprogress.cpp | 104 + Externals/wxWidgets3/src/msw/artmsw.cpp | 21 +- Externals/wxWidgets3/src/msw/bitmap.cpp | 684 +-- Externals/wxWidgets3/src/msw/bmpbuttn.cpp | 4 +- Externals/wxWidgets3/src/msw/bmpcbox.cpp | 145 +- Externals/wxWidgets3/src/msw/brush.cpp | 12 +- Externals/wxWidgets3/src/msw/button.cpp | 38 +- Externals/wxWidgets3/src/msw/calctrl.cpp | 2 +- Externals/wxWidgets3/src/msw/checkbox.cpp | 228 +- Externals/wxWidgets3/src/msw/checklst.cpp | 4 +- Externals/wxWidgets3/src/msw/choice.cpp | 55 +- Externals/wxWidgets3/src/msw/clipbrd.cpp | 18 +- Externals/wxWidgets3/src/msw/colordlg.cpp | 12 +- Externals/wxWidgets3/src/msw/combo.cpp | 25 +- Externals/wxWidgets3/src/msw/combobox.cpp | 61 +- Externals/wxWidgets3/src/msw/control.cpp | 306 +- Externals/wxWidgets3/src/msw/crashrpt.cpp | 2 - Externals/wxWidgets3/src/msw/cursor.cpp | 59 +- Externals/wxWidgets3/src/msw/datecontrols.cpp | 7 - Externals/wxWidgets3/src/msw/datectrl.cpp | 22 +- Externals/wxWidgets3/src/msw/datetimectrl.cpp | 54 +- Externals/wxWidgets3/src/msw/dc.cpp | 1300 +++--- Externals/wxWidgets3/src/msw/dcclient.cpp | 12 +- Externals/wxWidgets3/src/msw/dcmemory.cpp | 2 +- Externals/wxWidgets3/src/msw/dcprint.cpp | 14 +- Externals/wxWidgets3/src/msw/dcscreen.cpp | 2 +- Externals/wxWidgets3/src/msw/dde.cpp | 35 +- Externals/wxWidgets3/src/msw/debughlp.cpp | 413 +- Externals/wxWidgets3/src/msw/dialog.cpp | 113 - Externals/wxWidgets3/src/msw/dialup.cpp | 55 +- Externals/wxWidgets3/src/msw/dib.cpp | 73 +- Externals/wxWidgets3/src/msw/dir.cpp | 15 - Externals/wxWidgets3/src/msw/dirdlg.cpp | 58 +- Externals/wxWidgets3/src/msw/display.cpp | 103 +- Externals/wxWidgets3/src/msw/dlmsw.cpp | 257 +- Externals/wxWidgets3/src/msw/dragimag.cpp | 18 +- Externals/wxWidgets3/src/msw/enhmeta.cpp | 11 +- Externals/wxWidgets3/src/msw/evtloop.cpp | 41 +- .../wxWidgets3/src/msw/evtloopconsole.cpp | 100 +- Externals/wxWidgets3/src/msw/fdrepdlg.cpp | 35 +- Externals/wxWidgets3/src/msw/filedlg.cpp | 92 +- Externals/wxWidgets3/src/msw/font.cpp | 18 +- Externals/wxWidgets3/src/msw/fontdlg.cpp | 7 +- Externals/wxWidgets3/src/msw/fontenum.cpp | 38 +- Externals/wxWidgets3/src/msw/fontutil.cpp | 5 +- Externals/wxWidgets3/src/msw/frame.cpp | 307 +- Externals/wxWidgets3/src/msw/fswatcher.cpp | 34 +- Externals/wxWidgets3/src/msw/gauge.cpp | 18 +- Externals/wxWidgets3/src/msw/gdiimage.cpp | 74 +- Externals/wxWidgets3/src/msw/gdiplus.cpp | 4 +- Externals/wxWidgets3/src/msw/glcanvas.cpp | 1224 ++++-- Externals/wxWidgets3/src/msw/graphics.cpp | 271 +- Externals/wxWidgets3/src/msw/graphicsd2d.cpp | 3907 +++++++++++++++++ Externals/wxWidgets3/src/msw/headerctrl.cpp | 8 +- Externals/wxWidgets3/src/msw/helpbest.cpp | 2 +- Externals/wxWidgets3/src/msw/helpchm.cpp | 6 +- Externals/wxWidgets3/src/msw/helpwin.cpp | 2 +- Externals/wxWidgets3/src/msw/icon.cpp | 6 +- Externals/wxWidgets3/src/msw/imaglist.cpp | 161 +- Externals/wxWidgets3/src/msw/iniconf.cpp | 2 +- Externals/wxWidgets3/src/msw/joystick.cpp | 72 +- Externals/wxWidgets3/src/msw/listbox.cpp | 83 +- Externals/wxWidgets3/src/msw/listctrl.cpp | 323 +- Externals/wxWidgets3/src/msw/main.cpp | 140 +- Externals/wxWidgets3/src/msw/mdi.cpp | 274 +- Externals/wxWidgets3/src/msw/mediactrl_am.cpp | 656 +-- Externals/wxWidgets3/src/msw/mediactrl_qt.cpp | 16 +- .../wxWidgets3/src/msw/mediactrl_wmp10.cpp | 70 +- Externals/wxWidgets3/src/msw/menu.cpp | 565 +-- Externals/wxWidgets3/src/msw/menuitem.cpp | 252 +- Externals/wxWidgets3/src/msw/metafile.cpp | 17 +- Externals/wxWidgets3/src/msw/microwin.c | 364 -- Externals/wxWidgets3/src/msw/mimetype.cpp | 449 +- Externals/wxWidgets3/src/msw/minifram.cpp | 2 +- Externals/wxWidgets3/src/msw/msgdlg.cpp | 80 +- Externals/wxWidgets3/src/msw/mslu.cpp | 236 - Externals/wxWidgets3/src/msw/nativdlg.cpp | 12 +- Externals/wxWidgets3/src/msw/nativewin.cpp | 83 +- Externals/wxWidgets3/src/msw/nonownedwnd.cpp | 5 - Externals/wxWidgets3/src/msw/notebook.cpp | 116 +- Externals/wxWidgets3/src/msw/notifmsg.cpp | 403 +- Externals/wxWidgets3/src/msw/ole/access.cpp | 5 - Externals/wxWidgets3/src/msw/ole/activex.cpp | 43 +- Externals/wxWidgets3/src/msw/ole/automtn.cpp | 15 +- Externals/wxWidgets3/src/msw/ole/dataobj.cpp | 90 +- Externals/wxWidgets3/src/msw/ole/dropsrc.cpp | 7 +- Externals/wxWidgets3/src/msw/ole/droptgt.cpp | 73 +- Externals/wxWidgets3/src/msw/ole/oleutils.cpp | 39 +- .../wxWidgets3/src/msw/ole/safearray.cpp | 4 +- Externals/wxWidgets3/src/msw/ownerdrw.cpp | 4 - Externals/wxWidgets3/src/msw/palette.cpp | 2 +- Externals/wxWidgets3/src/msw/pen.cpp | 32 +- Externals/wxWidgets3/src/msw/penwin.cpp | 113 - Externals/wxWidgets3/src/msw/popupwin.cpp | 16 - Externals/wxWidgets3/src/msw/power.cpp | 88 +- Externals/wxWidgets3/src/msw/printdlg.cpp | 27 +- Externals/wxWidgets3/src/msw/printwin.cpp | 20 +- Externals/wxWidgets3/src/msw/progdlg.cpp | 2 +- Externals/wxWidgets3/src/msw/radiobox.cpp | 39 +- Externals/wxWidgets3/src/msw/radiobut.cpp | 53 +- Externals/wxWidgets3/src/msw/regconf.cpp | 2 +- Externals/wxWidgets3/src/msw/region.cpp | 18 +- Externals/wxWidgets3/src/msw/registry.cpp | 120 +- Externals/wxWidgets3/src/msw/renderer.cpp | 380 +- Externals/wxWidgets3/src/msw/richmsgdlg.cpp | 10 + .../wxWidgets3/src/msw/rt/notifmsgrt.cpp | 545 +++ Externals/wxWidgets3/src/msw/rt/utilsrt.cpp | 259 ++ Externals/wxWidgets3/src/msw/settings.cpp | 187 +- Externals/wxWidgets3/src/msw/slider.cpp | 52 +- Externals/wxWidgets3/src/msw/snglinst.cpp | 2 +- Externals/wxWidgets3/src/msw/sockmsw.cpp | 149 +- Externals/wxWidgets3/src/msw/spinbutt.cpp | 62 +- Externals/wxWidgets3/src/msw/spinctrl.cpp | 105 +- Externals/wxWidgets3/src/msw/stackwalk.cpp | 58 +- Externals/wxWidgets3/src/msw/statbmp.cpp | 82 +- Externals/wxWidgets3/src/msw/statbox.cpp | 91 +- Externals/wxWidgets3/src/msw/statline.cpp | 2 - Externals/wxWidgets3/src/msw/stattext.cpp | 52 +- Externals/wxWidgets3/src/msw/statusbar.cpp | 6 - Externals/wxWidgets3/src/msw/stdpaths.cpp | 182 +- Externals/wxWidgets3/src/msw/systhemectrl.cpp | 35 + Externals/wxWidgets3/src/msw/taskbar.cpp | 91 +- .../wxWidgets3/src/msw/taskbarbutton.cpp | 1554 +++++++ Externals/wxWidgets3/src/msw/textctrl.cpp | 470 +- Externals/wxWidgets3/src/msw/textentry.cpp | 89 +- Externals/wxWidgets3/src/msw/textmeasure.cpp | 22 +- Externals/wxWidgets3/src/msw/tglbtn.cpp | 19 +- Externals/wxWidgets3/src/msw/thread.cpp | 125 +- Externals/wxWidgets3/src/msw/timectrl.cpp | 2 +- Externals/wxWidgets3/src/msw/timer.cpp | 12 +- Externals/wxWidgets3/src/msw/toolbar.cpp | 926 ++-- Externals/wxWidgets3/src/msw/tooltip.cpp | 234 +- Externals/wxWidgets3/src/msw/toplevel.cpp | 563 +-- Externals/wxWidgets3/src/msw/treectrl.cpp | 154 +- Externals/wxWidgets3/src/msw/urlmsw.cpp | 4 +- Externals/wxWidgets3/src/msw/utils.cpp | 801 ++-- Externals/wxWidgets3/src/msw/utilsexc.cpp | 154 +- Externals/wxWidgets3/src/msw/utilsgui.cpp | 91 +- Externals/wxWidgets3/src/msw/utilswin.cpp | 33 +- Externals/wxWidgets3/src/msw/uxtheme.cpp | 14 +- Externals/wxWidgets3/src/msw/volume.cpp | 5 +- Externals/wxWidgets3/src/msw/webview_ie.cpp | 162 +- .../wxWidgets3/src/msw/wince/checklst.cpp | 393 -- .../wxWidgets3/src/msw/wince/choicece.cpp | 553 --- .../wxWidgets3/src/msw/wince/clean_vcp.py | 48 - Externals/wxWidgets3/src/msw/wince/crt.cpp | 81 - .../wxWidgets3/src/msw/wince/filedlgwce.cpp | 135 - .../wxWidgets3/src/msw/wince/filefnwce.cpp | 216 - .../wxWidgets3/src/msw/wince/helpwce.cpp | 122 - Externals/wxWidgets3/src/msw/wince/menuce.cpp | 272 -- Externals/wxWidgets3/src/msw/wince/net.cpp | 184 - .../wxWidgets3/src/msw/wince/tbarwce.cpp | 652 --- .../wxWidgets3/src/msw/wince/textctrlce.cpp | 1207 ----- Externals/wxWidgets3/src/msw/wince/time.cpp | 761 ---- Externals/wxWidgets3/src/msw/window.cpp | 1066 ++--- Externals/wxWidgets3/src/osx/accel.cpp | 2 +- .../wxWidgets3/src/osx/anybutton_osx.cpp | 4 +- Externals/wxWidgets3/src/osx/artmac.cpp | 6 +- Externals/wxWidgets3/src/osx/brush.cpp | 4 +- Externals/wxWidgets3/src/osx/button_osx.cpp | 67 +- .../wxWidgets3/src/osx/carbon/Info.plist.in | 6 +- .../wxWidgets3/src/osx/carbon/aboutdlg.cpp | 87 - .../wxWidgets3/src/osx/carbon/anybutton.cpp | 122 - Externals/wxWidgets3/src/osx/carbon/app.cpp | 756 +--- Externals/wxWidgets3/src/osx/carbon/apprsrc.h | 1 - Externals/wxWidgets3/src/osx/carbon/apprsrc.r | 1 - .../wxWidgets3/src/osx/carbon/bmpbuttn.cpp | 150 - .../wxWidgets3/src/osx/carbon/button.cpp | 120 - .../wxWidgets3/src/osx/carbon/carbrsrc.r | 7 - .../wxWidgets3/src/osx/carbon/checkbox.cpp | 41 - .../wxWidgets3/src/osx/carbon/choice.cpp | 65 - .../wxWidgets3/src/osx/carbon/clipbrd.cpp | 2 +- .../wxWidgets3/src/osx/carbon/colordlg.cpp | 4 +- .../wxWidgets3/src/osx/carbon/colordlgosx.mm | 22 +- .../wxWidgets3/src/osx/carbon/combobox.cpp | 668 --- .../wxWidgets3/src/osx/carbon/combobxc.cpp | 783 ---- .../wxWidgets3/src/osx/carbon/control.cpp | 13 +- .../wxWidgets3/src/osx/carbon/corersrc.r | 159 - .../wxWidgets3/src/osx/carbon/cursor.cpp | 378 +- .../wxWidgets3/src/osx/carbon/dataobj.cpp | 18 +- .../wxWidgets3/src/osx/carbon/dataview.cpp | 2823 ------------ .../wxWidgets3/src/osx/carbon/dcclient.cpp | 52 +- .../wxWidgets3/src/osx/carbon/dcprint.cpp | 37 +- .../wxWidgets3/src/osx/carbon/dcscreen.cpp | 16 +- .../wxWidgets3/src/osx/carbon/dialog.cpp | 40 - .../wxWidgets3/src/osx/carbon/dirdlg.cpp | 148 - .../wxWidgets3/src/osx/carbon/dirmac.cpp | 256 -- Externals/wxWidgets3/src/osx/carbon/dnd.cpp | 422 -- .../wxWidgets3/src/osx/carbon/drawer.cpp | 198 - Externals/wxWidgets3/src/osx/carbon/dummy.txt | 0 .../wxWidgets3/src/osx/carbon/evtloop.cpp | 179 - .../wxWidgets3/src/osx/carbon/filedlg.cpp | 625 --- Externals/wxWidgets3/src/osx/carbon/font.cpp | 181 +- .../wxWidgets3/src/osx/carbon/fontdlg.cpp | 251 +- .../wxWidgets3/src/osx/carbon/fontdlgosx.mm | 147 +- Externals/wxWidgets3/src/osx/carbon/frame.cpp | 34 +- Externals/wxWidgets3/src/osx/carbon/gauge.cpp | 95 - .../wxWidgets3/src/osx/carbon/gdiobj.cpp | 10 +- .../wxWidgets3/src/osx/carbon/glcanvas.cpp | 443 -- .../wxWidgets3/src/osx/carbon/graphics.cpp | 315 +- .../wxWidgets3/src/osx/carbon/helpxxxx.cpp | 79 - Externals/wxWidgets3/src/osx/carbon/icon.cpp | 55 +- .../wxWidgets3/src/osx/carbon/joystick.cpp | 1 - .../wxWidgets3/src/osx/carbon/listbox.cpp | 684 --- .../src/osx/carbon/listctrl_mac.cpp | 3394 -------------- Externals/wxWidgets3/src/osx/carbon/mdi.cpp | 36 +- .../wxWidgets3/src/osx/carbon/mediactrl.cpp | 1235 ------ Externals/wxWidgets3/src/osx/carbon/menu.cpp | 436 -- .../wxWidgets3/src/osx/carbon/menuitem.cpp | 24 - .../wxWidgets3/src/osx/carbon/metafile.cpp | 8 +- .../wxWidgets3/src/osx/carbon/mimetmac.cpp | 1958 --------- .../wxWidgets3/src/osx/carbon/msgdlg.cpp | 275 -- .../wxWidgets3/src/osx/carbon/nonownedwnd.cpp | 1692 ------- .../wxWidgets3/src/osx/carbon/notebmac.cpp | 198 - .../wxWidgets3/src/osx/carbon/popupwin.cpp | 24 + .../wxWidgets3/src/osx/carbon/printdlg.cpp | 125 - .../wxWidgets3/src/osx/carbon/radiobut.cpp | 37 - .../wxWidgets3/src/osx/carbon/region.cpp | 4 +- .../wxWidgets3/src/osx/carbon/renderer.cpp | 343 +- .../wxWidgets3/src/osx/carbon/scrolbar.cpp | 56 - .../wxWidgets3/src/osx/carbon/slider.cpp | 69 - .../wxWidgets3/src/osx/carbon/spinbutt.cpp | 42 - .../wxWidgets3/src/osx/carbon/srchctrl.cpp | 222 - .../wxWidgets3/src/osx/carbon/statbmp.cpp | 83 - .../wxWidgets3/src/osx/carbon/statbox.cpp | 37 - .../wxWidgets3/src/osx/carbon/statbrma.cpp | 31 +- .../wxWidgets3/src/osx/carbon/statline.cpp | 40 - .../wxWidgets3/src/osx/carbon/statlmac.cpp | 53 - .../wxWidgets3/src/osx/carbon/stattext.cpp | 140 - .../wxWidgets3/src/osx/carbon/taskbar.cpp | 506 --- .../wxWidgets3/src/osx/carbon/textctrl.cpp | 1582 ------- .../wxWidgets3/src/osx/carbon/tglbtn.cpp | 68 - .../wxWidgets3/src/osx/carbon/thread.cpp | 4 +- Externals/wxWidgets3/src/osx/carbon/timer.cpp | 98 - .../wxWidgets3/src/osx/carbon/toolbar.cpp | 1814 -------- .../wxWidgets3/src/osx/carbon/tooltip.cpp | 257 -- Externals/wxWidgets3/src/osx/carbon/uma.cpp | 281 -- Externals/wxWidgets3/src/osx/carbon/utils.cpp | 1002 ----- .../wxWidgets3/src/osx/carbon/utilscocoa.mm | 71 +- .../wxWidgets3/src/osx/carbon/window.cpp | 1481 ------- .../wxWidgets3/src/osx/carbon/wxmac.icns | Bin 36901 -> 45458 bytes Externals/wxWidgets3/src/osx/checkbox_osx.cpp | 2 +- Externals/wxWidgets3/src/osx/checklst_osx.cpp | 4 +- .../src/osx/cocoa/activityindicator.mm | 111 + .../wxWidgets3/src/osx/cocoa/appprogress.mm | 114 + Externals/wxWidgets3/src/osx/cocoa/button.mm | 183 +- .../wxWidgets3/src/osx/cocoa/checkbox.mm | 2 + Externals/wxWidgets3/src/osx/cocoa/choice.mm | 6 +- Externals/wxWidgets3/src/osx/cocoa/colour.mm | 110 +- .../wxWidgets3/src/osx/cocoa/combobox.mm | 47 +- .../wxWidgets3/src/osx/cocoa/dataview.mm | 353 +- .../wxWidgets3/src/osx/cocoa/datetimectrl.mm | 37 +- Externals/wxWidgets3/src/osx/cocoa/dirdlg.mm | 10 +- Externals/wxWidgets3/src/osx/cocoa/dnd.mm | 39 +- Externals/wxWidgets3/src/osx/cocoa/evtloop.mm | 138 +- Externals/wxWidgets3/src/osx/cocoa/filedlg.mm | 96 +- Externals/wxWidgets3/src/osx/cocoa/gauge.mm | 18 +- .../wxWidgets3/src/osx/cocoa/glcanvas.mm | 204 +- Externals/wxWidgets3/src/osx/cocoa/listbox.mm | 57 +- .../wxWidgets3/src/osx/cocoa/mediactrl.mm | 614 ++- Externals/wxWidgets3/src/osx/cocoa/menu.mm | 39 +- .../wxWidgets3/src/osx/cocoa/menuitem.mm | 22 +- Externals/wxWidgets3/src/osx/cocoa/msgdlg.mm | 27 +- .../wxWidgets3/src/osx/cocoa/nativewin.mm | 76 + .../wxWidgets3/src/osx/cocoa/nonownedwnd.mm | 155 +- .../wxWidgets3/src/osx/cocoa/notebook.mm | 23 +- .../wxWidgets3/src/osx/cocoa/notifmsg.mm | 256 ++ Externals/wxWidgets3/src/osx/cocoa/power.mm | 142 + .../wxWidgets3/src/osx/cocoa/preferences.mm | 12 +- .../wxWidgets3/src/osx/cocoa/printdlg.mm | 2 +- .../wxWidgets3/src/osx/cocoa/scrolbar.mm | 12 +- .../wxWidgets3/src/osx/cocoa/settings.mm | 251 ++ Externals/wxWidgets3/src/osx/cocoa/slider.mm | 4 +- .../wxWidgets3/src/osx/cocoa/spinbutt.mm | 4 +- .../wxWidgets3/src/osx/cocoa/srchctrl.mm | 43 +- Externals/wxWidgets3/src/osx/cocoa/statbox.mm | 5 +- .../wxWidgets3/src/osx/cocoa/stattext.mm | 39 +- .../wxWidgets3/src/osx/cocoa/stdpaths.mm | 129 + Externals/wxWidgets3/src/osx/cocoa/taskbar.mm | 52 +- .../wxWidgets3/src/osx/cocoa/textctrl.mm | 250 +- Externals/wxWidgets3/src/osx/cocoa/toolbar.mm | 165 +- Externals/wxWidgets3/src/osx/cocoa/tooltip.mm | 12 +- Externals/wxWidgets3/src/osx/cocoa/utils.mm | 56 +- .../wxWidgets3/src/osx/cocoa/utils_base.mm | 151 + Externals/wxWidgets3/src/osx/cocoa/window.mm | 465 +- Externals/wxWidgets3/src/osx/combobox_osx.cpp | 3 - Externals/wxWidgets3/src/osx/core/bitmap.cpp | 148 +- .../wxWidgets3/src/osx/core/cfstring.cpp | 7 +- Externals/wxWidgets3/src/osx/core/colour.cpp | 21 +- .../wxWidgets3/src/osx/core/dcmemory.cpp | 4 +- Externals/wxWidgets3/src/osx/core/display.cpp | 33 +- .../wxWidgets3/src/osx/core/evtloop_cf.cpp | 40 +- .../wxWidgets3/src/osx/core/fontenum.cpp | 48 +- Externals/wxWidgets3/src/osx/core/glgrab.cpp | 218 - Externals/wxWidgets3/src/osx/core/hid.cpp | 10 +- .../wxWidgets3/src/osx/core/hidjoystick.cpp | 22 +- .../wxWidgets3/src/osx/core/mimetype.cpp | 6 + .../wxWidgets3/src/osx/core/printmac.cpp | 70 +- Externals/wxWidgets3/src/osx/core/sockosx.cpp | 12 +- Externals/wxWidgets3/src/osx/core/sound.cpp | 46 +- .../wxWidgets3/src/osx/core/stdpaths_cf.cpp | 185 - .../wxWidgets3/src/osx/core/utilsexc_base.cpp | 52 - .../wxWidgets3/src/osx/core/utilsexc_cf.cpp | 22 +- Externals/wxWidgets3/src/osx/dataview_osx.cpp | 88 +- Externals/wxWidgets3/src/osx/dialog_osx.cpp | 4 + Externals/wxWidgets3/src/osx/dnd_osx.cpp | 7 +- .../wxWidgets3/src/osx/fswatcher_fsevents.cpp | 509 +++ Externals/wxWidgets3/src/osx/gauge_osx.cpp | 4 + Externals/wxWidgets3/src/osx/glcanvas_osx.cpp | 466 +- Externals/wxWidgets3/src/osx/imaglist.cpp | 2 +- .../wxWidgets3/src/osx/iphone/evtloop.mm | 4 + Externals/wxWidgets3/src/osx/iphone/msgdlg.mm | 2 +- .../wxWidgets3/src/osx/iphone/nonownedwnd.mm | 7 +- .../settings.cpp => iphone/settings.mm} | 106 +- .../wxWidgets3/src/osx/iphone/stattext.mm | 2 +- .../wxWidgets3/src/osx/iphone/textctrl.mm | 12 + .../wxWidgets3/src/osx/iphone/toolbar.mm | 4 +- Externals/wxWidgets3/src/osx/iphone/utils.mm | 37 +- Externals/wxWidgets3/src/osx/iphone/window.mm | 2 +- Externals/wxWidgets3/src/osx/listbox_osx.cpp | 14 +- Externals/wxWidgets3/src/osx/menu_osx.cpp | 110 +- Externals/wxWidgets3/src/osx/menuitem_osx.cpp | 5 +- Externals/wxWidgets3/src/osx/minifram.cpp | 2 +- .../wxWidgets3/src/osx/nonownedwnd_osx.cpp | 18 +- Externals/wxWidgets3/src/osx/notebook_osx.cpp | 46 +- Externals/wxWidgets3/src/osx/palette.cpp | 4 +- Externals/wxWidgets3/src/osx/pen.cpp | 4 +- Externals/wxWidgets3/src/osx/printdlg_osx.cpp | 6 +- Externals/wxWidgets3/src/osx/radiobox_osx.cpp | 14 +- Externals/wxWidgets3/src/osx/scrolbar_osx.cpp | 4 +- Externals/wxWidgets3/src/osx/slider_osx.cpp | 6 +- Externals/wxWidgets3/src/osx/sound_osx.cpp | 42 - Externals/wxWidgets3/src/osx/spinctrl_osx.cpp | 437 -- Externals/wxWidgets3/src/osx/srchctrl_osx.cpp | 13 +- Externals/wxWidgets3/src/osx/stattext_osx.cpp | 4 +- Externals/wxWidgets3/src/osx/textctrl_osx.cpp | 40 +- .../wxWidgets3/src/osx/textentry_osx.cpp | 17 + Externals/wxWidgets3/src/osx/tglbtn_osx.cpp | 4 +- Externals/wxWidgets3/src/osx/toolbar_osx.cpp | 2 +- Externals/wxWidgets3/src/osx/toplevel_osx.cpp | 51 +- Externals/wxWidgets3/src/osx/uiaction_osx.cpp | 6 +- Externals/wxWidgets3/src/osx/utils_osx.cpp | 72 +- .../wxWidgets3/src/osx/webview_webkit.mm | 496 +-- Externals/wxWidgets3/src/osx/window_osx.cpp | 174 +- Externals/wxWidgets3/src/osx/wxmac.icns | Bin 45458 -> 0 bytes Externals/wxWidgets3/src/unix/apptraits.cpp | 2 +- Externals/wxWidgets3/src/unix/appunix.cpp | 2 +- Externals/wxWidgets3/src/unix/dialup.cpp | 32 +- Externals/wxWidgets3/src/unix/displayx11.cpp | 274 +- Externals/wxWidgets3/src/unix/dlunix.cpp | 21 + Externals/wxWidgets3/src/unix/evtloopunix.cpp | 10 +- Externals/wxWidgets3/src/unix/fontenum.cpp | 17 +- Externals/wxWidgets3/src/unix/fontutil.cpp | 107 +- .../wxWidgets3/src/unix/fswatcher_inotify.cpp | 2 +- .../wxWidgets3/src/unix/fswatcher_kqueue.cpp | 18 +- Externals/wxWidgets3/src/unix/glx11.cpp | 749 +++- Externals/wxWidgets3/src/unix/joystick.cpp | 15 +- Externals/wxWidgets3/src/unix/mediactrl.cpp | 403 +- .../src/unix/mediactrl_gstplayer.cpp | 514 +++ Externals/wxWidgets3/src/unix/mimetype.cpp | 32 +- Externals/wxWidgets3/src/unix/net.cpp | 2 +- Externals/wxWidgets3/src/unix/snglinst.cpp | 8 +- Externals/wxWidgets3/src/unix/sockunix.cpp | 15 +- Externals/wxWidgets3/src/unix/sound.cpp | 52 +- Externals/wxWidgets3/src/unix/sound_sdl.cpp | 12 +- Externals/wxWidgets3/src/unix/stackwalk.cpp | 2 + Externals/wxWidgets3/src/unix/stdpaths.cpp | 31 +- Externals/wxWidgets3/src/unix/taskbarx11.cpp | 8 +- Externals/wxWidgets3/src/unix/threadpsx.cpp | 98 +- Externals/wxWidgets3/src/unix/timerunx.cpp | 24 +- Externals/wxWidgets3/src/unix/utilsunx.cpp | 155 +- Externals/wxWidgets3/src/unix/utilsx11.cpp | 1753 +++++++- Externals/wxWidgets3/wx/wxcocoa.h | 60 +- Externals/wxWidgets3/wx/wxgtk.h | 245 +- Externals/wxWidgets3/wx/wxmsw.h | 230 +- Source/Core/DolphinWX/AboutDolphin.cpp | 2 +- Source/Core/DolphinWX/Debugger/CodeView.cpp | 6 +- .../DolphinWX/Debugger/DebuggerUIUtil.cpp | 3 +- Source/Core/DolphinWX/Debugger/MemoryView.cpp | 6 +- Source/Core/DolphinWX/DolphinWX.vcxproj | 5 +- Source/Core/DolphinWX/FrameTools.cpp | 2 +- .../DolphinWX/NetPlay/NetPlaySetupFrame.cpp | 6 +- Source/Core/DolphinWX/TASInputDlg.cpp | 48 +- 1748 files changed, 58822 insertions(+), 84433 deletions(-) create mode 100644 Externals/wxWidgets3/art/edit.xpm create mode 100644 Externals/wxWidgets3/art/fullscreen.xpm delete mode 100644 Externals/wxWidgets3/art/osx/README delete mode 100644 Externals/wxWidgets3/art/osx/close.png delete mode 100644 Externals/wxWidgets3/art/osx/close_current.png delete mode 100644 Externals/wxWidgets3/art/osx/close_pressed.png create mode 100644 Externals/wxWidgets3/art/tango/fullscreen.h create mode 100644 Externals/wxWidgets3/include/wx/activityindicator.h create mode 100644 Externals/wxWidgets3/include/wx/addremovectrl.h create mode 100644 Externals/wxWidgets3/include/wx/appprogress.h create mode 100644 Externals/wxWidgets3/include/wx/aui/barartmsw.h create mode 100644 Externals/wxWidgets3/include/wx/aui/tabartmsw.h delete mode 100644 Externals/wxWidgets3/include/wx/cairo.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSApplication.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSBox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSButton.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSControl.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSMenu.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSPanel.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSScroller.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSSlider.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSTabView.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSTableDataSource.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSTableView.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSTextField.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSView.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/NSWindow.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/ObjcAssociate.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/ObjcRef.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/app.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/autorelease.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/bitmap.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/bmpbuttn.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/brush.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/button.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/checkbox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/checklst.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/chkconf.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/choice.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/clipbrd.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/colordlg.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/colour.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/combobox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/control.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/cursor.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dataform.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dataobj.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dc.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dcclient.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dcmemory.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dcscreen.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dialog.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/dirdlg.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/drawer.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/evtloop.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/filedlg.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/fontdlg.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/frame.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/gauge.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/glcanvas.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/icon.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/listbox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/log.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/mbarman.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/mdi.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/menu.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/menuitem.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/msgdlg.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/notebook.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/objc/NSMenu.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/objc/NSSlider.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/objc/NSView.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/objc/NSWindow.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/objc/objc_uniquifying.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/pen.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/private/fontfactory.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/private/scrollview.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/private/timer.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/radiobox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/radiobut.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/region.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/scrolbar.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/slider.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/sound.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/spinbutt.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/statbmp.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/statbox.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/statline.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/stattext.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/string.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/taskbar.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/textctrl.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/toolbar.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/tooltip.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/toplevel.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/trackingrectmanager.h delete mode 100644 Externals/wxWidgets3/include/wx/cocoa/window.h create mode 100644 Externals/wxWidgets3/include/wx/collheaderctrl.h create mode 100644 Externals/wxWidgets3/include/wx/generic/activityindicator.h create mode 100644 Externals/wxWidgets3/include/wx/generic/collheaderctrl.h create mode 100644 Externals/wxWidgets3/include/wx/generic/private/addremovectrl.h create mode 100644 Externals/wxWidgets3/include/wx/generic/private/notifmsg.h create mode 100644 Externals/wxWidgets3/include/wx/generic/private/widthcalc.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/activityindicator.h delete mode 100644 Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h delete mode 100644 Externals/wxWidgets3/include/wx/gtk/hildon/notifmsg.h delete mode 100644 Externals/wxWidgets3/include/wx/gtk/notifmsg.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/private/addremovectrl.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/private/eventsdisabler.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/private/gtk3-compat.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/private/treeview.h create mode 100644 Externals/wxWidgets3/include/wx/gtk/private/value.h delete mode 100644 Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h create mode 100644 Externals/wxWidgets3/include/wx/msw/appprogress.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/microwin.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/mslu.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/notifmsg.h create mode 100644 Externals/wxWidgets3/include/wx/msw/ownerdrawnbutton.h create mode 100644 Externals/wxWidgets3/include/wx/msw/private/event.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/rightarr.cur create mode 100644 Externals/wxWidgets3/include/wx/msw/rt/private/notifmsg.h create mode 100644 Externals/wxWidgets3/include/wx/msw/rt/utils.h create mode 100644 Externals/wxWidgets3/include/wx/msw/taskbarbutton.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/checklst.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/chkconf.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/choicece.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/helpwce.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/libraries.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/missing.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/net.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/resources.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/setup.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/smartphone.rc delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/tbarwce.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/textctrlce.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/time.h delete mode 100644 Externals/wxWidgets3/include/wx/msw/wince/wince.rc create mode 100644 Externals/wxWidgets3/include/wx/osx/activityindicator.h create mode 100644 Externals/wxWidgets3/include/wx/osx/appprogress.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/dataview.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/drawer.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/mimetype.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/private.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/private/mactext.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/private/timer.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/carbon/uma.h create mode 100644 Externals/wxWidgets3/include/wx/osx/cocoa/stdpaths.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/core/stdpaths.h create mode 100644 Externals/wxWidgets3/include/wx/osx/fswatcher_fsevents.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/helpxxxx.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/pnghand.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/pngread.h create mode 100644 Externals/wxWidgets3/include/wx/osx/private/addremovectrl.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/private/glgrab.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/spinctrl.h delete mode 100644 Externals/wxWidgets3/include/wx/osx/treectrl.h create mode 100644 Externals/wxWidgets3/include/wx/private/addremovectrl.h create mode 100644 Externals/wxWidgets3/include/wx/private/launchbrowser.h create mode 100644 Externals/wxWidgets3/include/wx/private/notifmsg.h delete mode 100644 Externals/wxWidgets3/include/wx/setup_gccxml.h create mode 100644 Externals/wxWidgets3/include/wx/systhemectrl.h create mode 100644 Externals/wxWidgets3/include/wx/taskbarbutton.h rename Externals/wxWidgets3/include/wx/unix/{ => private}/execute.h (98%) delete mode 100644 Externals/wxWidgets3/include/wx/wx_cw.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cw_cm.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cw_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwc.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwc_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwcocoa.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwcocoa_cm.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwcocoa_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wx_cwu_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlb_cw.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlb_cw_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlb_cwc.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlb_cwc_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlba_cw.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlba_cw_d.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlba_cwc.h delete mode 100644 Externals/wxWidgets3/include/wx/wxshlba_cwc_d.h create mode 100644 Externals/wxWidgets3/include/wx/x11/app.h create mode 100644 Externals/wxWidgets3/include/wx/x11/bitmap.h create mode 100644 Externals/wxWidgets3/include/wx/x11/brush.h create mode 100644 Externals/wxWidgets3/include/wx/x11/chkconf.h create mode 100644 Externals/wxWidgets3/include/wx/x11/clipbrd.h create mode 100644 Externals/wxWidgets3/include/wx/x11/colour.h create mode 100644 Externals/wxWidgets3/include/wx/x11/cursor.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dataform.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dataobj.h rename Externals/wxWidgets3/include/wx/{cocoa => x11}/dataobj2.h (52%) create mode 100644 Externals/wxWidgets3/include/wx/x11/dc.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dcclient.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dcmemory.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dcprint.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dcscreen.h create mode 100644 Externals/wxWidgets3/include/wx/x11/dnd.h rename Externals/wxWidgets3/include/wx/{cocoa => x11}/font.h (52%) create mode 100644 Externals/wxWidgets3/include/wx/x11/glcanvas.h create mode 100644 Externals/wxWidgets3/include/wx/x11/joystick.h create mode 100644 Externals/wxWidgets3/include/wx/x11/minifram.h create mode 100644 Externals/wxWidgets3/include/wx/x11/nanox/X11/Xatom.h create mode 100644 Externals/wxWidgets3/include/wx/x11/nanox/X11/Xlib.h create mode 100644 Externals/wxWidgets3/include/wx/x11/nanox/X11/Xutil.h create mode 100644 Externals/wxWidgets3/include/wx/x11/palette.h create mode 100644 Externals/wxWidgets3/include/wx/x11/pen.h create mode 100644 Externals/wxWidgets3/include/wx/x11/popupwin.h create mode 100644 Externals/wxWidgets3/include/wx/x11/print.h create mode 100644 Externals/wxWidgets3/include/wx/x11/private.h create mode 100644 Externals/wxWidgets3/include/wx/x11/privx.h create mode 100644 Externals/wxWidgets3/include/wx/x11/region.h create mode 100644 Externals/wxWidgets3/include/wx/x11/reparent.h create mode 100644 Externals/wxWidgets3/include/wx/x11/textctrl.h create mode 100644 Externals/wxWidgets3/include/wx/x11/toplevel.h create mode 100644 Externals/wxWidgets3/include/wx/x11/window.h create mode 100644 Externals/wxWidgets3/src/aui/barartmsw.cpp create mode 100644 Externals/wxWidgets3/src/aui/tabartmsw.cpp create mode 100644 Externals/wxWidgets3/src/common/addremovectrl.cpp delete mode 100644 Externals/wxWidgets3/src/common/emptydmy.cpp delete mode 100644 Externals/wxWidgets3/src/common/execcmn.cpp create mode 100644 Externals/wxWidgets3/src/common/notifmsgcmn.cpp create mode 100644 Externals/wxWidgets3/src/generic/activityindicator.cpp create mode 100644 Externals/wxWidgets3/src/generic/collheaderctrlg.cpp create mode 100644 Externals/wxWidgets3/src/gtk/activityindicator.cpp create mode 100644 Externals/wxWidgets3/src/gtk/display.cpp delete mode 100644 Externals/wxWidgets3/src/gtk/gnome/gprint.cpp delete mode 100644 Externals/wxWidgets3/src/gtk/hildon/notifmsg.cpp create mode 100644 Externals/wxWidgets3/src/msw/appprogress.cpp create mode 100644 Externals/wxWidgets3/src/msw/graphicsd2d.cpp delete mode 100644 Externals/wxWidgets3/src/msw/microwin.c delete mode 100644 Externals/wxWidgets3/src/msw/mslu.cpp delete mode 100644 Externals/wxWidgets3/src/msw/penwin.cpp create mode 100644 Externals/wxWidgets3/src/msw/rt/notifmsgrt.cpp create mode 100644 Externals/wxWidgets3/src/msw/rt/utilsrt.cpp create mode 100644 Externals/wxWidgets3/src/msw/systhemectrl.cpp create mode 100644 Externals/wxWidgets3/src/msw/taskbarbutton.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/checklst.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/choicece.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/clean_vcp.py delete mode 100644 Externals/wxWidgets3/src/msw/wince/crt.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/filedlgwce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/filefnwce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/helpwce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/menuce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/net.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/tbarwce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/textctrlce.cpp delete mode 100644 Externals/wxWidgets3/src/msw/wince/time.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/aboutdlg.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/anybutton.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/apprsrc.h delete mode 100644 Externals/wxWidgets3/src/osx/carbon/apprsrc.r delete mode 100644 Externals/wxWidgets3/src/osx/carbon/bmpbuttn.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/button.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/carbrsrc.r delete mode 100644 Externals/wxWidgets3/src/osx/carbon/checkbox.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/choice.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/combobox.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/combobxc.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/corersrc.r delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dataview.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dialog.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dirdlg.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dirmac.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dnd.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/drawer.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/dummy.txt delete mode 100644 Externals/wxWidgets3/src/osx/carbon/evtloop.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/filedlg.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/gauge.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/helpxxxx.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/joystick.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/listbox.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/mediactrl.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/menu.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/menuitem.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/mimetmac.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/msgdlg.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/notebmac.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/printdlg.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/radiobut.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/scrolbar.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/slider.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/spinbutt.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/srchctrl.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/statbmp.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/statbox.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/statline.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/statlmac.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/stattext.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/taskbar.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/textctrl.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/tglbtn.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/timer.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/toolbar.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/tooltip.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/uma.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/utils.cpp delete mode 100644 Externals/wxWidgets3/src/osx/carbon/window.cpp create mode 100644 Externals/wxWidgets3/src/osx/cocoa/activityindicator.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/appprogress.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/nativewin.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/notifmsg.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/power.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/settings.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/stdpaths.mm create mode 100644 Externals/wxWidgets3/src/osx/cocoa/utils_base.mm delete mode 100644 Externals/wxWidgets3/src/osx/core/glgrab.cpp delete mode 100644 Externals/wxWidgets3/src/osx/core/stdpaths_cf.cpp create mode 100644 Externals/wxWidgets3/src/osx/fswatcher_fsevents.cpp rename Externals/wxWidgets3/src/osx/{carbon/settings.cpp => iphone/settings.mm} (73%) delete mode 100644 Externals/wxWidgets3/src/osx/spinctrl_osx.cpp delete mode 100644 Externals/wxWidgets3/src/osx/wxmac.icns create mode 100644 Externals/wxWidgets3/src/unix/mediactrl_gstplayer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df4b2eb1f..6340d4f2b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -846,7 +846,7 @@ if(NOT DISABLE_WX) ERROR_QUIET ) message("Found wxWidgets version ${wxWidgets_VERSION}") - set(wxMIN_VERSION "3.0.1") + set(wxMIN_VERSION "3.1.0") if(${wxWidgets_VERSION} VERSION_LESS ${wxMIN_VERSION}) message("At least ${wxMIN_VERSION} is required; ignoring found version") unset(wxWidgets_FOUND) @@ -887,12 +887,13 @@ if(NOT DISABLE_WX) # not when building wx itself (see wxw3 CMakeLists.txt for that) if(APPLE) add_definitions(-D__WXOSX_COCOA__) - elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") add_definitions(-D__WXGTK__) # Check for required libs check_lib(GTHREAD2 gthread-2.0 gthread-2.0 glib/gthread.h REQUIRED) check_lib(PANGOCAIRO pangocairo pangocairo pango/pangocairo.h REQUIRED) + find_package(Backtrace REQUIRED) elseif(WIN32) add_definitions(-D__WXMSW__) else() diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt index 617a5266c9..50bc57533e 100644 --- a/Externals/wxWidgets3/CMakeLists.txt +++ b/Externals/wxWidgets3/CMakeLists.txt @@ -1,4 +1,4 @@ -# gtk, msw, osx and shared files as of r75363 +# gtk, msw, osx and shared files as of 81570ae070b35c9d52de47b1f14897f3ff1a66c7 set(SRCS_AUI "src/aui/auibar.cpp" @@ -12,6 +12,7 @@ set(SRCS_AUI set(SRCS_COMMON "src/common/accelcmn.cpp" #"src/common/accesscmn.cpp" + "src/common/addremovectrl.cpp" "src/common/affinematrix2d.cpp" "src/common/anidecod.cpp" "src/common/animatecmn.cpp" @@ -158,6 +159,7 @@ set(SRCS_COMMON "src/common/msgout.cpp" "src/common/mstream.cpp" "src/common/nbkbase.cpp" + "src/common/notifmsgcmn.cpp" "src/common/numformatter.cpp" "src/common/object.cpp" "src/common/odcombocmn.cpp" @@ -266,6 +268,7 @@ set(SRCS_GENERIC "src/generic/caret.cpp" "src/generic/choicbkg.cpp" "src/generic/choicdgg.cpp" + "src/generic/collheaderctrlg.cpp" #"src/generic/colour.cpp" "src/generic/combog.cpp" "src/generic/commandlinkbuttong.cpp" @@ -338,11 +341,15 @@ set(SRCS_GENERIC set(SRCS_GENERICGTK "src/generic/accel.cpp" + "src/generic/activityindicator.cpp" "src/generic/icon.cpp" "src/generic/imaglist.cpp" "src/generic/paletteg.cpp" "src/generic/preferencesg.cpp") +set(SRCS_GENERICMSW + "src/generic/activityindicator.cpp") + set(SRCS_GENERICOSX "src/generic/animateg.cpp" "src/generic/clrpickerg.cpp" @@ -355,6 +362,7 @@ set(SRCS_GENERICOSX set(SRCS_GTK "src/aui/tabartgtk.cpp" "src/gtk/aboutdlg.cpp" + "src/gtk/activityindicator.cpp" "src/gtk/animate.cpp" "src/gtk/anybutton.cpp" "src/gtk/app.cpp" @@ -385,6 +393,7 @@ set(SRCS_GTK "src/gtk/dcscreen.cpp" "src/gtk/dialog.cpp" "src/gtk/dirdlg.cpp" + "src/gtk/display.cpp" "src/gtk/dnd.cpp" "src/gtk/eggtrayicon.c" "src/gtk/evtloop.cpp" @@ -398,9 +407,7 @@ set(SRCS_GTK "src/gtk/frame.cpp" "src/gtk/gauge.cpp" "src/gtk/glcanvas.cpp" - #"src/gtk/gnome/gprint.cpp" #"src/gtk/gnome/gvfs.cpp" - #"src/gtk/hildon/notifmsg.cpp" "src/gtk/hyperlink.cpp" "src/gtk/infobar.cpp" "src/gtk/listbox.cpp" @@ -448,10 +455,13 @@ set(SRCS_GTK "src/gtk/window.cpp") set(SRCS_MSW + "src/aui/barartmsw.cpp" + "src/aui/tabartmsw.cpp" "src/msw/aboutdlg.cpp" "src/msw/accel.cpp" "src/msw/anybutton.cpp" "src/msw/app.cpp" + "src/msw/appprogress.cpp" "src/msw/artmsw.cpp" "src/msw/basemsw.cpp" "src/msw/bitmap.cpp" @@ -471,28 +481,28 @@ set(SRCS_MSW "src/msw/combobox.cpp" "src/msw/commandlinkbutton.cpp" "src/msw/control.cpp" - "src/msw/crashrpt.cpp" + #"src/msw/crashrpt.cpp" "src/msw/cursor.cpp" - "src/msw/data.cpp" + #"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" - "src/msw/dcprint.cpp" + #"src/msw/dcprint.cpp" "src/msw/dcscreen.cpp" "src/msw/dde.cpp" "src/msw/debughlp.cpp" "src/msw/dialog.cpp" - "src/msw/dialup.cpp" + #"src/msw/dialup.cpp" "src/msw/dib.cpp" "src/msw/dir.cpp" "src/msw/dirdlg.cpp" "src/msw/display.cpp" "src/msw/dlmsw.cpp" "src/msw/dragimag.cpp" - "src/msw/enhmeta.cpp" + #"src/msw/enhmeta.cpp" "src/msw/evtloop.cpp" #"src/msw/evtloopconsole.cpp" "src/msw/fdrepdlg.cpp" @@ -505,18 +515,19 @@ set(SRCS_MSW #"src/msw/fswatcher.cpp" "src/msw/gauge.cpp" "src/msw/gdiimage.cpp" - "src/msw/gdiobj.cpp" + #"src/msw/gdiobj.cpp" "src/msw/gdiplus.cpp" - "src/msw/glcanvas.cpp" + #"src/msw/glcanvas.cpp" "src/msw/graphics.cpp" + #"src/msw/graphicsd2d.cpp" "src/msw/headerctrl.cpp" - "src/msw/helpbest.cpp" - "src/msw/helpchm.cpp" + #"src/msw/helpbest.cpp" + #"src/msw/helpchm.cpp" "src/msw/helpwin.cpp" "src/msw/hyperlink.cpp" "src/msw/icon.cpp" "src/msw/imaglist.cpp" - "src/msw/iniconf.cpp" + #"src/msw/iniconf.cpp" #"src/msw/joystick.cpp" "src/msw/listbox.cpp" "src/msw/listctrl.cpp" @@ -527,12 +538,10 @@ set(SRCS_MSW #"src/msw/mediactrl_wmp10.cpp" "src/msw/menu.cpp" "src/msw/menuitem.cpp" - "src/msw/metafile.cpp" - "src/msw/microwin.c" + #"src/msw/metafile.cpp" "src/msw/mimetype.cpp" "src/msw/minifram.cpp" "src/msw/msgdlg.cpp" - "src/msw/mslu.cpp" "src/msw/nativdlg.cpp" "src/msw/nativewin.cpp" "src/msw/nonownedwnd.cpp" @@ -551,11 +560,10 @@ set(SRCS_MSW "src/msw/palette.cpp" "src/msw/panel.cpp" "src/msw/pen.cpp" - "src/msw/penwin.cpp" "src/msw/popupwin.cpp" "src/msw/power.cpp" - "src/msw/printdlg.cpp" - "src/msw/printwin.cpp" + #"src/msw/printdlg.cpp" + #"src/msw/printwin.cpp" "src/msw/progdlg.cpp" "src/msw/radiobox.cpp" "src/msw/radiobut.cpp" @@ -579,7 +587,9 @@ set(SRCS_MSW "src/msw/stattext.cpp" "src/msw/statusbar.cpp" "src/msw/stdpaths.cpp" + "src/msw/systhemectrl.cpp" "src/msw/taskbar.cpp" + "src/msw/taskbarbutton.cpp" "src/msw/textctrl.cpp" "src/msw/textentry.cpp" "src/msw/textmeasure.cpp" @@ -592,7 +602,7 @@ set(SRCS_MSW "src/msw/toplevel.cpp" "src/msw/treectrl.cpp" "src/msw/uiaction.cpp" - "src/msw/urlmsw.cpp" + #"src/msw/urlmsw.cpp" "src/msw/utils.cpp" "src/msw/utilsexc.cpp" "src/msw/utilsgui.cpp" @@ -601,19 +611,11 @@ set(SRCS_MSW "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" - "src/msw/wince/filedlgwce.cpp" - "src/msw/wince/filefnwce.cpp" - "src/msw/wince/helpwce.cpp" - "src/msw/wince/menuce.cpp" - "src/msw/wince/net.cpp" - "src/msw/wince/tbarwce.cpp" - "src/msw/wince/textctrlce.cpp" - "src/msw/wince/time.cpp" "src/msw/window.cpp" - "src/msw/winestub.c") + "src/msw/winestub.c" + #"src/msw/rt/notifmsgrt.cpp" + #"src/msw/rt/utilsrt.cpp" + ) set(SRCS_OSX "src/osx/accel.cpp" @@ -632,8 +634,9 @@ set(SRCS_OSX "src/osx/dialog_osx.cpp" "src/osx/dnd_osx.cpp" "src/osx/fontutil.cpp" + #"src/osx/fswatcher_fsevents.cpp" "src/osx/gauge_osx.cpp" - "src/osx/glcanvas_osx.cpp" + #"src/osx/glcanvas_osx.cpp" "src/osx/imaglist.cpp" "src/osx/listbox_osx.cpp" "src/osx/menu_osx.cpp" @@ -664,86 +667,39 @@ set(SRCS_OSX "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" - #"src/osx/carbon/checkbox.cpp" - #"src/osx/carbon/choice.cpp" "src/osx/carbon/clipbrd.cpp" #"src/osx/carbon/colordlg.cpp" "src/osx/carbon/colordlgosx.mm" - #"src/osx/carbon/combobox.cpp" - #"src/osx/carbon/combobxc.cpp" "src/osx/carbon/control.cpp" "src/osx/carbon/cursor.cpp" "src/osx/carbon/dataobj.cpp" - #"src/osx/carbon/dataview.cpp" "src/osx/carbon/dcclient.cpp" "src/osx/carbon/dcprint.cpp" "src/osx/carbon/dcscreen.cpp" - #"src/osx/carbon/dialog.cpp" - #"src/osx/carbon/dirdlg.cpp" - #"src/osx/carbon/dirmac.cpp" - #"src/osx/carbon/dnd.cpp" - #"src/osx/carbon/drawer.cpp" - #"src/osx/carbon/evtloop.cpp" - #"src/osx/carbon/filedlg.cpp" "src/osx/carbon/font.cpp" "src/osx/carbon/fontdlg.cpp" "src/osx/carbon/fontdlgosx.mm" "src/osx/carbon/frame.cpp" - #"src/osx/carbon/gauge.cpp" "src/osx/carbon/gdiobj.cpp" - #"src/osx/carbon/glcanvas.cpp" "src/osx/carbon/graphics.cpp" - #"src/osx/carbon/helpxxxx.cpp" "src/osx/carbon/icon.cpp" - #"src/osx/carbon/joystick.cpp" - #"src/osx/carbon/listbox.cpp" - #"src/osx/carbon/listctrl_mac.cpp" #"src/osx/carbon/main.cpp" "src/osx/carbon/mdi.cpp" - #"src/osx/carbon/mediactrl.cpp" - #"src/osx/carbon/menu.cpp" - #"src/osx/carbon/menuitem.cpp" "src/osx/carbon/metafile.cpp" - #"src/osx/carbon/mimetmac.cpp" - #"src/osx/carbon/msgdlg.cpp" - #"src/osx/carbon/nonownedwnd.cpp" - #"src/osx/carbon/notebmac.cpp" #"src/osx/carbon/overlay.cpp" "src/osx/carbon/popupwin.cpp" - #"src/osx/carbon/printdlg.cpp" - #"src/osx/carbon/radiobut.cpp" "src/osx/carbon/region.cpp" "src/osx/carbon/renderer.cpp" - #"src/osx/carbon/scrolbar.cpp" - "src/osx/carbon/settings.cpp" - #"src/osx/carbon/slider.cpp" #"src/osx/carbon/sound.cpp" - #"src/osx/carbon/spinbutt.cpp" - #"src/osx/carbon/srchctrl.cpp" - #"src/osx/carbon/statbmp.cpp" - #"src/osx/carbon/statbox.cpp" "src/osx/carbon/statbrma.cpp" - #"src/osx/carbon/statline.cpp" - #"src/osx/carbon/statlmac.cpp" - #"src/osx/carbon/stattext.cpp" - #"src/osx/carbon/taskbar.cpp" - #"src/osx/carbon/textctrl.cpp" - #"src/osx/carbon/tglbtn.cpp" #"src/osx/carbon/thread.cpp" #"src/osx/carbon/timer.cpp" - #"src/osx/carbon/toolbar.cpp" - #"src/osx/carbon/tooltip.cpp" - #"src/osx/carbon/uma.cpp" - #"src/osx/carbon/utils.cpp" "src/osx/carbon/utilscocoa.mm" - #"src/osx/carbon/window.cpp" "src/osx/cocoa/aboutdlg.mm" + "src/osx/cocoa/activityindicator.mm" "src/osx/cocoa/anybutton.mm" + "src/osx/cocoa/appprogress.mm" "src/osx/cocoa/button.mm" "src/osx/cocoa/checkbox.mm" "src/osx/cocoa/choice.mm" @@ -763,24 +719,30 @@ set(SRCS_OSX "src/osx/cocoa/menu.mm" "src/osx/cocoa/menuitem.mm" "src/osx/cocoa/msgdlg.mm" + "src/osx/cocoa/nativewin.mm" "src/osx/cocoa/nonownedwnd.mm" "src/osx/cocoa/notebook.mm" + "src/osx/cocoa/notifmsg.mm" "src/osx/cocoa/overlay.mm" + "src/osx/cocoa/power.mm" "src/osx/cocoa/printdlg.mm" "src/osx/cocoa/radiobut.mm" "src/osx/cocoa/scrolbar.mm" + "src/osx/cocoa/settings.mm" "src/osx/cocoa/slider.mm" "src/osx/cocoa/spinbutt.mm" "src/osx/cocoa/srchctrl.mm" "src/osx/cocoa/statbox.mm" "src/osx/cocoa/statline.mm" "src/osx/cocoa/stattext.mm" + "src/osx/cocoa/stdpaths.mm" "src/osx/cocoa/taskbar.mm" "src/osx/cocoa/textctrl.mm" "src/osx/cocoa/tglbtn.mm" "src/osx/cocoa/toolbar.mm" "src/osx/cocoa/tooltip.mm" "src/osx/cocoa/utils.mm" + "src/osx/cocoa/utils_base.mm" "src/osx/cocoa/window.mm" "src/osx/core/bitmap.cpp" "src/osx/core/cfstring.cpp" @@ -789,14 +751,12 @@ set(SRCS_OSX "src/osx/core/display.cpp" "src/osx/core/evtloop_cf.cpp" "src/osx/core/fontenum.cpp" - "src/osx/core/glgrab.cpp" "src/osx/core/hid.cpp" #"src/osx/core/hidjoystick.cpp" "src/osx/core/mimetype.cpp" "src/osx/core/printmac.cpp" "src/osx/core/sockosx.cpp" "src/osx/core/sound.cpp" - "src/osx/core/stdpaths_cf.cpp" "src/osx/core/strconv_cf.cpp" "src/osx/core/timer.cpp" "src/osx/core/utilsexc_base.cpp" @@ -810,6 +770,7 @@ set(SRCS_OSX #"src/osx/iphone/msgdlg.mm" #"src/osx/iphone/nonownedwnd.mm" #"src/osx/iphone/scrolbar.mm" + #"src/osx/iphone/settings.mm" #"src/osx/iphone/slider.mm" #"src/osx/iphone/stattext.mm" #"src/osx/iphone/textctrl.mm" @@ -831,7 +792,6 @@ set(SRCS_UNIX "src/unix/snglinst.cpp" "src/unix/sockunix.cpp" "src/unix/stackwalk.cpp" - "src/unix/stdpaths.cpp" "src/unix/threadpsx.cpp" "src/unix/timerunx.cpp" "src/unix/utilsunx.cpp" @@ -843,12 +803,14 @@ set(SRCS_UNIXGTK "src/unix/fontenum.cpp" "src/unix/fontutil.cpp" #"src/unix/fswatcher_inotify.cpp" - "src/unix/glx11.cpp" + #"src/unix/glx11.cpp" #"src/unix/joystick.cpp" #"src/unix/mediactrl.cpp" + #"src/unix/mediactrl_gstplayer.cpp" "src/unix/mimetype.cpp" "src/unix/sound.cpp" #"src/unix/sound_sdl.cpp" + "src/unix/stdpaths.cpp" #"src/unix/taskbarx11.cpp" "src/unix/uiactionx11.cpp" "src/unix/utilsx11.cpp") @@ -882,8 +844,13 @@ if(APPLE) ${IOK_LIBRARY} ${OPENGL_LIBRARY} ${QUICKTIME_LIBRARY}) -elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + add_definitions(-D__LINUX__=1) + else() + add_definitions(-D__BSD__=1) + endif() add_definitions(-D__WXGTK__) set(SRCS ${SRCS} @@ -891,15 +858,23 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ${SRCS_GTK} ${SRCS_UNIX} ${SRCS_UNIXGTK}) + if (NOT X11_xf86vmode_FOUND OR NOT X11_Xinerama_FOUND) + message(FATAL_ERROR "wxGTK2 needs Xinerama and Xxf86vm") + endif() set(LIBS png ${GTHREAD2_LIBRARIES} ${PANGOCAIRO_LIBRARIES} - ${GTK2_LIBRARIES}) + ${GTK2_LIBRARIES} + ${Backtrace_LIBRARY} + ${X11_X11_LIB} + ${X11_Xxf86vm_LIB} + ${X11_Xinerama_LIB}) else() add_definitions(-D__WXMSW__) set(SRCS ${SRCS} + ${SRCS_GENERICMSW} ${SRCS_MSW}) endif() diff --git a/Externals/wxWidgets3/art/addbookm.xpm b/Externals/wxWidgets3/art/addbookm.xpm index fb13ff161d..0b4f695c2c 100644 --- a/Externals/wxWidgets3/art/addbookm.xpm +++ b/Externals/wxWidgets3/art/addbookm.xpm @@ -1,24 +1,24 @@ -/* XPM */ -static const char *const addbookm_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 3 1", -". c Black", -"X c #00C000", -" c None", -/* pixels */ -" ....... ", -" .XXXXX. ", -" .. .XXXXX. ", -" .. .XXXXX. ", -" ...... .XXXXX. ", -" ...... .XXXXX. ", -" .. .XXXXX. ", -" .. .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XXXXX. ", -" .XX.XX. ", -" .X. .X. ", -" .. .. " -}; +/* XPM */ +static const char *const addbookm_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 3 1", +". c Black", +"X c #00C000", +" c None", +/* pixels */ +" ....... ", +" .XXXXX. ", +" .. .XXXXX. ", +" .. .XXXXX. ", +" ...... .XXXXX. ", +" ...... .XXXXX. ", +" .. .XXXXX. ", +" .. .XXXXX. ", +" .XXXXX. ", +" .XXXXX. ", +" .XXXXX. ", +" .XXXXX. ", +" .XX.XX. ", +" .X. .X. ", +" .. .. " +}; diff --git a/Externals/wxWidgets3/art/back.xpm b/Externals/wxWidgets3/art/back.xpm index 38b0f4b7dd..d5c1de519d 100644 --- a/Externals/wxWidgets3/art/back.xpm +++ b/Externals/wxWidgets3/art/back.xpm @@ -1,21 +1,21 @@ -/* XPM */ -static const char *const back_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" . ", -" .. ", -" .X. ", -" .XX........ ", -" .XXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXX. ", -" .XX........ ", -" .X. ", -" .. ", -" . ", -" "}; +/* XPM */ +static const char *const back_xpm[] = { +"16 15 3 1", +" c None", +". c Black", +"X c Gray100", +" ", +" ", +" . ", +" .. ", +" .X. ", +" .XX........ ", +" .XXXXXXXXXX. ", +" .XXXXXXXXXXX. ", +" .XXXXXXXXXXX. ", +" .XXXXXXXXXX. ", +" .XX........ ", +" .X. ", +" .. ", +" . ", +" "}; diff --git a/Externals/wxWidgets3/art/cdrom.xpm b/Externals/wxWidgets3/art/cdrom.xpm index fecc52ec74..e3bc19b96b 100644 --- a/Externals/wxWidgets3/art/cdrom.xpm +++ b/Externals/wxWidgets3/art/cdrom.xpm @@ -1,57 +1,57 @@ -/* XPM */ -static const char *const cdrom_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 36 1", -"= c #9BACC2", -"y c #547B99", -"$ c #FFFFFF", -"@ c #839CB5", -"o c #547897", -"4 c #4D7492", -"% c #F1F4F7", -"X c #5A809C", -"< c #8497A5", -"0 c #7898AD", -"+ c #CAD2DC", -"r c #ACAEB2", -"2 c #BECAD9", -"* c #65839D", -"e c #DCE2EA", -"- c #ADBED2", -"t c #597B9A", -" c None", -"1 c #467291", -"9 c #D6DFE7", -"O c #7393AB", -"u c #49708B", -"5 c #A0BACB", -"& c #AABFCD", -"8 c #B9CBD5", -"; c #B4C4D3", -": c #6F90A6", -"3 c #A8B6CA", -"# c #ADBACE", -"w c #E4E9ED", -". c #8EA9BC", -"> c #B3BFD1", -", c #C2CBDB", -"6 c #C0D1DC", -"7 c #A2B3C5", -"q c #5D7C93", -/* pixels */ -" .XooOo+ ", -" X@#$$$%o& ", -" *=-;$$$$$o+ ", -" +O#;-$$$$$$: ", -" o=>,-<1<$2-o ", -" o3>--1$122-* ", -" o=--$<4<22-X ", -" o5$$$$$26;7* ", -" X%$$$$2;-X8 ", -" 90*9$$$-7Xqo ", -" wXwe@O44X422222<<*4", -" ttyyyoo4441uuuo", -" t>$$$$$$$$$$$>o", -" XXXtyyyoo44411u" -}; +/* XPM */ +static const char *const cdrom_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 36 1", +"= c #9BACC2", +"y c #547B99", +"$ c #FFFFFF", +"@ c #839CB5", +"o c #547897", +"4 c #4D7492", +"% c #F1F4F7", +"X c #5A809C", +"< c #8497A5", +"0 c #7898AD", +"+ c #CAD2DC", +"r c #ACAEB2", +"2 c #BECAD9", +"* c #65839D", +"e c #DCE2EA", +"- c #ADBED2", +"t c #597B9A", +" c None", +"1 c #467291", +"9 c #D6DFE7", +"O c #7393AB", +"u c #49708B", +"5 c #A0BACB", +"& c #AABFCD", +"8 c #B9CBD5", +"; c #B4C4D3", +": c #6F90A6", +"3 c #A8B6CA", +"# c #ADBACE", +"w c #E4E9ED", +". c #8EA9BC", +"> c #B3BFD1", +", c #C2CBDB", +"6 c #C0D1DC", +"7 c #A2B3C5", +"q c #5D7C93", +/* pixels */ +" .XooOo+ ", +" X@#$$$%o& ", +" *=-;$$$$$o+ ", +" +O#;-$$$$$$: ", +" o=>,-<1<$2-o ", +" o3>--1$122-* ", +" o=--$<4<22-X ", +" o5$$$$$26;7* ", +" X%$$$$2;-X8 ", +" 90*9$$$-7Xqo ", +" wXwe@O44X422222<<*4", +" ttyyyoo4441uuuo", +" t>$$$$$$$$$$$>o", +" XXXtyyyoo44411u" +}; diff --git a/Externals/wxWidgets3/art/copy.xpm b/Externals/wxWidgets3/art/copy.xpm index 9143caa9b2..f393cd23e6 100644 --- a/Externals/wxWidgets3/art/copy.xpm +++ b/Externals/wxWidgets3/art/copy.xpm @@ -1,44 +1,44 @@ -/* XPM */ -static const char *const copy_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"o c #97C4E7", -"* c #FFFFFF", -"@ c #60A9DA", -"= c #D1E5F5", -"& c #C3DDF1", -". c #7EA6C0", -" c None", -"X c #2F93CD", -"O c #85BBE2", -", c #EFF6FC", -"; c #DEEDF8", -"+ c #72B2DD", -"3 c #F7FBFD", -"4 c #FAFCFE", -": c #DAEAF7", -"< c #E9F3FA", -"1 c #E2EFF8", -"- c #FDFDFE", -"% c #B6D5EE", -"$ c #A5CCEA", -"> c #E5F0F9", -"# c #AFD1EC", -"2 c #F4F9FD", -/* pixels */ -" .....XX ", -" .oO+@X#X ", -" .$oO+X##X ", -" .%$o........ ", -" .&%$.*=&#o.-. ", -" .=&%.*;=&#.--. ", -" .:=&.*>;=&.... ", -" .>:=.*,>;=&#o. ", -" .<1:.*2,>:=&#. ", -" .2<1.*32,>:=&. ", -" .32<.*432,>:=. ", -" .32<.*-432,>:. ", -" .....**-432,>. ", -" .***-432,. ", -" .......... " -}; +/* XPM */ +static const char *const copy_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 23 1", +"o c #97C4E7", +"* c #FFFFFF", +"@ c #60A9DA", +"= c #D1E5F5", +"& c #C3DDF1", +". c #7EA6C0", +" c None", +"X c #2F93CD", +"O c #85BBE2", +", c #EFF6FC", +"; c #DEEDF8", +"+ c #72B2DD", +"3 c #F7FBFD", +"4 c #FAFCFE", +": c #DAEAF7", +"< c #E9F3FA", +"1 c #E2EFF8", +"- c #FDFDFE", +"% c #B6D5EE", +"$ c #A5CCEA", +"> c #E5F0F9", +"# c #AFD1EC", +"2 c #F4F9FD", +/* pixels */ +" .....XX ", +" .oO+@X#X ", +" .$oO+X##X ", +" .%$o........ ", +" .&%$.*=&#o.-. ", +" .=&%.*;=&#.--. ", +" .:=&.*>;=&.... ", +" .>:=.*,>;=&#o. ", +" .<1:.*2,>:=&#. ", +" .2<1.*32,>:=&. ", +" .32<.*432,>:=. ", +" .32<.*-432,>:. ", +" .....**-432,>. ", +" .***-432,. ", +" .......... " +}; diff --git a/Externals/wxWidgets3/art/cross.xpm b/Externals/wxWidgets3/art/cross.xpm index 20ab3f3466..407fa9bfa1 100644 --- a/Externals/wxWidgets3/art/cross.xpm +++ b/Externals/wxWidgets3/art/cross.xpm @@ -1,17 +1,17 @@ -/* XPM */ -static const char *const cross_xpm[] = { -/* columns rows colors chars-per-pixel */ -"10 10 2 1", -" c Gray0", -"# c None", -/* pixels */ -" ######## ", -" #### ", -"# ## #", -"## ##", -"### ###", -"### ###", -"## ##", -"# ## #", -" #### ", -" ###### "}; +/* XPM */ +static const char *const cross_xpm[] = { +/* columns rows colors chars-per-pixel */ +"10 10 2 1", +" c Gray0", +"# c None", +/* pixels */ +" ######## ", +" #### ", +"# ## #", +"## ##", +"### ###", +"### ###", +"## ##", +"# ## #", +" #### ", +" ###### "}; diff --git a/Externals/wxWidgets3/art/cut.xpm b/Externals/wxWidgets3/art/cut.xpm index eacd7f94b3..e638157f59 100644 --- a/Externals/wxWidgets3/art/cut.xpm +++ b/Externals/wxWidgets3/art/cut.xpm @@ -1,46 +1,46 @@ -/* XPM */ -static const char *const cut_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 25 1", -"6 c #D8BDC0", -": c #C3C3C4", -"- c #FFFFFF", -". c #6C6D70", -"2 c #AD3A45", -"o c #DBDBDB", -"# c #939495", -"< c #E42234", -"& c #C3C5C8", -"; c #C6CCD3", -"% c #B7B7B8", -" c None", -"* c #DFE0E2", -"5 c #B69596", -"3 c #9C2A35", -"1 c #CFCFD0", -", c #AB5C64", -"+ c #D2D3D4", -"$ c #BCBDBE", -"@ c #C6C8CA", -"> c #CDC0C1", -"O c #826F72", -"X c #979BA0", -"4 c #9B8687", -"= c #9FA0A0", -/* pixels */ -" .X .o ", -" O.+ @. ", -" O. .. ", -" O#$ %.& ", -" O.*.. ", -" #%#.. ", -" O=-.. ", -" #%#;. ", -" OO:=O ", -" >,,<, ,<,,1 ", -" ><23<1 1<32<1 ", -" ,2 4< <5 2, ", -" <, ,2 2, ,< ", -" 23,<5 5<,32 ", -" 6225 522> " -}; +/* XPM */ +static const char *const cut_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 25 1", +"6 c #D8BDC0", +": c #C3C3C4", +"- c #FFFFFF", +". c #6C6D70", +"2 c #AD3A45", +"o c #DBDBDB", +"# c #939495", +"< c #E42234", +"& c #C3C5C8", +"; c #C6CCD3", +"% c #B7B7B8", +" c None", +"* c #DFE0E2", +"5 c #B69596", +"3 c #9C2A35", +"1 c #CFCFD0", +", c #AB5C64", +"+ c #D2D3D4", +"$ c #BCBDBE", +"@ c #C6C8CA", +"> c #CDC0C1", +"O c #826F72", +"X c #979BA0", +"4 c #9B8687", +"= c #9FA0A0", +/* pixels */ +" .X .o ", +" O.+ @. ", +" O. .. ", +" O#$ %.& ", +" O.*.. ", +" #%#.. ", +" O=-.. ", +" #%#;. ", +" OO:=O ", +" >,,<, ,<,,1 ", +" ><23<1 1<32<1 ", +" ,2 4< <5 2, ", +" <, ,2 2, ,< ", +" 23,<5 5<,32 ", +" 6225 522> " +}; diff --git a/Externals/wxWidgets3/art/deffile.xpm b/Externals/wxWidgets3/art/deffile.xpm index 182fbe4180..d7546a53f4 100644 --- a/Externals/wxWidgets3/art/deffile.xpm +++ b/Externals/wxWidgets3/art/deffile.xpm @@ -1,54 +1,54 @@ -/* XPM */ -static const char *const deffile_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 32 1", -"= c #97C4E7", -": c #72A8D2", -"1 c #FFFFFF", -"w c #839CB5", -"X c #6B98B8", -". c #5A89A6", -"@ c #3A749C", -", c #D1E5F5", -"< c #67A1CF", -"> c #F1F4F7", -"e c #85A7BC", -"% c #C3DDF1", -"0 c #749BB4", -"2 c #7EA6C0", -"; c #5F9BC8", -" c None", -"O c #538DB3", -"- c #85BBE2", -"$ c #D6DFE7", -"9 c #EFF6FC", -"o c #6591AE", -"4 c #F7FBFD", -"8 c #FAFCFE", -"6 c #DAEAF7", -"7 c #E9F3FA", -"q c #FDFDFE", -"3 c #E2EFF8", -"# c #8EA9BC", -"& c #B6D5EE", -"* c #A5CCEA", -"5 c #F4F9FD", -"+ c #4581AA", -/* pixels */ -" ..XooO+@#$ ", -" .%%&*=-;:;> ", -" .,,%&*=<1=X> ", -" #%%%%&*211=X ", -" #3----- c #F1F4F7", +"e c #85A7BC", +"% c #C3DDF1", +"0 c #749BB4", +"2 c #7EA6C0", +"; c #5F9BC8", +" c None", +"O c #538DB3", +"- c #85BBE2", +"$ c #D6DFE7", +"9 c #EFF6FC", +"o c #6591AE", +"4 c #F7FBFD", +"8 c #FAFCFE", +"6 c #DAEAF7", +"7 c #E9F3FA", +"q c #FDFDFE", +"3 c #E2EFF8", +"# c #8EA9BC", +"& c #B6D5EE", +"* c #A5CCEA", +"5 c #F4F9FD", +"+ c #4581AA", +/* pixels */ +" ..XooO+@#$ ", +" .%%&*=-;:;> ", +" .,,%&*=<1=X> ", +" #%%%%&*211=X ", +" #3----- c #5A7BB4", -"% c #5F7FB5", -/* pixels */ -" ", -" .Xo OO ", -" +@#. $@% ", -" &@@X .*@*o ", -" =@= .*@*. ", -" -@@X*@*. ", -" .#@@@$. ", -" ;@@: ", -" ;@@@+ ", -" .>@#%@@. ", -" o*@*oO@@, ", -" <#@*. .@@= ", -"&@@$ :@@1 ", -";#& 2#>. ", -" " -}; +/* XPM */ +static const char *const delete_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 21 1", +"2 c #A5AEBD", +"* c #5478B4", +"< c #95A3BB", +"O c #9AA7BC", +"; c #758EB7", +"$ c #6986B6", +"# c #4971B2", +"& c #8A9CBA", +"X c #8598B9", +" c None", +"o c #ABB2BE", +"- c #7F95B9", +"= c #4E74B3", +"1 c #A0ABBC", +"+ c #6F8AB7", +". c #B5B9BF", +"@ c #3E69B1", +", c #90A0BA", +": c #6483B5", +"> c #5A7BB4", +"% c #5F7FB5", +/* pixels */ +" ", +" .Xo OO ", +" +@#. $@% ", +" &@@X .*@*o ", +" =@= .*@*. ", +" -@@X*@*. ", +" .#@@@$. ", +" ;@@: ", +" ;@@@+ ", +" .>@#%@@. ", +" o*@*oO@@, ", +" <#@*. .@@= ", +"&@@$ :@@1 ", +";#& 2#>. ", +" " +}; diff --git a/Externals/wxWidgets3/art/dir_up.xpm b/Externals/wxWidgets3/art/dir_up.xpm index f644d93e6d..dd85ff25cd 100644 --- a/Externals/wxWidgets3/art/dir_up.xpm +++ b/Externals/wxWidgets3/art/dir_up.xpm @@ -1,52 +1,52 @@ -/* XPM */ -static const char *const dir_up_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 31 1", -"6 c #9BACC2", -"o c #9AEA53", -"7 c #94A5BD", -"8 c #547897", -"5 c #839CB5", -"@ c #376485", -"$ c #5A809C", -"# c #7F99B4", -": c #D1D9E5", -"< c #EAEDF3", -"& c #446A8C", -"q c #65839D", -"> c #DCE2EA", -", c #E1E6EE", -"2 c #F5F6F7", -"O c #8DA0B9", -" c None", -"% c #467291", -". c #305F81", -"X c #7393AB", -"+ c #6A89A2", -"4 c #A8B6CA", -"1 c #EEF1F3", -"3 c #F8F9FA", -"0 c #215579", -"9 c #7F97B0", -"* c #B3BFD1", -"w c #7A90AC", -"- c #C2CBDB", -"; c #CAD6E1", -"= c #BBC4D6", -/* pixels */ -" .. ", -" X.o. ", -".... X.ooo. ", -".OO+....ooooo. ", -".OOOOOO@@ooo.. ", -".OOOO#OO@ooo.$ ", -".OOOOOOO@ooo.$ ", -".O%............&", -".O&*=-;:>,<1231.", -".+.4*=-;:>,<12$.", -"..564*=-;:>,<1. ", -".@O764*=-;:>,<. ", -".89O764*=-;:>$$ ", -"0qw9O764*=-;:. ", -"0............. " -}; +/* XPM */ +static const char *const dir_up_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 31 1", +"6 c #9BACC2", +"o c #9AEA53", +"7 c #94A5BD", +"8 c #547897", +"5 c #839CB5", +"@ c #376485", +"$ c #5A809C", +"# c #7F99B4", +": c #D1D9E5", +"< c #EAEDF3", +"& c #446A8C", +"q c #65839D", +"> c #DCE2EA", +", c #E1E6EE", +"2 c #F5F6F7", +"O c #8DA0B9", +" c None", +"% c #467291", +". c #305F81", +"X c #7393AB", +"+ c #6A89A2", +"4 c #A8B6CA", +"1 c #EEF1F3", +"3 c #F8F9FA", +"0 c #215579", +"9 c #7F97B0", +"* c #B3BFD1", +"w c #7A90AC", +"- c #C2CBDB", +"; c #CAD6E1", +"= c #BBC4D6", +/* pixels */ +" .. ", +" X.o. ", +".... X.ooo. ", +".OO+....ooooo. ", +".OOOOOO@@ooo.. ", +".OOOO#OO@ooo.$ ", +".OOOOOOO@ooo.$ ", +".O%............&", +".O&*=-;:>,<1231.", +".+.4*=-;:>,<12$.", +"..564*=-;:>,<1. ", +".@O764*=-;:>,<. ", +".89O764*=-;:>$$ ", +"0qw9O764*=-;:. ", +"0............. " +}; diff --git a/Externals/wxWidgets3/art/down.xpm b/Externals/wxWidgets3/art/down.xpm index 88b0a9fdc9..5a0e4c98fb 100644 --- a/Externals/wxWidgets3/art/down.xpm +++ b/Externals/wxWidgets3/art/down.xpm @@ -1,21 +1,21 @@ -/* XPM */ -static const char *const down_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ...... ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" ....XXXX.... ", -" .XXXXXXXX. ", -" .XXXXXX. ", -" .XXXX. ", -" .XX. ", -" .. ", -" "}; +/* XPM */ +static const char *const down_xpm[] = { +"16 15 3 1", +" c None", +". c Black", +"X c Gray100", +" ", +" ...... ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" ....XXXX.... ", +" .XXXXXXXX. ", +" .XXXXXX. ", +" .XXXX. ", +" .XX. ", +" .. ", +" "}; diff --git a/Externals/wxWidgets3/art/edit.xpm b/Externals/wxWidgets3/art/edit.xpm new file mode 100644 index 0000000000..83d684ab3b --- /dev/null +++ b/Externals/wxWidgets3/art/edit.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static const char* const edit_xpm[] = { +"16 16 3 1", +" c None", +". c #000000", +"+ c #00007F", +" ", +" ", +" .. .. ", +" . ", +" . ", +" ++++ . ++++ ", +" ++ . ++ ++", +" +++++ . ++++++", +" ++ ++ . ++ ", +" ++ ++ . ++ ++", +" +++++ . ++++ ", +" . ", +" . ", +" .. .. ", +" ", +" "}; diff --git a/Externals/wxWidgets3/art/exefile.xpm b/Externals/wxWidgets3/art/exefile.xpm index f814a597e8..54a5e49c33 100644 --- a/Externals/wxWidgets3/art/exefile.xpm +++ b/Externals/wxWidgets3/art/exefile.xpm @@ -1,73 +1,73 @@ -/* XPM */ -static const char *const exefile_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 51 1", -"% c #E8E8EC", -"= c #E8E8ED", -"z c #CACAD4", -"8 c #D9D9E1", -"p c #D2D2DA", -"u c #E1E1E7", -"a c #D2D2DB", -"< c #E9E9ED", -"q c #DADAE1", -"+ c #F1F1F4", -"g c #D3D3DB", -"1 c #E2E2E8", -"x c #D3D3DC", -"5 c #00A5FF", -"$ c #EAEAEE", -"4 c #DBDBE2", -"h c #CCCCD6", -"y c #D4D4DC", -"r c #E3E3E9", -"d c #D4D4DD", -"7 c #DCDCE2", -": c #EBEBEF", -"0 c #DCDCE3", -" c None", -"O c #F3F3F5", -"> c #E4E4E9", -"& c #F3F3F6", -"j c #D5D5DD", -"6 c #E4E4EA", -". c #C6C6D5", -"# c #ECECF0", -"f c #CECED7", -"l c #CECED8", -"e c #D6D6DE", -"; c #EDEDF0", -"3 c #DEDEE4", -", c #EDEDF1", -"c c #CFCFD8", -"o c #F5F5F7", -"- c #E6E6EB", -"w c #D7D7DF", -"v c #C8C8D3", -"i c #DFDFE5", -"@ c #EEEEF2", -"s c #D0D0D9", -"X c #9494AD", -"9 c #D8D8DF", -"t c #D8D8E0", -"* c #EFEFF2", -"2 c #E0E0E6", -"k c #D1D1DA", -/* pixels */ -" ........X ", -" .oO+@#$%XX ", -" .&+*#$=-XXX ", -" .+*;:=->XXXX ", -" .*,:<->1234X ", -" .,5:5612378X ", -" 5,5559530qwX ", -" 55555550q9eX ", -" 5555r5555teyX ", -" 55rui559eypX ", -" 5555i5555yasX ", -" 5555555dasfX ", -" 5355595gsfhX ", -" .3595jgklhzX ", -" .0qwjxkchzvX ", -" XXXXXXXXXXXX " -}; +/* XPM */ +static const char *const exefile_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 51 1", +"% c #E8E8EC", +"= c #E8E8ED", +"z c #CACAD4", +"8 c #D9D9E1", +"p c #D2D2DA", +"u c #E1E1E7", +"a c #D2D2DB", +"< c #E9E9ED", +"q c #DADAE1", +"+ c #F1F1F4", +"g c #D3D3DB", +"1 c #E2E2E8", +"x c #D3D3DC", +"5 c #00A5FF", +"$ c #EAEAEE", +"4 c #DBDBE2", +"h c #CCCCD6", +"y c #D4D4DC", +"r c #E3E3E9", +"d c #D4D4DD", +"7 c #DCDCE2", +": c #EBEBEF", +"0 c #DCDCE3", +" c None", +"O c #F3F3F5", +"> c #E4E4E9", +"& c #F3F3F6", +"j c #D5D5DD", +"6 c #E4E4EA", +". c #C6C6D5", +"# c #ECECF0", +"f c #CECED7", +"l c #CECED8", +"e c #D6D6DE", +"; c #EDEDF0", +"3 c #DEDEE4", +", c #EDEDF1", +"c c #CFCFD8", +"o c #F5F5F7", +"- c #E6E6EB", +"w c #D7D7DF", +"v c #C8C8D3", +"i c #DFDFE5", +"@ c #EEEEF2", +"s c #D0D0D9", +"X c #9494AD", +"9 c #D8D8DF", +"t c #D8D8E0", +"* c #EFEFF2", +"2 c #E0E0E6", +"k c #D1D1DA", +/* pixels */ +" ........X ", +" .oO+@#$%XX ", +" .&+*#$=-XXX ", +" .+*;:=->XXXX ", +" .*,:<->1234X ", +" .,5:5612378X ", +" 5,5559530qwX ", +" 55555550q9eX ", +" 5555r5555teyX ", +" 55rui559eypX ", +" 5555i5555yasX ", +" 5555555dasfX ", +" 5355595gsfhX ", +" .3595jgklhzX ", +" .0qwjxkchzvX ", +" XXXXXXXXXXXX " +}; diff --git a/Externals/wxWidgets3/art/fileopen.xpm b/Externals/wxWidgets3/art/fileopen.xpm index 636a904123..997efdea19 100644 --- a/Externals/wxWidgets3/art/fileopen.xpm +++ b/Externals/wxWidgets3/art/fileopen.xpm @@ -1,57 +1,57 @@ -/* XPM */ -static const char *const fileopen_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 36 1", -"6 c #9BACC2", -"< c #9AEA53", -"9 c #94A5BD", -"5 c #839CB5", -"; c #4D7492", -". c #376485", -"$ c #7F99B4", -"r c #D1D9E5", -"7 c #EAEDF3", -"@ c #CAD2DC", -"% c #718BA7", -"t c #BECAD9", -"& c #65839D", -"0 c #DCE2EA", -"4 c #F5F6F7", -"w c #597B9A", -"O c #8DA0B9", -" c None", -"+ c #467291", -"u c #305F81", -"= c #B4C4D3", -"# c #CAE2AA", -"1 c #FAFCFE", -"3 c #A8B6CA", -"q c #E4E9ED", -"8 c #EEF1F3", -"X c #215579", -"2 c #7F97B0", -": c #B3BFD1", -"y c #7A90AC", -", c #C2CBDB", -"- c #ADD668", -"* c #B6D791", -"e c #CAD6E1", -"o c #DFF0D0", -"> c #BBC4D6", -/* pixels */ -" ", -" .... ", -"XXXXX .oo. ", -"XOOOO+@.#o. ", -"XOOOO$%&.*oXXX ", -"XOOOOOOO.*oX=X ", -"XOXXXX...-oXXXX;", -"XOX:>,.<<<<,.<<>.>.X0q7; ", -"Xw2O963:>>er0t; ", -"X&y2O963:>,er; ", -"uXXXXXXXXXXXX; ", -" " -}; +/* XPM */ +static const char *const fileopen_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 36 1", +"6 c #9BACC2", +"< c #9AEA53", +"9 c #94A5BD", +"5 c #839CB5", +"; c #4D7492", +". c #376485", +"$ c #7F99B4", +"r c #D1D9E5", +"7 c #EAEDF3", +"@ c #CAD2DC", +"% c #718BA7", +"t c #BECAD9", +"& c #65839D", +"0 c #DCE2EA", +"4 c #F5F6F7", +"w c #597B9A", +"O c #8DA0B9", +" c None", +"+ c #467291", +"u c #305F81", +"= c #B4C4D3", +"# c #CAE2AA", +"1 c #FAFCFE", +"3 c #A8B6CA", +"q c #E4E9ED", +"8 c #EEF1F3", +"X c #215579", +"2 c #7F97B0", +": c #B3BFD1", +"y c #7A90AC", +", c #C2CBDB", +"- c #ADD668", +"* c #B6D791", +"e c #CAD6E1", +"o c #DFF0D0", +"> c #BBC4D6", +/* pixels */ +" ", +" .... ", +"XXXXX .oo. ", +"XOOOO+@.#o. ", +"XOOOO$%&.*oXXX ", +"XOOOOOOO.*oX=X ", +"XOXXXX...-oXXXX;", +"XOX:>,.<<<<,.<<>.>.X0q7; ", +"Xw2O963:>>er0t; ", +"X&y2O963:>,er; ", +"uXXXXXXXXXXXX; ", +" " +}; diff --git a/Externals/wxWidgets3/art/filesave.xpm b/Externals/wxWidgets3/art/filesave.xpm index b1ffda3346..f571025cd6 100644 --- a/Externals/wxWidgets3/art/filesave.xpm +++ b/Externals/wxWidgets3/art/filesave.xpm @@ -1,42 +1,42 @@ -/* XPM */ -static const char *const filesave_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 21 1", -"O c #FFFFFF", -"> c #D5D6D8", -"; c #446A8C", -"1 c #CAD2DC", -": c #C0C7D1", -" c #5F666D", -"% c #A5B0BA", -"o c #65839D", -", c #DCE2EA", -"< c #C3C5C8", -"- c #E1E6EE", -"* c #C6CCD3", -". c None", -"$ c #305F81", -"2 c #D6DFE7", -"= c #D2D9E0", -"& c #B7BFC7", -"X c #1B4467", -"# c #BCBDBE", -"@ c #7A90AC", -"+ c #5D7C93", -/* pixels */ -" .", -" XoOOOOOOOOO+X .", -" @oO#######O+@ .", -" @oOOOOOOOOO+@ .", -" @oO#######O+@ .", -" @oOOOOOOOOO+@ .", -" @@+++++++++@@ .", -" @@@@@@@@@@@@@ .", -" @@@$$$$$$$$@@ .", -" @@$%%%&*=-O$@ .", -" @@$%X;;*=-O$@ .", -" @@$%X;;:>,O$@ .", -" @@$%X;;<12O$@ .", -" @@$<<2OOOOO$@ .", -". .." -}; +/* XPM */ +static const char *const filesave_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 21 1", +"O c #FFFFFF", +"> c #D5D6D8", +"; c #446A8C", +"1 c #CAD2DC", +": c #C0C7D1", +" c #5F666D", +"% c #A5B0BA", +"o c #65839D", +", c #DCE2EA", +"< c #C3C5C8", +"- c #E1E6EE", +"* c #C6CCD3", +". c None", +"$ c #305F81", +"2 c #D6DFE7", +"= c #D2D9E0", +"& c #B7BFC7", +"X c #1B4467", +"# c #BCBDBE", +"@ c #7A90AC", +"+ c #5D7C93", +/* pixels */ +" .", +" XoOOOOOOOOO+X .", +" @oO#######O+@ .", +" @oOOOOOOOOO+@ .", +" @oO#######O+@ .", +" @oOOOOOOOOO+@ .", +" @@+++++++++@@ .", +" @@@@@@@@@@@@@ .", +" @@@$$$$$$$$@@ .", +" @@$%%%&*=-O$@ .", +" @@$%X;;*=-O$@ .", +" @@$%X;;:>,O$@ .", +" @@$%X;;<12O$@ .", +" @@$<<2OOOOO$@ .", +". .." +}; diff --git a/Externals/wxWidgets3/art/filesaveas.xpm b/Externals/wxWidgets3/art/filesaveas.xpm index 4ca8e26227..7562f4cc47 100644 --- a/Externals/wxWidgets3/art/filesaveas.xpm +++ b/Externals/wxWidgets3/art/filesaveas.xpm @@ -1,44 +1,44 @@ -/* XPM */ -static const char *const filesaveas_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"X c Black", -"+ c #FFFFFF", -"< c #D5D6D8", -"> c #446A8C", -"3 c #CAD2DC", -", c #C0C7D1", -" c #5F666D", -"* c #A5B0BA", -"O c #65839D", -"1 c #DCE2EA", -"2 c #C3C5C8", -": c #E1E6EE", -". c #FFFF00", -"- c #C6CCD3", -"@ c None", -"& c #305F81", -"4 c #D6DFE7", -"; c #D2D9E0", -"= c #B7BFC7", -"o c #1B4467", -"$ c #BCBDBE", -"# c #7A90AC", -"% c #5D7C93", -/* pixels */ -" .X .XX.", -" oO+++++++.X.X.@", -" #O+$$$$$XX...XX", -" #O++++++.......", -" #O+$$$$$XX...XX", -" #O+++++++.X.X.@", -" ##%%%%%%.X%.X .", -" ############# @", -" ###&&&&&&&&## @", -" ##&***=-;:+&# @", -" ##&*o>>-;:+&# @", -" ##&*o>>,<1+&# @", -" ##&*o>>234+&# @", -" ##&224+++++&# @", -"@ @@" -}; +/* XPM */ +static const char *const filesaveas_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 23 1", +"X c Black", +"+ c #FFFFFF", +"< c #D5D6D8", +"> c #446A8C", +"3 c #CAD2DC", +", c #C0C7D1", +" c #5F666D", +"* c #A5B0BA", +"O c #65839D", +"1 c #DCE2EA", +"2 c #C3C5C8", +": c #E1E6EE", +". c #FFFF00", +"- c #C6CCD3", +"@ c None", +"& c #305F81", +"4 c #D6DFE7", +"; c #D2D9E0", +"= c #B7BFC7", +"o c #1B4467", +"$ c #BCBDBE", +"# c #7A90AC", +"% c #5D7C93", +/* pixels */ +" .X .XX.", +" oO+++++++.X.X.@", +" #O+$$$$$XX...XX", +" #O++++++.......", +" #O+$$$$$XX...XX", +" #O+++++++.X.X.@", +" ##%%%%%%.X%.X .", +" ############# @", +" ###&&&&&&&&## @", +" ##&***=-;:+&# @", +" ##&*o>>-;:+&# @", +" ##&*o>>,<1+&# @", +" ##&*o>>234+&# @", +" ##&224+++++&# @", +"@ @@" +}; diff --git a/Externals/wxWidgets3/art/find.xpm b/Externals/wxWidgets3/art/find.xpm index d5f24f8e41..a31ecde63f 100644 --- a/Externals/wxWidgets3/art/find.xpm +++ b/Externals/wxWidgets3/art/find.xpm @@ -1,62 +1,62 @@ -/* XPM */ -static const char *const find_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 41 1", -"y c #A06959", -"9 c #A7DAF2", -"$ c #B5CAD7", -"> c #35B4E1", -"t c #6B98B8", -"w c #B6E0F4", -"q c #AEC9D7", -"1 c #5A89A6", -"+ c #98B3C6", -"4 c #EAF6FC", -"3 c #DEF1FA", -"= c #4CBCE3", -"d c #DB916B", -"X c #85A7BC", -"s c #D8BCA4", -"o c #749BB4", -"e c #BCD9EF", -"* c #62B4DD", -"< c #91D2EF", -"a c #E6DED2", -"0 c #E9F4FB", -" c None", -"@ c #A0BACB", -"O c #AABFCD", -"i c #6591AE", -": c #B9CBD5", -"- c #71C5E7", -"5 c #D3ECF8", -"% c #81A3B9", -"6 c #8AD0EE", -"8 c #FDFDFE", -"p c #8EA9BC", -"r c #B6D5EE", -", c #81CCEB", -". c #ACC4D3", -"; c #AFD1DE", -"7 c #EFF8FC", -"u c #C2CBDB", -"# c #C0D1DC", -"2 c #CAD6E1", -"& c #8FB0C3", -/* pixels */ -" .XooXO ", -" +@###$+% ", -" .&#*==-;@@ ", -" o:*>,<--:X ", -" 12>-345-#% ", -" 12>678392% ", -" %$*,3059q& ", -" @Oq,wwer@@ ", -" t@q22q&+ ", -" yyui+%o%p ", -" yasy ", -" yasdy ", -" yasdy ", -" ysdy ", -" yy " -}; +/* XPM */ +static const char *const find_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 41 1", +"y c #A06959", +"9 c #A7DAF2", +"$ c #B5CAD7", +"> c #35B4E1", +"t c #6B98B8", +"w c #B6E0F4", +"q c #AEC9D7", +"1 c #5A89A6", +"+ c #98B3C6", +"4 c #EAF6FC", +"3 c #DEF1FA", +"= c #4CBCE3", +"d c #DB916B", +"X c #85A7BC", +"s c #D8BCA4", +"o c #749BB4", +"e c #BCD9EF", +"* c #62B4DD", +"< c #91D2EF", +"a c #E6DED2", +"0 c #E9F4FB", +" c None", +"@ c #A0BACB", +"O c #AABFCD", +"i c #6591AE", +": c #B9CBD5", +"- c #71C5E7", +"5 c #D3ECF8", +"% c #81A3B9", +"6 c #8AD0EE", +"8 c #FDFDFE", +"p c #8EA9BC", +"r c #B6D5EE", +", c #81CCEB", +". c #ACC4D3", +"; c #AFD1DE", +"7 c #EFF8FC", +"u c #C2CBDB", +"# c #C0D1DC", +"2 c #CAD6E1", +"& c #8FB0C3", +/* pixels */ +" .XooXO ", +" +@###$+% ", +" .&#*==-;@@ ", +" o:*>,<--:X ", +" 12>-345-#% ", +" 12>678392% ", +" %$*,3059q& ", +" @Oq,wwer@@ ", +" t@q22q&+ ", +" yyui+%o%p ", +" yasy ", +" yasdy ", +" yasdy ", +" ysdy ", +" yy " +}; diff --git a/Externals/wxWidgets3/art/findrepl.xpm b/Externals/wxWidgets3/art/findrepl.xpm index 55380e5c06..5d688ba4bc 100644 --- a/Externals/wxWidgets3/art/findrepl.xpm +++ b/Externals/wxWidgets3/art/findrepl.xpm @@ -1,63 +1,63 @@ -/* XPM */ -static const char *const findrepl_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 42 1", -"y c #A06959", -"9 c #A7DAF2", -"$ c #B5CAD7", -"> c #35B4E1", -"t c #6B98B8", -"w c #B6E0F4", -"q c #AEC9D7", -"1 c #5A89A6", -"+ c #98B3C6", -"4 c #EAF6FC", -"d c #008000", -"3 c #DEF1FA", -"= c #4CBCE3", -"f c #DB916B", -"X c #85A7BC", -"s c #D8BCA4", -"o c #749BB4", -"e c #BCD9EF", -"* c #62B4DD", -"< c #91D2EF", -"a c #E6DED2", -"0 c #E9F4FB", -" c None", -"@ c #A0BACB", -"O c #AABFCD", -"i c #6591AE", -": c #B9CBD5", -"- c #71C5E7", -"5 c #D3ECF8", -"% c #81A3B9", -"6 c #8AD0EE", -"8 c #FDFDFE", -"p c #8EA9BC", -"r c #B6D5EE", -", c #81CCEB", -". c #ACC4D3", -"; c #AFD1DE", -"7 c #EFF8FC", -"u c #C2CBDB", -"# c #C0D1DC", -"2 c #CAD6E1", -"& c #8FB0C3", -/* pixels */ -" .XooXO ", -" +@###$+% ", -" .&#*==-;@@ ", -" o:*>,<--:X ", -" 12>-345-#% ", -" 12>678392% ", -" %$*,3059q& ", -" @Oq,wwer@@ ", -" t@q22q&+ ", -" yyui+%o%p ", -" yasy d d ", -" yasfy dd dd ", -"yasfy ddddddddd", -"ysfy dd dd ", -" yy d d " -}; +/* XPM */ +static const char *const findrepl_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 42 1", +"y c #A06959", +"9 c #A7DAF2", +"$ c #B5CAD7", +"> c #35B4E1", +"t c #6B98B8", +"w c #B6E0F4", +"q c #AEC9D7", +"1 c #5A89A6", +"+ c #98B3C6", +"4 c #EAF6FC", +"d c #008000", +"3 c #DEF1FA", +"= c #4CBCE3", +"f c #DB916B", +"X c #85A7BC", +"s c #D8BCA4", +"o c #749BB4", +"e c #BCD9EF", +"* c #62B4DD", +"< c #91D2EF", +"a c #E6DED2", +"0 c #E9F4FB", +" c None", +"@ c #A0BACB", +"O c #AABFCD", +"i c #6591AE", +": c #B9CBD5", +"- c #71C5E7", +"5 c #D3ECF8", +"% c #81A3B9", +"6 c #8AD0EE", +"8 c #FDFDFE", +"p c #8EA9BC", +"r c #B6D5EE", +", c #81CCEB", +". c #ACC4D3", +"; c #AFD1DE", +"7 c #EFF8FC", +"u c #C2CBDB", +"# c #C0D1DC", +"2 c #CAD6E1", +"& c #8FB0C3", +/* pixels */ +" .XooXO ", +" +@###$+% ", +" .&#*==-;@@ ", +" o:*>,<--:X ", +" 12>-345-#% ", +" 12>678392% ", +" %$*,3059q& ", +" @Oq,wwer@@ ", +" t@q22q&+ ", +" yyui+%o%p ", +" yasy d d ", +" yasfy dd dd ", +"yasfy ddddddddd", +"ysfy dd dd ", +" yy d d " +}; diff --git a/Externals/wxWidgets3/art/floppy.xpm b/Externals/wxWidgets3/art/floppy.xpm index 0c685efbcb..f6057b14fa 100644 --- a/Externals/wxWidgets3/art/floppy.xpm +++ b/Externals/wxWidgets3/art/floppy.xpm @@ -1,39 +1,39 @@ -/* XPM */ -static const char *const floppy_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 18 1", -"& c #E3E4E6", -"+ c #FFFFFF", -". c #446A8C", -"o c #697787", -"> c #5F666D", -"* c #B2B3B3", -" c None", -", c #4B4C4D", -"= c #DCDBDA", -"$ c #1B4467", -": c #E4E9ED", -"@ c #979BA0", -"X c #203646", -"O c #215579", -"- c #545B63", -"; c #636465", -"# c #CAD6E1", -"% c #7F8286", -/* pixels */ -" .XoooooooXO ", -" .o+++++++.O ", -" .o+OOOOO+.O ", -" .o+++++++.O ", -" .o@@@@@@@.O ", -" ..........O ", -" ..#+++++#.O ", -" ..+$O+++#.O ", -" ..+$O+++#.O ", -" %&.........*% ", -"%=+++++++++++&% ", -"--------------; ", -"-:::::::::::::- ", -"-:X:XXXXXXXXX:> ", -"-*************, " -}; +/* XPM */ +static const char *const floppy_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 18 1", +"& c #E3E4E6", +"+ c #FFFFFF", +". c #446A8C", +"o c #697787", +"> c #5F666D", +"* c #B2B3B3", +" c None", +", c #4B4C4D", +"= c #DCDBDA", +"$ c #1B4467", +": c #E4E9ED", +"@ c #979BA0", +"X c #203646", +"O c #215579", +"- c #545B63", +"; c #636465", +"# c #CAD6E1", +"% c #7F8286", +/* pixels */ +" .XoooooooXO ", +" .o+++++++.O ", +" .o+OOOOO+.O ", +" .o+++++++.O ", +" .o@@@@@@@.O ", +" ..........O ", +" ..#+++++#.O ", +" ..+$O+++#.O ", +" ..+$O+++#.O ", +" %&.........*% ", +"%=+++++++++++&% ", +"--------------; ", +"-:::::::::::::- ", +"-:X:XXXXXXXXX:> ", +"-*************, " +}; diff --git a/Externals/wxWidgets3/art/folder.xpm b/Externals/wxWidgets3/art/folder.xpm index a116dcbd7b..98e52a70b8 100644 --- a/Externals/wxWidgets3/art/folder.xpm +++ b/Externals/wxWidgets3/art/folder.xpm @@ -1,43 +1,43 @@ -/* XPM */ -static const char *const folder_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 22 1", -"> c #9BACC2", -". c #547897", -"1 c #7F99B4", -"X c #D1D9E5", -"< c #EAEDF3", -"+ c #CAD2DC", -"3 c #718BA7", -"O c #BECAD9", -"$ c #E1E6EE", -"* c #F5F6F7", -", c #8DA0B9", -" c None", -"# c #D6DFE7", -"@ c #D2D9E0", -"- c #FAFCFE", -"; c #ADBACE", -"& c #EEF1F3", -"= c #F8F9FA", -"o c #B3BFD1", -"2 c #7A90AC", -": c #A2B3C5", -"% c #E5EAF1", -/* pixels */ -" ", -" ..... ", -" .XXXX. ", -" ............. ", -" .oO+@#$%&*=-. ", -" .oO+@#$%&*=-. ", -" .;oO+X#$%&*=. ", -" .:;oO+X#$%&*. ", -" .>:;oO+X#$%&. ", -" .,>:;oO+X#$<. ", -" .1,>:;oO+X#$. ", -" .21,>:;oO+X#. ", -" .321,>:;oO+X. ", -" ............. ", -" " -}; +/* XPM */ +static const char *const folder_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 22 1", +"> c #9BACC2", +". c #547897", +"1 c #7F99B4", +"X c #D1D9E5", +"< c #EAEDF3", +"+ c #CAD2DC", +"3 c #718BA7", +"O c #BECAD9", +"$ c #E1E6EE", +"* c #F5F6F7", +", c #8DA0B9", +" c None", +"# c #D6DFE7", +"@ c #D2D9E0", +"- c #FAFCFE", +"; c #ADBACE", +"& c #EEF1F3", +"= c #F8F9FA", +"o c #B3BFD1", +"2 c #7A90AC", +": c #A2B3C5", +"% c #E5EAF1", +/* pixels */ +" ", +" ..... ", +" .XXXX. ", +" ............. ", +" .oO+@#$%&*=-. ", +" .oO+@#$%&*=-. ", +" .;oO+X#$%&*=. ", +" .:;oO+X#$%&*. ", +" .>:;oO+X#$%&. ", +" .,>:;oO+X#$<. ", +" .1,>:;oO+X#$. ", +" .21,>:;oO+X#. ", +" .321,>:;oO+X. ", +" ............. ", +" " +}; diff --git a/Externals/wxWidgets3/art/folder_open.xpm b/Externals/wxWidgets3/art/folder_open.xpm index dd450e73b9..154441d2a9 100644 --- a/Externals/wxWidgets3/art/folder_open.xpm +++ b/Externals/wxWidgets3/art/folder_open.xpm @@ -1,52 +1,52 @@ -/* XPM */ -static const char *const folder_open_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 31 1", -"6 c #9BACC2", -"w c #547B99", -"5 c #94A5BD", -". c #376485", -"; c #F1F4F7", -"o c #7F99B4", -"2 c #D1D9E5", -"- c #EAEDF3", -"O c #718BA7", -"0 c #65839D", -"* c #DCE2EA", -": c #F5F6F7", -"7 c #597B9A", -"X c #8DA0B9", -" c None", -"+ c #467291", -"q c #305F81", -"& c #D6DFE7", -"3 c #6A89A2", -"1 c #A8B6CA", -"= c #E4E9ED", -"> c #F8F9FA", -", c #FDFDFE", -"9 c #215579", -"8 c #7F97B0", -"@ c #B3BFD1", -"< c #7A90AC", -"$ c #C2CBDB", -"4 c #A2B3C5", -"% c #CAD6E1", -"# c #BBC4D6", -/* pixels */ -" ", -"..... ", -".XXXo. ", -".XXXXO........ ", -".XXXXXXXXXXXX. ", -".XXXXXXXXXXXX. ", -".X++++++++++++++", -".X+@#$%&*=-;:>,+", -".<.1@#$%2*=-;:23", -"..X41@#$%2*=-;3 ", -"..X561@#$%2*=-3 ", -".78X561@#$%2*%3 ", -"90<8X561@#$%23 ", -"q++++++++++++w ", -" " -}; +/* XPM */ +static const char *const folder_open_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 31 1", +"6 c #9BACC2", +"w c #547B99", +"5 c #94A5BD", +". c #376485", +"; c #F1F4F7", +"o c #7F99B4", +"2 c #D1D9E5", +"- c #EAEDF3", +"O c #718BA7", +"0 c #65839D", +"* c #DCE2EA", +": c #F5F6F7", +"7 c #597B9A", +"X c #8DA0B9", +" c None", +"+ c #467291", +"q c #305F81", +"& c #D6DFE7", +"3 c #6A89A2", +"1 c #A8B6CA", +"= c #E4E9ED", +"> c #F8F9FA", +", c #FDFDFE", +"9 c #215579", +"8 c #7F97B0", +"@ c #B3BFD1", +"< c #7A90AC", +"$ c #C2CBDB", +"4 c #A2B3C5", +"% c #CAD6E1", +"# c #BBC4D6", +/* pixels */ +" ", +"..... ", +".XXXo. ", +".XXXXO........ ", +".XXXXXXXXXXXX. ", +".XXXXXXXXXXXX. ", +".X++++++++++++++", +".X+@#$%&*=-;:>,+", +".<.1@#$%2*=-;:23", +"..X41@#$%2*=-;3 ", +"..X561@#$%2*=-3 ", +".78X561@#$%2*%3 ", +"90<8X561@#$%23 ", +"q++++++++++++w ", +" " +}; diff --git a/Externals/wxWidgets3/art/forward.xpm b/Externals/wxWidgets3/art/forward.xpm index d17eef486e..81f62b0344 100644 --- a/Externals/wxWidgets3/art/forward.xpm +++ b/Externals/wxWidgets3/art/forward.xpm @@ -1,21 +1,21 @@ -/* XPM */ -static const char *const forward_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" ", -" . ", -" .. ", -" .X. ", -" ........XX. ", -" .XXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXXX. ", -" .XXXXXXXXXX. ", -" ........XX. ", -" .X. ", -" .. ", -" . ", -" "}; +/* XPM */ +static const char *const forward_xpm[] = { +"16 15 3 1", +" c None", +". c Black", +"X c Gray100", +" ", +" ", +" . ", +" .. ", +" .X. ", +" ........XX. ", +" .XXXXXXXXXX. ", +" .XXXXXXXXXXX. ", +" .XXXXXXXXXXX. ", +" .XXXXXXXXXX. ", +" ........XX. ", +" .X. ", +" .. ", +" . ", +" "}; diff --git a/Externals/wxWidgets3/art/fullscreen.xpm b/Externals/wxWidgets3/art/fullscreen.xpm new file mode 100644 index 0000000000..e9923646e6 --- /dev/null +++ b/Externals/wxWidgets3/art/fullscreen.xpm @@ -0,0 +1,70 @@ +/* XPM */ +static const char *const fullscreen_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 48 1", +" c #82837F", +". c #3465A4", +"X c #3566A4", +"o c #3767A5", +"O c #3B6AA7", +"+ c #406EA9", +"@ c #4370AA", +"# c #4672AB", +"$ c #4B76AE", +"% c #4E78AE", +"& c #577FB2", +"* c #5F84B4", +"= c #678BB9", +"- c #6F91BD", +"; c #7A98C0", +": c #848681", +"> c #888A85", +", c #8BA6C9", +"< c #90AACA", +"1 c #99B0CC", +"2 c #9EB5D1", +"3 c #A0B4CF", +"4 c #A2B6CF", +"5 c #A6BAD4", +"6 c #B7C7DB", +"7 c #B9C7D8", +"8 c #BDCBDC", +"9 c #C7D2DF", +"0 c #C9D3E0", +"q c #CCD7E3", +"w c #D3DBE6", +"e c #D9E1EA", +"r c #DBE2EA", +"t c #EFEEEC", +"y c #EFEFED", +"u c #F0F0EF", +"i c #F2F2F0", +"p c #F3F3F1", +"a c #F4F3F2", +"s c #F4F4F2", +"d c #F4F5F4", +"f c #F7F6F6", +"g c #F8F8F7", +"h c #F8F9F8", +"j c #FBFAFA", +"k c #FBFBFA", +"l c #FCFCFD", +"z c #FFFFFF", +/* pixels */ +">>>>>>>>>>>>>>>>", +">zzzzzzzzzzzzzz>", +">z..X.ttyy....z>", +">z..Xttyyyy...z>", +">z..#*uuss%+..z>", +">z.y&,4uu1-&sOz>", +">zuuy470w82asiz>", +">zuiuu9usqsddsz>", +">zsssfqsfrfhhfz>", +">zhff<6wr95jjjz>", +">z.h%=,fj4-$j.z>", +">z..O#hhjj+O.Xz>", +">z...jhhjjj...z>", +">z....jjzl....z>", +">zzzzzzzzzzzzzz>", +":>>>>>>>>>>>>>> " +}; diff --git a/Externals/wxWidgets3/art/gtk/error.xpm b/Externals/wxWidgets3/art/gtk/error.xpm index 2505d3d4a8..559715c64c 100644 --- a/Externals/wxWidgets3/art/gtk/error.xpm +++ b/Externals/wxWidgets3/art/gtk/error.xpm @@ -1,58 +1,58 @@ -/* XPM */ -static const char *const error_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 4 1", -" c None", -"X c #242424", -"o c #DCDF00", -". c #C00000", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ..... ", -" ............. ", -" ................. ", -" ................... ", -" ....................... ", -" ......................... ", -" ........................... ", -" ...........................X ", -" .............................X ", -" ............................... ", -" ...............................X ", -" .................................X ", -" .................................X ", -" .................................XX ", -" ...ooooooooooooooooooooooooooo...XX ", -" ....ooooooooooooooooooooooooooo....X ", -" ....ooooooooooooooooooooooooooo....X ", -" ....ooooooooooooooooooooooooooo....XX ", -" ....ooooooooooooooooooooooooooo....XX ", -" ....ooooooooooooooooooooooooooo....XX ", -" ...ooooooooooooooooooooooooooo...XXX ", -" ...ooooooooooooooooooooooooooo...XXX ", -" .................................XX ", -" .................................XX ", -" ...............................XXX ", -" ...............................XXX ", -" .............................XXX ", -" ...........................XXXX ", -" ...........................XXX ", -" .........................XXX ", -" .......................XXXX ", -" X...................XXXXX ", -" X.................XXXXX ", -" X.............XXXXX ", -" XXXX.....XXXXXXXX ", -" XXXXXXXXXXXXX ", -" XXXXX ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const error_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 4 1", +" c None", +"X c #242424", +"o c #DCDF00", +". c #C00000", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ............. ", +" ................. ", +" ................... ", +" ....................... ", +" ......................... ", +" ........................... ", +" ...........................X ", +" .............................X ", +" ............................... ", +" ...............................X ", +" .................................X ", +" .................................X ", +" .................................XX ", +" ...ooooooooooooooooooooooooooo...XX ", +" ....ooooooooooooooooooooooooooo....X ", +" ....ooooooooooooooooooooooooooo....X ", +" ....ooooooooooooooooooooooooooo....XX ", +" ....ooooooooooooooooooooooooooo....XX ", +" ....ooooooooooooooooooooooooooo....XX ", +" ...ooooooooooooooooooooooooooo...XXX ", +" ...ooooooooooooooooooooooooooo...XXX ", +" .................................XX ", +" .................................XX ", +" ...............................XXX ", +" ...............................XXX ", +" .............................XXX ", +" ...........................XXXX ", +" ...........................XXX ", +" .........................XXX ", +" .......................XXXX ", +" X...................XXXXX ", +" X.................XXXXX ", +" X.............XXXXX ", +" XXXX.....XXXXXXXX ", +" XXXXXXXXXXXXX ", +" XXXXX ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/gtk/info.xpm b/Externals/wxWidgets3/art/gtk/info.xpm index 8883955448..fe32e61982 100644 --- a/Externals/wxWidgets3/art/gtk/info.xpm +++ b/Externals/wxWidgets3/art/gtk/info.xpm @@ -1,63 +1,63 @@ -/* XPM */ -static const char *const info_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 9 1", -"$ c Black", -"O c #FFFFFF", -"@ c #808080", -"+ c #000080", -"o c #E8EB01", -" c None", -"X c #FFFF40", -"# c #C0C0C0", -". c #ABAD01", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ..... ", -" ..XXXXX.. ", -" ..XXXXXXXXo.. ", -" .XXXOXXXXXXXoo. ", -" .XOOXXX+XXXXXo. ", -" .XOOOXX+++XXXXoo. ", -" .XOOXXX+++XXXXXo. ", -" .XOOOXXX+++XXXXXXo. ", -" .XOOXXXX+++XXXXXXo. ", -" .XXXXXXX+++XXXXXXX. ", -" .XXXXXXX+++XXXXXXo. ", -" .XXXXXXX+++XXXXXoo. ", -" .XXXXXX+++XXXXXo. ", -" .XXXXXXX+XXXXXXo. ", -" .XXXXXXXXXXXXo. ", -" .XXXXX+++XXXoo. ", -" .XXXX+++XXoo. ", -" .XXXXXXXXo. ", -" ..XXXXXXo.. ", -" .XXXXXo.. ", -" @#######@ ", -" @@@@@@@@@ ", -" @#######@ ", -" @@@@@@@@@ ", -" @#######@ ", -" @@@@@@@ ", -" ### ", -" $$$ ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const info_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 9 1", +"$ c Black", +"O c #FFFFFF", +"@ c #808080", +"+ c #000080", +"o c #E8EB01", +" c None", +"X c #FFFF40", +"# c #C0C0C0", +". c #ABAD01", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ..XXXXX.. ", +" ..XXXXXXXXo.. ", +" .XXXOXXXXXXXoo. ", +" .XOOXXX+XXXXXo. ", +" .XOOOXX+++XXXXoo. ", +" .XOOXXX+++XXXXXo. ", +" .XOOOXXX+++XXXXXXo. ", +" .XOOXXXX+++XXXXXXo. ", +" .XXXXXXX+++XXXXXXX. ", +" .XXXXXXX+++XXXXXXo. ", +" .XXXXXXX+++XXXXXoo. ", +" .XXXXXX+++XXXXXo. ", +" .XXXXXXX+XXXXXXo. ", +" .XXXXXXXXXXXXo. ", +" .XXXXX+++XXXoo. ", +" .XXXX+++XXoo. ", +" .XXXXXXXXo. ", +" ..XXXXXXo.. ", +" .XXXXXo.. ", +" @#######@ ", +" @@@@@@@@@ ", +" @#######@ ", +" @@@@@@@@@ ", +" @#######@ ", +" @@@@@@@ ", +" ### ", +" $$$ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/gtk/question.xpm b/Externals/wxWidgets3/art/gtk/question.xpm index 701f4457ba..cb0001ec80 100644 --- a/Externals/wxWidgets3/art/gtk/question.xpm +++ b/Externals/wxWidgets3/art/gtk/question.xpm @@ -1,75 +1,75 @@ -/* XPM */ -static const char *const question_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 21 1", -". c Black", -"> c #696969", -"O c #1F1F00", -"+ c #181818", -"o c #F6F900", -"; c #3F3F00", -"$ c #111111", -" c None", -"& c #202020", -"X c #AAAA00", -"@ c #949400", -": c #303030", -"1 c #383838", -"% c #2A2A00", -", c #404040", -"= c #B4B400", -"- c #484848", -"# c #151500", -"< c #9F9F00", -"2 c #6A6A00", -"* c #353500", -/* pixels */ -" ", -" ", -" ", -" ", -" ......... ", -" ...XXXXXXX.. ", -" ..XXXXoooooXXXO+ ", -" ..XXooooooooooooX@.. ", -" ..XoooooooooooooooXX#. ", -" $%XoooooooooooooooooXX#. ", -" &.XoooooooXXXXXXooooooXX.. ", -" .XooooooXX.$...$XXoooooX*. ", -" $.XoooooX%.$ .*oooooo=.. ", -" .XooooooX.. -.XoooooX.. ", -" .XoooooX..+ .XoooooX;. ", -" ...XXXX..: .XoooooX;. ", -" ........ >.XoooooX;. ", -" +.XoooooX.. ", -" ,.Xoooooo<.. ", -" 1#XooooooXO.. ", -" &#XooooooX2.. ", -" $%XooooooXX.. ", -" $%XooooooXX.. ", -" $%XooooooXX.. ", -" &.XooooooXX.. ", -" .XooooooXX.. ", -" &.XoooooXX.. ", -" ..XooooXX.. ", -" ..XooooX... ", -" ..XXooXX..& ", -" ...XXXXX.. ", -" ........ ", -" ", -" ", -" ....... ", -" ..XXXXX.. ", -" ..XXoooXX.. ", -" ..XoooooX.. ", -" ..XoooooX.. ", -" ..XXoooXX.. ", -" ..XXXXX.. ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const question_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 21 1", +". c Black", +"> c #696969", +"O c #1F1F00", +"+ c #181818", +"o c #F6F900", +"; c #3F3F00", +"$ c #111111", +" c None", +"& c #202020", +"X c #AAAA00", +"@ c #949400", +": c #303030", +"1 c #383838", +"% c #2A2A00", +", c #404040", +"= c #B4B400", +"- c #484848", +"# c #151500", +"< c #9F9F00", +"2 c #6A6A00", +"* c #353500", +/* pixels */ +" ", +" ", +" ", +" ", +" ......... ", +" ...XXXXXXX.. ", +" ..XXXXoooooXXXO+ ", +" ..XXooooooooooooX@.. ", +" ..XoooooooooooooooXX#. ", +" $%XoooooooooooooooooXX#. ", +" &.XoooooooXXXXXXooooooXX.. ", +" .XooooooXX.$...$XXoooooX*. ", +" $.XoooooX%.$ .*oooooo=.. ", +" .XooooooX.. -.XoooooX.. ", +" .XoooooX..+ .XoooooX;. ", +" ...XXXX..: .XoooooX;. ", +" ........ >.XoooooX;. ", +" +.XoooooX.. ", +" ,.Xoooooo<.. ", +" 1#XooooooXO.. ", +" &#XooooooX2.. ", +" $%XooooooXX.. ", +" $%XooooooXX.. ", +" $%XooooooXX.. ", +" &.XooooooXX.. ", +" .XooooooXX.. ", +" &.XoooooXX.. ", +" ..XooooXX.. ", +" ..XooooX... ", +" ..XXooXX..& ", +" ...XXXXX.. ", +" ........ ", +" ", +" ", +" ....... ", +" ..XXXXX.. ", +" ..XXoooXX.. ", +" ..XoooooX.. ", +" ..XoooooX.. ", +" ..XXoooXX.. ", +" ..XXXXX.. ", +" ....... ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/gtk/warning.xpm b/Externals/wxWidgets3/art/gtk/warning.xpm index 35e60316c3..58aee153fe 100644 --- a/Externals/wxWidgets3/art/gtk/warning.xpm +++ b/Externals/wxWidgets3/art/gtk/warning.xpm @@ -1,63 +1,63 @@ -/* XPM */ -static const char *const warning_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 9 1", -"@ c Black", -"o c #A6A800", -"+ c #8A8C00", -"$ c #B8BA00", -" c None", -"O c #6E7000", -"X c #DCDF00", -". c #C00000", -"# c #373800", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . ", -" ... ", -" ... ", -" ..... ", -" ...X.. ", -" ..XXX.. ", -" ...XXX... ", -" ..XXXXX.. ", -" ..XXXXXX... ", -" ...XXoO+XX.. ", -" ..XXXO@#XXX.. ", -" ..XXXXO@#XXX... ", -" ...XXXXO@#XXXX.. ", -" ..XXXXXO@#XXXX... ", -" ...XXXXXo@OXXXXX.. ", -" ...XXXXXXo@OXXXXXX.. ", -" ..XXXXXXX$@OXXXXXX... ", -" ...XXXXXXXX@XXXXXXXX.. ", -" ...XXXXXXXXXXXXXXXXXX... ", -" ..XXXXXXXXXXOXXXXXXXXX.. ", -" ...XXXXXXXXXO@#XXXXXXXXX.. ", -" ..XXXXXXXXXXX#XXXXXXXXXX... ", -" ...XXXXXXXXXXXXXXXXXXXXXXX.. ", -" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", -" .............................. ", -" .............................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const warning_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 9 1", +"@ c Black", +"o c #A6A800", +"+ c #8A8C00", +"$ c #B8BA00", +" c None", +"O c #6E7000", +"X c #DCDF00", +". c #C00000", +"# c #373800", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" ... ", +" ... ", +" ..... ", +" ...X.. ", +" ..XXX.. ", +" ...XXX... ", +" ..XXXXX.. ", +" ..XXXXXX... ", +" ...XXoO+XX.. ", +" ..XXXO@#XXX.. ", +" ..XXXXO@#XXX... ", +" ...XXXXO@#XXXX.. ", +" ..XXXXXO@#XXXX... ", +" ...XXXXXo@OXXXXX.. ", +" ...XXXXXXo@OXXXXXX.. ", +" ..XXXXXXX$@OXXXXXX... ", +" ...XXXXXXXX@XXXXXXXX.. ", +" ...XXXXXXXXXXXXXXXXXX... ", +" ..XXXXXXXXXXOXXXXXXXXX.. ", +" ...XXXXXXXXXO@#XXXXXXXXX.. ", +" ..XXXXXXXXXXX#XXXXXXXXXX... ", +" ...XXXXXXXXXXXXXXXXXXXXXXX.. ", +" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", +" .............................. ", +" .............................. ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/harddisk.xpm b/Externals/wxWidgets3/art/harddisk.xpm index 3151a7f308..d21ebf3c3b 100644 --- a/Externals/wxWidgets3/art/harddisk.xpm +++ b/Externals/wxWidgets3/art/harddisk.xpm @@ -1,60 +1,60 @@ -/* XPM */ -static const char *const harddisk_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 39 1", -"7 c #E3E4E6", -"4 c #FFFFFF", -"5 c #839CB5", -". c #547897", -"1 c #4D7492", -"@ c #376485", -"o c #7A92A3", -"u c #D1D9E5", -"y c #446A8C", -"i c #51B03D", -"> c #CAD2DC", -"O c #718BA7", -"2 c #65839D", -"6 c #DCE2EA", -"0 c #C3C5C8", -"9 c #F5F6F7", -": c #EBEBEC", -"< c #597B9A", -"t c #C6CCD3", -" c None", -"* c #DFE0E2", -"e c #467291", -"a c #526E8B", -", c #7393AB", -"p c #130A0B", -"# c #AABFCD", -"r c #B4C4D3", -"; c #CFCFD0", -"X c #6F90A6", -"+ c #6A89A2", -"- c #D2D3D4", -"= c #DCDBDA", -"w c #E4E9ED", -"q c #C6C8CA", -"% c #215579", -"$ c #E7E7E7", -"3 c #7F97B0", -"8 c #C0D1DC", -"& c #5D7C93", -/* pixels */ -" ", -" .XoooXO+@ ", -" #$$%%%%$$$X ", -" &$*==-;$$$& ", -" &:>+,<1234o5 ", -" ###+67;;78242 ", -" &4,49*0q*9we4. ", -" &4+49*,,*9wo4. ", -"&4%r,67;;782t%4.", -"&44468rrrr84444,", -"y11111111111111e", -"1uu1:::::::::::1", -"1uu1::::::::ip:1", -"auu&:::::::::::1", -"1111111111111111" -}; +/* XPM */ +static const char *const harddisk_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 39 1", +"7 c #E3E4E6", +"4 c #FFFFFF", +"5 c #839CB5", +". c #547897", +"1 c #4D7492", +"@ c #376485", +"o c #7A92A3", +"u c #D1D9E5", +"y c #446A8C", +"i c #51B03D", +"> c #CAD2DC", +"O c #718BA7", +"2 c #65839D", +"6 c #DCE2EA", +"0 c #C3C5C8", +"9 c #F5F6F7", +": c #EBEBEC", +"< c #597B9A", +"t c #C6CCD3", +" c None", +"* c #DFE0E2", +"e c #467291", +"a c #526E8B", +", c #7393AB", +"p c #130A0B", +"# c #AABFCD", +"r c #B4C4D3", +"; c #CFCFD0", +"X c #6F90A6", +"+ c #6A89A2", +"- c #D2D3D4", +"= c #DCDBDA", +"w c #E4E9ED", +"q c #C6C8CA", +"% c #215579", +"$ c #E7E7E7", +"3 c #7F97B0", +"8 c #C0D1DC", +"& c #5D7C93", +/* pixels */ +" ", +" .XoooXO+@ ", +" #$$%%%%$$$X ", +" &$*==-;$$$& ", +" &:>+,<1234o5 ", +" ###+67;;78242 ", +" &4,49*0q*9we4. ", +" &4+49*,,*9wo4. ", +"&4%r,67;;782t%4.", +"&44468rrrr84444,", +"y11111111111111e", +"1uu1:::::::::::1", +"1uu1::::::::ip:1", +"auu&:::::::::::1", +"1111111111111111" +}; diff --git a/Externals/wxWidgets3/art/helpicon.xpm b/Externals/wxWidgets3/art/helpicon.xpm index 356c452399..9b4cd44450 100644 --- a/Externals/wxWidgets3/art/helpicon.xpm +++ b/Externals/wxWidgets3/art/helpicon.xpm @@ -1,44 +1,44 @@ -/* XPM */ -static const char *const helpicon_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 6 1", -" c Gray0", -". c Blue", -"X c #808080808080", -"o c #c0c0c0c0c0c0", -"O c Gray100", -"+ c None", -/* pixels */ -"+++++++++++XXXXXXXX+++++++++++++", -"++++++++XXXoOOOOOOoXXX++++++++++", -"++++++XXoOOOOOOOOOOOOoXX++++++++", -"+++++XoOOOOOOOOOOOOOOOOoX+++++++", -"++++XOOOOOOOOOOOOOOOOOOOO ++++++", -"+++XOOOOOOOo......oOOOOOOO +++++", -"++XOOOOOOOo.oOO....oOOOOOOO ++++", -"+XoOOOOOOO..OOOO....OOOOOOOo +++", -"+XOOOOOOOO....OO....OOOOOOOO X++", -"XoOOOOOOOO....Oo....OOOOOOOOo X+", -"XOOOOOOOOOo..oO....OOOOOOOOOO X+", -"XOOOOOOOOOOOOOo...OOOOOOOOOOO XX", -"XOOOOOOOOOOOOO...OOOOOOOOOOOO XX", -"XOOOOOOOOOOOOO..oOOOOOOOOOOOO XX", -"XOOOOOOOOOOOOO..OOOOOOOOOOOOO XX", -"XoOOOOOOOOOOOOOOOOOOOOOOOOOOo XX", -"+XOOOOOOOOOOOo..oOOOOOOOOOOO XXX", -"+XoOOOOOOOOOO....OOOOOOOOOOo XXX", -"++XOOOOOOOOOO....OOOOOOOOOO XXX+", -"+++ OOOOOOOOOo..oOOOOOOOOO XXXX+", -"++++ OOOOOOOOOOOOOOOOOOOO XXXX++", -"+++++ oOOOOOOOOOOOOOOOOo XXXX+++", -"++++++ oOOOOOOOOOOOOo XXXX++++", -"+++++++X oOOOOOOo XXXXX+++++", -"++++++++XXX oOOO XXXXXXX++++++", -"++++++++++XXXX OOO XXXXX++++++++", -"+++++++++++++X OOO XX+++++++++++", -"+++++++++++++++ OO XX+++++++++++", -"++++++++++++++++ O XX+++++++++++", -"+++++++++++++++++ XX+++++++++++", -"++++++++++++++++++XXX+++++++++++", -"+++++++++++++++++++XX+++++++++++" -}; +/* XPM */ +static const char *const helpicon_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 6 1", +" c Gray0", +". c Blue", +"X c #808080808080", +"o c #c0c0c0c0c0c0", +"O c Gray100", +"+ c None", +/* pixels */ +"+++++++++++XXXXXXXX+++++++++++++", +"++++++++XXXoOOOOOOoXXX++++++++++", +"++++++XXoOOOOOOOOOOOOoXX++++++++", +"+++++XoOOOOOOOOOOOOOOOOoX+++++++", +"++++XOOOOOOOOOOOOOOOOOOOO ++++++", +"+++XOOOOOOOo......oOOOOOOO +++++", +"++XOOOOOOOo.oOO....oOOOOOOO ++++", +"+XoOOOOOOO..OOOO....OOOOOOOo +++", +"+XOOOOOOOO....OO....OOOOOOOO X++", +"XoOOOOOOOO....Oo....OOOOOOOOo X+", +"XOOOOOOOOOo..oO....OOOOOOOOOO X+", +"XOOOOOOOOOOOOOo...OOOOOOOOOOO XX", +"XOOOOOOOOOOOOO...OOOOOOOOOOOO XX", +"XOOOOOOOOOOOOO..oOOOOOOOOOOOO XX", +"XOOOOOOOOOOOOO..OOOOOOOOOOOOO XX", +"XoOOOOOOOOOOOOOOOOOOOOOOOOOOo XX", +"+XOOOOOOOOOOOo..oOOOOOOOOOOO XXX", +"+XoOOOOOOOOOO....OOOOOOOOOOo XXX", +"++XOOOOOOOOOO....OOOOOOOOOO XXX+", +"+++ OOOOOOOOOo..oOOOOOOOOO XXXX+", +"++++ OOOOOOOOOOOOOOOOOOOO XXXX++", +"+++++ oOOOOOOOOOOOOOOOOo XXXX+++", +"++++++ oOOOOOOOOOOOOo XXXX++++", +"+++++++X oOOOOOOo XXXXX+++++", +"++++++++XXX oOOO XXXXXXX++++++", +"++++++++++XXXX OOO XXXXX++++++++", +"+++++++++++++X OOO XX+++++++++++", +"+++++++++++++++ OO XX+++++++++++", +"++++++++++++++++ O XX+++++++++++", +"+++++++++++++++++ XX+++++++++++", +"++++++++++++++++++XXX+++++++++++", +"+++++++++++++++++++XX+++++++++++" +}; diff --git a/Externals/wxWidgets3/art/home.xpm b/Externals/wxWidgets3/art/home.xpm index d246b1d72e..d0da8d26b8 100644 --- a/Externals/wxWidgets3/art/home.xpm +++ b/Externals/wxWidgets3/art/home.xpm @@ -1,24 +1,24 @@ -/* XPM */ -static const char *const home_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 3 1", -". c Black", -"X c #FFFFFF", -" c None", -/* pixels */ -" .... ", -" .XXXX. ", -" .XXXXXX. ", -" .XXXXXXXX. ", -" .XXXXXXXXXX. ", -" .............. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .XXXXXXXXXXXX. ", -" .X.....X....X. ", -" .X. .X. .X. ", -" .X. .X. .X. ", -" .X.....X. .X. ", -" .XXXXXXX. .X. ", -" ......... ... " -}; +/* XPM */ +static const char *const home_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 3 1", +". c Black", +"X c #FFFFFF", +" c None", +/* pixels */ +" .... ", +" .XXXX. ", +" .XXXXXX. ", +" .XXXXXXXX. ", +" .XXXXXXXXXX. ", +" .............. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .XXXXXXXXXXXX. ", +" .X.....X....X. ", +" .X. .X. .X. ", +" .X. .X. .X. ", +" .X.....X. .X. ", +" .XXXXXXX. .X. ", +" ......... ... " +}; diff --git a/Externals/wxWidgets3/art/htmbook.xpm b/Externals/wxWidgets3/art/htmbook.xpm index e49b4685f9..d0456ee6d5 100644 --- a/Externals/wxWidgets3/art/htmbook.xpm +++ b/Externals/wxWidgets3/art/htmbook.xpm @@ -1,25 +1,25 @@ -/* XPM */ -static const char *const htmbook_xpm[] = { -"16 16 6 1", -" c None", -". c Black", -"X c #000080", -"o c #c0c0c0", -"O c #808080", -"+ c Gray100", -" ", -" .. ", -" ..XX. ", -" ..XXXXX. ", -" ..XXXXXXXX. ", -".oXXXXXXXXXX. ", -".XoXXXXXXXXXX. ", -".XXoXXXXXXXXXX. ", -".XXXoXXXXXXXXX..", -".XXXXoXXXXXX..O ", -" .XXXXoXXX..O+O ", -" .XXXXo..O++o..", -" .XXX.O+++o.. ", -" .XX.o+o.. ", -" .X.o.. ", -" ... "}; +/* XPM */ +static const char *const htmbook_xpm[] = { +"16 16 6 1", +" c None", +". c Black", +"X c #000080", +"o c #c0c0c0", +"O c #808080", +"+ c Gray100", +" ", +" .. ", +" ..XX. ", +" ..XXXXX. ", +" ..XXXXXXXX. ", +".oXXXXXXXXXX. ", +".XoXXXXXXXXXX. ", +".XXoXXXXXXXXXX. ", +".XXXoXXXXXXXXX..", +".XXXXoXXXXXX..O ", +" .XXXXoXXX..O+O ", +" .XXXXo..O++o..", +" .XXX.O+++o.. ", +" .XX.o+o.. ", +" .X.o.. ", +" ... "}; diff --git a/Externals/wxWidgets3/art/htmfoldr.xpm b/Externals/wxWidgets3/art/htmfoldr.xpm index dacef687b1..4f84e8aeff 100644 --- a/Externals/wxWidgets3/art/htmfoldr.xpm +++ b/Externals/wxWidgets3/art/htmfoldr.xpm @@ -1,25 +1,25 @@ -/* XPM */ -static const char *const htmfoldr_xpm[] = { -"16 16 6 1", -" c None", -". c Black", -"X c #000080", -"o c #c0c0c0", -"O c #808080", -"+ c Gray100", -" ", -" .. ", -" ..XX. ", -" ..XXXXX. ", -" ..XXXXXXXX. ", -".oXXXXXXXXXX. ", -".XoXXXXXXXXXX. ", -".XXoXXXXXXXXXX. ", -".XXXoXXXXXXXXX..", -".XXXXoXXXXXX..O ", -" .XXXXoXXX..O+O ", -" .XXXXo..O++o..", -" .XXX.O+++o.. ", -" .XX.o+o.. ", -" .X.o.. ", -" ... "}; +/* XPM */ +static const char *const htmfoldr_xpm[] = { +"16 16 6 1", +" c None", +". c Black", +"X c #000080", +"o c #c0c0c0", +"O c #808080", +"+ c Gray100", +" ", +" .. ", +" ..XX. ", +" ..XXXXX. ", +" ..XXXXXXXX. ", +".oXXXXXXXXXX. ", +".XoXXXXXXXXXX. ", +".XXoXXXXXXXXXX. ", +".XXXoXXXXXXXXX..", +".XXXXoXXXXXX..O ", +" .XXXXoXXX..O+O ", +" .XXXXo..O++o..", +" .XXX.O+++o.. ", +" .XX.o+o.. ", +" .X.o.. ", +" ... "}; diff --git a/Externals/wxWidgets3/art/htmoptns.xpm b/Externals/wxWidgets3/art/htmoptns.xpm index 8806749ea4..0d178ab2e1 100644 --- a/Externals/wxWidgets3/art/htmoptns.xpm +++ b/Externals/wxWidgets3/art/htmoptns.xpm @@ -1,20 +1,20 @@ -/* XPM */ -static const char *const htmoptns_xpm[] = { -"16 15 2 1", -" c None", -". c #000000", -" ", -" .. ", -" ... ", -" .... ", -" . ... ", -" .. ... ", -" . .. ", -" .. ... ", -" . .. ", -" ......... ", -" .. ... ", -" . ... ", -" .. ... ", -" .... ....... ", -" "}; +/* XPM */ +static const char *const htmoptns_xpm[] = { +"16 15 2 1", +" c None", +". c #000000", +" ", +" .. ", +" ... ", +" .... ", +" . ... ", +" .. ... ", +" . .. ", +" .. ... ", +" . .. ", +" ......... ", +" .. ... ", +" . ... ", +" .. ... ", +" .... ....... ", +" "}; diff --git a/Externals/wxWidgets3/art/htmpage.xpm b/Externals/wxWidgets3/art/htmpage.xpm index e4fa3fbc71..f7d9f472ab 100644 --- a/Externals/wxWidgets3/art/htmpage.xpm +++ b/Externals/wxWidgets3/art/htmpage.xpm @@ -1,23 +1,23 @@ -/* XPM */ -static const char *const htmpage_xpm[] = { -"16 16 4 1", -" c None", -". c #808080", -"X c Gray100", -"o c Black", -" ", -" .......... ", -" .XXXXXXXX.. ", -" .XXXXXXXXooo ", -" .X......XXXo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .X........Xo ", -" .XXXXXXXXXXo ", -" .XXXXXXXXXXo ", -" oooooooooooo "}; +/* XPM */ +static const char *const htmpage_xpm[] = { +"16 16 4 1", +" c None", +". c #808080", +"X c Gray100", +"o c Black", +" ", +" .......... ", +" .XXXXXXXX.. ", +" .XXXXXXXXooo ", +" .X......XXXo ", +" .XXXXXXXXXXo ", +" .X........Xo ", +" .XXXXXXXXXXo ", +" .X........Xo ", +" .XXXXXXXXXXo ", +" .X........Xo ", +" .XXXXXXXXXXo ", +" .X........Xo ", +" .XXXXXXXXXXo ", +" .XXXXXXXXXXo ", +" oooooooooooo "}; diff --git a/Externals/wxWidgets3/art/htmsidep.xpm b/Externals/wxWidgets3/art/htmsidep.xpm index 30f6a92392..19bb863730 100644 --- a/Externals/wxWidgets3/art/htmsidep.xpm +++ b/Externals/wxWidgets3/art/htmsidep.xpm @@ -1,27 +1,27 @@ -/* XPM */ -static const char *const htmsidep_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 6 1", -". c Black", -"X c #FFFFFF", -"+ c #808080", -" c None", -"O c #0000C0", -"o c #C0C0C0", -/* pixels */ -" ", -" .............. ", -" .XXXX.ooooooo. ", -" .XOXX.oo...oo. ", -" .XXOX.ooooooo. ", -" .OOOO.o...+.o. ", -" .XXOX.ooooooo. ", -" .XOXX.ooooooo. ", -" .XXXX.o..+ooo. ", -" .XXOX.ooooooo. ", -" .XOXX.o...+.o. ", -" .OOOO.ooooooo. ", -" .XOXX.o.+...o. ", -" .XXOX.ooooooo. ", -" .............. " -}; +/* XPM */ +static const char *const htmsidep_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 6 1", +". c Black", +"X c #FFFFFF", +"+ c #808080", +" c None", +"O c #0000C0", +"o c #C0C0C0", +/* pixels */ +" ", +" .............. ", +" .XXXX.ooooooo. ", +" .XOXX.oo...oo. ", +" .XXOX.ooooooo. ", +" .OOOO.o...+.o. ", +" .XXOX.ooooooo. ", +" .XOXX.ooooooo. ", +" .XXXX.o..+ooo. ", +" .XXOX.ooooooo. ", +" .XOXX.o...+.o. ", +" .OOOO.ooooooo. ", +" .XOXX.o.+...o. ", +" .XXOX.ooooooo. ", +" .............. " +}; diff --git a/Externals/wxWidgets3/art/listview.xpm b/Externals/wxWidgets3/art/listview.xpm index 30f748abb4..2d8afc4198 100644 --- a/Externals/wxWidgets3/art/listview.xpm +++ b/Externals/wxWidgets3/art/listview.xpm @@ -1,25 +1,25 @@ -/* XPM */ -static const char *const listview_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 4 1", -" c Black", -". c #FFFFFF", -"X c #000084", -"o c #848484", -/* pixels */ -" ", -" .............. ", -" .XXX.......... ", -" .XXX. o o . ", -" .XXX.......... ", -" .............. ", -" .XXX.......... ", -" .XXX. o . ", -" .XXX.......... ", -" .............. ", -" .XXX.......... ", -" .XXX. o o . ", -" .XXX.......... ", -" .............. ", -" " -}; +/* XPM */ +static const char *const listview_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 4 1", +" c Black", +". c #FFFFFF", +"X c #000084", +"o c #848484", +/* pixels */ +" ", +" .............. ", +" .XXX.......... ", +" .XXX. o o . ", +" .XXX.......... ", +" .............. ", +" .XXX.......... ", +" .XXX. o . ", +" .XXX.......... ", +" .............. ", +" .XXX.......... ", +" .XXX. o o . ", +" .XXX.......... ", +" .............. ", +" " +}; diff --git a/Externals/wxWidgets3/art/missimg.xpm b/Externals/wxWidgets3/art/missimg.xpm index 80eecbcf2a..599aca7896 100644 --- a/Externals/wxWidgets3/art/missimg.xpm +++ b/Externals/wxWidgets3/art/missimg.xpm @@ -1,43 +1,43 @@ -/* XPM */ -static const char *const missimg_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 5 1", -"X c Black", -"o c #FFFFFF", -" c None", -". c #C0C0C0", -"O c #E0E0E0", -/* pixels */ -" .............................X ", -" .ooooooooooooooooooooooooooooX ", -" .ooooooooooooooooooooooooooooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOXOOOOOOOOOOOOOOOOooX ", -" XXXOOOOOXX XOOOOOOOOOOOOOOOooX ", -" XXXXX XOOOOOOOOOOOOOOooX ", -" XOOOXXXOOOOOOOooX ", -" XXX XXOOOOOooX ", -" XOOOOooX ", -" . XOOOooX ", -" .. XXOooX ", -" .o.. XooX ", -" .ooO... XXX ", -" .ooOOOO.......... ", -" .ooOOOOOOOOOOOOOO.. ", -" .ooOOOOOOOOOOOOOOOO.. ", -" .ooOOOOOOOOOOOOOOOOOO......... ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", -" .ooooooooooooooooooooooooooooX ", -" .ooooooooooooooooooooooooooooX ", -" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " -}; +/* XPM */ +static const char *const missimg_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 5 1", +"X c Black", +"o c #FFFFFF", +" c None", +". c #C0C0C0", +"O c #E0E0E0", +/* pixels */ +" .............................X ", +" .ooooooooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooooooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOXOOOOOOOOOOOOOOOOooX ", +" XXXOOOOOXX XOOOOOOOOOOOOOOOooX ", +" XXXXX XOOOOOOOOOOOOOOooX ", +" XOOOXXXOOOOOOOooX ", +" XXX XXOOOOOooX ", +" XOOOOooX ", +" . XOOOooX ", +" .. XXOooX ", +" .o.. XooX ", +" .ooO... XXX ", +" .ooOOOO.......... ", +" .ooOOOOOOOOOOOOOO.. ", +" .ooOOOOOOOOOOOOOOOO.. ", +" .ooOOOOOOOOOOOOOOOOOO......... ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooOOOOOOOOOOOOOOOOOOOOOOOOooX ", +" .ooooooooooooooooooooooooooooX ", +" .ooooooooooooooooooooooooooooX ", +" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " +}; diff --git a/Externals/wxWidgets3/art/motif/error.xpm b/Externals/wxWidgets3/art/motif/error.xpm index 2505d3d4a8..559715c64c 100644 --- a/Externals/wxWidgets3/art/motif/error.xpm +++ b/Externals/wxWidgets3/art/motif/error.xpm @@ -1,58 +1,58 @@ -/* XPM */ -static const char *const error_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 4 1", -" c None", -"X c #242424", -"o c #DCDF00", -". c #C00000", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ..... ", -" ............. ", -" ................. ", -" ................... ", -" ....................... ", -" ......................... ", -" ........................... ", -" ...........................X ", -" .............................X ", -" ............................... ", -" ...............................X ", -" .................................X ", -" .................................X ", -" .................................XX ", -" ...ooooooooooooooooooooooooooo...XX ", -" ....ooooooooooooooooooooooooooo....X ", -" ....ooooooooooooooooooooooooooo....X ", -" ....ooooooooooooooooooooooooooo....XX ", -" ....ooooooooooooooooooooooooooo....XX ", -" ....ooooooooooooooooooooooooooo....XX ", -" ...ooooooooooooooooooooooooooo...XXX ", -" ...ooooooooooooooooooooooooooo...XXX ", -" .................................XX ", -" .................................XX ", -" ...............................XXX ", -" ...............................XXX ", -" .............................XXX ", -" ...........................XXXX ", -" ...........................XXX ", -" .........................XXX ", -" .......................XXXX ", -" X...................XXXXX ", -" X.................XXXXX ", -" X.............XXXXX ", -" XXXX.....XXXXXXXX ", -" XXXXXXXXXXXXX ", -" XXXXX ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const error_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 4 1", +" c None", +"X c #242424", +"o c #DCDF00", +". c #C00000", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ............. ", +" ................. ", +" ................... ", +" ....................... ", +" ......................... ", +" ........................... ", +" ...........................X ", +" .............................X ", +" ............................... ", +" ...............................X ", +" .................................X ", +" .................................X ", +" .................................XX ", +" ...ooooooooooooooooooooooooooo...XX ", +" ....ooooooooooooooooooooooooooo....X ", +" ....ooooooooooooooooooooooooooo....X ", +" ....ooooooooooooooooooooooooooo....XX ", +" ....ooooooooooooooooooooooooooo....XX ", +" ....ooooooooooooooooooooooooooo....XX ", +" ...ooooooooooooooooooooooooooo...XXX ", +" ...ooooooooooooooooooooooooooo...XXX ", +" .................................XX ", +" .................................XX ", +" ...............................XXX ", +" ...............................XXX ", +" .............................XXX ", +" ...........................XXXX ", +" ...........................XXX ", +" .........................XXX ", +" .......................XXXX ", +" X...................XXXXX ", +" X.................XXXXX ", +" X.............XXXXX ", +" XXXX.....XXXXXXXX ", +" XXXXXXXXXXXXX ", +" XXXXX ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/motif/info.xpm b/Externals/wxWidgets3/art/motif/info.xpm index 8883955448..fe32e61982 100644 --- a/Externals/wxWidgets3/art/motif/info.xpm +++ b/Externals/wxWidgets3/art/motif/info.xpm @@ -1,63 +1,63 @@ -/* XPM */ -static const char *const info_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 9 1", -"$ c Black", -"O c #FFFFFF", -"@ c #808080", -"+ c #000080", -"o c #E8EB01", -" c None", -"X c #FFFF40", -"# c #C0C0C0", -". c #ABAD01", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ..... ", -" ..XXXXX.. ", -" ..XXXXXXXXo.. ", -" .XXXOXXXXXXXoo. ", -" .XOOXXX+XXXXXo. ", -" .XOOOXX+++XXXXoo. ", -" .XOOXXX+++XXXXXo. ", -" .XOOOXXX+++XXXXXXo. ", -" .XOOXXXX+++XXXXXXo. ", -" .XXXXXXX+++XXXXXXX. ", -" .XXXXXXX+++XXXXXXo. ", -" .XXXXXXX+++XXXXXoo. ", -" .XXXXXX+++XXXXXo. ", -" .XXXXXXX+XXXXXXo. ", -" .XXXXXXXXXXXXo. ", -" .XXXXX+++XXXoo. ", -" .XXXX+++XXoo. ", -" .XXXXXXXXo. ", -" ..XXXXXXo.. ", -" .XXXXXo.. ", -" @#######@ ", -" @@@@@@@@@ ", -" @#######@ ", -" @@@@@@@@@ ", -" @#######@ ", -" @@@@@@@ ", -" ### ", -" $$$ ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const info_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 9 1", +"$ c Black", +"O c #FFFFFF", +"@ c #808080", +"+ c #000080", +"o c #E8EB01", +" c None", +"X c #FFFF40", +"# c #C0C0C0", +". c #ABAD01", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ..... ", +" ..XXXXX.. ", +" ..XXXXXXXXo.. ", +" .XXXOXXXXXXXoo. ", +" .XOOXXX+XXXXXo. ", +" .XOOOXX+++XXXXoo. ", +" .XOOXXX+++XXXXXo. ", +" .XOOOXXX+++XXXXXXo. ", +" .XOOXXXX+++XXXXXXo. ", +" .XXXXXXX+++XXXXXXX. ", +" .XXXXXXX+++XXXXXXo. ", +" .XXXXXXX+++XXXXXoo. ", +" .XXXXXX+++XXXXXo. ", +" .XXXXXXX+XXXXXXo. ", +" .XXXXXXXXXXXXo. ", +" .XXXXX+++XXXoo. ", +" .XXXX+++XXoo. ", +" .XXXXXXXXo. ", +" ..XXXXXXo.. ", +" .XXXXXo.. ", +" @#######@ ", +" @@@@@@@@@ ", +" @#######@ ", +" @@@@@@@@@ ", +" @#######@ ", +" @@@@@@@ ", +" ### ", +" $$$ ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/motif/question.xpm b/Externals/wxWidgets3/art/motif/question.xpm index 701f4457ba..cb0001ec80 100644 --- a/Externals/wxWidgets3/art/motif/question.xpm +++ b/Externals/wxWidgets3/art/motif/question.xpm @@ -1,75 +1,75 @@ -/* XPM */ -static const char *const question_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 21 1", -". c Black", -"> c #696969", -"O c #1F1F00", -"+ c #181818", -"o c #F6F900", -"; c #3F3F00", -"$ c #111111", -" c None", -"& c #202020", -"X c #AAAA00", -"@ c #949400", -": c #303030", -"1 c #383838", -"% c #2A2A00", -", c #404040", -"= c #B4B400", -"- c #484848", -"# c #151500", -"< c #9F9F00", -"2 c #6A6A00", -"* c #353500", -/* pixels */ -" ", -" ", -" ", -" ", -" ......... ", -" ...XXXXXXX.. ", -" ..XXXXoooooXXXO+ ", -" ..XXooooooooooooX@.. ", -" ..XoooooooooooooooXX#. ", -" $%XoooooooooooooooooXX#. ", -" &.XoooooooXXXXXXooooooXX.. ", -" .XooooooXX.$...$XXoooooX*. ", -" $.XoooooX%.$ .*oooooo=.. ", -" .XooooooX.. -.XoooooX.. ", -" .XoooooX..+ .XoooooX;. ", -" ...XXXX..: .XoooooX;. ", -" ........ >.XoooooX;. ", -" +.XoooooX.. ", -" ,.Xoooooo<.. ", -" 1#XooooooXO.. ", -" &#XooooooX2.. ", -" $%XooooooXX.. ", -" $%XooooooXX.. ", -" $%XooooooXX.. ", -" &.XooooooXX.. ", -" .XooooooXX.. ", -" &.XoooooXX.. ", -" ..XooooXX.. ", -" ..XooooX... ", -" ..XXooXX..& ", -" ...XXXXX.. ", -" ........ ", -" ", -" ", -" ....... ", -" ..XXXXX.. ", -" ..XXoooXX.. ", -" ..XoooooX.. ", -" ..XoooooX.. ", -" ..XXoooXX.. ", -" ..XXXXX.. ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const question_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 21 1", +". c Black", +"> c #696969", +"O c #1F1F00", +"+ c #181818", +"o c #F6F900", +"; c #3F3F00", +"$ c #111111", +" c None", +"& c #202020", +"X c #AAAA00", +"@ c #949400", +": c #303030", +"1 c #383838", +"% c #2A2A00", +", c #404040", +"= c #B4B400", +"- c #484848", +"# c #151500", +"< c #9F9F00", +"2 c #6A6A00", +"* c #353500", +/* pixels */ +" ", +" ", +" ", +" ", +" ......... ", +" ...XXXXXXX.. ", +" ..XXXXoooooXXXO+ ", +" ..XXooooooooooooX@.. ", +" ..XoooooooooooooooXX#. ", +" $%XoooooooooooooooooXX#. ", +" &.XoooooooXXXXXXooooooXX.. ", +" .XooooooXX.$...$XXoooooX*. ", +" $.XoooooX%.$ .*oooooo=.. ", +" .XooooooX.. -.XoooooX.. ", +" .XoooooX..+ .XoooooX;. ", +" ...XXXX..: .XoooooX;. ", +" ........ >.XoooooX;. ", +" +.XoooooX.. ", +" ,.Xoooooo<.. ", +" 1#XooooooXO.. ", +" &#XooooooX2.. ", +" $%XooooooXX.. ", +" $%XooooooXX.. ", +" $%XooooooXX.. ", +" &.XooooooXX.. ", +" .XooooooXX.. ", +" &.XoooooXX.. ", +" ..XooooXX.. ", +" ..XooooX... ", +" ..XXooXX..& ", +" ...XXXXX.. ", +" ........ ", +" ", +" ", +" ....... ", +" ..XXXXX.. ", +" ..XXoooXX.. ", +" ..XoooooX.. ", +" ..XoooooX.. ", +" ..XXoooXX.. ", +" ..XXXXX.. ", +" ....... ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/motif/warning.xpm b/Externals/wxWidgets3/art/motif/warning.xpm index 35e60316c3..58aee153fe 100644 --- a/Externals/wxWidgets3/art/motif/warning.xpm +++ b/Externals/wxWidgets3/art/motif/warning.xpm @@ -1,63 +1,63 @@ -/* XPM */ -static const char *const warning_xpm[] = { -/* columns rows colors chars-per-pixel */ -"48 48 9 1", -"@ c Black", -"o c #A6A800", -"+ c #8A8C00", -"$ c #B8BA00", -" c None", -"O c #6E7000", -"X c #DCDF00", -". c #C00000", -"# c #373800", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . ", -" ... ", -" ... ", -" ..... ", -" ...X.. ", -" ..XXX.. ", -" ...XXX... ", -" ..XXXXX.. ", -" ..XXXXXX... ", -" ...XXoO+XX.. ", -" ..XXXO@#XXX.. ", -" ..XXXXO@#XXX... ", -" ...XXXXO@#XXXX.. ", -" ..XXXXXO@#XXXX... ", -" ...XXXXXo@OXXXXX.. ", -" ...XXXXXXo@OXXXXXX.. ", -" ..XXXXXXX$@OXXXXXX... ", -" ...XXXXXXXX@XXXXXXXX.. ", -" ...XXXXXXXXXXXXXXXXXX... ", -" ..XXXXXXXXXXOXXXXXXXXX.. ", -" ...XXXXXXXXXO@#XXXXXXXXX.. ", -" ..XXXXXXXXXXX#XXXXXXXXXX... ", -" ...XXXXXXXXXXXXXXXXXXXXXXX.. ", -" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", -" .............................. ", -" .............................. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" " -}; +/* XPM */ +static const char *const warning_xpm[] = { +/* columns rows colors chars-per-pixel */ +"48 48 9 1", +"@ c Black", +"o c #A6A800", +"+ c #8A8C00", +"$ c #B8BA00", +" c None", +"O c #6E7000", +"X c #DCDF00", +". c #C00000", +"# c #373800", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . ", +" ... ", +" ... ", +" ..... ", +" ...X.. ", +" ..XXX.. ", +" ...XXX... ", +" ..XXXXX.. ", +" ..XXXXXX... ", +" ...XXoO+XX.. ", +" ..XXXO@#XXX.. ", +" ..XXXXO@#XXX... ", +" ...XXXXO@#XXXX.. ", +" ..XXXXXO@#XXXX... ", +" ...XXXXXo@OXXXXX.. ", +" ...XXXXXXo@OXXXXXX.. ", +" ..XXXXXXX$@OXXXXXX... ", +" ...XXXXXXXX@XXXXXXXX.. ", +" ...XXXXXXXXXXXXXXXXXX... ", +" ..XXXXXXXXXXOXXXXXXXXX.. ", +" ...XXXXXXXXXO@#XXXXXXXXX.. ", +" ..XXXXXXXXXXX#XXXXXXXXXX... ", +" ...XXXXXXXXXXXXXXXXXXXXXXX.. ", +" ...XXXXXXXXXXXXXXXXXXXXXXXX... ", +" .............................. ", +" .............................. ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/Externals/wxWidgets3/art/new.xpm b/Externals/wxWidgets3/art/new.xpm index 6a0b133350..15826c8d22 100644 --- a/Externals/wxWidgets3/art/new.xpm +++ b/Externals/wxWidgets3/art/new.xpm @@ -1,50 +1,50 @@ -/* XPM */ -static const char *const new_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 29 1", -"* c #97C4E7", -"- c #72A8D2", -": c #FFFFFF", -"9 c #839CB5", -"o c #6B98B8", -"X c #5A89A6", -"# c #3A749C", -", c #D1E5F5", -"0 c #85A7BC", -"$ c #C3DDF1", -"8 c #749BB4", -"; c #5F9BC8", -" c None", -"+ c #538DB3", -"= c #85BBE2", -"3 c #EFF6FC", -"O c #6591AE", -"5 c #F7FBFD", -"7 c #FAFCFE", -"< c #DAEAF7", -"4 c #E9F3FA", -"6 c #FDFDFE", -"1 c #E2EFF8", -". c #8EA9BC", -"% c #B6D5EE", -"& c #A5CCEA", -"> c #ACE95B", -"2 c #F4F9FD", -"@ c #4581AA", -/* pixels */ -" .XoOO+@#. ", -" .$$%&*=O-; ", -" @@@@$%&*O:*o ", -" @>>@$$%&O::*o ", -"@@@>>@@@$%OOoO+ ", -"@>>>>>>@,$%&*=+ ", -"@>>>>>>@<,$%&*+ ", -"@@@>>@@@1<,$%&O ", -" @>>@2341<,$%O ", -" @@@@52341<,$o ", -" .:6752341<,8 ", -" .::6752341<8 ", -" .:::67523419 ", -" .::::6752340 ", -" ............ " -}; +/* XPM */ +static const char *const new_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 29 1", +"* c #97C4E7", +"- c #72A8D2", +": c #FFFFFF", +"9 c #839CB5", +"o c #6B98B8", +"X c #5A89A6", +"# c #3A749C", +", c #D1E5F5", +"0 c #85A7BC", +"$ c #C3DDF1", +"8 c #749BB4", +"; c #5F9BC8", +" c None", +"+ c #538DB3", +"= c #85BBE2", +"3 c #EFF6FC", +"O c #6591AE", +"5 c #F7FBFD", +"7 c #FAFCFE", +"< c #DAEAF7", +"4 c #E9F3FA", +"6 c #FDFDFE", +"1 c #E2EFF8", +". c #8EA9BC", +"% c #B6D5EE", +"& c #A5CCEA", +"> c #ACE95B", +"2 c #F4F9FD", +"@ c #4581AA", +/* pixels */ +" .XoOO+@#. ", +" .$$%&*=O-; ", +" @@@@$%&*O:*o ", +" @>>@$$%&O::*o ", +"@@@>>@@@$%OOoO+ ", +"@>>>>>>@,$%&*=+ ", +"@>>>>>>@<,$%&*+ ", +"@@@>>@@@1<,$%&O ", +" @>>@2341<,$%O ", +" @@@@52341<,$o ", +" .:6752341<,8 ", +" .::6752341<8 ", +" .:::67523419 ", +" .::::6752340 ", +" ............ " +}; diff --git a/Externals/wxWidgets3/art/new_dir.xpm b/Externals/wxWidgets3/art/new_dir.xpm index d100eea753..f49515e71b 100644 --- a/Externals/wxWidgets3/art/new_dir.xpm +++ b/Externals/wxWidgets3/art/new_dir.xpm @@ -1,43 +1,43 @@ -/* XPM */ -static const char *const new_dir_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 22 1", -"X c Black", -"> c #9BACC2", -"o c #547897", -"1 c #7F99B4", -"O c #D1D9E5", -"< c #EAEDF3", -"# c #CAD2DC", -"3 c #718BA7", -"@ c #BECAD9", -"& c #E1E6EE", -"; c #F5F6F7", -". c #FFFF00", -", c #8DA0B9", -" c None", -"% c #D6DFE7", -"$ c #D2D9E0", -"- c #ADBACE", -"= c #EEF1F3", -"+ c #B3BFD1", -"2 c #7A90AC", -": c #A2B3C5", -"* c #E5EAF1", -/* pixels */ -" .X .XX.", -" ooooo .X.X. ", -" oOOOOo XX...XX", -" oooooooo.......", -" o+@#$%&*XX...XX", -" o+@#$%&*=.X.X. ", -" o-+@#O%&.X;.X .", -" o:-+@#O%&*=;o ", -" o>:-+@#O%&*=o ", -" o,>:-+@#O%&:-+@#O%&o ", -" o21,>:-+@#O%o ", -" o321,>:-+@#Oo ", -" ooooooooooooo ", -" " -}; +/* XPM */ +static const char *const new_dir_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 22 1", +"X c Black", +"> c #9BACC2", +"o c #547897", +"1 c #7F99B4", +"O c #D1D9E5", +"< c #EAEDF3", +"# c #CAD2DC", +"3 c #718BA7", +"@ c #BECAD9", +"& c #E1E6EE", +"; c #F5F6F7", +". c #FFFF00", +", c #8DA0B9", +" c None", +"% c #D6DFE7", +"$ c #D2D9E0", +"- c #ADBACE", +"= c #EEF1F3", +"+ c #B3BFD1", +"2 c #7A90AC", +": c #A2B3C5", +"* c #E5EAF1", +/* pixels */ +" .X .XX.", +" ooooo .X.X. ", +" oOOOOo XX...XX", +" oooooooo.......", +" o+@#$%&*XX...XX", +" o+@#$%&*=.X.X. ", +" o-+@#O%&.X;.X .", +" o:-+@#O%&*=;o ", +" o>:-+@#O%&*=o ", +" o,>:-+@#O%&:-+@#O%&o ", +" o21,>:-+@#O%o ", +" o321,>:-+@#Oo ", +" ooooooooooooo ", +" " +}; diff --git a/Externals/wxWidgets3/art/osx/README b/Externals/wxWidgets3/art/osx/README deleted file mode 100644 index 6b959391ae..0000000000 --- a/Externals/wxWidgets3/art/osx/README +++ /dev/null @@ -1,2 +0,0 @@ -The files in this directory are the sources which were converted by -misc/scripts/png2c.py and included in src/osx/carbon/renderer.cpp. diff --git a/Externals/wxWidgets3/art/osx/close.png b/Externals/wxWidgets3/art/osx/close.png deleted file mode 100644 index 7d8f22e77b735aa3f31feab8179fca8af6eb8c15..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 400 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v_d#0*}aI z1_o{+5N5n|x9$%}u&lr_9Y}-qGi;3h_#Mc3@9E+gqH%udB||S}M~R~!?;i_g+9a{T zxc5e0m&meBCl!mhZ^yXKuvR%fGgp`8GN+SAYC=v~s*H$hyy>6kw$EnwhyPr|Hhso} zJ?ZRw9=-#}-MhueHo*1X%x89%-lyVs2lpJ3_4|A=spos{?R5)Y?|PeK zR;{tDUi#})k;T)+F+}71+)I1CoDCU{e!Sls=ECB7 z;b`a`uD-W#p1e`HlCBx~OKffpyKKy^rHeI`rmWMG^@5FM3i~837PLCtH-GEg*?W@ZiuML?Q8;!Z&d+2| zSX?zjZp=fiV-_o3@AA{UE2h7+B>H-(Y_g09|68u-JDEH*W6Q1Pc7Lp>VNbpDwk%&t zHBD4+e+x{GzU17)Diy0=|iau3)@73O{vXHTB z6HxnG_kShhA#cUy3>SVq&XTVZl;nU-c%lwV$~Taa3$TU=6})QPb1KF+}71+)0L6haE&*=IcB>B*1ax zfl`?wi>B}g){v!L{F{3D7AUU>Tg?1|V^_nj4X#|%nUo`%9TE~b1X;o}za4h7P)Rv; zQ}WsWzmGr4YAZ0A9k^7a{(wWKA+BX!auv(A1G3i*8S)Rv9VquPEI52V;)bVPV_n+u z+f2m`ck{N-vXaTm+o~;J!6fH0A@yeW``_=QUK=}1QVE>3?EJAA>oR9uRO@f-WnZvr zl^xIFC{0oBeXCDv&PTW3{NWS1ehHHMYb03O*8)2dEj2AuFE8qi9OHN z{Db@(ZQn)Nx%;dO&=lRC`}^UW$}f%F1^ha*mPz&+#zszaH_TiMwB?*3Z^N`_9*ocS zuPI~9O3*+1GFLh8?c8;V3~?K$epc(R*ZV0R5LqH@;>Z#O3_*pekcg6!%(OJCqWtn= r-GbC2-Qtp>%mN06id)884Okf%-5C~J+$y&Qs%7wW^>bP0l+XkK3|_9U diff --git a/Externals/wxWidgets3/art/paste.xpm b/Externals/wxWidgets3/art/paste.xpm index 2458378f86..a2155a3e9b 100644 --- a/Externals/wxWidgets3/art/paste.xpm +++ b/Externals/wxWidgets3/art/paste.xpm @@ -1,46 +1,46 @@ -/* XPM */ -static const char *const paste_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 25 1", -"< c #FEECE4", -"> c #FEE3D7", -"O c #FFFFFF", -"o c #7B767D", -"% c #F79586", -"& c #CAE1F3", -"@ c #F08B62", -"# c #FCCBB8", -"- c #FDD8C9", -"4 c #FFF8F4", -"5 c #FFF5F0", -" c None", -"$ c #F8AA8F", -", c #EFF6FC", -"1 c #F7FBFD", -"2 c #FAFCFE", -"; c #DAEAF7", -": c #E9F3FA", -"6 c #FFFAF8", -". c #3C78A6", -"3 c #FFF1ED", -"X c #9B8687", -"+ c #FBBCA4", -"* c #B6D5EE", -"= c #F4F9FD", -/* pixels */ -" ...... ", -" .XoOOOOoo. ", -".+XOOOOOOX@. ", -".+XXXXXXXX@. ", -".#++$$%@..... ", -".##++$$%.&*.=. ", -".-##++$$.;&.==. ", -".--##++$.:;.... ", -".>--##++.,:;&*. ", -".<>--##+.1,:;&. ", -".<<>--##.21,:;. ", -".3<<>--#.O21=:. ", -".45<<>--....... ", -".6453<>----. ", -"............ " -}; +/* XPM */ +static const char *const paste_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 25 1", +"< c #FEECE4", +"> c #FEE3D7", +"O c #FFFFFF", +"o c #7B767D", +"% c #F79586", +"& c #CAE1F3", +"@ c #F08B62", +"# c #FCCBB8", +"- c #FDD8C9", +"4 c #FFF8F4", +"5 c #FFF5F0", +" c None", +"$ c #F8AA8F", +", c #EFF6FC", +"1 c #F7FBFD", +"2 c #FAFCFE", +"; c #DAEAF7", +": c #E9F3FA", +"6 c #FFFAF8", +". c #3C78A6", +"3 c #FFF1ED", +"X c #9B8687", +"+ c #FBBCA4", +"* c #B6D5EE", +"= c #F4F9FD", +/* pixels */ +" ...... ", +" .XoOOOOoo. ", +".+XOOOOOOX@. ", +".+XXXXXXXX@. ", +".#++$$%@..... ", +".##++$$%.&*.=. ", +".-##++$$.;&.==. ", +".--##++$.:;.... ", +".>--##++.,:;&*. ", +".<>--##+.1,:;&. ", +".<<>--##.21,:;. ", +".3<<>--#.O21=:. ", +".45<<>--....... ", +".6453<>----. ", +"............ " +}; diff --git a/Externals/wxWidgets3/art/print.xpm b/Externals/wxWidgets3/art/print.xpm index dbdfe6b4d9..9afe540134 100644 --- a/Externals/wxWidgets3/art/print.xpm +++ b/Externals/wxWidgets3/art/print.xpm @@ -1,60 +1,60 @@ -/* XPM */ -static const char *const print_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 39 1", -"< c #E3E4E6", -"+ c #C3C3C4", -"i c #FFFFFF", -": c #74879B", -"# c #5A89A6", -"a c #F1F4F7", -"r c #5A809C", -"@ c #BDCCD9", -"e c #7A92A4", -"% c #3F6F93", -"t c #9FA2A6", -"3 c #939495", -"w c #5F666D", -"9 c #65839E", -"5 c #4A7291", -"$ c #4B7F9E", -" c None", -"O c #DFE0E2", -"o c #F3F3F3", -"; c #84A5BB", -"& c #467291", -". c #7897AD", -"* c #407598", -"4 c #CFCFD0", -"7 c #6F90A6", -"y c #6A89A2", -"0 c #AAADB2", -"1 c #D2D3D4", -"u c #4F7592", -", c #BCBDBE", -"p c #57778E", -"q c #979BA0", -"2 c #ABABAC", -"- c #E7E7E7", -"= c #D6DEE6", -"> c #9FA0A0", -"8 c #829EB5", -"X c #8FB0C3", -"6 c #5D7C93", -/* pixels */ -" .XXXXXXXX ", -" .oooooooX ", -" .OOOOOOOX ", -" .+++++++X ", -"@##$%&&&&&%*##@ ", -"$=-;:>,<123$-=$ ", -".44.5678.96$44. ", -"7,,,,,,,,,,,,,7 ", -"900qwwwwwwwe009 ", -"rtt9ryyyyyyuttr ", -"6qq6iiiiiii%qq6 ", -"633paiiiiii%336 ", -"XXX*iiiiiii%XXX ", -" 6iiiiiii% ", -" $XXXXXXX# " -}; +/* XPM */ +static const char *const print_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 39 1", +"< c #E3E4E6", +"+ c #C3C3C4", +"i c #FFFFFF", +": c #74879B", +"# c #5A89A6", +"a c #F1F4F7", +"r c #5A809C", +"@ c #BDCCD9", +"e c #7A92A4", +"% c #3F6F93", +"t c #9FA2A6", +"3 c #939495", +"w c #5F666D", +"9 c #65839E", +"5 c #4A7291", +"$ c #4B7F9E", +" c None", +"O c #DFE0E2", +"o c #F3F3F3", +"; c #84A5BB", +"& c #467291", +". c #7897AD", +"* c #407598", +"4 c #CFCFD0", +"7 c #6F90A6", +"y c #6A89A2", +"0 c #AAADB2", +"1 c #D2D3D4", +"u c #4F7592", +", c #BCBDBE", +"p c #57778E", +"q c #979BA0", +"2 c #ABABAC", +"- c #E7E7E7", +"= c #D6DEE6", +"> c #9FA0A0", +"8 c #829EB5", +"X c #8FB0C3", +"6 c #5D7C93", +/* pixels */ +" .XXXXXXXX ", +" .oooooooX ", +" .OOOOOOOX ", +" .+++++++X ", +"@##$%&&&&&%*##@ ", +"$=-;:>,<123$-=$ ", +".44.5678.96$44. ", +"7,,,,,,,,,,,,,7 ", +"900qwwwwwwwe009 ", +"rtt9ryyyyyyuttr ", +"6qq6iiiiiii%qq6 ", +"633paiiiiii%336 ", +"XXX*iiiiiii%XXX ", +" 6iiiiiii% ", +" $XXXXXXX# " +}; diff --git a/Externals/wxWidgets3/art/quit.xpm b/Externals/wxWidgets3/art/quit.xpm index 885bbd0fa4..df8abd675d 100644 --- a/Externals/wxWidgets3/art/quit.xpm +++ b/Externals/wxWidgets3/art/quit.xpm @@ -1,90 +1,90 @@ -/* XPM */ -static const char *const quit_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 69 1", -"@ c Black", -"i c #9AEA53", -"D c #7E9BB1", -"H c #839FB4", -", c #B7C7D3", -"8 c #BCCBD6", -"7 c #C1CFDA", -"v c #92ABBD", -"- c #D0DBE2", -"O c #547897", -"+ c #376485", -"L c #7090A8", -"t c #AEC0CE", -"g c #B3C4D1", -"S c #84A0B4", -"G c #89A4B8", -"> c #BDCCD7", -"F c #5A809C", -"2 c #C2D0DA", -"k c #93ACBE", -"= c #D6E0E6", -"* c #446A8C", -"z c #A5B9C8", -"# c #DEE5EB", -"0 c #AFC1CE", -"r c #B4C5D2", -"p c #B9C9D5", -"A c #8AA5B8", -"M c #92AABD", -"j c #A6BAC9", -"K c #7796AC", -"l c #ABBECC", -"o c #E4EAEF", -"9 c #B5C6D2", -" c None", -"; c #C9D6DF", -"X c #305F81", -"m c #98AFC0", -"V c #9DB3C3", -"% c #D1DBE3", -"u c #A2B7C6", -"y c #A7BBCA", -"h c #ACBFCD", -"4 c #B6C7D3", -"w c #C0CFD9", -"d c #982106", -"B c #85A0B5", -"6 c #C8D4DE", -"c c #99B0C1", -"x c #9EB4C4", -"$ c #D7E0E7", -"q c #A8BCCA", -"s c #ADC0CD", -"3 c #BCCCD7", -"N c #8BA5B9", -": c #C4D1DB", -"1 c #C9D5DE", -"f c #9AB1C2", -"n c #A4B9C8", -"a c #B3C5D1", -". c #215579", -"J c #7D9AB0", -"& c #829EB5", -"e c #BBCAD6", -"b c #8CA6B9", -"Z c #91AABC", -"C c #96AEC0", -"< c #CFDAE2", -"5 c #AFC2CF", -/* pixels */ -" ..XXXXXXXXXX ", -" XoO+X@@@@@@X ", -" X#$%&X*@@@@X ", -" X=-;:>,X@@@X ", -" X<12345X@@@X ", -" X67890qX@XXX ", -" XwertyuX@XiX ", -" XpasddfX++iiX ", -" XghjddkXiiiiiX ", -" XlzxcvbXiiiiiiX", -" XnxmMNBXiiiiiX ", -" XVCZASDXXXiiX ", -" XXFGHJKX XiX ", -" FXXFLX XX ", -" XX* " -}; +/* XPM */ +static const char *const quit_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 69 1", +"@ c Black", +"i c #9AEA53", +"D c #7E9BB1", +"H c #839FB4", +", c #B7C7D3", +"8 c #BCCBD6", +"7 c #C1CFDA", +"v c #92ABBD", +"- c #D0DBE2", +"O c #547897", +"+ c #376485", +"L c #7090A8", +"t c #AEC0CE", +"g c #B3C4D1", +"S c #84A0B4", +"G c #89A4B8", +"> c #BDCCD7", +"F c #5A809C", +"2 c #C2D0DA", +"k c #93ACBE", +"= c #D6E0E6", +"* c #446A8C", +"z c #A5B9C8", +"# c #DEE5EB", +"0 c #AFC1CE", +"r c #B4C5D2", +"p c #B9C9D5", +"A c #8AA5B8", +"M c #92AABD", +"j c #A6BAC9", +"K c #7796AC", +"l c #ABBECC", +"o c #E4EAEF", +"9 c #B5C6D2", +" c None", +"; c #C9D6DF", +"X c #305F81", +"m c #98AFC0", +"V c #9DB3C3", +"% c #D1DBE3", +"u c #A2B7C6", +"y c #A7BBCA", +"h c #ACBFCD", +"4 c #B6C7D3", +"w c #C0CFD9", +"d c #982106", +"B c #85A0B5", +"6 c #C8D4DE", +"c c #99B0C1", +"x c #9EB4C4", +"$ c #D7E0E7", +"q c #A8BCCA", +"s c #ADC0CD", +"3 c #BCCCD7", +"N c #8BA5B9", +": c #C4D1DB", +"1 c #C9D5DE", +"f c #9AB1C2", +"n c #A4B9C8", +"a c #B3C5D1", +". c #215579", +"J c #7D9AB0", +"& c #829EB5", +"e c #BBCAD6", +"b c #8CA6B9", +"Z c #91AABC", +"C c #96AEC0", +"< c #CFDAE2", +"5 c #AFC2CF", +/* pixels */ +" ..XXXXXXXXXX ", +" XoO+X@@@@@@X ", +" X#$%&X*@@@@X ", +" X=-;:>,X@@@X ", +" X<12345X@@@X ", +" X67890qX@XXX ", +" XwertyuX@XiX ", +" XpasddfX++iiX ", +" XghjddkXiiiiiX ", +" XlzxcvbXiiiiiiX", +" XnxmMNBXiiiiiX ", +" XVCZASDXXXiiX ", +" XXFGHJKX XiX ", +" FXXFLX XX ", +" XX* " +}; diff --git a/Externals/wxWidgets3/art/redo.xpm b/Externals/wxWidgets3/art/redo.xpm index 84ed3553ca..d20afdcc8c 100644 --- a/Externals/wxWidgets3/art/redo.xpm +++ b/Externals/wxWidgets3/art/redo.xpm @@ -1,58 +1,58 @@ -/* XPM */ -static const char *const redo_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 37 1", -"4 c #9BACC2", -"; c #4C7398", -"3 c #547B99", -"* c #547897", -"# c #5A89A6", -"8 c #3A749C", -"5 c #5A809C", -", c #7F99B4", -"& c #3F6F93", -"9 c #85A7BC", -"+ c #749BB4", -"> c #718BA7", -"e c #A5B3C8", -"w c #BECAD9", -": c #65839D", -"u c #E1E6EE", -"o c #236289", -"r c #ADBED2", -"= c #597B9A", -"2 c #8DA0B9", -" c None", -"% c #467291", -"1 c #7393AB", -"i c #4C809F", -"- c #A0BACB", -"O c #6591AE", -"X c #407598", -"6 c #6F90A6", -"t c #D2D9E0", -"7 c #ADBACE", -"@ c #326A8F", -"0 c #467A9C", -". c #ACC4D3", -"< c #7F97B0", -"y c #B3BFD1", -"q c #A2B3C5", -"$ c #8FB0C3", -/* pixels */ -" .XoooO ", -" +o@@@@@o# +", -" $@%%&@&%%&@ +o", -" X*=@+-+@*=;@#&@", -" @:=+ @=:=*:@", -" &>:$ @:>>>@", -" &,,,,&", -" +123 @<2222&", -" X44X #@56<44X", -" O1748 .9#&o", -" 0qwe8 ", -" 8rty8 ", -" 8wu+ ", -" i## ", -" " -}; +/* XPM */ +static const char *const redo_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 37 1", +"4 c #9BACC2", +"; c #4C7398", +"3 c #547B99", +"* c #547897", +"# c #5A89A6", +"8 c #3A749C", +"5 c #5A809C", +", c #7F99B4", +"& c #3F6F93", +"9 c #85A7BC", +"+ c #749BB4", +"> c #718BA7", +"e c #A5B3C8", +"w c #BECAD9", +": c #65839D", +"u c #E1E6EE", +"o c #236289", +"r c #ADBED2", +"= c #597B9A", +"2 c #8DA0B9", +" c None", +"% c #467291", +"1 c #7393AB", +"i c #4C809F", +"- c #A0BACB", +"O c #6591AE", +"X c #407598", +"6 c #6F90A6", +"t c #D2D9E0", +"7 c #ADBACE", +"@ c #326A8F", +"0 c #467A9C", +". c #ACC4D3", +"< c #7F97B0", +"y c #B3BFD1", +"q c #A2B3C5", +"$ c #8FB0C3", +/* pixels */ +" .XoooO ", +" +o@@@@@o# +", +" $@%%&@&%%&@ +o", +" X*=@+-+@*=;@#&@", +" @:=+ @=:=*:@", +" &>:$ @:>>>@", +" &,,,,&", +" +123 @<2222&", +" X44X #@56<44X", +" O1748 .9#&o", +" 0qwe8 ", +" 8rty8 ", +" 8wu+ ", +" i## ", +" " +}; diff --git a/Externals/wxWidgets3/art/removable.xpm b/Externals/wxWidgets3/art/removable.xpm index e066fd4df7..5b1d46b7dd 100644 --- a/Externals/wxWidgets3/art/removable.xpm +++ b/Externals/wxWidgets3/art/removable.xpm @@ -1,44 +1,44 @@ -/* XPM */ -static const char *const removable_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 15 23 1", -"@ c #C3C3C4", -"4 c #FFFFFF", -"o c #D5D6D8", -"> c #7A92A3", -". c #8497A5", -"% c #ACAEB2", -"2 c #4A7898", -": c #DCE2EA", -", c #F5F6F7", -"= c #EBEBEC", -"$ c #B7B7B8", -" c None", -"X c #DFE0E2", -"* c #A6A8AD", -"1 c #4C809F", -"3 c #407598", -"O c #CFCFD0", -"; c #9EA2A8", -"# c #BCBDBE", -"+ c #C6C8CA", -"- c #979BA0", -"& c #E7E7E7", -"< c #8FB0C3", -/* pixels */ -" ......... ", -" .XoO+@#$%. ", -" .XoO+@#$%. ", -" .&XoO+@#$%*. ", -" .&XoO+@#$%*. ", -" .=&XoO+@#$%*-. ", -" .=&XoO+@#$%*;. ", -".:=&XoO+@#$%*;>.", -".,=&XoO+@#$%*;-.", -"<..............<", -"<,=&XoO+@#$%%%%.", -" c #7A92A3", +". c #8497A5", +"% c #ACAEB2", +"2 c #4A7898", +": c #DCE2EA", +", c #F5F6F7", +"= c #EBEBEC", +"$ c #B7B7B8", +" c None", +"X c #DFE0E2", +"* c #A6A8AD", +"1 c #4C809F", +"3 c #407598", +"O c #CFCFD0", +"; c #9EA2A8", +"# c #BCBDBE", +"+ c #C6C8CA", +"- c #979BA0", +"& c #E7E7E7", +"< c #8FB0C3", +/* pixels */ +" ......... ", +" .XoO+@#$%. ", +" .XoO+@#$%. ", +" .&XoO+@#$%*. ", +" .&XoO+@#$%*. ", +" .=&XoO+@#$%*-. ", +" .=&XoO+@#$%*;. ", +".:=&XoO+@#$%*;>.", +".,=&XoO+@#$%*;-.", +"<..............<", +"<,=&XoO+@#$%%%%.", +" c #718BA7", -"0 c #A5B3C8", -"q c #BECAD9", -": c #65839D", -"u c #E1E6EE", -"X c #236289", -"y c #ADBED2", -"= c #597B9A", -"1 c #8DA0B9", -" c None", -"% c #467291", -"3 c #7393AB", -"i c #4C809F", -"; c #A0BACB", -". c #6591AE", -"o c #407598", -"5 c #6F90A6", -"t c #D2D9E0", -"9 c #ADBACE", -"# c #326A8F", -"e c #467A9C", -"O c #ACC4D3", -"< c #7F97B0", -"r c #B3BFD1", -"w c #A2B3C5", -"& c #8FB0C3", -/* pixels */ -" .XXXoO ", -"+ @X#####X+ ", -"X+ #$%%$#$%%#& ", -"#$@#*=-#+;+#=-o ", -"#:-=:=# +=:# ", -"#>>>:# &:>$ ", -"$,,,>o o<,$ ", -"$1111<# 213+ ", -"o44<56#@ o44o ", -"X$@7O 8493. ", -" 80qwe ", -" 8rty8 ", -" +uq8 ", -" @@i ", -" " -}; +/* XPM */ +static const char *const undo_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 15 37 1", +"4 c #9BACC2", +"* c #4C7398", +"2 c #547B99", +"- c #547897", +"@ c #5A89A6", +"8 c #3A749C", +"6 c #5A809C", +", c #7F99B4", +"$ c #3F6F93", +"7 c #85A7BC", +"+ c #749BB4", +"> c #718BA7", +"0 c #A5B3C8", +"q c #BECAD9", +": c #65839D", +"u c #E1E6EE", +"X c #236289", +"y c #ADBED2", +"= c #597B9A", +"1 c #8DA0B9", +" c None", +"% c #467291", +"3 c #7393AB", +"i c #4C809F", +"; c #A0BACB", +". c #6591AE", +"o c #407598", +"5 c #6F90A6", +"t c #D2D9E0", +"9 c #ADBACE", +"# c #326A8F", +"e c #467A9C", +"O c #ACC4D3", +"< c #7F97B0", +"r c #B3BFD1", +"w c #A2B3C5", +"& c #8FB0C3", +/* pixels */ +" .XXXoO ", +"+ @X#####X+ ", +"X+ #$%%$#$%%#& ", +"#$@#*=-#+;+#=-o ", +"#:-=:=# +=:# ", +"#>>>:# &:>$ ", +"$,,,>o o<,$ ", +"$1111<# 213+ ", +"o44<56#@ o44o ", +"X$@7O 8493. ", +" 80qwe ", +" 8rty8 ", +" +uq8 ", +" @@i ", +" " +}; diff --git a/Externals/wxWidgets3/art/up.xpm b/Externals/wxWidgets3/art/up.xpm index f29ed3d386..a93009f95c 100644 --- a/Externals/wxWidgets3/art/up.xpm +++ b/Externals/wxWidgets3/art/up.xpm @@ -1,21 +1,21 @@ -/* XPM */ -static const char *const up_xpm[] = { -"16 15 3 1", -" c None", -". c Black", -"X c Gray100", -" ", -" .. ", -" .XX. ", -" .XXXX. ", -" .XXXXXX. ", -" .XXXXXXXX. ", -" ....XXXX.... ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" .XXXX. ", -" ...... ", -" "}; +/* XPM */ +static const char *const up_xpm[] = { +"16 15 3 1", +" c None", +". c Black", +"X c Gray100", +" ", +" .. ", +" .XX. ", +" .XXXX. ", +" .XXXXXX. ", +" .XXXXXXXX. ", +" ....XXXX.... ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" ...... ", +" "}; diff --git a/Externals/wxWidgets3/art/wxwin16x16.xpm b/Externals/wxWidgets3/art/wxwin16x16.xpm index 119185329a..ed1848ea75 100644 --- a/Externals/wxWidgets3/art/wxwin16x16.xpm +++ b/Externals/wxWidgets3/art/wxwin16x16.xpm @@ -1,161 +1,161 @@ -/* XPM */ -static const char *const wxwin16x16_xpm[] = { -"16 16 142 2", -" c None", -". c #7171C0", -"+ c #7D7DC7", -"@ c #8181CE", -"# c #7979CE", -"$ c #7171CE", -"% c #6868CD", -"& c #5050C0", -"* c #7C7CCB", -"= c #D3D3FC", -"- c #C0C0FF", -"; c #B1B1FF", -"> c #A4A4FF", -", c #9696FF", -"' c #6B6BE3", -") c #3E3EC0", -"! c #7B7BD3", -"~ c #CFCFFF", -"{ c #A7A7FF", -"] c #8989FF", -"^ c #7B7BFF", -"/ c #5E5EEB", -"( c #3333BF", -"_ c #6969D3", -": c #BEBEFF", -"< c #8E8EFF", -"[ c #5E5EFF", -"} c #4C4CFD", -"| c #6464C6", -"1 c #A4A478", -"2 c #BFBF63", -"3 c #BFBF5C", -"4 c #BFBF56", -"5 c #BFBF51", -"6 c #C17474", -"7 c #BF7070", -"8 c #BF6969", -"9 c #BF6363", -"0 c #544AC7", -"a c #A8A8FF", -"b c #7070FF", -"c c #5050FF", -"d c #3F3FFF", -"e c #8C8CBA", -"f c #F6F6C8", -"g c #FBFBBB", -"h c #FBFBAE", -"i c #FBFBA1", -"j c #F9F993", -"k c #D7D760", -"l c #D28D8D", -"m c #EEB8B8", -"n c #EFAAAA", -"o c #EF9E9E", -"p c #7C5ABC", -"q c #8D8DFF", -"r c #4747FF", -"s c #3535FF", -"t c #2B2BFF", -"u c #AAAAA7", -"v c #FFFFD2", -"w c #FFFFA9", -"x c #FFFF9A", -"y c #FFFF8D", -"z c #FFFF80", -"A c #E4E45B", -"B c #E39F9F", -"C c #FFCCCC", -"D c #FFA9A9", -"E c #FF9C9C", -"F c #B469A0", -"G c #3E3DE7", -"H c #2828EF", -"I c #1E1EEF", -"J c #1515EF", -"K c #A5A595", -"L c #FFFFC2", -"M c #FFFF8F", -"N c #F7F765", -"O c #F2F251", -"P c #DBDB3A", -"Q c #E48E8E", -"R c #FFBABA", -"S c #FF8E8E", -"T c #FF8181", -"U c #FF6868", -"V c #E54D60", -"W c #AC2E56", -"X c #0B0BBF", -"Y c #0606BF", -"Z c #C8C85D", -"` c #FEFEB1", -" . c #FEFE74", -".. c #F4F456", -"+. c #EFEF42", -"@. c #EFEF38", -"#. c #D7D725", -"$. c #E47676", -"%. c #FFA8A8", -"&. c #FF7373", -"*. c #FF5555", -"=. c #FF4343", -"-. c #FF3939", -";. c #DA2323", -">. c #CFCF3C", -",. c #F6F694", -"'. c #F0F047", -"). c #EFEF2E", -"!. c #EFEF24", -"~. c #D7D715", -"{. c #E45757", -"]. c #FF8888", -"^. c #FF4646", -"/. c #FF2F2F", -"(. c #FF2525", -"_. c #DA1414", -":. c #C3C328", -"<. c #EBEB55", -"[. c #ECEC2F", -"}. c #ECEC24", -"|. c #ECEC1A", -"1. c #EBEB10", -"2. c #CDCD06", -"3. c #DD3A3A", -"4. c #FF6060", -"5. c #FF1B1B", -"6. c #FE1111", -"7. c #D10707", -"8. c #B8B819", -"9. c #B7B715", -"0. c #B7B710", -"a. c #B7B70B", -"b. c #B7B706", -"c. c #B7B701", -"d. c #B7B700", -"e. c #BF1A1A", -"f. c #CC1919", -"g. c #CE1414", -"h. c #CE0E0E", -"i. c #CE0808", -"j. c #C90202", -"k. c #C00000", -" ", -" ", -" . + @ # $ % & ", -" * = - ; > , ' ) ", -" ! ~ { , ] ^ / ( ", -" _ : < ^ [ } | 1 2 3 4 5 ", -"6 7 8 9 0 a b c d e f g h i j k ", -"l m n o p q r s t u v w x y z A ", -"B C D E F G H I J K L M z N O P ", -"Q R S T U V W X Y Z ` ...+.@.#.", -"$.%.&.*.=.-.;. >.,.'.@.).!.~.", -"{.].^.-./.(._. :.<.[.}.|.1.2.", -"3.4./.(.5.6.7. 8.9.0.a.b.c.d.", -"e.f.g.h.i.j.k. ", -" ", -" "}; +/* XPM */ +static const char *const wxwin16x16_xpm[] = { +"16 16 142 2", +" c None", +". c #7171C0", +"+ c #7D7DC7", +"@ c #8181CE", +"# c #7979CE", +"$ c #7171CE", +"% c #6868CD", +"& c #5050C0", +"* c #7C7CCB", +"= c #D3D3FC", +"- c #C0C0FF", +"; c #B1B1FF", +"> c #A4A4FF", +", c #9696FF", +"' c #6B6BE3", +") c #3E3EC0", +"! c #7B7BD3", +"~ c #CFCFFF", +"{ c #A7A7FF", +"] c #8989FF", +"^ c #7B7BFF", +"/ c #5E5EEB", +"( c #3333BF", +"_ c #6969D3", +": c #BEBEFF", +"< c #8E8EFF", +"[ c #5E5EFF", +"} c #4C4CFD", +"| c #6464C6", +"1 c #A4A478", +"2 c #BFBF63", +"3 c #BFBF5C", +"4 c #BFBF56", +"5 c #BFBF51", +"6 c #C17474", +"7 c #BF7070", +"8 c #BF6969", +"9 c #BF6363", +"0 c #544AC7", +"a c #A8A8FF", +"b c #7070FF", +"c c #5050FF", +"d c #3F3FFF", +"e c #8C8CBA", +"f c #F6F6C8", +"g c #FBFBBB", +"h c #FBFBAE", +"i c #FBFBA1", +"j c #F9F993", +"k c #D7D760", +"l c #D28D8D", +"m c #EEB8B8", +"n c #EFAAAA", +"o c #EF9E9E", +"p c #7C5ABC", +"q c #8D8DFF", +"r c #4747FF", +"s c #3535FF", +"t c #2B2BFF", +"u c #AAAAA7", +"v c #FFFFD2", +"w c #FFFFA9", +"x c #FFFF9A", +"y c #FFFF8D", +"z c #FFFF80", +"A c #E4E45B", +"B c #E39F9F", +"C c #FFCCCC", +"D c #FFA9A9", +"E c #FF9C9C", +"F c #B469A0", +"G c #3E3DE7", +"H c #2828EF", +"I c #1E1EEF", +"J c #1515EF", +"K c #A5A595", +"L c #FFFFC2", +"M c #FFFF8F", +"N c #F7F765", +"O c #F2F251", +"P c #DBDB3A", +"Q c #E48E8E", +"R c #FFBABA", +"S c #FF8E8E", +"T c #FF8181", +"U c #FF6868", +"V c #E54D60", +"W c #AC2E56", +"X c #0B0BBF", +"Y c #0606BF", +"Z c #C8C85D", +"` c #FEFEB1", +" . c #FEFE74", +".. c #F4F456", +"+. c #EFEF42", +"@. c #EFEF38", +"#. c #D7D725", +"$. c #E47676", +"%. c #FFA8A8", +"&. c #FF7373", +"*. c #FF5555", +"=. c #FF4343", +"-. c #FF3939", +";. c #DA2323", +">. c #CFCF3C", +",. c #F6F694", +"'. c #F0F047", +"). c #EFEF2E", +"!. c #EFEF24", +"~. c #D7D715", +"{. c #E45757", +"]. c #FF8888", +"^. c #FF4646", +"/. c #FF2F2F", +"(. c #FF2525", +"_. c #DA1414", +":. c #C3C328", +"<. c #EBEB55", +"[. c #ECEC2F", +"}. c #ECEC24", +"|. c #ECEC1A", +"1. c #EBEB10", +"2. c #CDCD06", +"3. c #DD3A3A", +"4. c #FF6060", +"5. c #FF1B1B", +"6. c #FE1111", +"7. c #D10707", +"8. c #B8B819", +"9. c #B7B715", +"0. c #B7B710", +"a. c #B7B70B", +"b. c #B7B706", +"c. c #B7B701", +"d. c #B7B700", +"e. c #BF1A1A", +"f. c #CC1919", +"g. c #CE1414", +"h. c #CE0E0E", +"i. c #CE0808", +"j. c #C90202", +"k. c #C00000", +" ", +" ", +" . + @ # $ % & ", +" * = - ; > , ' ) ", +" ! ~ { , ] ^ / ( ", +" _ : < ^ [ } | 1 2 3 4 5 ", +"6 7 8 9 0 a b c d e f g h i j k ", +"l m n o p q r s t u v w x y z A ", +"B C D E F G H I J K L M z N O P ", +"Q R S T U V W X Y Z ` ...+.@.#.", +"$.%.&.*.=.-.;. >.,.'.@.).!.~.", +"{.].^.-./.(._. :.<.[.}.|.1.2.", +"3.4./.(.5.6.7. 8.9.0.a.b.c.d.", +"e.f.g.h.i.j.k. ", +" ", +" "}; diff --git a/Externals/wxWidgets3/art/wxwin32x32.xpm b/Externals/wxWidgets3/art/wxwin32x32.xpm index d318f0aadb..25aed5e590 100644 --- a/Externals/wxWidgets3/art/wxwin32x32.xpm +++ b/Externals/wxWidgets3/art/wxwin32x32.xpm @@ -1,442 +1,442 @@ -/* XPM */ -static const char *const wxwin32x32_xpm[] = { -"32 32 407 2", -" c None", -". c #7373C1", -"+ c #6E6EBF", -"@ c #6B6BBF", -"# c #6868BF", -"$ c #6464BF", -"% c #6161BF", -"& c #5E5EBF", -"* c #5A5ABF", -"= c #5959C0", -"- c #7171C0", -"; c #7272C1", -"> c #8686CE", -", c #8686D0", -"' c #8282D0", -") c #7D7DD0", -"! c #7979D0", -"~ c #7575D0", -"{ c #7171D0", -"] c #6D6DD0", -"^ c #6666CD", -"/ c #5151C1", -"( c #4C4CBF", -"_ c #7171C1", -": c #7272C2", -"< c #C1C1F2", -"[ c #D7D7FF", -"} c #C9C9FF", -"| c #C2C2FF", -"1 c #BBBBFF", -"2 c #B4B4FF", -"3 c #AEAEFF", -"4 c #A7A7FF", -"5 c #A0A0FF", -"6 c #9A9AFF", -"7 c #8484F2", -"8 c #4949C2", -"9 c #4444C1", -"0 c #6A6AC0", -"a c #8989D4", -"b c #DADAFF", -"c c #C0C0FF", -"d c #9393FF", -"e c #8C8CFF", -"f c #8686FF", -"g c #5454D4", -"h c #3E3EC0", -"i c #6363BF", -"j c #8686D8", -"k c #D4D4FF", -"l c #D2D2FF", -"m c #7F7FFF", -"n c #7878FF", -"o c #4F4FD7", -"p c #3737BF", -"q c #5C5CBF", -"r c #7D7DD8", -"s c #CCCCFF", -"t c #CACAFF", -"u c #A8A8FF", -"v c #7070FF", -"w c #6B6BFF", -"x c #4545D7", -"y c #3030BF", -"z c #5555BF", -"A c #7373D8", -"B c #C3C3FF", -"C c #9C9CFF", -"D c #8D8DFF", -"E c #7777FF", -"F c #6262FF", -"G c #5252FF", -"H c #4B4BFF", -"I c #4848FF", -"J c #3232D7", -"K c #2626BF", -"L c #4E4EBF", -"M c #6A6AD8", -"N c #B9B9FF", -"O c #9090FF", -"P c #6F6FFF", -"Q c #5555FF", -"R c #4646FF", -"S c #4B4BF5", -"T c #8282B4", -"U c #93938E", -"V c #B1B173", -"W c #BFBF68", -"X c #BFBF65", -"Y c #BFBF62", -"Z c #BFBF5E", -"` c #BFBF5B", -" . c #BFBF57", -".. c #BFBF54", -"+. c #BFBF51", -"@. c #5858D8", -"#. c #B2B2FF", -"$. c #B1B1FF", -"%. c #8484FF", -"&. c #7272FF", -"*. c #6767FF", -"=. c #4F4FFF", -"-. c #4747FF", -";. c #4242FF", -">. c #4141FA", -",. c #ABAB8A", -"'. c #E4E4AA", -"). c #F5F5C3", -"!. c #F6F6BE", -"~. c #F6F6B7", -"{. c #F6F6B1", -"]. c #F6F6AB", -"^. c #F6F6A5", -"/. c #F6F69E", -"(. c #F6F698", -"_. c #F1F18C", -":. c #D0D05F", -"<. c #BFBF48", -"[. c #C17474", -"}. c #C07171", -"|. c #BF6E6E", -"1. c #BF6B6B", -"2. c #BF6868", -"3. c #BF6464", -"4. c #BF6161", -"5. c #7C498C", -"6. c #4242D8", -"7. c #A4A4FF", -"8. c #5959FF", -"9. c #3D3DFF", -"0. c #3838FF", -"a. c #6666CA", -"b. c #DCDC98", -"c. c #FFFFDD", -"d. c #FFFFD7", -"e. c #FFFFC0", -"f. c #FFFFB8", -"g. c #FFFFB2", -"h. c #FFFFAB", -"i. c #FFFFA4", -"j. c #FFFF9D", -"k. c #FFFF97", -"l. c #FFFF90", -"m. c #FBFB85", -"n. c #C2C244", -"o. c #C37676", -"p. c #DA9B9B", -"q. c #DF9F9F", -"r. c #DF9A9A", -"s. c #DF9494", -"t. c #DF8F8F", -"u. c #DF8A8A", -"v. c #B47094", -"w. c #3B3BD8", -"x. c #9292FF", -"y. c #5656FF", -"z. c #3333FF", -"A. c #2E2EFF", -"B. c #7070B6", -"C. c #E7E79F", -"D. c #FFFFDE", -"E. c #FFFFCF", -"F. c #FFFFB5", -"G. c #FFFF9E", -"H. c #FFFF8A", -"I. c #FFFF83", -"J. c #FFFF7C", -"K. c #C8C843", -"L. c #C06D6D", -"M. c #F1BEBE", -"N. c #FFDBDB", -"O. c #FFCBCB", -"P. c #FFC0C0", -"Q. c #FFBABA", -"R. c #FFB3B3", -"S. c #FFACAC", -"T. c #CE89AC", -"U. c #3333D7", -"V. c #8787FF", -"W. c #4D4DFF", -"X. c #2929FF", -"Y. c #2424FF", -"Z. c #6B6BB3", -"`. c #E7E795", -" + c #FFFFC6", -".+ c #FFFFA8", -"++ c #FFFF76", -"@+ c #FFFF6F", -"#+ c #C8C83C", -"$+ c #C77474", -"%+ c #FFD3D3", -"&+ c #FFDEDE", -"*+ c #FFC4C4", -"=+ c #FFA6A6", -"-+ c #FF9F9F", -";+ c #F3929A", -">+ c #2F29C3", -",+ c #4C4CFB", -"'+ c #6868FF", -")+ c #3939FF", -"!+ c #1F1FFF", -"~+ c #1A1AFF", -"{+ c #6666B0", -"]+ c #E7E78A", -"^+ c #FFFFD0", -"/+ c #FFFFBD", -"(+ c #FFFF9B", -"_+ c #FFFF91", -":+ c #FAFA6E", -"<+ c #F5F55F", -"[+ c #F5F558", -"}+ c #F7F756", -"|+ c #C7C732", -"1+ c #C86E6E", -"2+ c #FFC9C9", -"3+ c #FFD7D7", -"4+ c #FFB8B8", -"5+ c #FF9898", -"6+ c #FF9292", -"7+ c #FF8B8B", -"8+ c #B16098", -"9+ c #2420C6", -"0+ c #2222DD", -"a+ c #1F1FDF", -"b+ c #1B1BDF", -"c+ c #1818DF", -"d+ c #1414DF", -"e+ c #1010DF", -"f+ c #0C0CDF", -"g+ c #5F5F9C", -"h+ c #E7E77F", -"i+ c #FFFFC9", -"j+ c #FFFFB4", -"k+ c #FFFF8E", -"l+ c #FFFF7D", -"m+ c #FEFE75", -"n+ c #F4F45D", -"o+ c #EFEF4F", -"p+ c #EFEF4A", -"q+ c #EFEF44", -"r+ c #EFEF3F", -"s+ c #BFBF22", -"t+ c #C86666", -"u+ c #FFBFBF", -"v+ c #FFD0D0", -"w+ c #FFADAD", -"x+ c #FF8484", -"y+ c #FF7E7E", -"z+ c #FF7373", -"A+ c #E75F70", -"B+ c #B0457F", -"C+ c #9A3776", -"D+ c #5F1D7C", -"E+ c #0C0CBF", -"F+ c #0909BF", -"G+ c #0707BF", -"H+ c #0404BF", -"I+ c #878766", -"J+ c #E6E674", -"K+ c #FFFFC2", -"L+ c #FFFF82", -"M+ c #FEFE6E", -"N+ c #F3F355", -"O+ c #EFEF45", -"P+ c #EFEF40", -"Q+ c #EFEF3B", -"R+ c #EFEF36", -"S+ c #BFBF1C", -"T+ c #C85F5F", -"U+ c #FFB4B4", -"V+ c #FFA2A2", -"W+ c #FF7575", -"X+ c #FF5E5E", -"Y+ c #FF5050", -"Z+ c #FF4A4A", -"`+ c #FF4545", -" @ c #E73535", -".@ c #BF2121", -"+@ c #B7B733", -"@@ c #DCDC55", -"#@ c #FDFDB7", -"$@ c #FFFFA2", -"%@ c #FFFF75", -"&@ c #FCFC64", -"*@ c #F2F24E", -"=@ c #EFEF31", -"-@ c #EFEF2C", -";@ c #BFBF16", -">@ c #C85656", -",@ c #FFAAAA", -"'@ c #FFC2C2", -")@ c #FF9797", -"!@ c #FF7777", -"~@ c #FF6E6E", -"{@ c #FF5454", -"]@ c #FF4040", -"^@ c #FF3B3B", -"/@ c #E72C2C", -"(@ c #BF1919", -"_@ c #B7B72E", -":@ c #DADA48", -"<@ c #F7F7A6", -"[@ c #F6F689", -"}@ c #F2F254", -"|@ c #EFEF27", -"1@ c #EFEF22", -"2@ c #BFBF10", -"3@ c #C84040", -"4@ c #FF9A9A", -"5@ c #FFBBBB", -"6@ c #FF7171", -"7@ c #FF6666", -"8@ c #FF4E4E", -"9@ c #FF4646", -"0@ c #FF4141", -"a@ c #FF3C3C", -"b@ c #FF3737", -"c@ c #FF3232", -"d@ c #E72424", -"e@ c #BF1414", -"f@ c #B7B729", -"g@ c #DADA3F", -"h@ c #F7F7A1", -"i@ c #F4F480", -"j@ c #F0F047", -"k@ c #EFEF1D", -"l@ c #EFEF18", -"m@ c #BFBF0B", -"n@ c #C83636", -"o@ c #FFABAB", -"p@ c #FF7676", -"q@ c #FF2D2D", -"r@ c #FF2828", -"s@ c #E71C1C", -"t@ c #BF0F0F", -"u@ c #B7B724", -"v@ c #D1D132", -"w@ c #F4F478", -"x@ c #EFEF13", -"y@ c #ECEC0E", -"z@ c #BABA05", -"A@ c #C83030", -"B@ c #FF6161", -"C@ c #FF2323", -"D@ c #FF1E1E", -"E@ c #E71414", -"F@ c #BF0A0A", -"G@ c #B8B820", -"H@ c #B9B91F", -"I@ c #DADA2C", -"J@ c #E9E931", -"K@ c #EAEA2A", -"L@ c #EAEA25", -"M@ c #EAEA20", -"N@ c #EAEA1C", -"O@ c #EAEA17", -"P@ c #EAEA12", -"Q@ c #EAEA0D", -"R@ c #E5E508", -"S@ c #C7C703", -"T@ c #B7B701", -"U@ c #C52929", -"V@ c #FF5858", -"W@ c #FF1919", -"X@ c #FF1414", -"Y@ c #E30C0C", -"Z@ c #BF0606", -"`@ c #B8B819", -" # c #B7B717", -".# c #B7B714", -"+# c #B7B711", -"@# c #B7B70F", -"## c #B7B70C", -"$# c #B7B70A", -"%# c #B7B707", -"&# c #B7B705", -"*# c #B7B702", -"=# c #B7B700", -"-# c #BF2020", -";# c #E63131", -"># c #FF5555", -",# c #FF3A3A", -"'# c #FF0F0F", -")# c #FA0A0A", -"!# c #C90303", -"~# c #C00202", -"{# c #C01C1C", -"]# c #CB1B1B", -"^# c #D01A1A", -"/# c #D01616", -"(# c #D01313", -"_# c #D01010", -":# c #D00D0D", -"<# c #D00A0A", -"[# c #D00707", -"}# c #CF0303", -"|# c #C30101", -"1# c #C00000", -"2# c #C21414", -"3# c #BF1111", -"4# c #BF0E0E", -"5# c #BF0C0C", -"6# c #BF0909", -"7# c #BF0707", -"8# c #BF0404", -"9# c #BF0202", -"0# c #C50000", -" ", -" ", -" ", -" ", -" . + @ # $ % & * = ", -" - ; > , ' ) ! ~ { ] ^ / ( ", -" _ : < [ } | 1 2 3 4 5 6 7 8 9 ", -" 0 a b b c 2 3 4 5 6 d e f g h ", -" i j k l 2 4 5 6 d e f m n o p ", -" q r s t u 6 d e f m n v w x y ", -" z A B | C D f m E F G H I J K ", -" L M 1 N O m n P Q H R S T U V W X Y Z ` ...+. ", -" p @.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.", -" [.}.|.1.2.3.4.5.6.6 7.&.8.I ;.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.", -"}.o.p.q.r.s.t.u.v.w.O x.y.;.9.0.z.A.B.C.D.E.F.h.i.G.k.l.H.I.J.K.", -"L.M.N.O.P.Q.R.S.T.U.V.e W.0.z.A.X.Y.Z.`.d. +.+G.k.l.H.I.J.++@+#+", -"$+%+&+*+R.S.=+-+;+>+,+'+)+A.X.Y.!+~+{+]+^+/+(+_+H.I.J.:+<+[+}+|+", -"1+2+3+4+=+-+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+I.l+m+n+o+p+q+r+s+", -"t+u+v+w+5+6+7+x+y+z+A+B+C+D+E+F+G+H+I+J+K+h.L+++M+N+p+O+P+Q+R+S+", -"T+U+2+V+7+x+y+W+X+Y+Z+`+ @.@ +@@@#@$@%@&@*@O+P+Q+R+=@-@;@", -">@,@'@)@y+!@~@{@Z+`+]@^@/@(@ _@:@<@[@}@O+P+Q+R+=@-@|@1@2@", -"3@4@5@7+6@7@8@9@0@a@b@c@d@e@ f@g@h@i@j@Q+R+=@-@|@1@k@l@m@", -"n@y+o@p@{@9@0@a@b@c@q@r@s@t@ u@v@i@w@Q+=@-@|@1@k@l@x@y@z@", -"A@p@-+B@0@a@b@c@q@r@C@D@E@F@ G@H@I@J@K@L@M@N@O@P@Q@R@S@T@", -"U@7@4@V@b@c@q@r@C@D@W@X@Y@Z@ `@ #.#+#@###$#%#&#*#=#=# ", -"-#;#>#,#q@r@C@D@W@X@'#)#!#~# ", -"{#(@]#^#/#(#_#:#<#[#}#|#1# ", -" 2#3#4#5#6#7#8#9#1#0# ", -" ", -" ", -" ", -" "}; +/* XPM */ +static const char *const wxwin32x32_xpm[] = { +"32 32 407 2", +" c None", +". c #7373C1", +"+ c #6E6EBF", +"@ c #6B6BBF", +"# c #6868BF", +"$ c #6464BF", +"% c #6161BF", +"& c #5E5EBF", +"* c #5A5ABF", +"= c #5959C0", +"- c #7171C0", +"; c #7272C1", +"> c #8686CE", +", c #8686D0", +"' c #8282D0", +") c #7D7DD0", +"! c #7979D0", +"~ c #7575D0", +"{ c #7171D0", +"] c #6D6DD0", +"^ c #6666CD", +"/ c #5151C1", +"( c #4C4CBF", +"_ c #7171C1", +": c #7272C2", +"< c #C1C1F2", +"[ c #D7D7FF", +"} c #C9C9FF", +"| c #C2C2FF", +"1 c #BBBBFF", +"2 c #B4B4FF", +"3 c #AEAEFF", +"4 c #A7A7FF", +"5 c #A0A0FF", +"6 c #9A9AFF", +"7 c #8484F2", +"8 c #4949C2", +"9 c #4444C1", +"0 c #6A6AC0", +"a c #8989D4", +"b c #DADAFF", +"c c #C0C0FF", +"d c #9393FF", +"e c #8C8CFF", +"f c #8686FF", +"g c #5454D4", +"h c #3E3EC0", +"i c #6363BF", +"j c #8686D8", +"k c #D4D4FF", +"l c #D2D2FF", +"m c #7F7FFF", +"n c #7878FF", +"o c #4F4FD7", +"p c #3737BF", +"q c #5C5CBF", +"r c #7D7DD8", +"s c #CCCCFF", +"t c #CACAFF", +"u c #A8A8FF", +"v c #7070FF", +"w c #6B6BFF", +"x c #4545D7", +"y c #3030BF", +"z c #5555BF", +"A c #7373D8", +"B c #C3C3FF", +"C c #9C9CFF", +"D c #8D8DFF", +"E c #7777FF", +"F c #6262FF", +"G c #5252FF", +"H c #4B4BFF", +"I c #4848FF", +"J c #3232D7", +"K c #2626BF", +"L c #4E4EBF", +"M c #6A6AD8", +"N c #B9B9FF", +"O c #9090FF", +"P c #6F6FFF", +"Q c #5555FF", +"R c #4646FF", +"S c #4B4BF5", +"T c #8282B4", +"U c #93938E", +"V c #B1B173", +"W c #BFBF68", +"X c #BFBF65", +"Y c #BFBF62", +"Z c #BFBF5E", +"` c #BFBF5B", +" . c #BFBF57", +".. c #BFBF54", +"+. c #BFBF51", +"@. c #5858D8", +"#. c #B2B2FF", +"$. c #B1B1FF", +"%. c #8484FF", +"&. c #7272FF", +"*. c #6767FF", +"=. c #4F4FFF", +"-. c #4747FF", +";. c #4242FF", +">. c #4141FA", +",. c #ABAB8A", +"'. c #E4E4AA", +"). c #F5F5C3", +"!. c #F6F6BE", +"~. c #F6F6B7", +"{. c #F6F6B1", +"]. c #F6F6AB", +"^. c #F6F6A5", +"/. c #F6F69E", +"(. c #F6F698", +"_. c #F1F18C", +":. c #D0D05F", +"<. c #BFBF48", +"[. c #C17474", +"}. c #C07171", +"|. c #BF6E6E", +"1. c #BF6B6B", +"2. c #BF6868", +"3. c #BF6464", +"4. c #BF6161", +"5. c #7C498C", +"6. c #4242D8", +"7. c #A4A4FF", +"8. c #5959FF", +"9. c #3D3DFF", +"0. c #3838FF", +"a. c #6666CA", +"b. c #DCDC98", +"c. c #FFFFDD", +"d. c #FFFFD7", +"e. c #FFFFC0", +"f. c #FFFFB8", +"g. c #FFFFB2", +"h. c #FFFFAB", +"i. c #FFFFA4", +"j. c #FFFF9D", +"k. c #FFFF97", +"l. c #FFFF90", +"m. c #FBFB85", +"n. c #C2C244", +"o. c #C37676", +"p. c #DA9B9B", +"q. c #DF9F9F", +"r. c #DF9A9A", +"s. c #DF9494", +"t. c #DF8F8F", +"u. c #DF8A8A", +"v. c #B47094", +"w. c #3B3BD8", +"x. c #9292FF", +"y. c #5656FF", +"z. c #3333FF", +"A. c #2E2EFF", +"B. c #7070B6", +"C. c #E7E79F", +"D. c #FFFFDE", +"E. c #FFFFCF", +"F. c #FFFFB5", +"G. c #FFFF9E", +"H. c #FFFF8A", +"I. c #FFFF83", +"J. c #FFFF7C", +"K. c #C8C843", +"L. c #C06D6D", +"M. c #F1BEBE", +"N. c #FFDBDB", +"O. c #FFCBCB", +"P. c #FFC0C0", +"Q. c #FFBABA", +"R. c #FFB3B3", +"S. c #FFACAC", +"T. c #CE89AC", +"U. c #3333D7", +"V. c #8787FF", +"W. c #4D4DFF", +"X. c #2929FF", +"Y. c #2424FF", +"Z. c #6B6BB3", +"`. c #E7E795", +" + c #FFFFC6", +".+ c #FFFFA8", +"++ c #FFFF76", +"@+ c #FFFF6F", +"#+ c #C8C83C", +"$+ c #C77474", +"%+ c #FFD3D3", +"&+ c #FFDEDE", +"*+ c #FFC4C4", +"=+ c #FFA6A6", +"-+ c #FF9F9F", +";+ c #F3929A", +">+ c #2F29C3", +",+ c #4C4CFB", +"'+ c #6868FF", +")+ c #3939FF", +"!+ c #1F1FFF", +"~+ c #1A1AFF", +"{+ c #6666B0", +"]+ c #E7E78A", +"^+ c #FFFFD0", +"/+ c #FFFFBD", +"(+ c #FFFF9B", +"_+ c #FFFF91", +":+ c #FAFA6E", +"<+ c #F5F55F", +"[+ c #F5F558", +"}+ c #F7F756", +"|+ c #C7C732", +"1+ c #C86E6E", +"2+ c #FFC9C9", +"3+ c #FFD7D7", +"4+ c #FFB8B8", +"5+ c #FF9898", +"6+ c #FF9292", +"7+ c #FF8B8B", +"8+ c #B16098", +"9+ c #2420C6", +"0+ c #2222DD", +"a+ c #1F1FDF", +"b+ c #1B1BDF", +"c+ c #1818DF", +"d+ c #1414DF", +"e+ c #1010DF", +"f+ c #0C0CDF", +"g+ c #5F5F9C", +"h+ c #E7E77F", +"i+ c #FFFFC9", +"j+ c #FFFFB4", +"k+ c #FFFF8E", +"l+ c #FFFF7D", +"m+ c #FEFE75", +"n+ c #F4F45D", +"o+ c #EFEF4F", +"p+ c #EFEF4A", +"q+ c #EFEF44", +"r+ c #EFEF3F", +"s+ c #BFBF22", +"t+ c #C86666", +"u+ c #FFBFBF", +"v+ c #FFD0D0", +"w+ c #FFADAD", +"x+ c #FF8484", +"y+ c #FF7E7E", +"z+ c #FF7373", +"A+ c #E75F70", +"B+ c #B0457F", +"C+ c #9A3776", +"D+ c #5F1D7C", +"E+ c #0C0CBF", +"F+ c #0909BF", +"G+ c #0707BF", +"H+ c #0404BF", +"I+ c #878766", +"J+ c #E6E674", +"K+ c #FFFFC2", +"L+ c #FFFF82", +"M+ c #FEFE6E", +"N+ c #F3F355", +"O+ c #EFEF45", +"P+ c #EFEF40", +"Q+ c #EFEF3B", +"R+ c #EFEF36", +"S+ c #BFBF1C", +"T+ c #C85F5F", +"U+ c #FFB4B4", +"V+ c #FFA2A2", +"W+ c #FF7575", +"X+ c #FF5E5E", +"Y+ c #FF5050", +"Z+ c #FF4A4A", +"`+ c #FF4545", +" @ c #E73535", +".@ c #BF2121", +"+@ c #B7B733", +"@@ c #DCDC55", +"#@ c #FDFDB7", +"$@ c #FFFFA2", +"%@ c #FFFF75", +"&@ c #FCFC64", +"*@ c #F2F24E", +"=@ c #EFEF31", +"-@ c #EFEF2C", +";@ c #BFBF16", +">@ c #C85656", +",@ c #FFAAAA", +"'@ c #FFC2C2", +")@ c #FF9797", +"!@ c #FF7777", +"~@ c #FF6E6E", +"{@ c #FF5454", +"]@ c #FF4040", +"^@ c #FF3B3B", +"/@ c #E72C2C", +"(@ c #BF1919", +"_@ c #B7B72E", +":@ c #DADA48", +"<@ c #F7F7A6", +"[@ c #F6F689", +"}@ c #F2F254", +"|@ c #EFEF27", +"1@ c #EFEF22", +"2@ c #BFBF10", +"3@ c #C84040", +"4@ c #FF9A9A", +"5@ c #FFBBBB", +"6@ c #FF7171", +"7@ c #FF6666", +"8@ c #FF4E4E", +"9@ c #FF4646", +"0@ c #FF4141", +"a@ c #FF3C3C", +"b@ c #FF3737", +"c@ c #FF3232", +"d@ c #E72424", +"e@ c #BF1414", +"f@ c #B7B729", +"g@ c #DADA3F", +"h@ c #F7F7A1", +"i@ c #F4F480", +"j@ c #F0F047", +"k@ c #EFEF1D", +"l@ c #EFEF18", +"m@ c #BFBF0B", +"n@ c #C83636", +"o@ c #FFABAB", +"p@ c #FF7676", +"q@ c #FF2D2D", +"r@ c #FF2828", +"s@ c #E71C1C", +"t@ c #BF0F0F", +"u@ c #B7B724", +"v@ c #D1D132", +"w@ c #F4F478", +"x@ c #EFEF13", +"y@ c #ECEC0E", +"z@ c #BABA05", +"A@ c #C83030", +"B@ c #FF6161", +"C@ c #FF2323", +"D@ c #FF1E1E", +"E@ c #E71414", +"F@ c #BF0A0A", +"G@ c #B8B820", +"H@ c #B9B91F", +"I@ c #DADA2C", +"J@ c #E9E931", +"K@ c #EAEA2A", +"L@ c #EAEA25", +"M@ c #EAEA20", +"N@ c #EAEA1C", +"O@ c #EAEA17", +"P@ c #EAEA12", +"Q@ c #EAEA0D", +"R@ c #E5E508", +"S@ c #C7C703", +"T@ c #B7B701", +"U@ c #C52929", +"V@ c #FF5858", +"W@ c #FF1919", +"X@ c #FF1414", +"Y@ c #E30C0C", +"Z@ c #BF0606", +"`@ c #B8B819", +" # c #B7B717", +".# c #B7B714", +"+# c #B7B711", +"@# c #B7B70F", +"## c #B7B70C", +"$# c #B7B70A", +"%# c #B7B707", +"&# c #B7B705", +"*# c #B7B702", +"=# c #B7B700", +"-# c #BF2020", +";# c #E63131", +"># c #FF5555", +",# c #FF3A3A", +"'# c #FF0F0F", +")# c #FA0A0A", +"!# c #C90303", +"~# c #C00202", +"{# c #C01C1C", +"]# c #CB1B1B", +"^# c #D01A1A", +"/# c #D01616", +"(# c #D01313", +"_# c #D01010", +":# c #D00D0D", +"<# c #D00A0A", +"[# c #D00707", +"}# c #CF0303", +"|# c #C30101", +"1# c #C00000", +"2# c #C21414", +"3# c #BF1111", +"4# c #BF0E0E", +"5# c #BF0C0C", +"6# c #BF0909", +"7# c #BF0707", +"8# c #BF0404", +"9# c #BF0202", +"0# c #C50000", +" ", +" ", +" ", +" ", +" . + @ # $ % & * = ", +" - ; > , ' ) ! ~ { ] ^ / ( ", +" _ : < [ } | 1 2 3 4 5 6 7 8 9 ", +" 0 a b b c 2 3 4 5 6 d e f g h ", +" i j k l 2 4 5 6 d e f m n o p ", +" q r s t u 6 d e f m n v w x y ", +" z A B | C D f m E F G H I J K ", +" L M 1 N O m n P Q H R S T U V W X Y Z ` ...+. ", +" p @.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.", +" [.}.|.1.2.3.4.5.6.6 7.&.8.I ;.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.", +"}.o.p.q.r.s.t.u.v.w.O x.y.;.9.0.z.A.B.C.D.E.F.h.i.G.k.l.H.I.J.K.", +"L.M.N.O.P.Q.R.S.T.U.V.e W.0.z.A.X.Y.Z.`.d. +.+G.k.l.H.I.J.++@+#+", +"$+%+&+*+R.S.=+-+;+>+,+'+)+A.X.Y.!+~+{+]+^+/+(+_+H.I.J.:+<+[+}+|+", +"1+2+3+4+=+-+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+I.l+m+n+o+p+q+r+s+", +"t+u+v+w+5+6+7+x+y+z+A+B+C+D+E+F+G+H+I+J+K+h.L+++M+N+p+O+P+Q+R+S+", +"T+U+2+V+7+x+y+W+X+Y+Z+`+ @.@ +@@@#@$@%@&@*@O+P+Q+R+=@-@;@", +">@,@'@)@y+!@~@{@Z+`+]@^@/@(@ _@:@<@[@}@O+P+Q+R+=@-@|@1@2@", +"3@4@5@7+6@7@8@9@0@a@b@c@d@e@ f@g@h@i@j@Q+R+=@-@|@1@k@l@m@", +"n@y+o@p@{@9@0@a@b@c@q@r@s@t@ u@v@i@w@Q+=@-@|@1@k@l@x@y@z@", +"A@p@-+B@0@a@b@c@q@r@C@D@E@F@ G@H@I@J@K@L@M@N@O@P@Q@R@S@T@", +"U@7@4@V@b@c@q@r@C@D@W@X@Y@Z@ `@ #.#+#@###$#%#&#*#=#=# ", +"-#;#>#,#q@r@C@D@W@X@'#)#!#~# ", +"{#(@]#^#/#(#_#:#<#[#}#|#1# ", +" 2#3#4#5#6#7#8#9#1#0# ", +" ", +" ", +" ", +" "}; diff --git a/Externals/wxWidgets3/build/msw/wx_base.vcxproj b/Externals/wxWidgets3/build/msw/wx_base.vcxproj index 9550852f37..d212dce20f 100644 --- a/Externals/wxWidgets3/build/msw/wx_base.vcxproj +++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj @@ -1,4 +1,4 @@ - + @@ -14,6 +14,8 @@ + + @@ -24,11 +26,23 @@ + + + + + + + + + + + + @@ -41,7 +55,6 @@ - @@ -59,6 +72,7 @@ + @@ -161,6 +175,7 @@ + @@ -169,6 +184,7 @@ + @@ -212,6 +228,15 @@ + + + + + + + + + @@ -308,6 +333,7 @@ + @@ -377,16 +403,13 @@ - - - @@ -397,6 +420,7 @@ + @@ -409,6 +433,7 @@ + @@ -447,6 +472,7 @@ + @@ -522,7 +548,6 @@ - @@ -628,23 +653,6 @@ - - - - - - - - - - - - - - - - - @@ -670,15 +678,21 @@ + + + true + + true + @@ -710,7 +724,9 @@ - + + true + @@ -799,7 +815,9 @@ - + + true + @@ -869,20 +887,25 @@ + - + + true + - + + true + @@ -991,6 +1014,7 @@ + @@ -1004,6 +1028,7 @@ + @@ -1064,7 +1089,9 @@ true - + + true + @@ -1101,6 +1128,7 @@ + @@ -1133,7 +1161,9 @@ - + + true + @@ -1168,13 +1198,20 @@ true - + + true + + + true + true - + + true + @@ -1203,13 +1240,9 @@ true - - true - - @@ -1218,7 +1251,9 @@ true - + + true + @@ -1230,11 +1265,14 @@ - - - + + true + + + true + @@ -1259,7 +1297,9 @@ + + @@ -1340,4 +1380,4 @@ - \ 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 index 19d1a6c4c7..20b13ccbcc 100644 --- a/Externals/wxWidgets3/build/msw/wx_base.vcxproj.filters +++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj.filters @@ -34,6 +34,12 @@ {302035ca-b308-4626-83f9-60c08f3015c9} + + {73f456f5-1828-4572-86a5-6dc15050fb79} + + + {f6d51fb6-68c8-4855-8b5c-ef3717f3e1d3} + @@ -138,9 +144,6 @@ Headers - - Headers - Headers @@ -873,9 +876,6 @@ Headers - - Headers - Headers @@ -1173,33 +1173,6 @@ Headers - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - Headers @@ -1218,30 +1191,6 @@ Headers - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - Headers @@ -1488,9 +1437,6 @@ Headers\MSW - - Headers\MSW - Headers\MSW @@ -1500,9 +1446,6 @@ Headers\MSW - - Headers\MSW - Headers\MSW @@ -1512,9 +1455,6 @@ Headers\MSW - - Headers\MSW - Headers\MSW @@ -1977,6 +1917,96 @@ Headers\MSW\ole + + Headers + + + Headers + + + Headers + + + Headers + + + Headers\Generic + + + Headers\Generic + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW + + + Headers\MSW\private + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\AUI + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + + + Headers\Generic\private + @@ -3218,9 +3248,6 @@ MSW - - MSW - MSW @@ -3230,9 +3257,6 @@ MSW - - MSW - MSW @@ -3260,9 +3284,6 @@ MSW - - MSW - MSW @@ -3443,6 +3464,39 @@ + + AUI + + + AUI + + + AUI + + + Common + + + Common + + + Generic + + + Generic + + + MSW + + + MSW + + + MSW + + + MSW + diff --git a/Externals/wxWidgets3/build_wx.sh b/Externals/wxWidgets3/build_wx.sh index 89281b442c..89a74094a9 100755 --- a/Externals/wxWidgets3/build_wx.sh +++ b/Externals/wxWidgets3/build_wx.sh @@ -1,7 +1,9 @@ #!/bin/bash -svn co -r 75363 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets +#svn co -r 75363 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets +git clone https://github.com/wxWidgets/wxWidgets.git cd wxWidgets +git checkout cbb799b1ae3f309c99beb0d287e9bb3b62ea405c case $OSTYPE in darwin*) @@ -11,11 +13,12 @@ ADD_OPTS=--with-macosx-version-min=10.7 --enable-stl ;; linux*) BACKEND="gtk" +ADD_OPTS=--without-gtkprint ;; 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 $ADD_OPTS +../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 --without-opengl --disable-printarch --disable-mediactrl --disable-htmlhelp --disable-dialupman --enable-ipv6 $ADD_OPTS make diff --git a/Externals/wxWidgets3/include/msvc/wx/setup.h b/Externals/wxWidgets3/include/msvc/wx/setup.h index 7a8d472c78..3d2f068fd8 100644 --- a/Externals/wxWidgets3/include/msvc/wx/setup.h +++ b/Externals/wxWidgets3/include/msvc/wx/setup.h @@ -63,6 +63,8 @@ #define wxCOMPILER_PREFIX vc110 #elif _MSC_VER == 1800 #define wxCOMPILER_PREFIX vc120 + #elif _MSC_VER == 1900 + #define wxCOMPILER_PREFIX vc140 #else #error "Unknown MSVC compiler version, please report to wx-dev." #endif @@ -153,17 +155,20 @@ #endif #pragma comment(lib, wxBASE_LIB_NAME("net")) #endif -#ifndef wxNO_XML_LIB +#if wxUSE_XML && !defined(wxNO_XML_LIB) #pragma comment(lib, wxBASE_LIB_NAME("xml")) + #if !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat")) + #endif #endif #if wxUSE_REGEX && !defined(wxNO_REGEX_LIB) && !defined(WXUSINGDLL) #pragma comment(lib, wx3RD_PARTY_LIB_NAME_U("regex")) #endif +#if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL) + #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib")) +#endif #if wxUSE_GUI - #if wxUSE_XML && !defined(wxNO_EXPAT_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("expat")) - #endif #if wxUSE_LIBJPEG && !defined(wxNO_JPEG_LIB) && !defined(WXUSINGDLL) #pragma comment(lib, wx3RD_PARTY_LIB_NAME("jpeg")) #endif @@ -173,9 +178,6 @@ #if wxUSE_LIBTIFF && !defined(wxNO_TIFF_LIB) && !defined(WXUSINGDLL) #pragma comment(lib, wx3RD_PARTY_LIB_NAME("tiff")) #endif - #if wxUSE_ZLIB && !defined(wxNO_ZLIB_LIB) && !defined(WXUSINGDLL) - #pragma comment(lib, wx3RD_PARTY_LIB_NAME("zlib")) - #endif #pragma comment(lib, wxTOOLKIT_LIB_NAME("core")) @@ -183,7 +185,7 @@ #pragma comment(lib, wxTOOLKIT_LIB_NAME("adv")) #endif - #ifndef wxNO_HTML_LIB + #if wxUSE_HTML && !defined(wxNO_HTML_LIB) #pragma comment(lib, wxTOOLKIT_LIB_NAME("html")) #endif #if wxUSE_GLCANVAS && !defined(wxNO_GL_LIB) @@ -243,8 +245,13 @@ #endif #ifdef __WXGTK__ - #pragma comment(lib, "gtk-win32-2.0.lib") - #pragma comment(lib, "gdk-win32-2.0.lib") + #ifdef __WXGTK3__ + #pragma comment(lib, "libgtk-3.dll.a") + #pragma comment(lib, "libgdk-3.dll.a") + #else + #pragma comment(lib, "gtk-win32-2.0.lib") + #pragma comment(lib, "gdk-win32-2.0.lib") + #endif #pragma comment(lib, "pangocairo-1.0.lib") #pragma comment(lib, "gdk_pixbuf-2.0.lib") #pragma comment(lib, "cairo.lib") diff --git a/Externals/wxWidgets3/include/wx/accel.h b/Externals/wxWidgets3/include/wx/accel.h index 5226b8b35a..604039561f 100644 --- a/Externals/wxWidgets3/include/wx/accel.h +++ b/Externals/wxWidgets3/include/wx/accel.h @@ -32,7 +32,7 @@ enum wxAcceleratorEntryFlags wxACCEL_ALT = 0x0001, // hold Alt key down wxACCEL_CTRL = 0x0002, // hold Ctrl key down wxACCEL_SHIFT = 0x0004, // hold Shift key down -#if defined(__WXMAC__) || defined(__WXCOCOA__) +#if defined(__WXMAC__) wxACCEL_RAW_CTRL= 0x0008, // #else wxACCEL_RAW_CTRL= wxACCEL_CTRL, @@ -164,10 +164,8 @@ private: #include "wx/gtk1/accel.h" #elif defined(__WXMAC__) #include "wx/osx/accel.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/accel.h" -#elif defined(__WXPM__) - #include "wx/os2/accel.h" +#elif defined(__WXQT__) + #include "wx/qt/accel.h" #endif extern WXDLLIMPEXP_DATA_CORE(wxAcceleratorTable) wxNullAcceleratorTable; diff --git a/Externals/wxWidgets3/include/wx/access.h b/Externals/wxWidgets3/include/wx/access.h index 70cbaf1389..7eb041730b 100644 --- a/Externals/wxWidgets3/include/wx/access.h +++ b/Externals/wxWidgets3/include/wx/access.h @@ -21,14 +21,14 @@ #include "wx/variant.h" -typedef enum +enum wxAccStatus { wxACC_FAIL, wxACC_FALSE, wxACC_OK, wxACC_NOT_IMPLEMENTED, wxACC_NOT_SUPPORTED -} wxAccStatus; +}; // Child ids are integer identifiers from 1 up. // So zero represents 'this' object. @@ -36,7 +36,7 @@ typedef enum // Navigation constants -typedef enum +enum wxNavDir { wxNAVDIR_DOWN, wxNAVDIR_FIRSTCHILD, @@ -46,11 +46,11 @@ typedef enum wxNAVDIR_PREVIOUS, wxNAVDIR_RIGHT, wxNAVDIR_UP -} wxNavDir; +}; // Role constants -typedef enum { +enum wxAccRole { wxROLE_NONE, wxROLE_SYSTEM_ALERT, wxROLE_SYSTEM_ANIMATION, @@ -113,11 +113,11 @@ typedef enum { wxROLE_SYSTEM_TOOLTIP, wxROLE_SYSTEM_WHITESPACE, wxROLE_SYSTEM_WINDOW -} wxAccRole; +}; // Object types -typedef enum { +enum wxAccObject { wxOBJID_WINDOW = 0x00000000, wxOBJID_SYSMENU = 0xFFFFFFFF, wxOBJID_TITLEBAR = 0xFFFFFFFE, @@ -130,7 +130,7 @@ typedef enum { wxOBJID_CURSOR = 0xFFFFFFF7, wxOBJID_ALERT = 0xFFFFFFF6, wxOBJID_SOUND = 0xFFFFFFF5 -} wxAccObject; +}; // Accessible states @@ -163,7 +163,7 @@ typedef enum { // Selection flag -typedef enum +enum wxAccSelectionFlags { wxACC_SEL_NONE = 0, wxACC_SEL_TAKEFOCUS = 1, @@ -171,7 +171,7 @@ typedef enum wxACC_SEL_EXTENDSELECTION = 4, wxACC_SEL_ADDSELECTION = 8, wxACC_SEL_REMOVESELECTION = 16 -} wxAccSelectionFlags; +}; // Accessibility event identifiers diff --git a/Externals/wxWidgets3/include/wx/activityindicator.h b/Externals/wxWidgets3/include/wx/activityindicator.h new file mode 100644 index 0000000000..2d01bdb6cf --- /dev/null +++ b/Externals/wxWidgets3/include/wx/activityindicator.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/activityindicator.h +// Purpose: wxActivityIndicator declaration. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACTIVITYINDICATOR_H_ +#define _WX_ACTIVITYINDICATOR_H_ + +#include "wx/defs.h" + +#if wxUSE_ACTIVITYINDICATOR + +#include "wx/control.h" + +#define wxActivityIndicatorNameStr wxS("activityindicator") + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: small animated indicator of some application activity. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicatorBase : public wxControl +{ +public: + // Start or stop the activity animation (it is stopped initially). + virtual void Start() = 0; + virtual void Stop() = 0; + + // Return true if the control is currently showing activity. + virtual bool IsRunning() const = 0; + + // Override some base class virtual methods. + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } +}; + +#ifndef __WXUNIVERSAL__ +#if defined(__WXGTK220__) + #define wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/gtk/activityindicator.h" +#elif defined(__WXOSX_COCOA__) + #define wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/osx/activityindicator.h" +#endif +#endif // !__WXUNIVERSAL__ + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + #include "wx/generic/activityindicator.h" +#endif + +#endif // wxUSE_ACTIVITYINDICATOR + +#endif // _WX_ACTIVITYINDICATOR_H_ diff --git a/Externals/wxWidgets3/include/wx/addremovectrl.h b/Externals/wxWidgets3/include/wx/addremovectrl.h new file mode 100644 index 0000000000..78a34e7073 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/addremovectrl.h @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/addremovectrl.h +// Purpose: wxAddRemoveCtrl declaration. +// Author: Vadim Zeitlin +// Created: 2015-01-29 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ADDREMOVECTRL_H_ +#define _WX_ADDREMOVECTRL_H_ + +#include "wx/panel.h" + +#if wxUSE_ADDREMOVECTRL + +extern WXDLLIMPEXP_DATA_ADV(const char) wxAddRemoveCtrlNameStr[]; + +// ---------------------------------------------------------------------------- +// wxAddRemoveAdaptor: used by wxAddRemoveCtrl to work with the list control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAddRemoveAdaptor +{ +public: + // Default ctor and trivial but virtual dtor. + wxAddRemoveAdaptor() { } + virtual ~wxAddRemoveAdaptor() { } + + // Override to return the associated control. + virtual wxWindow* GetItemsCtrl() const = 0; + + // Override to return whether a new item can be added to the control. + virtual bool CanAdd() const = 0; + + // Override to return whether the currently selected item (if any) can be + // removed from the control. + virtual bool CanRemove() const = 0; + + // Called when an item should be added, can only be called if CanAdd() + // currently returns true. + virtual void OnAdd() = 0; + + // Called when the current item should be removed, can only be called if + // CanRemove() currently returns true. + virtual void OnRemove() = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxAddRemoveAdaptor); +}; + +// ---------------------------------------------------------------------------- +// wxAddRemoveCtrl: a list-like control combined with add/remove buttons +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxAddRemoveCtrl : public wxPanel +{ +public: + wxAddRemoveCtrl() + { + Init(); + } + + wxAddRemoveCtrl(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxAddRemoveCtrlNameStr) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxAddRemoveCtrlNameStr); + + virtual ~wxAddRemoveCtrl(); + + // Must be called for the control to be usable, takes ownership of the + // pointer. + void SetAdaptor(wxAddRemoveAdaptor* adaptor); + + // Set tooltips to use for the add and remove buttons. + void SetButtonsToolTips(const wxString& addtip, const wxString& removetip); + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() + { + m_impl = NULL; + } + + class wxAddRemoveImpl* m_impl; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveCtrl); +}; + +#endif // wxUSE_ADDREMOVECTRL + +#endif // _WX_ADDREMOVECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/affinematrix2d.h b/Externals/wxWidgets3/include/wx/affinematrix2d.h index 28055f8d35..ce383a96ac 100644 --- a/Externals/wxWidgets3/include/wx/affinematrix2d.h +++ b/Externals/wxWidgets3/include/wx/affinematrix2d.h @@ -28,19 +28,19 @@ public: } // 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 cRadians); + virtual void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr) wxOVERRIDE; + virtual void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const wxOVERRIDE; + virtual void Concat(const wxAffineMatrix2DBase& t) wxOVERRIDE; + virtual bool Invert() wxOVERRIDE; + virtual bool IsIdentity() const wxOVERRIDE; + virtual bool IsEqual(const wxAffineMatrix2DBase& t) const wxOVERRIDE; + virtual void Translate(wxDouble dx, wxDouble dy) wxOVERRIDE; + virtual void Scale(wxDouble xScale, wxDouble yScale) wxOVERRIDE; + virtual void Rotate(wxDouble cRadians) wxOVERRIDE; protected: - virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const; - virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const; + virtual wxPoint2DDouble DoTransformPoint(const wxPoint2DDouble& p) const wxOVERRIDE; + virtual wxPoint2DDouble DoTransformDistance(const wxPoint2DDouble& p) const wxOVERRIDE; private: wxDouble m_11, m_12, m_21, m_22, m_tx, m_ty; diff --git a/Externals/wxWidgets3/include/wx/afterstd.h b/Externals/wxWidgets3/include/wx/afterstd.h index 16075fe5d7..1c89d14758 100644 --- a/Externals/wxWidgets3/include/wx/afterstd.h +++ b/Externals/wxWidgets3/include/wx/afterstd.h @@ -18,24 +18,7 @@ // undo what we did in wx/beforestd.h #if defined(__VISUALC__) && __VISUALC__ <= 1201 - // MSVC 5 does not have this - #if _MSC_VER > 1100 - #pragma warning(pop) - #else - // 'expression' : signed/unsigned mismatch - #pragma warning(default:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(default:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(default:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(default:4663) - #endif + #pragma warning(pop) #endif // see beforestd.h for explanation diff --git a/Externals/wxWidgets3/include/wx/anidecod.h b/Externals/wxWidgets3/include/wx/anidecod.h index 2923887b49..4a112410c8 100644 --- a/Externals/wxWidgets3/include/wx/anidecod.h +++ b/Externals/wxWidgets3/include/wx/anidecod.h @@ -36,26 +36,26 @@ public: ~wxANIDecoder(); - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; - virtual wxColour GetTransparentColour(unsigned int frame) const; + virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE; + virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE; + virtual long GetDelay(unsigned int frame) const wxOVERRIDE; + virtual wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE; // implementation of wxAnimationDecoder's pure virtuals - virtual bool Load( wxInputStream& stream ); + virtual bool Load( wxInputStream& stream ) wxOVERRIDE; - bool ConvertToImage(unsigned int frame, wxImage *image) const; + bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE; - wxAnimationDecoder *Clone() const + wxAnimationDecoder *Clone() const wxOVERRIDE { return new wxANIDecoder; } - wxAnimationType GetType() const + wxAnimationType GetType() const wxOVERRIDE { return wxANIMATION_TYPE_ANI; } private: // wxAnimationDecoder pure virtual: - virtual bool DoCanRead( wxInputStream& stream ) const; + virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE; // modifies current stream position (see wxAnimationDecoder::CanRead) // frames stored as wxImage(s): ANI files are meant to be used mostly for animated diff --git a/Externals/wxWidgets3/include/wx/animate.h b/Externals/wxWidgets3/include/wx/animate.h index 6243fb4568..77ec3bf4f0 100644 --- a/Externals/wxWidgets3/include/wx/animate.h +++ b/Externals/wxWidgets3/include/wx/animate.h @@ -50,7 +50,7 @@ public: wxAnimationType type = wxANIMATION_TYPE_ANY) = 0; protected: - DECLARE_ABSTRACT_CLASS(wxAnimationBase) + wxDECLARE_ABSTRACT_CLASS(wxAnimationBase); }; @@ -106,7 +106,7 @@ protected: virtual void DisplayStaticImage() = 0; private: - DECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase) + wxDECLARE_ABSTRACT_CLASS(wxAnimationCtrlBase); }; diff --git a/Externals/wxWidgets3/include/wx/any.h b/Externals/wxWidgets3/include/wx/any.h index c2cd7a79f4..2b37bafa5e 100644 --- a/Externals/wxWidgets3/include/wx/any.h +++ b/Externals/wxWidgets3/include/wx/any.h @@ -102,16 +102,10 @@ public: Use this template function for checking if wxAnyValueType represents a specific C++ data type. - @remarks This template function does not work on some older compilers - (such as Visual C++ 6.0). For full compiler compatibility - please use wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) macro - instead. - @see wxAny::CheckType() */ - // FIXME-VC6: remove this hack when VC6 is no longer supported template - bool CheckType(T* reserved = NULL) const; + bool CheckType() const; #if wxUSE_EXTENDED_RTTI virtual const wxTypeInfo* GetTypeInfo() const = 0; @@ -139,8 +133,9 @@ private: }; -// -// This method of checking the type is compatible with VC6 +// Deprecated macro for checking the type which was originally introduced for +// MSVC6 compatibility and is not needed any longer now that this compiler is +// not supported any more. #define wxANY_VALUE_TYPE_CHECK_TYPE(valueTypePtr, T) \ wxAnyValueTypeImpl::IsSameClass(valueTypePtr) @@ -164,13 +159,17 @@ private: public: \ static bool IsSameClass(const wxAnyValueType* otherType) \ { \ - return wxTypeId(*sm_instance.get()) == wxTypeId(*otherType); \ + return AreSameClasses(*sm_instance.get(), *otherType); \ } \ - virtual bool IsSameType(const wxAnyValueType* otherType) const \ + virtual bool IsSameType(const wxAnyValueType* otherType) const wxOVERRIDE \ { \ return IsSameClass(otherType); \ } \ private: \ + static bool AreSameClasses(const wxAnyValueType& a, const wxAnyValueType& b) \ + { \ + return wxTypeId(a) == wxTypeId(b); \ + } \ static wxAnyValueTypeScopedPtr sm_instance; \ public: \ static wxAnyValueType* GetInstance() \ @@ -183,12 +182,6 @@ public: \ wxAnyValueTypeScopedPtr CLS::sm_instance(new CLS()); -#ifdef __VISUALC6__ - // "non dll-interface class 'xxx' used as base interface - #pragma warning (push) - #pragma warning (disable:4275) -#endif - /** Following are helper classes for the wxAnyValueTypeImplBase. */ @@ -201,11 +194,7 @@ class wxAnyValueTypeOpsInplace public: static void DeleteValue(wxAnyValueBuffer& buf) { - T* value = reinterpret_cast(&buf.m_buffer[0]); - value->~T(); - - // Some compiler may given 'unused variable' warnings without this - wxUnusedVar(value); + GetValue(buf).~T(); } static void SetValue(const T& value, @@ -218,11 +207,17 @@ public: static const T& GetValue(const wxAnyValueBuffer& buf) { - // Breaking this code into two lines should suppress - // GCC's 'type-punned pointer will break strict-aliasing rules' - // warning. - const T* value = reinterpret_cast(&buf.m_buffer[0]); - return *value; + // Use a union to avoid undefined behaviour (and gcc -Wstrict-alias + // warnings about it) which would occur if we just casted a wxByte + // pointer to a T one. + union + { + const T* ptr; + const wxByte *buf; + } u; + u.buf = buf.m_buffer; + + return *u.ptr; } }; @@ -266,6 +261,10 @@ public: } }; + +template +struct wxAnyAsImpl; + } // namespace wxPrivate @@ -288,13 +287,13 @@ public: wxAnyValueTypeImplBase() : wxAnyValueType() { } virtual ~wxAnyValueTypeImplBase() { } - virtual void DeleteValue(wxAnyValueBuffer& buf) const + virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE { Ops::DeleteValue(buf); } virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { Ops::SetValue(Ops::GetValue(src), dst); } @@ -340,7 +339,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { wxUnusedVar(src); wxUnusedVar(dstType); @@ -418,7 +417,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; + wxAnyValueBuffer& dst) const wxOVERRIDE; }; @@ -433,7 +432,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; + wxAnyValueBuffer& dst) const wxOVERRIDE; }; @@ -469,7 +468,7 @@ public: \ virtual ~wxAnyValueTypeImpl##TYPENAME() { } \ virtual bool ConvertValue(const wxAnyValueBuffer& src, \ wxAnyValueType* dstType, \ - wxAnyValueBuffer& dst) const \ + wxAnyValueBuffer& dst) const wxOVERRIDE \ { \ GV value = GetValue(src); \ return CONVFUNC(value, dstType, dst); \ @@ -520,7 +519,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; + wxAnyValueBuffer& dst) const wxOVERRIDE; }; // @@ -537,7 +536,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const; + wxAnyValueBuffer& dst) const wxOVERRIDE; }; // WX_ANY_DEFINE_SUB_TYPE requires this @@ -565,7 +564,7 @@ public: \ \ virtual bool ConvertValue(const wxAnyValueBuffer& src, \ wxAnyValueType* dstType, \ - wxAnyValueBuffer& dst) const \ + wxAnyValueBuffer& dst) const wxOVERRIDE \ { \ wxUnusedVar(src); \ wxUnusedVar(dstType); \ @@ -614,7 +613,7 @@ public: wxAnyValueTypeImplBase() { } virtual ~wxAnyValueTypeImplVariantData() { } - virtual void DeleteValue(wxAnyValueBuffer& buf) const + virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE { wxVariantData* data = static_cast(buf.m_ptr); if ( data ) @@ -622,7 +621,7 @@ public: } virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { wxVariantData* data = static_cast(src.m_ptr); if ( data ) @@ -644,7 +643,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { wxUnusedVar(src); wxUnusedVar(dstType); @@ -664,11 +663,6 @@ public: #endif // wxUSE_VARIANT -#ifdef __VISUALC6__ - // Re-enable useless VC6 warnings - #pragma warning (pop) -#endif - /* Let's define a discrete Null value so we don't have to really @@ -720,7 +714,6 @@ wxConvertAnyToVariant(const wxAny& any, wxVariant* variant); #endif // wxUSE_VARIANT - // // The wxAny class represents a container for any type. A variant's value // can be changed at run time, possibly to a different type of value. @@ -790,15 +783,10 @@ public: Use this template function for checking if this wxAny holds a specific C++ data type. - @remarks This template function does not work on some older compilers - (such as Visual C++ 6.0). For full compiler ccompatibility - please use wxANY_CHECK_TYPE(any, T) macro instead. - @see wxAnyValueType::CheckType() */ - // FIXME-VC6: remove this hack when VC6 is no longer supported template - bool CheckType(T* = NULL) const + bool CheckType() const { return m_type->CheckType(); } @@ -962,14 +950,16 @@ public: @remarks For convenience, conversion is done when T is wxString. This is useful when a string literal (which are treated as const char* and const wchar_t*) has been assigned to wxAny. - - This template function may not work properly with Visual C++ - 6. For full compiler compatibility, please use - wxANY_AS(any, T) macro instead. */ - // FIXME-VC6: remove this hack when VC6 is no longer supported - template + template T As(T* = NULL) const + { + return wxPrivate::wxAnyAsImpl::DoAs(*this); + } + + // Semi private helper: get the value without coercion, for all types. + template + T RawAs() const { if ( !wxAnyValueTypeImpl::IsSameClass(m_type) ) { @@ -979,19 +969,6 @@ public: return static_cast(wxAnyValueTypeImpl::GetValue(m_buffer)); } - // Allow easy conversion from 'const char *' etc. to wxString - // FIXME-VC6: remove this hack when VC6 is no longer supported - //template<> - wxString As(wxString*) const - { - wxString value; - if ( !GetAs(&value) ) - { - wxFAIL_MSG("Incorrect or non-convertible data type"); - } - return value; - } - #if wxUSE_EXTENDED_RTTI const wxTypeInfo* GetTypeInfo() const { @@ -1087,22 +1064,52 @@ private: }; -// -// This method of checking the type is compatible with VC6 +namespace wxPrivate +{ + +// Dispatcher for template wxAny::As() implementation which is different for +// wxString and all the other types: the generic implementation check if the +// value is of the right type and returns it. +template +struct wxAnyAsImpl +{ + static T DoAs(const wxAny& any) + { + return any.RawAs(); + } +}; + +// Specialization for wxString does coercion. +template <> +struct wxAnyAsImpl +{ + static wxString DoAs(const wxAny& any) + { + wxString value; + if ( !any.GetAs(&value) ) + { + wxFAIL_MSG("Incorrect or non-convertible data type"); + } + return value; + } +}; + +} + +// See comment for wxANY_VALUE_TYPE_CHECK_TYPE. #define wxANY_CHECK_TYPE(any, T) \ wxANY_VALUE_TYPE_CHECK_TYPE((any).GetType(), T) -// -// This method of getting the value is compatible with VC6 +// This macro shouldn't be used any longer for the same reasons as +// wxANY_VALUE_TYPE_CHECK_TYPE(), just call As() directly. #define wxANY_AS(any, T) \ (any).As(static_cast(NULL)) template -inline bool wxAnyValueType::CheckType(T* reserved) const +inline bool wxAnyValueType::CheckType() const { - wxUnusedVar(reserved); return wxAnyValueTypeImpl::IsSameClass(this); } diff --git a/Externals/wxWidgets3/include/wx/anybutton.h b/Externals/wxWidgets3/include/wx/anybutton.h index ebeac3b551..ff41ce999c 100644 --- a/Externals/wxWidgets3/include/wx/anybutton.h +++ b/Externals/wxWidgets3/include/wx/anybutton.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/anybutton.h // Purpose: wxAnyButtonBase class -// Author: Vadim Zetlin +// Author: Vadim Zeitlin // Created: 2000-08-15 (extracted from button.h) -// Copyright: (c) Vadim Zetlin +// Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -102,7 +102,7 @@ public: // 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; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } // wxUniv-compatible and deprecated equivalents to SetBitmapXXX() #if WXWIN_COMPATIBILITY_2_8 @@ -135,6 +135,13 @@ public: State_Max }; + // return the current setting for the "normal" state of the button, it can + // be different from State_Normal for a wxToggleButton + virtual State GetNormalState() const + { + return State_Normal; + } + // 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 @@ -150,7 +157,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } virtual wxBitmap DoGetBitmap(State WXUNUSED(which)) const { return wxBitmap(); } @@ -186,10 +193,8 @@ protected: // #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" +#elif defined(__WXQT__) + #include "wx/qt/anybutton.h" #else typedef wxAnyButtonBase wxAnyButton; #endif diff --git a/Externals/wxWidgets3/include/wx/anystr.h b/Externals/wxWidgets3/include/wx/anystr.h index 8eebaf9b03..082d83f151 100644 --- a/Externals/wxWidgets3/include/wx/anystr.h +++ b/Externals/wxWidgets3/include/wx/anystr.h @@ -60,7 +60,7 @@ public: // different conversions to pointers) operator bool() const { return m_str != NULL; } - // at least VC6 and VC7 also need this one or they complain about ambiguity + // at least VC7 also needs this one or it complains about ambiguity // for !anystr expressions bool operator!() const { return !((bool)*this); } diff --git a/Externals/wxWidgets3/include/wx/app.h b/Externals/wxWidgets3/include/wx/app.h index a886dce955..bc17b94b93 100644 --- a/Externals/wxWidgets3/include/wx/app.h +++ b/Externals/wxWidgets3/include/wx/app.h @@ -264,7 +264,7 @@ public: // Implement the inherited wxEventFilter method but just return -1 from it // to indicate that default processing should take place. - virtual int FilterEvent(wxEvent& event); + virtual int FilterEvent(wxEvent& event) wxOVERRIDE; // return true if we're running event loop, i.e. if the events can // (already) be dispatched @@ -298,10 +298,33 @@ public: // Function called if an uncaught exception is caught inside the main // event loop: it may return true to continue running the event loop or - // false to stop it (in the latter case it may rethrow the exception as - // well) + // false to stop it. If this function rethrows the exception, as it does by + // default, simply because there is no general way to handle exceptions, + // StoreCurrentException() will be called to store it because in any case + // the exception can't be allowed to escape. virtual bool OnExceptionInMainLoop(); + // This function can be overridden to store the current exception, in view + // of rethrowing it later when RethrowStoredException() is called. If the + // exception was stored, return true. If the exception can't be stored, + // i.e. if this function returns false, the program will abort after + // calling OnUnhandledException(). + // + // The default implementation of this function when using C++98 compiler + // just returns false, as there is no generic way to store an arbitrary + // exception in C++98 and each application must do it on its own for the + // exceptions it uses in its overridden version. When using C++11, the + // default implementation uses std::current_exception() and returns true, + // so it's normally not necessary to override this method when using C++11. + virtual bool StoreCurrentException(); + + // If StoreCurrentException() is overridden, this function should be + // overridden as well to rethrow the exceptions stored by it when the + // control gets back to our code, i.e. when it's safe to do it. + // + // The default version does nothing when using C++98 and uses + // std::rethrow_exception() in C++11. + virtual void RethrowStoredException(); #endif // wxUSE_EXCEPTIONS @@ -516,7 +539,7 @@ protected: wxDECLARE_NO_COPY_CLASS(wxAppConsoleBase); }; -#if defined(__UNIX__) && !defined(__WXMSW__) +#if defined(__UNIX__) && !defined(__WINDOWS__) #include "wx/unix/app.h" #else // this has to be a class and not a typedef as we forward declare it @@ -541,7 +564,7 @@ public: // very first initialization function // // Override: very rarely - virtual bool Initialize(int& _argc, wxChar **_argv); + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; // a platform-dependent version of OnInit(): the code here is likely to // depend on the toolkit. default version does nothing. @@ -556,15 +579,15 @@ public: // of the program really starts here // // Override: rarely in GUI applications, always in console ones. - virtual int OnRun(); + virtual int OnRun() wxOVERRIDE; // a matching function for OnInit() - virtual int OnExit(); + virtual int OnExit() wxOVERRIDE; // very last clean up function // // Override: very rarely - virtual void CleanUp(); + virtual void CleanUp() wxOVERRIDE; // the worker functions - usually not used directly by the user code @@ -579,10 +602,10 @@ public: // parties // // it should return true if more idle events are needed, false if not - virtual bool ProcessIdle(); + virtual bool ProcessIdle() wxOVERRIDE; // override base class version: GUI apps always use an event loop - virtual bool UsesEventLoop() const { return true; } + virtual bool UsesEventLoop() const wxOVERRIDE { return true; } // top level window functions @@ -645,8 +668,8 @@ public: // ------------------------------------------------------------------------ #if wxUSE_CMDLINE_PARSER - virtual bool OnCmdLineParsed(wxCmdLineParser& parser); - virtual void OnInitCmdLine(wxCmdLineParser& parser); + virtual bool OnCmdLineParsed(wxCmdLineParser& parser) wxOVERRIDE; + virtual void OnInitCmdLine(wxCmdLineParser& parser) wxOVERRIDE; #endif // miscellaneous other stuff @@ -657,15 +680,9 @@ public: // deactivated virtual void SetActive(bool isActive, wxWindow *lastFocus); -#if WXWIN_COMPATIBILITY_2_6 - // returns true if the program is successfully initialized - wxDEPRECATED_MSG("always returns true now, don't call") - bool Initialized(); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: // override base class method to use GUI traits - virtual wxAppTraits *CreateTraits(); + virtual wxAppTraits *CreateTraits() wxOVERRIDE; // the main top level window (may be NULL) @@ -694,10 +711,6 @@ protected: wxDECLARE_NO_COPY_CLASS(wxAppBase); }; -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxAppBase::Initialized() { return true; } -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // now include the declaration of the real class // ---------------------------------------------------------------------------- @@ -716,10 +729,8 @@ protected: #include "wx/x11/app.h" #elif defined(__WXMAC__) #include "wx/osx/app.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/app.h" -#elif defined(__WXPM__) - #include "wx/os2/app.h" +#elif defined(__WXQT__) + #include "wx/qt/app.h" #endif #else // !GUI @@ -851,7 +862,7 @@ public: wxIMPLEMENT_WX_THEME_SUPPORT \ wxIMPLEMENT_APP_NO_THEMES(appname) -// Same as IMPLEMENT_APP(), but for console applications. +// Same as wxIMPLEMENT_APP(), but for console applications. #define wxIMPLEMENT_APP_CONSOLE(appname) \ wxIMPLEMENT_WXWIN_MAIN_CONSOLE \ wxIMPLEMENT_APP_NO_MAIN(appname) @@ -875,7 +886,7 @@ extern wxAppInitializer wxTheAppInitializer; // deprecated variants _not_ requiring a semicolon after them // (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) +// it's not always possible to force the compiler to require it) #define IMPLEMENT_WXWIN_MAIN_CONSOLE wxIMPLEMENT_WXWIN_MAIN_CONSOLE #define IMPLEMENT_WXWIN_MAIN wxIMPLEMENT_WXWIN_MAIN diff --git a/Externals/wxWidgets3/include/wx/appprogress.h b/Externals/wxWidgets3/include/wx/appprogress.h new file mode 100644 index 0000000000..63bd6e5a14 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/appprogress.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/appprogress.h +// Purpose: wxAppProgressIndicator interface. +// Author: Chaobin Zhang +// Created: 2014-09-05 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APPPROG_H_ +#define _WX_APPPROG_H_ + +#include "wx/defs.h" + +class WXDLLIMPEXP_CORE wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicatorBase() {} + virtual ~wxAppProgressIndicatorBase() {} + + virtual bool IsAvailable() const = 0; + + virtual void SetValue(int value) = 0; + virtual void SetRange(int range) = 0; + virtual void Pulse() = 0; + virtual void Reset() = 0; + +private: + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicatorBase); +}; + +#if defined(__WXMSW__) && wxUSE_TASKBARBUTTON + #include "wx/msw/appprogress.h" +#elif defined(__WXOSX_COCOA__) + #include "wx/osx/appprogress.h" +#else + class wxAppProgressIndicator : public wxAppProgressIndicatorBase + { + public: + wxAppProgressIndicator(wxWindow* WXUNUSED(parent) = NULL, + int WXUNUSED(maxValue) = 100) + { + } + + virtual bool IsAvailable() const wxOVERRIDE { return false; } + + virtual void SetValue(int WXUNUSED(value)) wxOVERRIDE { } + virtual void SetRange(int WXUNUSED(range)) wxOVERRIDE { } + virtual void Pulse() wxOVERRIDE { } + virtual void Reset() wxOVERRIDE { } + }; +#endif + +#endif // _WX_APPPROG_H_ diff --git a/Externals/wxWidgets3/include/wx/apptrait.h b/Externals/wxWidgets3/include/wx/apptrait.h index da1b39b1d3..51168eb5d6 100644 --- a/Externals/wxWidgets3/include/wx/apptrait.h +++ b/Externals/wxWidgets3/include/wx/apptrait.h @@ -73,7 +73,6 @@ public: virtual wxRendererNative *CreateRenderer() = 0; // wxStandardPaths object is normally the same for wxBase and wxGUI - // except in the case of wxMac and wxCocoa virtual wxStandardPaths& GetStandardPaths(); @@ -130,7 +129,9 @@ public: // runtime (not compile-time) version. // returns wxPORT_BASE for console applications and one of the remaining // wxPORT_* values for GUI applications. - virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const = 0; + virtual wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const = 0; // return true if the port is using wxUniversal for the GUI, false if not virtual bool IsUsingUniversalWidgets() const = 0; @@ -172,10 +173,8 @@ private: // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port #if defined(__WIN32__) #include "wx/msw/apptbase.h" -#elif defined(__UNIX__) && !defined(__EMX__) +#elif defined(__UNIX__) #include "wx/unix/apptbase.h" -#elif defined(__OS2__) - #include "wx/os2/apptbase.h" #else // no platform-specific methods to add to wxAppTraits // wxAppTraits must be a class because it was forward declared as class class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase @@ -199,30 +198,33 @@ public: #endif // !wxUSE_CONSOLE_EVENTLOOP #if wxUSE_LOG - virtual wxLog *CreateLogTarget(); + virtual wxLog *CreateLogTarget() wxOVERRIDE; #endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); + virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE; #if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); + virtual wxFontMapper *CreateFontMapper() wxOVERRIDE; #endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); + virtual wxRendererNative *CreateRenderer() wxOVERRIDE; - virtual bool ShowAssertDialog(const wxString& msg); - virtual bool HasStderr(); + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; + virtual bool HasStderr() wxOVERRIDE; // the GetToolkitVersion for console application is always the same - virtual wxPortId GetToolkitVersion(int *verMaj = NULL, int *verMin = NULL) const + wxPortId GetToolkitVersion(int *verMaj = NULL, + int *verMin = NULL, + int *verMicro = NULL) const wxOVERRIDE { // no toolkits (wxBase is for console applications without GUI support) // NB: zero means "no toolkit", -1 means "not initialized yet" // so we must use zero here! if (verMaj) *verMaj = 0; if (verMin) *verMin = 0; + if (verMicro) *verMicro = 0; return wxPORT_BASE; } - virtual bool IsUsingUniversalWidgets() const { return false; } - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } + virtual bool IsUsingUniversalWidgets() const wxOVERRIDE { return false; } + virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; } }; // ---------------------------------------------------------------------------- @@ -235,18 +237,18 @@ class WXDLLIMPEXP_CORE wxGUIAppTraitsBase : public wxAppTraits { public: #if wxUSE_LOG - virtual wxLog *CreateLogTarget(); + virtual wxLog *CreateLogTarget() wxOVERRIDE; #endif // wxUSE_LOG - virtual wxMessageOutput *CreateMessageOutput(); + virtual wxMessageOutput *CreateMessageOutput() wxOVERRIDE; #if wxUSE_FONTMAP - virtual wxFontMapper *CreateFontMapper(); + virtual wxFontMapper *CreateFontMapper() wxOVERRIDE; #endif // wxUSE_FONTMAP - virtual wxRendererNative *CreateRenderer(); + virtual wxRendererNative *CreateRenderer() wxOVERRIDE; - virtual bool ShowAssertDialog(const wxString& msg); - virtual bool HasStderr(); + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; + virtual bool HasStderr() wxOVERRIDE; - virtual bool IsUsingUniversalWidgets() const + virtual bool IsUsingUniversalWidgets() const wxOVERRIDE { #ifdef __WXUNIVERSAL__ return true; @@ -255,7 +257,7 @@ public: #endif } - virtual wxString GetDesktopEnvironment() const { return wxEmptyString; } + virtual wxString GetDesktopEnvironment() const wxOVERRIDE { return wxEmptyString; } }; #endif // wxUSE_GUI @@ -267,12 +269,8 @@ public: // ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port #if defined(__WIN32__) #include "wx/msw/apptrait.h" -#elif defined(__OS2__) - #include "wx/os2/apptrait.h" #elif defined(__UNIX__) #include "wx/unix/apptrait.h" -#elif defined(__DOS__) - #include "wx/msdos/apptrait.h" #else #if wxUSE_GUI class wxGUIAppTraits : public wxGUIAppTraitsBase diff --git a/Externals/wxWidgets3/include/wx/archive.h b/Externals/wxWidgets3/include/wx/archive.h index 9f284668dd..1d0b45e2fb 100644 --- a/Externals/wxWidgets3/include/wx/archive.h +++ b/Externals/wxWidgets3/include/wx/archive.h @@ -73,7 +73,7 @@ protected: private: wxArchiveNotifier *m_notifier; - DECLARE_ABSTRACT_CLASS(wxArchiveEntry) + wxDECLARE_ABSTRACT_CLASS(wxArchiveEntry); }; @@ -99,7 +99,7 @@ public: wxArchiveEntry *GetNextEntry() { return DoGetNextEntry(); } - virtual char Peek() { return wxInputStream::Peek(); } + virtual char Peek() wxOVERRIDE { return wxInputStream::Peek(); } protected: wxArchiveInputStream(wxInputStream& stream, wxMBConv& conv); @@ -181,11 +181,7 @@ void _wxSetArchiveIteratorValue( val = std::make_pair(X(entry->GetInternalName()), Y(entry)); } -#if defined _MSC_VER && _MSC_VER < 1300 -template -#else template -#endif class wxArchiveIterator { public: @@ -374,7 +370,7 @@ private: static wxArchiveClassFactory *sm_first; wxArchiveClassFactory *m_next; - DECLARE_ABSTRACT_CLASS(wxArchiveClassFactory) + wxDECLARE_ABSTRACT_CLASS(wxArchiveClassFactory); }; #endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS diff --git a/Externals/wxWidgets3/include/wx/arrstr.h b/Externals/wxWidgets3/include/wx/arrstr.h index db67c8ef08..8b2a6325c9 100644 --- a/Externals/wxWidgets3/include/wx/arrstr.h +++ b/Externals/wxWidgets3/include/wx/arrstr.h @@ -14,19 +14,39 @@ #include "wx/defs.h" #include "wx/string.h" +#if wxUSE_STD_CONTAINERS_COMPATIBLY + #include +#endif + // these functions are only used in STL build now but we define them in any // case for compatibility with the existing code outside of the library which // could be using them -inline int wxCMPFUNC_CONV wxStringSortAscending(wxString* s1, wxString* s2) +inline int wxCMPFUNC_CONV wxStringSortAscending(const wxString& s1, const wxString& s2) { - return s1->Cmp(*s2); + return s1.Cmp(s2); } -inline int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2) +inline int wxCMPFUNC_CONV wxStringSortDescending(const wxString& s1, const wxString& s2) { return wxStringSortAscending(s2, s1); } +// This comparison function ignores case when comparing strings differing not +// in case only, i.e. this ensures that "Aa" comes before "AB", unlike with +// wxStringSortAscending(). +inline int wxCMPFUNC_CONV +wxDictionaryStringSortAscending(const wxString& s1, const wxString& s2) +{ + const int cmp = s1.CmpNoCase(s2); + return cmp ? cmp : s1.Cmp(s2); +} + +inline int wxCMPFUNC_CONV +wxDictionaryStringSortDescending(const wxString& s1, const wxString& s2) +{ + return wxDictionaryStringSortAscending(s2, s1); +} + #if wxUSE_STD_CONTAINERS #include "wx/dynarray.h" @@ -38,9 +58,6 @@ _WX_DECLARE_BASEARRAY_2(_wxArraywxBaseArrayStringBase, wxBaseArrayStringBase, class WXDLLIMPEXP_BASE); WX_DEFINE_USER_EXPORTED_TYPEARRAY(wxString, wxArrayStringBase, wxBaseArrayStringBase, WXDLLIMPEXP_BASE); -_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, - wxBaseArrayStringBase, = wxStringSortAscending, - class WXDLLIMPEXP_BASE, CMPFUNCwxString); class WXDLLIMPEXP_BASE wxArrayString : public wxArrayStringBase { @@ -68,6 +85,10 @@ public: } }; +_WX_DEFINE_SORTED_TYPEARRAY_2(wxString, wxSortedArrayStringBase, + wxBaseArrayStringBase, = wxStringSortAscending, + class WXDLLIMPEXP_BASE, wxArrayString::CompareFunction); + class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase { public: @@ -84,6 +105,9 @@ public: for ( size_t n = 0; n < src.size(); n++ ) Add(src[n]); } + wxEXPLICIT wxSortedArrayString(wxArrayString::CompareFunction compareFunction) + : wxSortedArrayStringBase(compareFunction) + { } int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const; @@ -101,21 +125,9 @@ private: #else // if !wxUSE_STD_CONTAINERS -// this shouldn't be defined for compilers not supporting template methods or -// without std::distance() -// -// FIXME-VC6: currently it's only not defined for VC6 in DLL build as it -// doesn't export template methods from DLL correctly so even though -// it compiles them fine, we get link errors when using wxArrayString -#if !defined(__VISUALC6__) || !(defined(WXMAKINGDLL) || defined(WXUSINGDLL)) - #define wxHAS_VECTOR_TEMPLATE_ASSIGN -#endif - -#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN - #include "wx/beforestd.h" - #include - #include "wx/afterstd.h" -#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN +#include "wx/beforestd.h" +#include +#include "wx/afterstd.h" class WXDLLIMPEXP_BASE wxArrayString { @@ -159,7 +171,7 @@ public: void Clear(); // preallocates memory for given number of items void Alloc(size_t nCount); - // minimzes the memory usage (by freeing all extra memory) + // minimizes the memory usage (by freeing all extra memory) void Shrink(); // simple accessors @@ -295,7 +307,6 @@ public: { Init(false); assign(first, last); } wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } -#ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN template void assign(Iterator first, Iterator last) { @@ -304,15 +315,6 @@ public: for(; first != last; ++first) push_back(*first); } -#else // !wxHAS_VECTOR_TEMPLATE_ASSIGN - void assign(const_iterator first, const_iterator last) - { - clear(); - reserve(last - first); - for(; first != last; ++first) - push_back(*first); - } -#endif // wxHAS_VECTOR_TEMPLATE_ASSIGN/!wxHAS_VECTOR_TEMPLATE_ASSIGN void assign(size_type n, const_reference v) { clear(); Add(v, n); } @@ -363,8 +365,13 @@ protected: void Init(bool autoSort); // common part of all ctors void Copy(const wxArrayString& src); // copies the contents of another array + CompareFunction m_compareFunction; // set only from wxSortedArrayString + private: - void Grow(size_t nIncrement = 0); // makes array bigger if needed + // Allocate the new buffer big enough to hold m_nCount + nIncrement items and + // return the pointer to the old buffer, which must be deleted by the caller + // (if the old buffer is big enough, just return NULL). + wxString *Grow(size_t nIncrement); size_t m_nSize, // current size of the array m_nCount; // current number of elements @@ -381,6 +388,10 @@ public: { } wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) { Copy(array); } + + wxEXPLICIT wxSortedArrayString(CompareFunction compareFunction) + : wxArrayString(true) + { m_compareFunction = compareFunction; } }; #endif // !wxUSE_STD_CONTAINERS @@ -467,6 +478,16 @@ public: m_data.ptr = strings; } +#if wxUSE_STD_CONTAINERS_COMPATIBLY + // construct an adapter from a vector of strings (of any type) + template + wxArrayStringsAdapter(const std::vector& strings) + : m_type(wxSTRING_POINTER), m_size(strings.size()) + { + m_data.ptr = &strings[0]; + } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + // construct an adapter from a single wxString wxArrayStringsAdapter(const wxString& s) : m_type(wxSTRING_POINTER), m_size(1) diff --git a/Externals/wxWidgets3/include/wx/artprov.h b/Externals/wxWidgets3/include/wx/artprov.h index 3e95ed98fe..29e0c71b26 100644 --- a/Externals/wxWidgets3/include/wx/artprov.h +++ b/Externals/wxWidgets3/include/wx/artprov.h @@ -111,6 +111,9 @@ typedef wxString wxArtID; #define wxART_FIND wxART_MAKE_ART_ID(wxART_FIND) #define wxART_FIND_AND_REPLACE wxART_MAKE_ART_ID(wxART_FIND_AND_REPLACE) +#define wxART_FULL_SCREEN wxART_MAKE_ART_ID(wxART_FULL_SCREEN) + +#define wxART_EDIT wxART_MAKE_ART_ID(wxART_EDIT) // ---------------------------------------------------------------------------- // wxArtProvider class @@ -186,17 +189,8 @@ public: // the topmost provider if platform_dependent = false static wxSize GetSizeHint(const wxArtClient& client, bool platform_dependent = false); -#if WXWIN_COMPATIBILITY_2_6 - // use the corresponding methods without redundant "Provider" suffix - static wxDEPRECATED( void PushProvider(wxArtProvider *provider) ); - static wxDEPRECATED( void InsertProvider(wxArtProvider *provider) ); - static wxDEPRECATED( bool PopProvider() ); - - // use Delete() if this is what you really need, or just delete the - // provider pointer, do not use Remove() as it does not delete the pointer - // unlike RemoveProvider() which does - static wxDEPRECATED( bool RemoveProvider(wxArtProvider *provider) ); -#endif // WXWIN_COMPATIBILITY_2_6 + // Rescale bitmap (used internally if requested size is other than the available). + static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded); protected: friend class wxArtProviderModule; @@ -246,7 +240,7 @@ private: // art resources cache (so that CreateXXX is not called that often): static wxArtProviderCache *sm_cache; - DECLARE_ABSTRACT_CLASS(wxArtProvider) + wxDECLARE_ABSTRACT_CLASS(wxArtProvider); }; diff --git a/Externals/wxWidgets3/include/wx/atomic.h b/Externals/wxWidgets3/include/wx/atomic.h index 1439d29484..25bd049834 100644 --- a/Externals/wxWidgets3/include/wx/atomic.h +++ b/Externals/wxWidgets3/include/wx/atomic.h @@ -57,7 +57,7 @@ inline wxUint32 wxAtomicDec (wxUint32 &value) return InterlockedDecrement ((LONG*)&value); } -#elif defined(__WXMAC__) || defined(__DARWIN__) +#elif defined(__DARWIN__) #include "libkern/OSAtomic.h" inline void wxAtomicInc (wxUint32 &value) diff --git a/Externals/wxWidgets3/include/wx/aui/auibar.h b/Externals/wxWidgets3/include/wx/aui/auibar.h index 52e2525215..c37787d993 100644 --- a/Externals/wxWidgets3/include/wx/aui/auibar.h +++ b/Externals/wxWidgets3/include/wx/aui/auibar.h @@ -83,7 +83,7 @@ public: m_toolId = c.m_toolId; } #endif - wxEvent *Clone() const { return new wxAuiToolBarEvent(*this); } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiToolBarEvent(*this); } bool IsDropDownClicked() const { return m_isDropdownClicked; } void SetDropDownClicked(bool c) { m_isDropdownClicked = c; } @@ -105,7 +105,7 @@ private: int m_toolId; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiToolBarEvent); }; @@ -347,86 +347,86 @@ public: -class WXDLLIMPEXP_AUI wxAuiDefaultToolBarArt : public wxAuiToolBarArt +class WXDLLIMPEXP_AUI wxAuiGenericToolBarArt : public wxAuiToolBarArt { public: - wxAuiDefaultToolBarArt(); - virtual ~wxAuiDefaultToolBarArt(); + wxAuiGenericToolBarArt(); + virtual ~wxAuiGenericToolBarArt(); - virtual wxAuiToolBarArt* Clone(); - virtual void SetFlags(unsigned int flags); - virtual unsigned int GetFlags(); - virtual void SetFont(const wxFont& font); - virtual wxFont GetFont(); - virtual void SetTextOrientation(int orientation); - virtual int GetTextOrientation(); + virtual wxAuiToolBarArt* Clone() wxOVERRIDE; + virtual void SetFlags(unsigned int flags) wxOVERRIDE; + virtual unsigned int GetFlags() wxOVERRIDE; + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual wxFont GetFont() wxOVERRIDE; + virtual void SetTextOrientation(int orientation) wxOVERRIDE; + virtual int GetTextOrientation() wxOVERRIDE; virtual void DrawBackground( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawPlainBackground(wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawLabel( wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawButton( wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawDropDownButton( wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawControlLabel( wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawSeparator( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawGripper( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; virtual void DrawOverflowButton( wxDC& dc, wxWindow* wnd, const wxRect& rect, - int state); + int state) wxOVERRIDE; virtual wxSize GetLabelSize( wxDC& dc, wxWindow* wnd, - const wxAuiToolBarItem& item); + const wxAuiToolBarItem& item) wxOVERRIDE; virtual wxSize GetToolSize( wxDC& dc, wxWindow* wnd, - const wxAuiToolBarItem& item); + const wxAuiToolBarItem& item) wxOVERRIDE; - virtual int GetElementSize(int element); - virtual void SetElementSize(int elementId, int size); + virtual int GetElementSize(int element) wxOVERRIDE; + virtual void SetElementSize(int elementId, int size) wxOVERRIDE; virtual int ShowDropDown(wxWindow* wnd, - const wxAuiToolBarItemArray& items); + const wxAuiToolBarItemArray& items) wxOVERRIDE; protected: @@ -475,12 +475,12 @@ public: const wxSize& size = wxDefaultSize, long style = wxAUI_TB_DEFAULT_STYLE); - virtual void SetWindowStyleFlag(long style); + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; void SetArtProvider(wxAuiToolBarArt* art); wxAuiToolBarArt* GetArtProvider() const; - bool SetFont(const wxFont& font); + bool SetFont(const wxFont& font) wxOVERRIDE; wxAuiToolBarItem* AddTool(int toolId, @@ -605,7 +605,7 @@ public: bool IsPaneValid(const wxAuiPaneInfo& pane) const; // Override to call DoIdleUpdate(). - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE; protected: void Init(); @@ -631,7 +631,7 @@ protected: int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; protected: // handlers @@ -692,8 +692,8 @@ private: // Common part of OnLeaveWindow() and OnCaptureLost(). void DoResetMouseState(); - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxAuiToolBar) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiToolBar); }; @@ -750,6 +750,16 @@ typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&); #define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK #define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG +#ifdef __WXMSW__ + #define wxHAS_NATIVE_TOOLBAR_ART + #include "wx/aui/barartmsw.h" + #define wxAuiDefaultToolBarArt wxAuiMSWToolBarArt +#endif + +#ifndef wxHAS_NATIVE_TOOLBAR_ART + #define wxAuiDefaultToolBarArt wxAuiGenericToolBarArt +#endif + #endif // wxUSE_AUI #endif // _WX_AUIBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/aui/auibook.h b/Externals/wxWidgets3/include/wx/aui/auibook.h index 17b3fdae9f..c6d232e48d 100644 --- a/Externals/wxWidgets3/include/wx/aui/auibook.h +++ b/Externals/wxWidgets3/include/wx/aui/auibook.h @@ -75,7 +75,7 @@ public: m_dragSource = c.m_dragSource; } #endif - wxEvent *Clone() const { return new wxAuiNotebookEvent(*this); } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiNotebookEvent(*this); } void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; } wxAuiNotebook* GetDragSource() const { return m_dragSource; } @@ -85,7 +85,7 @@ private: #ifndef SWIG private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiNotebookEvent); #endif }; @@ -99,6 +99,7 @@ public: wxBitmap bitmap; // tab's bitmap wxRect rect; // tab's hit rectangle bool active; // true if the page is currently active + bool hover; // true if mouse hovering over tab }; class WXDLLIMPEXP_AUI wxAuiTabContainerButton @@ -206,7 +207,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } void OnPaint(wxPaintEvent& evt); void OnEraseBackground(wxEraseEvent& evt); @@ -234,9 +235,11 @@ protected: wxAuiTabContainerButton* m_hoverButton; wxAuiTabContainerButton* m_pressedButton; + void SetHoverTab(wxWindow* wnd); + #ifndef SWIG - DECLARE_CLASS(wxAuiTabCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_CLASS(wxAuiTabCtrl); + wxDECLARE_EVENT_TABLE(); #endif }; @@ -268,7 +271,7 @@ public: const wxSize& size = wxDefaultSize, long style = 0); - void SetWindowStyleFlag(long style); + void SetWindowStyleFlag(long style) wxOVERRIDE; void SetArtProvider(wxAuiTabArt* art); wxAuiTabArt* GetArtProvider() const; @@ -286,15 +289,15 @@ public: bool select = false, const wxBitmap& bitmap = wxNullBitmap); - bool DeletePage(size_t page); - bool RemovePage(size_t page); + bool DeletePage(size_t page) wxOVERRIDE; + bool RemovePage(size_t page) wxOVERRIDE; - virtual size_t GetPageCount() const; - virtual wxWindow* GetPage(size_t pageIdx) const; + virtual size_t GetPageCount() const wxOVERRIDE; + virtual wxWindow* GetPage(size_t pageIdx) const wxOVERRIDE; int GetPageIndex(wxWindow* pageWnd) const; - bool SetPageText(size_t page, const wxString& text); - wxString GetPageText(size_t pageIdx) const; + bool SetPageText(size_t page, const wxString& text) wxOVERRIDE; + wxString GetPageText(size_t pageIdx) const wxOVERRIDE; bool SetPageToolTip(size_t page, const wxString& text); wxString GetPageToolTip(size_t pageIdx) const; @@ -302,8 +305,8 @@ public: bool SetPageBitmap(size_t page, const wxBitmap& bitmap); wxBitmap GetPageBitmap(size_t pageIdx) const; - int SetSelection(size_t newPage); - int GetSelection() const; + int SetSelection(size_t newPage) wxOVERRIDE; + int GetSelection() const wxOVERRIDE; virtual void Split(size_t page, int direction); @@ -319,7 +322,7 @@ public: void SetMeasuringFont(const wxFont& font); // Sets the tab font - virtual bool SetFont(const wxFont& font); + virtual bool SetFont(const wxFont& font) wxOVERRIDE; // Gets the tab control height int GetTabCtrlHeight() const; @@ -331,36 +334,36 @@ public: bool ShowWindowMenu(); // we do have multiple pages - virtual bool HasMultiplePages() const { return true; } + virtual bool HasMultiplePages() const wxOVERRIDE { return true; } // we don't want focus for ourselves // virtual bool AcceptsFocus() const { return false; } //wxBookCtrlBase functions - virtual void SetPageSize (const wxSize &size); - virtual int HitTest (const wxPoint &pt, long *flags=NULL) const; + virtual void SetPageSize (const wxSize &size) wxOVERRIDE; + virtual int HitTest (const wxPoint &pt, long *flags=NULL) const wxOVERRIDE; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; - virtual int ChangeSelection(size_t n); + virtual int ChangeSelection(size_t n) wxOVERRIDE; virtual bool AddPage(wxWindow *page, const wxString &text, bool select, - int imageId); - virtual bool DeleteAllPages(); + int imageId) wxOVERRIDE; + virtual bool DeleteAllPages() wxOVERRIDE; virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text, - bool select, int imageId); + bool select, int imageId) wxOVERRIDE; protected: // Common part of all ctors. void Init(); // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // Redo sizing after thawing - virtual void DoThaw(); + virtual void DoThaw() wxOVERRIDE; // these can be overridden @@ -372,7 +375,7 @@ protected: virtual wxSize CalculateNewSplitSize(); // remove the page and return a pointer to it - virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) { return NULL; } + virtual wxWindow *DoRemovePage(size_t WXUNUSED(page)) wxOVERRIDE { return NULL; } //A general selection function virtual int DoModifySelection(size_t n, bool events); @@ -432,8 +435,8 @@ protected: unsigned int m_flags; #ifndef SWIG - DECLARE_CLASS(wxAuiNotebook) - DECLARE_EVENT_TABLE() + wxDECLARE_CLASS(wxAuiNotebook); + wxDECLARE_EVENT_TABLE(); #endif }; diff --git a/Externals/wxWidgets3/include/wx/aui/barartmsw.h b/Externals/wxWidgets3/include/wx/aui/barartmsw.h new file mode 100644 index 0000000000..59602f0098 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/aui/barartmsw.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/barartmsw.h +// Purpose: Interface of wxAuiMSWToolBarArt +// Author: Tobias Taschner +// Created: 2015-09-22 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_BARART_MSW_H_ +#define _WX_AUI_BARART_MSW_H_ + +class WXDLLIMPEXP_AUI wxAuiMSWToolBarArt : public wxAuiGenericToolBarArt +{ +public: + wxAuiMSWToolBarArt(); + + virtual wxAuiToolBarArt* Clone() wxOVERRIDE; + + virtual void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawDropDownButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawControlLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawGripper( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + virtual void DrawOverflowButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + int state) wxOVERRIDE; + + virtual wxSize GetLabelSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual wxSize GetToolSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) wxOVERRIDE; + + virtual int GetElementSize(int element) wxOVERRIDE; + virtual void SetElementSize(int elementId, int size) wxOVERRIDE; + + virtual int ShowDropDown(wxWindow* wnd, + const wxAuiToolBarItemArray& items) wxOVERRIDE; + +private: + bool m_themed; + wxSize m_buttonSize; +}; + +#endif // _WX_AUI_BARART_MSW_H_ diff --git a/Externals/wxWidgets3/include/wx/aui/floatpane.h b/Externals/wxWidgets3/include/wx/aui/floatpane.h index bf158933b8..889d2deb73 100644 --- a/Externals/wxWidgets3/include/wx/aui/floatpane.h +++ b/Externals/wxWidgets3/include/wx/aui/floatpane.h @@ -43,6 +43,9 @@ public: void SetPaneWindow(const wxAuiPaneInfo& pane); wxAuiManager* GetOwnerManager() const; + // Allow processing accelerators to the parent frame + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE; + protected: virtual void OnMoveStart(); virtual void OnMoving(const wxRect& windowRect, wxDirection dir); @@ -70,8 +73,8 @@ private: wxAuiManager m_mgr; #ifndef SWIG - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxAuiFloatingFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiFloatingFrame); #endif // SWIG }; diff --git a/Externals/wxWidgets3/include/wx/aui/framemanager.h b/Externals/wxWidgets3/include/wx/aui/framemanager.h index 4f6b4641b1..fdf29d4f8e 100644 --- a/Externals/wxWidgets3/include/wx/aui/framemanager.h +++ b/Externals/wxWidgets3/include/wx/aui/framemanager.h @@ -664,8 +664,8 @@ protected: void* m_reserved; #ifndef SWIG - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxAuiManager) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxAuiManager); #endif // SWIG }; @@ -696,7 +696,7 @@ public: dc = c.dc; } #endif - wxEvent *Clone() const { return new wxAuiManagerEvent(*this); } + wxEvent *Clone() const wxOVERRIDE { return new wxAuiManagerEvent(*this); } void SetManager(wxAuiManager* mgr) { manager = mgr; } void SetPane(wxAuiPaneInfo* p) { pane = p; } @@ -723,7 +723,7 @@ public: #ifndef SWIG private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent); #endif }; diff --git a/Externals/wxWidgets3/include/wx/aui/tabart.h b/Externals/wxWidgets3/include/wx/aui/tabart.h index 3de076c9e3..11d919384b 100644 --- a/Externals/wxWidgets3/include/wx/aui/tabart.h +++ b/Externals/wxWidgets3/include/wx/aui/tabart.h @@ -120,26 +120,26 @@ public: wxAuiGenericTabArt(); virtual ~wxAuiGenericTabArt(); - wxAuiTabArt* Clone(); - void SetFlags(unsigned int flags); + wxAuiTabArt* Clone() wxOVERRIDE; + void SetFlags(unsigned int flags) wxOVERRIDE; void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount); + size_t tabCount) wxOVERRIDE; - 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 SetNormalFont(const wxFont& font) wxOVERRIDE; + void SetSelectedFont(const wxFont& font) wxOVERRIDE; + void SetMeasuringFont(const wxFont& font) wxOVERRIDE; + void SetColour(const wxColour& colour) wxOVERRIDE; + void SetActiveColour(const wxColour& colour) wxOVERRIDE; void DrawBorder( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; void DrawBackground( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; void DrawTab(wxDC& dc, wxWindow* wnd, @@ -148,7 +148,7 @@ public: int closeButtonState, wxRect* outTabRect, wxRect* outButtonRect, - int* xExtent); + int* xExtent) wxOVERRIDE; void DrawButton( wxDC& dc, @@ -157,15 +157,15 @@ public: int bitmapId, int buttonState, int orientation, - wxRect* outRect); + wxRect* outRect) wxOVERRIDE; - int GetIndentSize(); + int GetIndentSize() wxOVERRIDE; int GetBorderWidth( - wxWindow* wnd); + wxWindow* wnd) wxOVERRIDE; int GetAdditionalBorderSpace( - wxWindow* wnd); + wxWindow* wnd) wxOVERRIDE; wxSize GetTabSize( wxDC& dc, @@ -174,16 +174,16 @@ public: const wxBitmap& bitmap, bool active, int closeButtonState, - int* xExtent); + int* xExtent) wxOVERRIDE; int ShowDropDown( wxWindow* wnd, const wxAuiNotebookPageArray& items, - int activeIdx); + int activeIdx) wxOVERRIDE; int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& requiredBmpSize); + const wxSize& requiredBmpSize) wxOVERRIDE; protected: @@ -218,27 +218,27 @@ public: wxAuiSimpleTabArt(); virtual ~wxAuiSimpleTabArt(); - wxAuiTabArt* Clone(); - void SetFlags(unsigned int flags); + wxAuiTabArt* Clone() wxOVERRIDE; + void SetFlags(unsigned int flags) wxOVERRIDE; void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount); + size_t tabCount) wxOVERRIDE; - 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 SetNormalFont(const wxFont& font) wxOVERRIDE; + void SetSelectedFont(const wxFont& font) wxOVERRIDE; + void SetMeasuringFont(const wxFont& font) wxOVERRIDE; + void SetColour(const wxColour& colour) wxOVERRIDE; + void SetActiveColour(const wxColour& colour) wxOVERRIDE; void DrawBorder( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; void DrawBackground( wxDC& dc, wxWindow* wnd, - const wxRect& rect); + const wxRect& rect) wxOVERRIDE; void DrawTab(wxDC& dc, wxWindow* wnd, @@ -247,7 +247,7 @@ public: int closeButtonState, wxRect* outTabRect, wxRect* outButtonRect, - int* xExtent); + int* xExtent) wxOVERRIDE; void DrawButton( wxDC& dc, @@ -256,15 +256,15 @@ public: int bitmapId, int buttonState, int orientation, - wxRect* outRect); + wxRect* outRect) wxOVERRIDE; - int GetIndentSize(); + int GetIndentSize() wxOVERRIDE; int GetBorderWidth( - wxWindow* wnd); + wxWindow* wnd) wxOVERRIDE; int GetAdditionalBorderSpace( - wxWindow* wnd); + wxWindow* wnd) wxOVERRIDE; wxSize GetTabSize( wxDC& dc, @@ -273,22 +273,24 @@ public: const wxBitmap& bitmap, bool active, int closeButtonState, - int* xExtent); + int* xExtent) wxOVERRIDE; int ShowDropDown( wxWindow* wnd, const wxAuiNotebookPageArray& items, - int activeIdx); + int activeIdx) wxOVERRIDE; int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& requiredBmpSize); + const wxSize& requiredBmpSize) wxOVERRIDE; protected: wxFont m_normalFont; wxFont m_selectedFont; wxFont m_measuringFont; + wxColour m_normalTextColour; + wxColour m_selectedTextColour; wxPen m_normalBkPen; wxPen m_selectedBkPen; wxBrush m_normalBkBrush; @@ -312,6 +314,10 @@ protected: #define wxHAS_NATIVE_TABART #include "wx/aui/tabartgtk.h" #define wxAuiDefaultTabArt wxAuiGtkTabArt + #elif defined(__WXMSW__) + #define wxHAS_NATIVE_TABART + #include "wx/aui/tabartmsw.h" + #define wxAuiDefaultTabArt wxAuiMSWTabArt #endif #endif // !__WXUNIVERSAL__ diff --git a/Externals/wxWidgets3/include/wx/aui/tabartgtk.h b/Externals/wxWidgets3/include/wx/aui/tabartgtk.h index 85fe9e2a50..13f42cb4a8 100644 --- a/Externals/wxWidgets3/include/wx/aui/tabartgtk.h +++ b/Externals/wxWidgets3/include/wx/aui/tabartgtk.h @@ -31,9 +31,9 @@ class WXDLLIMPEXP_AUI wxAuiGtkTabArt : public wxAuiGenericTabArt public: wxAuiGtkTabArt(); - virtual wxAuiTabArt* Clone(); - virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect); - virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect); + virtual wxAuiTabArt* Clone() wxOVERRIDE; + virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect) wxOVERRIDE; + virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) wxOVERRIDE; virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& page, @@ -41,16 +41,16 @@ public: int close_button_state, wxRect* out_tab_rect, wxRect* out_button_rect, - int* x_extent); + int* x_extent) wxOVERRIDE; void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, int bitmap_id, - int button_state, int orientation, wxRect* out_rect); + int button_state, int orientation, wxRect* out_rect) wxOVERRIDE; int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages, - const wxSize& required_bmp_size); - int GetBorderWidth(wxWindow* wnd); - int GetAdditionalBorderSpace(wxWindow* wnd); + const wxSize& required_bmp_size) wxOVERRIDE; + int GetBorderWidth(wxWindow* wnd) wxOVERRIDE; + int GetAdditionalBorderSpace(wxWindow* wnd) wxOVERRIDE; virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption, const wxBitmap& bitmap, bool active, - int close_button_state, int* x_extent); + int close_button_state, int* x_extent) wxOVERRIDE; }; #endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/include/wx/aui/tabartmsw.h b/Externals/wxWidgets3/include/wx/aui/tabartmsw.h new file mode 100644 index 0000000000..41a47b267f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/aui/tabartmsw.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/tabartmsw.h +// Purpose: wxAuiMSWTabArt declaration +// Author: Tobias Taschner +// Created: 2015-09-26 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_AUI_TABARTMSW_H_ +#define _WX_AUI_TABARTMSW_H_ + +class WXDLLIMPEXP_AUI wxAuiMSWTabArt : public wxAuiGenericTabArt +{ + +public: + + wxAuiMSWTabArt(); + virtual ~wxAuiMSWTabArt(); + + wxAuiTabArt* Clone() wxOVERRIDE; + void SetSizingInfo(const wxSize& tabCtrlSize, + size_t tabCount) wxOVERRIDE; + + void DrawBorder( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) wxOVERRIDE; + + void DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& pane, + const wxRect& inRect, + int closeButtonState, + wxRect* outTabRect, + wxRect* outButtonRect, + int* xExtent) wxOVERRIDE; + + void DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& inRect, + int bitmapId, + int buttonState, + int orientation, + wxRect* outRect) wxOVERRIDE; + + int GetIndentSize() wxOVERRIDE; + + int GetBorderWidth( + wxWindow* wnd) wxOVERRIDE; + + int GetAdditionalBorderSpace( + wxWindow* wnd) wxOVERRIDE; + + wxSize GetTabSize( + wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmap& bitmap, + bool active, + int closeButtonState, + int* xExtent) wxOVERRIDE; + + int ShowDropDown( + wxWindow* wnd, + const wxAuiNotebookPageArray& items, + int activeIdx) wxOVERRIDE; + + int GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmpSize) wxOVERRIDE; + +private: + bool m_themed; + wxSize m_closeBtnSize; + wxSize m_tabSize; + int m_maxTabHeight; + + void InitSizes(wxWindow* wnd, wxDC& dc); + + bool IsThemed() const; +}; + +#endif // _WX_AUI_TABARTMSW_H_ diff --git a/Externals/wxWidgets3/include/wx/aui/tabmdi.h b/Externals/wxWidgets3/include/wx/aui/tabmdi.h index 8750831747..2922d3a84b 100644 --- a/Externals/wxWidgets3/include/wx/aui/tabmdi.h +++ b/Externals/wxWidgets3/include/wx/aui/tabmdi.h @@ -65,7 +65,7 @@ public: wxMenu* GetWindowMenu() const { return m_pWindowMenu; } void SetWindowMenu(wxMenu* pMenu); - virtual void SetMenuBar(wxMenuBar *pMenuBar); + virtual void SetMenuBar(wxMenuBar *pMenuBar) wxOVERRIDE; #endif // wxUSE_MENUS void SetChildMenuBar(wxAuiMDIChildFrame *pChild); @@ -102,13 +102,13 @@ protected: void DoHandleUpdateUI(wxUpdateUIEvent &event); #endif // wxUSE_MENUS - virtual bool ProcessEvent(wxEvent& event); + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; - virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame); }; //----------------------------------------------------------------------------- @@ -151,9 +151,9 @@ public: virtual const wxIcon& GetIcon() const; virtual void Activate(); - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; - virtual bool Show(bool show = true); + virtual bool Show(bool show = true) wxOVERRIDE; #if wxUSE_STATUSBAR // no status bars @@ -187,7 +187,7 @@ public: virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style)) { return false; } virtual bool IsFullScreen() const { return false; } - virtual bool IsTopLevel() const { return false; } + virtual bool IsTopLevel() const wxOVERRIDE { return false; } void OnMenuHighlight(wxMenuEvent& evt); void OnActivate(wxActivateEvent& evt); @@ -198,13 +198,13 @@ public: protected: void Init(); - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags); - virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; // no size hints virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), - int WXUNUSED(incW), int WXUNUSED(incH)) {} + int WXUNUSED(incW), int WXUNUSED(incH)) wxOVERRIDE {} public: // This function needs to be called when a size change is confirmed, // we needed this function to prevent anybody from the outside @@ -228,8 +228,8 @@ protected: private: - DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame); + wxDECLARE_EVENT_TABLE(); friend class wxAuiMDIClientWindow; }; @@ -247,7 +247,7 @@ public: virtual bool CreateClient(wxAuiMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); - virtual int SetSelection(size_t page); + virtual int SetSelection(size_t page) wxOVERRIDE; virtual wxAuiMDIChildFrame* GetActiveChild(); virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame) { @@ -262,8 +262,8 @@ protected: void OnSize(wxSizeEvent& evt); private: - DECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/include/wx/bannerwindow.h b/Externals/wxWidgets3/include/wx/bannerwindow.h index 1f1fb24611..c65f801fd8 100644 --- a/Externals/wxWidgets3/include/wx/bannerwindow.h +++ b/Externals/wxWidgets3/include/wx/bannerwindow.h @@ -87,7 +87,7 @@ public: void SetGradient(const wxColour& start, const wxColour& end); protected: - virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; private: // Common part of all constructors. diff --git a/Externals/wxWidgets3/include/wx/base64.h b/Externals/wxWidgets3/include/wx/base64.h index 96c6dd80ef..14aaf7d83f 100644 --- a/Externals/wxWidgets3/include/wx/base64.h +++ b/Externals/wxWidgets3/include/wx/base64.h @@ -9,6 +9,8 @@ #ifndef _WX_BASE64_H_ #define _WX_BASE64_H_ +#include "wx/defs.h" + #if wxUSE_BASE64 #include "wx/string.h" diff --git a/Externals/wxWidgets3/include/wx/beforestd.h b/Externals/wxWidgets3/include/wx/beforestd.h index cc335d317b..45c5b5bcba 100644 --- a/Externals/wxWidgets3/include/wx/beforestd.h +++ b/Externals/wxWidgets3/include/wx/beforestd.h @@ -36,31 +36,14 @@ // 'id': identifier was truncated to 'num' characters in the debug info #pragma warning(disable:4786) - // MSVC 5 does not have this - #if __VISUALC__ > 1100 - // we have to disable (and reenable in afterstd.h) this one because, - // even though it is of level 4, it is not disabled by warning(push, 1) - // below for VC7.1! + // we have to disable (and reenable in afterstd.h) this one because, + // even though it is of level 4, it is not disabled by warning(push, 1) + // below for VC7.1! - // unreachable code - #pragma warning(disable:4702) + // unreachable code + #pragma warning(disable:4702) - #pragma warning(push, 1) - #else // VC 5 - // 'expression' : signed/unsigned mismatch - #pragma warning(disable:4018) - - // 'identifier' : unreferenced formal parameter - #pragma warning(disable:4100) - - // 'conversion' : conversion from 'type1' to 'type2', - // possible loss of data - #pragma warning(disable:4244) - - // C++ language change: to explicitly specialize class template - // 'identifier' use the following syntax - #pragma warning(disable:4663) - #endif + #pragma warning(push, 1) #endif // VC++ < 7 /** diff --git a/Externals/wxWidgets3/include/wx/bitmap.h b/Externals/wxWidgets3/include/wx/bitmap.h index bcb189c5d3..9032097bfe 100644 --- a/Externals/wxWidgets3/include/wx/bitmap.h +++ b/Externals/wxWidgets3/include/wx/bitmap.h @@ -71,9 +71,9 @@ protected: #if defined(__WXDFB__) || \ defined(__WXMAC__) || \ defined(__WXGTK__) || \ - defined(__WXCOCOA__) || \ defined(__WXMOTIF__) || \ - defined(__WXX11__) + defined(__WXX11__) || \ + defined(__WXQT__) #define wxUSE_BITMAP_BASE 1 #else #define wxUSE_BITMAP_BASE 0 @@ -100,8 +100,8 @@ public: }; -// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as -// base class for wxBitmapHandler; wxMSW and wxOS2 use wxGDIImageHandler as +// All ports except wxMSW use wxBitmapHandler and wxBitmapBase as +// base class for wxBitmapHandler; wxMSW uses wxGDIImageHandler as // base class since it allows some code reuse there. #if wxUSE_BITMAP_BASE @@ -146,7 +146,7 @@ private: wxString m_extension; wxBitmapType m_type; - DECLARE_ABSTRACT_CLASS(wxBitmapHandler) + wxDECLARE_ABSTRACT_CLASS(wxBitmapHandler); }; // ---------------------------------------------------------------------------- @@ -254,7 +254,7 @@ public: protected: static wxList sm_handlers; - DECLARE_ABSTRACT_CLASS(wxBitmapBase) + wxDECLARE_ABSTRACT_CLASS(wxBitmapBase); }; #endif // wxUSE_BITMAP_BASE @@ -287,12 +287,9 @@ protected: #elif defined(__WXMAC__) #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_PICT_RESOURCE #include "wx/osx/bitmap.h" -#elif defined(__WXCOCOA__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE - #include "wx/cocoa/bitmap.h" -#elif defined(__WXPM__) - #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_BMP_RESOURCE - #include "wx/os2/bitmap.h" +#elif defined(__WXQT__) + #define wxBITMAP_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/qt/bitmap.h" #endif #if wxUSE_IMAGE @@ -305,13 +302,8 @@ wxBitmap:: #endif ConvertToDisabled(unsigned char brightness) const { - // XXX comex: scale support - wxImage disabledImage = ConvertToImage().ConvertToDisabled(brightness); - #ifdef __APPLE__ - return wxBitmap(disabledImage, -1, GetScaleFactor()); - #else - return disabledImage; - #endif + const wxImage imgDisabled = ConvertToImage().ConvertToDisabled(brightness); + return wxBitmap(imgDisabled, -1, GetScaleFactor()); } #endif // wxUSE_IMAGE diff --git a/Externals/wxWidgets3/include/wx/bmpbuttn.h b/Externals/wxWidgets3/include/wx/bmpbuttn.h index ead0ba81ec..2aec670359 100644 --- a/Externals/wxWidgets3/include/wx/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/bmpbuttn.h @@ -20,7 +20,7 @@ // FIXME: right now only wxMSW, wxGTK and wxOSX implement bitmap support in wxButton // itself, this shouldn't be used for the other platforms neither // when all of them do it -#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__)) && !defined(__WXUNIVERSAL__) +#if (defined(__WXMSW__) || defined(__WXGTK20__) || defined(__WXOSX__) || defined(__WXQT__)) && !defined(__WXUNIVERSAL__) #define wxHAS_BUTTON_BITMAP #endif @@ -66,7 +66,7 @@ public: } // Special creation function for a standard "Close" bitmap. It allows to - // simply create a close button with the image appropriate for the common + // simply create a close button with the image appropriate for the current // platform. static wxBitmapButton* NewCloseButton(wxWindow* parent, wxWindowID winid); @@ -80,16 +80,6 @@ public: int GetMarginX() const { return DoGetBitmapMargins().x; } int GetMarginY() const { return DoGetBitmapMargins().y; } - // deprecated synonym for SetBitmapLabel() -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), - SetBitmapLabel(bitmap); ) - - // prevent virtual function hiding - virtual void SetLabel(const wxString& label) - { wxWindow::SetLabel(label); } -#endif // WXWIN_COMPATIBILITY_2_6 - protected: #ifndef wxHAS_BUTTON_BITMAP // function called when any of the bitmaps changes @@ -133,10 +123,8 @@ protected: #include "wx/gtk1/bmpbuttn.h" #elif defined(__WXMAC__) #include "wx/osx/bmpbuttn.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/bmpbuttn.h" -#elif defined(__WXPM__) - #include "wx/os2/bmpbuttn.h" +#elif defined(__WXQT__) + #include "wx/qt/bmpbuttn.h" #endif #endif // wxUSE_BMPBUTTON diff --git a/Externals/wxWidgets3/include/wx/bmpcbox.h b/Externals/wxWidgets3/include/wx/bmpcbox.h index dd69525741..a5b9beeedb 100644 --- a/Externals/wxWidgets3/include/wx/bmpcbox.h +++ b/Externals/wxWidgets3/include/wx/bmpcbox.h @@ -17,6 +17,7 @@ #if wxUSE_BITMAPCOMBOBOX #include "wx/bitmap.h" +#include "wx/dynarray.h" class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxItemContainer; diff --git a/Externals/wxWidgets3/include/wx/bookctrl.h b/Externals/wxWidgets3/include/wx/bookctrl.h index 8b4fbb2fce..35d7bb45e9 100644 --- a/Externals/wxWidgets3/include/wx/bookctrl.h +++ b/Externals/wxWidgets3/include/wx/bookctrl.h @@ -38,7 +38,7 @@ enum wxBK_HITTEST_NOWHERE = 1, // not on tab wxBK_HITTEST_ONICON = 2, // on icon wxBK_HITTEST_ONLABEL = 4, // on label - wxBK_HITTEST_ONITEM = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL, + wxBK_HITTEST_ONITEM = 16, // on tab control but not on its icon or label wxBK_HITTEST_ONPAGE = 8 // not on tab control, but over the selected page }; @@ -226,13 +226,13 @@ public: // we do have multiple pages - virtual bool HasMultiplePages() const { return true; } + virtual bool HasMultiplePages() const wxOVERRIDE { return true; } // we don't want focus for ourselves - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } // returns true if the platform should explicitly apply a theme border - virtual bool CanApplyThemeBorder() const { return false; } + virtual bool CanApplyThemeBorder() const wxOVERRIDE { return false; } protected: // flags for DoSetSelection() @@ -242,7 +242,7 @@ protected: }; // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // After the insertion of the page in the method InsertPage, calling this // method sets the selection to the given page or the first one if there is @@ -303,7 +303,7 @@ protected: virtual wxWindow *DoRemovePage(size_t page) = 0; // our best size is the size which fits all our pages - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; // helper: get the next page wrapping if we reached the end int GetNextPage(bool forward) const; @@ -356,10 +356,10 @@ private: // internal border unsigned int m_internalBorder; - DECLARE_ABSTRACT_CLASS(wxBookCtrlBase) + wxDECLARE_ABSTRACT_CLASS(wxBookCtrlBase); wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; // ---------------------------------------------------------------------------- @@ -384,7 +384,7 @@ public: m_nOldSel = event.m_nOldSel; } - virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxBookCtrlEvent(*this); } // accessors // the currently selected page (wxNOT_FOUND if none) @@ -398,7 +398,7 @@ private: int m_nSel, // currently selected page m_nOldSel; // previously selected page - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent); }; typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&); @@ -432,14 +432,6 @@ typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&); #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_BOOKCTRL_PAGE_CHANGED #define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_BOOKCTRL_PAGE_CHANGING -#if WXWIN_COMPATIBILITY_2_6 - #define wxBC_TOP wxBK_TOP - #define wxBC_BOTTOM wxBK_BOTTOM - #define wxBC_LEFT wxBK_LEFT - #define wxBC_RIGHT wxBK_RIGHT - #define wxBC_DEFAULT wxBK_DEFAULT -#endif - #endif // wxUSE_BOOKCTRL #endif // _WX_BOOKCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/brush.h b/Externals/wxWidgets3/include/wx/brush.h index 1bf2c3005c..c4fb1da273 100644 --- a/Externals/wxWidgets3/include/wx/brush.h +++ b/Externals/wxWidgets3/include/wx/brush.h @@ -81,10 +81,8 @@ public: #include "wx/dfb/brush.h" #elif defined(__WXMAC__) #include "wx/osx/brush.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/brush.h" -#elif defined(__WXPM__) - #include "wx/os2/brush.h" +#elif defined(__WXQT__) + #include "wx/qt/brush.h" #endif class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase @@ -93,15 +91,9 @@ public: wxBrush *FindOrCreateBrush(const wxColour& colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") wxBrush *FindOrCreateBrush(const wxColour& colour, int style) { return FindOrCreateBrush(colour, (wxBrushStyle)style); } -#endif - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddBrush(wxBrush*) ); - wxDEPRECATED( void RemoveBrush(wxBrush*) ); -#endif }; extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; @@ -112,25 +104,24 @@ extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; // // to compile without warnings which it would otherwise provoke from some // compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 // Unfortunately some compilers have ambiguity issues when enum comparisons are // overloaded so we have to disable the overloads in this case, see // wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. #ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM +wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only") inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t) { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants only") inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t) { - return !(s == t); + return static_cast(s) != static_cast(t); } #endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - #endif // _WX_BRUSH_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/buffer.h b/Externals/wxWidgets3/include/wx/buffer.h index 9891494d97..ca6b340084 100644 --- a/Externals/wxWidgets3/include/wx/buffer.h +++ b/Externals/wxWidgets3/include/wx/buffer.h @@ -354,9 +354,6 @@ public: } }; -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer ) -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) - class wxCharBuffer : public wxCharTypeBuffer { public: @@ -374,9 +371,6 @@ public: wxCharBuffer(const wxCStrData& cstr); }; -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer ) -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer ) - class wxWCharBuffer : public wxCharTypeBuffer { public: @@ -464,13 +458,17 @@ private: { if (newSize > m_size) { - void *dataOld = m_data; - m_data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); - if ( !m_data ) + void* const data = realloc(m_data, newSize + wxMemoryBufferData::DefBufSize); + if ( !data ) { - free(dataOld); + // It's better to crash immediately dereferencing a null + // pointer in the function calling us than overflowing the + // buffer which couldn't be made big enough. + free(release()); + return; } + m_data = data; m_size = newSize + wxMemoryBufferData::DefBufSize; } } diff --git a/Externals/wxWidgets3/include/wx/build.h b/Externals/wxWidgets3/include/wx/build.h index 0959a29782..241314c23e 100644 --- a/Externals/wxWidgets3/include/wx/build.h +++ b/Externals/wxWidgets3/include/wx/build.h @@ -52,36 +52,44 @@ // GCC and Intel C++ share same C++ ABI (and possibly others in the future), // check if compiler versions are compatible: #if defined(__GXX_ABI_VERSION) + // The changes between ABI versions 1002 through 1010 (documented at + // https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html + // under -fabi-version) don't affect wxWidgets, so we allow a library + // and an application to differ within that range. + #if ((__GXX_ABI_VERSION >= 1002) && (__GXX_ABI_VERSION <= 1010)) + #define wxGXX_EFFECTIVE_ABI_VERSION 1002 + #else + #define wxGXX_EFFECTIVE_ABI_VERSION __GXX_ABI_VERSION + #endif #define __WX_BO_COMPILER \ - ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION) -#elif defined(__INTEL_COMPILER) - #define __WX_BO_COMPILER ",Intel C++" + ",compiler with C++ ABI " __WX_BO_STRINGIZE(wxGXX_EFFECTIVE_ABI_VERSION) #elif defined(__GNUG__) #define __WX_BO_COMPILER ",GCC " \ __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__) #elif defined(__VISUALC__) #define __WX_BO_COMPILER ",Visual C++ " __WX_BO_STRINGIZE(_MSC_VER) +#elif defined(__INTEL_COMPILER) + // Notice that this must come after MSVC check as ICC under Windows is + // ABI-compatible with the corresponding version of the MSVC and we want to + // allow using it compile the application code using MSVC-built DLLs. + #define __WX_BO_COMPILER ",Intel C++" #elif defined(__BORLANDC__) #define __WX_BO_COMPILER ",Borland C++" -#elif defined(__DIGITALMARS__) - #define __WX_BO_COMPILER ",DigitalMars" -#elif defined(__WATCOMC__) - #define __WX_BO_COMPILER ",Watcom C++" #else #define __WX_BO_COMPILER #endif // WXWIN_COMPATIBILITY macros affect presence of virtual functions -#if WXWIN_COMPATIBILITY_2_6 - #define __WX_BO_WXWIN_COMPAT_2_6 ",compatible with 2.6" -#else - #define __WX_BO_WXWIN_COMPAT_2_6 -#endif #if WXWIN_COMPATIBILITY_2_8 #define __WX_BO_WXWIN_COMPAT_2_8 ",compatible with 2.8" #else #define __WX_BO_WXWIN_COMPAT_2_8 #endif +#if WXWIN_COMPATIBILITY_3_0 + #define __WX_BO_WXWIN_COMPAT_3_0 ",compatible with 3.0" +#else + #define __WX_BO_WXWIN_COMPAT_3_0 +#endif // deriving wxWin containers from STL ones changes them completely: #if wxUSE_STD_CONTAINERS @@ -90,13 +98,13 @@ #define __WX_BO_STL ",wx containers" #endif -// This macro is passed as argument to wxConsoleApp::CheckBuildOptions() +// This macro is passed as argument to wxAppConsole::CheckBuildOptions() #define WX_BUILD_OPTIONS_SIGNATURE \ __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \ " (" __WX_BO_UNICODE \ __WX_BO_COMPILER \ __WX_BO_STL \ - __WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 \ + __WX_BO_WXWIN_COMPAT_2_8 __WX_BO_WXWIN_COMPAT_3_0 \ ")" diff --git a/Externals/wxWidgets3/include/wx/busyinfo.h b/Externals/wxWidgets3/include/wx/busyinfo.h index 600c86c634..94f8fabdcc 100644 --- a/Externals/wxWidgets3/include/wx/busyinfo.h +++ b/Externals/wxWidgets3/include/wx/busyinfo.h @@ -13,6 +13,64 @@ #if wxUSE_BUSYINFO +#include "wx/colour.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// This class is used to pass all the various parameters to wxBusyInfo ctor. +// According to the usual naming conventions (see wxAboutDialogInfo, +// wxFontInfo, ...) it would be called wxBusyInfoInfo, but this would have been +// rather strange, so we call it wxBusyInfoFlags instead. +// +// Methods are mostly self-explanatory except for the difference between "Text" +// and "Label": the former can contain markup, while the latter is just plain +// string which is not parsed in any way. +class wxBusyInfoFlags +{ +public: + wxBusyInfoFlags() + { + m_parent = NULL; + m_alpha = wxALPHA_OPAQUE; + } + + wxBusyInfoFlags& Parent(wxWindow* parent) + { m_parent = parent; return *this; } + + wxBusyInfoFlags& Icon(const wxIcon& icon) + { m_icon = icon; return *this; } + wxBusyInfoFlags& Title(const wxString& title) + { m_title = title; return *this; } + wxBusyInfoFlags& Text(const wxString& text) + { m_text = text; return *this; } + wxBusyInfoFlags& Label(const wxString& label) + { m_label = label; return *this; } + + wxBusyInfoFlags& Foreground(const wxColour& foreground) + { m_foreground = foreground; return *this; } + wxBusyInfoFlags& Background(const wxColour& background) + { m_background = background; return *this; } + + wxBusyInfoFlags& Transparency(wxByte alpha) + { m_alpha = alpha; return *this; } + +private: + wxWindow* m_parent; + + wxIcon m_icon; + wxString m_title, + m_text, + m_label; + + wxColour m_foreground, + m_background; + + wxByte m_alpha; + + friend class wxBusyInfo; +}; + #include "wx/generic/busyinfo.h" #endif // wxUSE_BUSYINFO diff --git a/Externals/wxWidgets3/include/wx/button.h b/Externals/wxWidgets3/include/wx/button.h index 71dbee41de..f31166413e 100644 --- a/Externals/wxWidgets3/include/wx/button.h +++ b/Externals/wxWidgets3/include/wx/button.h @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/button.h // Purpose: wxButtonBase class -// Author: Vadim Zetlin +// Author: Vadim Zeitlin // Modified by: // Created: 15.08.00 -// Copyright: (c) Vadim Zetlin +// Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -58,10 +58,8 @@ protected: #include "wx/gtk1/button.h" #elif defined(__WXMAC__) #include "wx/osx/button.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/button.h" -#elif defined(__WXPM__) - #include "wx/os2/button.h" +#elif defined(__WXQT__) + #include "wx/qt/button.h" #endif #endif // wxUSE_BUTTON diff --git a/Externals/wxWidgets3/include/wx/cairo.h b/Externals/wxWidgets3/include/wx/cairo.h deleted file mode 100644 index eb83424aa3..0000000000 --- a/Externals/wxWidgets3/include/wx/cairo.h +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cairo.h -// Purpose: Cairo library -// Author: Anthony Bretaudeau -// Created: 2007-08-25 -// RCS-ID: $Id: cairo.h 68935 2011-08-27 23:26:53Z RD $ -// Copyright: (c) Anthony Bretaudeau -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CAIRO_H_BASE_ -#define _WX_CAIRO_H_BASE_ - -#if wxUSE_CAIRO - -#include "wx/dynlib.h" -#include - -extern "C" -{ - -bool wxCairoInit(); -void wxCairoCleanUp(); - -} - -#endif // wxUSE_CAIRO - -#endif // _WX_CAIRO_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/calctrl.h b/Externals/wxWidgets3/include/wx/calctrl.h index 16a84748d2..de8881187e 100644 --- a/Externals/wxWidgets3/include/wx/calctrl.h +++ b/Externals/wxWidgets3/include/wx/calctrl.h @@ -164,15 +164,15 @@ public: wxCalendarEvent(const wxCalendarEvent& event) : wxDateEvent(event), m_wday(event.m_wday) { } - void SetWeekDay(const wxDateTime::WeekDay wd) { m_wday = wd; } + void SetWeekDay(wxDateTime::WeekDay wd) { m_wday = wd; } wxDateTime::WeekDay GetWeekDay() const { return m_wday; } - virtual wxEvent *Clone() const { return new wxCalendarEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCalendarEvent(*this); } private: wxDateTime::WeekDay m_wday; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalendarEvent); }; // ---------------------------------------------------------------------------- @@ -348,6 +348,9 @@ protected: #elif defined(__WXMSW__) #define wxHAS_NATIVE_CALENDARCTRL #include "wx/msw/calctrl.h" + #elif defined(__WXQT__) + #define wxHAS_NATIVE_CALENDARCTRL + #include "wx/qt/calctrl.h" #endif #endif // !__WXUNIVERSAL__ diff --git a/Externals/wxWidgets3/include/wx/chartype.h b/Externals/wxWidgets3/include/wx/chartype.h index 5217258d1b..e8ccb35f05 100644 --- a/Externals/wxWidgets3/include/wx/chartype.h +++ b/Externals/wxWidgets3/include/wx/chartype.h @@ -26,10 +26,6 @@ #endif #elif defined(__GNUWIN32__) && !defined(__MINGW32__) #define wxUSE_WCHAR_T 0 - #elif defined(__WATCOMC__) - #define wxUSE_WCHAR_T 0 - #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400) - #define wxUSE_WCHAR_T 0 #else /* add additional compiler checks if this fails */ #define wxUSE_WCHAR_T 1 @@ -47,7 +43,7 @@ Actually MinGW has tchar.h, but it does not include wchar.h */ -#if defined(__VISAGECPP__) || defined(__MINGW32__) || defined(__WATCOMC__) +#if defined(__MINGW32__) #ifndef HAVE_WCHAR_H #define HAVE_WCHAR_H #endif @@ -71,10 +67,27 @@ } #endif /* Cygwin and C++ */ + /* the current (as of Mar 2014) version of Android (up to api level 19) */ + /* doesn't include some declarations (wscdup, wcslen, wcscasecmp, etc.) */ + /* (moved out from __CYGWIN__ block) */ + #if defined(__WXQT__) && !defined(wcsdup) && defined(__ANDROID__) + #ifdef __cplusplus + extern "C" { + #endif + extern wchar_t *wcsdup(const wchar_t *); + extern size_t wcslen (const wchar_t *); + extern size_t wcsnlen (const wchar_t *, size_t ); + extern int wcscasecmp (const wchar_t *, const wchar_t *); + extern int wcsncasecmp (const wchar_t *, const wchar_t *, size_t); + #ifdef __cplusplus + } + #endif + #endif /* Android */ + #elif defined(HAVE_WCSTR_H) /* old compilers have relevant declarations here */ #include -#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__) +#elif defined(__FreeBSD__) || defined(__DARWIN__) /* include stdlib.h for wchar_t */ #include #endif /* HAVE_WCHAR_H */ @@ -95,24 +108,11 @@ #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520) #define wxHAVE_TCHAR_SUPPORT #include -#elif defined(__WATCOMC__) - #define wxHAVE_TCHAR_SUPPORT -#elif defined(__DMC__) - #define wxHAVE_TCHAR_SUPPORT #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) #define wxHAVE_TCHAR_SUPPORT #include #include #include -#elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400) - /* VZ: the old VisualAge definitions were completely wrong and had no */ - /* chance at all to work in Unicode build anyhow so let's pretend */ - /* that VisualAge does _not_ support TCHAR for the moment (as */ - /* indicated by "0 &&" above) until someone really has time to delve */ - /* into Unicode issues under OS/2 */ - - /* VisualAge 4.0+ supports TCHAR */ - #define wxHAVE_TCHAR_SUPPORT #endif /* compilers with (good) TCHAR support */ #ifdef wxHAVE_TCHAR_SUPPORT @@ -140,37 +140,9 @@ /* signed/unsigned version of it which (a) makes sense to me (unlike */ /* char wchar_t is always unsigned) and (b) was how the previous */ /* definitions worked so keep it like this */ - - /* Sun's SunPro compiler supports the wchar_t type and wide character */ - /* functions, but does not define __WCHAR_TYPE__. Define it here to */ - /* allow unicode enabled builds. */ - #if (defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && !defined(__WCHAR_TYPE__) - #define __WCHAR_TYPE__ wxchar_t - #endif - - /* GNU libc has __WCHAR_TYPE__ which requires special treatment, see */ - /* comment below */ - #if !defined(__WCHAR_TYPE__) || \ - (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96)) - /* standard case */ - typedef wchar_t wxChar; - typedef wchar_t wxSChar; - typedef wchar_t wxUChar; - #else /* __WCHAR_TYPE__ and gcc < 2.96 */ - /* VS: wxWidgets used to define wxChar as __WCHAR_TYPE__ here. */ - /* However, this doesn't work with new GCC 3.x compilers because */ - /* wchar_t is C++'s builtin type in the new standard. OTOH, old */ - /* compilers (GCC 2.x) won't accept new definition of */ - /* wx{S,U}CharType, so we have to define wxChar */ - /* conditionally depending on detected compiler & compiler */ - /* version. */ - - /* with old definition of wxChar. */ - #define wchar_t __WCHAR_TYPE__ - typedef __WCHAR_TYPE__ wxChar; - typedef __WCHAR_TYPE__ wxSChar; - typedef __WCHAR_TYPE__ wxUChar; - #endif /* __WCHAR_TYPE__ */ + typedef wchar_t wxChar; + typedef wchar_t wxSChar; + typedef wchar_t wxUChar; #endif /* ASCII/Unicode */ /* ------------------------------------------------------------------------- */ diff --git a/Externals/wxWidgets3/include/wx/checkbox.h b/Externals/wxWidgets3/include/wx/checkbox.h index e0978a0d13..00e73dca9e 100644 --- a/Externals/wxWidgets3/include/wx/checkbox.h +++ b/Externals/wxWidgets3/include/wx/checkbox.h @@ -97,10 +97,10 @@ public: return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); } - virtual bool HasTransparentBackground() { return true; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } // wxCheckBox-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE { wxControl::DoUpdateWindowUI(event); @@ -110,7 +110,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } @@ -178,11 +178,8 @@ private: #include "wx/gtk1/checkbox.h" #elif defined(__WXMAC__) #include "wx/osx/checkbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checkbox.h" -#elif defined(__WXPM__) - #undef wxHAS_3STATE_CHECKBOX - #include "wx/os2/checkbox.h" +#elif defined(__WXQT__) + #include "wx/qt/checkbox.h" #endif #endif // wxUSE_CHECKBOX diff --git a/Externals/wxWidgets3/include/wx/checklst.h b/Externals/wxWidgets3/include/wx/checklst.h index 3c54304d0e..1b06f34c08 100644 --- a/Externals/wxWidgets3/include/wx/checklst.h +++ b/Externals/wxWidgets3/include/wx/checklst.h @@ -21,13 +21,7 @@ // wxCheckListBox: a listbox whose items may be checked // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCheckListBoxBase : public - #ifdef __WXWINCE__ - // keep virtuals synchronised - wxListBoxBase - #else - wxListBox - #endif +class WXDLLIMPEXP_CORE wxCheckListBoxBase : public wxListBox { public: wxCheckListBoxBase() { } @@ -43,8 +37,6 @@ public: #if defined(__WXUNIVERSAL__) #include "wx/univ/checklst.h" -#elif defined(__WXWINCE__) - #include "wx/msw/wince/checklst.h" #elif defined(__WXMSW__) #include "wx/msw/checklst.h" #elif defined(__WXMOTIF__) @@ -55,10 +47,8 @@ public: #include "wx/gtk1/checklst.h" #elif defined(__WXMAC__) #include "wx/osx/checklst.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/checklst.h" -#elif defined(__WXPM__) - #include "wx/os2/checklst.h" +#elif defined(__WXQT__) + #include "wx/qt/checklst.h" #endif #endif // wxUSE_CHECKLISTBOX diff --git a/Externals/wxWidgets3/include/wx/chkconf.h b/Externals/wxWidgets3/include/wx/chkconf.h index 47fa8ee467..0e4814216d 100644 --- a/Externals/wxWidgets3/include/wx/chkconf.h +++ b/Externals/wxWidgets3/include/wx/chkconf.h @@ -19,12 +19,12 @@ If you get an error saying "wxUSE_FOO must be defined", it means that you are not using the correct up-to-date version of setup.h. This happens most - often when using svn or daily snapshots and a new symbol was added to - setup0.h and you haven't updated your local setup.h to reflect it. If - this is the case, you need to propagate the changes from setup0.h to your - setup.h and, if using makefiles under MSW, also remove setup.h under the - build directory (lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that - the new setup.h is copied there. + often when using git or snapshots and a new symbol was added to setup0.h + and you haven't updated your local setup.h to reflect it. If this is the + case, you need to propagate the changes from setup0.h to your setup.h and, + if using makefiles under MSW, also remove setup.h under the build directory + (lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that the new setup.h is + copied there. If you get an error of the form "wxFoo requires wxBar", then the settings in your setup.h are inconsistent. You have the choice between correcting @@ -309,6 +309,14 @@ # endif #endif /* !defined(wxUSE_STD_CONTAINERS) */ +#ifndef wxUSE_STD_CONTAINERS_COMPATIBLY +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_STD_CONTAINERS_COMPATIBLY must be defined, please read comment near the top of this file." +# else +# define wxUSE_STD_CONTAINERS_COMPATIBLY 0 +# endif +#endif /* !defined(wxUSE_STD_CONTAINERS_COMPATIBLY) */ + #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." @@ -417,6 +425,22 @@ # endif #endif /* !defined(wxUSE_ACCESSIBILITY) */ +#ifndef wxUSE_ADDREMOVECTRL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ADDREMOVECTRL must be defined, please read comment near the top of this file." +# else +# define wxUSE_ADDREMOVECTRL 0 +# endif +#endif /* !defined(wxUSE_ADDREMOVECTRL) */ + +#ifndef wxUSE_ACTIVITYINDICATOR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVITYINDICATOR must be defined, please read comment near the top of this file." +# else +# define wxUSE_ACTIVITYINDICATOR 0 +# endif +#endif /* !defined(wxUSE_ACTIVITYINDICATOR) */ + #ifndef wxUSE_ANIMATIONCTRL # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_ANIMATIONCTRL must be defined, please read comment near the top of this file." @@ -1216,21 +1240,15 @@ checks use wxUSE_XXX symbols in #if tests. */ -#if defined(__WXWINCE__) -# include "wx/msw/wince/chkconf.h" -#elif defined(__WINDOWS__) +#if defined(__WINDOWS__) # include "wx/msw/chkconf.h" # if defined(__WXGTK__) # include "wx/gtk/chkconf.h" # endif #elif defined(__WXGTK__) # include "wx/gtk/chkconf.h" -#elif defined(__WXCOCOA__) -# include "wx/cocoa/chkconf.h" #elif defined(__WXMAC__) # include "wx/osx/chkconf.h" -#elif defined(__OS2__) -# include "wx/os2/chkconf.h" #elif defined(__WXDFB__) # include "wx/dfb/chkconf.h" #elif defined(__WXMOTIF__) @@ -1257,16 +1275,16 @@ Section 3a: check consistency of the non-GUI settings. */ -#if WXWIN_COMPATIBILITY_2_6 -# if !WXWIN_COMPATIBILITY_2_8 +#if WXWIN_COMPATIBILITY_2_8 +# if !WXWIN_COMPATIBILITY_3_0 # ifdef wxABORT_ON_CONFIG_ERROR -# error "2.6.X compatibility requires 2.8.X compatibility" +# error "2.8.X compatibility requires 3.0.X compatibility" # else -# undef WXWIN_COMPATIBILITY_2_8 -# define WXWIN_COMPATIBILITY_2_8 1 +# undef WXWIN_COMPATIBILITY_3_0 +# define WXWIN_COMPATIBILITY_3_0 1 # endif # endif -#endif /* WXWIN_COMPATIBILITY_2_6 */ +#endif /* WXWIN_COMPATIBILITY_2_8 */ #if wxUSE_ARCHIVE_STREAMS # if !wxUSE_DATETIME @@ -1518,6 +1536,28 @@ # endif #endif /* controls */ +#if wxUSE_ADDREMOVECTRL +# if !wxUSE_BMPBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ADDREMOVECTRL requires wxUSE_BMPBUTTON" +# else +# undef wxUSE_ADDREMOVECTRL +# define wxUSE_ADDREMOVECTRL 0 +# endif +# endif +#endif /* wxUSE_ADDREMOVECTRL */ + +#if wxUSE_ANIMATIONCTRL +# if !wxUSE_STREAMS +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ANIMATIONCTRL requires wxUSE_STREAMS" +# else +# undef wxUSE_ANIMATIONCTRL +# define wxUSE_ANIMATIONCTRL 0 +# endif +# endif +#endif /* wxUSE_ANIMATIONCTRL */ + #if wxUSE_BMPBUTTON # if !wxUSE_BUTTON # ifdef wxABORT_ON_CONFIG_ERROR @@ -1552,7 +1592,8 @@ # endif #endif -#define wxUSE_BOOKCTRL (wxUSE_NOTEBOOK || \ +#define wxUSE_BOOKCTRL (wxUSE_AUI || \ + wxUSE_NOTEBOOK || \ wxUSE_LISTBOOK || \ wxUSE_CHOICEBOOK || \ wxUSE_TOOLBOOK || \ @@ -1738,6 +1779,20 @@ # endif #endif /* wxUSE_CALENDARCTRL */ +#if wxUSE_DATEPICKCTRL + /* Only the generic implementation, not used under MSW and OSX, needs + * wxComboCtrl. */ +# if !wxUSE_COMBOCTRL && (defined(__WXUNIVERSAL__) || \ + !(defined(__WXMSW__) || defined(__WXOSX_COCOA__))) +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxDatePickerCtrl requires wxUSE_COMBOCTRL" +# else +# undef wxUSE_COMBOCTRL +# define wxUSE_COMBOCTRL 1 +# endif +# endif +#endif /* wxUSE_DATEPICKCTRL */ + #if wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL # if !wxUSE_DATETIME # ifdef wxABORT_ON_CONFIG_ERROR @@ -2226,6 +2281,47 @@ # endif #endif /* wxUSE_PREFERENCES_EDITOR */ +#if wxUSE_MEDIACTRL +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxMediaCtrl requires wxUSE_LONLONG" +# else +# undef wxUSE_LONLONG +# define wxUSE_LONLONG 1 +# endif +# endif +#endif /* wxUSE_MEDIACTRL */ + +#if wxUSE_STC +# if !wxUSE_STOPWATCH +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxStyledTextCtrl requires wxUSE_STOPWATCH" +# else +# undef wxUSE_STC +# define wxUSE_STC 0 +# endif +# endif +#endif /* wxUSE_STC */ + +#if wxUSE_RICHTEXT +# if !wxUSE_HTML +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichTextCtrl requires wxUSE_HTML" +# else +# undef wxUSE_RICHTEXT +# define wxUSE_RICHTEXT 0 +# endif +# endif +# if !wxUSE_LONGLONG +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxRichTextCtrl requires wxUSE_LONLONG" +# else +# undef wxUSE_LONLONG +# define wxUSE_LONLONG 1 +# endif +# endif +#endif /* wxUSE_RICHTEXT */ + #endif /* wxUSE_GUI */ #endif /* _WX_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/choice.h b/Externals/wxWidgets3/include/wx/choice.h index 3a848f9f3c..b5bfac3b1a 100644 --- a/Externals/wxWidgets3/include/wx/choice.h +++ b/Externals/wxWidgets3/include/wx/choice.h @@ -52,17 +52,17 @@ public: virtual int GetColumns() const { return 1 ; } // emulate selecting the item event.GetInt() - void Command(wxCommandEvent& event); + void Command(wxCommandEvent& event) wxOVERRIDE; // override wxItemContainer::IsSorted - virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } + virtual bool IsSorted() const wxOVERRIDE { return HasFlag(wxCB_SORT); } protected: // The generic implementation doesn't determine the height correctly and // doesn't account for the width of the arrow but does take into account // the string widths, so the derived classes should override it and set the // height and add the arrow width to the size returned by this version. - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: wxDECLARE_NO_COPY_CLASS(wxChoiceBase); @@ -74,8 +74,6 @@ private: #if defined(__WXUNIVERSAL__) #include "wx/univ/choice.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/choicece.h" #elif defined(__WXMSW__) #include "wx/msw/choice.h" #elif defined(__WXMOTIF__) @@ -86,10 +84,8 @@ private: #include "wx/gtk1/choice.h" #elif defined(__WXMAC__) #include "wx/osx/choice.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/choice.h" -#elif defined(__WXPM__) - #include "wx/os2/choice.h" +#elif defined(__WXQT__) + #include "wx/qt/choice.h" #endif #endif // wxUSE_CHOICE diff --git a/Externals/wxWidgets3/include/wx/choicebk.h b/Externals/wxWidgets3/include/wx/choicebk.h index 335ede165e..c56916f903 100644 --- a/Externals/wxWidgets3/include/wx/choicebk.h +++ b/Externals/wxWidgets3/include/wx/choicebk.h @@ -60,21 +60,21 @@ public: const wxString& name = wxEmptyString); - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); - virtual int SetSelection(size_t n) + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) { return DoSetSelection(n); } - virtual void SetImageList(wxImageList *imageList); + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; - virtual bool DeleteAllPages(); + virtual bool DeleteAllPages() wxOVERRIDE; // returns the choice control wxChoice* GetChoiceCtrl() const { return (wxChoice*)m_bookctrl; } @@ -82,28 +82,28 @@ public: // Override this to return true because the part of parent window // background between our controlling wxChoice and the page area should // show through. - virtual bool HasTransparentBackground() { return true; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } protected: - virtual void DoSetWindowVariant(wxWindowVariant variant); + virtual void DoSetWindowVariant(wxWindowVariant variant) wxOVERRIDE; - virtual wxWindow *DoRemovePage(size_t page); + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; - void UpdateSelectedPage(size_t newsel) + void UpdateSelectedPage(size_t newsel) wxOVERRIDE { m_selection = static_cast(newsel); GetChoiceCtrl()->Select(m_selection); } - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; // event handlers void OnChoiceSelected(wxCommandEvent& event); private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/clipbrd.h b/Externals/wxWidgets3/include/wx/clipbrd.h index 5399be27d5..2c37937c58 100644 --- a/Externals/wxWidgets3/include/wx/clipbrd.h +++ b/Externals/wxWidgets3/include/wx/clipbrd.h @@ -117,7 +117,7 @@ public: bool SupportsFormat(const wxDataFormat& format) const; void AddFormat(const wxDataFormat& format); - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxClipboardEvent(*this); } @@ -126,7 +126,7 @@ public: protected: wxVector m_formats; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent ); @@ -161,10 +161,8 @@ typedef void (wxEvtHandler::*wxClipboardEventFunction)(wxClipboardEvent&); #include "wx/x11/clipbrd.h" #elif defined(__WXMAC__) #include "wx/osx/clipbrd.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/clipbrd.h" -#elif defined(__WXPM__) - #include "wx/os2/clipbrd.h" +#elif defined(__WXQT__) + #include "wx/qt/clipbrd.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/clrpicker.h b/Externals/wxWidgets3/include/wx/clrpicker.h index 1794ee68c9..840e0b1123 100644 --- a/Externals/wxWidgets3/include/wx/clrpicker.h +++ b/Externals/wxWidgets3/include/wx/clrpicker.h @@ -68,6 +68,7 @@ protected: // NOTE: this style is supported just by wxColourButtonGeneric and // thus is not exposed in wxColourPickerCtrl #define wxCLRP_SHOW_LABEL 0x0008 +#define wxCLRP_SHOW_ALPHA 0x0010 // map platform-dependent controls which implement the wxColourPickerWidgetBase // under the name "wxColourPickerWidget". @@ -79,6 +80,8 @@ protected: #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/clrpicker.h" #define wxColourPickerWidget wxColourButton +#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__) + #include "wx/qt/clrpicker.h" #else #include "wx/generic/clrpickerg.h" #define wxColourPickerWidget wxGenericColourButton @@ -134,20 +137,20 @@ public: // public API public: // internal functions // update the button colour to match the text control contents - void UpdatePickerFromTextCtrl(); + void UpdatePickerFromTextCtrl() wxOVERRIDE; // update the text control to match the button's colour - void UpdateTextCtrlFromPicker(); + void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnColourChange(wxColourPickerEvent &); protected: - virtual long GetPickerStyle(long style) const - { return (style & wxCLRP_SHOW_LABEL); } + virtual long GetPickerStyle(long style) const wxOVERRIDE + { return (style & (wxCLRP_SHOW_LABEL | wxCLRP_SHOW_ALPHA)); } private: - DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl) + wxDECLARE_DYNAMIC_CLASS(wxColourPickerCtrl); }; @@ -173,12 +176,12 @@ public: // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxColourPickerEvent(*this); } private: wxColour m_colour; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/cmdargs.h b/Externals/wxWidgets3/include/wx/cmdargs.h index e4167f0fd6..e34ba52a98 100644 --- a/Externals/wxWidgets3/include/wx/cmdargs.h +++ b/Externals/wxWidgets3/include/wx/cmdargs.h @@ -113,7 +113,7 @@ public: private: template - void Free(T **args) + void Free(T**& args) { if ( !args ) return; @@ -123,6 +123,7 @@ private: free(args[n]); delete [] args; + args = NULL; } void FreeArgs() diff --git a/Externals/wxWidgets3/include/wx/cmdline.h b/Externals/wxWidgets3/include/wx/cmdline.h index 3dd41b9fe4..2b7000fb28 100644 --- a/Externals/wxWidgets3/include/wx/cmdline.h +++ b/Externals/wxWidgets3/include/wx/cmdline.h @@ -27,6 +27,7 @@ enum wxCmdLineSplitType #if wxUSE_CMDLINE_PARSER +class WXDLLIMPEXP_FWD_BASE wxCmdLineParser; class WXDLLIMPEXP_FWD_BASE wxDateTime; // ---------------------------------------------------------------------------- @@ -93,6 +94,90 @@ struct wxCmdLineEntryDesc #define wxCMD_LINE_DESC_END \ { wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0x0 } +// ---------------------------------------------------------------------------- +// wxCmdLineArg contains the value for one command line argument +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineArg +{ +public: + virtual ~wxCmdLineArg() {} + + virtual double GetDoubleVal() const = 0; + virtual long GetLongVal() const = 0; + virtual const wxString& GetStrVal() const = 0; +#if wxUSE_DATETIME + virtual const wxDateTime& GetDateVal() const = 0; +#endif // wxUSE_DATETIME + + virtual bool IsNegated() const = 0; + + virtual wxCmdLineEntryType GetKind() const = 0; + virtual wxString GetShortName() const = 0; + virtual wxString GetLongName() const = 0; + virtual wxCmdLineParamType GetType() const = 0; +}; + +// ---------------------------------------------------------------------------- +// wxCmdLineArgs is a container of command line arguments actually parsed and +// allows enumerating them using the standard iterator-based approach. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxCmdLineArgs +{ +public: + class WXDLLIMPEXP_BASE const_iterator + { + public: + typedef int difference_type; + typedef wxCmdLineArg value_type; + typedef const wxCmdLineArg* pointer; + typedef const wxCmdLineArg& reference; + +// We avoid dependency on standard library by default but if we do use +// std::string, then it's ok to use iterator tags as well. +#if wxUSE_STD_STRING + typedef std::bidirectional_iterator_tag iterator_category; +#endif // wx_USE_STD_STRING + + const_iterator() : m_parser(NULL), m_index(0) {} + reference operator *() const; + pointer operator ->() const; + const_iterator &operator ++ (); + const_iterator operator ++ (int); + const_iterator &operator -- (); + const_iterator operator -- (int); + + bool operator == (const const_iterator &other) const { + return m_parser==other.m_parser && m_index==other.m_index; + } + bool operator != (const const_iterator &other) const { + return !operator==(other); + } + + private: + const_iterator (const wxCmdLineParser& parser, size_t index) + : m_parser(&parser), m_index(index) { + } + + const wxCmdLineParser* m_parser; + size_t m_index; + + friend class wxCmdLineArgs; + }; + + wxCmdLineArgs (const wxCmdLineParser& parser) : m_parser(parser) {} + + const_iterator begin() const { return const_iterator(m_parser, 0); } + const_iterator end() const { return const_iterator(m_parser, size()); } + + size_t size() const; + +private: + const wxCmdLineParser& m_parser; + wxDECLARE_NO_ASSIGN_CLASS(wxCmdLineArgs); +}; + // ---------------------------------------------------------------------------- // wxCmdLineParser is a class for parsing command line. // @@ -263,6 +348,9 @@ public: // gets the value of Nth parameter (as string only for now) wxString GetParam(size_t n = 0u) const; + // returns a reference to the container of all command line arguments + wxCmdLineArgs GetArguments() const { return wxCmdLineArgs(*this); } + // Resets switches and options void Reset(); @@ -277,6 +365,8 @@ private: struct wxCmdLineParserData *m_data; + friend class wxCmdLineArgs; + friend class wxCmdLineArgs::const_iterator; wxDECLARE_NO_COPY_CLASS(wxCmdLineParser); }; diff --git a/Externals/wxWidgets3/include/wx/cmdproc.h b/Externals/wxWidgets3/include/wx/cmdproc.h index c6125096a0..8f9656c5c3 100644 --- a/Externals/wxWidgets3/include/wx/cmdproc.h +++ b/Externals/wxWidgets3/include/wx/cmdproc.h @@ -41,7 +41,7 @@ protected: wxString m_commandName; private: - DECLARE_CLASS(wxCommand) + wxDECLARE_CLASS(wxCommand); }; // ---------------------------------------------------------------------------- @@ -132,7 +132,7 @@ protected: wxString m_redoAccelerator; private: - DECLARE_DYNAMIC_CLASS(wxCommandProcessor) + wxDECLARE_DYNAMIC_CLASS(wxCommandProcessor); wxDECLARE_NO_COPY_CLASS(wxCommandProcessor); }; diff --git a/Externals/wxWidgets3/include/wx/cmndata.h b/Externals/wxWidgets3/include/wx/cmndata.h index c8e345af56..db647824d7 100644 --- a/Externals/wxWidgets3/include/wx/cmndata.h +++ b/Externals/wxWidgets3/include/wx/cmndata.h @@ -71,8 +71,7 @@ public: bool GetColour() const { return m_colour; } wxDuplexMode GetDuplex() const { return m_duplexMode; } wxPaperSize GetPaperId() const { return m_paperId; } - const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size - // in wxPageSetupDialogData + const wxSize& GetPaperSize() const { return m_paperSize; } wxPrintQuality GetQuality() const { return m_printQuality; } wxPrintBin GetBin() const { return m_bin; } wxPrintMode GetPrintMode() const { return m_printMode; } @@ -138,7 +137,7 @@ private: wxPrintNativeDataBase *m_nativeData; private: - DECLARE_DYNAMIC_CLASS(wxPrintData) + wxDECLARE_DYNAMIC_CLASS(wxPrintData); }; /* @@ -213,7 +212,7 @@ private: wxPrintData m_printData; private: - DECLARE_DYNAMIC_CLASS(wxPrintDialogData) + wxDECLARE_DYNAMIC_CLASS(wxPrintDialogData); }; /* @@ -302,7 +301,7 @@ private: wxPrintData m_printData; private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData) + wxDECLARE_DYNAMIC_CLASS(wxPageSetupDialogData); }; #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSApplication.h b/Externals/wxWidgets3/include/wx/cocoa/NSApplication.h deleted file mode 100644 index 192d282782..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSApplication.h +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSApplication.h -// Purpose: wxNSApplicationDelegate definition -// Author: David Elliott -// Modified by: -// Created: 2004/01/26 -// Copyright: (c) 2003,2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_NSAPPLICATION_H__ -#define _WX_COCOA_NSAPPLICATION_H__ - -#include "wx/cocoa/objc/objc_uniquifying.h" - -// ======================================================================== -// wxNSApplicationDelegate -// ======================================================================== -/*! - @class wxNSApplicationDelegate - @discussion Implements an NSApplication delegate which can respond to messages sent by Cocoa to change Cocoa's behaviour. - - wxCocoa will set a singleton instance of this class as the NSApplication delegate upon startup unless wxWidgets is running - in a "plugin" manner in which case it would not be appropriate to do this. - - Although Cocoa will send notifications to the delegate it is also possible to register a different object to listen for - them. Because we want to support the plugin case, we use a separate notification observer object when we can. -*/ -@interface wxNSApplicationDelegate : NSObject -{ -} - -// Delegate methods -- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication; -@end // interface wxNSApplicationDelegate : NSObject -WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationDelegate,NSObject) - -// ======================================================================== -// wxNSApplicationObserver -// ======================================================================== -/*! - @class wxNSApplicationObserver - @discussion Observes most notifications sent by the NSApplication singleton. - - wxCocoa will create a singleton instance of this class upon startup and register it with the default notification center to - listen for several events sent by the NSApplication singleton. - - Because there can be any number of notification observers, this method allows wxCocoa to function properly even when it is - running as a plugin of some other (most likely not wxWidgets) application. -*/ -@interface wxNSApplicationObserver : NSObject -{ -} - -// Methods defined as (but not used here) as NSApplication delegate methods. -- (void)applicationWillBecomeActive:(NSNotification *)notification; -- (void)applicationDidBecomeActive:(NSNotification *)notification; -- (void)applicationWillResignActive:(NSNotification *)notification; -- (void)applicationDidResignActive:(NSNotification *)notification; -- (void)applicationWillUpdate:(NSNotification *)notification; - -// Other notifications -- (void)controlTintChanged:(NSNotification *)notification; -@end // interface wxNSApplicationObserver : NSObject -WX_DECLARE_GET_OBJC_CLASS(wxNSApplicationObserver,NSObject) - -#endif //ndef _WX_COCOA_NSAPPLICATION_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSBox.h b/Externals/wxWidgets3/include/wx/cocoa/NSBox.h deleted file mode 100644 index 39cbe3de5f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSBox.h +++ /dev/null @@ -1,25 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSBox.h -// Purpose: wxCocoaNSBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/19 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSBOX_H__ -#define __WX_COCOA_NSBOX_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSBox); -class wxCocoaNSBox -{ - WX_DECLARE_OBJC_INTERFACE(NSBox) -protected: -// virtual void Cocoa_didChangeText(void) = 0; -}; - -#endif // _WX_COCOA_NSBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSButton.h b/Externals/wxWidgets3/include/wx/cocoa/NSButton.h deleted file mode 100644 index 7e32aac07d..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSButton.h +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSButton.h -// Purpose: wxCocoaNSButton class -// Author: David Elliott -// Modified by: -// Created: 2002/12/09 -// Copyright: (c) 2002-2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_NSBUTTON_H__ -#define _WX_COCOA_NSBUTTON_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" -#include "wx/cocoa/ObjcRef.h" - -WX_DECLARE_OBJC_HASHMAP(NSButton); - -class wxCocoaNSButton -{ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSButton); -public: - void AssociateNSButton(WX_NSButton cocoaNSButton); - void DisassociateNSButton(WX_NSButton cocoaNSButton) - { - if(cocoaNSButton) - sm_cocoaHash.erase(cocoaNSButton); - } - - virtual void Cocoa_wxNSButtonAction(void) = 0; - virtual ~wxCocoaNSButton() { } - -protected: - static const wxObjcAutoRefFromAlloc sm_cocoaTarget; -}; - -#endif // _WX_COCOA_NSBUTTON_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSControl.h b/Externals/wxWidgets3/include/wx/cocoa/NSControl.h deleted file mode 100644 index f921c337d1..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSControl.h +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSControl.h -// Purpose: wxCocoaNSControl class -// Author: David Elliott -// Modified by: -// Created: 2003/02/15 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSCONTROL_H__ -#define __WX_COCOA_NSCONTROL_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSControl); -class wxCocoaNSControl -{ - WX_DECLARE_OBJC_INTERFACE(NSControl) -public: - virtual void CocoaTarget_action() {} -// virtual void Cocoa_didChangeText(void) = 0; - - virtual ~wxCocoaNSControl() { } - -protected: - static struct objc_object *sm_cocoaTarget; -}; - -#endif // _WX_COCOA_NSCONTROL_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSMenu.h b/Externals/wxWidgets3/include/wx/cocoa/NSMenu.h deleted file mode 100644 index a413ad45a6..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSMenu.h +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSMenu.h -// Purpose: wxCocoaNSMenu class -// Author: David Elliott -// Modified by: -// Created: 2002/12/09 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSMENU_H__ -#define __WX_COCOA_NSMENU_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSMenu); - -// ======================================================================== -// wxCocoaNSMenu -// ======================================================================== - -class wxCocoaNSMenu -{ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSMenu) -public: - void AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags = 0); - void DisassociateNSMenu(WX_NSMenu cocoaNSMenu); - enum - { OBSERVE_DidAddItem = 0x01 - , OBSERVE_DidChangeItem = 0x02 - , OBSERVE_DidRemoveItem = 0x04 - , OBSERVE_DidSendAction = 0x08 - , OBSERVE_WillSendAction = 0x10 - }; - virtual void Cocoa_dealloc() {} - virtual void CocoaNotification_menuDidAddItem(WX_NSNotification WXUNUSED(notification)) {} - virtual void CocoaNotification_menuDidChangeItem(WX_NSNotification WXUNUSED(notification)) {} - virtual void CocoaNotification_menuDidRemoveItem(WX_NSNotification WXUNUSED(notification)) {} - virtual void CocoaNotification_menuDidSendAction(WX_NSNotification WXUNUSED(notification)) {} - virtual void CocoaNotification_menuWillSendAction(WX_NSNotification WXUNUSED(notification)) {} - virtual ~wxCocoaNSMenu() { } - -protected: - static struct objc_object *sm_cocoaObserver; -}; - -#endif // _WX_COCOA_NSMENU_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSPanel.h b/Externals/wxWidgets3/include/wx/cocoa/NSPanel.h deleted file mode 100644 index 25acf54c42..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSPanel.h +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSPanel.h -// Purpose: wxCocoaNSPanel class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSPANEL_H__ -#define __WX_COCOA_NSPANEL_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSPanel); - -class wxCocoaNSPanel -{ - WX_DECLARE_OBJC_INTERFACE(NSPanel) -}; - -#endif // _WX_COCOA_NSPANEL_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSScroller.h b/Externals/wxWidgets3/include/wx/cocoa/NSScroller.h deleted file mode 100644 index 3cafc5815a..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSScroller.h +++ /dev/null @@ -1,40 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSScroller.h -// Purpose: wxCocoaNSScroller class -// Author: David Elliott -// Modified by: -// Created: 2004/04/27 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_NSSCROLLER_H__ -#define _WX_COCOA_NSSCROLLER_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" -#include "wx/cocoa/ObjcRef.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSScroller); - -WX_DECLARE_OBJC_HASHMAP(NSScroller); - -class wxCocoaNSScroller -{ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSScroller); -public: - void AssociateNSScroller(WX_NSScroller cocoaNSScroller); - void DisassociateNSScroller(WX_NSScroller cocoaNSScroller) - { - if(cocoaNSScroller) - sm_cocoaHash.erase(cocoaNSScroller); - } - - virtual void Cocoa_wxNSScrollerAction(void) = 0; - virtual ~wxCocoaNSScroller() { } - -protected: - static const wxObjcAutoRefFromAlloc sm_cocoaTarget; -}; - -#endif // _WX_COCOA_NSSCROLLER_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSSlider.h b/Externals/wxWidgets3/include/wx/cocoa/NSSlider.h deleted file mode 100644 index 0f278984ee..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSSlider.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSSlider.h -// Purpose: wxCocoaNSSlider class -// Author: Mark Oxenham -// Modified by: David Elliott -// Created: 2007/08/10 -// Copyright: (c) 2007 Software 2000 Ltd. All rights reserved. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WXNSSLIDER_H_ -#define _WXNSSLIDER_H_ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" -#include "wx/cocoa/ObjcRef.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSSlider); - -WX_DECLARE_OBJC_HASHMAP(NSSlider); - -// For when we're not in Objective-C mode: -typedef struct objc_selector *SEL; - -class wxCocoaNSSliderLastSelectorChanger; - -class wxCocoaNSSlider -{ - friend class wxCocoaNSSliderLastSelectorChanger; - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSSlider); -public: - void AssociateNSSlider(WX_NSSlider cocoaNSSlider); - void DisassociateNSSlider(WX_NSSlider cocoaNSSlider); - - virtual void CocoaNotification_startTracking(WX_NSNotification notification) = 0; - virtual void CocoaNotification_continueTracking(WX_NSNotification notification) = 0; - virtual void CocoaNotification_stopTracking(WX_NSNotification notification) = 0; - - static SEL GetLastResponderSelector() - { return sm_lastResponderSelector; } -protected: - virtual ~wxCocoaNSSlider() { } - static SEL sm_lastResponderSelector; -}; - -#endif diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSTabView.h b/Externals/wxWidgets3/include/wx/cocoa/NSTabView.h deleted file mode 100644 index 8c4320d0ae..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSTabView.h +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSTabView.h -// Purpose: wxCocoaNSTabView class -// Author: David Elliott -// Modified by: -// Created: 2004/04/08 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_NSTABVIEW_H__ -#define _WX_COCOA_NSTABVIEW_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" -#include "wx/cocoa/ObjcRef.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSTabView); -DECLARE_WXCOCOA_OBJC_CLASS(NSTabViewItem); -WX_DECLARE_OBJC_HASHMAP(NSTabView); -class wxCocoaNSTabView -{ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSTabView) -public: - void AssociateNSTabView(WX_NSTabView cocoaNSTabView); - void DisassociateNSTabView(WX_NSTabView ocoaNSTabView); - virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem) = 0; - virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem) = 0; - virtual ~wxCocoaNSTabView() { } - -protected: - static wxObjcAutoRefFromAlloc sm_cocoaDelegate; -}; - -#endif // _WX_COCOA_NSTABVIEW_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSTableDataSource.h b/Externals/wxWidgets3/include/wx/cocoa/NSTableDataSource.h deleted file mode 100644 index 39e96a8343..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSTableDataSource.h +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSTableDataSource.h -// Purpose: wxCocoaNSTableDataSource Objective-C class -// Author: David Elliott -// Modified by: -// Created: 2003/08/05 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSTABLEDATASOURCE_H__ -#define __WX_COCOA_NSTABLEDATASOURCE_H__ - -#include "wx/cocoa/objc/objc_uniquifying.h" - -#import - -// ============================================================================ -// @class wxCocoaNSTableDataSource -// ============================================================================ -@interface wxCocoaNSTableDataSource : NSObject -{ -} - -// NSTableDataSource is a loosely defined protocol consisting of the -// following two message implementations -- (int)numberOfRowsInTableView: (NSTableView *)tableView; -- (id)tableView:(NSTableView *)tableView - objectValueForTableColumn: (NSTableColumn *)tableColumn - row: (int)rowIndex; -@end // wxCocoaNSTableDataSource -WX_DECLARE_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject) - -#endif // _WX_COCOA_NSTABLEDATASOURCE_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSTableView.h b/Externals/wxWidgets3/include/wx/cocoa/NSTableView.h deleted file mode 100644 index 749a844d03..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSTableView.h +++ /dev/null @@ -1,29 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSTableView.h -// Purpose: wxCocoaNSTableView class -// Author: David Elliott -// Modified by: -// Created: 2003/08/05 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSTABLEVIEW_H__ -#define __WX_COCOA_NSTABLEVIEW_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSTableView); - -class wxCocoaNSTableView -{ - WX_DECLARE_OBJC_INTERFACE(NSTableView) -public: - virtual int CocoaDataSource_numberOfRows() = 0; - virtual struct objc_object* CocoaDataSource_objectForTableColumn( - WX_NSTableColumn tableColumn, int rowIndex) = 0; - virtual ~wxCocoaNSTableView() { } -}; - -#endif // _WX_COCOA_NSTABLEVIEW_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSTextField.h b/Externals/wxWidgets3/include/wx/cocoa/NSTextField.h deleted file mode 100644 index 5632318677..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSTextField.h +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSTextField.h -// Purpose: wxCocoaNSTextField class -// Author: David Elliott -// Modified by: -// Created: 2002/12/09 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSTEXTFIELD_H__ -#define __WX_COCOA_NSTEXTFIELD_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSTextField); -class wxCocoaNSTextField -{ - WX_DECLARE_OBJC_INTERFACE(NSTextField) -protected: - virtual void Cocoa_didChangeText(void) = 0; - virtual ~wxCocoaNSTextField() { } -}; - -#endif // _WX_COCOA_NSTEXTFIELD_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSView.h b/Externals/wxWidgets3/include/wx/cocoa/NSView.h deleted file mode 100644 index 3095fb1738..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSView.h +++ /dev/null @@ -1,80 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSView.h -// Purpose: wxCocoaNSView class -// Author: David Elliott -// Modified by: -// Created: 2003/02/15 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSVIEW_H__ -#define __WX_COCOA_NSVIEW_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef struct CGRect NSRect; -#else -typedef struct _NSRect NSRect; -#endif - -struct objc_object; - -class wxWindow; - -WX_DECLARE_OBJC_HASHMAP(NSView); -class wxCocoaNSView -{ -/* NSView is a rather special case and requires some extra attention */ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSView) -public: - void AssociateNSView(WX_NSView cocoaNSView); - void DisassociateNSView(WX_NSView cocoaNSView); -protected: - static struct objc_object *sm_cocoaObserver; -public: - virtual wxWindow* GetWxWindow() const - { return NULL; } - virtual void Cocoa_FrameChanged(void) = 0; - virtual void Cocoa_synthesizeMouseMoved(void) = 0; - virtual bool Cocoa_acceptsFirstMouse(bool &WXUNUSED(acceptsFirstMouse), WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_drawRect(const NSRect &WXUNUSED(rect)) - { return false; } - virtual bool Cocoa_mouseDown(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_mouseDragged(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_mouseUp(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_mouseMoved(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_mouseEntered(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_mouseExited(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_rightMouseDown(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_rightMouseDragged(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_rightMouseUp(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_otherMouseDown(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_otherMouseDragged(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_otherMouseUp(WX_NSEvent WXUNUSED(theEvent)) - { return false; } - virtual bool Cocoa_resetCursorRects() - { return false; } - virtual bool Cocoa_viewDidMoveToWindow() - { return false; } - virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow WXUNUSED(newWindow)) - { return false; } - virtual ~wxCocoaNSView() { } -}; - -#endif - // __WX_COCOA_NSVIEW_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/NSWindow.h b/Externals/wxWidgets3/include/wx/cocoa/NSWindow.h deleted file mode 100644 index 228ffe3ed0..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/NSWindow.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/NSWindow.h -// Purpose: wxCocoaNSWindow class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_NSWINDOW_H__ -#define __WX_COCOA_NSWINDOW_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -WX_DECLARE_OBJC_HASHMAP(NSWindow); - -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowCocoa; - -DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); -DECLARE_WXCOCOA_OBJC_CLASS(wxNSWindowDelegate); - -class WXDLLIMPEXP_CORE wxCocoaNSWindow -{ -/* NSWindow is a rather special case and requires some extra attention */ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSWindow) -public: - void AssociateNSWindow(WX_NSWindow cocoaNSWindow); - void DisassociateNSWindow(WX_NSWindow cocoaNSWindow); - virtual bool Cocoa_canBecomeKeyWindow(bool &WXUNUSED(canBecome)) - { return false; } - virtual bool Cocoa_canBecomeMainWindow(bool &WXUNUSED(canBecome)) - { return false; } - virtual bool CocoaDelegate_windowShouldClose(void) = 0; - virtual void CocoaDelegate_windowWillClose(void) = 0; - virtual void CocoaDelegate_windowDidBecomeKey(void) { } - virtual void CocoaDelegate_windowDidResignKey(void) { } - virtual void CocoaDelegate_windowDidBecomeMain(void) { } - virtual void CocoaDelegate_windowDidResignMain(void) { } - virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem) = 0; - virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem) = 0; - virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); - inline wxTopLevelWindowCocoa* GetWxTopLevelWindowCocoa() - { return m_wxTopLevelWindowCocoa; } -protected: - wxCocoaNSWindow(wxTopLevelWindowCocoa *tlw = NULL); - virtual ~wxCocoaNSWindow(); - WX_wxNSWindowDelegate m_cocoaDelegate; - wxTopLevelWindowCocoa *m_wxTopLevelWindowCocoa; -}; - -#endif // _WX_COCOA_NSWINDOW_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/ObjcAssociate.h b/Externals/wxWidgets3/include/wx/cocoa/ObjcAssociate.h deleted file mode 100644 index a6bf6e2ce4..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/ObjcAssociate.h +++ /dev/null @@ -1,77 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/ObjcAssociate.h -// Purpose: Associates an Objective-C class with a C++ class -// Author: David Elliott -// Modified by: -// Created: 2002/12/03 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_OBJC_ASSOCIATE_H__ -#define __WX_COCOA_OBJC_ASSOCIATE_H__ - -/*------------------------------------------------------------------------- -Basic hashmap stuff, used by everything --------------------------------------------------------------------------*/ -#define WX_DECLARE_OBJC_HASHMAP(ObjcClass) \ -class wxCocoa##ObjcClass; \ -WX_DECLARE_HASH_MAP(WX_##ObjcClass,wxCocoa##ObjcClass*,wxPointerHash,wxPointerEqual,wxCocoa##ObjcClass##Hash) - -#define WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -public: \ - static inline wxCocoa##ObjcClass* GetFromCocoa(WX_##ObjcClass cocoaObjcClass) \ - { \ - wxCocoa##ObjcClass##Hash::iterator iter = sm_cocoaHash.find(cocoaObjcClass); \ - if(iter!=sm_cocoaHash.end()) \ - { \ - return iter->second; \ - } \ - return NULL; \ - } \ -protected: \ - static wxCocoa##ObjcClass##Hash sm_cocoaHash; - -#define WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -wxCocoa##ObjcClass##Hash wxCocoa##ObjcClass::sm_cocoaHash; - - -/*------------------------------------------------------------------------- -The entire interface, including some boilerplate stuff --------------------------------------------------------------------------*/ -#define WX_DECLARE_OBJC_INTERFACE(ObjcClass) \ -WX_DECLARE_OBJC_INTERFACE_HASHMAP(ObjcClass) \ -public: \ - inline void Associate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ - { \ - if(cocoaObjcClass) \ - sm_cocoaHash.insert(wxCocoa##ObjcClass##Hash::value_type(cocoaObjcClass,this)); \ - } \ - inline void Disassociate##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ - { \ - if(cocoaObjcClass) \ - sm_cocoaHash.erase(cocoaObjcClass); \ - } - -#define WX_IMPLEMENT_OBJC_INTERFACE(ObjcClass) \ -WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(ObjcClass) - -/*------------------------------------------------------------------------- -Stuff to be used by the wxWidgets class (not the Cocoa interface) --------------------------------------------------------------------------*/ -#define WX_DECLARE_COCOA_OWNER(ObjcClass,ObjcBase,ObjcRoot) \ -public: \ - inline WX_##ObjcClass Get##ObjcClass() { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \ - inline const WX_##ObjcClass Get##ObjcClass() const { return (WX_##ObjcClass)m_cocoa##ObjcRoot; } \ -protected: \ - void Set##ObjcClass(WX_##ObjcClass cocoaObjcClass); - -#define WX_IMPLEMENT_COCOA_OWNER(wxClass,ObjcClass,ObjcBase,ObjcRoot) \ -void wxClass::Set##ObjcClass(WX_##ObjcClass cocoaObjcClass) \ -{ \ - Disassociate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ - Set##ObjcBase(cocoaObjcClass); \ - Associate##ObjcClass((WX_##ObjcClass)m_cocoa##ObjcRoot); \ -} - -#endif // __WX_COCOA_OBJC_ASSOCIATE_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/ObjcRef.h b/Externals/wxWidgets3/include/wx/cocoa/ObjcRef.h deleted file mode 100644 index d4aa6d91ec..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/ObjcRef.h +++ /dev/null @@ -1,235 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/ObjcRef.h -// Purpose: wxObjcAutoRef template class -// Author: David Elliott -// Modified by: -// Created: 2004/03/28 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_OBJCREF_H__ -#define _WX_COCOA_OBJCREF_H__ - -// Reuse wxCFRef-related code (e.g. wxCFRetain/wxCFRelease) -#include "wx/osx/core/cfref.h" - -// NOTE WELL: We can only know whether or not GC can be used when compiling Objective-C. -// Therefore we cannot implement these functions except when compiling Objective-C. -#ifdef __OBJC__ -/*! @function wxGCSafeRetain - @templatefield Type (implicit) An Objective-C class type - @arg r Pointer to Objective-C object. May be null. - @abstract Retains the Objective-C object, even when using Apple's garbage collector - @discussion - When Apple's garbage collector is enabled, the usual [obj retain] and [obj release] messages - are ignored. Instead the collector with help from compiler-generated write-barriers tracks - reachable objects. The write-barriers are generated when setting i-vars of C++ classes but - they are ignored by the garbage collector unless the C++ object is in GC-managed memory. - - The simple solution is to use CFRetain on the Objective-C object which has been enhanced in - GC mode to forcibly retain the object. In Retain/Release (RR) mode the CFRetain function has - the same effect as [obj retain]. Note that GC vs. RR is selected at runtime. - - Take care that wxGCSafeRetain must be balanced with wxGCSafeRelease and that conversely - wxGCSafeRelease must only be called on objects to balance wxGCSafeRetain. In particular when - receiving an Objective-C object from an alloc or copy method take care that you must retain - it with wxGCSafeRetain and balance the initial alloc with a standard release. - - Example: - wxGCSafeRelease(m_obj); // release current object (if any) - NSObject *obj = [[NSObject alloc] init]; - m_obj = wxGCSafeRetain(obj); - [obj release]; - - Alternatively (same effect, perhaps less clear): - wxGCSafeRelease(m_obj); // release current object (if any) - m_obj = wxGCSafeRetain([[NSObject alloc] init]); - [m_obj release]; // balance alloc - - Consider the effect on the retain count from each statement (alloc, CFRetain, release) - In RR mode: retainCount = 1, +1, -1 - In GC mode: strongRetainCount = 0, +1, -0 - - This is a template function to ensure it is used on raw pointers and never on pointer-holder - objects via implicit conversion operators. -*/ -template -inline Type * wxGCSafeRetain(Type *r) -{ -#ifdef __OBJC_GC__ - return static_cast(wxCFRetain(r)); -#else - return [r retain]; -#endif -} - -/*! @function wxGCSafeRelease - @templatefield Type (implicit) An Objective-C class type - @arg r Pointer to Objective-C object. May be null. - @abstract Balances wxGCSafeRetain. Particularly useful with the Apple Garbage Collector. - @discussion - See the wxGCSafeRetain documentation for more details. - - Example (from wxGCSafeRetain documentation): - wxGCSafeRelease(m_obj); // release current object (if any) - m_obj = wxGCSafeRetain([[NSObject alloc] init]); - [m_obj release]; // balance alloc - - When viewed from the start, m_obj ought to start as nil. However, the second time through - the wxGCSafeRelease call becomes critical as it releases the retain from the first time - through. - - In the destructor for this C++ object with the m_obj i-var you ought to do the following: - wxGCSafeRelease(m_obj); - m_obj = nil; // Not strictly needed, but safer. - - Under no circumstances should you balance an alloc or copy with a wxGCSafeRelease. -*/ -template -inline void wxGCSafeRelease(Type *r) -{ -#ifdef __OBJC_GC__ - wxCFRelease(r); -#else - [r release]; -#endif -} -#else -// NOTE: When not compiling Objective-C, declare these functions such that they can be -// used by other inline-implemented methods. Since those methods in turn will not actually -// be used from non-ObjC code the compiler ought not emit them. If it emits an out of -// line copy of those methods then presumably it will have also emitted at least one -// out of line copy of these functions from at least one Objective-C++ translation unit. -// That means the out of line implementation will be available at link time. - -template -inline Type * wxGCSafeRetain(Type *r); - -template -inline void wxGCSafeRelease(Type *r); - -#endif //def __OBJC__ - -/* -wxObjcAutoRefFromAlloc: construct a reference to an object that was -[NSObject -alloc]'ed and thus does not need a retain -wxObjcAutoRef: construct a reference to an object that was -either autoreleased or is retained by something else. -*/ - -struct objc_object; - -// We must do any calls to Objective-C from an Objective-C++ source file -class wxObjcAutoRefBase -{ -protected: - /*! @function ObjcRetain - @abstract Simply does [p retain]. - */ - static struct objc_object* ObjcRetain(struct objc_object*); - - /*! @function ObjcRelease - @abstract Simply does [p release]. - */ - static void ObjcRelease(struct objc_object*); -}; - -/*! @class wxObjcAutoRefFromAlloc - @templatefield T The type of _pointer_ (e.g. NSString*, NSRunLoop*) - @abstract Pointer-holder for Objective-C objects - @discussion - When constructing this object from a raw pointer, the pointer is assumed to have - come from an alloc-style method. That is, once you construct this object from - the pointer you must not balance your alloc with a call to release. - - This class has been carefully designed to work with both the traditional Retain/Release - and the new Garbage Collected modes. In RR-mode it will prevent the object from being - released by managing the reference count using the retain/release semantics. In GC-mode - it will use a method (currently CFRetain/CFRelease) to ensure the object will never be - finalized until this object is destroyed. - */ - -template -class wxObjcAutoRefFromAlloc: wxObjcAutoRefBase -{ -public: - wxObjcAutoRefFromAlloc(T p = 0) - : m_ptr(p) - // NOTE: this is from alloc. Do NOT retain - { - // CFRetain - // GC: Object is strongly retained and prevented from being collected - // non-GC: Simply realizes it's an Objective-C object and calls [p retain] - wxGCSafeRetain(p); - // ObjcRelease (e.g. [p release]) - // GC: Objective-C retain/release mean nothing in GC mode - // non-GC: This is a normal release call, balancing the retain - ObjcRelease(static_cast(p)); - // The overall result: - // GC: Object is strongly retained - // non-GC: Retain count is the same as it was (retain then release) - } - wxObjcAutoRefFromAlloc(const wxObjcAutoRefFromAlloc& otherRef) - : m_ptr(otherRef.m_ptr) - { wxGCSafeRetain(m_ptr); } - ~wxObjcAutoRefFromAlloc() - { wxGCSafeRelease(m_ptr); } - wxObjcAutoRefFromAlloc& operator=(const wxObjcAutoRefFromAlloc& otherRef) - { wxGCSafeRetain(otherRef.m_ptr); - wxGCSafeRelease(m_ptr); - m_ptr = otherRef.m_ptr; - return *this; - } - operator T() const - { return static_cast(m_ptr); } - T operator->() const - { return static_cast(m_ptr); } -protected: - /*! @field m_ptr The pointer to the Objective-C object - @discussion - The pointer to the Objective-C object is typed as void* to avoid compiler-generated write - barriers as would be used for implicitly __strong object pointers and to avoid the similar - read barriers as would be used for an explicitly __weak object pointer. The write barriers - are useless unless this object is located in GC-managed heap which is highly unlikely. - - Since we guarantee strong reference via CFRetain/CFRelease the write-barriers are not needed - at all, even if this object does happen to be allocated in GC-managed heap. - */ - void *m_ptr; -}; - -/*! - @class wxObjcAutoRef - @description - A pointer holder that does retain its argument. - NOTE: It is suggest that you instead use wxObjcAutoRefFromAlloc foo([aRawPointer retain]) - */ -template -class wxObjcAutoRef: public wxObjcAutoRefFromAlloc -{ -public: - /*! @method wxObjcAutoRef - @description - Uses the underlying wxObjcAutoRefFromAlloc and simply does a typical [p retain] such that - in RR-mode the object is in effectively the same retain-count state as it would have been - coming straight from an alloc method. - */ - wxObjcAutoRef(T p = 0) - : wxObjcAutoRefFromAlloc(p) - { // NOTE: ObjcRetain is correct because in GC-mode it balances ObjcRelease in our superclass constructor - // In RR mode it does retain and the superclass does retain/release thus resulting in an overall retain. - ObjcRetain(static_cast(wxObjcAutoRefFromAlloc::m_ptr)); - } - ~wxObjcAutoRef() {} - wxObjcAutoRef(const wxObjcAutoRef& otherRef) - : wxObjcAutoRefFromAlloc(otherRef) - {} - wxObjcAutoRef(const wxObjcAutoRefFromAlloc& otherRef) - : wxObjcAutoRefFromAlloc(otherRef) - {} - wxObjcAutoRef& operator=(const wxObjcAutoRef& otherRef) - { return wxObjcAutoRefFromAlloc::operator=(otherRef); } -}; - -#endif //ndef _WX_COCOA_OBJCREF_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/app.h b/Externals/wxWidgets3/include/wx/cocoa/app.h deleted file mode 100644 index dffb0cae63..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/app.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/app.h -// Purpose: wxApp class -// Author: David Elliott -// Modified by: -// Created: 2002/11/27 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_APP_H_ -#define _WX_COCOA_APP_H_ - -typedef struct __CFRunLoopObserver * CFRunLoopObserverRef; -typedef const struct __CFString * CFStringRef; - -#include "wx/osx/core/cfref.h" - -// ======================================================================== -// wxApp -// ======================================================================== -// Represents the application. Derive OnInit and declare -// a new App object to start application -class WXDLLIMPEXP_CORE wxApp: public wxAppBase -{ - DECLARE_DYNAMIC_CLASS(wxApp) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxApp(); - virtual ~wxApp(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - inline WX_NSApplication GetNSApplication() { return m_cocoaApp; } - virtual void CocoaDelegate_applicationWillBecomeActive(); - virtual void CocoaDelegate_applicationDidBecomeActive(); - virtual void CocoaDelegate_applicationWillResignActive(); - virtual void CocoaDelegate_applicationDidResignActive(); - virtual void CocoaDelegate_applicationWillUpdate(); - virtual void CF_ObserveMainRunLoopBeforeWaiting(CFRunLoopObserverRef observer, int activity); -protected: - WX_NSApplication m_cocoaApp; - struct objc_object *m_cocoaAppDelegate; - WX_NSThread m_cocoaMainThread; - wxCFRef m_cfRunLoopIdleObserver; - wxCFRef m_cfObservedRunLoopMode; - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // Implement wxAppBase pure virtuals - virtual void Exit(); - - virtual void WakeUpIdle(); - - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); - virtual bool CallOnInit(); - - - virtual bool OnInit(); - virtual bool OnInitGui(); - - // Set true _before_ initializing wx to force embedded mode (no app delegate, etc.) - static bool sm_isEmbedded; -}; - -#endif // _WX_COCOA_APP_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/autorelease.h b/Externals/wxWidgets3/include/wx/cocoa/autorelease.h deleted file mode 100644 index cd5f6b3e26..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/autorelease.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/autorelease.h -// Purpose: Automatic NSAutoreleasePool functionality -// Author: David Elliott -// Modified by: -// Created: 2003/07/11 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_AUTORELEASE_H__ -#define __WX_COCOA_AUTORELEASE_H__ - -#import - -class wxAutoNSAutoreleasePool -{ -public: - wxAutoNSAutoreleasePool() - { - m_pool = [[NSAutoreleasePool alloc] init]; - } - ~wxAutoNSAutoreleasePool() - { - [m_pool release]; - } -protected: - NSAutoreleasePool *m_pool; -}; - -#endif //__WX_COCOA_AUTORELEASE_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/bitmap.h b/Externals/wxWidgets3/include/wx/cocoa/bitmap.h deleted file mode 100644 index 392b50b5b9..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/bitmap.h +++ /dev/null @@ -1,164 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/bitmap.h -// Purpose: wxBitmap class -// Author: David Elliott -// Modified by: -// Created: 2003/07/19 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_BITMAP_H__ -#define __WX_COCOA_BITMAP_H__ - -#include "wx/palette.h" - -// Bitmap -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; - -// ======================================================================== -// wxMask -// ======================================================================== - -// A mask is a 1-bit alpha bitmap used for drawing bitmaps transparently. -class WXDLLIMPEXP_CORE wxMask: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxMask) -public: - wxMask(); - - // Construct a mask from a bitmap and a colour indicating - // the transparent area - wxMask(const wxBitmap& bitmap, const wxColour& colour); - - // Construct a mask from a bitmap and a palette index indicating - // the transparent area - wxMask(const wxBitmap& bitmap, int paletteIndex); - - // Construct a mask from a mono bitmap (copies the bitmap). - wxMask(const wxBitmap& bitmap); - - // Copy constructor - wxMask(const wxMask& src); - - virtual ~wxMask(); - - bool Create(const wxBitmap& bitmap, const wxColour& colour); - bool Create(const wxBitmap& bitmap, int paletteIndex); - bool Create(const wxBitmap& bitmap); - - // wxCocoa - inline WX_NSBitmapImageRep GetNSBitmapImageRep() - { return m_cocoaNSBitmapImageRep; } -protected: - WX_NSBitmapImageRep m_cocoaNSBitmapImageRep; -}; - - -// ======================================================================== -// wxBitmap -// ======================================================================== - -class WXDLLIMPEXP_CORE wxBitmap: public wxGDIObject, - public wxBitmapHelpers -{ -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - // Platform-specific default constructor - wxBitmap(); - // Initialize with raw data. - wxBitmap(const char bits[], int width, int height, int depth = 1); - // Initialize with XPM data - wxBitmap(const char* const* bits); - // Load a file or resource - wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - // Construct from Cocoa's NSImage - wxBitmap(NSImage* cocoaNSImage); - // Construct from Cocoa's NSBitmapImageRep - wxBitmap(NSBitmapImageRep* cocoaNSBitmapImageRep); - // Constructor for generalised creation from data - wxBitmap(const void* data, wxBitmapType type, int width, int height, int depth = 1); - // If depth is omitted, will create a bitmap compatible with the display - wxBitmap(int width, int height, int depth = -1) - { (void)Create(width, height, depth); } - wxBitmap(const wxSize& sz, int depth = -1) - { (void)Create(sz, depth); } - // Convert from wxImage: - wxBitmap(const wxImage& image, int depth = -1) - { CreateFromImage(image, depth); } - // Convert from wxIcon - wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - - // destructor - virtual ~wxBitmap(); - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // Initialize from wxImage - bool CreateFromImage(const wxImage& image, int depth=-1); - - virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); - virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) - { return Create(sz.GetWidth(), sz.GetHeight(), depth); } - - bool Create(NSImage* cocoaNSImage); - bool Create(NSBitmapImageRep* cocoaNSBitmapImageRep); - virtual bool Create(const void* data, wxBitmapType type, int width, int height, int depth = 1); - virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; - - // copies the contents and mask of the given (colour) icon to the bitmap - virtual bool CopyFromIcon(const wxIcon& icon); - - wxImage ConvertToImage() const; - - // get the given part of bitmap - wxBitmap GetSubBitmap( const wxRect& rect ) const; - - int GetWidth() const; - int GetHeight() const; - int GetDepth() const; - int GetQuality() const; - void SetWidth(int w); - void SetHeight(int h); - void SetDepth(int d); - void SetQuality(int q); - void SetOk(bool isOk); - - // raw bitmap access support functions - void *GetRawData(wxPixelDataBase& data, int bpp); - void UngetRawData(wxPixelDataBase& data); - - wxPalette* GetPalette() const; - void SetPalette(const wxPalette& palette); - - wxMask *GetMask() const; - void SetMask(wxMask *mask) ; - - wxBitmapType GetBitmapType() const; - - // wxCocoa - WX_NSBitmapImageRep GetNSBitmapImageRep(); - void SetNSBitmapImageRep(WX_NSBitmapImageRep bitmapImageRep); - WX_NSImage GetNSImage(bool useMask) const; - - static void InitStandardHandlers() { } - static void CleanUpHandlers() { } - -protected: - wxGDIRefData *CreateGDIRefData() const; - wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - - DECLARE_DYNAMIC_CLASS(wxBitmap) -}; - - -#endif // __WX_COCOA_BITMAP_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/bmpbuttn.h b/Externals/wxWidgets3/include/wx/cocoa/bmpbuttn.h deleted file mode 100644 index 10a1394872..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/bmpbuttn.h +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/bmpbuttn.h -// Purpose: wxBitmapButton class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_BMPBUTTN_H__ -#define __WX_COCOA_BMPBUTTN_H__ - -#include "wx/cocoa/NSButton.h" - -// ======================================================================== -// wxBitmapButton -// ======================================================================== -class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase -{ - DECLARE_DYNAMIC_CLASS(wxBitmapButton) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxBitmapButton() { } - wxBitmapButton(wxWindow *parent, wxWindowID winid, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, winid, bitmap, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - virtual ~wxBitmapButton(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_wxNSButtonAction(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // The wxButton::DoGetBestSize is not correct for bitmap buttons - wxSize DoGetBestSize() const - { return wxButtonBase::DoGetBestSize(); } -}; - -#endif // __WX_COCOA_BMPBUTTN_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/brush.h b/Externals/wxWidgets3/include/wx/cocoa/brush.h deleted file mode 100644 index d67294beac..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/brush.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/brush.h -// Purpose: wxBrush class -// Author: David Elliott -// Modified by: -// Created: 2003/07/03 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_BRUSH_H__ -#define __WX_COCOA_BRUSH_H__ - -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" -#include "wx/bitmap.h" - -class WXDLLIMPEXP_FWD_CORE wxBrush; - -// ======================================================================== -// wxBrush -// ======================================================================== -class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase -{ - DECLARE_DYNAMIC_CLASS(wxBrush) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxBrush(); - wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); -#endif - wxBrush(const wxBitmap& stipple); - virtual ~wxBrush(); - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ - virtual void SetColour(const wxColour& col) ; - virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; - virtual void SetStyle(wxBrushStyle style) ; - virtual void SetStipple(const wxBitmap& stipple) ; - - // comparison - bool operator == (const wxBrush& brush) const - { return m_refData == brush.m_refData; } - bool operator != (const wxBrush& brush) const - { return m_refData != brush.m_refData; } - - // accessors - wxColour GetColour() const; - virtual wxBrushStyle GetStyle() const; - wxBitmap *GetStipple() const; - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif - - // wxCocoa - WX_NSColor GetNSColor(); - -protected: - wxGDIRefData *CreateGDIRefData() const; - wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; -}; - -#endif // __WX_COCOA_BRUSH_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/button.h b/Externals/wxWidgets3/include/wx/cocoa/button.h deleted file mode 100644 index d58d0fb6bd..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/button.h +++ /dev/null @@ -1,64 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/button.h -// Purpose: wxButton class -// Author: David Elliott -// Modified by: -// Created: 2002/12/29 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_BUTTON_H__ -#define __WX_COCOA_BUTTON_H__ - -#include "wx/cocoa/NSButton.h" - -// ======================================================================== -// wxButton -// ======================================================================== -class WXDLLIMPEXP_CORE wxButton : public wxButtonBase, protected wxCocoaNSButton -{ - DECLARE_DYNAMIC_CLASS(wxButton) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxButton() { } - wxButton(wxWindow *parent, wxWindowID winid, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, winid, label, pos, size, style, validator, name); - } - - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - virtual ~wxButton(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_wxNSButtonAction(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - wxString GetLabel() const; - void SetLabel(const wxString& label); - wxSize DoGetBestSize() const; -}; - -#endif - // __WX_COCOA_BUTTON_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/checkbox.h b/Externals/wxWidgets3/include/wx/cocoa/checkbox.h deleted file mode 100644 index ba811c54e8..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/checkbox.h +++ /dev/null @@ -1,68 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/checkbox.h -// Purpose: wxCheckBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_CHECKBOX_H__ -#define __WX_COCOA_CHECKBOX_H__ - -#include "wx/cocoa/NSButton.h" - -// ======================================================================== -// wxCheckBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxCheckBox: public wxCheckBoxBase , protected wxCocoaNSButton -{ - DECLARE_DYNAMIC_CLASS(wxCheckBox) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxCheckBox() { } - wxCheckBox(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr) - { - Create(parent, winid, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxCheckBoxNameStr); - virtual ~wxCheckBox(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_wxNSButtonAction(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void SetValue(bool); - virtual bool GetValue() const; - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; - -protected: - virtual void DoSet3StateValue(wxCheckBoxState state); - virtual wxCheckBoxState DoGet3StateValue() const; -}; - -#endif // __WX_COCOA_CHECKBOX_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/checklst.h b/Externals/wxWidgets3/include/wx/cocoa/checklst.h deleted file mode 100644 index 8f07894342..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/checklst.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/checklst.h -// Purpose: wxCheckListBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_CHECKLST_H__ -#define __WX_COCOA_CHECKLST_H__ - -//#include "wx/cocoa/NSTableView.h" - -// ======================================================================== -// wxCheckListBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxCheckListBox: public wxCheckListBoxBase //, protected wxCocoaNSTableView -{ - DECLARE_DYNAMIC_CLASS(wxCheckListBox) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxCheckListBox() { } - wxCheckListBox(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, winid, pos, size, n, choices, style, validator, name); - } - wxCheckListBox(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, winid, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - virtual ~wxCheckListBox(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // check list box specific methods - virtual bool IsChecked(unsigned int item) const; - virtual void Check(unsigned int item, bool check = true); -}; - -#endif // __WX_COCOA_CHECKLST_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/chkconf.h b/Externals/wxWidgets3/include/wx/cocoa/chkconf.h deleted file mode 100644 index 77ccadfe68..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/chkconf.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Name: wx/cocoa/chkconf.h - * Purpose: wxCocoa-specific config settings checks - * Author: Vadim Zeitlin - * Created: 2008-09-11 - * Copyright: (c) 2008 Vadim Zeitlin - * Licence: wxWindows licence - */ - -/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ - -#ifndef _WX_COCOA_CHKCONF_H_ -#define _WX_COCOA_CHKCONF_H_ - -/* - wxLogDialog doesn't currently work correctly in wxCocoa. - */ -#undef wxUSE_LOG_DIALOG -#define wxUSE_LOG_DIALOG 0 - -#endif /* _WX_COCOA_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/cocoa/choice.h b/Externals/wxWidgets3/include/wx/cocoa/choice.h deleted file mode 100644 index 7fe2c06e8d..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/choice.h +++ /dev/null @@ -1,100 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/choice.h -// Purpose: wxChoice class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_CHOICE_H__ -#define __WX_COCOA_CHOICE_H__ - -//#include "wx/cocoa/NSPopUpButton.h" -#include "wx/cocoa/NSMenu.h" - -class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; - -// ======================================================================== -// wxChoice -// ======================================================================== -class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase /*, protected wxCocoaNSPopUpButton */, protected wxCocoaNSMenu -{ - DECLARE_DYNAMIC_CLASS(wxChoice) - DECLARE_EVENT_TABLE() -// WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxChoice() { Init(); } - wxChoice(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, winid, pos, size, n, choices, style, validator, name); - } - wxChoice(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Init(); - Create(parent, winid, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - virtual ~wxChoice(); -protected: - void Init(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - void CocoaNotification_menuDidSendAction(WX_NSNotification notification); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void DoClear(); - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int) const; - virtual void SetString(unsigned int pos, const wxString&); - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual int GetSelection() const; - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoDeleteOneItem(unsigned int pos); - virtual void DoSetItemClientData(unsigned int, void*); - virtual void* DoGetItemClientData(unsigned int) const; - virtual void SetSelection(int pos); -protected: - wxSortedArrayString *m_sortedStrings; - wxArrayPtrVoid m_itemsClientData; -}; - -#endif // __WX_COCOA_CHOICE_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/clipbrd.h b/Externals/wxWidgets3/include/wx/cocoa/clipbrd.h deleted file mode 100644 index 8571f8f56d..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/clipbrd.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/clipbrd.h -// Purpose: wxClipboard -// Author: David Elliott -// Modified by: -// Created: 2003/07/23 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_CLIPBRD_H__ -#define __WX_COCOA_CLIPBRD_H__ - -#include "wx/dataobj.h" - -//========================================================================= -// wxClipboard -//========================================================================= -class wxClipboard : public wxClipboardBase -{ - DECLARE_DYNAMIC_CLASS(wxClipboard) -public: - wxClipboard(); - virtual ~wxClipboard(); - - // open the clipboard before SetData() and GetData() - virtual bool Open(); - - // close the clipboard after SetData() and GetData() - virtual void Close(); - - // query whether the clipboard is opened - virtual bool IsOpened() const; - - // set the clipboard data. all other formats will be deleted. - virtual bool SetData( wxDataObject *data ); - - // add to the clipboard data. - virtual bool AddData( wxDataObject *data ); - - // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ); - - // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ); - - // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear(); -}; - -#endif //__WX_COCOA_CLIPBRD_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/colordlg.h b/Externals/wxWidgets3/include/wx/cocoa/colordlg.h deleted file mode 100644 index 8b13789179..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/colordlg.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/colour.h b/Externals/wxWidgets3/include/wx/cocoa/colour.h deleted file mode 100644 index 97593a3e3f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/colour.h +++ /dev/null @@ -1,92 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/colour.h -// Purpose: wxColour class -// Author: David Elliott -// Modified by: -// Created: 2003/06/17 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_COLOUR_H__ -#define __WX_COCOA_COLOUR_H__ - -#include "wx/object.h" -#include "wx/string.h" - -// ======================================================================== -// wxColour -// ======================================================================== - -class WXDLLIMPEXP_CORE wxColour : public wxColourBase -{ -public: - // constructors - // ------------ - DEFINE_STD_WXCOLOUR_CONSTRUCTORS - - // initialization using existing NSColor - wxColour( WX_NSColor aColor ); - - // copy ctors and assignment operators - wxColour( const wxColour& col ); - wxColour& operator = ( const wxColour& col ); - - virtual ~wxColour(); - - // accessors - virtual bool IsOk() const { return m_cocoaNSColor; } - WX_NSColor GetNSColor() { return m_cocoaNSColor; } - WX_NSColor GetNSColor() const { return m_cocoaNSColor; } - - unsigned char Red() const { return m_red; } - unsigned char Green() const { return m_green; } - unsigned char Blue() const { return m_blue; } - unsigned char Alpha() const { return m_alpha; } - - // comparison - bool operator == (const wxColour& colour) const - { - return m_cocoaNSColor == colour.m_cocoaNSColor || - (m_red == colour.m_red && - m_green == colour.m_green && - m_blue == colour.m_blue && - m_alpha == colour.m_alpha); - } - bool operator != (const wxColour& colour) const - { return !(*this == colour); } - - // Set() functions - void Set( WX_NSColor aColor ); - - // reroute the inherited ones - void Set(unsigned char red, - unsigned char green, - unsigned char blue, - unsigned char alpha = wxALPHA_OPAQUE) - { wxColourBase::Set(red, green, blue, alpha); } - - bool Set(const wxString &str) - { return wxColourBase::Set(str); } - - void Set(unsigned long colRGB) - { wxColourBase::Set(colRGB); } - -protected: - // puts the object in an invalid, uninitialized state - void Init(); - - virtual void - InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); - -private: - WX_NSColor m_cocoaNSColor; - unsigned char m_red; - unsigned char m_green; - unsigned char m_blue; - unsigned char m_alpha; - - DECLARE_DYNAMIC_CLASS(wxColour) -}; - -#endif // __WX_COCOA_COLOUR_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/combobox.h b/Externals/wxWidgets3/include/wx/cocoa/combobox.h deleted file mode 100644 index dc09cf216c..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/combobox.h +++ /dev/null @@ -1,157 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/combobox.h -// Purpose: wxComboBox class -// Author: Ryan Norton -// Modified by: -// Created: 2005/02/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_COMBOBOX_H__ -#define __WX_COCOA_COMBOBOX_H__ - -//Begin NSComboBox.h - -#include "wx/hashmap.h" -#include "wx/cocoa/ObjcAssociate.h" - -#include "wx/textctrl.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox); - -WX_DECLARE_OBJC_HASHMAP(NSComboBox); -class wxCocoaNSComboBox -{ - WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox) -public: - void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox); - void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox); - - virtual void doWxEvent(int nEvent) = 0; - virtual ~wxCocoaNSComboBox() { } -}; - -//begin combobox.h - -#include "wx/dynarray.h" - -// ======================================================================== -// wxComboBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase, protected wxCocoaNSComboBox, protected wxCocoaNSTextField -{ - DECLARE_DYNAMIC_CLASS(wxComboBox) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView) - WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxComboBox() { } - wxComboBox(wxWindow *parent, wxWindowID winid, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, winid, value, pos, size, n, choices, style, validator, name); - } - wxComboBox(wxWindow *parent, wxWindowID winid, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr) - { - Create(parent, winid, value, pos, size, choices, style, - validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxComboBoxNameStr); - virtual ~wxComboBox(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - wxArrayPtrVoid m_Datas; - virtual void doWxEvent(int nEvent); - - virtual void Cocoa_didChangeText() - {} -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - void Clear() // HACK - { wxComboBoxBase::Clear(); } - - // wxCombobox methods - virtual void SetSelection(int pos); - // Overlapping methods - virtual wxString GetStringSelection(); - // wxItemContainer - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int) const; - virtual void SetString(unsigned int pos, const wxString&); - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual int GetSelection() const; - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoSetItemClientData(unsigned int, void*); - virtual void* DoGetItemClientData(unsigned int) const; - virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } - -// ------------------------------------------------------------------------ -// wxTextEntryBase virtual implementations: -// ------------------------------------------------------------------------ - // FIXME: This needs to be moved to some sort of common code. - virtual void WriteText(const wxString&); - virtual wxString GetValue() const; - virtual void Remove(long, long); - virtual void Cut(); - virtual void Copy(); - virtual void Paste(); - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - virtual void SetSelection(long from, long to); - virtual void GetSelection(long *from, long *to) const; - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); - -private: - // implement wxTextEntry pure virtual method - virtual wxWindow *GetEditableWindow() { return this; } -}; - -#endif // __WX_COCOA_COMBOBOX_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/control.h b/Externals/wxWidgets3/include/wx/cocoa/control.h deleted file mode 100644 index cb493202a6..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/control.h +++ /dev/null @@ -1,77 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/control.h -// Purpose: wxControl class -// Author: David Elliott -// Modified by: -// Created: 2003/02/15 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_CONTROL_H__ -#define __WX_COCOA_CONTROL_H__ - -#include "wx/cocoa/NSControl.h" - -// ======================================================================== -// wxControl -// ======================================================================== - -class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxCocoaNSControl -{ - DECLARE_ABSTRACT_CLASS(wxControl) - WX_DECLARE_COCOA_OWNER(NSControl,NSView,NSView) - DECLARE_EVENT_TABLE() -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxControl() {} - wxControl(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr); - virtual ~wxControl(); - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - - // implementation from now on - // -------------------------- - - void OnEraseBackground(wxEraseEvent& event); - - virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } - - // Calls the callback and appropriate event handlers - bool ProcessCommand(wxCommandEvent& event); - - // Enables the control - virtual void CocoaSetEnabled(bool enable); -protected: - virtual wxSize DoGetBestSize() const; - - // Provides a common implementation of title setting which strips mnemonics - // and then calls setTitle: with the stripped string. May be implemented - // to call setTitleWithMnemonic: on OpenStep-compatible systems. Only - // intended for use by views or cells which implement at least setTitle: - // and possibly setTitleWithMnemonic: such as NSBox and NSButton or NSCell - // classes, for example as used by wxRadioBox. Not usable with classes like - // NSTextField which expect setStringValue:. - static void CocoaSetLabelForObject(const wxString& labelWithWxMnemonic, struct objc_object *anObject); -}; - -#endif - // __WX_COCOA_CONTROL_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/cursor.h b/Externals/wxWidgets3/include/wx/cocoa/cursor.h deleted file mode 100644 index 54209f0b19..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/cursor.h +++ /dev/null @@ -1,64 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/cursor.h -// Purpose: wxCursor class -// Author: David Elliott -// Modified by: -// Created: 2002/11/27 -// Copyright: (c) David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_CURSOR_H_ -#define _WX_COCOA_CURSOR_H_ - -#include "wx/bitmap.h" - -class WXDLLIMPEXP_CORE wxCursorRefData : public wxGDIRefData -{ -public: - wxCursorRefData(); - virtual ~wxCursorRefData(); - -protected: - int m_width, m_height; - WX_NSCursor m_hCursor; - - friend class WXDLLIMPEXP_FWD_CORE wxBitmap; - friend class WXDLLIMPEXP_FWD_CORE wxCursor; - - wxDECLARE_NO_COPY_CLASS(wxCursorRefData); -}; - -#define M_CURSORDATA ((wxCursorRefData *)m_refData) -#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) - -// Cursor -class WXDLLIMPEXP_CORE wxCursor: public wxBitmap -{ -public: - wxCursor(); - - wxCursor(const wxString& name, wxBitmapType type = wxCURSOR_DEFAULT_TYPE, - int hotSpotX = 0, int hotSpotY = 0); - - wxCursor(wxStockCursor id) { InitFromStock(id); } -#if WXWIN_COMPATIBILITY_2_8 - wxCursor(int id) { InitFromStock((wxStockCursor)id); } -#endif - virtual ~wxCursor(); - - // FIXME: operator==() is wrong! - bool operator==(const wxCursor& cursor) const { return m_refData == cursor.m_refData; } - bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); } - - WX_NSCursor GetNSCursor() const { return M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0; } - -private: - void InitFromStock(wxStockCursor); - DECLARE_DYNAMIC_CLASS(wxCursor) -}; - -extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor); - -#endif - // _WX_COCOA_CURSOR_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dataform.h b/Externals/wxWidgets3/include/wx/cocoa/dataform.h deleted file mode 100644 index 870ddb0470..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dataform.h +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dataform.h -// Purpose: declaration of the wxDataFormat class -// Author: David Elliott -// Modified by: -// Created: 2003/07/23 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DATAFORM_H__ -#define __WX_COCOA_DATAFORM_H__ - -class wxDataFormat -{ -public: - wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; } - wxDataFormat(const wxString& zFormat) { SetId(zFormat); } - - wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); } - wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); } - - // - // Comparison (must have both versions) - // - bool operator==(wxDataFormatId eFormat) const { return (m_uFormat == (unsigned int)eFormat); } - bool operator!=(wxDataFormatId eFormat) const { return (m_uFormat != (unsigned int)eFormat); } - bool operator==(const wxDataFormat& rFormat) const { return (m_uFormat == rFormat.m_uFormat); } - bool operator!=(const wxDataFormat& rFormat) const { return (m_uFormat != rFormat.m_uFormat); } - operator unsigned int(void) const { return m_uFormat; } - - unsigned int GetFormatId(void) const { return (unsigned int)m_uFormat; } - unsigned int GetType(void) const { return (unsigned int)m_uFormat; } - - bool IsStandard(void) const; - - void SetType(unsigned int uType){ m_uFormat = uType; } - - // - // String ids are used for custom types - this SetId() must be used for - // application-specific formats - // - wxString GetId(void) const; - void SetId(const wxString& WXUNUSED(pId)) { /* TODO */ } - -private: - unsigned int m_uFormat; -}; // end of CLASS wxDataFormat - -#endif // __WX_COCOA_DATAFORM_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dataobj.h b/Externals/wxWidgets3/include/wx/cocoa/dataobj.h deleted file mode 100644 index d525029f9c..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dataobj.h +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dataobj.h -// Purpose: declaration of the wxDataObject -// Author: David Elliott -// Modified by: -// Created: 2003/07/23 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DATAOBJ_H__ -#define __WX_COCOA_DATAOBJ_H__ - -class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase -{ -public: - wxDataObject(); - virtual ~wxDataObject(); - virtual bool IsSupportedFormat(const wxDataFormat& format, - Direction dir = Get) const; -}; - -#endif // __WX_COCOA_DATAOBJ_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dc.h b/Externals/wxWidgets3/include/wx/cocoa/dc.h deleted file mode 100644 index 0d4fec2065..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dc.h +++ /dev/null @@ -1,174 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dc.h -// Purpose: wxDC -// Author: David Elliott -// Modified by: -// Created: 2003/04/01 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DC_H__ -#define __WX_COCOA_DC_H__ - -DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform); - -#include "wx/dc.h" - -class WXDLLIMPEXP_FWD_CORE wxCocoaDCImpl; -WX_DECLARE_LIST(wxCocoaDCImpl, wxCocoaDCStack); - -//========================================================================= -// wxDC -//========================================================================= -class WXDLLIMPEXP_CORE wxCocoaDCImpl: public wxDCImpl -{ - DECLARE_ABSTRACT_CLASS(wxCocoaDCImpl) - wxDECLARE_NO_COPY_CLASS(wxCocoaDCImpl); -//------------------------------------------------------------------------- -// Initialization -//------------------------------------------------------------------------- -public: - wxCocoaDCImpl(wxDC *owner); - virtual ~wxCocoaDCImpl(); - -//------------------------------------------------------------------------- -// wxCocoa specifics -//------------------------------------------------------------------------- -public: - static void CocoaInitializeTextSystem(); - static void CocoaShutdownTextSystem(); - static WX_NSTextStorage sm_cocoaNSTextStorage; - static WX_NSLayoutManager sm_cocoaNSLayoutManager; - static WX_NSTextContainer sm_cocoaNSTextContainer; - // Create a simple Wx to Bounds transform (just flip the coordinate system) - static WX_NSAffineTransform CocoaGetWxToBoundsTransform(bool isFlipped, float height); -protected: -// DC stack - static wxCocoaDCStack sm_cocoaDCStack; - virtual bool CocoaLockFocus(); - virtual bool CocoaUnlockFocus(); - bool CocoaUnwindStackAndTakeFocus(); - inline bool CocoaTakeFocus() - { - wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst(); - if(node && (node->GetData() == this)) - return true; - return CocoaUnwindStackAndTakeFocus(); - } - void CocoaUnwindStackAndLoseFocus(); -// DC flipping/transformation - void CocoaApplyTransformations(); - void CocoaUnapplyTransformations(); - WX_NSAffineTransform m_cocoaWxToBoundsTransform; -// Get bounds rect (for Clear()) - // note: we use void * to mean NSRect * so that we can avoid - // putting NSRect in the headers. - virtual bool CocoaGetBounds(void *rectData); -// Blitting - virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask); -//------------------------------------------------------------------------- -// Implementation -//------------------------------------------------------------------------- -public: - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; } - virtual void EndDoc(void) {} - - virtual void StartPage(void) {} - virtual void EndPage(void) {} - - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode) { m_backgroundMode = mode; } - virtual void SetPalette(const wxPalette& palette); - - virtual void DestroyClippingRegion(); - - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; - virtual void DoGetTextExtent(const wxString& string, - wxCoord *x, wxCoord *y, - wxCoord *descent = NULL, - wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(wxMappingMode mode); - virtual void SetUserScale(double x, double y); - - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(wxCoord x, wxCoord y); - virtual void SetDeviceOrigin(wxCoord x, wxCoord y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(wxRasterOperationMode function); - - virtual void SetTextForeground(const wxColour& colour) ; - virtual void SetTextBackground(const wxColour& colour) ; - - virtual void ComputeScaleAndOrigin(); -protected: - virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE); - - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; - - virtual void DoDrawPoint(wxCoord x, wxCoord y); - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - - virtual void DoDrawArc(wxCoord x1, wxCoord y1, - wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); - - virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); - - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - - virtual void DoCrossHair(wxCoord x, wxCoord y); - - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); - - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); - - virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, - wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); - - // this is gnarly - we can't even call this function DoSetClippingRegion() - // because of virtual function hiding - virtual void DoSetDeviceClippingRegion(const wxRegion& region); - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); - - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetSizeMM(int* width, int* height) const; - - virtual void DoDrawLines(int n, const wxPoint points[], - wxCoord xoffset, wxCoord yoffset); - virtual void DoDrawPolygon(int n, const wxPoint points[], - wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); -}; - -#endif // __WX_COCOA_DC_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dcclient.h b/Externals/wxWidgets3/include/wx/cocoa/dcclient.h deleted file mode 100644 index 631c6ffd33..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dcclient.h +++ /dev/null @@ -1,69 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dcclient.h -// Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes -// Author: David Elliott -// Modified by: -// Created: 2003/04/01 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DCCLIENT_H__ -#define __WX_COCOA_DCCLIENT_H__ - -#include "wx/cocoa/dc.h" - -// DFE: A while ago I stumbled upon the fact that retrieving the parent -// NSView of the content view seems to return the entire window rectangle -// (including decorations). Of course, that is not at all part of the -// Cocoa or OpenStep APIs, but it might be a neat hack. -class WXDLLIMPEXP_CORE wxWindowDCImpl: public wxCocoaDCImpl -{ - DECLARE_DYNAMIC_CLASS(wxWindowDCImpl) -public: - wxWindowDCImpl(wxDC *owner); - // Create a DC corresponding to a window - wxWindowDCImpl(wxDC *owner, wxWindow *win); - virtual ~wxWindowDCImpl(void); - -protected: - wxWindow *m_window; - WX_NSView m_lockedNSView; -// DC stack - virtual bool CocoaLockFocus(); - virtual bool CocoaUnlockFocus(); - bool CocoaLockFocusOnNSView(WX_NSView nsview); - bool CocoaUnlockFocusOnNSView(); - virtual bool CocoaGetBounds(void *rectData); -}; - -class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl -{ - DECLARE_DYNAMIC_CLASS(wxClientDCImpl) -public: - wxClientDCImpl(wxDC *owner); - // Create a DC corresponding to a window - wxClientDCImpl(wxDC *owner, wxWindow *win); - virtual ~wxClientDCImpl(void); -protected: -// DC stack - virtual bool CocoaLockFocus(); - virtual bool CocoaUnlockFocus(); -}; - -class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl -{ - DECLARE_DYNAMIC_CLASS(wxPaintDCImpl) -public: - wxPaintDCImpl(wxDC *owner); - // Create a DC corresponding to a window - wxPaintDCImpl(wxDC *owner, wxWindow *win); - virtual ~wxPaintDCImpl(void); -protected: -// DC stack - virtual bool CocoaLockFocus(); - virtual bool CocoaUnlockFocus(); -}; - -#endif - // __WX_COCOA_DCCLIENT_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dcmemory.h b/Externals/wxWidgets3/include/wx/cocoa/dcmemory.h deleted file mode 100644 index 33846293c3..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dcmemory.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dcmemory.h -// Purpose: wxMemoryDCImpl class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DCMEMORY_H__ -#define __WX_COCOA_DCMEMORY_H__ - -#include "wx/cocoa/dc.h" - -#include "wx/dcmemory.h" - -class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxCocoaDCImpl -{ - DECLARE_DYNAMIC_CLASS(wxMemoryDCImpl) - -public: - wxMemoryDCImpl(wxMemoryDC *owner) - : wxCocoaDCImpl(owner) - { Init(); } - wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap) - : wxCocoaDCImpl(owner) - { Init(); - owner->SelectObject(bitmap); - } - wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc ); // Create compatible DC - virtual ~wxMemoryDCImpl(void); - - virtual void DoGetSize(int *width, int *height) const; - virtual void DoSelect(const wxBitmap& bitmap); - -protected: - wxBitmap m_selectedBitmap; - WX_NSImage m_cocoaNSImage; -// DC stack - virtual bool CocoaLockFocus(); - virtual bool CocoaUnlockFocus(); - virtual bool CocoaGetBounds(void *rectData); -// Blitting - virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc, - wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask); - -private: - void Init(); -}; - -#endif - // __WX_COCOA_DCMEMORY_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dcscreen.h b/Externals/wxWidgets3/include/wx/cocoa/dcscreen.h deleted file mode 100644 index af7d4ee54e..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dcscreen.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dcscreen.h -// Purpose: wxScreenDCImpl class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_DCSCREEN_H__ -#define __WX_COCOA_DCSCREEN_H__ - -#include "wx/dcscreen.h" -#include "wx/cocoa/dc.h" - -class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxCocoaDCImpl -{ - DECLARE_DYNAMIC_CLASS(wxScreenDCImpl) -public: - wxScreenDCImpl(wxScreenDC *owner); - wxScreenDCImpl(wxScreenDC *owner, wxDC *dc ); // Create compatible DC - virtual ~wxScreenDCImpl(void); - - // Compatibility with X's requirements for drawing on top of all windows - static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; } - static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; } - static bool EndDrawingOnTop() { return true; } -}; - -#endif // __WX_COCOA_DCSCREEN_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dialog.h b/Externals/wxWidgets3/include/wx/cocoa/dialog.h deleted file mode 100644 index 632df8f1bb..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dialog.h +++ /dev/null @@ -1,94 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dialog.h -// Purpose: wxDialog class -// Author: David Elliott -// Modified by: -// Created: 2002/12/15 -// Copyright: David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_DIALOG_H_ -#define _WX_COCOA_DIALOG_H_ - -#include "wx/defs.h" -// NOTE: we don't need panel.h, but other things expect it to be included -#include "wx/panel.h" -#include "wx/cocoa/NSPanel.h" - -// ======================================================================== -// wxDialog -// ======================================================================== -class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase, protected wxCocoaNSPanel -{ - DECLARE_DYNAMIC_CLASS(wxDialog) - WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxDialog() { Init(); } - -#if WXWIN_COMPATIBILITY_2_6 - // Constructor with a modal flag, but no window id - the old convention - wxDialog(wxWindow *parent, - const wxString& title, bool WXUNUSED(modal), - int x = wxDefaultCoord, int y= wxDefaultCoord, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height), - style, name); - } -#endif // WXWIN_COMPATIBILITY_2_6 - - // Constructor with no modal flag - the new convention. - wxDialog(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - virtual ~wxDialog(); -protected: - void Init(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -protected: - virtual void CocoaDelegate_windowWillClose(void); - virtual bool Cocoa_canBecomeMainWindow(bool &canBecome) - { canBecome = true; return true; } - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual bool Show(bool show = true); - - void SetModal(bool flag); - virtual bool IsModal() const { return m_isModal; } - bool m_isModal; - - // For now, same as Show(true) but returns return code - virtual int ShowModal(); - - // may be called to terminate the dialog with the given return code - virtual void EndModal(int retCode); -}; - -#endif // _WX_COCOA_DIALOG_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dirdlg.h b/Externals/wxWidgets3/include/wx/cocoa/dirdlg.h deleted file mode 100644 index 207f79baac..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/dirdlg.h +++ /dev/null @@ -1,50 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dirdlg.h -// Purpose: wxDirDialog class -// Author: Ryan Norton -// Modified by: Hiroyuki Nakamura(maloninc) -// Created: 2006-01-10 -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_DIRDLG_H_ -#define _WX_COCOA_DIRDLG_H_ - -DECLARE_WXCOCOA_OBJC_CLASS(NSSavePanel); - -#define wxDirDialog wxCocoaDirDialog -//------------------------------------------------------------------------- -// wxDirDialog -//------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxDirDialog: public wxDirDialogBase -{ - DECLARE_DYNAMIC_CLASS(wxDirDialog) - wxDECLARE_NO_COPY_CLASS(wxDirDialog); -public: - wxDirDialog(wxWindow *parent, - const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = wxT(""), - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxDirDialogNameStr); - virtual ~wxDirDialog(); - - virtual int ShowModal(); - - inline WX_NSSavePanel GetNSSavePanel() - { return (WX_NSSavePanel)m_cocoaNSWindow; } - -protected: - wxString m_dir; - wxWindow * m_parent; - wxString m_fileName; - -private: - wxArrayString m_fileNames; -}; - -#endif // _WX_DIRDLG_H_ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/drawer.h b/Externals/wxWidgets3/include/wx/cocoa/drawer.h deleted file mode 100644 index 8b13789179..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/drawer.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/evtloop.h b/Externals/wxWidgets3/include/wx/cocoa/evtloop.h deleted file mode 100644 index 366e46cb1b..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/evtloop.h +++ /dev/null @@ -1,38 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/evtloop.h -// Purpose: declaration of wxGUIEventLoop for wxCocoa -// Author: Vadim Zeitlin -// Created: 2008-12-28 -// Copyright: (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_EVTLOOP_H_ -#define _WX_COCOA_EVTLOOP_H_ - -// ---------------------------------------------------------------------------- -// wxGUIEventLoop for wxCocoa -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase -{ -public: - wxGUIEventLoop() { m_exitcode = 0; } - - virtual void ScheduleExit(int rc = 0); - virtual bool Pending() const; - virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp() { } - virtual bool YieldFor(long eventsToProcess); - -protected: - virtual int DoRun(); - - int m_exitcode; - - wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop); -}; - -#endif // _WX_COCOA_EVTLOOP_H_ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/filedlg.h b/Externals/wxWidgets3/include/wx/cocoa/filedlg.h deleted file mode 100644 index b888be18e7..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/filedlg.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/filedlg.h -// Purpose: wxFileDialog class -// Author: Ryan Norton -// Modified by: -// Created: 2004-10-02 -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_FILEDLG_H_ -#define _WX_COCOA_FILEDLG_H_ - -DECLARE_WXCOCOA_OBJC_CLASS(NSSavePanel); - -#define wxFileDialog wxCocoaFileDialog -//------------------------------------------------------------------------- -// wxFileDialog -//------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase -{ - DECLARE_DYNAMIC_CLASS(wxFileDialog) - wxDECLARE_NO_COPY_CLASS(wxFileDialog); -public: - wxFileDialog(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 void SetPath(const wxString& path); - virtual void GetPaths(wxArrayString& paths) const; - virtual void GetFilenames(wxArrayString& files) const; - - virtual int ShowModal(); - - inline WX_NSSavePanel GetNSSavePanel() - { return (WX_NSSavePanel)m_cocoaNSWindow; } - -private: - WX_NSMutableArray m_wildcards; - wxArrayString m_fileNames; -}; - -#endif // _WX_FILEDLG_H_ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/fontdlg.h b/Externals/wxWidgets3/include/wx/cocoa/fontdlg.h deleted file mode 100644 index 8b13789179..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/fontdlg.h +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/frame.h b/Externals/wxWidgets3/include/wx/cocoa/frame.h deleted file mode 100644 index ebdb56ed34..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/frame.h +++ /dev/null @@ -1,106 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/frame.h -// Purpose: wxFrame class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_FRAME_H_ -#define _WX_COCOA_FRAME_H_ - -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxStatusBar; - -class WXDLLIMPEXP_CORE wxFrame: public wxFrameBase -{ - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxFrame) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxFrame() { Init(); } - wxFrame(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - virtual ~wxFrame(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); -protected: - void Init(); -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); - // Returns the NSView for non-client drawing - virtual WX_NSView GetNonClientNSView(); - - // Helper function to position status/tool bars - // Also called by native toolbar to force a size update - void UpdateFrameNSView(); - - virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem menuItem); - virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem menuItem); -protected: - virtual void CocoaSetWxWindowSize(int width, int height); - - virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); - // frameNSView is used whenever a statusbar/generic toolbar are present - WX_NSView m_frameNSView; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void AttachMenuBar(wxMenuBar *mbar); - virtual void DetachMenuBar(); - virtual void SetMenuBar(wxMenuBar *menubar); - - // implementation only from now on - // ------------------------------- - - // override some more virtuals - - // get the origin of the client area (which may be different from (0, 0) - // if the frame has a toolbar) in client coordinates - virtual wxPoint GetClientAreaOrigin() const; - - // create the main status bar by calling OnCreateStatusBar() - virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxSTB_DEFAULT_STYLE, - wxWindowID winid = 0, - const wxString& name = - wxStatusLineNameStr); - // sets the main status bar - void SetStatusBar(wxStatusBar *statBar); -#if wxUSE_TOOLBAR - // create main toolbar bycalling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // sets the main tool bar - virtual void SetToolBar(wxToolBar *toolbar); -#endif //wxUSE_TOOLBAR -protected: - void PositionStatusBar(); -}; - -#endif // _WX_COCOA_FRAME_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/gauge.h b/Externals/wxWidgets3/include/wx/cocoa/gauge.h deleted file mode 100644 index ffadb1c27b..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/gauge.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/gauge.h -// Purpose: wxGauge class -// Author: David Elliott -// Modified by: -// Created: 2003/07/15 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_GAUGE_H__ -#define __WX_COCOA_GAUGE_H__ - -// #include "wx/cocoa/NSProgressIndicator.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSProgressIndicator); - -// ======================================================================== -// wxGauge -// ======================================================================== -class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase// , protected wxCocoaNSProgressIndicator -{ - DECLARE_DYNAMIC_CLASS(wxGauge) - DECLARE_EVENT_TABLE() -// WX_DECLARE_COCOA_OWNER(NSProgressIndicator,NSView,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxGauge() { } - wxGauge(wxWindow *parent, wxWindowID winid, int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr) - { - Create(parent, winid, range, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, int range, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxGA_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxGaugeNameStr); - virtual ~wxGauge(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -public: - inline WX_NSProgressIndicator GetNSProgressIndicator() const { return (WX_NSProgressIndicator)m_cocoaNSView; } -protected: - // NSProgressIndicator cannot be enabled/disabled - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // Pure Virtuals - virtual int GetValue() const; - virtual void SetValue(int value); - - // retrieve/change the range - virtual void SetRange(int maxValue); - int GetRange(void) const; -protected: - virtual wxSize DoGetBestSize() const; -}; - -#endif - // __WX_COCOA_GAUGE_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/glcanvas.h b/Externals/wxWidgets3/include/wx/cocoa/glcanvas.h deleted file mode 100644 index 927c3e05ee..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/glcanvas.h +++ /dev/null @@ -1,97 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/glcanvas.h -// Purpose: wxGLCanvas class -// Author: David Elliott -// Modified by: -// Created: 2004/09/29 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_GLCANVAS_H__ -#define _WX_COCOA_GLCANVAS_H__ - -#include "wx/window.h" - -// #include "wx/cocoa/NSOpenGLView.h" -// Include gl.h from the OpenGL framework -#include - -class WXDLLIMPEXP_FWD_GL wxGLCanvas; -DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); -DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView); - -// ======================================================================== -// wxGLContext -// ======================================================================== - -class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase -{ -public: - wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); - - virtual ~wxGLContext(); - - virtual void SetCurrent(const wxGLCanvas& win) const; - - WX_NSOpenGLContext GetNSOpenGLContext() const - { return m_cocoaNSOpenGLContext; } - -private: - WX_NSOpenGLContext m_cocoaNSOpenGLContext; -}; - -// ======================================================================== -// wxGLCanvas -// ======================================================================== - -class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase - // , protected wxCocoaNSOpenGLView -{ - DECLARE_DYNAMIC_CLASS(wxGLCanvas) -// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxGLCanvas(wxWindow *parent, - wxWindowID id = wxID_ANY, - const int *attribList = NULL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const wxPalette& palette = wxNullPalette) - { - Create(parent, id, pos, size, style, name, attribList, palette); - } - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const int *attribList = NULL, - const wxPalette& palette = wxNullPalette); - - virtual ~wxGLCanvas(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // NSOpenGLView cannot be enabled/disabled - virtual void CocoaSetEnabled(bool enable) { } -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void SwapBuffers(); - - - NSOpenGLView *GetNSOpenGLView() const - { return (NSOpenGLView *)m_cocoaNSView; } -}; - -#endif //ndef _WX_COCOA_GLCANVAS_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/icon.h b/Externals/wxWidgets3/include/wx/cocoa/icon.h deleted file mode 100644 index ac041ba354..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/icon.h +++ /dev/null @@ -1,63 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/icon.h -// Purpose: wxIcon class -// Author: David Elliott -// Modified by: -// Created: 2003/08/11 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_ICON_H__ -#define _WX_COCOA_ICON_H__ - -#include "wx/gdicmn.h" -#include "wx/gdiobj.h" - -// ======================================================================== -// wxIcon -// ======================================================================== -class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject -{ -public: - wxIcon(); - - wxIcon(const char* const* data) { CreateFromXpm(data); } - wxIcon(const char bits[], int width , int height ); - wxIcon(const wxString& name, int flags = wxICON_DEFAULT_TYPE, - int desiredWidth = -1, int desiredHeight = -1); - wxIcon(const wxIconLocation& loc) - { - LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); - } - virtual ~wxIcon(); - - bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, - int desiredWidth=-1, int desiredHeight=-1); - - bool operator==(const wxIcon& icon) const - { return m_refData == icon.m_refData; } - bool operator!=(const wxIcon& icon) const { return !(*this == icon); } - - // create from bitmap (which should have a mask unless it's monochrome): - // there shouldn't be any implicit bitmap -> icon conversion (i.e. no - // ctors, assignment operators...), but it's ok to have such function - void CopyFromBitmap(const wxBitmap& bmp); - - int GetWidth() const; - int GetHeight() const; - - wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } - - WX_NSImage GetNSImage() const; - bool CreateFromXpm(const char* const* bits); - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxIcon) -}; - -#endif // _WX_COCOA_ICON_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/listbox.h b/Externals/wxWidgets3/include/wx/cocoa/listbox.h deleted file mode 100644 index a9f233aa8a..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/listbox.h +++ /dev/null @@ -1,114 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/listbox.h -// Purpose: wxListBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_LISTBOX_H__ -#define __WX_COCOA_LISTBOX_H__ - -#include "wx/cocoa/NSTableView.h" - -#include "wx/dynarray.h" - -// ======================================================================== -// wxListBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase, protected wxCocoaNSTableView -{ - DECLARE_DYNAMIC_CLASS(wxListBox) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSTableView,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxListBox() { m_cocoaItems = NULL; m_cocoaDataSource = NULL; } - wxListBox(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, winid, pos, size, n, choices, style, validator, name); - } - wxListBox(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, winid, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - virtual ~wxListBox(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual int CocoaDataSource_numberOfRows(); - virtual struct objc_object* CocoaDataSource_objectForTableColumn( - WX_NSTableColumn tableColumn, int rowIndex); - WX_NSMutableArray m_cocoaItems; - wxArrayPtrVoid m_itemClientData; - struct objc_object *m_cocoaDataSource; - bool m_needsUpdate; - inline bool _WxCocoa_GetNeedsUpdate(); - inline void _WxCocoa_SetNeedsUpdate(bool needsUpdate); - virtual void OnInternalIdle(); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual wxSize DoGetBestSize() const; -// pure virtuals from wxListBoxBase - virtual bool IsSelected(int n) const; - virtual int GetSelections(wxArrayInt& aSelections) const; -protected: - virtual void DoSetFirstItem(int n); - virtual void DoSetSelection(int n, bool select); - -// pure virtuals from wxItemContainer -public: - // deleting items - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - // accessing strings - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - // selection - virtual int GetSelection() const; -protected: - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; -}; - -#endif // __WX_COCOA_LISTBOX_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/log.h b/Externals/wxWidgets3/include/wx/cocoa/log.h deleted file mode 100644 index 82f9319a48..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/log.h +++ /dev/null @@ -1,21 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/log.h -// Purpose: Declare wxCocoa-specific trace masks -// Author: David Elliott -// Modified by: -// Created: 2004/02/07 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_LOG_H__ -#define _WX_COCOA_LOG_H__ - -// General tracing (in lieu of wxLogDebug) -#define wxTRACE_COCOA wxT("COCOA") -// Specific tracing -#define wxTRACE_COCOA_RetainRelease wxT("COCOA_RetainRelease") -#define wxTRACE_COCOA_TopLevelWindow_Size wxT("COCOA_TopLevelWindow_Size") -#define wxTRACE_COCOA_Window_Size wxT("COCOA_Window_Size") - -#endif //ndef _WX_COCOA_LOG_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/mbarman.h b/Externals/wxWidgets3/include/wx/cocoa/mbarman.h deleted file mode 100644 index 0223cb5c74..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/mbarman.h +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/mbarman.h -// Purpose: wxMenuBarManager class -// Author: David Elliott -// Modified by: -// Created: 2003/09/04 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_MBARMAN_H__ -#define __WX_COCOA_MBARMAN_H__ - -#if wxUSE_MENUS - -#include "wx/toplevel.h" - -DECLARE_WXCOCOA_OBJC_CLASS(wxMenuBarManagerObserver); - -// ======================================================================== -// wxMenuBarManager -// ======================================================================== -class WXDLLIMPEXP_CORE wxMenuBarManager : public wxObject -{ -// ------------------------------------------------------------------------ -// initialization/destruction -// ------------------------------------------------------------------------ -public: - wxMenuBarManager(); - virtual ~wxMenuBarManager(); -// ------------------------------------------------------------------------ -// Single instance -// ------------------------------------------------------------------------ -public: - static wxMenuBarManager *GetInstance() { return sm_mbarmanInstance; } - static void CreateInstance(); - static void DestroyInstance(); -protected: - static wxMenuBarManager *sm_mbarmanInstance; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - void SetMainMenuBar(wxMenuBar* menubar); - void WindowDidBecomeKey(NSNotification *notification); -#if 0 - void WindowDidResignKey(NSNotification *notification); - void WindowDidBecomeMain(NSNotification *notification); - void WindowDidResignMain(NSNotification *notification); - void WindowWillClose(NSNotification *notification); -#endif // 0 - void UpdateMenuBar(); -protected: - void SetMenuBar(wxMenuBar* menubar); - void InstallMenuBarForWindow(wxCocoaNSWindow *win); - void InstallMainMenu(); - WX_NSMenu m_menuApp; - WX_NSMenu m_menuServices; - WX_NSMenu m_menuWindows; - WX_NSMenu m_menuMain; - // Is main menu bar the current one - bool m_mainMenuBarInstalled; - // Main menu (if app provides one) - wxMenuBar *m_mainMenuBar; - wxMenuBarManagerObserver *m_observer; - WX_NSWindow m_currentNSWindow; -}; - -#endif // wxUSE_MENUS -#endif // _WX_COCOA_MBARMAN_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/mdi.h b/Externals/wxWidgets3/include/wx/cocoa/mdi.h deleted file mode 100644 index 6cef55caf2..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/mdi.h +++ /dev/null @@ -1,163 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/mdi.h -// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow -// Author: David Elliott -// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes -// Created: 2003/09/08 -// Copyright: (c) 2003 David Elliott -// (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_MDI_H__ -#define __WX_COCOA_MDI_H__ - -#include "wx/frame.h" - -DECLARE_WXCOCOA_OBJC_CLASS(wxMDIParentFrameObserver); - -class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; -class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; - -WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList); - -// ======================================================================== -// wxMDIParentFrame -// ======================================================================== -class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase -{ - friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxMDIParentFrame() { Init(); } - wxMDIParentFrame(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - virtual ~wxMDIParentFrame(); - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); -protected: - void Init(); -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - void WindowDidBecomeMain(NSNotification *notification); -protected: - virtual void CocoaDelegate_windowDidBecomeKey(void); - virtual void CocoaDelegate_windowDidResignKey(void); - virtual bool Cocoa_canBecomeMainWindow(bool &canBecome); - virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); - - void AddMDIChild(wxMDIChildFrame *child); - void RemoveMDIChild(wxMDIChildFrame *child); - - wxMDIParentFrameObserver *m_observer; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - void SetActiveChild(wxMDIChildFrame *child); - - // implement base class pure virtuals - // ---------------------------------- - - static bool IsTDI() { return false; } - - virtual void ActivateNext() { /* TODO */ } - virtual void ActivatePrevious() { /* TODO */ } - -protected: - wxMDIClientWindow *m_clientWindow; - wxMDIChildFrame *m_currentChild; - wxCocoaMDIChildFrameList m_mdiChildren; -}; - -// ======================================================================== -// wxMDIChildFrame -// ======================================================================== -class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame -{ - friend class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxMDIChildFrame() { Init(); } - wxMDIChildFrame(wxMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - virtual ~wxMDIChildFrame(); - - bool Create(wxMDIParentFrame *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); -protected: - void Init(); -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: -protected: - virtual void CocoaDelegate_windowDidBecomeKey(void); - virtual void CocoaDelegate_windowDidBecomeMain(void); - virtual void CocoaDelegate_windowDidResignKey(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void Activate(); - virtual bool Destroy(); -protected: - wxMDIParentFrame *m_mdiParent; -}; - -// ======================================================================== -// wxMDIClientWindow -// ======================================================================== -class wxMDIClientWindow : public wxMDIClientWindowBase -{ -public: - wxMDIClientWindow() { } - - virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxHSCROLL | wxVSCROLL); - - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) -}; - -#endif // __WX_COCOA_MDI_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/menu.h b/Externals/wxWidgets3/include/wx/cocoa/menu.h deleted file mode 100644 index 0cb304126f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/menu.h +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/menu.h -// Purpose: wxMenu and wxMenuBar classes -// Author: David Elliott -// Modified by: -// Created: 2002/12/09 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_MENU_H__ -#define __WX_COCOA_MENU_H__ - -#include "wx/cocoa/NSMenu.h" - -#if wxUSE_ACCEL - #include "wx/accel.h" -#endif // wxUSE_ACCEL - -// ======================================================================== -// wxMenu -// ======================================================================== - -class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase, public wxCocoaNSMenu -{ -public: - // ctors and dtor - wxMenu(const wxString& title, long style = 0) - : wxMenuBase(title, style) - , m_cocoaDeletes(false) - { Create(title,style); } - bool Create(const wxString& title, long style = 0); - - wxMenu(long style = 0) : wxMenuBase(style) { Create(wxEmptyString, style); } - - virtual ~wxMenu(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; } - void SetCocoaDeletes(bool cocoaDeletes); - virtual void Cocoa_dealloc(); -protected: - WX_NSMenu m_cocoaNSMenu; - bool m_cocoaDeletes; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -protected: - // implement base class virtuals - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); - -#if wxUSE_ACCEL - // add/remove accel for the given menu item - void AddAccelFor(wxMenuItem *item); - void RemoveAccelFor(wxMenuItem *item); -#endif // wxUSE_ACCEL - -private: -#if wxUSE_ACCEL - // the accel table for this menu - wxAcceleratorTable m_accelTable; -#endif // wxUSE_ACCEL - - DECLARE_DYNAMIC_CLASS(wxMenu) -}; - -// ======================================================================== -// wxMenuBar -// ======================================================================== -class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase -{ -public: - // ctors and dtor - wxMenuBar(long style = 0) { Create(style); } - wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); - bool Create(long style = 0); - virtual ~wxMenuBar(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - inline WX_NSMenu GetNSMenu() { return m_cocoaNSMenu; } -protected: - WX_NSMenu m_cocoaNSMenu; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // implement base class virtuals - virtual bool Append(wxMenu *menu, const wxString &title); - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Remove(size_t pos); - - virtual void EnableTop(size_t pos, bool enable); - virtual bool IsEnabledTop(size_t pos) const; - - virtual void SetMenuLabel(size_t pos, const wxString& label); - virtual wxString GetMenuLabel(size_t pos) const; - - virtual void Attach(wxFrame *frame); - virtual void Detach(); - - // get the next item for the givan accel letter (used by wxFrame), return - // -1 if none - // - // if unique is not NULL, filled with TRUE if there is only one item with - // this accel, FALSE if two or more - int FindNextItemForAccel(int idxStart, - int keycode, - bool *unique = NULL) const; - - // called by wxFrame to set focus to or open the given menu - void SelectMenu(size_t pos); - -#if wxUSE_ACCEL - // find the item for the given accel and generate an event if found - bool ProcessAccelEvent(const wxKeyEvent& event); -#endif // wxUSE_ACCEL - -protected: - // event handlers - void OnLeftDown(wxMouseEvent& event); - void OnMouseMove(wxMouseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKillFocus(wxFocusEvent& event); - - // process the mouse move event, return TRUE if we did, FALSE to continue - // processing as usual - // - // the coordinates are client coordinates of menubar, convert if necessary - bool ProcessMouseEvent(const wxPoint& pt); - - // menubar geometry - virtual wxSize DoGetBestClientSize() const; - - // has the menubar been created already? - bool IsCreated() const { return m_frameLast != NULL; } - - // get the (total) width of the specified menu - wxCoord GetItemWidth(size_t pos) const; - - // get the rect of the item - wxRect GetItemRect(size_t pos) const; - - // get the menu from the given point or -1 if none - int GetMenuFromPoint(const wxPoint& pos) const; - - // refresh the given item - void RefreshItem(size_t pos); - - // refresh all items after this one (including it) - void RefreshAllItemsAfter(size_t pos); - - // do we show a menu currently? - bool IsShowingMenu() const { return m_menuShown != 0; } - - // we don't want to have focus except while selecting from menu - void GiveAwayFocus(); - - // the current item (only used when menubar has focus) - int m_current; - -private: - // the last frame to which we were attached, NULL initially - wxFrame *m_frameLast; - - // the currently shown menu or NULL - wxMenu *m_menuShown; - - // should be showing the menu? this is subtly different from m_menuShown != - // NULL as the menu which should be shown may be disabled in which case we - // don't show it - but will do as soon as the focus shifts to another menu - bool m_shouldShowMenu; - - DECLARE_DYNAMIC_CLASS(wxMenuBar) -}; - -#endif // _WX_COCOA_MENU_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/menuitem.h b/Externals/wxWidgets3/include/wx/cocoa/menuitem.h deleted file mode 100644 index 23983171bb..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/menuitem.h +++ /dev/null @@ -1,99 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/menuitem.h -// Purpose: wxMenuItem class -// Author: David Elliott -// Modified by: -// Created: 2002/12/13 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_MENUITEM_H_ -#define _WX_COCOA_MENUITEM_H_ - -#include "wx/hashmap.h" -#include "wx/bitmap.h" - -#include "wx/cocoa/ObjcRef.h" - -// ======================================================================== -// wxMenuItem -// ======================================================================== - -#define wxMenuItemCocoa wxMenuItem -class wxMenuItemCocoa; -WX_DECLARE_HASH_MAP(WX_NSMenuItem,wxMenuItem*,wxPointerHash,wxPointerEqual,wxMenuItemCocoaHash); - -class WXDLLIMPEXP_CORE wxMenuItemCocoa : public wxMenuItemBase -{ -public: -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ - wxMenuItemCocoa(wxMenu *parentMenu = NULL, - int id = wxID_SEPARATOR, - const wxString& name = wxEmptyString, - const wxString& help = wxEmptyString, - wxItemKind kind = wxITEM_NORMAL, - wxMenu *subMenu = NULL); - virtual ~wxMenuItemCocoa(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - inline WX_NSMenuItem GetNSMenuItem() { return m_cocoaNSMenuItem; } - static inline wxMenuItem* GetFromCocoa(WX_NSMenuItem cocoaNSMenuItem) - { - wxMenuItemCocoaHash::iterator iter=sm_cocoaHash.find(cocoaNSMenuItem); - if(iter!=sm_cocoaHash.end()) - return iter->second; - return NULL; - } - void CocoaItemSelected(); - bool Cocoa_validateMenuItem(); -protected: - void CocoaSetKeyEquivalent(); - WX_NSMenuItem m_cocoaNSMenuItem; - static wxMenuItemCocoaHash sm_cocoaHash; - static wxObjcAutoRefFromAlloc sm_cocoaTarget; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // override base class virtuals to update the item appearance on screen - virtual void SetItemLabel(const wxString& text); - virtual void SetCheckable(bool checkable); - - virtual void Enable(bool enable = TRUE); - virtual void Check(bool check = TRUE); - - // we add some extra functions which are also available under MSW from - // wxOwnerDrawn class - they will be moved to wxMenuItemBase later - // hopefully - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap); - void SetBitmap(const wxBitmap& bmp) { SetBitmaps(bmp); } - const wxBitmap& GetBitmap(bool checked = TRUE) const - { return checked ? m_bmpChecked : m_bmpUnchecked; } - -protected: - // notify the menu about the change in this item - inline void NotifyMenu(); - - // set the accel index and string from text - void UpdateAccelInfo(); - - // the bitmaps (may be invalid, then they're not used) - wxBitmap m_bmpChecked, - m_bmpUnchecked; - - // the accel string (i.e. "Ctrl-Q" or "Alt-F1") - wxString m_strAccel; - -private: - DECLARE_DYNAMIC_CLASS(wxMenuItem) -}; - -#endif // _WX_COCOA_MENUITEM_H_ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/msgdlg.h b/Externals/wxWidgets3/include/wx/cocoa/msgdlg.h deleted file mode 100644 index 4a313c44af..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/msgdlg.h +++ /dev/null @@ -1,70 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/msgdlg.h -// Purpose: wxMessageDialog class -// Author: Gareth Simpson -// Created: 2007-10-29 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_MSGDLG_H_ -#define _WX_COCOA_MSGDLG_H_ - -#include "wx/msgdlg.h" - -DECLARE_WXCOCOA_OBJC_CLASS(NSAlert); - -#ifndef wxUSE_COCOA_NATIVE_MSGDLG -// trunk: Always use Cocoa dialog -// 2.8: Only use Cocoa dialog if ABI incompatible features is on -// Build both on both branches (there was no wxCocoaMessageDialog class so it's not an ABI issue) - #if 1/* wxUSE_ABI_INCOMPATIBLE_FEATURES */ - #define wxUSE_COCOA_NATIVE_MSGDLG 1 - #else - #define wxUSE_COCOA_NATIVE_MSGDLG 0 - #endif -#endif - -#if wxUSE_COCOA_NATIVE_MSGDLG - #define wxMessageDialog wxCocoaMessageDialog -#else - #include "wx/generic/msgdlgg.h" - - #define wxMessageDialog wxGenericMessageDialog -#endif - -// ---------------------------------------------------------------------------- -// wxCocoaMessageDialog -// ---------------------------------------------------------------------------- - - -class WXDLLIMPEXP_CORE wxCocoaMessageDialog - : public wxMessageDialogWithCustomLabels -{ -public: - wxCocoaMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, - const wxPoint& pos = wxDefaultPosition); - - virtual int ShowModal(); - -protected: - // not supported for message dialog - virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} - - // override wxMessageDialogWithCustomLabels method to get rid of - // accelerators in the custom label strings - // - // VZ: I have no idea _why_ do we do this but the old version did and - // I didn't want to change the existing behaviour - virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label); - - DECLARE_DYNAMIC_CLASS(wxCocoaMessageDialog) - wxDECLARE_NO_COPY_CLASS(wxCocoaMessageDialog); -}; - -#endif // _WX_MSGDLG_H_ - diff --git a/Externals/wxWidgets3/include/wx/cocoa/notebook.h b/Externals/wxWidgets3/include/wx/cocoa/notebook.h deleted file mode 100644 index 0fe99e91a1..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/notebook.h +++ /dev/null @@ -1,104 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/notebook.h -// Purpose: wxNotebook class -// Author: David Elliott -// Modified by: -// Created: 2004/04/08 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_NOTEBOOK_H__ -#define _WX_COCOA_NOTEBOOK_H__ - -#include "wx/cocoa/NSTabView.h" - -// ======================================================================== -// wxNotebook -// ======================================================================== -class WXDLLIMPEXP_CORE wxNotebook: public wxNotebookBase, protected wxCocoaNSTabView -{ - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSTabView,NSView,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxNotebook() { } - wxNotebook(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr) - { - Create(parent, winid, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - virtual ~wxNotebook(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // Notebooks cannot be enabled/disabled - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } - virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem); - virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // set the currently selected page, return the index of the previously - // selected one (or wxNOT_FOUND on error) - int SetSelection(size_t nPage); - // get the currently selected page - int GetSelection() const; - - // changes selected page without sending events - int ChangeSelection(size_t nPage); - - // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; - - // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); - - // set the size (the same for all pages) - void SetPageSize(const wxSize& size); - - // SetPadding and SetTabSize aren't possible to implement - void SetPadding(const wxSize& padding); - void SetTabSize(const wxSize& sz); - - //----------------------- - // adding/removing pages - - // remove one page from the notebook, without deleting - virtual wxNotebookPage *DoRemovePage(size_t nPage); - - // remove one page from the notebook - bool DeletePage(size_t nPage); - // remove all pages - bool DeleteAllPages(); - - // adds a new page to the notebook (it will be deleted ny the notebook, - // don't delete it yourself). If bSelect, this page becomes active. - // the same as AddPage(), but adds it at the specified position - bool InsertPage( size_t position, - wxNotebookPage *win, - const wxString& strText, - bool bSelect = false, - int imageId = NO_IMAGE ); - -protected: -}; - -#endif //ndef _WX_COCOA_NOTEBOOK_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/objc/NSMenu.h b/Externals/wxWidgets3/include/wx/cocoa/objc/NSMenu.h deleted file mode 100644 index 780d306058..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/objc/NSMenu.h +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/objc/NSMenu.h -// Purpose: WXNSMenu class -// Author: David Elliott -// Modified by: -// Created: 2007/04/20 (move from NSMenu.mm) -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_OBJC_NSMENU_H__ -#define __WX_COCOA_OBJC_NSMENU_H__ - -#include "wx/cocoa/objc/objc_uniquifying.h" - -#import - -// ============================================================================ -// @class WXNSMenu -// ============================================================================ -@interface WXNSMenu : NSMenu -{ -} - -- (void)dealloc; - -@end // WXNSMenu -WX_DECLARE_GET_OBJC_CLASS(WXNSMenu,NSMenu) - -#endif //ndef __WX_COCOA_OBJC_NSMENU_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/objc/NSSlider.h b/Externals/wxWidgets3/include/wx/cocoa/objc/NSSlider.h deleted file mode 100644 index 3534d8576f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/objc/NSSlider.h +++ /dev/null @@ -1,36 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/objc/NSSlider.h -// Purpose: WXNSSlider class -// Author: David Elliott -// Modified by: -// Created: 2007/08/10 (move from NSSlider.mm) -// Copyright: (c) 2007 Software 2000 Ltd. -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_OBJC_NSSLIDER_H__ -#define __WX_COCOA_OBJC_NSSLIDER_H__ - -#include "wx/cocoa/objc/objc_uniquifying.h" - -#import - -// ============================================================================ -// @class WXNSSlider -// ============================================================================ - -@interface WXNSSlider : NSSlider -@end - -WX_DECLARE_GET_OBJC_CLASS(WXNSSlider,NSSlider) - -// ============================================================================ -// @class WXNSSliderCell -// ============================================================================ - -@interface WXNSSliderCell : NSSliderCell -@end - -WX_DECLARE_GET_OBJC_CLASS(WXNSSliderCell,NSSliderCell) - -#endif //ndef __WX_COCOA_OBJC_NSSLIDER_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/objc/NSView.h b/Externals/wxWidgets3/include/wx/cocoa/objc/NSView.h deleted file mode 100644 index f4c5f04ebf..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/objc/NSView.h +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/objc/NSView.h -// Purpose: WXNSView class -// Author: David Elliott -// Modified by: -// Created: 2007/04/20 (move from NSView.mm) -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_OBJC_NSVIEW_H__ -#define __WX_COCOA_OBJC_NSVIEW_H__ - -#include "wx/cocoa/objc/objc_uniquifying.h" - -#import - -// ============================================================================ -// @class WXNSView -// ============================================================================ -@interface WXNSView : NSView -{ -} - -- (void)drawRect: (NSRect)rect; -- (void)mouseDown:(NSEvent *)theEvent; -- (void)mouseDragged:(NSEvent *)theEvent; -- (void)mouseUp:(NSEvent *)theEvent; -- (void)mouseMoved:(NSEvent *)theEvent; -- (void)mouseEntered:(NSEvent *)theEvent; -- (void)mouseExited:(NSEvent *)theEvent; -- (void)rightMouseDown:(NSEvent *)theEvent; -- (void)rightMouseDragged:(NSEvent *)theEvent; -- (void)rightMouseUp:(NSEvent *)theEvent; -- (void)otherMouseDown:(NSEvent *)theEvent; -- (void)otherMouseDragged:(NSEvent *)theEvent; -- (void)otherMouseUp:(NSEvent *)theEvent; -- (void)resetCursorRects; -- (void)viewDidMoveToWindow; -- (void)viewWillMoveToWindow:(NSWindow *)newWindow; -@end // WXNSView -WX_DECLARE_GET_OBJC_CLASS(WXNSView,NSView) - -#endif //ndef __WX_COCOA_OBJC_NSVIEW_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/objc/NSWindow.h b/Externals/wxWidgets3/include/wx/cocoa/objc/NSWindow.h deleted file mode 100644 index bed9e59838..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/objc/NSWindow.h +++ /dev/null @@ -1,39 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/objc/NSWindow.h -// Purpose: WXNSWindow class -// Author: David Elliott -// Modified by: -// Created: 2007/04/20 (move from NSWindow.mm) -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#import -#import - -#include "wx/cocoa/objc/objc_uniquifying.h" - -// ============================================================================ -// @class WXNSWindow -// ============================================================================ -@interface WXNSWindow : NSWindow -{ -} - -- (BOOL)canBecomeKeyWindow; -- (BOOL)canBecomeMainWindow; -@end // WXNSWindow -WX_DECLARE_GET_OBJC_CLASS(WXNSWindow,NSWindow) - -// ============================================================================ -// @class WXNSPanel -// ============================================================================ -@interface WXNSPanel : NSPanel -{ -} - -- (BOOL)canBecomeKeyWindow; -- (BOOL)canBecomeMainWindow; -@end // WXNSPanel -WX_DECLARE_GET_OBJC_CLASS(WXNSPanel,NSPanel) - diff --git a/Externals/wxWidgets3/include/wx/cocoa/objc/objc_uniquifying.h b/Externals/wxWidgets3/include/wx/cocoa/objc/objc_uniquifying.h deleted file mode 100644 index bedbf44677..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/objc/objc_uniquifying.h +++ /dev/null @@ -1,364 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/objc/objc_uniquifying.h -// Purpose: Allows wxWidgets code to get a direct pointer to a compiled -// Objective-C class and provides a method to fix up the -// name to include a unique identifier (currently the address -// of the objc_class structure). -// Author: David Elliott -// Modified by: -// Created: 2007/05/15 -// Copyright: (c) 2007 Software 2000 Ltd. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_OBJC_CLASS_H__ -#define __WX_COCOA_OBJC_CLASS_H__ - -/* A note about this header: -Nothing in here is guaranteed to exist in future versions of wxCocoa. There -are other ways of adding Objective-C classes at runtime and a future wxCocoa -might use these instead of this ugly hack. You may use this header file in -your own wxCocoa code if you need your own Objective-C classes to be -unqiuified. - -You cannot turn this on for 64-bit mode. It will not compile due to opaque -Objective-C data structures and it is not needed because it is a workaround -for a bug that does not exist in the 64-bit runtime. - -You should not use this when wxCocoa is built as a dynamic library. This has -only been tested for the case when wxCocoa is built as a static library and -statically linked to user code to form a loadable bundle (e.g. a Cocoa plugin). -It forces each plugin (when multiple wxCocoa-using plugins are used) to use -its own internal Objective-C classes which is desirable when wxCocoa is -statically linked to the rest of the code. - -Do not use uniquifying on your principal class. That one should be named -differently for different bundles. - */ - -#if wxUSE_OBJC_UNIQUIFYING - -// objc_getClass and stuff -#include - -////////////// Objective-C uniquifying implementation ////////////// - -template -class wxObjcClassInitializer; - -template -class UniquifiedName; - -template -class wxObjcCompilerInformation -{ - friend class wxObjcClassInitializer; - friend class UniquifiedName; -private: - // GetCompiledClass must be partially specialized for an ObjcType - // If you're not using it, implement an inline returning NULL - inline static struct objc_class * GetCompiledClass(); - - // sm_theClassName must be partially specialized for each type - static const char sm_theClassName[]; - - // GetSuperclass must be specialized. Typically one of two ways: - // 1. objc_getClass("SomeRealClassName") - // 2. wxGetObjcClass_SomeWxClassName(); - inline static struct objc_class *GetSuperclass(); -}; - - -template -struct UniquifiedName -{ - // We're going for OriginalClassName@ClassStructureAddress - // Therefore our size is the sizeof the original class name constant string (which includes the terminating NULL) - // plus the sizeof a pointer to struct objc_class times two (two hex digits for each byte) plus 3 for "@0x" - typedef char Type[sizeof(wxObjcCompilerInformation::sm_theClassName) + (sizeof(struct objc_class*)<<1) + 3]; - static void Init(Type m_theString, const objc_class *aClass) - { - snprintf(const_cast(m_theString), sizeof(Type), "%s@%p", wxObjcCompilerInformation::sm_theClassName, aClass); - } -}; - -/*! @function HidePointerFromGC - @abstract Returns an l-value whose location the compiler cannot know. - @discussion - The compiler-generated Objective-C class structures are located in the static data area. - They are by design Objective-C objects in their own right which makes the compiler issue - write barriers as if they were located in the GC-managed heap as most Objective-C objects. - - By accepting and returning a reference to any pointer type we can set any i-var of an - Objective-C object that is a pointer to another Objective-C object without the compiler - generating an objc_assign_ivar write barrier. It will instad generate an - objc_assign_strongCast write barrier which is the appropriate write-barrier when assigning - pointers to Objective-C objects located in unknown memory. - - For instance: - Class *someClass = ...; - HidePointerFromGC(someClass->isa) = ...; - */ -template -inline ObjcType * & HidePointerFromGC(ObjcType * &p) __attribute__((always_inline)); - -template -inline ObjcType * & HidePointerFromGC(ObjcType * &p) -{ - return p; -} - -template -class wxObjcClassInitializer -{ -public: - static struct objc_class* Get() - { - static wxObjcClassInitializer s_theInstance; - s_theInstance.noop(); // Make the compiler think we need this instance - return wxObjcCompilerInformation::GetCompiledClass(); - } -private: - void noop() - {} - // This "constructor" operates solely on static data - // It exists so that we can take advantage of a function-static - // "instance" of this class to do the static data initialization. - wxObjcClassInitializer() - { - // Objective-C class initialization occurs before C++ static initialization because the - // libobjc.dylib gets notified directly by dyld on Tiger. - // Therefore, even though we change the name, the class is still registered with the - // original name. We unfortunately can't change that. - - // The first time the class is loaded, Objective-C will already have fixed up the super_class - // and isa->isa and isa->super_class variables so much of this won't do anything. But - // the next time the class is loaded, Objective-C will ignore it and thus we need to - // initialize the data structures appropriately. - - // Ideally we'd have some sort of lock here, but we depend on the fact that we get called - // just before the first time someone wants to send a class message so it should be - // reasonably safe to do this without any locks. - - struct objc_class &theClassData = *wxObjcCompilerInformation::GetCompiledClass(); - // Initialize the uniquified class name - UniquifiedName::Init(sm_theUniquifiedClassName, &theClassData); - - //////// Class Initialization //////// - // Use objc_getClass to fix up the superclass pointer - theClassData.super_class = wxObjcCompilerInformation::GetSuperclass(); - // Fix up the compiler generated class struct to use the new name - theClassData.name = sm_theUniquifiedClassName; - - //////// Meta-Class Initialization //////// - // theClassData.isa is the metaclass pointer - // Globals on Darwin use PC-relative access (slow) so it's quicker to use theClassData.isa - - // In any object hierarchy a metaclass's metaclass is always the root class's metaclass - // Therefore, our superclass's metaclass's metaclass should already be the root class's metaclass - HidePointerFromGC(theClassData.isa->isa) = theClassData.super_class->isa->isa; - // A metaclass's superclass is always the superclass's metaclass. - HidePointerFromGC(theClassData.isa->super_class) = theClassData.super_class->isa; - // Fix up the compiler generated metaclass struct to use the new name - theClassData.isa->name = sm_theUniquifiedClassName; - - // We need to set the initialized flag because after we change the name, Objective-C can't - // look us up by name because we're only registered with the original name. - theClassData.isa->info |= CLS_INITIALIZED; - } - wxObjcClassInitializer(const wxObjcClassInitializer&); // NO COPY - wxObjcClassInitializer& operator =(const wxObjcClassInitializer&); // NO ASSIGN - static typename UniquifiedName::Type sm_theUniquifiedClassName; -}; - -template -typename UniquifiedName::Type wxObjcClassInitializer::sm_theUniquifiedClassName; - -// WX_DECLARE_GET_OBJC_CLASS -// Declares a function to get a direct pointer to an objective-C class. -// The class is guaranteed to be usable. -// When wxCocoa is built into a Mach-O bundle this function allows the wxCocoa -// code to get a reference to the Objective-C class structure located in the -// same bundle. This allows a static wxCocoa library to be built into -// two different Mach-O bundles without having one bundle's Objective-C -// classes trample on the other's. -// Right now we toss the ObjcSuperClass parameter, but we might use it later. -#define WX_DECLARE_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) \ -struct objc_class* wx_GetObjcClass_ ## ObjcClass(); - -// WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) -// Provides an architecture-dependent way to get the direct pointer to the -// objc_class structure in the __OBJC segment. -// This takes advantage of the fact that the Objective-C compiler uses guessable -// local assembler labels for the class structures. -// Those class structures are only available on the Objective-C file containing the -// @implementation block. - -#if 1 -// Generic implementation - Tested on i386 and PPC. Should work in all cases. -// This is a hack that depends on GCC asm symbol names. -// The static variable winds up being initialized with a direct reference to the appropriate -// L_OBJC_CLASS and no global symbol reference is generated because nothing uses the global symbol -// except for the static initializer which does it directly. -// The generated assembler for s_objc_class_ptr is basically like this: -// _s_objc_class_ptr_ObjcClass: -// .long L_OBJC_CLASS_ObjcClass -// Once that static symbol is defined, the function implementation is easy for GCC to generate. -// Do note that return &s_objc_class_data_ObjcClass won't work. The code is wrong in this case. -#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \ -extern "C" objc_class s_objc_class_data_ ## ObjcClass asm("L_OBJC_CLASS_" #ObjcClass); \ -static objc_class * s_objc_class_ptr_ ## ObjcClass = &s_objc_class_data_ ## ObjcClass; \ -template<> \ -inline objc_class * wxObjcCompilerInformation::GetCompiledClass() \ -{ \ - return s_objc_class_ptr_## ObjcClass; \ -} - -#elif defined(__i386__) -// Not used because the generic implementation seems to work fine. -// But this is here since it was written beforehand and it also works. - -// This is based on the code GCC generates for accessing file-static data on i386. -// The i386 PC-relative addressing happens in this manner -// 1. The program counter is placed into ecx using the code that GCC should have -// already generated. -// 2. A label is placed directly after the call to get the program counter. -// 3. The Load Effective Address instruction is used to add the offset of the -// local assembler label we're interested in minus the local assembler label -// from step 2 to the program counter register in ecx and place the result -// into the result register (typically eax if not inlined). -#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \ -template<> \ -inline objc_class * wxObjcCompilerInformation::GetCompiledClass() \ -{ \ - register struct objc_class *retval; \ - asm \ - ( "call ___i686.get_pc_thunk.cx\n" \ - "\"LPC_FOR_GET_CLASS_" #ObjcClass "\":\n\t" \ - "leal L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\"(%%ecx), %0" \ - : "=r"(retval) \ - : \ - : "ecx" \ - ); \ - return retval; \ -} - -#elif defined(__ppc__) -// Not used because the generic implementation seems to work fine. -// But this is here since it was written beforehand and it also works. - -// This is based on the code GCC generates for accessing file-static data on PPC. -// The PowerPC PC-relative addressing happens in this manner -// 1. The link register is saved (mflr) to a temporary (we re-use the output register for this) -// 2. An unconditional branch instruction (bcl) "branches" to the following address (labeled) -// 3. The link register (filled in by bcl) is saved to r10 (a temporary) -// 4. The previous link register is restored (mtlr) (from the output register we were using as a temporary) -// 5. The address of the LPC label as executed is added to the high 16 bits of the offset between that label and the static data we want -// and stored in a temporary register (r2) -// 6. That temporary register plus the low 16 bits of the offset are stored into the result register. -#define WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \ -template<> \ -inline objc_class * wxObjcCompilerInformation::GetCompiledClass() \ -{ \ - register struct objc_class *retval; \ - asm \ - ( "mflr %0" \ - "\n\tbcl 20, 31, \"LPC_FOR_GET_CLASS_" #ObjcClass "\"" \ - "\n\"LPC_FOR_GET_CLASS_" #ObjcClass "\":" \ - "\n\tmflr r10" \ - "\n\tmtlr %0" \ - "\n\taddis r2,r10,ha16(L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\")" \ - "\n\tla %0,lo16(L_OBJC_CLASS_" #ObjcClass "-\"LPC_FOR_GET_CLASS_" #ObjcClass "\")(r2)" \ - : "=r" (retval) \ - : \ - : "r10","r2" \ - ); \ - return retval; \ -} - -// TODO: __x86_64__, __ppc64__ -#else // Can't write inline asm to bust into __OBJC segment -// This won't be used since the generic implementation takes precedence. - -#warning "Don't know how to implement wxObjcCompilerInformation::GetCompiledClass on this platform" - -#endif // platforms - -// The WX_IMPLEMENT_OBJC_GET_SUPERCLASS macro implements the template specialization -// to get the superclass. This only works if it's a real superclass. If you are -// deriving from a class that's already being uniquified then you'd need to -// implement the specialization to call the appropriate get method instead. -#define WX_IMPLEMENT_OBJC_GET_SUPERCLASS(ObjcClass,ObjcSuperClass) \ - template <> \ - inline objc_class* wxObjcCompilerInformation::GetSuperclass() \ - { \ - return objc_getClass(#ObjcSuperClass); \ - } - -// The WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS macro implements the template -// specialization to get the superclass when the superclass is another uniquified -// Objective-C class. -#define WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \ - template <> \ - inline objc_class* wxObjcCompilerInformation::GetSuperclass() \ - { \ - return wx_GetObjcClass_ ## ObjcSuperClass(); \ - } - -// The WX_IMPLEMENT_OBJC_CLASS_NAME macro implements the template specialization -// of the sm_theClassName constant. As soon as this specialization is in place -// sizeof(sm_theClassName) will return the number of bytes at compile time. -#define WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \ - template <> \ - const char wxObjcCompilerInformation::sm_theClassName[] = #ObjcClass; - -// The WX_IMPLEMENT_OBJC_GET_OBJC_CLASS macro is the final one that actually provides -// the wx_GetObjcClass_XXX function that will be called in lieu of asking the Objective-C -// runtime for the class. All the others are really machinery to make this happen. -#define WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass) \ - objc_class* wx_GetObjcClass_ ## ObjcClass() \ - { \ - return wxObjcClassInitializer::Get(); \ - } - -// The WX_IMPLEMENT_GET_OBJC_CLASS macro combines all of these together -// for the case when the superclass is a non-uniquified class. -#define WX_IMPLEMENT_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) \ - WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \ - WX_IMPLEMENT_OBJC_GET_SUPERCLASS(ObjcClass,ObjcSuperClass) \ - WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \ - WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass) - -// The WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS macro combines all -// of these together for the case when the superclass is another uniquified class. -#define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \ - WX_IMPLEMENT_OBJC_GET_COMPILED_CLASS(ObjcClass) \ - WX_IMPLEMENT_OBJC_GET_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) \ - WX_IMPLEMENT_OBJC_CLASS_NAME(ObjcClass) \ - WX_IMPLEMENT_OBJC_GET_OBJC_CLASS(ObjcClass) - -// The WX_GET_OBJC_CLASS macro is intended to wrap the class name when the class -// is used as a message receiver (e.g. for calling class methods). When -// class name uniquifying is used, this calls the global function implemented -// in the Objective-C file containing the class @implementation. -#define WX_GET_OBJC_CLASS(ObjcClass) wx_GetObjcClass_ ## ObjcClass() - -#else // wxUSE_OBJC_UNIQUIFYING - -// Define WX_DECLARE_GET_OBJC_CLASS as nothing -#define WX_DECLARE_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) -// Define WX_IMPLEMENT_GET_OBJC_CLASS as nothing -#define WX_IMPLEMENT_GET_OBJC_CLASS(ObjcClass,ObjcSuperClass) -// Define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS as nothing -#define WX_IMPLEMENT_GET_OBJC_CLASS_WITH_UNIQUIFIED_SUPERCLASS(ObjcClass,ObjcSuperClass) - -// Define WX_GET_OBJC_CLASS macro to output the class name and let the compiler do the normal thing -// The WX_GET_OBJC_CLASS macro is intended to wrap the class name when the class -// is used as a message receiver (e.g. for calling class methods). When -// class name uniquifying is not used, this is simply defined to be the class -// name which will allow the compiler to do the normal thing. -#define WX_GET_OBJC_CLASS(ObjcClass) ObjcClass - -#endif // wxUSE_OBJC_UNIQUIFYING - -#endif //ndef __WX_COCOA_OBJC_CLASS_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/pen.h b/Externals/wxWidgets3/include/wx/cocoa/pen.h deleted file mode 100644 index 66a0c7f367..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/pen.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/pen.h -// Purpose: wxPen class -// Author: David Elliott -// Modified by: -// Created: 2003/08/02 (stubs from 22.03.2003) -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_PEN_H__ -#define __WX_COCOA_PEN_H__ - -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxColour; -class WXDLLIMPEXP_FWD_CORE wxBitmap; - -// ======================================================================== -// wxPen -// ======================================================================== -class WXDLLIMPEXP_CORE wxPen: public wxGDIObject -{ -public: - wxPen(); - wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); -#endif - wxPen(const wxBitmap& stipple, int width); - virtual ~wxPen(); - - // FIXME: operator==() is wrong - bool operator==(const wxPen& pen) const { return m_refData == pen.m_refData; } - bool operator!=(const wxPen& pen) const { return !(*this == pen); } - - void SetColour(const wxColour& col) ; - void SetColour(unsigned char r, unsigned char g, unsigned char b) ; - - void SetWidth(int width); - void SetStyle(wxPenStyle style); - void SetStipple(const wxBitmap& stipple); - void SetDashes(int nb_dashes, const wxDash *dash); - void SetJoin(wxPenJoin join); - void SetCap(wxPenCap cap); - - wxColour GetColour() const; - int GetWidth() const; - wxPenStyle GetStyle() const; - wxPenJoin GetJoin() const; - wxPenCap GetCap() const; - int GetDashes(wxDash **ptr) const; - wxBitmap *GetStipple() const; - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxPenStyle)style); } -#endif - - // Cocoa-specific - WX_NSColor GetNSColor(); - int GetCocoaLineDash(const CGFloat **pattern); - -protected: - wxGDIRefData *CreateGDIRefData() const; - wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - - DECLARE_DYNAMIC_CLASS(wxPen) -}; - -#endif // __WX_COCOA_PEN_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/private/fontfactory.h b/Externals/wxWidgets3/include/wx/cocoa/private/fontfactory.h deleted file mode 100644 index 7cbfcfe0d1..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/private/fontfactory.h +++ /dev/null @@ -1,27 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/private/fontfactory.h -// Purpose: wxFontFactory class -// Author: David Elliott -// Modified by: -// Created: 2007-10-13 -// Copyright: 2007 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_FONTFACTORY_H_ -#define _WX_COCOA_FONTFACTORY_H_ - -/*! @discussion - This class exists so that wxFont need not know about wxSettings - The implementation, however, is in the font.mm file because the - implementation needs to have knowledge of wxFontRefData. - */ -class wxCocoaFontFactory -{ -public: - /*! @abstract Create an instance with the specified NSFont and underline flag. - */ - static wxFont InstanceForNSFont(WX_NSFont cocoaFont, bool underlined = false); -}; - -#endif //_WX_COCOA_FONTFACTORY_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/private/scrollview.h b/Externals/wxWidgets3/include/wx/cocoa/private/scrollview.h deleted file mode 100644 index fe07ff9fa1..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/private/scrollview.h +++ /dev/null @@ -1,128 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/private/scrollview.h -// Purpose: wxWindowCocoaScrollView -// Author: David Elliott -// Modified by: -// Created: 2008/02/14 -// Copyright: (c) 2003- David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_SCROLLVIEW_H__ -#define _WX_COCOA_SCROLLVIEW_H__ - -@class NSScroller; - -// ======================================================================== -// wxWindowCocoaScrollView -// ======================================================================== -class wxWindowCocoaScrollView: protected wxCocoaNSView -{ - wxDECLARE_NO_COPY_CLASS(wxWindowCocoaScrollView); -public: - wxWindowCocoaScrollView(wxWindow *owner); - virtual ~wxWindowCocoaScrollView(); - inline WX_NSScrollView GetNSScrollView() { return m_cocoaNSScrollView; } - void ClientSizeToSize(int &width, int &height); - void DoGetClientSize(int *x, int *y) const; - void Encapsulate(); - void Unencapsulate(); - - // wxWindow calls this to do the work. Note that we don't have the refresh parameter - // because wxWindow handles that itself. - void SetScrollbar(int orientation, int position, int thumbSize, int range); - int GetScrollPos(wxOrientation orient); - void SetScrollPos(wxOrientation orient, int position); - int GetScrollRange(wxOrientation orient); - int GetScrollThumb(wxOrientation orient); - void ScrollWindow(int dx, int dy, const wxRect*); - void UpdateSizes(); - - void _wx_doScroller(NSScroller *sender); - -protected: - wxWindowCocoa *m_owner; - WX_NSScrollView m_cocoaNSScrollView; - virtual void Cocoa_FrameChanged(void); - virtual void Cocoa_synthesizeMouseMoved(void) {} - /*! - Flag as to whether we're scrolling for a native view or a custom - wxWindow. This controls the scrolling behaviour. When providing - scrolling for a native view we don't catch scroller action messages - and thus don't send scroll events and we don't actually scroll the - window when the application calls ScrollWindow. - - When providing scrolling for a custom wxWindow, we make the NSScroller - send their action messages to us which we in turn package as wx window - scrolling events. At this point, the window will not physically be - scrolled. The application will most likely handle the event by calling - ScrollWindow which will do the real scrolling. On the other hand, - the application may instead not call ScrollWindow until some threshold - is reached. This causes the window to only scroll in steps which is - what, for instance, wxScrolledWindow does. - */ - bool m_isNativeView; - /*! - The range as the application code wishes to see it. That is, the - range from the last SetScrollbar call for the appropriate dimension. - The horizontal dimension is the first [0] element and the vertical - dimension the second [1] element. - - In wxMSW, a SCROLLINFO with nMin=0 and nMax=range-1 is used which - gives exactly range possible positions so long as nPage (which is - the thumb size) is less than or equal to 1. - */ - int m_scrollRange[2]; - /*! - The thumb size is intended to reflect the size of the visible portion - of the scrolled document. As the document size increases, the thumb - visible thumb size decreases. As document size decreases, the visible - thumb size increases. However, the thumb size on wx is defined in - terms of scroll units (which are effectively defined by the scroll - range) and so increasing the number of scroll units to reflect increased - document size will have the effect of decreasing the visible thumb - size even though the number doesn't change. - - It's also important to note that subtracting the thumb size from the - full range gives you the real range that can be used. Microsoft - defines nPos (the current scrolling position) to be within the range - from nMin to nMax - max(nPage - 1, 0). We know that wxMSW code always - sets nMin = 0 and nMax = range -1. So let's algebraically reduce the - definition of the maximum allowed position: - - Begin: - = nMax - max(nPage - 1, 0) - Substitute (range - 1) for nMax and thumbSize for nPage: - = range - 1 - max(thumbSize - 1, 0) - Add one inside the max conditional and subtract one outside of it: - = range - 1 - (max(thumbSize - 1 + 1, 1) - 1) - Reduce some constants: - = range - 1 - (max(thumbSize, 1) - 1) - Distribute the negative across the parenthesis: - = range - 1 - max(thumbSize, 1) + 1 - Reduce the constants: - = range - max(thumbSize, 1) - - Also keep in mind that thumbSize may never be greater than range but - can be equal to it. Thus for the smallest possible thumbSize there - are exactly range possible scroll positions (numbered from 0 to - range - 1) and for the largest possible thumbSize there is exactly - one possible scroll position (numbered 0). - */ - int m_scrollThumb[2]; - - /*! - The origin of the virtual coordinate space expressed in terms of client - coordinates. Starts at (0,0) and each call to ScrollWindow accumulates - into it. Thus if the user scrolls the window right (thus causing the - contents to move left with respect to the client origin, the - application code (typically wxScrolledWindow) will be called with - dx of -something, for example -20. This is added to m_virtualOrigin - and thus m_virtualOrigin will be (-20,0) in this example. - */ - wxPoint m_virtualOrigin; -private: - wxWindowCocoaScrollView(); -}; - -#endif //ndef _WX_COCOA_SCROLLVIEW_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/private/timer.h b/Externals/wxWidgets3/include/wx/cocoa/private/timer.h deleted file mode 100644 index 1dec2cf7fb..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/private/timer.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/private/timer.h -// Purpose: Cocoa wxTimer class -// Author: Ryan Norton -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_PRIVATE_TIMER_H_ -#define _WX_COCOA_PRIVATE_TIMER_H_ - -#include "wx/private/timer.h" - -#include "wx/cocoa/ObjcRef.h" - -//----------------------------------------------------------------------------- -// wxTimer -//----------------------------------------------------------------------------- - -DECLARE_WXCOCOA_OBJC_CLASS(NSTimer); - -class WXDLLIMPEXP_CORE wxCocoaTimerImpl : public wxTimerImpl -{ -public: - wxCocoaTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { Init(); } - virtual ~wxCocoaTimerImpl(); - - virtual bool Start(int millisecs = -1, bool oneShot = false); - virtual void Stop(); - - virtual bool IsRunning() const; - - WX_NSTimer GetNSTimer() { return m_cocoaNSTimer; } - -protected: - void Init(); - -private: - WX_NSTimer m_cocoaNSTimer; -}; - -#endif // _WX_COCOA_PRIVATE_TIMER_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/radiobox.h b/Externals/wxWidgets3/include/wx/cocoa/radiobox.h deleted file mode 100644 index a56a0c654b..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/radiobox.h +++ /dev/null @@ -1,137 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/radiobox.h -// Purpose: wxRadioBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/18 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_RADIOBOX_H__ -#define __WX_COCOA_RADIOBOX_H__ - -// #include "wx/cocoa/NSButton.h" -DECLARE_WXCOCOA_OBJC_CLASS(NSMatrix); - -// ======================================================================== -// wxRadioBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxRadioBox: public wxControl, public wxRadioBoxBase// , protected wxCocoaNSButton -{ - DECLARE_DYNAMIC_CLASS(wxRadioBox) - DECLARE_EVENT_TABLE() - // NOTE: We explicitly skip NSControl because our primary cocoa view is - // the NSBox but we want to receive action messages from the NSMatrix. - WX_DECLARE_COCOA_OWNER(NSBox,NSView,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxRadioBox() { } - wxRadioBox(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Create(parent, winid, title, pos, size, n, choices, majorDim, style, validator, name); - } - wxRadioBox(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr) - { - Create(parent, winid, title, pos, size, choices, majorDim, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - int majorDim = 0, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& title, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - int majorDim = 0, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioBoxNameStr); - virtual ~wxRadioBox(); - - // Enabling - virtual bool Enable(unsigned int n, bool enable = true); - virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const - { - /* TODO */ - return true; - } - - // Showing - virtual bool Show(unsigned int n, bool show = true); - virtual bool IsItemShown(unsigned int WXUNUSED(n)) const - { - /* TODO */ - return true; - } - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // Radio boxes cannot be enabled/disabled - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } - virtual void CocoaTarget_action(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: -// Pure virtuals - // selection - virtual void SetSelection(int n); - virtual int GetSelection() const; - // string access - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& label); - // change the individual radio button state -protected: - // We don't want the typical wxCocoaNSBox behaviour because our real - // implementation is by using an NSMatrix as the NSBox's contentView. - WX_NSMatrix GetNSMatrix() const; - void AssociateNSBox(WX_NSBox theBox); - void DisassociateNSBox(WX_NSBox theBox); - - virtual wxSize DoGetBestSize() const; - - int GetRowForIndex(int n) const - { - if(m_windowStyle & wxRA_SPECIFY_COLS) - return n / GetMajorDim(); - else - return n % GetMajorDim(); - } - - int GetColumnForIndex(int n) const - { - if(m_windowStyle & wxRA_SPECIFY_COLS) - return n % GetMajorDim(); - else - return n / GetMajorDim(); - } -}; - -#endif // __WX_COCOA_RADIOBOX_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/radiobut.h b/Externals/wxWidgets3/include/wx/cocoa/radiobut.h deleted file mode 100644 index 4a78b617c2..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/radiobut.h +++ /dev/null @@ -1,73 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/radiobut.h -// Purpose: wxRadioButton class -// Author: David Elliott -// Modified by: -// Created: 2003/03/18 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_RADIOBUT_H__ -#define __WX_COCOA_RADIOBUT_H__ - -#include "wx/cocoa/NSButton.h" - -class WXDLLIMPEXP_FWD_CORE wxRadioButton; - -WX_DECLARE_EXPORTED_LIST(wxRadioButton, wxRadioButtonList); - -// ======================================================================== -// wxRadioButton -// ======================================================================== -class WXDLLIMPEXP_CORE wxRadioButton: public wxControl, protected wxCocoaNSButton -{ - DECLARE_DYNAMIC_CLASS(wxRadioButton) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxRadioButton() { m_radioMaster = NULL; } - wxRadioButton(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr) - { - Create(parent, winid, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxRadioButtonNameStr); - virtual ~wxRadioButton(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_wxNSButtonAction(void); -private: - void Cocoa_DeselectOtherButtonsInTheGroup(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void SetValue(bool); - virtual bool GetValue() const; - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; -protected: - wxRadioButtonList m_radioSlaves; - wxRadioButton *m_radioMaster; -}; - -#endif // __WX_COCOA_RADIOBUT_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/region.h b/Externals/wxWidgets3/include/wx/cocoa/region.h deleted file mode 100644 index c9aed9592d..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/region.h +++ /dev/null @@ -1,75 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/region.h -// Purpose: wxRegion class -// Author: David Elliott -// Modified by: -// Created: 2004/04/12 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_REGION_H__ -#define _WX_COCOA_REGION_H__ - -#include "wx/generic/region.h" - -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef struct CGRect NSRect; -#else -typedef struct _NSRect NSRect; -#endif - -class WXDLLIMPEXP_CORE wxRegion : public wxRegionGeneric -{ -public: - wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - : wxRegionGeneric(x,y,w,h) - {} - wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight) - : wxRegionGeneric(topLeft, bottomRight) - {} - wxRegion(const wxRect& rect) - : wxRegionGeneric(rect) - {} - wxRegion() {} - wxRegion(const wxBitmap& bmp) - : wxRegionGeneric() - { Union(bmp); } - wxRegion(const wxBitmap& bmp, - const wxColour& transColour, int tolerance = 0) - : wxRegionGeneric() - { Union(bmp, transColour, tolerance); } - virtual ~wxRegion() {} - wxRegion(const wxRegion& r) - : wxRegionGeneric(r) - {} - wxRegion& operator= (const wxRegion& r) - { return *(wxRegion*)&(this->wxRegionGeneric::operator=(r)); } - - // Cocoa-specific creation - wxRegion(const NSRect& rect); - wxRegion(const NSRect *rects, int count); - -private: - DECLARE_DYNAMIC_CLASS(wxRegion); -}; - -class WXDLLIMPEXP_CORE wxRegionIterator : public wxRegionIteratorGeneric -{ -// DECLARE_DYNAMIC_CLASS(wxRegionIteratorGeneric); -public: - wxRegionIterator() {} - wxRegionIterator(const wxRegion& region) - : wxRegionIteratorGeneric(region) - {} - wxRegionIterator(const wxRegionIterator& iterator) - : wxRegionIteratorGeneric(iterator) - {} - virtual ~wxRegionIterator() {} - - wxRegionIterator& operator=(const wxRegionIterator& iter) - { return *(wxRegionIterator*)&(this->wxRegionIteratorGeneric::operator=(iter)); } -}; - -#endif - //ndef _WX_COCOA_REGION_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/scrolbar.h b/Externals/wxWidgets3/include/wx/cocoa/scrolbar.h deleted file mode 100644 index a051896ef7..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/scrolbar.h +++ /dev/null @@ -1,74 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/scrolbar.h -// Purpose: wxScrollBar class -// Author: David Elliott -// Modified by: -// Created: 2004/04/25 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_SCROLBAR_H__ -#define _WX_COCOA_SCROLBAR_H__ - -#include "wx/cocoa/NSScroller.h" - -// ======================================================================== -// wxScrollBar -// ======================================================================== -class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase, protected wxCocoaNSScroller -{ - DECLARE_DYNAMIC_CLASS(wxScrollBar) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSScroller,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxScrollBar() { } - wxScrollBar(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSB_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxScrollBarNameStr); - virtual ~wxScrollBar(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_wxNSScrollerAction(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // accessors - virtual int GetThumbPosition() const; - virtual int GetThumbSize() const { return m_thumbSize; } - virtual int GetPageSize() const { return m_pageSize; } - virtual int GetRange() const { return m_range; } - - // operations - virtual void SetThumbPosition(int viewStart); - virtual void SetScrollbar(int position, int thumbSize, - int range, int pageSize, - bool refresh = TRUE); -protected: - int m_range; - int m_thumbSize; - int m_pageSize; -}; - -#endif - // _WX_COCOA_SCROLBAR_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/slider.h b/Externals/wxWidgets3/include/wx/cocoa/slider.h deleted file mode 100644 index 5e73aa1796..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/slider.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/slider.h -// Purpose: wxSlider class -// Author: David Elliott -// Mark Oxenham -// Modified by: -// Created: 2003/06/19 -// Copyright: (c) 2003 David Elliott -// (c) 2007 Software 2000 Ltd. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_SLIDER_H__ -#define __WX_COCOA_SLIDER_H__ - -#include "wx/cocoa/NSSlider.h" - -// ======================================================================== -// wxSlider -// ======================================================================== -class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase, protected wxCocoaNSSlider -{ - DECLARE_DYNAMIC_CLASS(wxSlider) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxSlider() { } - wxSlider(wxWindow *parent, wxWindowID winid, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr) - { - Create(parent, winid, value, minValue, maxValue, - pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - int value, int minValue, int maxValue, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSL_HORIZONTAL, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxSliderNameStr); - virtual ~wxSlider(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // Override this so we can use wxCocoaNSControl's target - void AssociateNSSlider(WX_NSSlider theSlider); - - // Helper method to do the real work - virtual void ProcessEventType(wxEventType commandType); - - // from wxCocoaNSControl: - virtual void CocoaTarget_action(); - - // from wxCocoaNSSlider: - virtual void CocoaNotification_startTracking(WX_NSNotification notification); - virtual void CocoaNotification_continueTracking(WX_NSNotification notification); - virtual void CocoaNotification_stopTracking(WX_NSNotification notification); - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // Pure Virtuals - virtual int GetValue() const; - virtual void SetValue(int value); - - // retrieve/change the range - virtual void SetRange(int minValue, int maxValue); - virtual int GetMin() const; - virtual int GetMax() const; - - // the line/page size is the increment by which the slider moves when - // cursor arrow key/page up or down are pressed (clicking the mouse is like - // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range - virtual void SetLineSize(int lineSize); - virtual void SetPageSize(int pageSize); - virtual int GetLineSize() const; - virtual int GetPageSize() const; - - // these methods get/set the length of the slider pointer in pixels - virtual void SetThumbLength(int lenPixels); - virtual int GetThumbLength() const; - - // copied from (wxSliderCocoa.h) - virtual int GetTickFreq() const; - virtual void ClearTicks() { SetTickFreq(0); } - - virtual void SetTickPos(int pos); - -protected: - // Platform-specific implementation of SetTickFreq - virtual void DoSetTickFreq(int freq); -}; - -#endif - // __WX_COCOA_SLIDER_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/sound.h b/Externals/wxWidgets3/include/wx/cocoa/sound.h deleted file mode 100644 index 362e2e288d..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/sound.h +++ /dev/null @@ -1,51 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/sound.h -// Purpose: wxSound class (loads and plays short Windows .wav files). -// Optional on non-Windows platforms. -// Authors: David Elliott, Ryan Norton -// Modified by: -// Created: 2004-10-02 -// Copyright: (c) 2004 David Elliott, Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_SOUND_H_ -#define _WX_COCOA_SOUND_H_ - -#include "wx/object.h" -#include "wx/cocoa/ObjcRef.h" - -class WXDLLIMPEXP_ADV wxSound : public wxSoundBase -{ -public: - wxSound() - : m_cocoaNSSound(NULL) - {} - wxSound(const wxString& fileName, bool isResource = false) - : m_cocoaNSSound(NULL) - { Create(fileName, isResource); } - wxSound(size_t size, const void* data) - : m_cocoaNSSound(NULL) - { LoadWAV(data,size,true); } - wxSound(const wxSound& sound); // why not? - virtual ~wxSound(); - -public: - bool Create(const wxString& fileName, bool isResource = false); - bool IsOk() const - { return m_cocoaNSSound; } - static void Stop(); - static bool IsPlaying(); - - void SetNSSound(WX_NSSound cocoaNSSound); - inline WX_NSSound GetNSSound() - { return m_cocoaNSSound; } -protected: - bool DoPlay(unsigned flags) const; - bool LoadWAV(const void* data, size_t length, bool copyData); -private: - WX_NSSound m_cocoaNSSound; - static const wxObjcAutoRefFromAlloc sm_cocoaDelegate; -}; - -#endif //ndef _WX_COCOA_SOUND_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/spinbutt.h b/Externals/wxWidgets3/include/wx/cocoa/spinbutt.h deleted file mode 100644 index d4dc80dfc0..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/spinbutt.h +++ /dev/null @@ -1,63 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/spinbutt.h -// Purpose: wxSpinButton class -// Author: David Elliott -// Modified by: -// Created: 2003/07/14 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_SPINBUTT_H__ -#define __WX_COCOA_SPINBUTT_H__ - -// #include "wx/cocoa/NSStepper.h" - -// ======================================================================== -// wxSpinButton -// ======================================================================== -class WXDLLIMPEXP_CORE wxSpinButton: public wxSpinButtonBase// , protected wxCocoaNSStepper -{ - DECLARE_DYNAMIC_CLASS(wxSpinButton) - DECLARE_EVENT_TABLE() -// WX_DECLARE_COCOA_OWNER(NSStepper,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxSpinButton() { } - wxSpinButton(wxWindow *parent, wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, - const wxString& name = wxSPIN_BUTTON_NAME) - { - Create(parent, winid, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_HORIZONTAL, - const wxString& name = wxSPIN_BUTTON_NAME); - virtual ~wxSpinButton(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - virtual void CocoaTarget_action(); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // Pure Virtuals - virtual int GetValue() const; - virtual void SetValue(int value); - - // retrieve/change the range - virtual void SetRange(int minValue, int maxValue); -}; - -#endif - // __WX_COCOA_SPINBUTT_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/statbmp.h b/Externals/wxWidgets3/include/wx/cocoa/statbmp.h deleted file mode 100644 index f06b129d9f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/statbmp.h +++ /dev/null @@ -1,59 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/statbmp.h -// Purpose: wxStaticBitmap class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_STATBMP_H__ -#define __WX_COCOA_STATBMP_H__ - -DECLARE_WXCOCOA_OBJC_CLASS(NSImageView); - -// ======================================================================== -// wxStaticBitmap -// ======================================================================== -class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase //, protected wxCocoaNSxxx -{ - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - DECLARE_EVENT_TABLE() -// WX_DECLARE_COCOA_OWNER(NSxxx,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxStaticBitmap() {} - wxStaticBitmap(wxWindow *parent, wxWindowID winid, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Create(parent, winid, bitmap, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxBitmap& bitmap, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxStaticBitmapNameStr); - virtual ~wxStaticBitmap(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ - WX_NSImageView GetNSImageView() { return (WX_NSImageView)m_cocoaNSView; } - wxBitmap m_bitmap; - -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ - virtual void SetIcon(const wxIcon& icon); - virtual void SetBitmap(const wxBitmap& bitmap); - virtual wxBitmap GetBitmap() const; -}; - -#endif // __WX_COCOA_STATBMP_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/statbox.h b/Externals/wxWidgets3/include/wx/cocoa/statbox.h deleted file mode 100644 index f19579850c..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/statbox.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/statbox.h -// Purpose: wxStaticBox class -// Author: David Elliott -// Modified by: -// Created: 2003/03/18 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_STATBOX_H__ -#define __WX_COCOA_STATBOX_H__ - -#include "wx/cocoa/NSBox.h" - -// ======================================================================== -// wxStaticBox -// ======================================================================== -class WXDLLIMPEXP_CORE wxStaticBox: public wxStaticBoxBase, protected wxCocoaNSBox -{ - DECLARE_DYNAMIC_CLASS(wxStaticBox) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSBox,NSView,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxStaticBox() { } - wxStaticBox(wxWindow *parent, wxWindowID winid, const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxStaticBoxNameStr) - { - Create(parent, winid, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxStaticBoxNameStr); - virtual ~wxStaticBox(); - - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // Static boxes cannot be enabled/disabled - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; -protected: -}; - -#endif // __WX_COCOA_STATBOX_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/statline.h b/Externals/wxWidgets3/include/wx/cocoa/statline.h deleted file mode 100644 index 3834a37637..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/statline.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/statline.h -// Purpose: wxStaticLine class -// Author: David Elliott -// Modified by: -// Created: 2003/03/18 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_STATLINE_H__ -#define __WX_COCOA_STATLINE_H__ - -// #include "wx/cocoa/NSButton.h" - -// ======================================================================== -// wxStaticLine -// ======================================================================== -class WXDLLIMPEXP_CORE wxStaticLine: public wxStaticLineBase// , protected wxCocoaNSButton -{ - DECLARE_DYNAMIC_CLASS(wxStaticLine) - DECLARE_EVENT_TABLE() -// WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxStaticLine() { } - wxStaticLine(wxWindow *parent, wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxStaticLineNameStr) - { - Create(parent, winid, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxStaticLineNameStr); - virtual ~wxStaticLine(); - -// ------------------------------------------------------------------------ -// Cocoa callbacks -// ------------------------------------------------------------------------ -protected: - // Static lines cannot be enabled/disabled - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: -}; - -#endif // __WX_COCOA_STATLINE_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/stattext.h b/Externals/wxWidgets3/include/wx/cocoa/stattext.h deleted file mode 100644 index 176d53a0be..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/stattext.h +++ /dev/null @@ -1,58 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/stattext.h -// Purpose: wxStaticText class -// Author: David Elliott -// Modified by: -// Created: 2003/02/15 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_STATTEXT_H__ -#define __WX_COCOA_STATTEXT_H__ - -#include "wx/cocoa/NSTextField.h" - -// ======================================================================== -// wxStaticText -// ======================================================================== -class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase, protected wxCocoaNSTextField -{ - DECLARE_DYNAMIC_CLASS(wxStaticText) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxStaticText() {} - wxStaticText(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxStaticTextNameStr) - { - Create(parent, winid, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxStaticTextNameStr); - virtual ~wxStaticText(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_didChangeText(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; -}; - -#endif // __WX_COCOA_STATTEXT_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/string.h b/Externals/wxWidgets3/include/wx/cocoa/string.h deleted file mode 100644 index 65112a053a..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/string.h +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/string.h -// Purpose: String conversion methods -// Author: David Elliott -// Modified by: -// Created: 2003/04/13 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_STRING_H__ -#define __WX_COCOA_STRING_H__ - -#import -#include "wx/string.h" - -// FIXME: In unicode mode we are doing the conversion twice. wxString -// converts to UTF-8 and NSString converts from UTF-8. -// One possible optimization is to convert to the wxString internal -// representation which is an unsigned short (unichar) but unfortunately -// there is little documentation on which encoding it uses by default. - -// Return an autoreleased NSString -inline NSString* wxNSStringWithWxString(const wxString &wxstring) -{ -#if wxUSE_UNICODE - return [NSString stringWithUTF8String: wxstring.utf8_str()]; -#else - return [NSString stringWithCString: wxstring.c_str() length:wxstring.Len()]; -#endif // wxUSE_UNICODE -} - -// Intialize an NSString which has already been allocated -inline NSString* wxInitNSStringWithWxString(NSString *nsstring, const wxString &wxstring) -{ -#if wxUSE_UNICODE - return [nsstring initWithUTF8String: wxstring.utf8_str()]; -#else - return [nsstring initWithCString: wxstring.c_str() length:wxstring.Len()]; -#endif // wxUSE_UNICODE -} - -inline wxString wxStringWithNSString(NSString *nsstring) -{ -#if wxUSE_UNICODE - return wxString::FromUTF8Unchecked([nsstring UTF8String]); -#else - return wxString([nsstring lossyCString]); -#endif // wxUSE_UNICODE -} - -#endif // __WX_COCOA_STRING_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/taskbar.h b/Externals/wxWidgets3/include/wx/cocoa/taskbar.h deleted file mode 100644 index 9c52bfc6c8..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/taskbar.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// File: wx/cocoa/taskbar.h -// Purpose: Defines wxTaskBarIcon class -// Author: David Elliott -// Modified by: -// Created: 2004/01/24 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_TASKBAR_H__ -#define _WX_COCOA_TASKBAR_H__ - -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxMenu; - -class wxTaskBarIconCocoaImpl; - -class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase -{ - friend class wxTaskBarIconCocoaImpl; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) -public: - //type of taskbar item to create (currently only DOCK is implemented) - enum wxTaskBarIconType - { DOCK - , CUSTOM_STATUSITEM -// , STATUSITEM // TODO: Implement using NSStatusItem w/o custom NSView -// , MENUEXTRA // Menu extras require undocumented hacks - , DEFAULT_TYPE = CUSTOM_STATUSITEM - }; - - // Only one wxTaskBarIcon can be of the Dock type so by default - // create NSStatusItem for maximum source compatibility. - wxTaskBarIcon(wxTaskBarIconType iconType = DEFAULT_TYPE); - virtual ~wxTaskBarIcon(); - - bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - bool RemoveIcon(); - bool PopupMenu(wxMenu *menu); //, int x, int y); -protected: - wxTaskBarIconCocoaImpl *m_impl; -}; - -#endif // _WX_COCOA_TASKBAR_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/textctrl.h b/Externals/wxWidgets3/include/wx/cocoa/textctrl.h deleted file mode 100644 index d7b8c0aa7c..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/textctrl.h +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/textctrl.h -// Purpose: wxTextCtrl class -// Author: David Elliott -// Modified by: -// Created: 2003/03/16 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_TEXTCTRL_H__ -#define __WX_COCOA_TEXTCTRL_H__ - -#include "wx/cocoa/NSTextField.h" - -// ======================================================================== -// wxTextCtrl -// ======================================================================== -class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, protected wxCocoaNSTextField -{ - DECLARE_DYNAMIC_CLASS(wxTextCtrl) - DECLARE_EVENT_TABLE() - WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxTextCtrl() {} - wxTextCtrl(wxWindow *parent, wxWindowID winid, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - { - Create(parent, winid, value, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - virtual ~wxTextCtrl(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -protected: - virtual void Cocoa_didChangeText(void); - virtual void CocoaTarget_action(void); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual wxString GetValue() const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); -// virtual void SelectAll(); - virtual void SetEditable(bool editable); - -protected: - virtual wxSize DoGetBestSize() const; - - virtual void DoSetValue(const wxString& value, int flags = 0); -}; - -#endif // __WX_COCOA_TEXTCTRL_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/toolbar.h b/Externals/wxWidgets3/include/wx/cocoa/toolbar.h deleted file mode 100644 index ce57dee03f..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/toolbar.h +++ /dev/null @@ -1,120 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/toolbar.h -// Purpose: wxToolBar -// Author: David Elliott -// Modified by: -// Created: 2003/08/17 -// Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_TOOLBAR_H__ -#define __WX_COCOA_TOOLBAR_H__ - -#if wxUSE_TOOLBAR - -// ======================================================================== -// wxToolBar -// ======================================================================== -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef struct CGPoint NSPoint; -#else -typedef struct _NSPoint NSPoint; -#endif - -class wxToolBarTool; - -class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase -{ - DECLARE_DYNAMIC_CLASS(wxToolBar) -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxToolBar() { Init(); } - wxToolBar( wxWindow *parent, - wxWindowID toolid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr ) - { - Init(); - - Create(parent, toolid, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID toolid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxToolBarNameStr ); - - virtual ~wxToolBar(); - -protected: - // common part of all ctors - void Init(); - -// ------------------------------------------------------------------------ -// Cocoa -// ------------------------------------------------------------------------ -protected: - virtual bool Cocoa_acceptsFirstMouse(bool &acceptsFirstMouse, WX_NSEvent theEvent); - virtual bool Cocoa_drawRect(const NSRect &rect); - virtual bool Cocoa_mouseDown(WX_NSEvent theEvent); - virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent); - wxToolBarTool *CocoaFindToolForPosition(const NSPoint& pos) const; - void CocoaToolClickEnded(); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - // override base class virtuals - virtual void SetMargins(int x, int y); - virtual void SetToolSeparation(int separation); - - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual void SetToolShortHelp(int toolid, const wxString& helpString); - - virtual void SetWindowStyleFlag( long style ); - - // implementation from now on - // -------------------------- - - void OnInternalIdle(); - virtual bool Realize(); - virtual wxSize DoGetBestSize() const; - - void SetOwningFrame(wxFrame *owningFrame) - { m_owningFrame = owningFrame; } -protected: - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); - - virtual wxToolBarToolBase *CreateTool(int toolid, - 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); - - wxSize m_bestSize; - wxFrame *m_owningFrame; - wxToolBarTool *m_mouseDownTool; -}; - -#endif // wxUSE_TOOLBAR - -#endif // __WX_COCOA_TOOLBAR_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/tooltip.h b/Externals/wxWidgets3/include/wx/cocoa/tooltip.h deleted file mode 100644 index a096a54236..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/tooltip.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/tooltip.h -// Purpose: wxToolTip class - tooltip control -// Author: Ryan Norton -// Modified by: -// Created: 31.01.99 -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_COCOA_TOOLTIP_H_ -#define _WX_COCOA_TOOLTIP_H_ - -#include "wx/object.h" - -class wxWindow; - -class wxToolTip : public wxObject -{ -public: - // ctor & dtor - wxToolTip(const wxString &tip); - virtual ~wxToolTip(); - - // accessors - // tip text - void SetTip(const wxString& tip); - const wxString& GetTip() const; - - // the window we're associated with - wxWindow *GetWindow() const; - - // controlling tooltip behaviour: globally change tooltip parameters - // enable or disable the tooltips globally - static void Enable(bool flag); - // set the delay after which the tooltip appears - static void SetDelay(long milliseconds); - // set the delay after which the tooltip disappears or how long the tooltip remains visible - static void SetAutoPop(long milliseconds); - // set the delay between subsequent tooltips to appear - static void SetReshow(long milliseconds); - -private: - void SetWindow(wxWindow* window); - - friend class wxWindow; - - wxString m_text; // tooltip text - wxWindow *m_window; // window we're associated with - - DECLARE_ABSTRACT_CLASS(wxToolTip) -}; - -#endif // _WX_COCOA_TOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/toplevel.h b/Externals/wxWidgets3/include/wx/cocoa/toplevel.h deleted file mode 100644 index d0768294d3..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/toplevel.h +++ /dev/null @@ -1,130 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/toplevel.h -// Purpose: wxTopLevelWindowCocoa is the Cocoa implementation of wxTLW -// Author: David Elliott -// Modified by: -// Created: 2002/12/08 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_TOPLEVEL_H__ -#define __WX_COCOA_TOPLEVEL_H__ - -#include "wx/hashmap.h" -#include "wx/cocoa/NSWindow.h" - -class WXDLLIMPEXP_FWD_CORE wxMenuBar; - -// ======================================================================== -// wxTopLevelWindowCocoa -// ======================================================================== -class WXDLLIMPEXP_CORE wxTopLevelWindowCocoa : public wxTopLevelWindowBase, protected wxCocoaNSWindow -{ - DECLARE_EVENT_TABLE(); - DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa); -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - inline wxTopLevelWindowCocoa() - : wxCocoaNSWindow(this) - { Init(); } - - inline wxTopLevelWindowCocoa(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - : wxCocoaNSWindow(this) - { - Init(); - Create(parent, winid, title, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID winid, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxTopLevelWindowCocoa(); - -protected: - // common part of all ctors - void Init(); - -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; } - virtual void CocoaDelegate_windowWillClose(void); - virtual bool CocoaDelegate_windowShouldClose(void); - virtual void CocoaDelegate_windowDidBecomeKey(void); - virtual void CocoaDelegate_windowDidResignKey(void); - virtual void CocoaDelegate_windowDidBecomeMain(void); - virtual void CocoaDelegate_windowDidResignMain(void); - virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem sender); - virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem sender); - virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); - static void DeactivatePendingWindow(); -protected: - void SetNSWindow(WX_NSWindow cocoaNSWindow); - WX_NSWindow m_cocoaNSWindow; - static wxCocoaNSWindowHash sm_cocoaHash; - virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); - static unsigned int NSWindowStyleForWxStyle(long style); - static NSRect MakeInitialNSWindowContentRect(const wxPoint& pos, const wxSize& size, unsigned int cocoaStyleMask); - - static wxTopLevelWindowCocoa *sm_cocoaDeactivateWindow; -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - virtual bool Destroy(); - // Pure virtuals - virtual void Maximize(bool maximize = true); - virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = true); - virtual bool IsIconized() const; - virtual void Restore(); - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual bool IsFullScreen() const; - // other - virtual bool Show( bool show = true ); - virtual bool Close( bool force = false ); - virtual void OnCloseWindow(wxCloseEvent& event); - virtual void CocoaSetWxWindowSize(int width, int height); - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetPosition(int *x, int *y) const; - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - - // Default button (item) - wxWindow *SetDefaultItem(wxWindow *win); - -// Things I may/may not do -// virtual void SetIcons(const wxIconBundle& icons); -// virtual void Clear() ; -// virtual void Raise(); -// virtual void Lower(); -protected: - // is the frame currently iconized? - bool m_iconized; - // has the frame been closed - bool m_closed; - // should the frame be maximized when it will be shown? set by Maximize() - // when it is called while the frame is hidden - bool m_maximizeOnShow; -}; - -// list of all frames and modeless dialogs -extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; - -#endif // __WX_COCOA_TOPLEVEL_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/trackingrectmanager.h b/Externals/wxWidgets3/include/wx/cocoa/trackingrectmanager.h deleted file mode 100644 index eac59b07b4..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/trackingrectmanager.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/trackingrectmanager.h -// Purpose: wxCocoaTrackingRectManager -// Notes: Source in window.mm -// Author: David Elliott -// Modified by: -// Created: 2007/05/02 -// Copyright: (c) 2007 Software 2000 Ltd. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -#ifndef __WX_COCOA_TRACKINGRECTMANAGER_H__ -#define __WX_COCOA_TRACKINGRECTMANAGER_H__ - -#include - -#define wxTRACE_COCOA_TrackingRect wxT("COCOA_TrackingRect") - -class wxCocoaTrackingRectManager -{ - wxDECLARE_NO_COPY_CLASS(wxCocoaTrackingRectManager); -public: - wxCocoaTrackingRectManager(wxWindow *window); - void ClearTrackingRect(); - void BuildTrackingRect(); - void RebuildTrackingRectIfNeeded(); - void RebuildTrackingRect(); - bool IsOwnerOfEvent(NSEvent *anEvent); - ~wxCocoaTrackingRectManager(); - void BeginSynthesizingEvents(); - void StopSynthesizingEvents(); -protected: - wxWindow *m_window; - bool m_isTrackingRectActive; - NSInteger m_trackingRectTag; - NSRect m_trackingRectInWindowCoordinates; -private: - wxCocoaTrackingRectManager(); -}; - -#endif // ndef __WX_COCOA_TRACKINGRECTMANAGER_H__ diff --git a/Externals/wxWidgets3/include/wx/cocoa/window.h b/Externals/wxWidgets3/include/wx/cocoa/window.h deleted file mode 100644 index a060f37892..0000000000 --- a/Externals/wxWidgets3/include/wx/cocoa/window.h +++ /dev/null @@ -1,226 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/window.h -// Purpose: wxWindowCocoa -// Author: David Elliott -// Modified by: -// Created: 2002/12/26 -// Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef __WX_COCOA_WINDOW_H__ -#define __WX_COCOA_WINDOW_H__ - -#include "wx/cocoa/NSView.h" - -#ifdef __OBJC__ - #import -#endif //def __OBJC__ - -// We can only import Foundation/NSGeometry.h from Objective-C code but it's -// nice to be able to use NSPoint and NSRect in the declarations of helper -// methods so we must define them as opaque structs identically to the way -// they are defined by the real header. -// NOTE: We specifically use these regardless of C++ or Objective-C++ mode so -// the compiler will complain if we got the definitions wrong. In regular -// C++ mode there is no way to know if we got the definitons right so -// we depend on at least one Objective-C++ file including this header. -#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) -typedef struct CGPoint NSPoint; -typedef struct CGRect NSRect; -#else -typedef struct _NSPoint NSPoint; -typedef struct _NSRect NSRect; -#endif - -DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform); - -class wxWindowCocoaHider; -class wxWindowCocoaScrollView; -class wxCocoaTrackingRectManager; - -// ======================================================================== -// wxWindowCocoa -// ======================================================================== -class WXDLLIMPEXP_CORE wxWindowCocoa: public wxWindowBase, protected wxCocoaNSView -{ - DECLARE_DYNAMIC_CLASS(wxWindowCocoa) - wxDECLARE_NO_COPY_CLASS(wxWindowCocoa); - DECLARE_EVENT_TABLE() - friend wxWindow *wxWindowBase::GetCapture(); - friend class wxWindowCocoaScrollView; - friend class wxCocoaTrackingRectManager; -// ------------------------------------------------------------------------ -// initialization -// ------------------------------------------------------------------------ -public: - wxWindowCocoa() { Init(); } - inline wxWindowCocoa(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - Create(parent, winid, pos, size, style, name); - } - - virtual ~wxWindowCocoa(); - - bool Create(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); -protected: - void Init(); -// ------------------------------------------------------------------------ -// Cocoa specifics -// ------------------------------------------------------------------------ -public: - // Returns the content NSView (where children are added, drawing performed) - inline WX_NSView GetNSView() { return m_cocoaNSView; } - // Returns the NSView suitable for use as a subview - WX_NSView GetNSViewForSuperview() const; - // Returns the NSView that may be hidden/is being hidden - WX_NSView GetNSViewForHiding() const; - // Returns the NSView for non-client drawing - virtual WX_NSView GetNonClientNSView() { return GetNSViewForSuperview(); } - // Add/remove children - void CocoaAddChild(wxWindowCocoa *child); - void CocoaRemoveFromParent(void); -#ifdef __OBJC__ - // Returns an autoreleased NSAffineTransform which can be applied - // to a graphics context currently using the view's coordinate system - // (such as the one locked when drawRect is called or after a call - // to [NSView lockFocus]) such that further drawing is done using - // the wxWidgets coordinate system. - WX_NSAffineTransform CocoaGetWxToBoundsTransform(); -#endif //def __OBJC__ -protected: - // actually enable/disable the cocoa control, overridden by subclasses - virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } - - void CocoaCreateNSScrollView(); - void InitMouseEvent(wxMouseEvent &event, WX_NSEvent cocoaEvent); - virtual wxWindow* GetWxWindow() const; - virtual void Cocoa_FrameChanged(void); - virtual void Cocoa_synthesizeMouseMoved(void); - virtual bool Cocoa_drawRect(const NSRect &rect); - virtual bool Cocoa_mouseDown(WX_NSEvent theEvent); - virtual bool Cocoa_mouseDragged(WX_NSEvent theEvent); - virtual bool Cocoa_mouseUp(WX_NSEvent theEvent); - virtual bool Cocoa_mouseMoved(WX_NSEvent theEvent); - virtual bool Cocoa_mouseEntered(WX_NSEvent theEvent); - virtual bool Cocoa_mouseExited(WX_NSEvent theEvent); - virtual bool Cocoa_rightMouseDown(WX_NSEvent theEvent); - virtual bool Cocoa_rightMouseDragged(WX_NSEvent theEvent); - virtual bool Cocoa_rightMouseUp(WX_NSEvent theEvent); - virtual bool Cocoa_otherMouseDown(WX_NSEvent theEvent); - virtual bool Cocoa_otherMouseDragged(WX_NSEvent theEvent); - virtual bool Cocoa_otherMouseUp(WX_NSEvent theEvent); - virtual bool Cocoa_resetCursorRects(); - virtual bool Cocoa_viewDidMoveToWindow(); - virtual bool Cocoa_viewWillMoveToWindow(WX_NSWindow newWindow); - void SetNSView(WX_NSView cocoaNSView); - WX_NSView m_cocoaNSView; - wxWindowCocoaHider *m_cocoaHider; - wxWindowCocoaScrollView *m_wxCocoaScrollView; - bool m_isInPaint; - wxCocoaTrackingRectManager *m_visibleTrackingRectManager; - static wxWindow *sm_capturedWindow; - virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView); - void SetInitialFrameRect(const wxPoint& pos, const wxSize& size); -#ifdef __OBJC__ - inline NSRect MakeDefaultNSRect(const wxSize& size) - { - // NOTE: position is 10,10 to make it "obvious" that it's out of place - return NSMakeRect(10.0,10.0,WidthDefault(size.x),HeightDefault(size.y)); - } - // These functions translate NSPoint or NSRect between the coordinate - // system of Cocoa's boudns rect and wx's coordinate system. - NSPoint CocoaTransformBoundsToWx(NSPoint pointBounds); - NSRect CocoaTransformBoundsToWx(NSRect rectBounds); - NSPoint CocoaTransformWxToBounds(NSPoint pointWx); - NSRect CocoaTransformWxToBounds(NSRect rectWx); -#endif //def __OBJC__ - static wxPoint OriginInWxDisplayCoordinatesForRectInCocoaScreenCoordinates(NSRect windowFrame); - static NSPoint OriginInCocoaScreenCoordinatesForRectInWxDisplayCoordinates(wxCoord x, wxCoord y, wxCoord width, wxCoord height, bool keepOriginVisible); -// ------------------------------------------------------------------------ -// Implementation -// ------------------------------------------------------------------------ -public: - /* Pure Virtuals */ - // Raise the window to the top of the Z order - virtual void Raise(); - // Lower the window to the bottom of the Z order - virtual void Lower(); - // Set the focus to this window - virtual void SetFocus(); - // Warp the pointer the given position - virtual void WarpPointer(int x_pos, int y_pos) ; - // Change the window's cursor - virtual bool SetCursor( const wxCursor &cursor ); - // Send the window a refresh event - virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); - // Set/get the window's font - virtual bool SetFont(const wxFont& f); -// inline virtual wxFont& GetFont() const; - virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const; - // label handling - // Get character size - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void DoGetTextExtent(const wxString& string, int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL) const; - // Scroll stuff - virtual void SetScrollbar(int orient, int pos, int thumbVisible, - int range, bool refresh = true); - virtual void SetScrollPos(int orient, int pos, bool refresh = true); - virtual int GetScrollPos(int orient) const; - virtual int GetScrollThumb(int orient) const; - virtual int GetScrollRange(int orient) const; - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); - virtual void DoSetVirtualSize(int x, int y); - // Get the private handle (platform-dependent) - virtual WXWidget GetHandle() const; - // Convert client to screen coordinates - virtual void DoClientToScreen(int *x, int *y) const; - // Convert screen to client coordinates - virtual void DoScreenToClient(int *x, int *y) const; - // Capture/release mouse - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); - // Get window position, relative to parent (or screen if no parent) - virtual void DoGetPosition(int *x, int *y) const; - // Get overall window size - virtual void DoGetSize(int *width, int *height) const; - // Get/set client (application-useable) size - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int size); - // Set this window's tooltip - virtual void DoSetToolTip( wxToolTip *tip ); - // Set the size of the wxWindow (the contentView of an NSWindow) - // wxTopLevelWindow will override this and set the NSWindow size - // such that the contentView will be this size - virtual void CocoaSetWxWindowSize(int width, int height); - // Set overall size and position - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void DoMoveWindow(int x, int y, int width, int height); - // Popup a menu - virtual bool DoPopupMenu(wxMenu *menu, int x, int y); - - /* Other implementation */ - - // NOTE: typically Close() is not virtual, but we want this for Cocoa - virtual bool Close( bool force = false ); - virtual bool Show( bool show = true ); - virtual void DoEnable( bool enable ); - - virtual bool IsDoubleBuffered() const { return true; } -}; - -#endif // __WX_COCOA_WINDOW_H__ diff --git a/Externals/wxWidgets3/include/wx/collheaderctrl.h b/Externals/wxWidgets3/include/wx/collheaderctrl.h new file mode 100644 index 0000000000..2364218d8e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/collheaderctrl.h @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/collheaderctrl.h +// Purpose: wxCollapsibleHeaderCtrl +// Author: Tobias Taschner +// Created: 2015-09-19 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLLAPSIBLEHEADER_CTRL_H_ +#define _WX_COLLAPSIBLEHEADER_CTRL_H_ + +#include "wx/defs.h" + +#if wxUSE_COLLPANE + +#include "wx/control.h" + +// class name +extern WXDLLIMPEXP_DATA_CORE(const char) wxCollapsibleHeaderCtrlNameStr[]; + +// +// wxGenericCollapsibleHeaderCtrl +// + +class WXDLLIMPEXP_CORE wxCollapsibleHeaderCtrlBase : public wxControl +{ +public: + wxCollapsibleHeaderCtrlBase() { } + + wxCollapsibleHeaderCtrlBase(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCollapsibleHeaderCtrlNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCollapsibleHeaderCtrlNameStr) + { + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) + return false; + + SetLabel(label); + + return true; + } + + virtual void SetCollapsed(bool collapsed = true) = 0; + + virtual bool IsCollapsed() const = 0; + +private: + + wxDECLARE_NO_COPY_CLASS(wxCollapsibleHeaderCtrlBase); +}; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COLLAPSIBLEHEADER_CHANGED, wxCommandEvent); + +#define wxCollapsibleHeaderChangedHandler(func) \ + wxEVENT_HANDLER_CAST(wxCommandEventFunction, func) + +#define EVT_COLLAPSIBLEHEADER_CHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_COLLAPSIBLEHEADER_CHANGED, id, wxCollapsibleHeaderChangedHandler(fn)) + +// Currently there is only the native implementation, use it for all ports. + +#include "wx/generic/collheaderctrl.h" + +class WXDLLIMPEXP_CORE wxCollapsibleHeaderCtrl + : public wxGenericCollapsibleHeaderCtrl +{ +public: + wxCollapsibleHeaderCtrl() { } + + wxCollapsibleHeaderCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCollapsibleHeaderCtrlNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + +private: + + wxDECLARE_NO_COPY_CLASS(wxCollapsibleHeaderCtrl); +}; + +#endif // wxUSE_COLLPANE + +#endif // _WX_COLLAPSIBLEHEADER_CTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/collpane.h b/Externals/wxWidgets3/include/wx/collpane.h index 40c8939b01..4a66f124f9 100644 --- a/Externals/wxWidgets3/include/wx/collpane.h +++ b/Externals/wxWidgets3/include/wx/collpane.h @@ -70,12 +70,12 @@ public: // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxCollapsiblePaneEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCollapsiblePaneEvent(*this); } private: bool m_bCollapsed; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCollapsiblePaneEvent); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/colordlg.h b/Externals/wxWidgets3/include/wx/colordlg.h index b4156d1460..7eb7cc9a42 100644 --- a/Externals/wxWidgets3/include/wx/colordlg.h +++ b/Externals/wxWidgets3/include/wx/colordlg.h @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/colordlg.h // Purpose: wxColourDialog -// Author: Vadim Zeitiln +// Author: Vadim Zeitlin // Modified by: // Created: 01/02/97 // Copyright: (c) wxWidgets team @@ -23,6 +23,8 @@ #include "wx/osx/colordlg.h" #elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #include "wx/gtk/colordlg.h" +#elif defined(__WXQT__) + #include "wx/qt/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 eec5542803..1651f63d44 100644 --- a/Externals/wxWidgets3/include/wx/colour.h +++ b/Externals/wxWidgets3/include/wx/colour.h @@ -65,7 +65,7 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE) not need the wxGDIObject machinery to handle colors, please add it to the list of ports which do not need it. */ -#if defined( __WXMAC__ ) || defined( __WXMSW__ ) || defined( __WXPM__ ) || defined( __WXCOCOA__ ) +#if defined( __WXMAC__ ) || defined( __WXMSW__ ) #define wxCOLOUR_IS_GDIOBJECT 0 #else #define wxCOLOUR_IS_GDIOBJECT 1 @@ -168,14 +168,6 @@ public: wxColour ChangeLightness(int ialpha) const; wxColour& MakeDisabled(unsigned char brightness = 255); - // old, deprecated - // --------------- - -#if WXWIN_COMPATIBILITY_2_6 - static wxDEPRECATED( wxColour CreateByName(const wxString& name) ); - wxDEPRECATED( void InitFromName(const wxString& col) ); -#endif - protected: // Some ports need Init() and while we don't, provide a stub so that the // ports which don't need it are not forced to define it @@ -190,14 +182,14 @@ protected: // wxColour doesn't use reference counted data (at least not in all ports) // so provide stubs for the functions which need to be defined if we do use // them - virtual wxGDIRefData *CreateGDIRefData() const + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE { wxFAIL_MSG( "must be overridden if used" ); return NULL; } - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *WXUNUSED(data)) const wxOVERRIDE { wxFAIL_MSG( "must be overridden if used" ); @@ -227,10 +219,8 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxColourBase* col); #include "wx/x11/colour.h" #elif defined(__WXMAC__) #include "wx/osx/colour.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/colour.h" -#elif defined(__WXPM__) - #include "wx/os2/colour.h" +#elif defined(__WXQT__) + #include "wx/qt/colour.h" #endif #define wxColor wxColour diff --git a/Externals/wxWidgets3/include/wx/colourdata.h b/Externals/wxWidgets3/include/wx/colourdata.h index 5a755ae078..d05a9a37b4 100644 --- a/Externals/wxWidgets3/include/wx/colourdata.h +++ b/Externals/wxWidgets3/include/wx/colourdata.h @@ -26,6 +26,8 @@ public: void SetChooseFull(bool flag) { m_chooseFull = flag; } bool GetChooseFull() const { return m_chooseFull; } + void SetChooseAlpha(bool flag) { m_chooseAlpha = flag; } + bool GetChooseAlpha() const { return m_chooseAlpha; } void SetColour(const wxColour& colour) { m_dataColour = colour; } const wxColour& GetColour() const { return m_dataColour; } wxColour& GetColour() { return m_dataColour; } @@ -45,7 +47,10 @@ public: wxColour m_custColours[NUM_CUSTOM]; bool m_chooseFull; - DECLARE_DYNAMIC_CLASS(wxColourData) +protected: + bool m_chooseAlpha; + + wxDECLARE_DYNAMIC_CLASS(wxColourData); }; #endif // _WX_COLOURDATA_H_ diff --git a/Externals/wxWidgets3/include/wx/combo.h b/Externals/wxWidgets3/include/wx/combo.h index 6a040b3d22..29cd02e819 100644 --- a/Externals/wxWidgets3/include/wx/combo.h +++ b/Externals/wxWidgets3/include/wx/combo.h @@ -45,6 +45,7 @@ #include "wx/renderer.h" // this is needed for wxCONTROL_XXX flags #include "wx/bitmap.h" // wxBitmap used by-value #include "wx/textentry.h" +#include "wx/time.h" // needed for wxMilliClock_t class WXDLLIMPEXP_FWD_CORE wxTextCtrl; class WXDLLIMPEXP_FWD_CORE wxComboPopup; @@ -204,9 +205,9 @@ public: wxWindow *GetButton() const { return m_btn; } // forward these methods to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - virtual bool SetFont(const wxFont& font); + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; // // wxTextEntry methods @@ -214,49 +215,49 @@ public: // NB: We basically need to override all of them because there is // no guarantee how platform-specific wxTextEntry is implemented. // - virtual void SetValue(const wxString& value) + virtual void SetValue(const wxString& value) wxOVERRIDE { wxTextEntryBase::SetValue(value); } - virtual void ChangeValue(const wxString& value) + virtual void ChangeValue(const wxString& value) wxOVERRIDE { wxTextEntryBase::ChangeValue(value); } - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text) + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE { wxTextEntryBase::AppendText(text); } - virtual wxString GetValue() const + virtual wxString GetValue() const wxOVERRIDE { return wxTextEntryBase::GetValue(); } - virtual wxString GetRange(long from, long to) const + virtual wxString GetRange(long from, long to) const wxOVERRIDE { return wxTextEntryBase::GetRange(from, to); } // Replace() and DoSetValue() need to be fully re-implemented since // EventSuppressor utility class does not work with the way // wxComboCtrl is implemented. - virtual void Replace(long from, long to, const wxString& value); + virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; - virtual void Remove(long from, long to); + virtual void Remove(long from, long to) wxOVERRIDE; - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; - virtual void SetSelection(long from, long to); - virtual void GetSelection(long *from, long *to) const; + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; // This method sets the text without affecting list selection // (ie. wxComboPopup::SetStringValue doesn't get called). @@ -467,12 +468,12 @@ public: void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; } // This is public so we can access it from wxComboCtrlTextCtrl - virtual wxWindow *GetMainWindowOfCompositeControl() + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return m_mainCtrlWnd; } // also set the embedded wxTextCtrl colours - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; protected: @@ -546,8 +547,8 @@ protected: // override the base class virtuals involved in geometry calculations // The common version only sets a default width, so the derived classes // should override it and set the height and change the width as needed. - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; // NULL popup can be used to indicate default in a derived class virtual void DoSetPopupControl(wxComboPopup* popup); @@ -598,17 +599,17 @@ protected: virtual bool AnimateShow( const wxRect& rect, int flags ); #if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; #endif // protected wxTextEntry methods - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const; - virtual wxWindow *GetEditableWindow() { return this; } + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } // margins functions - virtual bool DoSetMargins(const wxPoint& pt); - virtual wxPoint DoGetMargins() const; + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; // This is used when m_text is hidden (readonly). wxString m_valueString; @@ -647,7 +648,7 @@ protected: // 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; + wxMilliClock_t m_timeCanAcceptClick; // how much popup should expand to the left/right of the control wxCoord m_extLeft; @@ -727,9 +728,9 @@ private: // Is popup window wxPopupTransientWindow, wxPopupWindow or wxDialog? wxByte m_popupWinType; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_ABSTRACT_CLASS(wxComboCtrlBase) + wxDECLARE_ABSTRACT_CLASS(wxComboCtrlBase); }; diff --git a/Externals/wxWidgets3/include/wx/combobox.h b/Externals/wxWidgets3/include/wx/combobox.h index 93b3699553..4e9b64fdc8 100644 --- a/Externals/wxWidgets3/include/wx/combobox.h +++ b/Externals/wxWidgets3/include/wx/combobox.h @@ -33,7 +33,7 @@ class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer, { public: // override these methods to disambiguate between two base classes versions - virtual void Clear() + virtual void Clear() wxOVERRIDE { wxTextEntry::Clear(); wxItemContainer::Clear(); @@ -53,8 +53,8 @@ public: // but still make it pure virtual because for some platforms it's not // implemented there and also because the derived class has to override // it anyhow to avoid ambiguity with the other GetSelection() - virtual int GetSelection() const = 0; - virtual void GetSelection(long *from, long *to) const = 0; + virtual int GetSelection() const wxOVERRIDE = 0; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE = 0; virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); } virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); } @@ -81,10 +81,8 @@ public: #include "wx/gtk1/combobox.h" #elif defined(__WXMAC__) #include "wx/osx/combobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/combobox.h" -#elif defined(__WXPM__) - #include "wx/os2/combobox.h" +#elif defined(__WXQT__) + #include "wx/qt/combobox.h" #endif #endif // wxUSE_COMBOBOX diff --git a/Externals/wxWidgets3/include/wx/commandlinkbutton.h b/Externals/wxWidgets3/include/wx/commandlinkbutton.h index 0aaa0ec65a..bd4b5d2e23 100644 --- a/Externals/wxWidgets3/include/wx/commandlinkbutton.h +++ b/Externals/wxWidgets3/include/wx/commandlinkbutton.h @@ -120,7 +120,7 @@ public: const wxString& name = wxButtonNameStr); virtual void SetMainLabelAndNote(const wxString& mainLabel, - const wxString& note) + const wxString& note) wxOVERRIDE { wxButton::SetLabel(mainLabel + '\n' + note); } diff --git a/Externals/wxWidgets3/include/wx/compiler.h b/Externals/wxWidgets3/include/wx/compiler.h index 0be92d7da7..dfab0a25b4 100644 --- a/Externals/wxWidgets3/include/wx/compiler.h +++ b/Externals/wxWidgets3/include/wx/compiler.h @@ -35,12 +35,8 @@ define special symbols for different VC version instead of writing tests for magic numbers such as 1200, 1300 &c repeatedly */ -#if __VISUALC__ < 1100 -# error "This Visual C++ version is too old and not supported any longer." -#elif __VISUALC__ < 1200 -# define __VISUALC5__ -#elif __VISUALC__ < 1300 -# define __VISUALC6__ +#if __VISUALC__ < 1300 +# error "This Visual C++ version is not supported any longer (at least MSVC 2003 required)." #elif __VISUALC__ < 1400 # define __VISUALC7__ #elif __VISUALC__ < 1500 @@ -57,24 +53,19 @@ /* There is no __VISUALC13__! */ # define __VISUALC14__ #else + /* + Don't forget to update include/msvc/wx/setup.h as well when adding + support for a newer MSVC version here. + */ # pragma message("Please update wx/compiler.h to recognize this VC++ version") #endif #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) # define __BORLANDC__ -#elif defined(__WATCOMC__) -#elif defined(__SC__) -# define __SYMANTECC__ #elif defined(__SUNPRO_CC) # ifndef __SUNCC__ # define __SUNCC__ __SUNPRO_CC # endif /* Sun CC */ -#elif defined(__SC__) -# ifdef __DMC__ -# define __DIGITALMARS__ -# else -# define __SYMANTEC__ -# endif #endif /* compiler */ /* @@ -127,59 +118,9 @@ #define wxCHECK_SUNCC_VERSION(maj, min) (0) #endif -#ifndef __WATCOMC__ -# define wxWATCOM_VERSION(major,minor) 0 -# define wxCHECK_WATCOM_VERSION(major,minor) 0 -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) 0 -# define WX_WATCOM_ONLY_CODE( x ) -#else -# if __WATCOMC__ < 1200 -# error "Only Open Watcom is supported in this release" -# endif - -# define wxWATCOM_VERSION(major,minor) ( major * 100 + minor * 10 + 1100 ) -# define wxCHECK_WATCOM_VERSION(major,minor) ( __WATCOMC__ >= wxWATCOM_VERSION(major,minor) ) -# define wxONLY_WATCOM_EARLIER_THAN(major,minor) ( __WATCOMC__ < wxWATCOM_VERSION(major,minor) ) -# define WX_WATCOM_ONLY_CODE( x ) x -#endif - /* - This macro can be used to check that the version of mingw32 CRT is at least - maj.min + wxCHECK_MINGW32_VERSION() is defined in wx/msw/gccpriv.h which is included + later, see comments there. */ -/* Check for Mingw runtime version: */ -#ifdef __MINGW32__ - /* Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION */ - #include <_mingw.h> - - #define wxCHECK_MINGW32_VERSION( major, minor ) \ - ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ - || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) - -/* - MinGW-w64 project provides compilers for both Win32 and Win64 but only - defines the same __MINGW32__ symbol for the former as MinGW32 toolchain - which is quite different (notably doesn't provide many SDK headers that - MinGW-w64 does include). So we define a separate symbol which, unlike the - predefined __MINGW64__, can be used to detect this toolchain in both 32 and - 64 bit builds. - - And define __MINGW32_TOOLCHAIN__ for consistency and also because it's - convenient as we often want to have some workarounds only for the (old) - MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__. - */ -# ifdef __MINGW64_VERSION_MAJOR -# ifndef __MINGW64_TOOLCHAIN__ -# define __MINGW64_TOOLCHAIN__ -# endif -# else -# ifndef __MINGW32_TOOLCHAIN__ -# define __MINGW32_TOOLCHAIN__ -# endif -# endif -#else - #define wxCHECK_MINGW32_VERSION( major, minor ) (0) -#endif - #endif // _WX_COMPILER_H_ diff --git a/Externals/wxWidgets3/include/wx/compositewin.h b/Externals/wxWidgets3/include/wx/compositewin.h index a46c257708..0a9bbdff81 100644 --- a/Externals/wxWidgets3/include/wx/compositewin.h +++ b/Externals/wxWidgets3/include/wx/compositewin.h @@ -44,16 +44,6 @@ public: } -#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. @@ -104,7 +94,35 @@ public: return true; } + virtual void SetLayoutDirection(wxLayoutDirection dir) + { + BaseWindowClass::SetLayoutDirection(dir); + + SetForAllParts(&wxWindowBase::SetLayoutDirection, dir); + + // The child layout almost invariably depends on the layout direction, + // so redo it when it changes. + // + // However avoid doing it when we're called from wxWindow::Create() in + // wxGTK as the derived window is not fully created yet and calling its + // SetSize() may be unexpected. This does mean that any future calls to + // SetLayoutDirection(wxLayout_Default) wouldn't result in a re-layout + // neither, but then we're not supposed to be called with it at all. + if ( dir != wxLayout_Default ) + this->SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE); + } + #if wxUSE_TOOLTIPS + virtual void DoSetToolTipText(const wxString &tip) + { + BaseWindowClass::DoSetToolTipText(tip); + + // Use a variable to disambiguate between SetToolTip() overloads. + void (wxWindowBase::*func)(const wxString&) = &wxWindowBase::SetToolTip; + + SetForAllParts(func, tip); + } + virtual void DoSetToolTip(wxToolTip *tip) { BaseWindowClass::DoSetToolTip(tip); @@ -113,8 +131,6 @@ public: } #endif // wxUSE_TOOLTIPS -#endif // !__VISUALC6__ - virtual void SetFocus() { wxSetFocusToChild(this, NULL); @@ -190,21 +206,8 @@ private: event.Skip(); } -#ifndef __VISUALC6__ - template - 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) + template + void SetForAllParts(R (wxWindowBase::*func)(TArg), T arg) { // Simply call the setters for all parts of this composite window. const wxWindowList parts = GetCompositeWindowParts(); @@ -221,7 +224,6 @@ private: (child->*func)(arg); } } -#endif // !__VISUALC6__ wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCompositeWindow, W); }; diff --git a/Externals/wxWidgets3/include/wx/confbase.h b/Externals/wxWidgets3/include/wx/confbase.h index 9fd9df782a..714e3d0092 100644 --- a/Externals/wxWidgets3/include/wx/confbase.h +++ b/Externals/wxWidgets3/include/wx/confbase.h @@ -51,10 +51,8 @@ class WXDLLIMPEXP_FWD_BASE wxArrayString; // not all compilers can deal with template Read/Write() methods, define this // symbol if the template functions are available -#if (!defined(__VISUALC__) || __VISUALC__ > 1200) && \ - !defined( __VMS ) && \ - !(defined(__HP_aCC) && defined(__hppa)) && \ - !defined (__DMC__) +#if !defined( __VMS ) && \ + !(defined(__HP_aCC) && defined(__hppa)) #define wxHAS_CONFIG_TEMPLATE_RW #endif @@ -305,8 +303,8 @@ public: bool Write(const wxString& key, float value) { return DoWriteDouble(key, value); } - // Causes ambiguities in VC++ 6 and OpenVMS (at least) -#if ( (!defined(__VISUALC__) || __VISUALC__ > 1200) && !defined( __VMS ) && !defined (__DMC__)) + // Causes ambiguities in under OpenVMS +#if !defined( __VMS ) // for other types, use wxToString() template bool Write(const wxString& key, T const& value) @@ -403,7 +401,7 @@ private: // Style flag long m_style; - DECLARE_ABSTRACT_CLASS(wxConfigBase) + wxDECLARE_ABSTRACT_CLASS(wxConfigBase); }; // a handy little class which changes current path to the path of given entry diff --git a/Externals/wxWidgets3/include/wx/config.h b/Externals/wxWidgets3/include/wx/config.h index 4df4b8dd08..2a28e0715a 100644 --- a/Externals/wxWidgets3/include/wx/config.h +++ b/Externals/wxWidgets3/include/wx/config.h @@ -24,9 +24,6 @@ #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 #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 277909e559..784ff2fcd7 100644 --- a/Externals/wxWidgets3/include/wx/containr.h +++ b/Externals/wxWidgets3/include/wx/containr.h @@ -137,7 +137,7 @@ class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase { protected: // set the focus to the child which had it the last time - virtual bool SetFocusToChild(); + virtual bool SetFocusToChild() wxOVERRIDE; }; #else // !wxHAS_NATIVE_TAB_TRAVERSAL diff --git a/Externals/wxWidgets3/include/wx/control.h b/Externals/wxWidgets3/include/wx/control.h index cd7bc9e268..86563645e0 100644 --- a/Externals/wxWidgets3/include/wx/control.h +++ b/Externals/wxWidgets3/include/wx/control.h @@ -20,34 +20,11 @@ #if wxUSE_CONTROLS #include "wx/window.h" // base class +#include "wx/gdicmn.h" // wxEllipsize... extern WXDLLIMPEXP_DATA_CORE(const char) wxControlNameStr[]; -// ---------------------------------------------------------------------------- -// Ellipsize() constants -// ---------------------------------------------------------------------------- - -enum wxEllipsizeFlags -{ - wxELLIPSIZE_FLAGS_NONE = 0, - wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1, - wxELLIPSIZE_FLAGS_EXPAND_TABS = 2, - - wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS | - wxELLIPSIZE_FLAGS_EXPAND_TABS -}; - -// NB: Don't change the order of these values, they're the same as in -// PangoEllipsizeMode enum. -enum wxEllipsizeMode -{ - wxELLIPSIZE_NONE, - wxELLIPSIZE_START, - wxELLIPSIZE_MIDDLE, - wxELLIPSIZE_END -}; - // ---------------------------------------------------------------------------- // wxControl is the base class for all controls // ---------------------------------------------------------------------------- @@ -71,7 +48,7 @@ public: int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } // set label with mnemonics - virtual void SetLabel(const wxString& label) + virtual void SetLabel(const wxString& label) wxOVERRIDE { m_labelOrig = label; @@ -82,7 +59,7 @@ public: // return the original string, as it was passed to SetLabel() // (i.e. with wx-style mnemonics) - virtual wxString GetLabel() const { return m_labelOrig; } + virtual wxString GetLabel() const wxOVERRIDE { return m_labelOrig; } // set label text (mnemonics will be escaped) virtual void SetLabelText(const wxString& text) @@ -119,7 +96,7 @@ public: // controls by default inherit the colours of their parents, if a // particular control class doesn't want to do it, it can override // ShouldInheritColours() to return false - virtual bool ShouldInheritColours() const { return true; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return true; } // WARNING: this doesn't work for all controls nor all platforms! @@ -128,10 +105,10 @@ public: // if the button was clicked) virtual void Command(wxCommandEvent &event); - virtual bool SetFont(const wxFont& font); + virtual bool SetFont(const wxFont& font) wxOVERRIDE; // wxControl-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE; wxSize GetSizeFromTextSize(int xlen, int ylen = -1) const { return DoGetSizeFromTextSize(xlen, ylen); } @@ -176,7 +153,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; // creates the control (calls wxWindowBase::CreateBase inside) and adds it // to the list of parents children @@ -236,10 +213,8 @@ protected: #include "wx/gtk1/control.h" #elif defined(__WXMAC__) #include "wx/osx/control.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/control.h" -#elif defined(__WXPM__) - #include "wx/os2/control.h" +#elif defined(__WXQT__) + #include "wx/qt/control.h" #endif #endif // wxUSE_CONTROLS diff --git a/Externals/wxWidgets3/include/wx/convauto.h b/Externals/wxWidgets3/include/wx/convauto.h index 0912368f64..3da6c6adc4 100644 --- a/Externals/wxWidgets3/include/wx/convauto.h +++ b/Externals/wxWidgets3/include/wx/convauto.h @@ -71,14 +71,14 @@ public: // override the base class virtual function(s) to use our m_conv virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; - virtual size_t GetMBNulLen() const { return m_conv->GetMBNulLen(); } + virtual size_t GetMBNulLen() const wxOVERRIDE { return m_conv->GetMBNulLen(); } - virtual wxMBConv *Clone() const { return new wxConvAuto(*this); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvAuto(*this); } // return the BOM type of this buffer static wxBOM DetectBOM(const char *src, size_t srcLen); diff --git a/Externals/wxWidgets3/include/wx/cpp.h b/Externals/wxWidgets3/include/wx/cpp.h index b5ce014e4d..2c881c3591 100644 --- a/Externals/wxWidgets3/include/wx/cpp.h +++ b/Externals/wxWidgets3/include/wx/cpp.h @@ -58,7 +58,7 @@ should avoid doing it or provide unique prefixes then) but we have to do it differently for VC++ */ -#if defined(__VISUALC__) && (__VISUALC__ >= 1300) +#if defined(__VISUALC__) /* __LINE__ handling is completely broken in VC++ when using "Edit and Continue" (/ZI option) and results in preprocessor errors if we use it @@ -83,7 +83,7 @@ /* Helpers for defining macros that expand into a single statement. - The standatd solution is to use "do { ... } while (0)" statement but MSVC + The standard solution is to use "do { ... } while (0)" statement but MSVC generates a C4127 "condition expression is constant" warning for it so we use something which is just complicated enough to not be recognized as a constant but still simple enough to be optimized away. @@ -93,29 +93,16 @@ Notice that wxASSERT_ARG_TYPE in wx/strvargarg.h relies on these macros creating some kind of a loop because it uses "break". */ -#ifdef __WATCOMC__ - #define wxFOR_ONCE(name) for(int name=0; name<1; name++) - #define wxSTATEMENT_MACRO_BEGIN wxFOR_ONCE(wxMAKE_UNIQUE_NAME(wxmacro)) { - #define wxSTATEMENT_MACRO_END } -#else - #define wxSTATEMENT_MACRO_BEGIN do { - #define wxSTATEMENT_MACRO_END } while ( (void)0, 0 ) -#endif +#define wxSTATEMENT_MACRO_BEGIN do { +#define wxSTATEMENT_MACRO_END } while ( (void)0, 0 ) /* Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as NULL for the compilers which don't support the latter. */ #ifndef __WXFUNCTION__ - /* TODO: add more compilers supporting __FUNCTION__ */ - #if defined(__DMC__) - /* - __FUNCTION__ happens to be not defined within class members - http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485 - */ - #define __WXFUNCTION__ (NULL) - #elif defined(__GNUC__) || \ - (defined(_MSC_VER) && _MSC_VER >= 1300) || \ + #if defined(__GNUC__) || \ + defined(__VISUALC__) || \ defined(__FUNCTION__) #define __WXFUNCTION__ __FUNCTION__ #else @@ -130,19 +117,32 @@ /* Any C99 or C++11 compiler should have them. */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ (defined(__cplusplus) && __cplusplus >= 201103L) - #define HAVE_VARIADIC_MACROS - #elif wxCHECK_GCC_VERSION(3,0) - #define HAVE_VARIADIC_MACROS + #define HAVE_VARIADIC_MACROS 1 + #elif defined(__GNUC__) + #define HAVE_VARIADIC_MACROS 1 #elif wxCHECK_VISUALC_VERSION(8) - #define HAVE_VARIADIC_MACROS - #elif wxCHECK_WATCOM_VERSION(1,2) - #define HAVE_VARIADIC_MACROS + #define HAVE_VARIADIC_MACROS 1 #endif #endif /* !HAVE_VARIADIC_MACROS */ #ifdef HAVE_VARIADIC_MACROS + +/* + This is a hack to make it possible to use variadic macros with g++ 3.x even + when using -pedantic[-errors] option: without this, it would complain that + + "anonymous variadic macros were introduced in C99" + + and the option disabling this warning (-Wno-variadic-macros) is only + available in gcc 4.0 and later, so until then this hack is the only thing we + can do. + */ +#if defined(__GNUC__) && __GNUC__ == 3 + #pragma GCC system_header +#endif /* gcc-3.x */ + /* wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x), for every remaining argument 'x', with 'pos' being its 1-based index in @@ -164,14 +164,23 @@ #define wxCALL_FOR_EACH_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N #define wxCALL_FOR_EACH_RSEQ_N() 8, 7, 6, 5, 4, 3, 2, 1, 0 +#define wxCALL_FOR_EACH_1_(args) wxCALL_FOR_EACH_1 args +#define wxCALL_FOR_EACH_2_(args) wxCALL_FOR_EACH_2 args +#define wxCALL_FOR_EACH_3_(args) wxCALL_FOR_EACH_3 args +#define wxCALL_FOR_EACH_4_(args) wxCALL_FOR_EACH_4 args +#define wxCALL_FOR_EACH_5_(args) wxCALL_FOR_EACH_5 args +#define wxCALL_FOR_EACH_6_(args) wxCALL_FOR_EACH_6 args +#define wxCALL_FOR_EACH_7_(args) wxCALL_FOR_EACH_7 args +#define wxCALL_FOR_EACH_8_(args) wxCALL_FOR_EACH_8 args + #define wxCALL_FOR_EACH_1(what, x) what(1, x) -#define wxCALL_FOR_EACH_2(what, x, ...) what(2, x) wxCALL_FOR_EACH_1(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_3(what, x, ...) what(3, x) wxCALL_FOR_EACH_2(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_4(what, x, ...) what(4, x) wxCALL_FOR_EACH_3(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_5(what, x, ...) what(5, x) wxCALL_FOR_EACH_4(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_6(what, x, ...) what(6, x) wxCALL_FOR_EACH_5(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_7(what, x, ...) what(7, x) wxCALL_FOR_EACH_6(what, __VA_ARGS__) -#define wxCALL_FOR_EACH_8(what, x, ...) what(8, x) wxCALL_FOR_EACH_7(what, __VA_ARGS__) +#define wxCALL_FOR_EACH_2(what, x, ...) what(2, x) wxCALL_FOR_EACH_1_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_3(what, x, ...) what(3, x) wxCALL_FOR_EACH_2_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_4(what, x, ...) what(4, x) wxCALL_FOR_EACH_3_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_5(what, x, ...) what(5, x) wxCALL_FOR_EACH_4_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_6(what, x, ...) what(6, x) wxCALL_FOR_EACH_5_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_7(what, x, ...) what(7, x) wxCALL_FOR_EACH_6_((what, __VA_ARGS__)) +#define wxCALL_FOR_EACH_8(what, x, ...) what(8, x) wxCALL_FOR_EACH_7_((what, __VA_ARGS__)) #define wxCALL_FOR_EACH_(N, args) \ wxCONCAT(wxCALL_FOR_EACH_, N) args diff --git a/Externals/wxWidgets3/include/wx/cppunit.h b/Externals/wxWidgets3/include/wx/cppunit.h index 89edd9165f..70ccd97784 100644 --- a/Externals/wxWidgets3/include/wx/cppunit.h +++ b/Externals/wxWidgets3/include/wx/cppunit.h @@ -149,8 +149,8 @@ assertEquals(const wxString& expected, CPPUNIT_NS_END -// define an assertEquals() overload for the given types, this is a helper and -// shouldn't be used directly because of VC6 complications, see below +// define an assertEquals() overload for the given types, this is a helper used +// by WX_CPPUNIT_ALLOW_EQUALS_TO_INT() below #define WX_CPPUNIT_ASSERT_EQUALS(T1, T2) \ inline void \ assertEquals(T1 expected, \ @@ -169,30 +169,11 @@ CPPUNIT_NS_END // this macro allows us to specify (usually literal) ints as expected values // for functions returning integral types different from "int" -// -// FIXME-VC6: due to incorrect resolution of overloaded/template functions in -// this compiler (it basically doesn't use the template version at -// all if any overloaded function matches partially even if none of -// them matches fully) we also need to provide extra overloads - -#ifdef __VISUALC6__ - #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ - CPPUNIT_NS_BEGIN \ - WX_CPPUNIT_ASSERT_EQUALS(int, T) \ - WX_CPPUNIT_ASSERT_EQUALS(T, int) \ - WX_CPPUNIT_ASSERT_EQUALS(T, T) \ - CPPUNIT_NS_END - - CPPUNIT_NS_BEGIN - WX_CPPUNIT_ASSERT_EQUALS(int, int) +#define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ + CPPUNIT_NS_BEGIN \ + WX_CPPUNIT_ASSERT_EQUALS(int, T) \ + WX_CPPUNIT_ASSERT_EQUALS(T, int) \ CPPUNIT_NS_END -#else // !VC6 - #define WX_CPPUNIT_ALLOW_EQUALS_TO_INT(T) \ - CPPUNIT_NS_BEGIN \ - WX_CPPUNIT_ASSERT_EQUALS(int, T) \ - WX_CPPUNIT_ASSERT_EQUALS(T, int) \ - CPPUNIT_NS_END -#endif // VC6/!VC6 WX_CPPUNIT_ALLOW_EQUALS_TO_INT(long) WX_CPPUNIT_ALLOW_EQUALS_TO_INT(short) @@ -254,28 +235,6 @@ inline std::ostream& operator<<(std::ostream& o, const wxString& s) #endif // !wxUSE_STD_IOSTREAM -// VC6 doesn't provide overloads for operator<<(__int64) in its stream classes -// so do it ourselves -#if defined(__VISUALC6__) && defined(wxLongLong_t) - -#include "wx/longlong.h" - -inline std::ostream& operator<<(std::ostream& ostr, wxLongLong_t ll) -{ - ostr << wxLongLong(ll).ToString(); - - return ostr; -} - -inline std::ostream& operator<<(std::ostream& ostr, unsigned wxLongLong_t llu) -{ - ostr << wxULongLong(llu).ToString(); - - return ostr; -} - -#endif // VC6 && wxLongLong_t - /////////////////////////////////////////////////////////////////////////////// // Some more compiler warning tweaking and auto linking. // diff --git a/Externals/wxWidgets3/include/wx/cshelp.h b/Externals/wxWidgets3/include/wx/cshelp.h index 723ac14e0a..c521d454bc 100644 --- a/Externals/wxWidgets3/include/wx/cshelp.h +++ b/Externals/wxWidgets3/include/wx/cshelp.h @@ -54,7 +54,7 @@ protected: bool m_status; // true if the user left-clicked private: - DECLARE_DYNAMIC_CLASS(wxContextHelp) + wxDECLARE_DYNAMIC_CLASS(wxContextHelp); }; #if wxUSE_BMPBUTTON @@ -67,17 +67,30 @@ private: class WXDLLIMPEXP_CORE wxContextHelpButton : public wxBitmapButton { public: + wxContextHelpButton() {} + wxContextHelpButton(wxWindow* parent, wxWindowID id = wxID_CONTEXT_HELP, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxBU_AUTODRAW); + long style = wxBU_AUTODRAW) + { + Create(parent, id, pos, size, style); + } + + + bool Create(wxWindow* parent, + wxWindowID id = wxID_CONTEXT_HELP, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBU_AUTODRAW); + void OnContextHelp(wxCommandEvent& event); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxContextHelpButton); + wxDECLARE_EVENT_TABLE(); }; #endif @@ -191,14 +204,14 @@ class WXDLLIMPEXP_CORE wxSimpleHelpProvider : public wxHelpProvider { public: // implement wxHelpProvider methods - virtual wxString GetHelp(const wxWindowBase *window); + virtual wxString GetHelp(const wxWindowBase *window) wxOVERRIDE; // override ShowHelp() and not ShowHelpAtPoint() as explained above - virtual bool ShowHelp(wxWindowBase *window); + virtual bool ShowHelp(wxWindowBase *window) wxOVERRIDE; - virtual void AddHelp(wxWindowBase *window, const wxString& text); - virtual void AddHelp(wxWindowID id, const wxString& text); - virtual void RemoveHelp(wxWindowBase* window); + virtual void AddHelp(wxWindowBase *window, const wxString& text) wxOVERRIDE; + virtual void AddHelp(wxWindowID id, const wxString& text) wxOVERRIDE; + virtual void RemoveHelp(wxWindowBase* window) wxOVERRIDE; protected: // we use 2 hashes for storing the help strings associated with windows @@ -222,7 +235,7 @@ public: // again (see above): this should be ShowHelpAtPoint() but we need to // override ShowHelp() to avoid breaking existing code - virtual bool ShowHelp(wxWindowBase *window); + virtual bool ShowHelp(wxWindowBase *window) wxOVERRIDE; // Other accessors void SetHelpController(wxHelpControllerBase* hc) { m_helpController = hc; } diff --git a/Externals/wxWidgets3/include/wx/ctrlsub.h b/Externals/wxWidgets3/include/wx/ctrlsub.h index 88832e5b75..b934d2376f 100644 --- a/Externals/wxWidgets3/include/wx/ctrlsub.h +++ b/Externals/wxWidgets3/include/wx/ctrlsub.h @@ -18,6 +18,10 @@ #include "wx/arrstr.h" #include "wx/control.h" // base class +#if wxUSE_STD_CONTAINERS_COMPATIBLY +#include +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + // ---------------------------------------------------------------------------- // wxItemContainer defines an interface which is implemented by all controls // which have string subitems each of which may be selected. @@ -216,6 +220,12 @@ public: wxClientData **clientData) { return AppendItems(wxArrayStringsAdapter(n, items), clientData); } +#if wxUSE_STD_CONTAINERS_COMPATIBLY + template + int Append(const std::vector& items) + { return AppendItems(items); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + // only for RTTI needs (separate name) void AppendString(const wxString& item) { Append(item); } @@ -255,6 +265,11 @@ public: wxClientData **clientData) { return InsertItems(wxArrayStringsAdapter(n, items), pos, clientData); } +#if wxUSE_STD_CONTAINERS_COMPATIBLY + template + int Insert(const std::vector& items, unsigned int pos) + { return InsertItems(items, pos); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY // replacing items // --------------- @@ -272,10 +287,16 @@ public: void Set(unsigned int n, const wxString *items, wxClientData **clientData) { Clear(); Append(n, items, clientData); } +#if wxUSE_STD_CONTAINERS_COMPATIBLY + template + void Set(const std::vector& items) + { Clear(); Append(items); } +#endif // wxUSE_STD_CONTAINERS_COMPATIBLY + // deleting items // -------------- - void Clear(); + virtual void Clear(); void Delete(unsigned int pos); @@ -438,7 +459,7 @@ public: // usually the controls like list/combo boxes have their own background // colour - virtual bool ShouldInheritColours() const { return false; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } // Implementation only from now on. @@ -462,6 +483,8 @@ private: #include "wx/msw/ctrlsub.h" #elif defined(__WXMOTIF__) #include "wx/motif/ctrlsub.h" +#elif defined(__WXQT__) + #include "wx/qt/ctrlsub.h" #else class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase { @@ -469,7 +492,7 @@ private: wxControlWithItems() { } private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); wxDECLARE_NO_COPY_CLASS(wxControlWithItems); }; #endif diff --git a/Externals/wxWidgets3/include/wx/cursor.h b/Externals/wxWidgets3/include/wx/cursor.h index bdde8cdf66..df0c57423e 100644 --- a/Externals/wxWidgets3/include/wx/cursor.h +++ b/Externals/wxWidgets3/include/wx/cursor.h @@ -1,24 +1,33 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/cursor.h // Purpose: wxCursor base header -// Author: Julian Smart -// Modified by: +// Author: Julian Smart, Vadim Zeitlin // Created: // Copyright: (c) Julian Smart +// (c) 2014 Vadim Zeitlin (wxCursorBase) // Licence: wxWindows Licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_CURSOR_H_BASE_ #define _WX_CURSOR_H_BASE_ -#include "wx/defs.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" -/* - wxCursor classes should have the following public API: +// Under most ports, wxCursor derives directly from wxGDIObject, but in wxMSW +// there is an intermediate wxGDIImage class. +#ifdef __WXMSW__ + #include "wx/msw/gdiimage.h" +#else + typedef wxGDIObject wxGDIImage; +#endif -class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject +class WXDLLIMPEXP_CORE wxCursorBase : public wxGDIImage { public: +/* + wxCursor classes should provide the following ctors: + wxCursor(); wxCursor(const wxImage& image); wxCursor(const wxString& name, @@ -28,11 +37,11 @@ public: #if WXWIN_COMPATIBILITY_2_8 wxCursor(int id) { InitFromStock((wxStockCursor)id); } #endif - virtual ~wxCursor(); -}; - */ + virtual wxPoint GetHotSpot() const { return wxDefaultPosition; } +}; + #if defined(__WXMSW__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE #include "wx/msw/cursor.h" @@ -58,12 +67,9 @@ public: #elif defined(__WXMAC__) #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE #include "wx/osx/cursor.h" -#elif defined(__WXCOCOA__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_MACCURSOR_RESOURCE - #include "wx/cocoa/cursor.h" -#elif defined(__WXPM__) - #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR_RESOURCE - #include "wx/os2/cursor.h" +#elif defined(__WXQT__) + #define wxCURSOR_DEFAULT_TYPE wxBITMAP_TYPE_CUR + #include "wx/qt/cursor.h" #endif #include "wx/utils.h" diff --git a/Externals/wxWidgets3/include/wx/custombgwin.h b/Externals/wxWidgets3/include/wx/custombgwin.h index 73890a4654..329589c7f2 100644 --- a/Externals/wxWidgets3/include/wx/custombgwin.h +++ b/Externals/wxWidgets3/include/wx/custombgwin.h @@ -10,6 +10,10 @@ #ifndef _WX_CUSTOMBGWIN_H_ #define _WX_CUSTOMBGWIN_H_ +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_CORE wxBitmap; + // ---------------------------------------------------------------------------- // wxCustomBackgroundWindow: Adds support for custom backgrounds to any // wxWindow-derived class. diff --git a/Externals/wxWidgets3/include/wx/dataobj.h b/Externals/wxWidgets3/include/wx/dataobj.h index d099f4b6b1..2caee94243 100644 --- a/Externals/wxWidgets3/include/wx/dataobj.h +++ b/Externals/wxWidgets3/include/wx/dataobj.h @@ -83,10 +83,8 @@ public: #include "wx/x11/dataform.h" #elif defined(__WXMAC__) #include "wx/osx/dataform.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataform.h" -#elif defined(__WXPM__) - #include "wx/os2/dataform.h" +#elif defined(__WXQT__) + #include "wx/qt/dataform.h" #endif // the value for default argument to some functions (corresponds to @@ -171,10 +169,8 @@ public: #include "wx/gtk1/dataobj.h" #elif defined(__WXMAC__) #include "wx/osx/dataobj.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj.h" -#elif defined(__WXPM__) - #include "wx/os2/dataobj.h" +#elif defined(__WXQT__) + #include "wx/qt/dataobj.h" #endif // ---------------------------------------------------------------------------- @@ -225,20 +221,20 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE { return m_format; } - virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + virtual size_t GetFormatCount(wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE { return 1; } virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE { *formats = m_format; } - virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const wxOVERRIDE { return GetDataSize(); } virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), - void *buf) const + void *buf) const wxOVERRIDE { return GetDataHere(buf); } virtual bool SetData(const wxDataFormat& WXUNUSED(format), - size_t len, const void *buf) + size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } private: @@ -286,12 +282,12 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const; - virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const; - virtual size_t GetDataSize(const wxDataFormat& format) const; - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; - virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf); + virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const wxOVERRIDE; + virtual size_t GetFormatCount(wxDataObjectBase::Direction dir = Get) const wxOVERRIDE; + virtual void GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir = Get) const wxOVERRIDE; + virtual size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const wxOVERRIDE; + virtual bool SetData(const wxDataFormat& format, size_t len, const void *buf) wxOVERRIDE; #if defined(__WXMSW__) virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size, const wxDataFormat& format ); @@ -326,7 +322,7 @@ private: // ---------------------------------------------------------------------------- #if wxUSE_UNICODE - #if defined(__WXGTK20__) + #if defined(__WXGTK20__) || defined(__WXX11__) #define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ #elif defined(__WXMAC__) #define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ @@ -350,20 +346,20 @@ public: virtual wxString GetHTML() const { return m_html; } virtual void SetHTML(const wxString& html) { m_html = html; } - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } @@ -400,17 +396,17 @@ public: // some platforms have 2 and not 1 format for text data #if defined(wxNEEDS_UTF8_FOR_TEXT_DATAOBJ) || defined(wxNEEDS_UTF16_FOR_TEXT_DATAOBJ) - virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } + virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const wxOVERRIDE { return 2; } virtual void GetAllFormats(wxDataFormat *formats, - wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; + wxDataObjectBase::Direction WXUNUSED(dir) = Get) const wxOVERRIDE; - virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); } - virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); } - virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); } + virtual size_t GetDataSize() const wxOVERRIDE { return GetDataSize(GetPreferredFormat()); } + virtual bool GetDataHere(void *buf) const wxOVERRIDE { return GetDataHere(GetPreferredFormat(), buf); } + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE { return SetData(GetPreferredFormat(), len, buf); } - size_t GetDataSize(const wxDataFormat& format) const; - bool GetDataHere(const wxDataFormat& format, void *pBuf) const; - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf); + size_t GetDataSize(const wxDataFormat& format) const wxOVERRIDE; + bool GetDataHere(const wxDataFormat& format, void *pBuf) const wxOVERRIDE; + bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) wxOVERRIDE; #else // !wxNEEDS_UTF{8,16}_FOR_TEXT_DATAOBJ virtual size_t GetDataSize() const; virtual bool GetDataHere(void *buf) const; @@ -520,19 +516,19 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t size, const void *buf); + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t size, const void *buf) wxOVERRIDE; // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } @@ -564,10 +560,8 @@ private: #include "wx/motif/dataobj2.h" #elif defined(__WXMAC__) #include "wx/osx/dataobj2.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dataobj2.h" - #elif defined(__WXPM__) - #include "wx/os2/dataobj2.h" + #elif defined(__WXQT__) + #include "wx/qt/dataobj2.h" #endif // wxURLDataObject is simply wxTextDataObject with a different name diff --git a/Externals/wxWidgets3/include/wx/dataview.h b/Externals/wxWidgets3/include/wx/dataview.h index 2aa4a60d7d..8364cdbd78 100644 --- a/Externals/wxWidgets3/include/wx/dataview.h +++ b/Externals/wxWidgets3/include/wx/dataview.h @@ -26,10 +26,11 @@ #include "wx/vector.h" #include "wx/dataobj.h" #include "wx/withimages.h" +#include "wx/systhemectrl.h" class WXDLLIMPEXP_FWD_CORE wxImageList; -#if !(defined(__WXGTK20__) || defined(__WXOSX__)) || defined(__WXUNIVERSAL__) +#if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__) // #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__) #define wxHAS_GENERIC_DATAVIEWCTRL #endif @@ -313,13 +314,13 @@ public: // implement some base class pure virtual directly virtual wxDataViewItem - GetParent( const wxDataViewItem & WXUNUSED(item) ) const + GetParent( const wxDataViewItem & WXUNUSED(item) ) const wxOVERRIDE { // items never have valid parent in this model return wxDataViewItem(); } - virtual bool IsContainer( const wxDataViewItem &item ) const + virtual bool IsContainer( const wxDataViewItem &item ) const wxOVERRIDE { // only the invisible (and invalid) root item has children return !item.IsOk(); @@ -327,30 +328,30 @@ public: // and implement some others by forwarding them to our own ones virtual void GetValue( wxVariant &variant, - const wxDataViewItem &item, unsigned int col ) const + const wxDataViewItem &item, unsigned int col ) const wxOVERRIDE { GetValueByRow(variant, GetRow(item), col); } virtual bool SetValue( const wxVariant &variant, - const wxDataViewItem &item, unsigned int col ) + const wxDataViewItem &item, unsigned int col ) wxOVERRIDE { return SetValueByRow( variant, GetRow(item), col ); } virtual bool GetAttr(const wxDataViewItem &item, unsigned int col, - wxDataViewItemAttr &attr) const + wxDataViewItemAttr &attr) const wxOVERRIDE { return GetAttrByRow( GetRow(item), col, attr ); } - virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const + virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const wxOVERRIDE { return IsEnabledByRow( GetRow(item), col ); } - virtual bool IsListModel() const { return true; } + virtual bool IsListModel() const wxOVERRIDE { return true; } }; // --------------------------------------------------------- @@ -373,13 +374,13 @@ public: // convert to/from row/wxDataViewItem - virtual unsigned GetRow( const wxDataViewItem &item ) const; + virtual unsigned GetRow( const wxDataViewItem &item ) const wxOVERRIDE; wxDataViewItem GetItem( unsigned int row ) const; // implement base methods - virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; - unsigned int GetCount() const { return m_hash.GetCount(); } + unsigned int GetCount() const wxOVERRIDE { return m_hash.GetCount(); } private: wxDataViewItemArray m_hash; @@ -412,22 +413,22 @@ public: // convert to/from row/wxDataViewItem - virtual unsigned GetRow( const wxDataViewItem &item ) const; + virtual unsigned GetRow( const wxDataViewItem &item ) const wxOVERRIDE; wxDataViewItem GetItem( unsigned int row ) const; // compare based on index virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, - unsigned int column, bool ascending ) const; - virtual bool HasDefaultCompare() const; + unsigned int column, bool ascending ) const wxOVERRIDE; + virtual bool HasDefaultCompare() const wxOVERRIDE; // implement base methods - virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; - unsigned int GetCount() const { return m_size; } + unsigned int GetCount() const wxOVERRIDE { return m_size; } // internal - virtual bool IsVirtualListModel() const { return true; } + virtual bool IsVirtualListModel() const wxOVERRIDE { return true; } private: unsigned int m_size; @@ -485,8 +486,8 @@ public: // implement some of base class pure virtuals (the rest is port-dependent // and done differently in generic and native versions) - virtual void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; } - virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE { m_bitmap = bitmap; } + virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; } protected: wxDataViewRenderer *m_renderer; @@ -513,7 +514,7 @@ private: #define wxDV_ROW_LINES 0x0010 // alternating colour in rows #define wxDV_VARIABLE_LINE_HEIGHT 0x0020 // variable line height -class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxControl +class WXDLLIMPEXP_ADV wxDataViewCtrlBase: public wxSystemThemedControl { public: wxDataViewCtrlBase(); @@ -645,6 +646,25 @@ public: { return m_expander_column; } virtual wxDataViewColumn *GetSortingColumn() const = 0; + virtual wxVector GetSortingColumns() const + { + wxVector columns; + if ( wxDataViewColumn* col = GetSortingColumn() ) + columns.push_back(col); + return columns; + } + + // This must be overridden to return true if the control does allow sorting + // by more than one column, which is not the case by default. + virtual bool AllowMultiColumnSort(bool allow) + { + // We can still return true when disabling multi-column sort. + return !allow; + } + + // This should also be overridden to actually use the specified column for + // sorting if using multiple columns is supported. + virtual void ToggleSortByColumn(int WXUNUSED(column)) { } // items management @@ -709,7 +729,7 @@ public: // define control visual attributes // -------------------------------- - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -736,7 +756,7 @@ private: int m_indent ; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCtrlBase); }; // ---------------------------------------------------------------------------- @@ -835,7 +855,7 @@ public: wxDragResult GetDropEffect() const { return m_dropEffect; } #endif // wxUSE_DRAG_AND_DROP - virtual wxEvent *Clone() const { return new wxDataViewEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDataViewEvent(*this); } protected: wxDataViewItem m_item; @@ -860,7 +880,7 @@ protected: #endif // wxUSE_DRAG_AND_DROP private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent ); @@ -929,6 +949,8 @@ typedef void (wxEvtHandler::*wxDataViewEventFunction)(wxDataViewEvent&); #include "wx/gtk/dataview.h" #elif defined(__WXMAC__) #include "wx/osx/dataview.h" +#elif defined(__WXQT__) + #include "wx/qt/dataview.h" #else #error "unknown native wxDataViewCtrl implementation" #endif @@ -981,15 +1003,15 @@ public: // override base virtuals - virtual unsigned int GetColumnCount() const; + virtual unsigned int GetColumnCount() const wxOVERRIDE; - virtual wxString GetColumnType( unsigned int col ) const; + virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE; virtual void GetValueByRow( wxVariant &value, - unsigned int row, unsigned int col ) const; + unsigned int row, unsigned int col ) const wxOVERRIDE; virtual bool SetValueByRow( const wxVariant &value, - unsigned int row, unsigned int col ); + unsigned int row, unsigned int col ) wxOVERRIDE; public: @@ -1038,10 +1060,10 @@ public: bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); // overridden from base class - virtual bool PrependColumn( wxDataViewColumn *col ); - virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); - virtual bool AppendColumn( wxDataViewColumn *col ); - virtual bool ClearColumns(); + virtual bool PrependColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) wxOVERRIDE; + virtual bool AppendColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool ClearColumns() wxOVERRIDE; wxDataViewColumn *AppendTextColumn( const wxString &label, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, @@ -1096,8 +1118,8 @@ public: void OnSize( wxSizeEvent &event ); private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewListCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewListCtrl); }; //----------------------------------------------------------------------------- @@ -1166,7 +1188,7 @@ public: bool IsExpanded() const { return m_isExpanded; } - virtual bool IsContainer() + virtual bool IsContainer() wxOVERRIDE { return true; } private: @@ -1219,21 +1241,21 @@ public: // implement base methods virtual void GetValue( wxVariant &variant, - const wxDataViewItem &item, unsigned int col ) const; + const wxDataViewItem &item, unsigned int col ) const wxOVERRIDE; virtual bool SetValue( const wxVariant &variant, - const wxDataViewItem &item, unsigned int col ); - virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const; - virtual bool IsContainer( const wxDataViewItem &item ) const; - virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const; + const wxDataViewItem &item, unsigned int col ) wxOVERRIDE; + virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const wxOVERRIDE; + virtual bool IsContainer( const wxDataViewItem &item ) const wxOVERRIDE; + virtual unsigned int GetChildren( const wxDataViewItem &item, wxDataViewItemArray &children ) const wxOVERRIDE; virtual int Compare( const wxDataViewItem &item1, const wxDataViewItem &item2, - unsigned int column, bool ascending ) const; + unsigned int column, bool ascending ) const wxOVERRIDE; - virtual bool HasDefaultCompare() const + virtual bool HasDefaultCompare() const wxOVERRIDE { return true; } - virtual unsigned int GetColumnCount() const + virtual unsigned int GetColumnCount() const wxOVERRIDE { return 1; } - virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const + virtual wxString GetColumnType( unsigned int WXUNUSED(col) ) const wxOVERRIDE { return wxT("wxDataViewIconText"); } wxDataViewTreeStoreNode *FindNode( const wxDataViewItem &item ) const; @@ -1321,8 +1343,8 @@ public: void OnSize( wxSizeEvent &event ); private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDataViewTreeCtrl); }; // old wxEVT_COMMAND_* constants diff --git a/Externals/wxWidgets3/include/wx/datectrl.h b/Externals/wxWidgets3/include/wx/datectrl.h index 6fa4367c0a..a3c236781a 100644 --- a/Externals/wxWidgets3/include/wx/datectrl.h +++ b/Externals/wxWidgets3/include/wx/datectrl.h @@ -103,7 +103,7 @@ public: } private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); }; #endif diff --git a/Externals/wxWidgets3/include/wx/dateevt.h b/Externals/wxWidgets3/include/wx/dateevt.h index 4131ab383e..2032d89a71 100644 --- a/Externals/wxWidgets3/include/wx/dateevt.h +++ b/Externals/wxWidgets3/include/wx/dateevt.h @@ -34,12 +34,12 @@ public: void SetDate(const wxDateTime &date) { m_date = date; } // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxDateEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDateEvent(*this); } private: wxDateTime m_date; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDateEvent); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/datetime.h b/Externals/wxWidgets3/include/wx/datetime.h index f500985f28..d35667246f 100644 --- a/Externals/wxWidgets3/include/wx/datetime.h +++ b/Externals/wxWidgets3/include/wx/datetime.h @@ -16,11 +16,7 @@ #if wxUSE_DATETIME -#ifdef __WXWINCE__ - #include "wx/msw/wince/time.h" -#else - #include -#endif // OS +#include #include // for INT_MIN @@ -120,8 +116,8 @@ extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; // if configure detected strftime(), we have it too #ifdef HAVE_STRFTIME #define wxHAS_STRFTIME -// suppose everyone else has strftime except Win CE unless VC8 is used -#elif !defined(__WXWINCE__) || defined(__VISUALC8__) +// suppose everyone else has strftime +#else #define wxHAS_STRFTIME #endif @@ -227,11 +223,6 @@ public: // // TODO move this to intl.h -// Required for WinCE -#ifdef USA -#undef USA -#endif - enum Country { Country_Unknown, // no special information for this country @@ -462,10 +453,7 @@ public: wxDateTime() { m_time = wxLongLong(wxINT32_MIN, 0); } // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970) -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration inline wxDateTime(time_t timet); -#endif // from broken down time/date (only for standard Unix range) inline wxDateTime(const struct tm& tm); // from broken down time/date (any range) @@ -506,11 +494,8 @@ public: // set to the current time inline wxDateTime& SetToCurrent(); -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) -// VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration // set to given time_t value inline wxDateTime& Set(time_t timet); -#endif // set to given broken down time/date wxDateTime& Set(const struct tm& tm); @@ -613,21 +598,6 @@ public: Month month = Inv_Month, int year = Inv_Year); -#if WXWIN_COMPATIBILITY_2_6 - // sets the date to the given day of the given week in the year, - // returns true on success and false if given date doesn't exist (e.g. - // numWeek is > 53) - // - // these functions are badly defined as they're not the reverse of - // GetWeekOfYear(), use SetToTheWeekOfYear() instead - wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) ); - wxDEPRECATED( wxDateTime GetWeek(wxDateTime_t numWeek, - WeekDay weekday = Mon, - WeekFlags flags = Monday_First) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - // returns the date corresponding to the given week day of the given // week (in ISO notation) of the specified year static wxDateTime SetToWeekOfYear(int year, @@ -781,6 +751,9 @@ public: // invalid) wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First, const TimeZone& tz = Local) const; + // get the year to which the number returned from GetWeekOfYear() + // belongs + int GetWeekBasedYear(const TimeZone& tz = Local) const; // get the week number since the month start (1..5, 0 if date is // invalid) wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First, @@ -1599,10 +1572,10 @@ private: class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority { protected: - virtual bool DoIsHoliday(const wxDateTime& dt) const; + virtual bool DoIsHoliday(const wxDateTime& dt) const wxOVERRIDE; virtual size_t DoGetHolidaysInRange(const wxDateTime& dtStart, const wxDateTime& dtEnd, - wxDateTimeArray& holidays) const; + wxDateTimeArray& holidays) const wxOVERRIDE; }; // ============================================================================ @@ -1651,7 +1624,6 @@ inline wxDateTime wxDateTime::Today() return dt; } -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) inline wxDateTime& wxDateTime::Set(time_t timet) { if ( timet == (time_t)-1 ) @@ -1667,7 +1639,6 @@ inline wxDateTime& wxDateTime::Set(time_t timet) return *this; } -#endif inline wxDateTime& wxDateTime::SetToCurrent() { @@ -1675,12 +1646,10 @@ inline wxDateTime& wxDateTime::SetToCurrent() return *this; } -#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) inline wxDateTime::wxDateTime(time_t timet) { Set(timet); } -#endif inline wxDateTime::wxDateTime(const struct tm& tm) { diff --git a/Externals/wxWidgets3/include/wx/dc.h b/Externals/wxWidgets3/include/wx/dc.h index d13720500b..2637b5a828 100644 --- a/Externals/wxWidgets3/include/wx/dc.h +++ b/Externals/wxWidgets3/include/wx/dc.h @@ -18,9 +18,8 @@ #include "wx/object.h" // the base class #include "wx/intl.h" // for wxLayoutDirection -#include "wx/cursor.h" // we have member variables of these classes +#include "wx/colour.h" // we have member variables of these classes #include "wx/font.h" // so we can't do without them -#include "wx/colour.h" #include "wx/bitmap.h" // for wxNullBitmap #include "wx/brush.h" #include "wx/pen.h" @@ -41,6 +40,7 @@ class WXDLLIMPEXP_FWD_CORE wxScreenDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDC; class WXDLLIMPEXP_FWD_CORE wxPrinterDC; class WXDLLIMPEXP_FWD_CORE wxPrintData; +class WXDLLIMPEXP_FWD_CORE wxWindow; #if wxUSE_GRAPHICS_CONTEXT class WXDLLIMPEXP_FWD_CORE wxGraphicsContext; @@ -243,15 +243,15 @@ class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory public: wxNativeDCFactory() {} - virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ); - virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ); - virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ); - virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ); - virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ); + virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) wxOVERRIDE; + virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) wxOVERRIDE; + virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) wxOVERRIDE; #if wxUSE_PRINTING_ARCHITECTURE - virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ); + virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) wxOVERRIDE; #endif }; @@ -670,53 +670,6 @@ protected: m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0; } -#ifdef __WXWINCE__ - //! Generic method to draw ellipses, circles and arcs with current pen and brush. - /*! \param x Upper left corner of bounding box. - * \param y Upper left corner of bounding box. - * \param w Width of bounding box. - * \param h Height of bounding box. - * \param sa Starting angle of arc - * (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param ea Ending angle of arc. - * \param angle Rotation angle, the Arc will be rotated after - * calculating begin and end. - */ - void DrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord width, wxCoord height, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxPoint& pt, - const wxSize& sz, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); } - - void DrawEllipticArcRot( const wxRect& rect, - double sa = 0, double ea = 0, double angle = 0 ) - { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); } - - virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa = 0, double ea = 0, double angle = 0 ); - - //! Rotates points around center. - /*! This is a quite straight method, it calculates in pixels - * and so it produces rounding errors. - * \param points The points inside will be rotated. - * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle). - * \param center Center of rotation. - */ - void Rotate( wxPointList* points, double angle, wxPoint center = wxPoint(0,0) ); - - // used by DrawEllipticArcRot - // Careful: wxList gets filled with points you have to delete later. - void CalculateEllipticPoints( wxPointList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ); -#endif // __WXWINCE__ - // returns adjustment factor for converting wxFont "point size"; in wx // it is point size on screen and needs to be multiplied by this value // for rendering on higher-resolution DCs such as printer ones @@ -776,7 +729,7 @@ protected: #endif // wxUSE_PALETTE private: - DECLARE_ABSTRACT_CLASS(wxDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxDCImpl); }; @@ -1373,7 +1326,7 @@ protected: wxDCImpl * const m_pimpl; private: - DECLARE_ABSTRACT_CLASS(wxDC) + wxDECLARE_ABSTRACT_CLASS(wxDC); wxDECLARE_NO_COPY_CLASS(wxDC); }; diff --git a/Externals/wxWidgets3/include/wx/dcbuffer.h b/Externals/wxWidgets3/include/wx/dcbuffer.h index f4d27c7fb8..fb912f6e24 100644 --- a/Externals/wxWidgets3/include/wx/dcbuffer.h +++ b/Externals/wxWidgets3/include/wx/dcbuffer.h @@ -17,7 +17,7 @@ // Split platforms into two groups - those which have well-working // double-buffering by default, and those which do not. -#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) +#if defined(__WXMAC__) || defined(__WXGTK20__) || defined(__WXDFB__) || defined(__WXQT__) #define wxALWAYS_NATIVE_DOUBLE_BUFFER 1 #else #define wxALWAYS_NATIVE_DOUBLE_BUFFER 0 @@ -135,7 +135,7 @@ private: wxSize m_area; - DECLARE_DYNAMIC_CLASS(wxBufferedDC) + wxDECLARE_DYNAMIC_CLASS(wxBufferedDC); wxDECLARE_NO_COPY_CLASS(wxBufferedDC); }; @@ -195,7 +195,7 @@ protected: private: wxPaintDC m_paintdc; - DECLARE_ABSTRACT_CLASS(wxBufferedPaintDC) + wxDECLARE_ABSTRACT_CLASS(wxBufferedPaintDC); wxDECLARE_NO_COPY_CLASS(wxBufferedPaintDC); }; diff --git a/Externals/wxWidgets3/include/wx/dcclient.h b/Externals/wxWidgets3/include/wx/dcclient.h index f4bf74f75f..28391d1266 100644 --- a/Externals/wxWidgets3/include/wx/dcclient.h +++ b/Externals/wxWidgets3/include/wx/dcclient.h @@ -24,7 +24,7 @@ protected: wxWindowDC(wxDCImpl *impl) : wxDC(impl) { } private: - DECLARE_ABSTRACT_CLASS(wxWindowDC) + wxDECLARE_ABSTRACT_CLASS(wxWindowDC); }; //----------------------------------------------------------------------------- @@ -40,7 +40,7 @@ protected: wxClientDC(wxDCImpl *impl) : wxWindowDC(impl) { } private: - DECLARE_ABSTRACT_CLASS(wxClientDC) + wxDECLARE_ABSTRACT_CLASS(wxClientDC); }; //----------------------------------------------------------------------------- @@ -56,7 +56,7 @@ protected: wxPaintDC(wxDCImpl *impl) : wxClientDC(impl) { } private: - DECLARE_ABSTRACT_CLASS(wxPaintDC) + wxDECLARE_ABSTRACT_CLASS(wxPaintDC); }; #endif // _WX_DCCLIENT_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/dcgraph.h b/Externals/wxWidgets3/include/wx/dcgraph.h index 06cca91298..612bd1c089 100644 --- a/Externals/wxWidgets3/include/wx/dcgraph.h +++ b/Externals/wxWidgets3/include/wx/dcgraph.h @@ -36,9 +36,6 @@ public: wxGCDC(); virtual ~wxGCDC(); - wxGraphicsContext* GetGraphicsContext() const; - void SetGraphicsContext( wxGraphicsContext* ctx ); - #ifdef __WXMSW__ // override wxDC virtual functions to provide access to HDC associated with // this Graphics object (implemented in src/msw/graphics.cpp) @@ -47,7 +44,7 @@ public: #endif // __WXMSW__ private: - DECLARE_DYNAMIC_CLASS(wxGCDC) + wxDECLARE_DYNAMIC_CLASS(wxGCDC); wxDECLARE_NO_COPY_CLASS(wxGCDC); }; @@ -70,100 +67,100 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual void Clear(); + virtual void Clear() wxOVERRIDE; - virtual bool StartDoc( const wxString& message ); - virtual void EndDoc(); + virtual bool StartDoc( const wxString& message ) wxOVERRIDE; + virtual void EndDoc() wxOVERRIDE; - virtual void StartPage(); - virtual void EndPage(); + virtual void StartPage() wxOVERRIDE; + virtual void EndPage() wxOVERRIDE; // flushing the content of this dc immediately onto screen - virtual void Flush(); + virtual void Flush() wxOVERRIDE; - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); - virtual void SetBrush(const wxBrush& brush); - virtual void SetBackground(const wxBrush& brush); - virtual void SetBackgroundMode(int mode); - virtual void SetPalette(const wxPalette& palette); + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE; + virtual void SetBackgroundMode(int mode) wxOVERRIDE; + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE; - virtual void DestroyClippingRegion(); + virtual void DestroyClippingRegion() wxOVERRIDE; - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; + virtual bool CanDrawBitmap() const wxOVERRIDE; + virtual bool CanGetTextExtent() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; - virtual void SetLogicalFunction(wxRasterOperationMode function); + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE; - virtual void SetTextForeground(const wxColour& colour); - virtual void SetTextBackground(const wxColour& colour); + virtual void SetTextForeground(const wxColour& colour) wxOVERRIDE; + virtual void SetTextBackground(const wxColour& colour) wxOVERRIDE; - virtual void ComputeScaleAndOrigin(); + virtual void ComputeScaleAndOrigin() wxOVERRIDE; - wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; } - virtual void SetGraphicsContext( wxGraphicsContext* ctx ); + wxGraphicsContext* GetGraphicsContext() const wxOVERRIDE { return m_graphicContext; } + virtual void SetGraphicsContext( wxGraphicsContext* ctx ) wxOVERRIDE; - virtual void* GetHandle() const; + virtual void* GetHandle() const wxOVERRIDE; // the true implementations virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE); + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; virtual void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, - wxDirection nDirection = wxEAST); + wxDirection nDirection = wxEAST) wxOVERRIDE; virtual void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, - const wxPoint& circleCenter); + const wxPoint& circleCenter) wxOVERRIDE; - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE; - virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; #if wxUSE_SPLINES - virtual void DoDrawSpline(const wxPointList *points); + virtual void DoDrawSpline(const wxPointList *points) wxOVERRIDE; #endif - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; virtual void DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc); + wxCoord xc, wxCoord yc) wxOVERRIDE; virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); + wxCoord width, wxCoord height) wxOVERRIDE; virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); + double sa, double ea) wxOVERRIDE; - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, - double radius); - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + double radius) wxOVERRIDE; + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; - virtual void DoCrossHair(wxCoord x, wxCoord y); + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false); + bool useMask = false) wxOVERRIDE; - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); + double angle) wxOVERRIDE; virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) wxOVERRIDE; virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight, @@ -171,31 +168,31 @@ public: wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, wxRasterOperationMode = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; - virtual void DoGetSize(int *,int *) const; - virtual void DoGetSizeMM(int* width, int* height) const; + virtual void DoGetSize(int *,int *) const wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; virtual void DoDrawLines(int n, const wxPoint points[], - wxCoord xoffset, wxCoord yoffset); + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; virtual void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle); + wxPolygonFillMode fillStyle) wxOVERRIDE; - virtual void DoSetDeviceClippingRegion(const wxRegion& region); + virtual void DoSetDeviceClippingRegion(const wxRegion& region) wxOVERRIDE; virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord width, wxCoord height); + wxCoord width, wxCoord height) wxOVERRIDE; virtual void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; + const wxFont *theFont = NULL) const wxOVERRIDE; - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; #ifdef __WXMSW__ virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const; @@ -218,7 +215,7 @@ protected: private: void Init(wxGraphicsContext*); - DECLARE_CLASS(wxGCDCImpl) + wxDECLARE_CLASS(wxGCDCImpl); wxDECLARE_NO_COPY_CLASS(wxGCDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/dcmemory.h b/Externals/wxWidgets3/include/wx/dcmemory.h index d5f301c942..573da75ce0 100644 --- a/Externals/wxWidgets3/include/wx/dcmemory.h +++ b/Externals/wxWidgets3/include/wx/dcmemory.h @@ -36,7 +36,7 @@ public: wxBitmap& GetSelectedBitmap(); private: - DECLARE_DYNAMIC_CLASS(wxMemoryDC) + wxDECLARE_DYNAMIC_CLASS(wxMemoryDC); }; diff --git a/Externals/wxWidgets3/include/wx/dcmirror.h b/Externals/wxWidgets3/include/wx/dcmirror.h index 42deb9771c..4bbd27e777 100644 --- a/Externals/wxWidgets3/include/wx/dcmirror.h +++ b/Externals/wxWidgets3/include/wx/dcmirror.h @@ -33,39 +33,39 @@ public: } // wxDCBase operations - virtual void Clear() { m_dc.Clear(); } - virtual void SetFont(const wxFont& font) { m_dc.SetFont(font); } - virtual void SetPen(const wxPen& pen) { m_dc.SetPen(pen); } - virtual void SetBrush(const wxBrush& brush) { m_dc.SetBrush(brush); } - virtual void SetBackground(const wxBrush& brush) + virtual void Clear() wxOVERRIDE { m_dc.Clear(); } + virtual void SetFont(const wxFont& font) wxOVERRIDE { m_dc.SetFont(font); } + virtual void SetPen(const wxPen& pen) wxOVERRIDE { m_dc.SetPen(pen); } + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE { m_dc.SetBrush(brush); } + virtual void SetBackground(const wxBrush& brush) wxOVERRIDE { m_dc.SetBackground(brush); } - virtual void SetBackgroundMode(int mode) { m_dc.SetBackgroundMode(mode); } + virtual void SetBackgroundMode(int mode) wxOVERRIDE { m_dc.SetBackgroundMode(mode); } #if wxUSE_PALETTE - virtual void SetPalette(const wxPalette& palette) + virtual void SetPalette(const wxPalette& palette) wxOVERRIDE { m_dc.SetPalette(palette); } #endif // wxUSE_PALETTE - virtual void DestroyClippingRegion() { m_dc.DestroyClippingRegion(); } - virtual wxCoord GetCharHeight() const { return m_dc.GetCharHeight(); } - virtual wxCoord GetCharWidth() const { return m_dc.GetCharWidth(); } - virtual bool CanDrawBitmap() const { return m_dc.CanDrawBitmap(); } - virtual bool CanGetTextExtent() const { return m_dc.CanGetTextExtent(); } - virtual int GetDepth() const { return m_dc.GetDepth(); } - virtual wxSize GetPPI() const { return m_dc.GetPPI(); } - virtual bool IsOk() const { return m_dc.IsOk(); } - virtual void SetMapMode(wxMappingMode mode) { m_dc.SetMapMode(mode); } - virtual void SetUserScale(double x, double y) + virtual void DestroyClippingRegion() wxOVERRIDE { m_dc.DestroyClippingRegion(); } + virtual wxCoord GetCharHeight() const wxOVERRIDE { return m_dc.GetCharHeight(); } + virtual wxCoord GetCharWidth() const wxOVERRIDE { return m_dc.GetCharWidth(); } + virtual bool CanDrawBitmap() const wxOVERRIDE { return m_dc.CanDrawBitmap(); } + virtual bool CanGetTextExtent() const wxOVERRIDE { return m_dc.CanGetTextExtent(); } + virtual int GetDepth() const wxOVERRIDE { return m_dc.GetDepth(); } + virtual wxSize GetPPI() const wxOVERRIDE { return m_dc.GetPPI(); } + virtual bool IsOk() const wxOVERRIDE { return m_dc.IsOk(); } + virtual void SetMapMode(wxMappingMode mode) wxOVERRIDE { m_dc.SetMapMode(mode); } + virtual void SetUserScale(double x, double y) wxOVERRIDE { m_dc.SetUserScale(GetX(x, y), GetY(x, y)); } - virtual void SetLogicalOrigin(wxCoord x, wxCoord y) + virtual void SetLogicalOrigin(wxCoord x, wxCoord y) wxOVERRIDE { m_dc.SetLogicalOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetDeviceOrigin(wxCoord x, wxCoord y) + virtual void SetDeviceOrigin(wxCoord x, wxCoord y) wxOVERRIDE { m_dc.SetDeviceOrigin(GetX(x, y), GetY(x, y)); } - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) wxOVERRIDE { m_dc.SetAxisOrientation(GetX(xLeftRight, yBottomUp), GetY(xLeftRight, yBottomUp)); } - virtual void SetLogicalFunction(wxRasterOperationMode function) + virtual void SetLogicalFunction(wxRasterOperationMode function) wxOVERRIDE { m_dc.SetLogicalFunction(function); } - virtual void* GetHandle() const + virtual void* GetHandle() const wxOVERRIDE { return m_dc.GetHandle(); } protected: @@ -100,30 +100,30 @@ protected: // wxDCBase functions virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style = wxFLOOD_SURFACE) + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE { return m_dc.DoFloodFill(GetX(x, y), GetY(x, y), col, style); } - virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const wxOVERRIDE { return m_dc.DoGetPixel(GetX(x, y), GetY(x, y), col); } - virtual void DoDrawPoint(wxCoord x, wxCoord y) + virtual void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE { m_dc.DoDrawPoint(GetX(x, y), GetY(x, y)); } - virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE { m_dc.DoDrawLine(GetX(x1, y1), GetY(x1, y1), GetX(x2, y2), GetY(x2, y2)); } virtual void DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc) + wxCoord xc, wxCoord yc) wxOVERRIDE { wxFAIL_MSG( wxT("this is probably wrong") ); @@ -133,14 +133,14 @@ protected: } virtual void DoDrawCheckMark(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) + wxCoord w, wxCoord h) wxOVERRIDE { m_dc.DoDrawCheckMark(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); } virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea) + double sa, double ea) wxOVERRIDE { wxFAIL_MSG( wxT("this is probably wrong") ); @@ -149,49 +149,49 @@ protected: sa, ea); } - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE { m_dc.DoDrawRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); } virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double radius) + double radius) wxOVERRIDE { m_dc.DoDrawRoundedRectangle(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h), radius); } - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE { m_dc.DoDrawEllipse(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); } - virtual void DoCrossHair(wxCoord x, wxCoord y) + virtual void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE { m_dc.DoCrossHair(GetX(x, y), GetY(x, y)); } - virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE { m_dc.DoDrawIcon(icon, GetX(x, y), GetY(x, y)); } virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = false) + bool useMask = false) wxOVERRIDE { m_dc.DoDrawBitmap(bmp, GetX(x, y), GetY(x, y), useMask); } - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE { // this is never mirrored m_dc.DoDrawText(text, x, y); } virtual void DoDrawRotatedText(const wxString& text, - wxCoord x, wxCoord y, double angle) + wxCoord x, wxCoord y, double angle) wxOVERRIDE { // this is never mirrored m_dc.DoDrawRotatedText(text, x, y, angle); @@ -202,7 +202,7 @@ protected: wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE { return m_dc.DoBlit(GetX(xdest, ydest), GetY(xdest, ydest), GetX(w, h), GetY(w, h), @@ -211,18 +211,18 @@ protected: GetX(xsrcMask, ysrcMask), GetX(xsrcMask, ysrcMask)); } - virtual void DoGetSize(int *w, int *h) const + virtual void DoGetSize(int *w, int *h) const wxOVERRIDE { m_dc.DoGetSize(GetX(w, h), GetY(w, h)); } - virtual void DoGetSizeMM(int *w, int *h) const + virtual void DoGetSizeMM(int *w, int *h) const wxOVERRIDE { m_dc.DoGetSizeMM(GetX(w, h), GetY(w, h)); } virtual void DoDrawLines(int n, const wxPoint points[], - wxCoord xoffset, wxCoord yoffset) + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE { wxPoint* points_alloc = Mirror(n, points); @@ -234,7 +234,7 @@ protected: virtual void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE) + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE { wxPoint* points_alloc = Mirror(n, points); @@ -245,13 +245,13 @@ protected: delete[] points_alloc; } - virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) + virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) wxOVERRIDE { wxFAIL_MSG( wxT("not implemented") ); } virtual void DoSetClippingRegion(wxCoord x, wxCoord y, - wxCoord w, wxCoord h) + wxCoord w, wxCoord h) wxOVERRIDE { m_dc.DoSetClippingRegion(GetX(x, y), GetY(x, y), GetX(w, h), GetY(w, h)); } @@ -260,7 +260,7 @@ protected: wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const + const wxFont *theFont = NULL) const wxOVERRIDE { // never mirrored m_dc.DoGetTextExtent(string, x, y, descent, externalLeading, theFont); diff --git a/Externals/wxWidgets3/include/wx/dcprint.h b/Externals/wxWidgets3/include/wx/dcprint.h index 6d84731116..2e98c7e43b 100644 --- a/Externals/wxWidgets3/include/wx/dcprint.h +++ b/Externals/wxWidgets3/include/wx/dcprint.h @@ -28,13 +28,13 @@ public: wxPrinterDC(const wxPrintData& data); wxRect GetPaperRect() const; - int GetResolution() const; + int GetResolution() const wxOVERRIDE; protected: wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { } private: - DECLARE_DYNAMIC_CLASS(wxPrinterDC) + wxDECLARE_DYNAMIC_CLASS(wxPrinterDC); }; #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Externals/wxWidgets3/include/wx/dcscreen.h b/Externals/wxWidgets3/include/wx/dcscreen.h index 391e91aacf..fb60309da0 100644 --- a/Externals/wxWidgets3/include/wx/dcscreen.h +++ b/Externals/wxWidgets3/include/wx/dcscreen.h @@ -27,7 +27,7 @@ public: { return true; } private: - DECLARE_DYNAMIC_CLASS(wxScreenDC) + wxDECLARE_DYNAMIC_CLASS(wxScreenDC); }; diff --git a/Externals/wxWidgets3/include/wx/dcsvg.h b/Externals/wxWidgets3/include/wx/dcsvg.h index c6485ff131..3f7bd5a5fd 100644 --- a/Externals/wxWidgets3/include/wx/dcsvg.h +++ b/Externals/wxWidgets3/include/wx/dcsvg.h @@ -25,10 +25,43 @@ class WXDLLIMPEXP_FWD_BASE wxFileOutputStream; - - class WXDLLIMPEXP_FWD_CORE wxSVGFileDC; +// Base class for bitmap handlers used by wxSVGFileDC, used by the standard +// "embed" and "link" handlers below but can also be used to create a custom +// handler. +class WXDLLIMPEXP_CORE wxSVGBitmapHandler +{ +public: + // Write the representation of the given bitmap, appearing at the specified + // position, to the provided stream. + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const = 0; + + virtual ~wxSVGBitmapHandler() {} +}; + +// Predefined standard bitmap handler: creates a file, stores the bitmap in +// this file and uses the file URI in the generated SVG. +class WXDLLIMPEXP_CORE wxSVGBitmapFileHandler : public wxSVGBitmapHandler +{ +public: + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const wxOVERRIDE; +}; + +// Predefined handler which embeds the bitmap (base64-encoding it) inside the +// generated SVG file. +class WXDLLIMPEXP_CORE wxSVGBitmapEmbedHandler : public wxSVGBitmapHandler +{ +public: + virtual bool ProcessBitmap(const wxBitmap& bitmap, + wxCoord x, wxCoord y, + wxOutputStream& stream) const wxOVERRIDE; +}; + class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl { public: @@ -37,26 +70,26 @@ public: virtual ~wxSVGFileDCImpl(); - bool IsOk() const { return m_OK; } + bool IsOk() const wxOVERRIDE { return m_OK; } - virtual bool CanDrawBitmap() const { return true; } - virtual bool CanGetTextExtent() const { return true; } + virtual bool CanDrawBitmap() const wxOVERRIDE { return true; } + virtual bool CanGetTextExtent() const wxOVERRIDE { return true; } - virtual int GetDepth() const + virtual int GetDepth() const wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1; } - virtual void Clear() + virtual void Clear() wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); } - virtual void DestroyClippingRegion(); + virtual void DestroyClippingRegion() wxOVERRIDE; - virtual wxCoord GetCharHeight() const; - virtual wxCoord GetCharWidth() const; + virtual wxCoord GetCharHeight() const wxOVERRIDE; + virtual wxCoord GetCharWidth() const wxOVERRIDE; virtual void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxCoord WXUNUSED(w), wxCoord WXUNUSED(h)) @@ -64,7 +97,7 @@ public: wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented")); } - virtual void SetPalette(const wxPalette& WXUNUSED(palette)) + virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented")); } @@ -75,27 +108,29 @@ public: wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented")); } - virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) + virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); } - virtual wxRasterOperationMode GetLogicalFunction() const + virtual wxRasterOperationMode GetLogicalFunction() const wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); return wxCOPY; } - virtual void SetBackground( const wxBrush &brush ); - virtual void SetBackgroundMode( int mode ); - virtual void SetBrush(const wxBrush& brush); - virtual void SetFont(const wxFont& font); - virtual void SetPen(const wxPen& pen); + virtual void SetBackground( const wxBrush &brush ) wxOVERRIDE; + virtual void SetBackgroundMode( int mode ) wxOVERRIDE; + virtual void SetBrush(const wxBrush& brush) wxOVERRIDE; + virtual void SetFont(const wxFont& font) wxOVERRIDE; + virtual void SetPen(const wxPen& pen) wxOVERRIDE; - virtual void* GetHandle() const { return NULL; } + virtual void* GetHandle() const wxOVERRIDE { return NULL; } + + void SetBitmapHandler(wxSVGBitmapHandler* handler); private: - virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const + virtual bool DoGetPixel(wxCoord, wxCoord, wxColour *) const wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; @@ -103,57 +138,57 @@ private: virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, wxDC *, wxCoord, wxCoord, wxRasterOperationMode = wxCOPY, - bool = 0, int = -1, int = -1); + bool = 0, int = -1, int = -1) wxOVERRIDE; - virtual void DoCrossHair(wxCoord, wxCoord) + virtual void DoCrossHair(wxCoord, wxCoord) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented")); } - virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); + virtual void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord) wxOVERRIDE; - virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false); + virtual void DoDrawBitmap(const wxBitmap &, wxCoord, wxCoord, bool = false) wxOVERRIDE; - virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE; - virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE; virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double sa, double ea); + double sa, double ea) wxOVERRIDE; - virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord); + virtual void DoDrawIcon(const wxIcon &, wxCoord, wxCoord) wxOVERRIDE; - virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + virtual void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; virtual void DoDrawLines(int n, const wxPoint points[], - wxCoord xoffset = 0, wxCoord yoffset = 0); + wxCoord xoffset = 0, wxCoord yoffset = 0) wxOVERRIDE; - virtual void DoDrawPoint(wxCoord, wxCoord); + virtual void DoDrawPoint(wxCoord, wxCoord) wxOVERRIDE; virtual void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle); + wxPolygonFillMode fillStyle) wxOVERRIDE; - virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) wxOVERRIDE; virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); + double angle) wxOVERRIDE; virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h, - double radius = 20) ; + double radius = 20) wxOVERRIDE ; - virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; virtual bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour& WXUNUSED(col), - wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE) + wxFloodFillStyle WXUNUSED(style) = wxFLOOD_SURFACE) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); return false; } - virtual void DoGetSize(int * x, int *y) const + virtual void DoGetSize(int * x, int *y) const wxOVERRIDE { if ( x ) *x = m_width; @@ -164,18 +199,18 @@ private: virtual void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *font = NULL) const; + const wxFont *font = NULL) const wxOVERRIDE; - virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) + virtual void DoSetDeviceClippingRegion(const wxRegion& WXUNUSED(region)) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented")); } - virtual void DoSetClippingRegion(int x, int y, int width, int height); + virtual void DoSetClippingRegion(int x, int y, int width, int height) wxOVERRIDE; - virtual void DoGetSizeMM( int *width, int *height ) const; + virtual void DoGetSizeMM( int *width, int *height ) const wxOVERRIDE; - virtual wxSize GetPPI() const; + virtual wxSize GetPPI() const wxOVERRIDE; void Init (const wxString &filename, int width, int height, double dpi); @@ -197,6 +232,7 @@ private: bool m_graphics_changed; // set by Set{Brush,Pen}() int m_width, m_height; double m_dpi; + wxSVGBitmapHandler* m_bmp_handler; // class to handle bitmaps // The clipping nesting level is incremented by every call to // SetClippingRegion() and reset when DestroyClippingRegion() is called. @@ -206,7 +242,7 @@ private: // incremented in each SetClippingRegion() call. size_t m_clipUniqueId; - DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl); }; @@ -220,6 +256,11 @@ public: : wxDC(new wxSVGFileDCImpl(this, filename, width, height, dpi)) { } + + // wxSVGFileDC-specific methods: + + // Use a custom bitmap handler: takes ownership of the handler. + void SetBitmapHandler(wxSVGBitmapHandler* handler); }; #endif // wxUSE_SVG diff --git a/Externals/wxWidgets3/include/wx/debug.h b/Externals/wxWidgets3/include/wx/debug.h index f80f7be680..13f3cb7d55 100644 --- a/Externals/wxWidgets3/include/wx/debug.h +++ b/Externals/wxWidgets3/include/wx/debug.h @@ -10,9 +10,7 @@ #ifndef _WX_DEBUG_H_ #define _WX_DEBUG_H_ -#if !defined(__WXWINCE__) - #include -#endif // systems without assert.h +#include #include // for CHAR_BIT used below @@ -256,11 +254,18 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, // If possible, we prefer to define it as a macro rather than as a function // to open the debugger at the position where we trapped and not inside the // trap function itself which is not very useful. - #if wxCHECK_VISUALC_VERSION(7) + #ifdef __VISUALC__ #define wxTrap() __debugbreak() - #else + #elif defined(__GNUC__) + #if defined(__i386) || defined(__x86_64) + #define wxTrap() asm volatile ("int $3") + #endif + #endif + + #ifndef wxTrap + // For all the other cases, use a generic function. extern WXDLLIMPEXP_BASE void wxTrap(); - #endif // Win VisualC + #endif // Global flag used to indicate that assert macros should call wxTrap(): it // is set by the default assert handler if the user answers yes to the @@ -275,34 +280,44 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, // reasons (if we changed its return type, we'd need to change wxApp:: // OnAssertFailure() too which would break user code overriding it), hence // the need for the ugly global flag. - #define wxASSERT_MSG(cond, msg) \ + #define wxASSERT_MSG_AT(cond, msg, file, line, func) \ wxSTATEMENT_MACRO_BEGIN \ if ( wxTheAssertHandler && !(cond) && \ - (wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \ - #cond, msg), wxTrapInAssert) ) \ + (wxOnAssert(file, line, func, #cond, msg), \ + wxTrapInAssert) ) \ { \ wxTrapInAssert = false; \ wxTrap(); \ } \ wxSTATEMENT_MACRO_END + // A version asserting at the current location. + #define wxASSERT_MSG(cond, msg) \ + wxASSERT_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__) + // a version without any additional message, don't use unless condition // itself is fully self-explanatory #define wxASSERT(cond) wxASSERT_MSG(cond, (const char*)NULL) // wxFAIL is a special form of assert: it always triggers (and so is // usually used in normally unreachable code) - #define wxFAIL_COND_MSG(cond, msg) \ + #define wxFAIL_COND_MSG_AT(cond, msg, file, line, func) \ wxSTATEMENT_MACRO_BEGIN \ if ( wxTheAssertHandler && \ - (wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \ - cond, msg), wxTrapInAssert) ) \ + (wxOnAssert(file, line, func, #cond, msg), \ + wxTrapInAssert) ) \ { \ wxTrapInAssert = false; \ wxTrap(); \ } \ wxSTATEMENT_MACRO_END + #define wxFAIL_MSG_AT(msg, file, line, func) \ + wxFAIL_COND_MSG_AT("Assert failure", msg, file, line, func) + + #define wxFAIL_COND_MSG(cond, msg) \ + wxFAIL_COND_MSG_AT(cond, msg, __FILE__, __LINE__, __WXFUNCTION__) + #define wxFAIL_MSG(msg) wxFAIL_COND_MSG("Assert failure", msg) #define wxFAIL wxFAIL_MSG((const char*)NULL) #else // !wxDEBUG_LEVEL @@ -404,14 +419,7 @@ extern void WXDLLIMPEXP_BASE wxAbort(); It may be used both within a function and in the global scope. */ -#if defined(__WATCOMC__) - /* avoid "unused symbol" warning */ - #define wxCOMPILE_TIME_ASSERT(expr, msg) \ - class wxMAKE_UNIQUE_ASSERT_NAME { \ - unsigned int msg: expr; \ - wxMAKE_UNIQUE_ASSERT_NAME() { wxUnusedVar(msg); } \ - } -#elif defined( __VMS ) +#if defined( __VMS ) namespace wxdebug{ // HP aCC cannot deal with missing names for template value parameters diff --git a/Externals/wxWidgets3/include/wx/debugrpt.h b/Externals/wxWidgets3/include/wx/debugrpt.h index 421bede975..17e0b899a4 100644 --- a/Externals/wxWidgets3/include/wx/debugrpt.h +++ b/Externals/wxWidgets3/include/wx/debugrpt.h @@ -146,7 +146,7 @@ public: const wxString& GetCompressedFileName() const { return m_zipfile; } protected: - virtual bool DoProcess(); + virtual bool DoProcess() wxOVERRIDE; private: // user-specified file directory/base name, use defaults if empty @@ -176,7 +176,7 @@ public: const wxString& curl = wxT("curl")); protected: - virtual bool DoProcess(); + virtual bool DoProcess() wxOVERRIDE; // this function may be overridden in a derived class to show the output // from curl: this may be an HTML page or anything else that the server @@ -237,7 +237,7 @@ class WXDLLIMPEXP_QA wxDebugReportPreviewStd : public wxDebugReportPreview public: wxDebugReportPreviewStd() { } - virtual bool Show(wxDebugReport& dbgrpt) const; + virtual bool Show(wxDebugReport& dbgrpt) const wxOVERRIDE; }; #endif // wxUSE_GUI diff --git a/Externals/wxWidgets3/include/wx/defs.h b/Externals/wxWidgets3/include/wx/defs.h index e3d16d36ae..98262ba07a 100644 --- a/Externals/wxWidgets3/include/wx/defs.h +++ b/Externals/wxWidgets3/include/wx/defs.h @@ -13,13 +13,6 @@ #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 - */ -#define FUTURE_WXWIN_COMPATIBILITY_3_0 1 -#define wxDEPRECATED_FUTURE( x ) x - /* ---------------------------------------------------------------------------- */ /* compiler and OS identification */ /* ---------------------------------------------------------------------------- */ @@ -33,14 +26,12 @@ # elif !defined(__WXMOTIF__) && \ !defined(__WXMSW__) && \ !defined(__WXGTK__) && \ - !defined(__WXPM__) && \ - !defined(__WXOSX_CARBON__) && \ !defined(__WXOSX_COCOA__) && \ !defined(__WXOSX_IPHONE__) && \ - !defined(__WXCOCOA__) && \ !defined(__X__) && \ !defined(__WXDFB__) && \ !defined(__WXX11__) && \ + !defined(__WXQT__) && \ wxUSE_GUI # ifdef __UNIX__ # error "No Target! You should use wx-config program for compilation flags!" @@ -111,21 +102,6 @@ # pragma warning(disable:4003) /* not enough actual parameters for macro */ # endif - /* - VC6 insists on complaining about - - return type for 'wxVector::reverse_iterator::operator ->' is 'T **' - (ie; not a UDT or reference to a UDT. Will produce errors if applied - using infix notation) - - which is perfectly fine because template classes do routinely define - operators which don't make sense for all template parameter values - (besides this warning was removed in subsequent versions). - */ - #ifdef __VISUALC6__ - #pragma warning(disable: 4284) - #endif /* VC6 */ - /* When compiling with VC++ 7 /Wp64 option we get thousands of warnings for conversion from size_t to int or long. Some precious few of them might @@ -177,10 +153,10 @@ /* Clang Support */ - + #ifndef WX_HAS_CLANG_FEATURE -# ifndef __has_feature -# define WX_HAS_CLANG_FEATURE(x) 0 +# ifndef __has_feature +# define WX_HAS_CLANG_FEATURE(x) 0 # else # define WX_HAS_CLANG_FEATURE(x) __has_feature(x) # endif @@ -216,7 +192,7 @@ /* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */ /* when using Windows sockets. */ -#if defined(__CYGWIN__) && defined(__WXMSW__) +#if defined(__CYGWIN__) && defined(__WINDOWS__) #define __USE_W32_SOCKETS #endif @@ -243,6 +219,8 @@ typedef short int WXTYPE; /* other feature tests */ /* ---------------------------------------------------------------------------- */ +#ifdef __cplusplus + /* Every ride down a slippery slope begins with a single step.. */ /* */ /* Yes, using nested classes is indeed against our coding standards in */ @@ -253,20 +231,13 @@ typedef short int WXTYPE; /* check for explicit keyword support */ #ifndef HAVE_EXPLICIT - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */ + #if defined(__VISUALC__) #define HAVE_EXPLICIT - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(2, 95) - /* GCC 2.95 has explicit, what about earlier versions? */ + #elif defined(__GNUC__) #define HAVE_EXPLICIT #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520) /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */ #define HAVE_EXPLICIT - #elif defined(__DIGITALMARS__) - #define HAVE_EXPLICIT - #elif defined(__WATCOMC__) - #define HAVE_EXPLICIT #endif #endif /* !HAVE_EXPLICIT */ @@ -276,6 +247,46 @@ typedef short int WXTYPE; #define wxEXPLICIT #endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */ +/* check for override keyword support */ +#ifndef HAVE_OVERRIDE + #if __cplusplus >= 201103L + /* All C++11 compilers should have it. */ + #define HAVE_OVERRIDE + #elif wxCHECK_VISUALC_VERSION(11) + /* + VC++ supports override keyword since version 8 but doesn't define + __cplusplus as indicating C++11 support (at least up to and + including 12), so handle its case specially. + + Also note that while the keyword is supported, using it with + versions 8, 9 and 10 results in C4481 compiler warning ("nonstandard + extension used") and so we avoid using it there, you could disable + this warning and predefine HAVE_OVERRIDE if you don't care about it. + */ + #define HAVE_OVERRIDE + #elif WX_HAS_CLANG_FEATURE(cxx_override_control) + #define HAVE_OVERRIDE + #endif +#endif /* !HAVE_OVERRIDE */ + +#ifdef HAVE_OVERRIDE + #define wxOVERRIDE override +#else /* !HAVE_OVERRIDE */ + #define wxOVERRIDE +#endif /* HAVE_OVERRIDE/!HAVE_EXPLICIT */ + +/* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */ + +#if __cplusplus >= 201103L && defined(__has_warning) + #if WX_HAS_CLANG_FEATURE(cxx_attributes) + #define wxFALLTHROUGH [[clang::fallthrough]] + #endif +#endif + +#ifndef wxFALLTHROUGH + #define wxFALLTHROUGH ((void)0) +#endif + /* these macros are obsolete, use the standard C++ casts directly now */ #define wx_static_cast(t, x) static_cast(x) #define wx_const_cast(t, x) const_cast(x) @@ -286,7 +297,7 @@ typedef short int WXTYPE; truncate from a larger to smaller type, static_cast<> can't be used for it as it results in warnings when using some compilers (SGI mipspro for example) */ -#if defined(__INTELC__) && defined(__cplusplus) +#if defined(__INTELC__) template inline T wx_truncate_cast_impl(X x) { @@ -305,7 +316,7 @@ typedef short int WXTYPE; #define wx_truncate_cast(t, x) wx_truncate_cast_impl(x) -#elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310 +#elif defined(__VISUALC__) && __VISUALC__ >= 1310 template inline T wx_truncate_cast_impl(X x) { @@ -329,24 +340,21 @@ typedef short int WXTYPE; #define wxConstCast(obj, className) wx_const_cast(className *, obj) #ifndef HAVE_STD_WSTRING - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */ + #if __cplusplus >= 201103L #define HAVE_STD_WSTRING - #elif defined(__MINGW32__) && wxCHECK_GCC_VERSION(3, 3) - /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */ + #elif defined(__VISUALC__) + #define HAVE_STD_WSTRING + #elif defined(__MINGW32__) #define HAVE_STD_WSTRING #endif #endif #ifndef HAVE_STD_STRING_COMPARE - #if defined(__VISUALC__) && (__VISUALC__ >= 1100) - /* VC++ 6.0 and 5.0 have std::string::compare */ - /* (what about earlier versions?) */ + #if __cplusplus >= 201103L #define HAVE_STD_STRING_COMPARE - #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \ - && wxCHECK_GCC_VERSION(3, 1) - /* GCC 3.1 has std::string::compare; */ - /* 3.0 never was in MinGW, 2.95 hasn't it */ + #elif defined(__VISUALC__) + #define HAVE_STD_STRING_COMPARE + #elif defined(__MINGW32__) || defined(__CYGWIN32__) #define HAVE_STD_STRING_COMPARE #endif #endif @@ -357,31 +365,41 @@ typedef short int WXTYPE; #endif #endif -#if defined(__has_include) - #if !defined(HAVE_TYPE_TRAITS) && __has_include() +/* + Check for C++11 compilers, it is important to do it before the + __has_include() checks because at least g++ 4.9.2+ __has_include() returns + true for C++11 headers which can't be compiled in non-C++11 mode. + */ +#if __cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10) + #ifndef HAVE_TYPE_TRAITS #define HAVE_TYPE_TRAITS #endif - + #ifndef HAVE_STD_UNORDERED_MAP + #define HAVE_STD_UNORDERED_MAP + #endif + #ifndef HAVE_STD_UNORDERED_SET + #define HAVE_STD_UNORDERED_SET + #endif +#elif defined(__has_include) + /* + We're in non-C++11 mode here, so only test for pre-C++11 headers. As + mentioned above, using __has_include() to test for C++11 would wrongly + detect them even though they can't be used in this case, don't do it. + */ #if !defined(HAVE_TR1_TYPE_TRAITS) && __has_include() #define HAVE_TR1_TYPE_TRAITS #endif - #if !defined(HAVE_STD_UNORDERED_MAP) && __has_include() - #define HAVE_STD_UNORDERED_MAP - #endif - #if !defined(HAVE_TR1_UNORDERED_MAP) && __has_include() #define HAVE_TR1_UNORDERED_MAP #endif - #if !defined(HAVE_STD_UNORDERED_SET) && __has_include() - #define HAVE_STD_UNORDERED_SET - #endif - #if !defined(HAVE_TR1_UNORDERED_SET) && __has_include() #define HAVE_TR1_UNORDERED_SET #endif -#endif // defined(__has_include) +#endif /* defined(__has_include) */ + +#endif /* __cplusplus */ /* provide replacement for C99 va_copy() if the compiler doesn't have it */ @@ -397,13 +415,6 @@ typedef short int WXTYPE; special cases. */ - #ifdef __WATCOMC__ - /* Watcom uses array type for va_list except for PPC and Alpha */ - #if !defined(__PPC__) && !defined(__AXP__) - #define VA_LIST_IS_ARRAY - #endif - #endif /* __WATCOMC__ */ - #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32)) /* PPC using SysV ABI and NT/PPC are special in that they use an @@ -497,7 +508,7 @@ typedef short int WXTYPE; /* wxCALLBACK should be used for the functions which are called back by */ /* Windows (such as compare function for wxListCtrl) */ -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) #define wxCALLBACK wxSTDCALL #else /* no stdcall under Unix nor Win16 */ @@ -508,8 +519,6 @@ typedef short int WXTYPE; #if defined(__VISUALC__) #define wxC_CALLING_CONV _cdecl -#elif defined(__VISAGECPP__) - #define wxC_CALLING_CONV _Optlink #else /* !Visual C++ */ #define wxC_CALLING_CONV #endif /* compiler */ @@ -547,7 +556,7 @@ typedef short int WXTYPE; # define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn)) # elif defined( __GNUC__ ) # define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn)) -# elif wxCHECK_VISUALC_VERSION(7) +# elif defined(__VISUALC__) # define WX_ATTRIBUTE_NORETURN __declspec(noreturn) # else # define WX_ATTRIBUTE_NORETURN @@ -572,9 +581,9 @@ typedef short int WXTYPE; /* The basic compiler-specific construct to generate a deprecation warning. */ #ifdef __clang__ #define wxDEPRECATED_DECL __attribute__((deprecated)) -#elif wxCHECK_GCC_VERSION(3, 1) +#elif defined(__GNUC__) #define wxDEPRECATED_DECL __attribute__((deprecated)) -#elif defined(__VISUALC__) && (__VISUALC__ >= 1300) +#elif defined(__VISUALC__) #define wxDEPRECATED_DECL __declspec(deprecated) #else #define wxDEPRECATED_DECL @@ -653,17 +662,40 @@ typedef short int WXTYPE; inline bool wxIsSameDouble(double x, double y) { return x == y; } wxGCC_WARNING_RESTORE(float-equal) */ -#if wxCHECK_GCC_VERSION(4, 6) +#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) # define wxGCC_WARNING_SUPPRESS(x) \ _Pragma (wxSTRINGIZE(GCC diagnostic push)) \ _Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x)))) # define wxGCC_WARNING_RESTORE(x) \ _Pragma (wxSTRINGIZE(GCC diagnostic pop)) -#else /* gcc < 4.6 or not gcc at all */ +#else /* gcc < 4.6 or not gcc and not clang at all */ # define wxGCC_WARNING_SUPPRESS(x) # define wxGCC_WARNING_RESTORE(x) #endif +/* + Macros to suppress and restore clang warning only when it is valid. + + Example: + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) + virtual wxClassInfo *GetClassInfo() const + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) +*/ +#if defined(__has_warning) +# define wxCLANG_HAS_WARNING(x) __has_warning(x) /* allow macro expansion for the warning name */ +# define wxCLANG_IF_VALID_WARNING(x,y) \ + wxCONCAT(wxCLANG_IF_VALID_WARNING_,wxCLANG_HAS_WARNING(wxSTRINGIZE(wxCONCAT(-W,x))))(y) +# define wxCLANG_IF_VALID_WARNING_0(x) +# define wxCLANG_IF_VALID_WARNING_1(x) x +# define wxCLANG_WARNING_SUPPRESS(x) \ + wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_SUPPRESS(x)) +# define wxCLANG_WARNING_RESTORE(x) \ + wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_RESTORE(x)) +#else +# define wxCLANG_WARNING_SUPPRESS(x) +# define wxCLANG_WARNING_RESTORE(x) +#endif + /* Combination of the two variants above: should be used for deprecated functions which are defined inline and are used by wxWidgets itself. @@ -678,9 +710,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__) #include -#endif #ifdef __cplusplus @@ -821,13 +851,6 @@ typedef short int WXTYPE; #define WXUNUSED_IN_UNICODE(param) param #endif -/* some arguments are not used in WinCE build */ -#ifdef __WXWINCE__ - #define WXUNUSED_IN_WINCE(param) WXUNUSED(param) -#else - #define WXUNUSED_IN_WINCE(param) param -#endif - /* unused parameters in non stream builds */ #if wxUSE_STREAMS #define WXUNUSED_UNLESS_STREAMS(param) param @@ -860,17 +883,11 @@ typedef short int WXTYPE; /* compiler specific settings */ /* ---------------------------------------------------------------------------- */ -#if wxONLY_WATCOM_EARLIER_THAN(1,4) - typedef short mode_t; -#endif - /* where should i put this? we need to make sure of this as it breaks */ /* the code. */ #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) -# ifdef wxUSE_DEBUG_NEW_ALWAYS # undef wxUSE_DEBUG_NEW_ALWAYS # define wxUSE_DEBUG_NEW_ALWAYS 0 -# endif #endif /* ---------------------------------------------------------------------------- */ @@ -1106,25 +1123,13 @@ typedef wxUint32 wxDword; #define wxLongLong_t __int64 #define wxLongLongSuffix i64 #define wxLongLongFmtSpec "L" -#elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__))) - #define wxLongLong_t __int64 - #define wxLongLongSuffix i64 - #define wxLongLongFmtSpec "L" -#elif defined(__DIGITALMARS__) - #define wxLongLong_t __int64 - #define wxLongLongSuffix LL - #define wxLongLongFmtSpec "ll" #elif defined(__MINGW32__) #define wxLongLong_t long long #define wxLongLongSuffix ll #define wxLongLongFmtSpec "I64" -#elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 - #define wxLongLong_t long long #elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ defined(__GNUC__) || \ - defined(__CYGWIN__) || \ - defined(__WXMICROWIN__) || \ - (defined(__DJGPP__) && __DJGPP__ >= 2) + defined(__CYGWIN__) #define wxLongLong_t long long #define wxLongLongSuffix ll #define wxLongLongFmtSpec "ll" @@ -1202,8 +1207,6 @@ typedef wxUint32 wxDword; #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED) #define HAVE_SSIZE_T #endif -#elif wxCHECK_WATCOM_VERSION(1,4) - #define HAVE_SSIZE_T #endif #endif /* !HAVE_SSIZE_T */ @@ -1232,8 +1235,7 @@ typedef wxUint32 wxDword; 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) */ -// (dolphin-emu) Just disable __w64 usage. It's not meant to be used anymore, -// even on 32bit builds. +// XXX: Dolphin. Causes unnecessary build warnings. #if 0 #define wxW64 __w64 #else @@ -1263,7 +1265,7 @@ typedef wxUint32 wxDword; #else /* This should never happen for the current architectures but if you're - using one where it does, please contact wx-dev@lists.wxwidgets.org. + using one where it does, please contact wx-dev@googlegroups.com. */ #error "Pointers can't be stored inside integer types." #endif @@ -1278,9 +1280,7 @@ inline wxUIntPtr wxPtrToUInt(const void *p) doing here. Same thing with icc with -Wall. */ #ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif + #pragma warning(push) /* pointer truncation from '' to '' */ #pragma warning(disable: 4311) #elif defined(__INTELC__) @@ -1291,7 +1291,7 @@ inline wxUIntPtr wxPtrToUInt(const void *p) return wx_reinterpret_cast(wxUIntPtr, p); -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) +#if defined(__VISUALC__) || defined(__INTELC__) #pragma warning(pop) #endif } @@ -1299,9 +1299,7 @@ inline wxUIntPtr wxPtrToUInt(const void *p) inline void *wxUIntToPtr(wxUIntPtr p) { #ifdef __VISUALC__ - #if __VISUALC__ >= 1200 - #pragma warning(push) - #endif + #pragma warning(push) /* conversion to type of greater size */ #pragma warning(disable: 4312) #elif defined(__INTELC__) @@ -1312,7 +1310,7 @@ inline void *wxUIntToPtr(wxUIntPtr p) return wx_reinterpret_cast(void *, p); -#if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__) +#if defined(__VISUALC__) || defined(__INTELC__) #pragma warning(pop) #endif } @@ -1548,7 +1546,21 @@ typedef double wxDouble; #define wxUINT64_SWAP_ON_LE(val) (val) #define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val) #define wxINT64_SWAP_ON_LE(val) (val) + + #define wxUINT64_SWAP_ON_BE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_BE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val) + #define wxUINT64_SWAP_ON_LE_IN_PLACE(val) + #define wxINT64_SWAP_ON_LE_IN_PLACE(val) #endif + + #define wxUINT16_SWAP_ON_BE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_BE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val) + #define wxUINT16_SWAP_ON_LE_IN_PLACE(val) + #define wxINT16_SWAP_ON_LE_IN_PLACE(val) + #define wxUINT32_SWAP_ON_BE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_BE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_LE_IN_PLACE(val) + #define wxINT32_SWAP_ON_LE_IN_PLACE(val) #else #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val) #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val) @@ -1563,46 +1575,20 @@ typedef double wxDouble; #define wxUINT64_SWAP_ON_BE(val) (val) #define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val) #define wxINT64_SWAP_ON_BE(val) (val) + #define wxUINT64_SWAP_ON_BE_IN_PLACE(val) + #define wxINT64_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT64_SWAP_ON_LE_IN_PLACE(val) val = wxUINT64_SWAP_ALWAYS(val) + #define wxINT64_SWAP_ON_LE_IN_PLACE(val) val = wxINT64_SWAP_ALWAYS(val) #endif -#endif -/* ---------------------------------------------------------------------------- */ -/* template workarounds for buggy compilers */ -/* ---------------------------------------------------------------------------- */ - -#if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3, 4 ) - /* 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 */ -# define wxUSE_MEMBER_TEMPLATES 0 -# define wxUSE_FUNC_TEMPLATE_POINTER 0 -#endif - -#ifndef wxUSE_MEMBER_TEMPLATES -# define wxUSE_MEMBER_TEMPLATES 1 -#endif - -#ifndef wxUSE_FUNC_TEMPLATE_POINTER -# define wxUSE_FUNC_TEMPLATE_POINTER 1 -#endif - -#if wxUSE_MEMBER_TEMPLATES -# define wxTEMPLATED_MEMBER_CALL( method, type ) method() -# define wxTEMPLATED_MEMBER_FIX( type ) -#else -# define wxTEMPLATED_MEMBER_CALL( method, type ) method((type*)NULL) -# define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL -#endif - -#if defined(_MSC_VER) && _MSC_VER <= 1200 -# define wxTEMPLATED_FUNCTION_FIX( type ), wxTEMPLATED_MEMBER_FIX(type) -# define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type; -#else -# define wxTEMPLATED_FUNCTION_FIX( type ) -# define wxINFUNC_CLASS_TYPE_FIX( type ) + #define wxUINT16_SWAP_ON_BE_IN_PLACE(val) + #define wxINT16_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT16_SWAP_ON_LE_IN_PLACE(val) val = wxUINT16_SWAP_ALWAYS(val) + #define wxINT16_SWAP_ON_LE_IN_PLACE(val) val = wxINT16_SWAP_ALWAYS(val) + #define wxUINT32_SWAP_ON_BE_IN_PLACE(val) + #define wxINT32_SWAP_ON_BE_IN_PLACE(val) + #define wxUINT32_SWAP_ON_LE_IN_PLACE(val) val = wxUINT32_SWAP_ALWAYS(val) + #define wxINT32_SWAP_ON_LE_IN_PLACE(val) val = wxINT32_SWAP_ALWAYS(val) #endif /* ---------------------------------------------------------------------------- */ @@ -1732,11 +1718,7 @@ enum wxBorder }; /* This makes it easier to specify a 'normal' border for a control */ -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -#define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE -#else #define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN -#endif /* ---------------------------------------------------------------------------- */ /* Window style flags */ @@ -1786,7 +1768,12 @@ enum wxBorder /* * Window (Frame/dialog/subwindow/panel item) style flags */ -#define wxVSCROLL 0x80000000 + +/* The cast is needed to avoid g++ -Wnarrowing warnings when initializing + * values of int type with wxVSCROLL on 32 bit platforms, where its value is + * greater than INT_MAX. + */ +#define wxVSCROLL ((int)0x80000000) #define wxHSCROLL 0x40000000 #define wxCAPTION 0x20000000 @@ -1863,10 +1850,9 @@ enum wxBorder * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle()) */ -/* by default, TransferDataTo/FromWindow() only work on direct children of the */ -/* window (compatible behaviour), set this flag to make them recursively */ -/* descend into all subwindows */ -#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001 +/* This flag is obsolete as recursive validation is now the default (and only + * possible) behaviour. Simply don't use it any more in the new code. */ +#define wxWS_EX_VALIDATE_RECURSIVELY 0x00000000 /* used to be 1 */ /* wxCommandEvents and the objects of the derived classes are forwarded to the */ /* parent window and so on recursively by default. Using this flag for the */ @@ -1947,12 +1933,6 @@ enum wxBorder /* always show an entire number of rows */ #define wxLB_INT_HEIGHT 0x0800 -#if WXWIN_COMPATIBILITY_2_6 - /* deprecated synonyms */ - #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */ - #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */ -#endif - /* * wxComboBox style flags */ @@ -2046,13 +2026,13 @@ enum wxBorder #define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */ #define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */ -#define wxICON_EXCLAMATION 0x00000100 -#define wxICON_HAND 0x00000200 -#define wxICON_WARNING wxICON_EXCLAMATION -#define wxICON_ERROR wxICON_HAND +#define wxICON_WARNING 0x00000100 +#define wxICON_ERROR 0x00000200 #define wxICON_QUESTION 0x00000400 #define wxICON_INFORMATION 0x00000800 -#define wxICON_STOP wxICON_HAND +#define wxICON_EXCLAMATION wxICON_WARNING +#define wxICON_HAND wxICON_ERROR +#define wxICON_STOP wxICON_ERROR #define wxICON_ASTERISK wxICON_INFORMATION #define wxHELP 0x00001000 @@ -2092,8 +2072,10 @@ enum wxBackgroundStyle */ wxBG_STYLE_PAINT, - - /* this is a Mac-only style, don't use in portable code */ + /* + Indicates that the window background is not erased, letting the parent + window show through. + */ wxBG_STYLE_TRANSPARENT, /* this style is deprecated and doesn't do anything, don't use */ @@ -2316,14 +2298,17 @@ enum wxStandardID }; /* ---------------------------------------------------------------------------- */ -/* wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h) */ +/* wxWindowID type */ /* ---------------------------------------------------------------------------- */ -/* special care should be taken with this type under Windows where the real */ -/* window id is unsigned, so we must always do the cast before comparing them */ -/* (or else they would be always different!). Using wxGetWindowId() which does */ -/* the cast itself is recommended. Note that this type can't be unsigned */ -/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ +/* + * wxWindowID used to be just a typedef defined here, now it's a class, but we + * still continue to define it here for compatibility, so that the code using + * it continues to compile even if it includes just wx/defs.h. + * + * Notice that wx/windowid.h can only be included after wxID_XYZ definitions + * (as it uses them). + */ #if defined(__cplusplus) && wxUSE_GUI #include "wx/windowid.h" #endif @@ -2435,8 +2420,6 @@ enum wxHatchStyle wxPenStyle, wxPenCap, wxPenJoin enum values instead! */ -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - /* don't use any elements of this enum in the new code */ enum wxDeprecatedGUIConstants { @@ -2486,7 +2469,6 @@ enum wxDeprecatedGUIConstants wxFIRST_HATCH = wxHATCHSTYLE_FIRST, wxLAST_HATCH = wxHATCHSTYLE_LAST }; -#endif /* ToolPanel in wxFrame (VZ: unused?) */ enum @@ -2640,11 +2622,6 @@ enum wxKeyCode WXK_SCROLL, WXK_PAGEUP, WXK_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_PRIOR = WXK_PAGEUP, - WXK_NEXT = WXK_PAGEDOWN, -#endif - WXK_NUMPAD_SPACE, WXK_NUMPAD_TAB, WXK_NUMPAD_ENTER, @@ -2659,10 +2636,6 @@ enum wxKeyCode WXK_NUMPAD_DOWN, WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN, -#if WXWIN_COMPATIBILITY_2_6 - WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP, - WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN, -#endif WXK_NUMPAD_END, WXK_NUMPAD_BEGIN, WXK_NUMPAD_INSERT, @@ -2686,7 +2659,7 @@ enum wxKeyCode WXK_COMMAND = WXK_CONTROL, /* Hardware-specific buttons */ - WXK_SPECIAL1 = 193, + WXK_SPECIAL1 = WXK_WINDOWS_MENU + 2, /* Skip WXK_RAW_CONTROL if necessary */ WXK_SPECIAL2, WXK_SPECIAL3, WXK_SPECIAL4, @@ -2705,7 +2678,25 @@ enum wxKeyCode WXK_SPECIAL17, WXK_SPECIAL18, WXK_SPECIAL19, - WXK_SPECIAL20 + WXK_SPECIAL20, + + WXK_BROWSER_BACK, + WXK_BROWSER_FORWARD, + WXK_BROWSER_REFRESH, + WXK_BROWSER_STOP, + WXK_BROWSER_SEARCH, + WXK_BROWSER_FAVORITES, + WXK_BROWSER_HOME, + WXK_VOLUME_MUTE, + WXK_VOLUME_DOWN, + WXK_VOLUME_UP, + WXK_MEDIA_NEXT_TRACK, + WXK_MEDIA_PREV_TRACK, + WXK_MEDIA_STOP, + WXK_MEDIA_PLAY_PAUSE, + WXK_LAUNCH_MAIL, + WXK_LAUNCH_APP1, + WXK_LAUNCH_APP2 }; /* This enum contains bit mask constants used in wxKeyEvent */ @@ -2718,7 +2709,7 @@ enum wxKeyModifier wxMOD_SHIFT = 0x0004, wxMOD_META = 0x0008, wxMOD_WIN = wxMOD_META, -#if defined(__WXMAC__) || defined(__WXCOCOA__) +#if defined(__WXMAC__) wxMOD_RAW_CONTROL = 0x0010, #else wxMOD_RAW_CONTROL = wxMOD_CONTROL, @@ -2731,7 +2722,7 @@ enum wxKeyModifier #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) /* Paper types */ -typedef enum +enum wxPaperSize { wxPAPER_NONE, /* Use specific dimensions */ wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */ @@ -2854,7 +2845,7 @@ typedef enum wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */ wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */ wxPAPER_A1 /* A1 Sheet 594 x 841 mm */ -} wxPaperSize; +}; /* Printing orientation */ enum wxPrintOrientation @@ -2931,7 +2922,7 @@ typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); #endif /* macro to specify "All Files" on different platforms */ -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) # define wxALL_FILES_PATTERN wxT("*.*") # define wxALL_FILES gettext_noop("All files (*.*)|*.*") #else @@ -2983,12 +2974,6 @@ typedef unsigned long WXDWORD; typedef unsigned short WXWORD; typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; -#if wxOSX_USE_CARBON -typedef struct OpaqueControlRef* WXWidget ; -typedef struct OpaqueWindowPtr* WXWindow ; -typedef struct __AGLPixelFormatRec *WXGLPixelFormat; -typedef struct __AGLContextRec *WXGLContext; -#endif typedef void* WXDisplay; @@ -3033,13 +3018,10 @@ DECLARE_WXMAC_OPAQUE_REF( MenuRef ) typedef IconRef WXHICON ; typedef HIShapeRef WXHRGN; -#if wxOSX_USE_CARBON -typedef MenuRef WXHMENU; -#endif #endif -#if defined( __WXCOCOA__ ) || defined(__WXMAC__) +#if defined(__WXMAC__) /* Definitions of 32-bit/64-bit types * These are typedef'd exactly the same way in newer OS X headers so @@ -3140,10 +3122,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSView); DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat); DECLARE_WXCOCOA_OBJC_CLASS( NSPrintInfo ); -#ifndef __WXMAC__ -typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ -#endif -#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ +#endif /* __WXMAC__ &__DARWIN__ */ #ifdef __WXMAC__ @@ -3166,14 +3145,22 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIImage); DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); DECLARE_WXCOCOA_OBJC_CLASS(NSSet); DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); +DECLARE_WXCOCOA_OBJC_CLASS(UIWebView); typedef WX_UIWindow WXWindow; typedef WX_UIView WXWidget; typedef WX_EAGLContext WXGLContext; typedef WX_NSString* WXGLPixelFormat; +typedef WX_UIWebView OSXWebViewPtr; #endif +#if wxOSX_USE_COCOA_OR_CARBON +DECLARE_WXCOCOA_OBJC_CLASS(WebView); +typedef WX_WebView OSXWebViewPtr; +#endif + + #endif /* __WXMAC__ */ /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ @@ -3228,16 +3215,16 @@ typedef WXHWND WXWidget; #endif #ifdef __WIN64__ -typedef unsigned __int64 WXWPARAM; -typedef __int64 WXLPARAM; -typedef __int64 WXLRESULT; +typedef wxUint64 WXWPARAM; +typedef wxInt64 WXLPARAM; +typedef wxInt64 WXLRESULT; #else typedef wxW64 unsigned int WXWPARAM; typedef wxW64 long WXLPARAM; typedef wxW64 long WXLRESULT; #endif -#if defined(__GNUWIN32__) || defined(__WXMICROWIN__) +#if defined(__GNUWIN32__) typedef int (*WXFARPROC)(); #else typedef int (__stdcall *WXFARPROC)(); @@ -3245,115 +3232,6 @@ typedef int (__stdcall *WXFARPROC)(); #endif /* __WIN32__ */ -#if defined(__OS2__) -typedef unsigned long DWORD; -typedef unsigned short WORD; -#endif - -#if defined(__WXPM__) || defined(__EMX__) -#ifdef __WXPM__ -/* Stand-ins for OS/2 types, to avoid #including all of os2.h */ -typedef unsigned long WXHWND; -typedef unsigned long WXHANDLE; -typedef unsigned long WXHICON; -typedef unsigned long WXHFONT; -typedef unsigned long WXHMENU; -typedef unsigned long WXHPEN; -typedef unsigned long WXHBRUSH; -typedef unsigned long WXHPALETTE; -typedef unsigned long WXHCURSOR; -typedef unsigned long WXHRGN; -typedef unsigned long WXHACCEL; -typedef unsigned long WXHINSTANCE; -typedef unsigned long WXHMODULE; -typedef unsigned long WXHBITMAP; -typedef unsigned long WXHDC; -typedef unsigned int WXUINT; -typedef unsigned long WXDWORD; -typedef unsigned short WXWORD; - -typedef unsigned long WXCOLORREF; -typedef void * WXMSG; -typedef unsigned long WXHTREEITEM; - -typedef void * WXDRAWITEMSTRUCT; -typedef void * WXMEASUREITEMSTRUCT; -typedef void * WXLPCREATESTRUCT; - -typedef WXHWND WXWidget; -#endif -#ifdef __EMX__ -/* Need a well-known type for WXFARPROC - below. MPARAM is typedef'ed too late. */ -#define WXWPARAM void * -#define WXLPARAM void * -#else -#define WXWPARAM MPARAM -#define WXLPARAM MPARAM -#endif -#define RECT RECTL -#define LOGFONT FATTRS -#define LOWORD SHORT1FROMMP -#define HIWORD SHORT2FROMMP - -typedef unsigned long WXMPARAM; -typedef unsigned long WXMSGID; -typedef void* WXRESULT; -/* typedef int (*WXFARPROC)(); */ -/* some windows handles not defined by PM */ -typedef unsigned long HANDLE; -typedef unsigned long HICON; -typedef unsigned long HFONT; -typedef unsigned long HMENU; -typedef unsigned long HPEN; -typedef unsigned long HBRUSH; -typedef unsigned long HPALETTE; -typedef unsigned long HCURSOR; -typedef unsigned long HINSTANCE; -typedef unsigned long HIMAGELIST; -typedef unsigned long HGLOBAL; -#endif /* WXPM || EMX */ - -#if defined (__WXPM__) -/* WIN32 graphics types for OS/2 GPI */ - -/* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */ -#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) - -typedef unsigned long COLORREF; -#define GetRValue(rgb) ((unsigned char)((rgb) >> 16)) -#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8)) -#define GetBValue(rgb) ((unsigned char)(rgb)) -#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) -#define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) -/* OS2's RGB/RGB2 is backwards from this */ -typedef struct tagPALETTEENTRY -{ - char bRed; - char bGreen; - char bBlue; - char bFlags; -} PALETTEENTRY; -typedef struct tagLOGPALETTE -{ - WORD palVersion; - WORD palNumentries; - WORD PALETTEENTRY[1]; -} LOGPALETTE; - -#if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__) - /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */ -typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); -#else -#if defined(__EMX__) && !defined(_System) -#define _System -#endif -typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); -#endif - -#endif /* __WXPM__ */ - - #if defined(__WXMOTIF__) || defined(__WXX11__) /* Stand-ins for X/Xt/Motif types */ typedef void* WXWindow; @@ -3457,6 +3335,10 @@ typedef struct _PangoFontDescription PangoFontDescription; typedef const void* WXWidget; #endif /* DFB */ +#ifdef __WXQT__ +#include "wx/qt/defs.h" +#endif + /* This is required because of clashing macros in windows.h, which may be */ /* included before or after wxWidgets classes, and therefore must be */ /* disabled here before any significant wxWidgets headers are included. */ diff --git a/Externals/wxWidgets3/include/wx/dialog.h b/Externals/wxWidgets3/include/wx/dialog.h index 7110151356..1150fbdbf3 100644 --- a/Externals/wxWidgets3/include/wx/dialog.h +++ b/Externals/wxWidgets3/include/wx/dialog.h @@ -28,11 +28,7 @@ class wxTextSizerWrapper; #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) -#else #define wxDEFAULT_DIALOG_STYLE (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX) -#endif // Layout adaptation levels, for SetLayoutAdaptationLevel @@ -80,10 +76,8 @@ public: virtual void ShowWindowModal () ; virtual void SendWindowModalDialogEvent ( wxEventType type ); -#ifdef wxHAS_EVENT_BIND template void ShowWindowModalThenDo(const Functor& onEndModal); -#endif // wxHAS_EVENT_BIND // Modal dialogs have a return code - usually the id of the last // pressed button @@ -272,7 +266,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxDialogBase); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; /*! @@ -284,7 +278,7 @@ private: class WXDLLIMPEXP_CORE wxDialogLayoutAdapter: public wxObject { - DECLARE_CLASS(wxDialogLayoutAdapter) + wxDECLARE_CLASS(wxDialogLayoutAdapter); public: wxDialogLayoutAdapter() {} @@ -302,17 +296,17 @@ public: class WXDLLIMPEXP_CORE wxStandardDialogLayoutAdapter: public wxDialogLayoutAdapter { - DECLARE_CLASS(wxStandardDialogLayoutAdapter) + wxDECLARE_CLASS(wxStandardDialogLayoutAdapter); public: wxStandardDialogLayoutAdapter() {} // Overrides // Indicate that adaptation should be done - virtual bool CanDoLayoutAdaptation(wxDialog* dialog); + virtual bool CanDoLayoutAdaptation(wxDialog* dialog) wxOVERRIDE; // Do layout adaptation - virtual bool DoLayoutAdaptation(wxDialog* dialog); + virtual bool DoLayoutAdaptation(wxDialog* dialog) wxOVERRIDE; // Implementation @@ -349,7 +343,7 @@ public: static int DoMustScroll(wxDialog* dialog, wxSize& windowSize, wxSize& displaySize); }; -#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) +#if defined(__WXUNIVERSAL__) #include "wx/univ/dialog.h" #else #if defined(__WXMSW__) @@ -362,10 +356,8 @@ public: #include "wx/gtk1/dialog.h" #elif defined(__WXMAC__) #include "wx/osx/dialog.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/dialog.h" - #elif defined(__WXPM__) - #include "wx/os2/dialog.h" + #elif defined(__WXQT__) + #include "wx/qt/dialog.h" #endif #endif @@ -381,10 +373,10 @@ public: int GetReturnCode() const { return GetDialog()->GetReturnCode(); } - virtual wxEvent *Clone() const { return new wxWindowModalDialogEvent (*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowModalDialogEvent (*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent ) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent); }; wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent ); @@ -397,7 +389,6 @@ typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDial #define EVT_WINDOW_MODAL_DIALOG_CLOSED(winid, func) \ wx__DECLARE_EVT1(wxEVT_WINDOW_MODAL_DIALOG_CLOSED, winid, wxWindowModalDialogEventHandler(func)) -#ifdef wxHAS_EVENT_BIND template class wxWindowModalDialogEventFunctor { @@ -435,7 +426,6 @@ void wxDialogBase::ShowWindowModalThenDo(const Functor& onEndModal) wxWindowModalDialogEventFunctor(onEndModal)); ShowWindowModal(); } -#endif // wxHAS_EVENT_BIND #endif // _WX_DIALOG_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/dirdlg.h b/Externals/wxWidgets3/include/wx/dirdlg.h index b7b7474ab5..dfdbffc737 100644 --- a/Externals/wxWidgets3/include/wx/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/dirdlg.h @@ -11,6 +11,8 @@ #ifndef _WX_DIRDLG_H_BASE_ #define _WX_DIRDLG_H_BASE_ +#include "wx/defs.h" + #if wxUSE_DIRDLG #include "wx/dialog.h" @@ -29,11 +31,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; // deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it #define wxDD_NEW_DIR_BUTTON 0 -#ifdef __WXWINCE__ - #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE -#else - #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) -#endif +#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) //------------------------------------------------------------------------- // wxDirDialogBase @@ -72,13 +70,6 @@ public: return true; } -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - virtual void SetMessage(const wxString& message) { m_message = message; } virtual void SetPath(const wxString& path) { m_path = path; } @@ -95,13 +86,9 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/generic/dirdlgg.h" #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && (!wxUSE_OLE || \ - (defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS)) +#elif defined(__WXMSW__) && !wxUSE_OLE #include "wx/generic/dirdlgg.h" #define wxDirDialog wxGenericDirDialog -#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__) - #include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone - #define wxDirDialog wxGenericDirDialog #elif defined(__WXMSW__) #include "wx/msw/dirdlg.h" // Native MSW #elif defined(__WXGTK20__) @@ -111,14 +98,12 @@ protected: #define wxDirDialog wxGenericDirDialog #elif defined(__WXMAC__) #include "wx/osx/dirdlg.h" // Native Mac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/dirdlg.h" // Native Cocoa #elif defined(__WXMOTIF__) || \ - defined(__WXX11__) || \ - defined(__WXCOCOA__) || \ - defined(__WXPM__) + defined(__WXX11__) #include "wx/generic/dirdlgg.h" // Other ports use generic implementation #define wxDirDialog wxGenericDirDialog +#elif defined(__WXQT__) + #include "wx/qt/dirdlg.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/dlimpexp.h b/Externals/wxWidgets3/include/wx/dlimpexp.h index 800b745fa6..3412137fdf 100644 --- a/Externals/wxWidgets3/include/wx/dlimpexp.h +++ b/Externals/wxWidgets3/include/wx/dlimpexp.h @@ -20,20 +20,22 @@ # define WXIMPORT __attribute__ ((visibility("default"))) #elif defined(__WINDOWS__) /* - __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - as VC++. + __declspec works in BC++ 5 and later as well as VC++. */ -# if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) +# if defined(__VISUALC__) || defined(__BORLANDC__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) /* - While gcc also supports __declspec(dllexport), it creates unusably huge - DLL files since gcc 4.5 (while taking horribly long amounts of time), + While gcc also supports __declspec(dllexport), it created unusably huge + DLL files in gcc 4.[56] (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+. + quite well for 4.5+. However the problem was fixed in 4.7 and later and + not exporting everything creates smaller DLLs (~8% size difference), so + do use the explicit attributes again for the newer versions. */ -# elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5) +# elif defined(__GNUC__) && \ + (!wxCHECK_GCC_VERSION(4, 5) || wxCHECK_GCC_VERSION(4, 7)) /* __declspec could be used here too but let's use the native __attribute__ instead for clarity. @@ -41,21 +43,6 @@ # define WXEXPORT __attribute__((dllexport)) # define WXIMPORT __attribute__((dllimport)) # endif -#elif defined(__WXPM__) -# if defined (__WATCOMC__) -# define WXEXPORT __declspec(dllexport) - /* - __declspec(dllimport) prepends __imp to imported symbols. We do NOT - want that! - */ -# define WXIMPORT -# elif defined(__EMX__) -# define WXEXPORT -# define WXIMPORT -# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) -# define WXEXPORT _Export -# define WXIMPORT _Export -# endif #elif defined(__CYGWIN__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) @@ -326,39 +313,4 @@ #define WXDLLEXPORT WXDLLIMPEXP_CORE #define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE -/* - MSVC up to 6.0 needs to be explicitly told to export template instantiations - used by the DLL clients, use this macro to do it like this: - - template class Foo { ... }; - WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( Foo ) - - (notice that currently we only need this for wxBase and wxCore libraries) - */ -#if defined(__VISUALC__) && (__VISUALC__ <= 1200) - #ifdef WXMAKINGDLL_BASE - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \ - template class WXDLLIMPEXP_BASE decl; - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \ - template class WXDLLIMPEXP_CORE decl; - #else - /* - We need to disable this warning when using this macro, as - recommended by Microsoft itself: - - http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958 - */ - #pragma warning(disable:4231) - - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) \ - extern template class WXDLLIMPEXP_BASE decl; - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) \ - extern template class WXDLLIMPEXP_CORE decl; - #endif -#else /* not VC <= 6 */ - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE(decl) - #define WXDLLIMPEXP_TEMPLATE_INSTANCE_CORE(decl) -#endif /* VC6/others */ - #endif /* _WX_DLIMPEXP_H_ */ - diff --git a/Externals/wxWidgets3/include/wx/dlist.h b/Externals/wxWidgets3/include/wx/dlist.h index b69f617d9b..e0d23106e0 100644 --- a/Externals/wxWidgets3/include/wx/dlist.h +++ b/Externals/wxWidgets3/include/wx/dlist.h @@ -35,8 +35,6 @@ public: class compatibility_iterator { private: - /* Workaround for broken VC6 nested class name resolution */ - typedef typename BaseListType::iterator iterator; friend class wxDList; iterator m_iter; diff --git a/Externals/wxWidgets3/include/wx/dnd.h b/Externals/wxWidgets3/include/wx/dnd.h index 9d9f2e25ca..2f3f333329 100644 --- a/Externals/wxWidgets3/include/wx/dnd.h +++ b/Externals/wxWidgets3/include/wx/dnd.h @@ -222,8 +222,8 @@ protected: #include "wx/gtk1/dnd.h" #elif defined(__WXMAC__) #include "wx/osx/dnd.h" -#elif defined(__WXPM__) - #include "wx/os2/dnd.h" +#elif defined(__WXQT__) + #include "wx/qt/dnd.h" #endif // ---------------------------------------------------------------------------- @@ -239,7 +239,7 @@ public: virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0; - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; private: wxDECLARE_NO_COPY_CLASS(wxTextDropTarget); @@ -255,7 +255,7 @@ public: virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) = 0; - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; private: wxDECLARE_NO_COPY_CLASS(wxFileDropTarget); diff --git a/Externals/wxWidgets3/include/wx/docmdi.h b/Externals/wxWidgets3/include/wx/docmdi.h index e7dcb7ad02..4ffd2e7509 100644 --- a/Externals/wxWidgets3/include/wx/docmdi.h +++ b/Externals/wxWidgets3/include/wx/docmdi.h @@ -18,14 +18,6 @@ #include "wx/docview.h" #include "wx/mdi.h" -#ifdef __VISUALC6__ - // "non dll-interface class 'wxDocXXXFrameAny<>' used as base interface for - // dll-interface class 'wxDocMDIXXXFrame'" -- this is bogus as the template - // will be DLL-exported but only once it is used as base class here! - #pragma warning (push) - #pragma warning (disable:4275) -#endif - // Define MDI versions of the doc-view frame classes. Note that we need to // define them as classes for wxRTTI, otherwise we could simply define them as // typedefs. @@ -56,7 +48,7 @@ public: } private: - DECLARE_CLASS(wxDocMDIParentFrame) + wxDECLARE_CLASS(wxDocMDIParentFrame); wxDECLARE_NO_COPY_CLASS(wxDocMDIParentFrame); }; @@ -87,14 +79,10 @@ public: } private: - DECLARE_CLASS(wxDocMDIChildFrame) + wxDECLARE_CLASS(wxDocMDIChildFrame); wxDECLARE_NO_COPY_CLASS(wxDocMDIChildFrame); }; -#ifdef __VISUALC6__ - #pragma warning (pop) -#endif - #endif // wxUSE_MDI_ARCHITECTURE #endif // _WX_DOCMDI_H_ diff --git a/Externals/wxWidgets3/include/wx/docview.h b/Externals/wxWidgets3/include/wx/docview.h index 78bf44d4b4..45cfc585c9 100644 --- a/Externals/wxWidgets3/include/wx/docview.h +++ b/Externals/wxWidgets3/include/wx/docview.h @@ -148,9 +148,7 @@ public: virtual bool AddView(wxView *view); virtual bool RemoveView(wxView *view); -#ifndef __VISUALC6__ wxViewVector GetViewsVector() const; -#endif // !__VISUALC6__ wxList& GetViews() { return m_documentViews; } const wxList& GetViews() const { return m_documentViews; } @@ -220,7 +218,7 @@ private: typedef wxDList DocsList; DocsList m_childDocuments; - DECLARE_ABSTRACT_CLASS(wxDocument) + wxDECLARE_ABSTRACT_CLASS(wxDocument); wxDECLARE_NO_COPY_CLASS(wxDocument); }; @@ -284,7 +282,7 @@ public: protected: // hook the document into event handlers chain here - virtual bool TryBefore(wxEvent& event); + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; wxDocument* m_viewDocument; wxString m_viewTypeName; @@ -293,7 +291,7 @@ protected: wxDocChildFrameAnyBase *m_docChildFrame; private: - DECLARE_ABSTRACT_CLASS(wxView) + wxDECLARE_ABSTRACT_CLASS(wxView); wxDECLARE_NO_COPY_CLASS(wxView); }; @@ -378,7 +376,7 @@ protected: virtual wxView *DoCreateView(); private: - DECLARE_CLASS(wxDocTemplate) + wxDECLARE_CLASS(wxDocTemplate); wxDECLARE_NO_COPY_CLASS(wxDocTemplate); }; @@ -480,10 +478,8 @@ public: wxView *GetAnyUsableView() const; -#ifndef __VISUALC6__ wxDocVector GetDocumentsVector() const; wxDocTemplateVector GetTemplatesVector() const; -#endif // !__VISUALC6__ wxList& GetDocuments() { return m_docs; } wxList& GetTemplates() { return m_templates; } @@ -533,12 +529,6 @@ public: ); #endif -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetHistoryFilesCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - - 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 @@ -554,7 +544,7 @@ protected: #endif // wxUSE_PRINTING_ARCHITECTURE // hook the currently active view into event handlers chain here - virtual bool TryBefore(wxEvent& event); + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; // return the command processor for the current document, if any wxCommandProcessor *GetCurrentCommandProcessor() const; @@ -572,18 +562,11 @@ protected: wxPageSetupDialogData m_pageSetupDialogData; #endif // wxUSE_PRINTING_ARCHITECTURE - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxDocManager) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxDocManager); wxDECLARE_NO_COPY_CLASS(wxDocManager); }; -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxDocManager::GetNoHistoryFiles() const -{ - return GetHistoryFilesCount(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // Base class for child frames -- this is what wxView renders itself into // @@ -774,15 +757,6 @@ private: // otherwise we could simply typedef it // ---------------------------------------------------------------------------- -#ifdef __VISUALC6__ - // "non dll-interface class 'wxDocChildFrameAny<>' used as base interface - // for dll-interface class 'wxDocChildFrame'" -- this is bogus as the - // template will be DLL-exported but only once it is used as base class - // here! - #pragma warning (push) - #pragma warning (disable:4275) -#endif - typedef wxDocChildFrameAny wxDocChildFrameBase; class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase @@ -824,7 +798,7 @@ public: } private: - DECLARE_CLASS(wxDocChildFrame) + wxDECLARE_CLASS(wxDocChildFrame); wxDECLARE_NO_COPY_CLASS(wxDocChildFrame); }; @@ -976,15 +950,10 @@ public: } private: - DECLARE_CLASS(wxDocParentFrame) + wxDECLARE_CLASS(wxDocParentFrame); wxDECLARE_NO_COPY_CLASS(wxDocParentFrame); }; -#ifdef __VISUALC6__ - // reenable warning 4275 - #pragma warning (pop) -#endif - // ---------------------------------------------------------------------------- // Provide simple default printing facilities // ---------------------------------------------------------------------------- @@ -996,11 +965,11 @@ public: wxDocPrintout(wxView *view = NULL, const wxString& title = wxString()); // implement wxPrintout methods - virtual bool OnPrintPage(int page); - virtual bool HasPage(int page); - virtual bool OnBeginDocument(int startPage, int endPage); + virtual bool OnPrintPage(int page) wxOVERRIDE; + virtual bool HasPage(int page) wxOVERRIDE; + virtual bool OnBeginDocument(int startPage, int endPage) wxOVERRIDE; virtual void GetPageInfo(int *minPage, int *maxPage, - int *selPageFrom, int *selPageTo); + int *selPageFrom, int *selPageTo) wxOVERRIDE; virtual wxView *GetView() { return m_printoutView; } @@ -1008,7 +977,7 @@ protected: wxView* m_printoutView; private: - DECLARE_DYNAMIC_CLASS(wxDocPrintout) + wxDECLARE_DYNAMIC_CLASS(wxDocPrintout); wxDECLARE_NO_COPY_CLASS(wxDocPrintout); }; #endif // wxUSE_PRINTING_ARCHITECTURE @@ -1039,7 +1008,6 @@ enum }; #endif // WXWIN_COMPATIBILITY_2_8 -#ifndef __VISUALC6__ inline wxViewVector wxDocument::GetViewsVector() const { return m_documentViews.AsVector(); @@ -1054,7 +1022,6 @@ inline wxDocTemplateVector wxDocManager::GetTemplatesVector() const { return m_templates.AsVector(); } -#endif // !__VISUALC6__ #endif // wxUSE_DOC_VIEW_ARCHITECTURE diff --git a/Externals/wxWidgets3/include/wx/dragimag.h b/Externals/wxWidgets3/include/wx/dragimag.h index 4143ca8898..4f8bc6a717 100644 --- a/Externals/wxWidgets3/include/wx/dragimag.h +++ b/Externals/wxWidgets3/include/wx/dragimag.h @@ -41,7 +41,7 @@ class WXDLLIMPEXP_FWD_CORE wxDC; # include "wx/generic/dragimgg.h" # define wxDragImage wxGenericDragImage -#elif defined(__WXPM__) +#elif defined(__WXQT__) # include "wx/generic/dragimgg.h" # define wxDragImage wxGenericDragImage diff --git a/Externals/wxWidgets3/include/wx/dvrenderers.h b/Externals/wxWidgets3/include/wx/dvrenderers.h index 775bc1a2d8..69ed7817d7 100644 --- a/Externals/wxWidgets3/include/wx/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/dvrenderers.h @@ -72,7 +72,7 @@ private: wxString m_text; wxIcon m_icon; - DECLARE_DYNAMIC_CLASS(wxDataViewIconText) + wxDECLARE_DYNAMIC_CLASS(wxDataViewIconText); }; DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) @@ -115,15 +115,21 @@ public: virtual bool SetValue(const wxVariant& value) = 0; virtual bool GetValue(wxVariant& value) const = 0; - virtual void SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) { } - - virtual void SetEnabled(bool WXUNUSED(enabled)) { } - wxString GetVariantType() const { return m_variantType; } - // helper that calls SetValue and SetAttr: - void PrepareForItem(const wxDataViewModel *model, - const wxDataViewItem& item, unsigned column); + // Prepare for rendering the value of the corresponding item in the given + // column taken from the provided non-null model. + // + // Notice that the column must be the same as GetOwner()->GetModelColumn(), + // it is only passed to this method because the existing code already has + // it and should probably be removed in the future. + // + // Return true if this cell is non-empty or false otherwise (and also if + // the model returned a value of the wrong, i.e. different from our + // GetVariantType(), type, in which case a debug error is also logged). + bool PrepareForItem(const wxDataViewModel *model, + const wxDataViewItem& item, + unsigned column); // renderer properties: virtual void SetMode( wxDataViewCellMode mode ) = 0; @@ -158,7 +164,7 @@ public: virtual void CancelEditing(); virtual bool FinishEditing(); - wxWindow *GetEditorCtrl() { return m_editorCtrl; } + wxWindow *GetEditorCtrl() const { return m_editorCtrl; } virtual bool IsCustomRenderer() const { return false; } @@ -174,21 +180,36 @@ public: // wxDVR_DEFAULT_ALIGNMENT. int GetEffectiveAlignment() const; + // Send wxEVT_DATAVIEW_ITEM_EDITING_STARTED event. + void NotifyEditingStarted(const wxDataViewItem& item); + protected: + // These methods are called from PrepareForItem() and should do whatever is + // needed for the current platform to ensure that the item is rendered + // using the given attributes and enabled/disabled state. + virtual void SetAttr(const wxDataViewItemAttr& attr) = 0; + virtual void SetEnabled(bool enabled) = 0; + // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl void DestroyEditControl(); + // Helper of PrepareForItem() also used in StartEditing(): returns the + // value checking that its type matches our GetVariantType(). + wxVariant CheckedGetValue(const wxDataViewModel* model, + const wxDataViewItem& item, + unsigned column) const; + wxString m_variantType; wxDataViewColumn *m_owner; wxWeakRef m_editorCtrl; - wxDataViewItem m_item; // for m_editorCtrl + wxDataViewItem m_item; // Item being currently edited, if valid. // internal utility, may be used anywhere the window associated with the // renderer is required wxDataViewCtrl* GetView() const; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRendererBase); }; // include the real wxDataViewRenderer declaration for the native ports @@ -208,6 +229,8 @@ protected: #include "wx/gtk/dvrenderer.h" #elif defined(__WXMAC__) #include "wx/osx/dvrenderer.h" + #elif defined(__WXQT__) + #include "wx/qt/dvrenderer.h" #else #error "unknown native wxDataViewCtrl implementation" #endif @@ -285,12 +308,12 @@ public: // Override the base class virtual method to simply store the attribute so // that it can be accessed using GetAttr() from Render() if needed. - virtual void SetAttr(const wxDataViewItemAttr& attr) { m_attr = attr; } + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE { m_attr = attr; } const wxDataViewItemAttr& GetAttr() const { return m_attr; } // Store the enabled state of the item so that it can be accessed from // Render() via GetEnabled() if needed. - virtual void SetEnabled(bool enabled) { m_enabled = enabled; } + virtual void SetEnabled(bool enabled) wxOVERRIDE; bool GetEnabled() const { return m_enabled; } @@ -306,7 +329,7 @@ public: // Prepare DC to use attributes and call Render(). void WXCallRender(wxRect rect, wxDC *dc, int state); - virtual bool IsCustomRenderer() const { return true; } + virtual bool IsCustomRenderer() const wxOVERRIDE { return true; } protected: // helper for GetSize() implementations, respects attributes @@ -332,10 +355,14 @@ private: #include "wx/gtk/dvrenderers.h" #elif defined(__WXMAC__) #include "wx/osx/dvrenderers.h" +#elif defined(__WXQT__) + #include "wx/qt/dvrenderers.h" #else #error "unknown native wxDataViewCtrl implementation" #endif +#if wxUSE_SPINCTRL + // ---------------------------------------------------------------------------- // wxDataViewSpinRenderer // ---------------------------------------------------------------------------- @@ -346,20 +373,22 @@ public: wxDataViewSpinRenderer( int min, int max, wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = 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 Render( wxRect rect, wxDC *dc, int state ); - virtual wxSize GetSize() const; - virtual bool SetValue( const wxVariant &value ); - virtual bool GetValue( wxVariant &value ) const; + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value ) wxOVERRIDE; + virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; private: long m_data; long m_min,m_max; }; -#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__) +#endif // wxUSE_SPINCTRL + +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) // ---------------------------------------------------------------------------- // wxDataViewChoiceRenderer @@ -406,7 +435,7 @@ public: }; -#endif // generic or Carbon versions +#endif // generic version #if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__) @@ -418,17 +447,19 @@ public: class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer { public: - wxDataViewDateRenderer(const wxString &varianttype = wxT("datetime"), + static wxString GetDefaultType() { return wxS("datetime"); } + + wxDataViewDateRenderer(const wxString &varianttype = GetDefaultType(), 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; + virtual bool HasEditorCtrl() const wxOVERRIDE { return true; } + virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value) wxOVERRIDE; + virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value) wxOVERRIDE; + virtual bool SetValue(const wxVariant &value) wxOVERRIDE; + virtual bool GetValue(wxVariant& value) const wxOVERRIDE; + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; private: wxDateTime m_date; diff --git a/Externals/wxWidgets3/include/wx/dynarray.h b/Externals/wxWidgets3/include/wx/dynarray.h index 6495030f0c..a15936c394 100644 --- a/Externals/wxWidgets3/include/wx/dynarray.h +++ b/Externals/wxWidgets3/include/wx/dynarray.h @@ -114,7 +114,7 @@ private: _WX_DECLARE_BASEARRAY_2(T, name, name##_Predicate, classexp) #define _WX_DECLARE_BASEARRAY_2(T, name, predicate, classexp) \ -classexp name : public std::vector \ +class name : public std::vector \ { \ typedef predicate Predicate; \ typedef predicate::CMPFUNC SCMPFUNC; \ diff --git a/Externals/wxWidgets3/include/wx/dynlib.h b/Externals/wxWidgets3/include/wx/dynlib.h index 5487ccc949..0f035d904f 100644 --- a/Externals/wxWidgets3/include/wx/dynlib.h +++ b/Externals/wxWidgets3/include/wx/dynlib.h @@ -19,7 +19,7 @@ #include "wx/dynarray.h" // note that we have our own dlerror() implementation under Darwin -#if (defined(HAVE_DLERROR) && !defined(__EMX__)) || defined(__DARWIN__) +#if defined(HAVE_DLERROR) || defined(__DARWIN__) #define wxHAVE_DYNLIB_ERROR #endif @@ -29,9 +29,7 @@ class WXDLLIMPEXP_FWD_BASE wxDynamicLibraryDetailsCreator; // conditional compilation // ---------------------------------------------------------------------------- -// Note: __OS2__/EMX has to be tested first, since we want to use -// native version, even if configure detected presence of DLOPEN. -#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__) +#if defined(__WINDOWS__) typedef WXHMODULE wxDllType; #elif defined(__DARWIN__) // Don't include dlfcn.h on Darwin, we may be using our own replacements. @@ -296,11 +294,7 @@ public: static void *RawGetSymbol(wxDllType handle, const wxString& name); void *RawGetSymbol(const wxString& name) const { -#if defined (__WXPM__) || defined(__EMX__) - return GetSymbol(name); -#else return RawGetSymbol(m_handle, name); -#endif } #ifdef __WINDOWS__ @@ -347,6 +341,12 @@ public: // string on others: static wxString GetPluginsDirectory(); + // Return the load address of the module containing the given address or + // NULL if not found. + // + // If path output parameter is non-NULL, fill it with the full path to this + // module disk file on success. + static void* GetModuleFromAddress(const void* addr, wxString* path = NULL); #ifdef __WINDOWS__ // return the handle (HMODULE/HINSTANCE) of the DLL with the given name diff --git a/Externals/wxWidgets3/include/wx/editlbox.h b/Externals/wxWidgets3/include/wx/editlbox.h index 7aad2ac205..c264c4c886 100644 --- a/Externals/wxWidgets3/include/wx/editlbox.h +++ b/Externals/wxWidgets3/include/wx/editlbox.h @@ -86,8 +86,8 @@ protected: void OnUpItem(wxCommandEvent& event); void OnDownItem(wxCommandEvent& event); - DECLARE_CLASS(wxEditableListBox) - DECLARE_EVENT_TABLE() + wxDECLARE_CLASS(wxEditableListBox); + wxDECLARE_EVENT_TABLE(); private: void SwapItems(long i1, long i2); diff --git a/Externals/wxWidgets3/include/wx/effects.h b/Externals/wxWidgets3/include/wx/effects.h index adaf951c10..b0e1b574b6 100644 --- a/Externals/wxWidgets3/include/wx/effects.h +++ b/Externals/wxWidgets3/include/wx/effects.h @@ -74,7 +74,7 @@ protected: wxColour m_mediumShadow; // Usually dark grey wxColour m_darkShadow; // Usually black - DECLARE_CLASS(wxEffectsImpl) + wxDECLARE_CLASS(wxEffectsImpl); }; // current versions of g++ don't generate deprecation warnings for classes diff --git a/Externals/wxWidgets3/include/wx/encconv.h b/Externals/wxWidgets3/include/wx/encconv.h index bc464785c8..7c49465f51 100644 --- a/Externals/wxWidgets3/include/wx/encconv.h +++ b/Externals/wxWidgets3/include/wx/encconv.h @@ -33,7 +33,6 @@ enum wxPLATFORM_UNIX = 0, wxPLATFORM_WINDOWS, - wxPLATFORM_OS2, wxPLATFORM_MAC }; diff --git a/Externals/wxWidgets3/include/wx/encinfo.h b/Externals/wxWidgets3/include/wx/encinfo.h index 27b1453847..66b00034e5 100644 --- a/Externals/wxWidgets3/include/wx/encinfo.h +++ b/Externals/wxWidgets3/include/wx/encinfo.h @@ -37,9 +37,8 @@ struct WXDLLIMPEXP_CORE wxNativeEncodingInfo wxFontEncoding encoding; // so that we know what this struct represents #if defined(__WXMSW__) || \ - defined(__WXPM__) || \ defined(__WXMAC__) || \ - defined(__WXCOCOA__) // FIXME: __WXCOCOA__ + defined(__WXQT__) wxNativeEncodingInfo() : facename() diff --git a/Externals/wxWidgets3/include/wx/event.h b/Externals/wxWidgets3/include/wx/event.h index 61ec19c5b3..c70f159f6e 100644 --- a/Externals/wxWidgets3/include/wx/event.h +++ b/Externals/wxWidgets3/include/wx/event.h @@ -27,13 +27,12 @@ #include "wx/tracker.h" #include "wx/typeinfo.h" #include "wx/any.h" +#include "wx/vector.h" -#ifdef wxHAS_EVENT_BIND - #include "wx/meta/convertible.h" -#endif +#include "wx/meta/convertible.h" -// Currently VC6 and VC7 are known to not be able to compile CallAfter() code, -// so disable it for them. +// Currently VC7 is known to not be able to compile CallAfter() code, so +// disable it for it (FIXME-VC7). #if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(8) #include "wx/meta/removeref.h" @@ -96,51 +95,32 @@ typedef int wxEventType; // generate a new unique event type extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); -// define macros to create new event types: -#ifdef wxHAS_EVENT_BIND - // events are represented by an instance of wxEventTypeTag and the - // corresponding type must be specified for type-safety checks +// events are represented by an instance of wxEventTypeTag and the +// corresponding type must be specified for type-safety checks - // define a new custom event type, can be used alone or after event - // declaration in the header using one of the macros below - #define wxDEFINE_EVENT( name, type ) \ - const wxEventTypeTag< type > name( wxNewEventType() ) +// define a new custom event type, can be used alone or after event +// declaration in the header using one of the macros below +#define wxDEFINE_EVENT( name, type ) \ + const wxEventTypeTag< type > name( wxNewEventType() ) - // the general version allowing exporting the event type from DLL, used by - // wxWidgets itself - #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ - extern const expdecl wxEventTypeTag< type > name +// the general version allowing exporting the event type from DLL, used by +// wxWidgets itself +#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ + extern const expdecl wxEventTypeTag< type > name - // this is the version which will normally be used in the user code - #define wxDECLARE_EVENT( name, type ) \ - wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) +// this is the version which will normally be used in the user code +#define wxDECLARE_EVENT( name, type ) \ + wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) - // these macros are only used internally for backwards compatibility and - // allow to define an alias for an existing event type (this is used by - // wxEVT_SPIN_XXX) - #define wxDEFINE_EVENT_ALIAS( name, type, value ) \ - const wxEventTypeTag< type > name( value ) +// these macros are only used internally for backwards compatibility and +// allow to define an alias for an existing event type (this is used by +// wxEVT_SPIN_XXX) +#define wxDEFINE_EVENT_ALIAS( name, type, value ) \ + const wxEventTypeTag< type > name( value ) - #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ - extern const expdecl wxEventTypeTag< type > name -#else // !wxHAS_EVENT_BIND - // the macros are the same ones as above but defined differently as we only - // use the integer event type values to identify events in this case - - #define wxDEFINE_EVENT( name, type ) \ - const wxEventType name( wxNewEventType() ) - - #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \ - extern const expdecl wxEventType name - #define wxDECLARE_EVENT( name, type ) \ - wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type ) - - #define wxDEFINE_EVENT_ALIAS( name, type, value ) \ - const wxEventType name = value - #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ - extern const expdecl wxEventType name -#endif // wxHAS_EVENT_BIND/!wxHAS_EVENT_BIND +#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ + extern const expdecl wxEventTypeTag< type > name // Try to cast the given event handler to the correct handler type: @@ -148,8 +128,6 @@ extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); ( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func ) -#ifdef wxHAS_EVENT_BIND - // The tag is a type associated to the event type (which is an integer itself, // in spite of its name) value. It exists in order to be used as a template // parameter and provide a mapping between the event type values and their @@ -172,8 +150,6 @@ private: wxEventType m_type; }; -#endif // wxHAS_EVENT_BIND - // These are needed for the functor definitions typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); @@ -223,32 +199,26 @@ public: : m_handler( handler ), m_method( method ) { } - virtual void operator()(wxEvtHandler *handler, wxEvent& event); + virtual void operator()(wxEvtHandler *handler, wxEvent& event) wxOVERRIDE; - virtual bool IsMatching(const wxEventFunctor& functor) const + virtual bool IsMatching(const wxEventFunctor& functor) const wxOVERRIDE { if ( wxTypeId(functor) == wxTypeId(*this) ) { const wxObjectEventFunctor &other = static_cast< const wxObjectEventFunctor & >( functor ); - // 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 == 0 ) && - ( m_handler == other.m_handler || other.m_handler == NULL ); + return ( m_method == other.m_method || !other.m_method ) && + ( m_handler == other.m_handler || !other.m_handler ); } else return false; } - virtual wxEvtHandler *GetEvtHandler() const + virtual wxEvtHandler *GetEvtHandler() const wxOVERRIDE { return m_handler; } - virtual wxEventFunction GetEvtMethod() const + virtual wxEventFunction GetEvtMethod() const wxOVERRIDE { return m_method; } private: @@ -286,8 +256,6 @@ wxMakeEventFunctor(const wxEventType& WXUNUSED(evtType), return wxObjectEventFunctor(method, handler); } -#ifdef wxHAS_EVENT_BIND - namespace wxPrivate { @@ -459,7 +427,7 @@ public: CheckHandlerArgument(static_cast(NULL)); } - virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) + virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE { // If you get an error here like "must use .* or ->* to call // pointer-to-member function" then you probably tried to call @@ -471,7 +439,7 @@ public: m_handler(static_cast(event)); } - virtual bool IsMatching(const wxEventFunctor &functor) const + virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE { if ( wxTypeId(functor) != wxTypeId(*this) ) return false; @@ -504,7 +472,7 @@ public: : m_handler(handler), m_handlerAddr(&handler) { } - virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) + virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event) wxOVERRIDE { // If you get an error here like "must use '.*' or '->*' to call // pointer-to-member function" then you probably tried to call @@ -516,7 +484,7 @@ public: m_handler(static_cast(event)); } - virtual bool IsMatching(const wxEventFunctor &functor) const + virtual bool IsMatching(const wxEventFunctor &functor) const wxOVERRIDE { if ( wxTypeId(functor) != wxTypeId(*this) ) return false; @@ -615,8 +583,6 @@ wxNewEventTableFunctor(const EventTag&, void (Class::*method)(EventArg&)) method, NULL); } -#endif // wxHAS_EVENT_BIND - // many, but not all, standard event types @@ -716,6 +682,7 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent); wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent); wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent); wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAGNIFY, wxMouseEvent); // Character input event type wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent); @@ -1088,7 +1055,7 @@ private: friend class WXDLLIMPEXP_FWD_BASE wxEventProcessInHandlerOnly; - DECLARE_ABSTRACT_CLASS(wxEvent) + wxDECLARE_ABSTRACT_CLASS(wxEvent); }; /* @@ -1206,7 +1173,7 @@ class WXDLLIMPEXP_BASE wxEventAnyPayloadMixin : public wxEventBasicPayloadMixin public: wxEventAnyPayloadMixin() : wxEventBasicPayloadMixin() {} -#if wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) +#if wxUSE_ANY template void SetPayload(const T& payload) { @@ -1221,7 +1188,7 @@ public: protected: wxAny m_payload; -#endif // wxUSE_ANY && (!defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)) +#endif // wxUSE_ANY wxDECLARE_NO_ASSIGN_CLASS(wxEventBasicPayloadMixin); }; @@ -1261,7 +1228,7 @@ public: void RequestMore(bool needMore = true) { m_requestMore = needMore; } bool MoreRequested() const { return m_requestMore; } - virtual wxEvent *Clone() const { return new wxIdleEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxIdleEvent(*this); } // Specify how wxWidgets will send idle events: to // all windows, or only to those which specify that they @@ -1276,7 +1243,7 @@ protected: static wxIdleMode sm_idleMode; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent); }; @@ -1299,18 +1266,18 @@ public: SetString(GetString().Clone()); } - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { 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 + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_THREAD; } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxThreadEvent); }; @@ -1363,12 +1330,12 @@ public: { } - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxAsyncMethodCallEvent0(*this); } - virtual void Execute() + virtual void Execute() wxOVERRIDE { (m_object->*m_method)(); } @@ -1405,12 +1372,12 @@ public: { } - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxAsyncMethodCallEvent1(*this); } - virtual void Execute() + virtual void Execute() wxOVERRIDE { (m_object->*m_method)(m_param1); } @@ -1452,12 +1419,12 @@ public: { } - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxAsyncMethodCallEvent2(*this); } - virtual void Execute() + virtual void Execute() wxOVERRIDE { (m_object->*m_method)(m_param1, m_param2); } @@ -1488,12 +1455,12 @@ public: { } - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxAsyncMethodCallEventFunctor(*this); } - virtual void Execute() + virtual void Execute() wxOVERRIDE { m_fn(); } @@ -1531,7 +1498,16 @@ class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent, public wxEventBasicPayloadMixin { public: - wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); + wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0) + : wxEvent(winid, commandType) + { + m_clientData = NULL; + m_clientObject = NULL; + m_isCommandEvent = true; + + // the command events are propagated upwards by default + m_propagationLevel = wxEVENT_PROPAGATE_MAX; + } wxCommandEvent(const wxCommandEvent& event) : wxEvent(event), @@ -1566,15 +1542,16 @@ public: // true if the listbox event was a selection. bool IsSelection() const { return (m_extraLong != 0); } - virtual wxEvent *Clone() const { return new wxCommandEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCommandEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } protected: void* m_clientData; // Arbitrary client data wxClientData* m_clientObject; // Arbitrary client object private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent) + + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent); }; // this class adds a possibility to react (from the user) code to a control @@ -1599,13 +1576,13 @@ public: // for implementation code only: is the operation allowed? bool IsAllowed() const { return m_bAllow; } - virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNotifyEvent(*this); } private: bool m_bAllow; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent); }; @@ -1634,10 +1611,10 @@ public: void SetOrientation(int orient) { m_extraLong = (long) orient; } void SetPosition(int pos) { m_commandInt = pos; } - virtual wxEvent *Clone() const { return new wxScrollEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent); }; // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents @@ -1667,14 +1644,14 @@ public: void SetOrientation(int orient) { m_extraLong = (long) orient; } void SetPosition(int pos) { m_commandInt = pos; } - virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxScrollWinEvent(*this); } protected: int m_commandInt; long m_extraLong; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent); }; @@ -1751,6 +1728,8 @@ public: bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_DCLICK); } bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_DCLICK); } + bool Magnify() const { return (m_eventType == wxEVT_MAGNIFY); } + // True if a button is down and the mouse is moving bool Dragging() const { @@ -1805,8 +1784,9 @@ public: // Is the system set to do page scrolling? bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } - virtual wxEvent *Clone() const { return new wxMouseEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } + float GetMagnification() const { return m_magnification; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } wxMouseEvent& operator=(const wxMouseEvent& event) { @@ -1823,12 +1803,13 @@ public: int m_wheelDelta; int m_linesPerAction; int m_columnsPerAction; + float m_magnification; protected: void Assign(const wxMouseEvent& evt); private: - DECLARE_DYNAMIC_CLASS(wxMouseEvent) + wxDECLARE_DYNAMIC_CLASS(wxMouseEvent); }; // Cursor set event @@ -1859,14 +1840,14 @@ public: const wxCursor& GetCursor() const { return m_cursor; } bool HasCursor() const { return m_cursor.IsOk(); } - virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSetCursorEvent(*this); } private: wxCoord m_x, m_y; wxCursor m_cursor; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent); }; // Keyboard input event class @@ -1971,8 +1952,8 @@ public: bool IsNextEventAllowed() const { return m_allowNext; } - virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_USER_INPUT; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxKeyEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; } // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for // example) @@ -2050,7 +2031,7 @@ private: // when they're requested. bool m_hasPosition; - DECLARE_DYNAMIC_CLASS(wxKeyEvent) + wxDECLARE_DYNAMIC_CLASS(wxKeyEvent); }; // Size event class @@ -2080,7 +2061,7 @@ public: wxRect GetRect() const { return m_rect; } void SetRect(const wxRect& rect) { m_rect = rect; } - virtual wxEvent *Clone() const { return new wxSizeEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSizeEvent(*this); } public: // For internal usage only. Will be converted to protected members. @@ -2088,7 +2069,7 @@ public: wxRect m_rect; // Used for wxEVT_SIZING private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent); }; // Move event class @@ -2120,14 +2101,14 @@ public: wxRect GetRect() const { return m_rect; } void SetRect(const wxRect& rect) { m_rect = rect; } - virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMoveEvent(*this); } protected: wxPoint m_pos; wxRect m_rect; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent); }; // Paint event class @@ -2136,10 +2117,10 @@ private: wxEVT_NC_PAINT */ -#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__)) +#if wxDEBUG_LEVEL && defined(__WXMSW__) #define wxHAS_PAINT_DEBUG - // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined + // see comments in src/msw/dcclient.cpp where g_isPainting is defined extern WXDLLIMPEXP_CORE int g_isPainting; #endif // debug @@ -2170,10 +2151,10 @@ public: } #endif // debug - virtual wxEvent *Clone() const { return new wxPaintEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent); }; class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent @@ -2183,10 +2164,10 @@ public: : wxEvent(winid, wxEVT_NC_PAINT) { } - virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNcPaintEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent); }; // Erase background event class @@ -2209,13 +2190,13 @@ public: wxDC *GetDC() const { return m_dc; } - virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxEraseEvent(*this); } protected: wxDC *m_dc; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent); }; // Focus event class @@ -2241,13 +2222,13 @@ public: wxWindow *GetWindow() const { return m_win; } void SetWindow(wxWindow *win) { m_win = win; } - virtual wxEvent *Clone() const { return new wxFocusEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFocusEvent(*this); } private: wxWindow *m_win; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent); }; // wxChildFocusEvent notifies the parent that a child has got the focus: unlike @@ -2259,10 +2240,10 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxChildFocusEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent); }; // Activate event class @@ -2300,14 +2281,14 @@ public: bool GetActive() const { return m_active; } Reason GetActivationReason() const { return m_activationReason;} - virtual wxEvent *Clone() const { return new wxActivateEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxActivateEvent(*this); } private: bool m_active; Reason m_activationReason; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent); }; // InitDialog event class @@ -2322,10 +2303,10 @@ public: : wxEvent(Id, wxEVT_INIT_DIALOG) { } - virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxInitDialogEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent); }; // Miscellaneous menu event class @@ -2354,13 +2335,13 @@ public: // only for wxEVT_MENU_OPEN/CLOSE wxMenu* GetMenu() const { return m_menu; } - virtual wxEvent *Clone() const { return new wxMenuEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMenuEvent(*this); } private: int m_menuId; wxMenu* m_menu; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent); }; // Window close or session close event class @@ -2408,7 +2389,7 @@ public: bool CanVeto() const { return m_canVeto; } bool GetVeto() const { return m_canVeto && m_veto; } - virtual wxEvent *Clone() const { return new wxCloseEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCloseEvent(*this); } protected: bool m_loggingOff, @@ -2416,7 +2397,7 @@ protected: m_canVeto; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent); }; /* @@ -2442,13 +2423,13 @@ public: wxDEPRECATED( bool GetShow() const { return IsShown(); } ) #endif - virtual wxEvent *Clone() const { return new wxShowEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxShowEvent(*this); } protected: bool m_show; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent); }; /* @@ -2471,13 +2452,13 @@ public: // return true if the frame was iconized, false if restored bool IsIconized() const { return m_iconized; } - virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxIconizeEvent(*this); } protected: bool m_iconized; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent); }; /* wxEVT_MAXIMIZE @@ -2490,10 +2471,10 @@ public: : wxEvent(winid, wxEVT_MAXIMIZE) { } - virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMaximizeEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent); }; // Joystick event class @@ -2589,10 +2570,10 @@ public: { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || ((m_buttonState & but) == but)); } - virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxJoystickEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent); }; // Drop files event class @@ -2639,10 +2620,10 @@ public: int GetNumberOfFiles() const { return m_noFiles; } wxString *GetFiles() const { return m_files; } - virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDropFilesEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent); }; // Update UI event @@ -2726,7 +2707,7 @@ public: // Returns the UI update mode static wxUpdateUIMode GetMode() { return sm_updateMode; } - virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxUpdateUIEvent(*this); } protected: bool m_checked; @@ -2744,7 +2725,7 @@ protected: static wxUpdateUIMode sm_updateMode; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent); }; /* @@ -2759,10 +2740,10 @@ public: : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED) { } - virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSysColourChangedEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent); }; /* @@ -2784,14 +2765,14 @@ public: m_gainedCapture(event.m_gainedCapture) { } - virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureChangedEvent(*this); } wxWindow* GetCapturedWindow() const { return m_gainedCapture; } private: wxWindow* m_gainedCapture; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent); }; /* @@ -2812,9 +2793,9 @@ public: : wxEvent(event) {} - virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMouseCaptureLostEvent(*this); } - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent); }; /* @@ -2823,14 +2804,14 @@ public: class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent { private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent); public: wxDisplayChangedEvent() : wxEvent(0, wxEVT_DISPLAY_CHANGED) { } - virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxDisplayChangedEvent(*this); } }; /* @@ -2853,13 +2834,13 @@ public: void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } wxWindow* GetChangedWindow() const { return m_changedWindow; } - virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaletteChangedEvent(*this); } protected: wxWindow* m_changedWindow; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent); }; /* @@ -2883,13 +2864,13 @@ public: void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } bool GetPaletteRealized() const { return m_paletteRealized; } - virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxQueryNewPaletteEvent(*this); } protected: bool m_paletteRealized; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent); }; /* @@ -2942,7 +2923,7 @@ public: // Set flags void SetFlags(long flags) { m_flags = flags; } - virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxNavigationKeyEvent(*this); } enum wxNavigationKeyEventFlags { @@ -2956,7 +2937,7 @@ public: wxWindow *m_focus; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent); }; // Window creation/destruction events: the first is sent as soon as window is @@ -2976,10 +2957,10 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowCreateEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent); }; class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent @@ -2989,10 +2970,10 @@ public: wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } - virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWindowDestroyEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent); }; // A help event is sent when the user clicks on a window in context-help mode. @@ -3040,7 +3021,7 @@ public: const wxString& GetTarget() const { return m_target; } void SetTarget(const wxString& target) { m_target = target; } - virtual wxEvent *Clone() const { return new wxHelpEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHelpEvent(*this); } // optional indication of the event source Origin GetOrigin() const { return m_origin; } @@ -3057,7 +3038,7 @@ protected: static Origin GuessOrigin(Origin origin); private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent); }; // A Clipboard Text event is sent when a window intercepts text copy/cut/paste @@ -3082,10 +3063,10 @@ public: : wxCommandEvent(event) { } - virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxClipboardTextEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent); }; // A Context event is sent when the user right clicks on a window or @@ -3114,13 +3095,13 @@ public: const wxPoint& GetPosition() const { return m_pos; } void SetPosition(const wxPoint& pos) { m_pos = pos; } - virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxContextMenuEvent(*this); } protected: wxPoint m_pos; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent); }; @@ -3518,7 +3499,6 @@ public: wxEvtHandler *eventSink = NULL) { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); } -#ifdef wxHAS_EVENT_BIND // Bind functions to an event: template void Bind(const EventTag& eventType, @@ -3600,9 +3580,6 @@ public: wxMakeEventFunctor(eventType, method, handler), userData); } -#endif // wxHAS_EVENT_BIND - - wxList* GetDynamicEventTable() const { return m_dynamicEvents ; } // User data can be associated with each wxEvtHandler void SetClientObject( wxClientData *data ) { DoSetClientObject(data); } @@ -3625,6 +3602,14 @@ public: wxEvtHandler *handler, wxEvent& event); + // Allow iterating over all connected dynamic event handlers: you must pass + // the same "cookie" to GetFirst() and GetNext() and call them until null + // is returned. + // + // These functions are for internal use only. + wxDynamicEventTableEntry* GetFirstDynamicEntry(size_t& cookie) const; + wxDynamicEventTableEntry* GetNextDynamicEntry(size_t& cookie) const; + virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); bool SearchDynamicEventTable( wxEvent& event ); @@ -3686,6 +3671,15 @@ protected: virtual bool TryParent(wxEvent& event), return DoTryApp(event); ) #endif // WXWIN_COMPATIBILITY_2_8 + // Overriding this method allows filtering the event handlers dynamically + // connected to this object. If this method returns false, the handler is + // not connected at all. If it returns true, it is connected using the + // possibly modified fields of the given entry. + virtual bool OnDynamicBind(wxDynamicEventTableEntry& WXUNUSED(entry)) + { + return true; + } + static const wxEventTable sm_eventTable; virtual const wxEventTable *GetEventTable() const; @@ -3695,7 +3689,10 @@ protected: wxEvtHandler* m_nextHandler; wxEvtHandler* m_previousHandler; - wxList* m_dynamicEvents; + + typedef wxVector DynamicEvents; + DynamicEvents* m_dynamicEvents; + wxList* m_pendingEvents; #if wxUSE_THREADS @@ -3741,7 +3738,7 @@ private: // Head of the event filter linked list. static wxEventFilter* ms_filterList; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler); }; WX_DEFINE_ARRAY_WITH_DECL_PTR(wxEvtHandler *, wxEvtHandlerArray, class WXDLLIMPEXP_BASE); @@ -3775,14 +3772,14 @@ public: } // The sink is being destroyed - virtual void OnObjectDestroy( ) + virtual void OnObjectDestroy( ) wxOVERRIDE { if ( m_src ) m_src->OnSinkDestroyed( m_sink ); delete this; } - virtual wxEventConnectionRef *ToEventConnection() { return this; } + virtual wxEventConnectionRef *ToEventConnection() wxOVERRIDE { return this; } void IncRef() { m_refCount++; } void DecRef() @@ -3855,7 +3852,7 @@ public: m_eventsToBlock.push_back(type); } - virtual bool ProcessEvent(wxEvent& event); + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; protected: wxArrayInt m_eventsToBlock; @@ -3985,10 +3982,12 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& private: \ static const wxEventTableEntry sm_eventTableEntries[]; \ protected: \ + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \ + const wxEventTable* GetEventTable() const; \ + wxEventHashTable& GetEventHashTable() const; \ + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \ static const wxEventTable sm_eventTable; \ - virtual const wxEventTable* GetEventTable() const; \ - static wxEventHashTable sm_eventHashTable; \ - virtual wxEventHashTable& GetEventHashTable() const + static wxEventHashTable sm_eventHashTable // N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize // sm_eventTable before using it in GetEventTable() or the compiler gives @@ -4218,6 +4217,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func)) #define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func)) #define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func)) +#define EVT_MAGNIFY(func) wx__DECLARE_EVT0(wxEVT_MAGNIFY, wxMouseEventHandler(func)) // All mouse events #define EVT_MOUSE_EVENTS(func) \ @@ -4239,7 +4239,8 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& EVT_MOTION(func) \ EVT_LEAVE_WINDOW(func) \ EVT_ENTER_WINDOW(func) \ - EVT_MOUSEWHEEL(func) + EVT_MOUSEWHEEL(func) \ + EVT_MAGNIFY(func) // Scrolling from wxWindow (sent to wxScrolledWindow) #define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func)) @@ -4305,13 +4306,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \ EVT_COMMAND_SCROLL_CHANGED(winid, func) -#if WXWIN_COMPATIBILITY_2_6 - // compatibility macros for the old name, deprecated in 2.8 - #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED - #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED - #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED -#endif // WXWIN_COMPATIBILITY_2_6 - // Convenience macros for commonly-used commands #define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_CHECKBOX, winid, wxCommandEventHandler(func)) #define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_CHOICE, winid, wxCommandEventHandler(func)) @@ -4319,11 +4313,7 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_LISTBOX_DCLICK, winid, wxCommandEventHandler(func)) #define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_MENU, winid, wxCommandEventHandler(func)) #define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_MENU, id1, id2, wxCommandEventHandler(func)) -#if defined(__SMARTPHONE__) -# define EVT_BUTTON(winid, func) EVT_MENU(winid, func) -#else -# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func)) -#endif +#define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_BUTTON, winid, wxCommandEventHandler(func)) #define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_SLIDER, winid, wxCommandEventHandler(func)) #define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBOX, winid, wxCommandEventHandler(func)) #define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_RADIOBUTTON, winid, wxCommandEventHandler(func)) @@ -4393,41 +4383,6 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& // Helper functions // ---------------------------------------------------------------------------- -// This is an ugly hack to allow the use of Bind() instead of Connect() inside -// the library code if the library was built with support for it, here is how -// it is used: -// -// class SomeEventHandlingClass : wxBIND_OR_CONNECT_HACK_BASE_CLASS -// public SomeBaseClass -// { -// public: -// SomeEventHandlingClass(wxWindow *win) -// { -// // connect to the event for the given window -// wxBIND_OR_CONNECT_HACK(win, wxEVT_SOMETHING, wxSomeEventHandler, -// SomeEventHandlingClass::OnSomeEvent, this); -// } -// -// private: -// void OnSomeEvent(wxSomeEvent&) { ... } -// }; -// -// This is *not* meant to be used by library users, it is only defined here -// (and not in a private header) because the base class must be visible from -// other public headers, please do NOT use this in your code, it will be -// removed from future wx versions without warning. -#ifdef wxHAS_EVENT_BIND - #define wxBIND_OR_CONNECT_HACK_BASE_CLASS - #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS - #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \ - win->Bind(evt, &func, obj) -#else // wxHAS_EVENT_BIND - #define wxBIND_OR_CONNECT_HACK_BASE_CLASS public wxEvtHandler, - #define wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS : public wxEvtHandler - #define wxBIND_OR_CONNECT_HACK(win, evt, handler, func, obj) \ - win->Connect(evt, handler(func), NULL, obj) -#endif // wxHAS_EVENT_BIND - #if wxUSE_GUI // Find a window with the focus, that is also a descendant of the given window. @@ -4443,7 +4398,7 @@ WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor); // deprecated variants _not_ requiring a semicolon after them and without wx prefix // (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) +// it's not always possible to force the compiler to require it) #define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) diff --git a/Externals/wxWidgets3/include/wx/evtloop.h b/Externals/wxWidgets3/include/wx/evtloop.h index 8dd5d6eb7b..00e6d097d5 100644 --- a/Externals/wxWidgets3/include/wx/evtloop.h +++ b/Externals/wxWidgets3/include/wx/evtloop.h @@ -16,7 +16,7 @@ // TODO: implement wxEventLoopSource for MSW (it should wrap a HANDLE and be // monitored using MsgWaitForMultipleObjects()) -#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WXMSW__)) +#if defined(__WXOSX__) || (defined(__UNIX__) && !defined(__WINDOWS__)) #define wxUSE_EVENTLOOP_SOURCE 1 #else #define wxUSE_EVENTLOOP_SOURCE 0 @@ -145,19 +145,24 @@ public: // process all currently pending events right now // - // it is an error to call Yield() recursively unless the value of - // onlyIfNeeded is true + // if onlyIfNeeded is true, returns false without doing anything else if + // we're already inside Yield() // // WARNING: this function is dangerous as it can lead to unexpected // reentrancies (i.e. when called from an event handler it // may result in calling the same event handler again), use // with _extreme_ care or, better, don't use at all! bool Yield(bool onlyIfNeeded = false); - virtual bool YieldFor(long eventsToProcess) = 0; + + // more selective version of Yield() + // + // notice that it is virtual for backwards-compatibility but new code + // should override DoYieldFor() and not YieldFor() itself + virtual bool YieldFor(long eventsToProcess); // returns true if the main thread is inside a Yield() call virtual bool IsYielding() const - { return m_isInsideYield; } + { return m_yieldLevel != 0; } // returns true if events of the given event category should be immediately // processed inside a wxApp::Yield() call or rather should be queued for @@ -182,6 +187,16 @@ protected: // real implementation of Run() virtual int DoRun() = 0; + // And the real, port-specific, implementation of YieldFor(). + // + // The base class version is pure virtual to ensure that it is overridden + // in the derived classes but does have an implementation which processes + // pending events in wxApp if eventsToProcess allows it, and so should be + // called from the overridden version at an appropriate place (i.e. after + // processing the native events but before doing anything else that could + // be affected by pending events dispatching). + virtual void DoYieldFor(long eventsToProcess) = 0; + // this function should be called before the event loop terminates, whether // this happens normally (because of Exit() call) or abnormally (because of // an exception thrown from inside the loop) @@ -199,8 +214,10 @@ protected: // should we exit the loop? bool m_shouldExit; - // YieldFor() helpers: - bool m_isInsideYield; + // incremented each time on entering Yield() and decremented on leaving it + int m_yieldLevel; + + // the argument of the last call to YieldFor() long m_eventsToProcessInsideYield; private: @@ -223,12 +240,12 @@ public: // sets the "should exit" flag and wakes up the loop so that it terminates // soon - virtual void ScheduleExit(int rc = 0); + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; protected: // enters a loop calling OnNextIteration(), Pending() and Dispatch() and // terminating when Exit() is called - virtual int DoRun(); + virtual int DoRun() wxOVERRIDE; // may be overridden to perform some action at the start of each new event // loop iteration @@ -263,7 +280,7 @@ private: #endif // include the header defining wxConsoleEventLoop -#if defined(__UNIX__) && !defined(__WXMSW__) +#if defined(__UNIX__) && !defined(__WINDOWS__) #include "wx/unix/evtloop.h" #elif defined(__WINDOWS__) #include "wx/msw/evtloopconsole.h" @@ -275,14 +292,14 @@ private: #if defined(__WXMSW__) #include "wx/msw/evtloop.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/evtloop.h" #elif defined(__WXOSX__) #include "wx/osx/evtloop.h" #elif defined(__WXDFB__) #include "wx/dfb/evtloop.h" #elif defined(__WXGTK20__) #include "wx/gtk/evtloop.h" + #elif defined(__WXQT__) + #include "wx/qt/evtloop.h" #else // other platform #include "wx/stopwatch.h" // for wxMilliClock_t @@ -313,10 +330,10 @@ public: } } virtual void WakeUp() { } - virtual bool YieldFor(long eventsToProcess); protected: virtual int DoRun(); + virtual void DoYieldFor(long eventsToProcess); // the pointer to the port specific implementation class wxEventLoopImpl *m_impl; @@ -362,7 +379,7 @@ public: } protected: - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { delete m_windowDisabler; m_windowDisabler = NULL; @@ -402,7 +419,7 @@ private: wxEventLoopBase *m_evtLoopOld; }; -#if wxUSE_CONSOLE_EVENTLOOP +#if wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP class wxEventLoopGuarantor { @@ -430,6 +447,6 @@ private: wxEventLoop *m_evtLoopNew; }; -#endif // wxUSE_CONSOLE_EVENTLOOP +#endif // wxUSE_GUI || wxUSE_CONSOLE_EVENTLOOP #endif // _WX_EVTLOOP_H_ diff --git a/Externals/wxWidgets3/include/wx/evtloopsrc.h b/Externals/wxWidgets3/include/wx/evtloopsrc.h index cb3e5c6a90..6b7f2b1fdd 100644 --- a/Externals/wxWidgets3/include/wx/evtloopsrc.h +++ b/Externals/wxWidgets3/include/wx/evtloopsrc.h @@ -12,7 +12,6 @@ // Include the header to get wxUSE_EVENTLOOP_SOURCE definition from it. #include "wx/evtloop.h" - // ---------------------------------------------------------------------------- // wxEventLoopSource: a source of events which may be added to wxEventLoop // ---------------------------------------------------------------------------- @@ -95,6 +94,8 @@ inline wxEventLoopSource::~wxEventLoopSource() { } #if defined(__DARWIN__) #include "wx/osx/evtloopsrc.h" +#elif defined(__WXQT__) + #include "wx/unix/evtloopsrc.h" #endif #endif // wxUSE_EVENTLOOP_SOURCE diff --git a/Externals/wxWidgets3/include/wx/fdrepdlg.h b/Externals/wxWidgets3/include/wx/fdrepdlg.h index 709dcb156b..1c7f46f55e 100644 --- a/Externals/wxWidgets3/include/wx/fdrepdlg.h +++ b/Externals/wxWidgets3/include/wx/fdrepdlg.h @@ -124,7 +124,7 @@ protected: }; // include wxFindReplaceDialog declaration -#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__) +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/fdrepdlg.h" #else #define wxGenericFindReplaceDialog wxFindReplaceDialog @@ -156,12 +156,12 @@ public: void SetFindString(const wxString& str) { SetString(str); } void SetReplaceString(const wxString& str) { m_strReplace = str; } - virtual wxEvent *Clone() const { return new wxFindDialogEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFindDialogEvent(*this); } private: wxString m_strReplace; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFindDialogEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FIND, wxFindDialogEvent ); diff --git a/Externals/wxWidgets3/include/wx/features.h b/Externals/wxWidgets3/include/wx/features.h index 765f0f7f1f..46ac758cd7 100644 --- a/Externals/wxWidgets3/include/wx/features.h +++ b/Externals/wxWidgets3/include/wx/features.h @@ -32,9 +32,9 @@ #endif /* taskbar is implemented in the major ports */ -#if defined(__WXMSW__) || defined(__WXCOCOA__) \ +#if defined(__WXMSW__) \ || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \ - || defined(__WXOSX_MAC__) || defined(__WXCOCOA__) + || defined(__WXOSX_MAC__) || defined(__WXQT__) #define wxHAS_TASK_BAR_ICON #else #undef wxUSE_TASKBARICON @@ -69,7 +69,7 @@ /* This is defined when the underlying toolkit handles tab traversal natively. Otherwise we implement it ourselves in wxControlContainer. */ -#ifdef __WXGTK20__ +#if defined(__WXGTK20__) || defined(__WXQT__) #define wxHAS_NATIVE_TAB_TRAVERSAL #endif @@ -77,7 +77,7 @@ functions. Otherwise, we implement them ourselves to only support the 'C' locale */ #if defined(HAVE_LOCALE_T) || \ - (wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__)) + (wxCHECK_VISUALC_VERSION(8)) #define wxHAS_XLOCALE_SUPPORT #else #undef wxHAS_XLOCALE_SUPPORT @@ -85,15 +85,12 @@ /* Direct access to bitmap data is not implemented in all ports yet */ #if defined(__WXGTK20__) || defined(__WXMAC__) || defined(__WXDFB__) || \ - defined(__WXMSW__) + defined(__WXMSW__) || defined(__WXQT__) /* - These compilers can't deal with templates in wx/rawbmp.h: - - HP aCC for PA-RISC - - Watcom < 1.8 + HP aCC for PA-RISC can't deal with templates in wx/rawbmp.h. */ - #if !wxONLY_WATCOM_EARLIER_THAN(1, 8) && \ - !(defined(__HP_aCC) && defined(__hppa)) + #if !(defined(__HP_aCC) && defined(__hppa)) #define wxHAS_RAW_BITMAP #endif #endif @@ -103,24 +100,12 @@ #define wxHAVE_RAW_BITMAP #endif -/* - 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) \ - || (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \ - || (defined(__xlC__) && __xlC__ >= 0x700) \ - || defined(__INTELC__) - #define wxHAS_EVENT_BIND -#endif +// Previously this symbol wasn't defined for all compilers as Bind() couldn't +// be implemented for some of them (notably MSVC 6), but this is not the case +// any more and Bind() is always implemented when using any currently supported +// compiler, so this symbol exists purely for compatibility. +#define wxHAS_EVENT_BIND #endif /* _WX_FEATURES_H_ */ diff --git a/Externals/wxWidgets3/include/wx/fileconf.h b/Externals/wxWidgets3/include/wx/fileconf.h index c16129a5b1..a15468cfd7 100644 --- a/Externals/wxWidgets3/include/wx/fileconf.h +++ b/Externals/wxWidgets3/include/wx/fileconf.h @@ -151,28 +151,28 @@ public: #endif // __UNIX__/!__UNIX__ // implement inherited pure virtual functions - virtual void SetPath(const wxString& strPath); - virtual const wxString& GetPath() const; + virtual void SetPath(const wxString& strPath) wxOVERRIDE; + virtual const wxString& GetPath() const wxOVERRIDE; - virtual bool GetFirstGroup(wxString& str, long& lIndex) const; - virtual bool GetNextGroup (wxString& str, long& lIndex) const; - virtual bool GetFirstEntry(wxString& str, long& lIndex) const; - virtual bool GetNextEntry (wxString& str, long& lIndex) const; + virtual bool GetFirstGroup(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextGroup (wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const wxOVERRIDE; + virtual bool GetNextEntry (wxString& str, long& lIndex) const wxOVERRIDE; - virtual size_t GetNumberOfEntries(bool bRecursive = false) const; - virtual size_t GetNumberOfGroups(bool bRecursive = false) const; + virtual size_t GetNumberOfEntries(bool bRecursive = false) const wxOVERRIDE; + virtual size_t GetNumberOfGroups(bool bRecursive = false) const wxOVERRIDE; - virtual bool HasGroup(const wxString& strName) const; - virtual bool HasEntry(const wxString& strName) const; + virtual bool HasGroup(const wxString& strName) const wxOVERRIDE; + virtual bool HasEntry(const wxString& strName) const wxOVERRIDE; - virtual bool Flush(bool bCurrentOnly = false); + virtual bool Flush(bool bCurrentOnly = false) wxOVERRIDE; - virtual bool RenameEntry(const wxString& oldName, const wxString& newName); - virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + virtual bool RenameEntry(const wxString& oldName, const wxString& newName) wxOVERRIDE; + virtual bool RenameGroup(const wxString& oldName, const wxString& newName) wxOVERRIDE; - virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true); - virtual bool DeleteGroup(const wxString& szKey); - virtual bool DeleteAll(); + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = true) wxOVERRIDE; + virtual bool DeleteGroup(const wxString& szKey) wxOVERRIDE; + virtual bool DeleteAll() wxOVERRIDE; // additional, wxFileConfig-specific, functionality #if wxUSE_STREAMS @@ -191,16 +191,16 @@ public: bool LineListIsEmpty(); protected: - virtual bool DoReadString(const wxString& key, wxString *pStr) const; - virtual bool DoReadLong(const wxString& key, long *pl) const; + virtual bool DoReadString(const wxString& key, wxString *pStr) const wxOVERRIDE; + virtual bool DoReadLong(const wxString& key, long *pl) const wxOVERRIDE; #if wxUSE_BASE64 - virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const; + virtual bool DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const wxOVERRIDE; #endif // wxUSE_BASE64 - virtual bool DoWriteString(const wxString& key, const wxString& szValue); - virtual bool DoWriteLong(const wxString& key, long lValue); + virtual bool DoWriteString(const wxString& key, const wxString& szValue) wxOVERRIDE; + virtual bool DoWriteLong(const wxString& key, long lValue) wxOVERRIDE; #if wxUSE_BASE64 - virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf); + virtual bool DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf) wxOVERRIDE; #endif // wxUSE_BASE64 private: @@ -252,7 +252,7 @@ private: bool m_isDirty; // if true, we have unsaved changes wxDECLARE_NO_COPY_CLASS(wxFileConfig); - DECLARE_ABSTRACT_CLASS(wxFileConfig) + wxDECLARE_ABSTRACT_CLASS(wxFileConfig); }; #endif diff --git a/Externals/wxWidgets3/include/wx/filectrl.h b/Externals/wxWidgets3/include/wx/filectrl.h index e4c302f7d5..c8c3d49a57 100644 --- a/Externals/wxWidgets3/include/wx/filectrl.h +++ b/Externals/wxWidgets3/include/wx/filectrl.h @@ -65,7 +65,7 @@ public: void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); -void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString ); +void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename = wxEmptyString ); #if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #define wxFileCtrl wxGtkFileCtrl @@ -98,7 +98,7 @@ public: } // no need for the copy constructor as the default one will be fine. - virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFileCtrlEvent( *this ); } void SetFiles( const wxArrayString &files ) { m_files = files; } void SetDirectory( const wxString &directory ) { m_directory = directory; } @@ -115,7 +115,7 @@ protected: wxString m_directory; wxArrayString m_files; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent ) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileCtrlEvent); }; typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& ); diff --git a/Externals/wxWidgets3/include/wx/filedlg.h b/Externals/wxWidgets3/include/wx/filedlg.h index d105493cc2..b068129ae2 100644 --- a/Externals/wxWidgets3/include/wx/filedlg.h +++ b/Externals/wxWidgets3/include/wx/filedlg.h @@ -36,6 +36,7 @@ #define wxSYSTEM_MENU 0x00000800 wxBORDER_NONE = 0x00200000 #define wxRESIZE_BORDER 0x00000040 + #define wxDIALOG_NO_PARENT 0x00000020 */ enum @@ -43,24 +44,13 @@ enum wxFD_OPEN = 0x0001, wxFD_SAVE = 0x0002, wxFD_OVERWRITE_PROMPT = 0x0004, + wxFD_NO_FOLLOW = 0x0008, wxFD_FILE_MUST_EXIST = 0x0010, - wxFD_MULTIPLE = 0x0020, wxFD_CHANGE_DIR = 0x0080, - wxFD_PREVIEW = 0x0100 + wxFD_PREVIEW = 0x0100, + wxFD_MULTIPLE = 0x0200 }; -#if WXWIN_COMPATIBILITY_2_6 -enum -{ - wxOPEN = wxFD_OPEN, - wxSAVE = wxFD_SAVE, - wxOVERWRITE_PROMPT = wxFD_OVERWRITE_PROMPT, - wxFILE_MUST_EXIST = wxFD_FILE_MUST_EXIST, - wxMULTIPLE = wxFD_MULTIPLE, - wxCHANGE_DIR = wxFD_CHANGE_DIR -}; -#endif - #define wxFD_DEFAULT_STYLE wxFD_OPEN extern WXDLLIMPEXP_DATA_CORE(const char) wxFileDialogNameStr[]; @@ -135,14 +125,6 @@ public: // Utility functions -#if WXWIN_COMPATIBILITY_2_6 - - wxDEPRECATED( long GetStyle() const ); - wxDEPRECATED( void SetStyle(long style) ); - -#endif // WXWIN_COMPATIBILITY_2_6 - - // Append first extension to filePath from a ';' separated extensionList // if filePath = "path/foo.bar" just return it as is // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" @@ -150,6 +132,13 @@ public: static wxString AppendExtension(const wxString &filePath, const wxString &extensionList); + // Set the filter index to match the given extension. + // + // This is always valid to call, even if the extension is empty or the + // filter list doesn't contain it, the function will just do nothing in + // these cases. + void SetFilterIndexFromExt(const wxString& ext); + protected: wxString m_message; wxString m_dir; @@ -178,7 +167,7 @@ private: ExtraControlCreatorFunction m_extraControlCreator; void Init(); - DECLARE_DYNAMIC_CLASS(wxFileDialogBase) + wxDECLARE_DYNAMIC_CLASS(wxFileDialogBase); wxDECLARE_NO_COPY_CLASS(wxFileDialogBase); }; @@ -237,10 +226,8 @@ wxSaveFileSelector(const wxString& what, #include "wx/gtk1/filedlg.h" #elif defined(__WXMAC__) #include "wx/osx/filedlg.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/filedlg.h" -#elif defined(__WXPM__) - #include "wx/os2/filedlg.h" +#elif defined(__WXQT__) + #include "wx/qt/filedlg.h" #endif #endif // wxUSE_FILEDLG diff --git a/Externals/wxWidgets3/include/wx/filefn.h b/Externals/wxWidgets3/include/wx/filefn.h index 95b3051c05..5a585bd9e5 100644 --- a/Externals/wxWidgets3/include/wx/filefn.h +++ b/Externals/wxWidgets3/include/wx/filefn.h @@ -14,88 +14,48 @@ #include "wx/list.h" #include "wx/arrstr.h" -#ifdef __WXWINCE__ - #include "wx/msw/wince/time.h" - #include "wx/msw/private.h" -#else - #include -#endif +#include -#ifndef __WXWINCE__ - #include - #include -#endif +#include +#include -#ifdef __OS2__ -// need to check for __OS2__ first since currently both -// __OS2__ and __UNIX__ are defined. - #include - #include "wx/os2/private.h" - #ifdef __WATCOMC__ - #include - #endif - #include - #ifdef __EMX__ - #include - #endif -#elif defined(__UNIX__) +#if defined(__UNIX__) #include #include #endif -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) -#if !defined( __GNUWIN32__ ) && !defined(__WXWINCE__) && !defined(__CYGWIN__) +#if defined(__WINDOWS__) +#if !defined( __GNUWIN32__ ) && !defined(__CYGWIN__) #include #include #include #endif // __WINDOWS__ #endif // native Win compiler -#if defined(__DOS__) - #ifdef __WATCOMC__ - #include - #include - #include - #endif - #ifdef __DJGPP__ - #include - #include - #endif -#endif - #ifdef __BORLANDC__ // Please someone tell me which version of Borland needs // this (3.1 I believe) and how to test for it. // If this works for Borland 4.0 as well, then no worries. #include #endif -#ifndef __WXWINCE__ - #include // O_RDONLY &c -#endif +#include // O_RDONLY &c // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -#if defined(__VISUALC__) || defined(__DIGITALMARS__) +// MSVC doesn't define mode_t, so do it ourselves unless someone else +// had already predefined it. +#if defined(__VISUALC__) && !defined(wxHAS_MODE_T) + #define wxHAS_MODE_T typedef int mode_t; #endif -#ifdef __WXWINCE__ - typedef long off_t; -#else - // define off_t - #if !defined(__WXMAC__) || defined(__UNIX__) || defined(__MACH__) - #include - #else - typedef long off_t; - #endif -#endif +// define off_t +#include -#if defined(__VISUALC__) && !defined(__WXWINCE__) +#if defined(__VISUALC__) typedef _off_t off_t; -#elif defined(__SYMANTEC__) - typedef long off_t; #endif enum wxSeekMode @@ -163,36 +123,12 @@ enum wxPosixPermissions // underscores to the usual names, some also have Unicode versions of them // ---------------------------------------------------------------------------- -// Wrappers around Win32 api functions like CreateFile, ReadFile and such -// Implemented in filefnwce.cpp -#if defined( __WXWINCE__) - typedef __int64 wxFileOffset; - #define wxFileOffsetFmtSpec wxT("I64") - WXDLLIMPEXP_BASE int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)); - WXDLLIMPEXP_BASE int wxCRT_Access(const wxChar *name, int WXUNUSED(how)); - WXDLLIMPEXP_BASE int wxCRT_Chmod(const wxChar *name, int WXUNUSED(how)); - WXDLLIMPEXP_BASE int wxClose(int fd); - WXDLLIMPEXP_BASE int wxFsync(int WXUNUSED(fd)); - WXDLLIMPEXP_BASE int wxRead(int fd, void *buf, unsigned int count); - WXDLLIMPEXP_BASE int wxWrite(int fd, const void *buf, unsigned int count); - WXDLLIMPEXP_BASE int wxEof(int fd); - WXDLLIMPEXP_BASE wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin); - #define wxLSeek wxSeek - WXDLLIMPEXP_BASE wxFileOffset wxTell(int fd); - - // always Unicode under WinCE - #define wxCRT_MkDir _wmkdir - #define wxCRT_RmDir _wrmdir - #define wxCRT_Stat _wstat - #define wxStructStat struct _stat -#elif (defined(__WINDOWS__) || defined(__OS2__)) && \ +#if defined(__WINDOWS__) && \ ( \ defined(__VISUALC__) || \ - defined(__MINGW64__) || \ + defined(__MINGW64_TOOLCHAIN__) || \ (defined(__MINGW32__) && !defined(__WINE__) && \ wxCHECK_W32API_VERSION(0, 5)) || \ - defined(__DMC__) || \ - defined(__WATCOMC__) || \ defined(__BORLANDC__) \ ) @@ -203,8 +139,8 @@ enum wxPosixPermissions // detect compilers which have support for huge files #if defined(__VISUALC__) #define wxHAS_HUGE_FILES 1 - #elif defined(__MINGW32__) || defined(__MINGW64__) - #define wxHAS_HUGE_FILES 1f + #elif defined(__MINGW32__) + #define wxHAS_HUGE_FILES 1 #elif defined(_LARGE_FILES) #define wxHAS_HUGE_FILES 1 #endif @@ -216,12 +152,26 @@ enum wxPosixPermissions #define wxFtell _ftelli64 #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc) #define wxHAS_HUGE_STDIO_FILES + + wxDECL_FOR_STRICT_MINGW32(int, fseeko64, (FILE*, long long, int)) #define wxFseek fseeko64 - #define wxFtell ftello64 + + #ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + // Unfortunately ftello64() is not defined in the library for + // whatever reason but as an inline function, so define wxFtell() + // here similarly. + inline long long wxFtell(FILE* fp) + { + fpos_t pos; + return fgetpos(fp, &pos) == 0 ? pos : -1LL; + } + #else + #define wxFtell ftello64 + #endif #endif - // other Windows compilers (DMC, Watcom, and Borland) don't have huge file - // support (or at least not all functions needed for it by wx) currently + // other Windows compilers (Borland) don't have huge file support (or at + // least not all functions needed for it by wx) currently // types @@ -240,12 +190,8 @@ enum wxPosixPermissions #define wxPOSIX_STRUCT(s) struct wxPOSIX_IDENT(s) #endif - // Notice that Watcom is the only compiler to have a wide char - // version of struct stat as well as a wide char stat function variant. - // This was dropped since OW 1.4 "for consistency across platforms". - // - // Borland is also special in that it uses _stat with Unicode functions - // (for MSVC compatibility?) but stat with ANSI ones + // Borland is special in that it uses _stat with Unicode functions (for + // MSVC compatibility?) but stat with ANSI ones #ifdef __BORLANDC__ #if wxHAS_HUGE_FILES #define wxStructStat struct stati64 @@ -258,17 +204,9 @@ enum wxPosixPermissions #endif #else // !__BORLANDC__ #ifdef wxHAS_HUGE_FILES - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstati64 - #else - #define wxStructStat struct _stati64 - #endif + #define wxStructStat struct _stati64 #else - #if wxUSE_UNICODE && wxONLY_WATCOM_EARLIER_THAN(1,4) - #define wxStructStat struct _wstat - #else - #define wxStructStat struct _stat - #endif + #define wxStructStat struct _stat #endif #endif // __BORLANDC__/!__BORLANDC__ @@ -281,7 +219,7 @@ enum wxPosixPermissions // to avoid using them as they're not present in earlier versions and // always using the native functions spelling is easier than testing for // the versions - #if defined(__BORLANDC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__MINGW64__) + #if defined(__BORLANDC__) || defined(__MINGW64_TOOLCHAIN__) #define wxPOSIX_IDENT(func) ::func #else // by default assume MSVC-compatible names #define wxPOSIX_IDENT(func) _ ## func @@ -296,7 +234,7 @@ enum wxPosixPermissions #define wxWrite wxPOSIX_IDENT(write) #ifdef wxHAS_HUGE_FILES - #ifndef __MINGW64__ + #ifndef __MINGW64_TOOLCHAIN__ #define wxSeek wxPOSIX_IDENT(lseeki64) #define wxLseek wxPOSIX_IDENT(lseeki64) #define wxTell wxPOSIX_IDENT(telli64) @@ -312,17 +250,15 @@ enum wxPosixPermissions #define wxTell wxPOSIX_IDENT(tell) #endif // wxHAS_HUGE_FILES/!wxHAS_HUGE_FILES - #ifndef __WATCOMC__ - #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) - // NB: this one is not POSIX and always has the underscore - #define wxFsync _commit + #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x540) + // NB: this one is not POSIX and always has the underscore + #define wxFsync _commit - // could be already defined by configure (Cygwin) - #ifndef HAVE_FSYNC - #define HAVE_FSYNC - #endif - #endif // BORLANDC - #endif + // could be already defined by configure (Cygwin) + #ifndef HAVE_FSYNC + #define HAVE_FSYNC + #endif + #endif // BORLANDC #define wxEof wxPOSIX_IDENT(eof) @@ -337,18 +273,13 @@ enum wxPosixPermissions #ifdef wxHAS_HUGE_FILES // MinGW-64 provides underscore-less versions of all file functions // except for this one. - #ifdef __MINGW64__ + #ifdef __MINGW64_TOOLCHAIN__ #define wxCRT_StatA _stati64 #else #define wxCRT_StatA wxPOSIX_IDENT(stati64) #endif #else - // Unfortunately Watcom is not consistent - #if defined(__OS2__) && defined(__WATCOMC__) - #define wxCRT_StatA _stat - #else - #define wxCRT_StatA wxPOSIX_IDENT(stat) - #endif + #define wxCRT_StatA wxPOSIX_IDENT(stat) #endif // then wide char ones @@ -362,6 +293,9 @@ enum wxPosixPermissions #define wxCRT_OpenW _wopen #endif + wxDECL_FOR_STRICT_MINGW32(int, _wmkdir, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrmdir, (const wchar_t*)) + #define wxCRT_AccessW _waccess #define wxCRT_ChmodW _wchmod #define wxCRT_MkDirW _wmkdir @@ -376,35 +310,12 @@ enum wxPosixPermissions // finally the default char-type versions #if wxUSE_UNICODE - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) - // implement the missing file functions in Win9x ourselves - WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, - int flags, int mode); - WXDLLIMPEXP_BASE int wxMSLU__waccess(const wxChar *name, - int mode); - WXDLLIMPEXP_BASE int wxMSLU__wchmod(const wxChar *name, - int mode); - WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wxChar *name); - WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wxChar *name); - - WXDLLIMPEXP_BASE int - wxMSLU__wstat(const wxChar *name, wxStructStat *buffer); - - #define wxCRT_Open wxMSLU__wopen - - #define wxCRT_Access wxMSLU__waccess - #define wxCRT_Chmod wxMSLU__wchmod - #define wxCRT_MkDir wxMSLU__wmkdir - #define wxCRT_RmDir wxMSLU__wrmdir - #define wxCRT_Stat wxMSLU__wstat - #else // !wxUSE_UNICODE_MSLU - #define wxCRT_Open wxCRT_OpenW - #define wxCRT_Access wxCRT_AccessW - #define wxCRT_Chmod wxCRT_ChmodW - #define wxCRT_MkDir wxCRT_MkDirW - #define wxCRT_RmDir wxCRT_RmDirW - #define wxCRT_Stat wxCRT_StatW - #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU + #define wxCRT_Open wxCRT_OpenW + #define wxCRT_Access wxCRT_AccessW + #define wxCRT_Chmod wxCRT_ChmodW + #define wxCRT_MkDir wxCRT_MkDirW + #define wxCRT_RmDir wxCRT_RmDirW + #define wxCRT_Stat wxCRT_StatW #else // !wxUSE_UNICODE #define wxCRT_Open wxCRT_OpenA #define wxCRT_Access wxCRT_AccessA @@ -514,23 +425,19 @@ inline int wxChmod(const wxString& path, mode_t mode) inline int wxOpen(const wxString& path, int flags, mode_t mode) { return wxCRT_Open(path.fn_str(), flags, mode); } -// FIXME-CE: provide our own implementations of the missing CRT functions -#ifndef __WXWINCE__ inline int wxStat(const wxString& path, wxStructStat *buf) { return wxCRT_Stat(path.fn_str(), buf); } inline int wxLstat(const wxString& path, wxStructStat *buf) { return wxCRT_Lstat(path.fn_str(), buf); } inline int wxRmDir(const wxString& path) { return wxCRT_RmDir(path.fn_str()); } -#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) \ - || (defined(__OS2__) && defined(__WATCOMC__)) +#if (defined(__WINDOWS__) && !defined(__CYGWIN__)) inline int wxMkDir(const wxString& path, mode_t WXUNUSED(mode) = 0) { return wxCRT_MkDir(path.fn_str()); } #else inline int wxMkDir(const wxString& path, mode_t mode) { return wxCRT_MkDir(path.fn_str(), mode); } #endif -#endif // !__WXWINCE__ #ifdef O_BINARY #define wxO_BINARY O_BINARY @@ -538,15 +445,7 @@ inline int wxMkDir(const wxString& path, mode_t mode) #define wxO_BINARY 0 #endif -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -// -// VisualAge C++ V4.0 cannot have any external linkage const decs -// in headers included by more than one primary source -// -extern const int wxInvalidOffset; -#else const int wxInvalidOffset = -1; -#endif // ---------------------------------------------------------------------------- // functions @@ -641,15 +540,6 @@ WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); WXDLLIMPEXP_BASE bool wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite = true); // Get current working directory. -#if WXWIN_COMPATIBILITY_2_6 -// If buf is NULL, allocates space using new, else -// copies into buf. -// IMPORTANT NOTE getcwd is know not to work under some releases -// of Win32s 1.3, according to MS release notes! -wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetWorkingDirectory(wxChar *buf = NULL, int sz = 1000) ); -// new and preferred version of wxGetWorkingDirectory -// NB: can't have the same name because of overloading ambiguity -#endif // WXWIN_COMPATIBILITY_2_6 WXDLLIMPEXP_BASE wxString wxGetCwd(); // Set working directory @@ -665,15 +555,6 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(int fd); WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp); -#if WXWIN_COMPATIBILITY_2_6 -// compatibility defines, don't use in new code -wxDEPRECATED( inline bool wxPathExists(const wxChar *pszPathName) ); -inline bool wxPathExists(const wxChar *pszPathName) -{ - return wxDirExists(pszPathName); -} -#endif //WXWIN_COMPATIBILITY_2_6 - // permissions; these functions work both on files and directories: WXDLLIMPEXP_BASE bool wxIsWritable(const wxString &path); WXDLLIMPEXP_BASE bool wxIsReadable(const wxString &path); @@ -704,7 +585,7 @@ WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); #define wxPATH_SEP_MAC wxT(";") // platform independent versions -#if defined(__UNIX__) && !defined(__OS2__) +#if defined(__UNIX__) // CYGWIN also uses UNIX settings #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX #define wxPATH_SEP wxPATH_SEP_UNIX @@ -718,7 +599,7 @@ WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); // this is useful for wxString::IsSameAs(): to compare two file names use // filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) -#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) +#if defined(__UNIX__) && !defined(__DARWIN__) #define wxARE_FILENAMES_CASE_SENSITIVE true #else // Windows, Mac OS and OS/2 #define wxARE_FILENAMES_CASE_SENSITIVE false @@ -728,7 +609,7 @@ WXDLLIMPEXP_BASE bool wxIsExecutable(const wxString &path); inline bool wxIsPathSeparator(wxChar c) { // under DOS/Windows we should understand both Unix and DOS file separators -#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) +#if defined(__UNIX__) || defined(__MAC__) return c == wxFILE_SEP_PATH; #else return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; @@ -832,11 +713,6 @@ public: // Given full path and filename, add path to list bool EnsureFileAccessible(const wxString& path); - -#if WXWIN_COMPATIBILITY_2_6 - // Returns true if the path is in the list - wxDEPRECATED( bool Member(const wxString& path) const ); -#endif }; #endif // _WX_FILEFN_H_ diff --git a/Externals/wxWidgets3/include/wx/filehistory.h b/Externals/wxWidgets3/include/wx/filehistory.h index b6cb1cb501..9cd4be4034 100644 --- a/Externals/wxWidgets3/include/wx/filehistory.h +++ b/Externals/wxWidgets3/include/wx/filehistory.h @@ -60,11 +60,6 @@ public: void SetBaseId(wxWindowID baseId) { m_idBase = baseId; } wxWindowID GetBaseId() const { return m_idBase; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use GetCount() instead - wxDEPRECATED( size_t GetNoHistoryFiles() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: // Last n files wxArrayString m_fileHistory; @@ -83,17 +78,12 @@ private: // this to ensure the same normalization is used everywhere. static wxString NormalizeFileName(const wxFileName& filename); + // Remove any existing entries from the associated menus. + void RemoveExistingHistory(); + wxDECLARE_NO_COPY_CLASS(wxFileHistoryBase); }; -#if WXWIN_COMPATIBILITY_2_6 -inline size_t wxFileHistoryBase::GetNoHistoryFiles() const -{ - return m_fileHistory.GetCount(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - #if defined(__WXGTK20__) #include "wx/gtk/filehistory.h" #else @@ -104,7 +94,7 @@ inline size_t wxFileHistoryBase::GetNoHistoryFiles() const wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1) : wxFileHistoryBase(maxFiles, idBase) {} - DECLARE_DYNAMIC_CLASS(wxFileHistory) + wxDECLARE_DYNAMIC_CLASS(wxFileHistory); }; #endif diff --git a/Externals/wxWidgets3/include/wx/filename.h b/Externals/wxWidgets3/include/wx/filename.h index 1a16e14050..e2b05ec13e 100644 --- a/Externals/wxWidgets3/include/wx/filename.h +++ b/Externals/wxWidgets3/include/wx/filename.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_FWD_BASE wxFFile; // this symbol is defined for the platforms where file systems use volumes in // paths -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) +#if defined(__WINDOWS__) #define wxHAS_FILESYSTEM_VOLUMES #endif @@ -285,17 +285,6 @@ public: } #endif // wxUSE_DATETIME -#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON - bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; - bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const; - // gets the 'common' type and creator for a certain extension - static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; - // registers application defined extensions and their default type and creator - static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ; - // looks up the appropriate type and creator from the registration and then sets - bool MacSetDefaultTypeAndCreator() ; -#endif - // various file/dir operations // retrieve the value of the current working directory @@ -395,7 +384,7 @@ public: return !m_dontFollowLinks; } -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE +#if defined(__WIN32__) && wxUSE_OLE // if the path is a shortcut, return the target and optionally, // the arguments bool GetShortcutTarget(const wxString& shortcutPath, @@ -403,7 +392,6 @@ public: wxString* arguments = NULL) const; #endif -#ifndef __WXWINCE__ // if the path contains the value of the environment variable named envname // then this function replaces it with the string obtained from // wxString::Format(replacementFmtString, value_of_envname_variable) @@ -415,7 +403,6 @@ public: bool ReplaceEnvVariable(const wxString& envname, const wxString& replacementFmtString = "$%s", wxPathFormat format = wxPATH_NATIVE); -#endif // replaces, if present in the path, the home directory for the given user // (see wxGetHomeDir) with a tilde @@ -597,10 +584,8 @@ public: // deprecated methods, don't use any more // -------------------------------------- -#ifndef __DIGITALMARS__ wxString GetPath( bool withSep, wxPathFormat format = wxPATH_NATIVE ) const { return GetPath(withSep ? wxPATH_GET_SEPARATOR : 0, format); } -#endif wxString GetPathWithSep(wxPathFormat format = wxPATH_NATIVE ) const { return GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, format); } diff --git a/Externals/wxWidgets3/include/wx/filepicker.h b/Externals/wxWidgets3/include/wx/filepicker.h index 5264ddb3ea..6c9b3f85a7 100644 --- a/Externals/wxWidgets3/include/wx/filepicker.h +++ b/Externals/wxWidgets3/include/wx/filepicker.h @@ -50,12 +50,12 @@ public: void SetPath(const wxString &p) { m_path = p; } // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFileDirPickerEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFileDirPickerEvent(*this); } private: wxString m_path; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileDirPickerEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent ); @@ -176,8 +176,8 @@ public: // public API public: // internal functions - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); + void UpdatePickerFromTextCtrl() wxOVERRIDE; + void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnFileDirChange(wxFileDirPickerEvent &); @@ -267,15 +267,15 @@ public: public: // overrides // return the text control value in canonical form - wxString GetTextCtrlValue() const; + wxString GetTextCtrlValue() const wxOVERRIDE; - bool IsCwdToUpdate() const + bool IsCwdToUpdate() const wxOVERRIDE { return HasFlag(wxFLP_CHANGE_DIR); } - wxEventType GetEventType() const + wxEventType GetEventType() const wxOVERRIDE { return wxEVT_FILEPICKER_CHANGED; } - virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) + virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE { sender->Connect( wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ), @@ -288,7 +288,7 @@ protected: wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, - const wxString& wildcard) + const wxString& wildcard) wxOVERRIDE { return new wxFilePickerWidget(parent, wxID_ANY, wxGetTranslation(wxFilePickerWidgetLabel), @@ -298,7 +298,7 @@ protected: } // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const + long GetPickerStyle(long style) const wxOVERRIDE { return style & (wxFLP_OPEN | wxFLP_SAVE | @@ -310,7 +310,7 @@ protected: } private: - DECLARE_DYNAMIC_CLASS(wxFilePickerCtrl) + wxDECLARE_DYNAMIC_CLASS(wxFilePickerCtrl); }; #endif // wxUSE_FILEPICKERCTRL @@ -367,15 +367,15 @@ public: public: // overrides - wxString GetTextCtrlValue() const; + wxString GetTextCtrlValue() const wxOVERRIDE; - bool IsCwdToUpdate() const + bool IsCwdToUpdate() const wxOVERRIDE { return HasFlag(wxDIRP_CHANGE_DIR); } - wxEventType GetEventType() const + wxEventType GetEventType() const wxOVERRIDE { return wxEVT_DIRPICKER_CHANGED; } - virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) + virtual void DoConnect( wxControl *sender, wxFileDirPickerCtrlBase *eventSink ) wxOVERRIDE { sender->Connect( wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( wxFileDirPickerCtrlBase::OnFileDirChange ), @@ -388,7 +388,7 @@ protected: wxFileDirPickerWidgetBase *CreatePicker(wxWindow *parent, const wxString& path, const wxString& message, - const wxString& WXUNUSED(wildcard)) + const wxString& WXUNUSED(wildcard)) wxOVERRIDE { return new wxDirPickerWidget(parent, wxID_ANY, wxGetTranslation(wxDirPickerWidgetLabel), @@ -398,7 +398,7 @@ protected: } // extracts the style for our picker from wxFileDirPickerCtrlBase's style - long GetPickerStyle(long style) const + long GetPickerStyle(long style) const wxOVERRIDE { return style & (wxDIRP_DIR_MUST_EXIST | wxDIRP_CHANGE_DIR | @@ -407,7 +407,7 @@ protected: } private: - DECLARE_DYNAMIC_CLASS(wxDirPickerCtrl) + wxDECLARE_DYNAMIC_CLASS(wxDirPickerCtrl); }; #endif // wxUSE_DIRPICKERCTRL diff --git a/Externals/wxWidgets3/include/wx/filesys.h b/Externals/wxWidgets3/include/wx/filesys.h index 3bd6e426c7..eb9a794e80 100644 --- a/Externals/wxWidgets3/include/wx/filesys.h +++ b/Externals/wxWidgets3/include/wx/filesys.h @@ -97,7 +97,7 @@ private: wxDateTime m_Modif; #endif // wxUSE_DATETIME - DECLARE_ABSTRACT_CLASS(wxFSFile) + wxDECLARE_ABSTRACT_CLASS(wxFSFile); wxDECLARE_NO_COPY_CLASS(wxFSFile); }; @@ -154,7 +154,7 @@ protected: // {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"} static wxString GetRightLocation(const wxString& location); - DECLARE_ABSTRACT_CLASS(wxFileSystemHandler) + wxDECLARE_ABSTRACT_CLASS(wxFileSystemHandler); }; @@ -245,7 +245,7 @@ protected: wxFSHandlerHash m_LocalHandlers; // Handlers local to this instance - DECLARE_DYNAMIC_CLASS(wxFileSystem) + wxDECLARE_DYNAMIC_CLASS(wxFileSystem); wxDECLARE_NO_COPY_CLASS(wxFileSystem); }; @@ -277,10 +277,10 @@ special characters : class WXDLLIMPEXP_BASE wxLocalFSHandler : public wxFileSystemHandler { public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; // wxLocalFSHandler will prefix all filenames with 'root' before accessing // files on disk. This effectively makes 'root' the top-level directory diff --git a/Externals/wxWidgets3/include/wx/font.h b/Externals/wxWidgets3/include/wx/font.h index 10a6f0e5d7..cbd3cada8f 100644 --- a/Externals/wxWidgets3/include/wx/font.h +++ b/Externals/wxWidgets3/include/wx/font.h @@ -285,32 +285,6 @@ public: virtual ~wxFontBase(); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - // from the font components - static wxFont *New( - int pointSize, // size of the font in points - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... - { return New(pointSize, (wxFontFamily)family, (wxFontStyle)style, - (wxFontWeight)weight, underlined, face, encoding); } - - // from the font components - static wxFont *New( - const wxSize& pixelSize, // size of the font in pixels - int family, // see wxFontFamily enum - int style, // see wxFontStyle enum - int weight, // see wxFontWeight enum - bool underlined = false, // not underlined by default - const wxString& face = wxEmptyString, // facename - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... - { return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style, - (wxFontWeight)weight, underlined, face, encoding); } -#endif - // from the font components static wxFont *New( int pointSize, // size of the font in points @@ -419,10 +393,37 @@ public: // this doesn't do anything and is kept for compatibility only #if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);); + wxDEPRECATED_INLINE(void SetNoAntiAliasing(bool no = true), wxUnusedVar(no);) wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;) #endif // WXWIN_COMPATIBILITY_2_8 + // from the font components + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + static wxFont *New( + int pointSize, // size of the font in points + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... + { return New(pointSize, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underlined, face, encoding); } + + // from the font components + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + static wxFont *New( + const wxSize& pixelSize, // size of the font in pixels + int family, // see wxFontFamily enum + int style, // see wxFontStyle enum + int weight, // see wxFontWeight enum + bool underlined = false, // not underlined by default + const wxString& face = wxEmptyString, // facename + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ... + { return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underlined, face, encoding); } + + protected: // the function called by both overloads of SetNativeFontInfo() virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); @@ -475,27 +476,26 @@ WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font); WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 -#define wxDECLARE_FONT_COMPAT_SETTER \ - wxDEPRECATED_FUTURE( void SetFamily(int family) ) \ - { SetFamily((wxFontFamily)family); } \ - wxDEPRECATED_FUTURE( void SetStyle(int style) ) \ - { SetStyle((wxFontStyle)style); } \ - wxDEPRECATED_FUTURE( void SetWeight(int weight) ) \ - { SetWeight((wxFontWeight)weight); } \ - wxDEPRECATED_FUTURE( void SetFamily(wxDeprecatedGUIConstants family) ) \ - { SetFamily((wxFontFamily)family); } \ - wxDEPRECATED_FUTURE( void SetStyle(wxDeprecatedGUIConstants style) ) \ - { SetStyle((wxFontStyle)style); } \ - wxDEPRECATED_FUTURE( void SetWeight(wxDeprecatedGUIConstants weight) ) \ - { SetWeight((wxFontWeight)weight); } -#else -#define wxDECLARE_FONT_COMPAT_SETTER /*empty*/ -#endif - // this macro must be used in all derived wxFont classes declarations #define wxDECLARE_COMMON_FONT_METHODS() \ - wxDECLARE_FONT_COMPAT_SETTER \ + wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ + void SetFamily(int family) \ + { SetFamily((wxFontFamily)family); } \ + wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ + void SetStyle(int style) \ + { SetStyle((wxFontStyle)style); } \ + wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ + void SetWeight(int weight) \ + { SetWeight((wxFontWeight)weight); } \ + wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ + void SetFamily(wxDeprecatedGUIConstants family) \ + { SetFamily((wxFontFamily)family); } \ + wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ + void SetStyle(wxDeprecatedGUIConstants style) \ + { SetStyle((wxFontStyle)style); } \ + wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ + void SetWeight(wxDeprecatedGUIConstants weight) \ + { SetWeight((wxFontWeight)weight); } \ \ /* functions for modifying font in place */ \ wxFont& MakeBold(); \ @@ -507,6 +507,7 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); wxFont& Scale(float x); \ /* functions for creating fonts based on this one */ \ wxFont Bold() const; \ + wxFont GetBaseFont() const; \ wxFont Italic() const; \ wxFont Underlined() const; \ wxFont Strikethrough() const; \ @@ -529,10 +530,8 @@ WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); #include "wx/dfb/font.h" #elif defined(__WXMAC__) #include "wx/osx/font.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/font.h" -#elif defined(__WXPM__) - #include "wx/os2/font.h" +#elif defined(__WXQT__) + #include "wx/qt/font.h" #endif class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase @@ -546,19 +545,13 @@ public: const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight, bool underline = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) { return FindOrCreateFont(pointSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underline, face, encoding); } -#endif - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddFont(wxFont*) ); - wxDEPRECATED( void RemoveFont(wxFont*) ); -#endif }; extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; @@ -570,29 +563,31 @@ extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; // // to compile without warnings which it would otherwise provoke from some // compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 // Unfortunately some compilers have ambiguity issues when enum comparisons are // overloaded so we have to disable the overloads in this case, see // wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. #ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM +wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \ inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t) -{ return !(s == t); } + { return static_cast(s) != static_cast(t); } +wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \ inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t) -{ return !(s == t); } + { return static_cast(s) != static_cast(t); } +wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t) -{ return static_cast(s) == static_cast(t); } + { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \ inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t) -{ return !(s == t); } + { return static_cast(s) != static_cast(t); } #endif // // wxCOMPILER_NO_OVERLOAD_ON_ENUM -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - -#endif - // _WX_FONT_H_BASE_ +#endif // _WX_FONT_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/fontdata.h b/Externals/wxWidgets3/include/wx/fontdata.h index 87571ce940..592e0b6d9b 100644 --- a/Externals/wxWidgets3/include/wx/fontdata.h +++ b/Externals/wxWidgets3/include/wx/fontdata.h @@ -64,7 +64,7 @@ private: wxFontEncoding m_encoding; wxNativeEncodingInfo m_encodingInfo; - DECLARE_DYNAMIC_CLASS(wxFontData) + wxDECLARE_DYNAMIC_CLASS(wxFontData); }; #endif // _WX_FONTDATA_H_ diff --git a/Externals/wxWidgets3/include/wx/fontdlg.h b/Externals/wxWidgets3/include/wx/fontdlg.h index 74a6e6fccf..63e7fd4439 100644 --- a/Externals/wxWidgets3/include/wx/fontdlg.h +++ b/Externals/wxWidgets3/include/wx/fontdlg.h @@ -40,13 +40,6 @@ public: const wxFontData& GetFontData() const { return m_fontData; } wxFontData& GetFontData() { return m_fontData; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use - wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) ); - - wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } @@ -58,15 +51,6 @@ protected: wxDECLARE_NO_COPY_CLASS(wxFontDialogBase); }; -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, for compatibility only, don't use -inline wxFontDialogBase::wxFontDialogBase(wxWindow *parent, const wxFontData *data) -{ m_parent = parent; InitFontData(data); } - -inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) -{ InitFontData(data); return Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // platform-specific wxFontDialog implementation // ---------------------------------------------------------------------------- @@ -81,8 +65,6 @@ inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) #if defined(__WXUNIVERSAL__) || \ defined(__WXMOTIF__) || \ - defined(__WXCOCOA__) || \ - defined(__WXWINCE__) || \ defined(__WXGPE__) #include "wx/generic/fontdlgg.h" @@ -93,10 +75,10 @@ inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) #include "wx/gtk/fontdlg.h" #elif defined(__WXGTK__) #include "wx/gtk1/fontdlg.h" -#elif defined(__WXPM__) - #include "wx/os2/fontdlg.h" #elif defined(__WXMAC__) #include "wx/osx/fontdlg.h" +#elif defined(__WXQT__) + #include "wx/qt/fontdlg.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/fontpicker.h b/Externals/wxWidgets3/include/wx/fontpicker.h index 1bacc3a4a0..650c919579 100644 --- a/Externals/wxWidgets3/include/wx/fontpicker.h +++ b/Externals/wxWidgets3/include/wx/fontpicker.h @@ -41,6 +41,9 @@ public: virtual void SetSelectedFont(const wxFont &f) { m_selectedFont = f; UpdateFont(); } + virtual wxColour GetSelectedColour() const = 0; + virtual void SetSelectedColour(const wxColour &colour) = 0; + protected: virtual void UpdateFont() = 0; @@ -133,12 +136,20 @@ public: // public API // get the font chosen wxFont GetSelectedFont() const - { return ((wxFontPickerWidget *)m_picker)->GetSelectedFont(); } + { return GetPickerWidget()->GetSelectedFont(); } // sets currently displayed font void SetSelectedFont(const wxFont& f); - // set/get the max pointsize + // returns the selected color + wxColour GetSelectedColour() const + { return GetPickerWidget()->GetSelectedColour(); } + + // sets the currently selected color + void SetSelectedColour(const wxColour& colour) + { GetPickerWidget()->SetSelectedColour(colour); } + + // set/get the max point size void SetMaxPointSize(unsigned int max) { m_nMaxPointSize=max; } unsigned int GetMaxPointSize() const @@ -146,8 +157,8 @@ public: // public API public: // internal functions - void UpdatePickerFromTextCtrl(); - void UpdateTextCtrlFromPicker(); + void UpdatePickerFromTextCtrl() wxOVERRIDE; + void UpdateTextCtrlFromPicker() wxOVERRIDE; // event handler for our picker void OnFontChange(wxFontPickerEvent &); @@ -159,14 +170,17 @@ public: // internal functions protected: // extracts the style for our picker from wxFontPickerCtrl's style - long GetPickerStyle(long style) const + long GetPickerStyle(long style) const wxOVERRIDE { return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); } // the maximum pointsize allowed to the user unsigned int m_nMaxPointSize; private: - DECLARE_DYNAMIC_CLASS(wxFontPickerCtrl) + wxFontPickerWidget* GetPickerWidget() const + { return static_cast(m_picker); } + + wxDECLARE_DYNAMIC_CLASS(wxFontPickerCtrl); }; @@ -191,12 +205,12 @@ public: void SetFont(const wxFont &c) { m_font = c; } // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxFontPickerEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxFontPickerEvent(*this); } private: wxFont m_font; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFontPickerEvent); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/fontutil.h b/Externals/wxWidgets3/include/wx/fontutil.h index a4e0a7d4d5..d5e1a86ebb 100644 --- a/Externals/wxWidgets3/include/wx/fontutil.h +++ b/Externals/wxWidgets3/include/wx/fontutil.h @@ -25,6 +25,10 @@ #include "wx/msw/wrapwin.h" #endif +#if defined(__WXQT__) + #include +#endif + class WXDLLIMPEXP_FWD_BASE wxArrayString; struct WXDLLIMPEXP_FWD_CORE wxNativeEncodingInfo; @@ -113,11 +117,6 @@ public: wxNativeFontInfo(const LOGFONT& lf_) : lf(lf_) { } LOGFONT lf; -#elif defined(__WXPM__) - // OS/2 native structures that define a font - FATTRS fa; - FONTMETRICS fm; - FACENAMEDESC fn; #elif defined(__WXOSX__) public: wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); } @@ -126,9 +125,14 @@ public: wxFontStyle style, 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); + } ~wxNativeFontInfo() { Free(); } @@ -149,12 +153,16 @@ public: wxFontStyle style, wxFontWeight weight, bool underlined, + bool strikethrough, const wxString& faceName , wxFontEncoding encoding); void Free(); void EnsureValid(); + static void UpdateNamesMap(const wxString& familyname, CTFontDescriptorRef descr); + static void UpdateNamesMap(const wxString& familyname, CTFontRef font); + bool m_descriptorValid; #if wxOSX_USE_ATSU_TEXT @@ -163,10 +171,6 @@ public: wxUint32 m_atsuFontID; // the qd styles that are not intrinsic to the font above wxInt16 m_atsuAdditionalQDStyles; -#if wxOSX_USE_CARBON - wxInt16 m_qdFontFamily; - wxInt16 m_qdFontStyle; -#endif #endif int m_pointSize; @@ -178,6 +182,8 @@ public: wxString m_faceName; wxFontEncoding m_encoding; public : +#elif defined(__WXQT__) + QFont m_qtFont; #else // other platforms // // This is a generic implementation that should work on all ports diff --git a/Externals/wxWidgets3/include/wx/frame.h b/Externals/wxWidgets3/include/wx/frame.h index 41927f775a..c1e1bcfe3d 100644 --- a/Externals/wxWidgets3/include/wx/frame.h +++ b/Externals/wxWidgets3/include/wx/frame.h @@ -71,7 +71,7 @@ public: // get the origin of the client area (which may be different from (0, 0) // if the frame has a toolbar) in client coordinates - virtual wxPoint GetClientAreaOrigin() const; + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; // menu bar functions @@ -164,10 +164,10 @@ public: #endif // wxUSE_MENUS // do the UI update processing for this window - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE); + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE; // Implement internal behaviour (menu updating on some platforms) - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; #if wxUSE_MENUS || wxUSE_TOOLBAR // show help text for the currently selected menu or toolbar item @@ -176,7 +176,7 @@ public: virtual void DoGiveHelp(const wxString& text, bool show); #endif - virtual bool IsClientAreaChild(const wxWindow *child) const + virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE { return !IsOneOfBars(child) && wxTopLevelWindow::IsClientAreaChild(child); } @@ -190,7 +190,7 @@ protected: void DeleteAllBars(); // test whether this window makes part of the frame - virtual bool IsOneOfBars(const wxWindow *win) const; + virtual bool IsOneOfBars(const wxWindow *win) const wxOVERRIDE; #if wxUSE_MENUS // override to update menu bar position when the frame size changes @@ -244,14 +244,14 @@ protected: #endif // wxUSE_TOOLBAR #if wxUSE_MENUS && wxUSE_STATUSBAR - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); #endif // wxUSE_MENUS && wxUSE_STATUSBAR wxDECLARE_NO_COPY_CLASS(wxFrameBase); }; // include the real class declaration -#if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) +#if defined(__WXUNIVERSAL__) #include "wx/univ/frame.h" #else // !__WXUNIVERSAL__ #if defined(__WXMSW__) @@ -264,10 +264,8 @@ protected: #include "wx/motif/frame.h" #elif defined(__WXMAC__) #include "wx/osx/frame.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/frame.h" - #elif defined(__WXPM__) - #include "wx/os2/frame.h" + #elif defined(__WXQT__) + #include "wx/qt/frame.h" #endif #endif diff --git a/Externals/wxWidgets3/include/wx/fs_arc.h b/Externals/wxWidgets3/include/wx/fs_arc.h index e65b8fc7b6..014270d609 100644 --- a/Externals/wxWidgets3/include/wx/fs_arc.h +++ b/Externals/wxWidgets3/include/wx/fs_arc.h @@ -26,10 +26,10 @@ class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler { public: wxArchiveFSHandler(); - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; void Cleanup(); virtual ~wxArchiveFSHandler(); @@ -47,7 +47,7 @@ private: wxString DoFind(); wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler); - DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) + wxDECLARE_DYNAMIC_CLASS(wxArchiveFSHandler); }; #endif // wxUSE_FS_ARCHIVE diff --git a/Externals/wxWidgets3/include/wx/fs_filter.h b/Externals/wxWidgets3/include/wx/fs_filter.h index 8e8afda4e2..4391921252 100644 --- a/Externals/wxWidgets3/include/wx/fs_filter.h +++ b/Externals/wxWidgets3/include/wx/fs_filter.h @@ -25,11 +25,11 @@ public: wxFilterFSHandler() : wxFileSystemHandler() { } virtual ~wxFilterFSHandler() { } - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; private: wxDECLARE_NO_COPY_CLASS(wxFilterFSHandler); diff --git a/Externals/wxWidgets3/include/wx/fs_inet.h b/Externals/wxWidgets3/include/wx/fs_inet.h index bde0c69546..58b74ab64a 100644 --- a/Externals/wxWidgets3/include/wx/fs_inet.h +++ b/Externals/wxWidgets3/include/wx/fs_inet.h @@ -22,8 +22,8 @@ class WXDLLIMPEXP_NET wxInternetFSHandler : public wxFileSystemHandler { public: - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; }; #endif diff --git a/Externals/wxWidgets3/include/wx/fs_mem.h b/Externals/wxWidgets3/include/wx/fs_mem.h index 6688537ca5..f62d21c2fd 100644 --- a/Externals/wxWidgets3/include/wx/fs_mem.h +++ b/Externals/wxWidgets3/include/wx/fs_mem.h @@ -49,10 +49,10 @@ public: // Remove file from memory FS and free occupied memory static void RemoveFile(const wxString& filename); - virtual bool CanOpen(const wxString& location); - virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); - virtual wxString FindFirst(const wxString& spec, int flags = 0); - virtual wxString FindNext(); + virtual bool CanOpen(const wxString& location) wxOVERRIDE; + virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) wxOVERRIDE; + virtual wxString FindFirst(const wxString& spec, int flags = 0) wxOVERRIDE; + virtual wxString FindNext() wxOVERRIDE; protected: // check that the given file is not already present in m_Hash; logs an diff --git a/Externals/wxWidgets3/include/wx/fswatcher.h b/Externals/wxWidgets3/include/wx/fswatcher.h index 056780d348..a29ff834e6 100644 --- a/Externals/wxWidgets3/include/wx/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/fswatcher.h @@ -52,7 +52,7 @@ enum wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY | wxFSW_EVENT_ACCESS | wxFSW_EVENT_ATTRIB | wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR -#ifdef wxHAS_INOTIFY +#if defined(wxHAS_INOTIFY) || defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) ,wxFSW_EVENT_UNMOUNT = 0x2000 #endif }; @@ -159,7 +159,7 @@ public: return m_changeType; } - virtual wxEvent* Clone() const + virtual wxEvent* Clone() const wxOVERRIDE { wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent(*this); evt->m_errorMsg = m_errorMsg.Clone(); @@ -169,7 +169,7 @@ public: return evt; } - virtual wxEventCategory GetEventCategory() const + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { // TODO this has to be merged with "similar" categories and changed return wxEVT_CATEGORY_UNKNOWN; @@ -205,7 +205,7 @@ protected: wxFileName m_newPath; wxString m_errorMsg; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileSystemWatcherEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFileSystemWatcherEvent); }; typedef void (wxEvtHandler::*wxFileSystemWatcherEventFunction) @@ -395,6 +395,10 @@ protected: #ifdef wxHAS_INOTIFY #include "wx/unix/fswatcher_inotify.h" #define wxFileSystemWatcher wxInotifyFileSystemWatcher +#elif defined(wxHAS_KQUEUE) && defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) + #include "wx/unix/fswatcher_kqueue.h" + #include "wx/osx/fswatcher_fsevents.h" + #define wxFileSystemWatcher wxFsEventsFileSystemWatcher #elif defined(wxHAS_KQUEUE) #include "wx/unix/fswatcher_kqueue.h" #define wxFileSystemWatcher wxKqueueFileSystemWatcher diff --git a/Externals/wxWidgets3/include/wx/gauge.h b/Externals/wxWidgets3/include/wx/gauge.h index 93ae86fcc4..d89f089131 100644 --- a/Externals/wxWidgets3/include/wx/gauge.h +++ b/Externals/wxWidgets3/include/wx/gauge.h @@ -24,17 +24,17 @@ #define wxGA_HORIZONTAL wxHORIZONTAL #define wxGA_VERTICAL wxVERTICAL +// Available since Windows 7 only. With this style, the value of guage will +// reflect on the taskbar button. +#define wxGA_PROGRESS 0x0010 // Win32 only, is default (and only) on some other platforms #define wxGA_SMOOTH 0x0020 - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete style - #define wxGA_PROGRESSBAR 0 -#endif // WXWIN_COMPATIBILITY_2_6 +// QT only, display current completed percentage (text default format "%p%") +#define wxGA_TEXT 0x0040 // GTK and Mac always have native implementation of the indeterminate mode // wxMSW has native implementation only if comctl32.dll >= 6.00 -#if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__) +#if !defined(__WXGTK20__) && !defined(__WXMAC__) #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 #else #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 @@ -42,6 +42,8 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; +class WXDLLIMPEXP_FWD_CORE wxAppProgressIndicator; + // ---------------------------------------------------------------------------- // wxGauge: a progress bar // ---------------------------------------------------------------------------- @@ -49,7 +51,9 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl { public: - wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } + wxGaugeBase() : m_rangeMax(0), m_gaugePos(0), + m_appProgressIndicator(NULL) { } + virtual ~wxGaugeBase(); bool Create(wxWindow *parent, @@ -76,18 +80,31 @@ public: // simple accessors bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } - // appearance params (not implemented for most ports) - virtual void SetShadowWidth(int w); - virtual int GetShadowWidth() const; - - virtual void SetBezelFace(int w); - virtual int GetBezelFace() const; - // overridden base class virtuals - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + + // Deprecated methods not doing anything since a long time. + wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") + void SetShadowWidth(int WXUNUSED(w)) { } + + wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") + int GetShadowWidth() const { return 0; } + + wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") + void SetBezelFace(int WXUNUSED(w)) { } + + wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") + int GetBezelFace() const { return 0; } protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } + + // Initialize m_appProgressIndicator if necessary, i.e. if this object has + // wxGA_PROGRESS style. This method is supposed to be called from the + // derived class Create() if it doesn't call the base class Create(), which + // already does it, after initializing the window style and range. + void InitProgressIndicatorIfNeeded(); + // the max position int m_rangeMax; @@ -99,6 +116,8 @@ protected: int m_nDirection; // can be wxRIGHT or wxLEFT #endif + wxAppProgressIndicator *m_appProgressIndicator; + wxDECLARE_NO_COPY_CLASS(wxGaugeBase); }; @@ -114,10 +133,8 @@ protected: #include "wx/gtk1/gauge.h" #elif defined(__WXMAC__) #include "wx/osx/gauge.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/gauge.h" -#elif defined(__WXPM__) - #include "wx/os2/gauge.h" +#elif defined(__WXQT__) + #include "wx/qt/gauge.h" #endif #endif // wxUSE_GAUGE diff --git a/Externals/wxWidgets3/include/wx/gbsizer.h b/Externals/wxWidgets3/include/wx/gbsizer.h index dea46c15ab..501b5d8188 100644 --- a/Externals/wxWidgets3/include/wx/gbsizer.h +++ b/Externals/wxWidgets3/include/wx/gbsizer.h @@ -195,7 +195,7 @@ protected: private: - DECLARE_DYNAMIC_CLASS(wxGBSizerItem) + wxDECLARE_DYNAMIC_CLASS(wxGBSizerItem); wxDECLARE_NO_COPY_CLASS(wxGBSizerItem); }; @@ -291,8 +291,8 @@ public: // These are what make the sizer do size calculations and layout - virtual void RecalcSizes(); - virtual wxSize CalcMin(); + virtual void RecalcSizes() wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; // Look at all items and see if any intersect (or would overlap) the given @@ -317,7 +317,7 @@ public: virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ) wxOVERRIDE; virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); @@ -333,7 +333,7 @@ protected: private: - DECLARE_CLASS(wxGridBagSizer) + wxDECLARE_CLASS(wxGridBagSizer); wxDECLARE_NO_COPY_CLASS(wxGridBagSizer); }; diff --git a/Externals/wxWidgets3/include/wx/gdicmn.h b/Externals/wxWidgets3/include/wx/gdicmn.h index 6ce652d49f..35f680adea 100644 --- a/Externals/wxWidgets3/include/wx/gdicmn.h +++ b/Externals/wxWidgets3/include/wx/gdicmn.h @@ -155,11 +155,35 @@ enum wxStockCursor #define wxCURSOR_CLOSED_HAND wxCURSOR_HAND #endif +// ---------------------------------------------------------------------------- +// Ellipsize() constants +// ---------------------------------------------------------------------------- + +enum wxEllipsizeFlags +{ + wxELLIPSIZE_FLAGS_NONE = 0, + wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS = 1, + wxELLIPSIZE_FLAGS_EXPAND_TABS = 2, + + wxELLIPSIZE_FLAGS_DEFAULT = wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS | + wxELLIPSIZE_FLAGS_EXPAND_TABS +}; + +// NB: Don't change the order of these values, they're the same as in +// PangoEllipsizeMode enum. +enum wxEllipsizeMode +{ + wxELLIPSIZE_NONE, + wxELLIPSIZE_START, + wxELLIPSIZE_MIDDLE, + wxELLIPSIZE_END +}; + // --------------------------------------------------------------------------- // macros // --------------------------------------------------------------------------- -#if defined(__WINDOWS__) || defined(__WXPM__) +#if defined(__WINDOWS__) #define wxHAS_IMAGES_IN_RESOURCES #endif @@ -176,9 +200,6 @@ enum wxStockCursor #ifdef __WINDOWS__ // Load from a resource #define wxICON(X) wxIcon(wxT(#X)) -#elif defined(__WXPM__) - // Load from a resource - #define wxICON(X) wxIcon(wxT(#X)) #elif defined(__WXDFB__) // Initialize from an included XPM #define wxICON(X) wxIcon( X##_xpm ) @@ -194,6 +215,9 @@ enum wxStockCursor #elif defined(__WXX11__) // Initialize from an included XPM #define wxICON(X) wxIcon( X##_xpm ) +#elif defined(__WXQT__) + // Initialize from an included XPM + #define wxICON(X) wxIcon( X##_xpm ) #else // This will usually mean something on any platform #define wxICON(X) wxIcon(wxT(#X)) @@ -203,14 +227,13 @@ enum wxStockCursor under Unix bitmaps live in XPMs and under Windows they're in ressources. */ -#if defined(__WINDOWS__) || defined(__WXPM__) +#if defined(__WINDOWS__) #define wxBITMAP(name) wxBitmap(wxT(#name), wxBITMAP_TYPE_BMP_RESOURCE) #elif defined(__WXGTK__) || \ defined(__WXMOTIF__) || \ defined(__WXX11__) || \ defined(__WXMAC__) || \ - defined(__WXDFB__) || \ - defined(__WXCOCOA__) + defined(__WXDFB__) // Initialize from an included XPM #define wxBITMAP(name) wxBitmap(name##_xpm) #else // other platforms @@ -808,13 +831,6 @@ public: // return true if the rectangle 'rect' is (not strictly) inside this rect bool Contains(const wxRect& rect) const; -#if WXWIN_COMPATIBILITY_2_6 - // use Contains() instead - wxDEPRECATED( bool Inside(int x, int y) const ); - wxDEPRECATED( bool Inside(const wxPoint& pt) const ); - wxDEPRECATED( bool Inside(const wxRect& rect) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - // return true if the rectangles have a non empty intersection bool Intersects(const wxRect& rect) const; @@ -861,16 +877,6 @@ WXDLLIMPEXP_CORE wxRect operator+(const wxRect& r1, const wxRect& r2); // intersections of two rectangles WXDLLIMPEXP_CORE wxRect operator*(const wxRect& r1, const wxRect& r2); - - - -#if WXWIN_COMPATIBILITY_2_6 -inline bool wxRect::Inside(int cx, int cy) const { return Contains(cx, cy); } -inline bool wxRect::Inside(const wxPoint& pt) const { return Contains(pt); } -inline bool wxRect::Inside(const wxRect& rect) const { return Contains(rect); } -#endif // WXWIN_COMPATIBILITY_2_6 - - // define functions which couldn't be defined above because of declarations // order inline void wxSize::IncBy(const wxPoint& pt) { IncBy(pt.x, pt.y); } @@ -906,18 +912,6 @@ public: // add a new colour to the database void AddColour(const wxString& name, const wxColour& colour); -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, use Find() instead - wxDEPRECATED( wxColour *FindColour(const wxString& name) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - -#ifdef __WXPM__ - // PM keeps its own type of colour table - long* m_palTable; - size_t m_nSize; -#endif - private: // load the database with the built in colour values when called for the // first time, do nothing after this @@ -931,7 +925,7 @@ class WXDLLIMPEXP_CORE wxResourceCache: public wxList public: wxResourceCache() { } #if !wxUSE_STD_CONTAINERS - wxResourceCache(const unsigned int keyType) : wxList(keyType) { } + wxResourceCache(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 903dfe083d..81d1f46a6b 100644 --- a/Externals/wxWidgets3/include/wx/gdiobj.h +++ b/Externals/wxWidgets3/include/wx/gdiobj.h @@ -56,7 +56,7 @@ public: // because it's still widely used) bool Ok() const { return IsOk(); } -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) // Creates the resource virtual bool RealizeResource() { return false; } @@ -67,18 +67,18 @@ public: // Returns handle. virtual WXHANDLE GetResourceHandle() const { return 0; } -#endif // defined(__WXMSW__) || defined(__WXPM__) +#endif // defined(__WXMSW__) protected: // replace base class functions using wxObjectRefData with our own which // use wxGDIRefData to ensure that we always work with data objects of the // correct type (i.e. derived from wxGDIRefData) - virtual wxObjectRefData *CreateRefData() const + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE { return CreateGDIRefData(); } - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE { return CloneGDIRefData(static_cast(data)); } @@ -86,7 +86,7 @@ protected: virtual wxGDIRefData *CreateGDIRefData() const = 0; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const = 0; - DECLARE_DYNAMIC_CLASS(wxGDIObject) + wxDECLARE_DYNAMIC_CLASS(wxGDIObject); }; #endif // _WX_GDIOBJ_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/generic/accel.h b/Externals/wxWidgets3/include/wx/generic/accel.h index 44f8e07e83..0195f4642b 100644 --- a/Externals/wxWidgets3/include/wx/generic/accel.h +++ b/Externals/wxWidgets3/include/wx/generic/accel.h @@ -38,11 +38,11 @@ public: protected: // ref counting code - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); }; #endif // _WX_GENERIC_ACCEL_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/activityindicator.h b/Externals/wxWidgets3/include/wx/generic/activityindicator.h new file mode 100644 index 0000000000..1fbeb8e624 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/activityindicator.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/activityindicator.h +// Purpose: Declaration of wxActivityIndicatorGeneric. +// Author: Vadim Zeitlin +// Created: 2015-03-06 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_ACTIVITYINDICATOR_H_ +#define _WX_GENERIC_ACTIVITYINDICATOR_H_ + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + // This is the only implementation we have, so call it accordingly. + #define wxActivityIndicatorGeneric wxActivityIndicator +#endif + +// ---------------------------------------------------------------------------- +// wxActivityIndicatorGeneric: built-in generic implementation. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicatorGeneric : public wxActivityIndicatorBase +{ +public: + wxActivityIndicatorGeneric() + { + m_impl = NULL; + } + + explicit + wxActivityIndicatorGeneric(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + m_impl = NULL; + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual ~wxActivityIndicatorGeneric(); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + class wxActivityIndicatorImpl *m_impl; + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); +#endif +}; + +#endif // _WX_GENERIC_ACTIVITYINDICATOR_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/animate.h b/Externals/wxWidgets3/include/wx/generic/animate.h index 818daf890c..c9773f44fb 100644 --- a/Externals/wxWidgets3/include/wx/generic/animate.h +++ b/Externals/wxWidgets3/include/wx/generic/animate.h @@ -58,7 +58,7 @@ public: static void CleanUpHandlers(); static void InitStandardHandlers(); - DECLARE_DYNAMIC_CLASS(wxAnimation) + wxDECLARE_DYNAMIC_CLASS(wxAnimation); }; @@ -95,23 +95,23 @@ public: ~wxAnimationCtrl(); public: - virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY); - virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; - virtual void Stop(); - virtual bool Play() + virtual void Stop() wxOVERRIDE; + virtual bool Play() wxOVERRIDE { return Play(true /* looped */); } - virtual bool IsPlaying() const + virtual bool IsPlaying() const wxOVERRIDE { return m_isPlaying; } - void SetAnimation(const wxAnimation &animation); - wxAnimation GetAnimation() const + void SetAnimation(const wxAnimation &animation) wxOVERRIDE; + wxAnimation GetAnimation() const wxOVERRIDE { return m_animation; } - virtual void SetInactiveBitmap(const wxBitmap &bmp); + virtual void SetInactiveBitmap(const wxBitmap &bmp) wxOVERRIDE; // override base class method - virtual bool SetBackgroundColour(const wxColour& col); + virtual bool SetBackgroundColour(const wxColour& col) wxOVERRIDE; public: // event handlers @@ -153,8 +153,8 @@ protected: // internal utilities bool RebuildBackingStoreUpToFrame(unsigned int); void DrawFrame(wxDC &dc, unsigned int); - virtual void DisplayStaticImage(); - virtual wxSize DoGetBestSize() const; + virtual void DisplayStaticImage() wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; protected: unsigned int m_currentFrame; // Current frame @@ -170,8 +170,8 @@ protected: private: typedef wxAnimationCtrlBase base_type; - DECLARE_DYNAMIC_CLASS(wxAnimationCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GENERIC_ANIMATEH__ diff --git a/Externals/wxWidgets3/include/wx/generic/bmpcbox.h b/Externals/wxWidgets3/include/wx/generic/bmpcbox.h index d5e5cbb169..4630a29a72 100644 --- a/Externals/wxWidgets3/include/wx/generic/bmpcbox.h +++ b/Externals/wxWidgets3/include/wx/generic/bmpcbox.h @@ -98,39 +98,39 @@ public: unsigned int pos, wxClientData *clientData); // Sets the image for the given item. - virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap); - virtual bool SetFont(const wxFont& font); + virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE; + virtual bool SetFont(const wxFont& font) wxOVERRIDE; protected: - virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const; - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const; - virtual wxCoord OnMeasureItem(size_t item) const; - virtual wxCoord OnMeasureItemWidth(size_t item) const; + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const wxOVERRIDE; + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, int item, int flags) const wxOVERRIDE; + virtual wxCoord OnMeasureItem(size_t item) const wxOVERRIDE; + virtual wxCoord OnMeasureItemWidth(size_t item) const wxOVERRIDE; // Event handlers void OnSize(wxSizeEvent& event); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; - virtual wxItemContainer* GetItemContainer() { return this; } - virtual wxWindow* GetControl() { return this; } + virtual wxItemContainer* GetItemContainer() wxOVERRIDE { return this; } + virtual wxWindow* GetControl() wxOVERRIDE { return this; } // wxItemContainer implementation virtual int DoInsertItems(const wxArrayStringsAdapter & items, unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; private: bool m_inResize; void Init(); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_DYNAMIC_CLASS(wxBitmapComboBox) + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); }; #endif // _WX_GENERIC_BMPCBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/busyinfo.h b/Externals/wxWidgets3/include/wx/generic/busyinfo.h index 7f56edb26d..d910668c86 100644 --- a/Externals/wxWidgets3/include/wx/generic/busyinfo.h +++ b/Externals/wxWidgets3/include/wx/generic/busyinfo.h @@ -27,11 +27,21 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_CORE wxBusyInfo : public wxObject { public: - wxBusyInfo(const wxString& message, wxWindow *parent = NULL); + wxBusyInfo(const wxBusyInfoFlags& flags) + { + Init(flags); + } + + wxBusyInfo(const wxString& message, wxWindow *parent = NULL) + { + Init(wxBusyInfoFlags().Parent(parent).Label(message)); + } virtual ~wxBusyInfo(); private: + void Init(const wxBusyInfoFlags& flags); + wxFrame *m_InfoFrame; wxDECLARE_NO_COPY_CLASS(wxBusyInfo); diff --git a/Externals/wxWidgets3/include/wx/generic/buttonbar.h b/Externals/wxWidgets3/include/wx/generic/buttonbar.h index e933a3ca2c..7a96d4adbe 100644 --- a/Externals/wxWidgets3/include/wx/generic/buttonbar.h +++ b/Externals/wxWidgets3/include/wx/generic/buttonbar.h @@ -47,22 +47,22 @@ public: virtual ~wxButtonToolBar(); - virtual bool Realize(); + virtual bool Realize() wxOVERRIDE; - virtual void SetToolShortHelp(int id, const wxString& helpString); - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; protected: // common part of all ctors void Init(); // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(int id, const wxString& label, @@ -71,11 +71,11 @@ protected: wxItemKind kind, wxObject *clientData, const wxString& shortHelp, - const wxString& longHelp); + const wxString& longHelp) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); + const wxString& label) wxOVERRIDE; - virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; // calculate layout void DoLayout(); @@ -114,8 +114,8 @@ private: int m_labelMargin; private: - DECLARE_DYNAMIC_CLASS(wxButtonToolBar) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxButtonToolBar); + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/Externals/wxWidgets3/include/wx/generic/calctrlg.h b/Externals/wxWidgets3/include/wx/generic/calctrlg.h index 8e430b6231..0c2b48b413 100644 --- a/Externals/wxWidgets3/include/wx/generic/calctrlg.h +++ b/Externals/wxWidgets3/include/wx/generic/calctrlg.h @@ -46,22 +46,22 @@ public: virtual ~wxGenericCalendarCtrl(); - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; // set/get the current date // ------------------------ - virtual bool SetDate(const wxDateTime& date); - virtual wxDateTime GetDate() const { return m_date; } + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE { return m_date; } // set/get the range in which selection can occur // --------------------------------------------- virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, - const wxDateTime& upperdate = wxDefaultDateTime); + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; - virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const; + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; // these functions are for generic version only, don't use them but use the // Set/GetDateRange() above instead @@ -79,7 +79,7 @@ public: // should be used instead for them // corresponds to wxCAL_NO_MONTH_CHANGE bit - virtual bool EnableMonthChange(bool enable = true); + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; // corresponds to wxCAL_NO_YEAR_CHANGE bit, deprecated, generic only void EnableYearChange(bool enable = true); @@ -88,48 +88,48 @@ public: // customization // ------------- - virtual void Mark(size_t day, bool mark); + virtual void Mark(size_t day, bool mark) wxOVERRIDE; // all other functions in this section are for generic version only // header colours are used for painting the weekdays at the top - virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) + virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE { m_colHeaderFg = colFg; m_colHeaderBg = colBg; } - virtual const wxColour& GetHeaderColourFg() const { return m_colHeaderFg; } - virtual const wxColour& GetHeaderColourBg() const { return m_colHeaderBg; } + virtual const wxColour& GetHeaderColourFg() const wxOVERRIDE { return m_colHeaderFg; } + virtual const wxColour& GetHeaderColourBg() const wxOVERRIDE { return m_colHeaderBg; } // highlight colour is used for the currently selected date - virtual void SetHighlightColours(const wxColour& colFg, const wxColour& colBg) + virtual void SetHighlightColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE { m_colHighlightFg = colFg; m_colHighlightBg = colBg; } - virtual const wxColour& GetHighlightColourFg() const { return m_colHighlightFg; } - virtual const wxColour& GetHighlightColourBg() const { return m_colHighlightBg; } + virtual const wxColour& GetHighlightColourFg() const wxOVERRIDE { return m_colHighlightFg; } + virtual const wxColour& GetHighlightColourBg() const wxOVERRIDE { return m_colHighlightBg; } // holiday colour is used for the holidays (if style & wxCAL_SHOW_HOLIDAYS) - virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) + virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) wxOVERRIDE { m_colHolidayFg = colFg; m_colHolidayBg = colBg; } - virtual const wxColour& GetHolidayColourFg() const { return m_colHolidayFg; } - virtual const wxColour& GetHolidayColourBg() const { return m_colHolidayBg; } + virtual const wxColour& GetHolidayColourFg() const wxOVERRIDE { return m_colHolidayFg; } + virtual const wxColour& GetHolidayColourBg() const wxOVERRIDE { return m_colHolidayBg; } - virtual wxCalendarDateAttr *GetAttr(size_t day) const + virtual wxCalendarDateAttr *GetAttr(size_t day) const wxOVERRIDE { wxCHECK_MSG( day > 0 && day < 32, NULL, wxT("invalid day") ); return m_attrs[day - 1]; } - virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) + virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) wxOVERRIDE { wxCHECK_RET( day > 0 && day < 32, wxT("invalid day") ); @@ -137,24 +137,24 @@ public: m_attrs[day - 1] = attr; } - virtual void ResetAttr(size_t day) { SetAttr(day, NULL); } + virtual void ResetAttr(size_t day) wxOVERRIDE { SetAttr(day, NULL); } - virtual void SetHoliday(size_t day); + virtual void SetHoliday(size_t day) wxOVERRIDE; virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, wxDateTime *date = NULL, - wxDateTime::WeekDay *wd = NULL); + wxDateTime::WeekDay *wd = NULL) wxOVERRIDE; // implementation only from now on // ------------------------------- // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; - virtual void SetWindowStyleFlag(long style); + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } static wxVisualAttributes @@ -164,9 +164,9 @@ public: protected: // override some base class virtuals - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoGetSize(int *width, int *height) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; private: // common part of all ctors @@ -179,6 +179,7 @@ private: void OnPaint(wxPaintEvent& event); void OnClick(wxMouseEvent& event); void OnDClick(wxMouseEvent& event); + void OnWheel(wxMouseEvent& event); void OnChar(wxKeyEvent& event); void OnMonthChange(wxCommandEvent& event); @@ -247,8 +248,8 @@ public: wxControl *GetYearControl() const; private: - virtual void ResetHolidayAttrs(); - virtual void RefreshHolidays() { Refresh(); } + virtual void ResetHolidayAttrs() wxOVERRIDE; + virtual void RefreshHolidays() wxOVERRIDE { Refresh(); } // OnPaint helper-methods @@ -308,8 +309,8 @@ private: // the year control bool m_userChangedYear; - DECLARE_DYNAMIC_CLASS(wxGenericCalendarCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGenericCalendarCtrl); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGenericCalendarCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/generic/caret.h b/Externals/wxWidgets3/include/wx/generic/caret.h index 67041cf20d..de9117c656 100644 --- a/Externals/wxWidgets3/include/wx/generic/caret.h +++ b/Externals/wxWidgets3/include/wx/generic/caret.h @@ -25,7 +25,7 @@ class WXDLLIMPEXP_CORE wxCaretTimer : public wxTimer { public: wxCaretTimer(wxCaret *caret); - virtual void Notify(); + virtual void Notify() wxOVERRIDE; private: wxCaret *m_caret; @@ -50,17 +50,17 @@ public: // -------------- // called by wxWindow (not using the event tables) - virtual void OnSetFocus(); - virtual void OnKillFocus(); + virtual void OnSetFocus() wxOVERRIDE; + virtual void OnKillFocus() wxOVERRIDE; // called by wxCaretTimer void OnTimer(); protected: - virtual void DoShow(); - virtual void DoHide(); - virtual void DoMove(); - virtual void DoSize(); + virtual void DoShow() wxOVERRIDE; + virtual void DoHide() wxOVERRIDE; + virtual void DoMove() wxOVERRIDE; + virtual void DoSize() wxOVERRIDE; // blink the caret once void Blink(); diff --git a/Externals/wxWidgets3/include/wx/generic/choicdgg.h b/Externals/wxWidgets3/include/wx/generic/choicdgg.h index 2d92b44276..114d666230 100644 --- a/Externals/wxWidgets3/include/wx/generic/choicdgg.h +++ b/Externals/wxWidgets3/include/wx/generic/choicdgg.h @@ -23,13 +23,8 @@ class WXDLLIMPEXP_FWD_CORE wxListBoxBase; #define wxCHOICE_HEIGHT 150 #define wxCHOICE_WIDTH 200 -#ifdef __WXWINCE__ -#define wxCHOICEDLG_STYLE \ - (wxDEFAULT_DIALOG_STYLE | wxOK | wxCANCEL | wxCENTRE) -#else #define wxCHOICEDLG_STYLE \ (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) -#endif // ---------------------------------------------------------------------------- // wxAnyChoiceDialog: a base class for dialogs containing a listbox @@ -214,12 +209,7 @@ public: // implementation from now on void OnOK(wxCommandEvent& event); -#ifndef __SMARTPHONE__ void OnListBoxDClick(wxCommandEvent& event); -#endif -#ifdef __WXWINCE__ - void OnJoystickButtonDown(wxJoystickEvent& event); -#endif protected: int m_selection; @@ -228,8 +218,8 @@ protected: void DoChoice(); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog); + wxDECLARE_EVENT_TABLE(); }; // ---------------------------------------------------------------------------- @@ -279,19 +269,19 @@ public: wxArrayInt GetSelections() const { return m_selections; } // implementation from now on - virtual bool TransferDataFromWindow(); + virtual bool TransferDataFromWindow() wxOVERRIDE; protected: #if wxUSE_CHECKLISTBOX virtual wxListBoxBase *CreateList(int n, const wxString *choices, - long styleLbox); + long styleLbox) wxOVERRIDE; #endif // wxUSE_CHECKLISTBOX wxArrayInt m_selections; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMultiChoiceDialog); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/generic/clrpickerg.h b/Externals/wxWidgets3/include/wx/generic/clrpickerg.h index de32125e00..fd12c0e637 100644 --- a/Externals/wxWidgets3/include/wx/generic/clrpickerg.h +++ b/Externals/wxWidgets3/include/wx/generic/clrpickerg.h @@ -75,7 +75,7 @@ protected: static wxColourData ms_data; private: - DECLARE_DYNAMIC_CLASS(wxGenericColourButton) + wxDECLARE_DYNAMIC_CLASS(wxGenericColourButton); }; diff --git a/Externals/wxWidgets3/include/wx/generic/collheaderctrl.h b/Externals/wxWidgets3/include/wx/generic/collheaderctrl.h new file mode 100644 index 0000000000..b2dd3582c2 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/collheaderctrl.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/collheaderctrl.h +// Purpose: wxGenericCollapsibleHeaderCtrl +// Author: Tobias Taschner +// Created: 2015-09-19 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ +#define _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ + +class WXDLLIMPEXP_CORE wxGenericCollapsibleHeaderCtrl + : public wxCollapsibleHeaderCtrlBase +{ +public: + wxGenericCollapsibleHeaderCtrl() { Init(); } + + wxGenericCollapsibleHeaderCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCollapsibleHeaderCtrlNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxBORDER_NONE, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCollapsibleHeaderCtrlNameStr); + + virtual void SetCollapsed(bool collapsed = true) wxOVERRIDE; + + virtual bool IsCollapsed() const wxOVERRIDE + { return m_collapsed; } + +protected: + + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + bool m_collapsed; + bool m_inWindow; + bool m_mouseDown; + + void Init(); + + void OnPaint(wxPaintEvent& event); + + // Handle set/kill focus events (invalidate for painting focus rect) + void OnFocus(wxFocusEvent& event); + + // Handle click + void OnLeftUp(wxMouseEvent& event); + + // Handle pressed state + void OnLeftDown(wxMouseEvent& event); + + // Handle current state + void OnEnterWindow(wxMouseEvent& event); + + void OnLeaveWindow(wxMouseEvent& event); + + // Toggle on space + void OnChar(wxKeyEvent& event); + + void DoSetCollapsed(bool collapsed); + + wxDECLARE_NO_COPY_CLASS(wxGenericCollapsibleHeaderCtrl); +}; + + +#endif // _WX_GENERIC_COLLAPSIBLEHEADER_CTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/collpaneg.h b/Externals/wxWidgets3/include/wx/generic/collpaneg.h index ec0777115d..7b14cc1b0e 100644 --- a/Externals/wxWidgets3/include/wx/generic/collpaneg.h +++ b/Externals/wxWidgets3/include/wx/generic/collpaneg.h @@ -12,11 +12,8 @@ #define _WX_COLLAPSABLE_PANE_H_GENERIC_ // forward declared -class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCollapsibleHeaderCtrl; class WXDLLIMPEXP_FWD_CORE wxStaticLine; -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) -class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle; -#endif #include "wx/containr.h" @@ -56,17 +53,16 @@ public: const wxString& name = wxCollapsiblePaneNameStr); // public wxCollapsiblePane API - virtual void Collapse(bool collapse = true); - virtual void SetLabel(const wxString &label); + virtual void Collapse(bool collapse = true) wxOVERRIDE; + virtual void SetLabel(const wxString &label) wxOVERRIDE; - virtual bool IsCollapsed() const + virtual bool IsCollapsed() const wxOVERRIDE { return m_pPane==NULL || !m_pPane->IsShown(); } - virtual wxWindow *GetPane() const + virtual wxWindow *GetPane() const wxOVERRIDE { return m_pPane; } - virtual wxString GetLabel() const - { return m_strLabel; } + virtual wxString GetLabel() const wxOVERRIDE; - virtual bool Layout(); + virtual bool Layout() wxOVERRIDE; // for the generic collapsible pane only: @@ -78,24 +74,16 @@ public: protected: // overridden methods - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; - wxString GetBtnLabel() const; int GetBorder() const; // child controls -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - wxDisclosureTriangle *m_pButton; -#else - wxButton *m_pButton; -#endif + wxCollapsibleHeaderCtrl *m_pButton; wxStaticLine *m_pStaticLine; wxWindow *m_pPane; wxSizer *m_sz; - // the button label without ">>" or "<<" - wxString m_strLabel; - private: void Init(); @@ -103,8 +91,8 @@ private: void OnButton(wxCommandEvent &ev); void OnSize(wxSizeEvent &ev); - DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ diff --git a/Externals/wxWidgets3/include/wx/generic/colour.h b/Externals/wxWidgets3/include/wx/generic/colour.h index 5db020cacd..8ef0ccb7c6 100644 --- a/Externals/wxWidgets3/include/wx/generic/colour.h +++ b/Externals/wxWidgets3/include/wx/generic/colour.h @@ -65,7 +65,7 @@ private: unsigned char m_alpha; private: - DECLARE_DYNAMIC_CLASS(wxColour) + wxDECLARE_DYNAMIC_CLASS(wxColour); }; #endif // _WX_GENERIC_COLOUR_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/colrdlgg.h b/Externals/wxWidgets3/include/wx/generic/colrdlgg.h index a83abd8ce3..10657529ed 100644 --- a/Externals/wxWidgets3/include/wx/generic/colrdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/colrdlgg.h @@ -14,18 +14,21 @@ #include "wx/gdicmn.h" #include "wx/dialog.h" -#define wxID_ADD_CUSTOM 3000 - #if wxUSE_SLIDER - - #define wxID_RED_SLIDER 3001 - #define wxID_GREEN_SLIDER 3002 - #define wxID_BLUE_SLIDER 3003 - class WXDLLIMPEXP_FWD_CORE wxSlider; - #endif // wxUSE_SLIDER +// Preview with opacity is possible only if wxGCDC and wxStaticBitmap are +// available and currently it only works in wxOSX and wxMSW as it uses wxBitmap +// UseAlpha() and HasAlpha() methods which only these ports provide. +#define wxCLRDLGG_USE_PREVIEW_WITH_ALPHA \ + ((wxUSE_GRAPHICS_CONTEXT && wxUSE_STATBMP) && \ + (defined(__WXMSW__) || defined(__WXOSX__))) + +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +class wxStaticBitmap; +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog { public: @@ -38,18 +41,23 @@ public: wxColourData &GetColourData() { return m_colourData; } - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; // Internal functions void OnMouseEvent(wxMouseEvent& event); void OnPaint(wxPaintEvent& event); +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + void OnCustomColourMouseClick(wxMouseEvent& event); +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA virtual void CalculateMeasurements(); virtual void CreateWidgets(); virtual void InitializeColours(); virtual void PaintBasicColours(wxDC& dc); - virtual void PaintCustomColours(wxDC& dc); +#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + virtual void PaintCustomColours(wxDC& dc, int clrIndex = -1); +#endif // !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA virtual void PaintCustomColour(wxDC& dc); virtual void PaintHighlight(wxDC& dc, bool draw); @@ -62,10 +70,15 @@ public: void OnRedSlider(wxCommandEvent& event); void OnGreenSlider(wxCommandEvent& event); void OnBlueSlider(wxCommandEvent& event); + void OnAlphaSlider(wxCommandEvent& event); #endif // wxUSE_SLIDER void OnCloseWindow(wxCloseEvent& event); +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + void DoPreviewBitmap(wxBitmap& bmp, const wxColour& colour); +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + protected: wxColourData m_colourData; @@ -75,10 +88,7 @@ protected: wxRect m_singleCustomColourRect; // Size of each colour rectangle - wxPoint m_smallRectangleSize; - - // For single customizable colour - wxPoint m_customRectangleSize; + wxSize m_smallRectangleSize; // Grid spacing (between rectangles) int m_gridSpacing; @@ -100,7 +110,14 @@ protected: wxSlider *m_redSlider; wxSlider *m_greenSlider; wxSlider *m_blueSlider; + wxSlider *m_alphaSlider; #endif // wxUSE_SLIDER +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + // Bitmap to preview selected colour (with alpha channel) + wxStaticBitmap *m_customColourBmp; + // Bitmaps to preview custom colours (with alpha channel) + wxStaticBitmap *m_customColoursBmp[16]; +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA int m_buttonY; @@ -109,8 +126,8 @@ protected: // static bool colourDialogCancelled; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericColourDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericColourDialog); }; #endif // _WX_COLORDLGG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/combo.h b/Externals/wxWidgets3/include/wx/generic/combo.h index f271563ae2..92b3ff624e 100644 --- a/Externals/wxWidgets3/include/wx/generic/combo.h +++ b/Externals/wxWidgets3/include/wx/generic/combo.h @@ -68,7 +68,7 @@ public: void SetCustomPaintWidth( int width ); - virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; + virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const wxOVERRIDE; static int GetFeatures() { return wxComboCtrlFeatures::All; } @@ -88,17 +88,15 @@ protected: virtual WXWidget GetTextWidget() const { return NULL; } #elif defined(__WXGTK__) #if defined(__WXGTK20__) - virtual GtkEditable *GetEditable() const { return NULL; } - virtual GtkEntry *GetEntry() const { return NULL; } + virtual GtkEditable *GetEditable() const wxOVERRIDE { return NULL; } + virtual GtkEntry *GetEntry() const wxOVERRIDE { return NULL; } #endif #elif defined(__WXMAC__) // Looks like there's nothing we need to override here -#elif defined(__WXPM__) - virtual WXHWND GetEditHWND() const { return NULL; } #endif // For better transparent background rendering - virtual bool HasTransparentBackground() + virtual bool HasTransparentBackground() wxOVERRIDE { #if wxALWAYS_NATIVE_DOUBLE_BUFFER #ifdef __WXGTK__ @@ -113,7 +111,7 @@ protected: } // Mandatory virtuals - virtual void OnResize(); + virtual void OnResize() wxOVERRIDE; // Event handlers void OnPaintEvent( wxPaintEvent& event ); @@ -122,9 +120,9 @@ protected: private: void Init(); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl) + wxDECLARE_DYNAMIC_CLASS(wxGenericComboCtrl); }; @@ -156,7 +154,7 @@ public: protected: private: - DECLARE_DYNAMIC_CLASS(wxComboCtrl) + wxDECLARE_DYNAMIC_CLASS(wxComboCtrl); }; #endif // _WX_COMBOCONTROL_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/custombgwin.h b/Externals/wxWidgets3/include/wx/generic/custombgwin.h index 8004195498..d274313069 100644 --- a/Externals/wxWidgets3/include/wx/generic/custombgwin.h +++ b/Externals/wxWidgets3/include/wx/generic/custombgwin.h @@ -11,6 +11,9 @@ #define _WX_GENERIC_CUSTOMBGWIN_H_ #include "wx/bitmap.h" +#include "wx/dc.h" +#include "wx/event.h" +#include "wx/window.h" // A helper to avoid template bloat: this class contains all type-independent // code of wxCustomBackgroundWindow<> below. diff --git a/Externals/wxWidgets3/include/wx/generic/dataview.h b/Externals/wxWidgets3/include/wx/generic/dataview.h index f3ac8ee598..c4ec501229 100644 --- a/Externals/wxWidgets3/include/wx/generic/dataview.h +++ b/Externals/wxWidgets3/include/wx/generic/dataview.h @@ -155,6 +155,7 @@ public: virtual int GetColumnPosition( const wxDataViewColumn *column ) const; virtual wxDataViewColumn *GetSortingColumn() const; + virtual wxVector GetSortingColumns() const; virtual int GetSelectedItemsCount() const; virtual int GetSelections( wxDataViewItemArray & sel ) const; @@ -183,6 +184,10 @@ public: virtual bool SetFont(const wxFont & font); + virtual bool AllowMultiColumnSort(bool allow); + virtual bool IsMultiColumnSortAllowed() { return m_allowMultiColumnSort; } + virtual void ToggleSortByColumn(int column); + #if wxUSE_DRAG_AND_DROP virtual bool EnableDragSource( const wxDataFormat &format ); virtual bool EnableDropTarget( const wxDataFormat &format ); @@ -205,8 +210,17 @@ protected: virtual wxDataViewItem GetItemByRow( unsigned int row ) const; virtual int GetRowByItem( const wxDataViewItem & item ) const; - int GetSortingColumnIndex() const { return m_sortingColumnIdx; } - void SetSortingColumnIndex(int idx) { m_sortingColumnIdx = idx; } + // Mark the column as being used or not for sorting. + void UseColumnForSorting(int idx); + void DontUseColumnForSorting(int idx); + + // Return true if the given column is sorted + bool IsColumnSorted(int idx) const; + + // Reset all columns currently used for sorting. + void ResetAllSortColumns(); + + virtual void DoEnableSystemTheme(bool enable, wxWindow* window) wxOVERRIDE; public: // utility functions not part of the API @@ -267,8 +281,11 @@ private: // 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; + // columns indices used for sorting, empty if nothing is sorted + wxVector m_sortingColumnIdxs; + + // if true, allow sorting by more than one column + bool m_allowMultiColumnSort; private: void OnSize( wxSizeEvent &event ); @@ -283,9 +300,9 @@ private: WX_FORWARD_TO_SCROLL_HELPER() private: - DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; diff --git a/Externals/wxWidgets3/include/wx/generic/datectrl.h b/Externals/wxWidgets3/include/wx/generic/datectrl.h index 47e656634b..61a4ad18c9 100644 --- a/Externals/wxWidgets3/include/wx/generic/datectrl.h +++ b/Externals/wxWidgets3/include/wx/generic/datectrl.h @@ -49,11 +49,11 @@ public: const wxString& name = wxDatePickerCtrlNameStr); // wxDatePickerCtrl methods - void SetValue(const wxDateTime& date); - wxDateTime GetValue() const; + void SetValue(const wxDateTime& date) wxOVERRIDE; + wxDateTime GetValue() const wxOVERRIDE; - bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const; - void SetRange(const wxDateTime &dt1, const wxDateTime &dt2); + bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const wxOVERRIDE; + void SetRange(const wxDateTime &dt1, const wxDateTime &dt2) wxOVERRIDE; bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, const wxDateTime& upperdate = wxDefaultDateTime); @@ -66,29 +66,29 @@ public: // ------------------------------- // overridden base class methods - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: void Init(); // return the list of the windows composing this one - virtual wxWindowList GetCompositeWindowParts() const; + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; void OnText(wxCommandEvent &event); void OnSize(wxSizeEvent& event); void OnFocus(wxFocusEvent& event); #ifdef __WXOSX_COCOA__ - virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) { } + virtual void OSXGenerateEvent(const wxDateTime& WXUNUSED(dt)) wxOVERRIDE { } #endif wxComboCtrl* m_combo; wxCalendarComboPopup* m_popup; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxDatePickerCtrlGeneric); }; diff --git a/Externals/wxWidgets3/include/wx/generic/dcpsg.h b/Externals/wxWidgets3/include/wx/generic/dcpsg.h index ea423475d5..5eb3463ee2 100644 --- a/Externals/wxWidgets3/include/wx/generic/dcpsg.h +++ b/Externals/wxWidgets3/include/wx/generic/dcpsg.h @@ -35,7 +35,7 @@ public: wxPostScriptDC(const wxPrintData& printData); private: - DECLARE_DYNAMIC_CLASS(wxPostScriptDC) + wxDECLARE_DYNAMIC_CLASS(wxPostScriptDC); }; class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl @@ -51,91 +51,91 @@ public: virtual ~wxPostScriptDCImpl(); virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; + virtual bool IsOk() const wxOVERRIDE; - bool CanDrawBitmap() const { return true; } + bool CanDrawBitmap() const wxOVERRIDE { return true; } - void Clear(); - void SetFont( const wxFont& font ); - void SetPen( const wxPen& pen ); - void SetBrush( const wxBrush& brush ); - void SetLogicalFunction( wxRasterOperationMode function ); - void SetBackground( const wxBrush& brush ); + void Clear() wxOVERRIDE; + void SetFont( const wxFont& font ) wxOVERRIDE; + void SetPen( const wxPen& pen ) wxOVERRIDE; + void SetBrush( const wxBrush& brush ) wxOVERRIDE; + void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + void SetBackground( const wxBrush& brush ) wxOVERRIDE; - void DestroyClippingRegion(); + void DestroyClippingRegion() wxOVERRIDE; - bool StartDoc(const wxString& message); - void EndDoc(); - void StartPage(); - void EndPage(); + bool StartDoc(const wxString& message) wxOVERRIDE; + void EndDoc() wxOVERRIDE; + void StartPage() wxOVERRIDE; + void EndPage() wxOVERRIDE; - wxCoord GetCharHeight() const; - wxCoord GetCharWidth() const; - bool CanGetTextExtent() const { return true; } + wxCoord GetCharHeight() const wxOVERRIDE; + wxCoord GetCharWidth() const wxOVERRIDE; + bool CanGetTextExtent() const wxOVERRIDE { return true; } // Resolution in pixels per logical inch - wxSize GetPPI() const; + wxSize GetPPI() const wxOVERRIDE; - virtual void ComputeScaleAndOrigin(); + virtual void ComputeScaleAndOrigin() wxOVERRIDE; - void SetBackgroundMode(int WXUNUSED(mode)) { } - void SetPalette(const wxPalette& WXUNUSED(palette)) { } + void SetBackgroundMode(int WXUNUSED(mode)) wxOVERRIDE { } + void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } void SetPrintData(const wxPrintData& data); wxPrintData& GetPrintData() { return m_printData; } - virtual int GetDepth() const { return 24; } + virtual int GetDepth() const wxOVERRIDE { return 24; } void PsPrint( const wxString& psdata ); // Overrridden for wxPrinterDC Impl - virtual int GetResolution() const; - virtual wxRect GetPaperRect() const; + virtual int GetResolution() const wxOVERRIDE; + virtual wxRect GetPaperRect() const wxOVERRIDE; - virtual void* GetHandle() const { return NULL; } + virtual void* GetHandle() const wxOVERRIDE { return NULL; } protected: bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, - wxFloodFillStyle style = wxFLOOD_SURFACE); - bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; - void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - void DoCrossHair(wxCoord x, wxCoord y) ; - void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); - void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); - void DoDrawPoint(wxCoord x, wxCoord y); - void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); + wxFloodFillStyle style = wxFLOOD_SURFACE) wxOVERRIDE; + bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const wxOVERRIDE; + void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE ; + void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) wxOVERRIDE; + void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) wxOVERRIDE; + void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) wxOVERRIDE; void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); - void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20); - void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20) wxOVERRIDE; + void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; #if wxUSE_SPLINES - void DoDrawSpline(const wxPointList *points); + void DoDrawSpline(const wxPointList *points) wxOVERRIDE; #endif bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); - void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false); - void DoDrawText(const wxString& text, wxCoord x, wxCoord y); - void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); - void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip)) + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false) wxOVERRIDE; + void DoDrawText(const wxString& text, wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) wxOVERRIDE; + void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip)) wxOVERRIDE { wxFAIL_MSG( "not implemented" ); } void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; - void DoGetSize(int* width, int* height) const; - void DoGetSizeMM(int *width, int *height) const; + const wxFont *theFont = NULL) const wxOVERRIDE; + void DoGetSize(int* width, int* height) const wxOVERRIDE; + void DoGetSizeMM(int *width, int *height) const wxOVERRIDE; FILE* m_pstream; // PostScript output stream unsigned char m_currentRed; @@ -149,7 +149,7 @@ protected: double m_pageHeight; private: - DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl) + wxDECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl); }; #endif diff --git a/Externals/wxWidgets3/include/wx/generic/dirctrlg.h b/Externals/wxWidgets3/include/wx/generic/dirctrlg.h index bdaa3df33b..6037c77fce 100644 --- a/Externals/wxWidgets3/include/wx/generic/dirctrlg.h +++ b/Externals/wxWidgets3/include/wx/generic/dirctrlg.h @@ -45,7 +45,9 @@ enum // Editable labels wxDIRCTRL_EDIT_LABELS = 0x0100, // Allow multiple selection - wxDIRCTRL_MULTIPLE = 0x0200 + wxDIRCTRL_MULTIPLE = 0x0200, + + wxDIRCTRL_DEFAULT_STYLE = wxDIRCTRL_3D_INTERNAL }; //----------------------------------------------------------------------------- @@ -78,11 +80,11 @@ class WXDLLIMPEXP_CORE wxGenericDirCtrl: public wxControl { public: wxGenericDirCtrl(); - wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = wxID_ANY, + wxGenericDirCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL, + long style = wxDIRCTRL_DEFAULT_STYLE, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr ) @@ -91,11 +93,11 @@ public: Create(parent, id, dir, pos, size, style, filter, defaultFilter, name); } - bool Create(wxWindow *parent, const wxWindowID id = wxID_ANY, + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxString &dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDIRCTRL_3D_INTERNAL, + long style = wxDIRCTRL_DEFAULT_STYLE, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr ); @@ -172,7 +174,7 @@ public: virtual void CollapseTree(); // overridden base class methods - virtual void SetFocus(); + virtual void SetFocus() wxOVERRIDE; protected: virtual void ExpandRoot(); @@ -204,8 +206,8 @@ private: wxDirFilterListCtrl* m_filterListCtrl; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericDirCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericDirCtrl); wxDECLARE_NO_COPY_CLASS(wxGenericDirCtrl); }; @@ -226,7 +228,7 @@ class WXDLLIMPEXP_CORE wxDirFilterListCtrl: public wxChoice { public: wxDirFilterListCtrl() { Init(); } - wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + wxDirFilterListCtrl(wxGenericDirCtrl* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0) @@ -235,7 +237,7 @@ public: Create(parent, id, pos, size, style); } - bool Create(wxGenericDirCtrl* parent, const wxWindowID id = wxID_ANY, + bool Create(wxGenericDirCtrl* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); @@ -253,12 +255,12 @@ public: protected: wxGenericDirCtrl* m_dirCtrl; - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxDirFilterListCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxDirFilterListCtrl); wxDECLARE_NO_COPY_CLASS(wxDirFilterListCtrl); }; -#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) +#if !defined(__WXMSW__) && !defined(__WXMAC__) #define wxDirCtrl wxGenericDirCtrl #endif @@ -298,11 +300,17 @@ public: int GetIconID(const wxString& extension, const wxString& mime = wxEmptyString); wxImageList *GetSmallImageList(); + const wxSize& GetSize() const { return m_size; } + void SetSize(const wxSize& sz) { m_size = sz; } + + bool IsOk() const { return m_smallImageList != NULL; } + protected: - void Create(); // create on first use + void Create(const wxSize& sz); // create on first use wxImageList *m_smallImageList; wxHashTable *m_HashTable; + wxSize m_size; }; // The global fileicons table diff --git a/Externals/wxWidgets3/include/wx/generic/dirdlgg.h b/Externals/wxWidgets3/include/wx/generic/dirdlgg.h index cc8b5a874b..85038afe23 100644 --- a/Externals/wxWidgets3/include/wx/generic/dirdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/dirdlgg.h @@ -23,11 +23,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[]; #ifndef wxDD_DEFAULT_STYLE -#ifdef __WXWINCE__ - #define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE -#else - #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) -#endif +#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) #endif #include "wx/dialog.h" @@ -58,12 +54,12 @@ public: const wxString& name = wxDirDialogNameStr); //// Accessors - void SetPath(const wxString& path); - wxString GetPath() const; + void SetPath(const wxString& path) wxOVERRIDE; + wxString GetPath() const wxOVERRIDE; //// Overrides - virtual int ShowModal(); - virtual void EndModal(int retCode); + virtual int ShowModal() wxOVERRIDE; + virtual void EndModal(int retCode) wxOVERRIDE; // this one is specific to wxGenericDirDialog wxTextCtrl* GetInputCtrl() const { return m_input; } @@ -81,8 +77,8 @@ protected: wxGenericDirCtrl* m_dirCtrl; wxTextCtrl* m_input; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericDirDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericDirDialog); }; #endif // _WX_DIRDLGG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/dragimgg.h b/Externals/wxWidgets3/include/wx/generic/dragimgg.h index 9c90e163f2..71ffd8aef9 100644 --- a/Externals/wxWidgets3/include/wx/generic/dragimgg.h +++ b/Externals/wxWidgets3/include/wx/generic/dragimgg.h @@ -121,18 +121,6 @@ public: Create(str, cursor); } -#if WXWIN_COMPATIBILITY_2_6 - // don't use in new code, use versions without hot spot parameter - wxDEPRECATED( wxGenericDragImage(const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) ); - wxDEPRECATED( bool Create(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_6 - #if wxUSE_TREECTRL wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { @@ -263,7 +251,7 @@ protected: bool m_fullScreen; private: - DECLARE_DYNAMIC_CLASS(wxGenericDragImage) + wxDECLARE_DYNAMIC_CLASS(wxGenericDragImage); wxDECLARE_NO_COPY_CLASS(wxGenericDragImage); }; diff --git a/Externals/wxWidgets3/include/wx/generic/dvrenderer.h b/Externals/wxWidgets3/include/wx/generic/dvrenderer.h index 75889a8108..251dc81297 100644 --- a/Externals/wxWidgets3/include/wx/generic/dvrenderer.h +++ b/Externals/wxWidgets3/include/wx/generic/dvrenderer.h @@ -60,7 +60,7 @@ private: wxDC *m_dc; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); }; #endif // _WX_GENERIC_DVRENDERER_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/dvrenderers.h b/Externals/wxWidgets3/include/wx/generic/dvrenderers.h index 6f80c773a5..a56beaf034 100644 --- a/Externals/wxWidgets3/include/wx/generic/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/generic/dvrenderers.h @@ -18,7 +18,9 @@ class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer { public: - wxDataViewCustomRenderer( const wxString &varianttype = wxT("string"), + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); @@ -35,7 +37,7 @@ public: } private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); }; @@ -46,12 +48,14 @@ private: class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer { public: - wxDataViewTextRenderer( const wxString &varianttype = wxT("string"), + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + 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; @@ -66,7 +70,7 @@ protected: wxString m_text; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); }; // --------------------------------------------------------- @@ -76,22 +80,24 @@ protected: class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer { public: - wxDataViewBitmapRenderer( const wxString &varianttype = wxT("wxBitmap"), + static wxString GetDefaultType() { return wxS("wxBitmap"); } + + wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + virtual bool SetValue( const wxVariant &value ); + virtual bool GetValue( wxVariant &value ) const; - bool Render( wxRect cell, wxDC *dc, int state ); - wxSize GetSize() const; + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; private: wxIcon m_icon; wxBitmap m_bitmap; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); }; // --------------------------------------------------------- @@ -101,15 +107,17 @@ protected: class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer { public: - wxDataViewToggleRenderer( const wxString &varianttype = wxT("bool"), + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + virtual bool SetValue( const wxVariant &value ); + virtual bool GetValue( wxVariant &value ) const; - bool Render( wxRect cell, wxDC *dc, int state ); - wxSize GetSize() const; + virtual bool Render( wxRect cell, wxDC *dc, int state ); + virtual wxSize GetSize() const; // Implementation only, don't use nor override virtual bool WXActivateCell(const wxRect& cell, @@ -121,7 +129,7 @@ private: bool m_toggle; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); }; // --------------------------------------------------------- @@ -131,13 +139,15 @@ protected: class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer { public: + static wxString GetDefaultType() { return wxS("long"); } + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, - const wxString &varianttype = wxT("long"), + const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant& value ) const; + 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; @@ -147,7 +157,7 @@ private: int m_value; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); }; // --------------------------------------------------------- @@ -157,12 +167,14 @@ protected: class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer { public: - wxDataViewIconTextRenderer( const wxString &varianttype = wxT("wxDataViewIconText"), + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + 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; @@ -176,7 +188,7 @@ private: wxDataViewIconText m_value; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); }; #endif // _WX_GENERIC_DVRENDERERS_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/fdrepdlg.h b/Externals/wxWidgets3/include/wx/generic/fdrepdlg.h index d1ad8d1b88..052193c9e2 100644 --- a/Externals/wxWidgets3/include/wx/generic/fdrepdlg.h +++ b/Externals/wxWidgets3/include/wx/generic/fdrepdlg.h @@ -62,9 +62,9 @@ protected: *m_textRepl; private: - DECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog) + wxDECLARE_DYNAMIC_CLASS(wxGenericFindReplaceDialog); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GENERIC_FDREPDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/filectrlg.h b/Externals/wxWidgets3/include/wx/generic/filectrlg.h index ba26118d7f..d460fd3e99 100644 --- a/Externals/wxWidgets3/include/wx/generic/filectrlg.h +++ b/Externals/wxWidgets3/include/wx/generic/filectrlg.h @@ -177,8 +177,8 @@ protected: wxFileData::fileListFieldType m_sort_field; private: - DECLARE_DYNAMIC_CLASS(wxFileListCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxFileListCtrl); + wxDECLARE_EVENT_TABLE(); }; class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxNavigationEnabled, @@ -217,32 +217,32 @@ public: const wxSize& size = wxDefaultSize, const wxString& name = wxFileCtrlNameStr ); - virtual void SetWildcard( const wxString& wildCard ); - virtual void SetFilterIndex( int filterindex ); - virtual bool SetDirectory( const wxString& dir ); + virtual void SetWildcard( const wxString& wildCard ) wxOVERRIDE; + virtual void SetFilterIndex( int filterindex ) wxOVERRIDE; + virtual bool SetDirectory( const wxString& dir ) wxOVERRIDE; // Selects a certain file. // In case the filename specified isn't found/couldn't be shown with // currently selected filter, false is returned and nothing happens - virtual bool SetFilename( const wxString& name ); + virtual bool SetFilename( const wxString& name ) wxOVERRIDE; // Changes to a certain directory and selects a certain file. // In case the filename specified isn't found/couldn't be shown with // currently selected filter, false is returned and if directory exists // it's chdir'ed to - virtual bool SetPath( const wxString& path ); + virtual bool SetPath( const wxString& path ) wxOVERRIDE; - virtual wxString GetFilename() const; - virtual wxString GetDirectory() const; - virtual wxString GetWildcard() const { return this->m_wildCard; } - virtual wxString GetPath() const; - virtual void GetPaths( wxArrayString& paths ) const; - virtual void GetFilenames( wxArrayString& files ) const; - virtual int GetFilterIndex() const { return m_filterIndex; } + virtual wxString GetFilename() const wxOVERRIDE; + virtual wxString GetDirectory() const wxOVERRIDE; + virtual wxString GetWildcard() const wxOVERRIDE { return this->m_wildCard; } + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths( wxArrayString& paths ) const wxOVERRIDE; + virtual void GetFilenames( wxArrayString& files ) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE { return m_filterIndex; } - virtual bool HasMultipleFileSelection() const + virtual bool HasMultipleFileSelection() const wxOVERRIDE { return HasFlag(wxFC_MULTIPLE); } - virtual void ShowHidden(bool show) { m_list->ShowHidden( show ); } + virtual void ShowHidden(bool show) wxOVERRIDE { m_list->ShowHidden( show ); } void GoToParentDir(); void GoToHomeDir(); @@ -294,8 +294,8 @@ private: bool m_ignoreChanges; bool m_noSelChgEvent; // suppress selection changed events. - DECLARE_DYNAMIC_CLASS( wxGenericFileCtrl ) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGenericFileCtrl); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_FILECTRL diff --git a/Externals/wxWidgets3/include/wx/generic/filedlgg.h b/Externals/wxWidgets3/include/wx/generic/filedlgg.h index 7d14e523fb..6c00f2020f 100644 --- a/Externals/wxWidgets3/include/wx/generic/filedlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/filedlgg.h @@ -60,39 +60,39 @@ public: virtual ~wxGenericFileDialog(); - virtual void SetDirectory(const wxString& dir) + virtual void SetDirectory(const wxString& dir) wxOVERRIDE { m_filectrl->SetDirectory(dir); } - virtual void SetFilename(const wxString& name) + virtual void SetFilename(const wxString& name) wxOVERRIDE { m_filectrl->SetFilename(name); } - virtual void SetMessage(const wxString& message) { SetTitle(message); } - virtual void SetPath(const wxString& path) + virtual void SetMessage(const wxString& message) wxOVERRIDE { SetTitle(message); } + virtual void SetPath(const wxString& path) wxOVERRIDE { m_filectrl->SetPath(path); } - virtual void SetFilterIndex(int filterIndex) + virtual void SetFilterIndex(int filterIndex) wxOVERRIDE { m_filectrl->SetFilterIndex(filterIndex); } - virtual void SetWildcard(const wxString& wildCard) + virtual void SetWildcard(const wxString& wildCard) wxOVERRIDE { m_filectrl->SetWildcard(wildCard); } - virtual wxString GetPath() const + virtual wxString GetPath() const wxOVERRIDE { return m_filectrl->GetPath(); } - virtual void GetPaths(wxArrayString& paths) const + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE { m_filectrl->GetPaths(paths); } - virtual wxString GetDirectory() const + virtual wxString GetDirectory() const wxOVERRIDE { return m_filectrl->GetDirectory(); } - virtual wxString GetFilename() const + virtual wxString GetFilename() const wxOVERRIDE { return m_filectrl->GetFilename(); } - virtual void GetFilenames(wxArrayString& files) const + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE { m_filectrl->GetFilenames(files); } - virtual wxString GetWildcard() const + virtual wxString GetWildcard() const wxOVERRIDE { return m_filectrl->GetWildcard(); } - virtual int GetFilterIndex() const + virtual int GetFilterIndex() const wxOVERRIDE { return m_filectrl->GetFilterIndex(); } - virtual bool SupportsExtraControl() const { return true; } + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } // implementation only from now on // ------------------------------- - virtual int ShowModal(); - virtual bool Show( bool show = true ); + virtual int ShowModal() wxOVERRIDE; + virtual bool Show( bool show = true ) wxOVERRIDE; void OnList( wxCommandEvent &event ); void OnReport( wxCommandEvent &event ); @@ -121,8 +121,8 @@ private: wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId, const wxString& tip, wxSizer *sizer ); - DECLARE_DYNAMIC_CLASS(wxGenericFileDialog) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGenericFileDialog); + wxDECLARE_EVENT_TABLE(); // these variables are preserved between wxGenericFileDialog calls static long ms_lastViewStyle; // list or report? @@ -148,11 +148,11 @@ public: defaultDir, defaultFile, wildCard, style, pos, size) - { - } + { + } private: - DECLARE_DYNAMIC_CLASS(wxFileDialog) + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); }; #endif // wxHAS_GENERIC_FILEDIALOG diff --git a/Externals/wxWidgets3/include/wx/generic/filepickerg.h b/Externals/wxWidgets3/include/wx/generic/filepickerg.h index d88daa556a..cf4782f8d7 100644 --- a/Externals/wxWidgets3/include/wx/generic/filepickerg.h +++ b/Externals/wxWidgets3/include/wx/generic/filepickerg.h @@ -46,7 +46,7 @@ public: pos, size, style, validator, name); } - virtual wxControl *AsControl() { return this; } + virtual wxControl *AsControl() wxOVERRIDE { return this; } public: // overridable @@ -57,7 +57,7 @@ public: // overridable virtual wxEventType GetEventType() const = 0; - virtual void SetInitialDirectory(const wxString& dir); + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; public: @@ -144,19 +144,19 @@ public: // overridable return filedlgstyle; } - virtual wxDialog *CreateDialog(); + virtual wxDialog *CreateDialog() wxOVERRIDE; - wxEventType GetEventType() const + wxEventType GetEventType() const wxOVERRIDE { return wxEVT_FILEPICKER_CHANGED; } protected: - void UpdateDialogPath(wxDialog *p) + void UpdateDialogPath(wxDialog *p) wxOVERRIDE { wxStaticCast(p, wxFileDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) + void UpdatePathFromDialog(wxDialog *p) wxOVERRIDE { m_path = wxStaticCast(p, wxFileDialog)->GetPath(); } private: - DECLARE_DYNAMIC_CLASS(wxGenericFileButton) + wxDECLARE_DYNAMIC_CLASS(wxGenericFileButton); }; @@ -199,19 +199,19 @@ public: // overridable return dirdlgstyle; } - virtual wxDialog *CreateDialog(); + virtual wxDialog *CreateDialog() wxOVERRIDE; - wxEventType GetEventType() const + wxEventType GetEventType() const wxOVERRIDE { return wxEVT_DIRPICKER_CHANGED; } protected: - void UpdateDialogPath(wxDialog *p) + void UpdateDialogPath(wxDialog *p) wxOVERRIDE { wxStaticCast(p, wxDirDialog)->SetPath(m_path); } - void UpdatePathFromDialog(wxDialog *p) + void UpdatePathFromDialog(wxDialog *p) wxOVERRIDE { m_path = wxStaticCast(p, wxDirDialog)->GetPath(); } private: - DECLARE_DYNAMIC_CLASS(wxGenericDirButton) + wxDECLARE_DYNAMIC_CLASS(wxGenericDirButton); }; // old wxEVT_COMMAND_* constants diff --git a/Externals/wxWidgets3/include/wx/generic/fontdlgg.h b/Externals/wxWidgets3/include/wx/generic/fontdlgg.h index a16fa6e2e8..4d01c899e4 100644 --- a/Externals/wxWidgets3/include/wx/generic/fontdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/fontdlgg.h @@ -14,12 +14,7 @@ #include "wx/gdicmn.h" #include "wx/font.h" -#ifdef __WXWINCE__ -#define USE_SPINCTRL_FOR_POINT_SIZE 1 -class WXDLLIMPEXP_FWD_CORE wxSpinEvent; -#else #define USE_SPINCTRL_FOR_POINT_SIZE 0 -#endif /* * FONT DIALOG @@ -50,12 +45,7 @@ public: : wxFontDialogBase(parent, data) { Init(); } virtual ~wxGenericFontDialog(); - virtual int ShowModal(); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for backwards compatibility only - wxDEPRECATED( wxGenericFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 + virtual int ShowModal() wxOVERRIDE; // Internal functions void OnCloseWindow(wxCloseEvent& event); @@ -71,7 +61,7 @@ public: protected: - virtual bool DoCreate(wxWindow *parent); + virtual bool DoCreate(wxWindow *parent) wxOVERRIDE; private: @@ -96,14 +86,8 @@ private: bool m_useEvents; // static bool fontDialogCancelled; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericFontDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericFontDialog); }; -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for backwards compatibility only -inline wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, const wxFontData *data) - :wxFontDialogBase(parent) { Init(); InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - #endif // _WX_GENERIC_FONTDLGG_H diff --git a/Externals/wxWidgets3/include/wx/generic/fontpickerg.h b/Externals/wxWidgets3/include/wx/generic/fontpickerg.h index 8090450038..ea2180ed35 100644 --- a/Externals/wxWidgets3/include/wx/generic/fontpickerg.h +++ b/Externals/wxWidgets3/include/wx/generic/fontpickerg.h @@ -35,6 +35,12 @@ public: Create(parent, id, initial, pos, size, style, validator, name); } + virtual wxColour GetSelectedColour() const + { return m_data.GetColour(); } + + virtual void SetSelectedColour(const wxColour &colour) + { m_data.SetColour(colour); UpdateFont(); } + virtual ~wxGenericFontButton() {} @@ -68,7 +74,7 @@ protected: wxFontData m_data; private: - DECLARE_DYNAMIC_CLASS(wxGenericFontButton) + wxDECLARE_DYNAMIC_CLASS(wxGenericFontButton); }; diff --git a/Externals/wxWidgets3/include/wx/generic/grid.h b/Externals/wxWidgets3/include/wx/generic/grid.h index c58cec3742..c1adbb0b24 100644 --- a/Externals/wxWidgets3/include/wx/generic/grid.h +++ b/Externals/wxWidgets3/include/wx/generic/grid.h @@ -174,6 +174,30 @@ public: wxDC& dc, int row, int col) = 0; + // Get the preferred height for a given width. Override this method if the + // renderer computes height as function of its width, as is the case of the + // standard wxGridCellAutoWrapStringRenderer, for example. + // and vice versa + virtual int GetBestHeight(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int WXUNUSED(width)) + { + return GetBestSize(grid, attr, dc, row, col).GetHeight(); + } + + // Get the preferred width for a given height, this is the symmetric + // version of GetBestHeight(). + virtual int GetBestWidth(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int WXUNUSED(height)) + { + return GetBestSize(grid, attr, dc, row, col).GetWidth(); + } + // create a new object which is the copy of this one virtual wxGridCellRenderer *Clone() const = 0; }; @@ -355,7 +379,7 @@ class WXDLLIMPEXP_ADV wxGridRowHeaderRendererDefault public: virtual void DrawBorder(const wxGrid& grid, wxDC& dc, - wxRect& rect) const; + wxRect& rect) const wxOVERRIDE; }; // Column header cells renderers @@ -365,7 +389,7 @@ class WXDLLIMPEXP_ADV wxGridColumnHeaderRendererDefault public: virtual void DrawBorder(const wxGrid& grid, wxDC& dc, - wxRect& rect) const; + wxRect& rect) const wxOVERRIDE; }; // Header corner renderer @@ -375,7 +399,7 @@ class WXDLLIMPEXP_ADV wxGridCornerHeaderRendererDefault public: virtual void DrawBorder(const wxGrid& grid, wxDC& dc, - wxRect& rect) const; + wxRect& rect) const wxOVERRIDE; }; @@ -752,7 +776,7 @@ private: wxGrid * m_view; wxGridCellAttrProvider *m_attrProvider; - DECLARE_ABSTRACT_CLASS(wxGridTableBase) + wxDECLARE_ABSTRACT_CLASS(wxGridTableBase); wxDECLARE_NO_COPY_CLASS(wxGridTableBase); }; @@ -765,9 +789,12 @@ private: // enum wxGridTableRequest { + // The first two requests never did anything, simply don't use them. +#if WXWIN_COMPATIBILITY_3_0 wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, - wxGRIDTABLE_NOTIFY_ROWS_INSERTED, +#endif // WXWIN_COMPATIBILITY_3_0 + wxGRIDTABLE_NOTIFY_ROWS_INSERTED = 2002, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_COLS_INSERTED, @@ -826,25 +853,25 @@ public: // these are pure virtual in wxGridTableBase // - virtual int GetNumberRows() { return static_cast(m_data.size()); } - virtual int GetNumberCols() { return m_numCols; } - virtual wxString GetValue( int row, int col ); - virtual void SetValue( int row, int col, const wxString& s ); + virtual int GetNumberRows() wxOVERRIDE { return static_cast(m_data.size()); } + virtual int GetNumberCols() wxOVERRIDE { return m_numCols; } + virtual wxString GetValue( int row, int col ) wxOVERRIDE; + virtual void SetValue( int row, int col, const wxString& s ) wxOVERRIDE; // overridden functions from wxGridTableBase // - void Clear(); - bool InsertRows( size_t pos = 0, size_t numRows = 1 ); - bool AppendRows( size_t numRows = 1 ); - bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); - bool InsertCols( size_t pos = 0, size_t numCols = 1 ); - bool AppendCols( size_t numCols = 1 ); - bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + void Clear() wxOVERRIDE; + bool InsertRows( size_t pos = 0, size_t numRows = 1 ) wxOVERRIDE; + bool AppendRows( size_t numRows = 1 ) wxOVERRIDE; + bool DeleteRows( size_t pos = 0, size_t numRows = 1 ) wxOVERRIDE; + bool InsertCols( size_t pos = 0, size_t numCols = 1 ) wxOVERRIDE; + bool AppendCols( size_t numCols = 1 ) wxOVERRIDE; + bool DeleteCols( size_t pos = 0, size_t numCols = 1 ) wxOVERRIDE; - void SetRowLabelValue( int row, const wxString& ); - void SetColLabelValue( int col, const wxString& ); - wxString GetRowLabelValue( int row ); - wxString GetColLabelValue( int col ); + void SetRowLabelValue( int row, const wxString& ) wxOVERRIDE; + void SetColLabelValue( int col, const wxString& ) wxOVERRIDE; + wxString GetRowLabelValue( int row ) wxOVERRIDE; + wxString GetColLabelValue( int col ) wxOVERRIDE; private: wxGridStringArray m_data; @@ -861,7 +888,7 @@ private: wxArrayString m_rowLabels; wxArrayString m_colLabels; - DECLARE_DYNAMIC_CLASS_NO_COPY( wxGridStringTable ) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGridStringTable); }; @@ -1083,7 +1110,7 @@ public: int GetBatchCount() { return m_batchCount; } - virtual void Refresh(bool eraseb = true, const wxRect* rect = NULL); + virtual void Refresh(bool eraseb = true, const wxRect* rect = NULL) wxOVERRIDE; // Use this, rather than wxWindow::Refresh(), to force an // immediate repainting of the grid. Has no effect if you are @@ -1424,15 +1451,10 @@ public: if ( m_colAt.IsEmpty() ) return idx; - for ( int i = 0; i < m_numCols; i++ ) - { - if ( m_colAt[i] == idx ) - return i; - } + int pos = m_colAt.Index(idx); + wxASSERT_MSG( pos != wxNOT_FOUND, "invalid column index" ); - wxFAIL_MSG( "invalid column index" ); - - return wxNOT_FOUND; + return pos; } // reset the columns positions to the default order @@ -1642,7 +1664,7 @@ public: // ------- drag and drop #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget(wxDropTarget *dropTarget); + virtual void SetDropTarget(wxDropTarget *dropTarget) wxOVERRIDE; #endif // wxUSE_DRAG_AND_DROP @@ -1838,16 +1860,16 @@ public: // override some base class functions - virtual bool Enable(bool enable = true); - virtual wxWindow *GetMainWindowOfCompositeControl() + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return (wxWindow*)m_gridWin; } - virtual void Fit(); + virtual void Fit() wxOVERRIDE; // implementation only void CancelMouseCapture(); protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; bool m_created; @@ -2098,21 +2120,21 @@ protected: // generate the appropriate grid event and return -1 if it was vetoed, 1 if // it was processed (but not vetoed) and 0 if it wasn't processed - int SendEvent(const wxEventType evtType, + int SendEvent(wxEventType evtType, int row, int col, const wxMouseEvent& e); - int SendEvent(const wxEventType evtType, + int SendEvent(wxEventType evtType, const wxGridCellCoords& coords, const wxMouseEvent& e) { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), e); } - int SendEvent(const wxEventType evtType, + int SendEvent(wxEventType evtType, int row, int col, const wxString& s = wxString()); - int SendEvent(const wxEventType evtType, + int SendEvent(wxEventType evtType, const wxGridCellCoords& coords, const wxString& s = wxString()) { return SendEvent(evtType, coords.GetRow(), coords.GetCol(), s); } - int SendEvent(const wxEventType evtType, const wxString& s = wxString()) + int SendEvent(wxEventType evtType, const wxString& s = wxString()) { return SendEvent(evtType, m_currentCellCoords, s); } // send wxEVT_GRID_{ROW,COL}_SIZE or wxEVT_GRID_COL_AUTO_SIZE, return true @@ -2145,11 +2167,6 @@ protected: { UpdateBlockBeingSelected(topLeft.GetRow(), topLeft.GetCol(), bottomRight.GetRow(), bottomRight.GetCol()); } - // ------ functions to get/send data (see also public functions) - // - bool GetModelValues(); - bool SetModelValues(); - friend class WXDLLIMPEXP_FWD_ADV wxGridSelection; friend class wxGridRowOperations; friend class wxGridColumnOperations; @@ -2166,7 +2183,7 @@ protected: private: // implement wxScrolledWindow method to return m_gridWin size - virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size); + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; // redraw the grid lines, should be called after changing their attributes void RedrawGridLines(); @@ -2329,8 +2346,8 @@ private: wxGridFixedIndicesSet *m_setFixedRows, *m_setFixedCols; - DECLARE_DYNAMIC_CLASS( wxGrid ) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGrid); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGrid); }; @@ -2420,7 +2437,7 @@ public: wxPoint GetPosition() { return wxPoint( m_x, m_y ); } bool Selecting() { return m_selecting; } - virtual wxEvent *Clone() const { return new wxGridEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEvent(*this); } protected: int m_row; @@ -2439,7 +2456,7 @@ private: m_selecting = sel; } - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEvent); }; class WXDLLIMPEXP_ADV wxGridSizeEvent : public wxNotifyEvent, @@ -2480,7 +2497,7 @@ public: int GetRowOrCol() { return m_rowOrCol; } wxPoint GetPosition() { return wxPoint( m_x, m_y ); } - virtual wxEvent *Clone() const { return new wxGridSizeEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridSizeEvent(*this); } protected: int m_rowOrCol; @@ -2495,7 +2512,7 @@ private: m_y = y; } - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridSizeEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridSizeEvent); }; @@ -2544,7 +2561,7 @@ public: int GetRightCol() { return m_bottomRight.GetCol(); } bool Selecting() { return m_selecting; } - virtual wxEvent *Clone() const { return new wxGridRangeSelectEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridRangeSelectEvent(*this); } protected: void Init(const wxGridCellCoords& topLeft, @@ -2560,7 +2577,7 @@ protected: wxGridCellCoords m_bottomRight; bool m_selecting; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridRangeSelectEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridRangeSelectEvent); }; @@ -2585,14 +2602,14 @@ public: void SetCol(int col) { m_col = col; } void SetControl(wxControl* ctrl) { m_ctrl = ctrl; } - virtual wxEvent *Clone() const { return new wxGridEditorCreatedEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxGridEditorCreatedEvent(*this); } private: int m_row; int m_col; wxControl* m_ctrl; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEditorCreatedEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxGridEditorCreatedEvent); }; diff --git a/Externals/wxWidgets3/include/wx/generic/gridctrl.h b/Externals/wxWidgets3/include/wx/generic/gridctrl.h index efcb233c8d..044f565382 100644 --- a/Externals/wxWidgets3/include/wx/generic/gridctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/gridctrl.h @@ -29,15 +29,15 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; // return the string extent virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const + virtual wxGridCellRenderer *Clone() const wxOVERRIDE { return new wxGridCellStringRenderer; } protected: @@ -63,14 +63,14 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const + virtual wxGridCellRenderer *Clone() const wxOVERRIDE { return new wxGridCellNumberRenderer; } protected: @@ -98,18 +98,18 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; // 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 void SetParameters(const wxString& params) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const; + virtual wxGridCellRenderer *Clone() const wxOVERRIDE; protected: wxString GetString(const wxGrid& grid, int row, int col); @@ -133,15 +133,15 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; // return the checkmark size virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const + virtual wxGridCellRenderer *Clone() const wxOVERRIDE { return new wxGridCellBoolRenderer; } private: @@ -166,17 +166,17 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const; + virtual wxGridCellRenderer *Clone() const wxOVERRIDE; // output strptime()-like format string - virtual void SetParameters(const wxString& params); + virtual void SetParameters(const wxString& params) wxOVERRIDE; protected: wxString GetString(const wxGrid& grid, int row, int col); @@ -201,18 +201,18 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const; + virtual wxGridCellRenderer *Clone() const wxOVERRIDE; // parameters string format is "item1[,item2[...,itemN]]" where itemN will // be used if the cell value is N-1 - virtual void SetParameters(const wxString& params); + virtual void SetParameters(const wxString& params) wxOVERRIDE; protected: wxString GetString(const wxGrid& grid, int row, int col); @@ -231,14 +231,26 @@ public: wxDC& dc, const wxRect& rect, int row, int col, - bool isSelected); + bool isSelected) wxOVERRIDE; virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col); + int row, int col) wxOVERRIDE; - virtual wxGridCellRenderer *Clone() const + virtual int GetBestHeight(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int width) wxOVERRIDE; + + virtual int GetBestWidth(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int height) wxOVERRIDE; + + virtual wxGridCellRenderer *Clone() const wxOVERRIDE { return new wxGridCellAutoWrapStringRenderer; } private: diff --git a/Externals/wxWidgets3/include/wx/generic/grideditors.h b/Externals/wxWidgets3/include/wx/generic/grideditors.h index c45106d3e8..faa1007c65 100644 --- a/Externals/wxWidgets3/include/wx/generic/grideditors.h +++ b/Externals/wxWidgets3/include/wx/generic/grideditors.h @@ -41,8 +41,8 @@ private: // a combobox within a set focus event. bool m_inSetFocus; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler); wxDECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler); }; @@ -57,31 +57,33 @@ public: virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); - virtual void SetSize(const wxRect& rect); + wxEvtHandler* evtHandler) wxOVERRIDE; + virtual void SetSize(const wxRect& rect) wxOVERRIDE; virtual void PaintBackground(wxDC& dc, const wxRect& rectCell, - const wxGridCellAttr& attr); + const wxGridCellAttr& attr) wxOVERRIDE; - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); - virtual void HandleReturn(wxKeyEvent& event); + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; + virtual void HandleReturn(wxKeyEvent& event) wxOVERRIDE; // parameters string format is "max_width" - virtual void SetParameters(const wxString& params); + virtual void SetParameters(const wxString& params) wxOVERRIDE; +#if wxUSE_VALIDATORS virtual void SetValidator(const wxValidator& validator); +#endif - virtual wxGridCellEditor *Clone() const; + virtual wxGridCellEditor *Clone() const wxOVERRIDE; // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; + virtual wxString GetValue() const wxOVERRIDE; protected: wxTextCtrl *Text() const { return (wxTextCtrl *)m_control; } @@ -94,7 +96,9 @@ protected: private: size_t m_maxChars; // max number of chars allowed +#if wxUSE_VALIDATORS wxScopedPtr m_validator; +#endif wxString m_value; wxDECLARE_NO_COPY_CLASS(wxGridCellTextEditor); @@ -110,25 +114,25 @@ public: virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); + wxEvtHandler* evtHandler) wxOVERRIDE; - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; // parameters string format is "min,max" - virtual void SetParameters(const wxString& params); + virtual void SetParameters(const wxString& params) wxOVERRIDE; - virtual wxGridCellEditor *Clone() const + virtual wxGridCellEditor *Clone() const wxOVERRIDE { return new wxGridCellNumberEditor(m_min, m_max); } // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; + virtual wxString GetValue() const wxOVERRIDE; protected: #if wxUSE_SPINCTRL @@ -193,23 +197,23 @@ public: virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); + wxEvtHandler* evtHandler) wxOVERRIDE; - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; - virtual void Reset(); - virtual void StartingKey(wxKeyEvent& event); + virtual void Reset() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; - virtual wxGridCellEditor *Clone() const + virtual wxGridCellEditor *Clone() const wxOVERRIDE { return new wxGridCellFloatEditor(m_width, m_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); + virtual void SetParameters(const wxString& params) wxOVERRIDE; protected: // string representation of our value @@ -238,27 +242,27 @@ public: virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); + wxEvtHandler* evtHandler) wxOVERRIDE; - virtual void SetSize(const wxRect& rect); - virtual void Show(bool show, wxGridCellAttr *attr = NULL); + virtual void SetSize(const wxRect& rect) wxOVERRIDE; + virtual void Show(bool show, wxGridCellAttr *attr = NULL) wxOVERRIDE; - virtual bool IsAcceptedKey(wxKeyEvent& event); - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool IsAcceptedKey(wxKeyEvent& event) wxOVERRIDE; + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; - virtual void Reset(); - virtual void StartingClick(); - virtual void StartingKey(wxKeyEvent& event); + virtual void Reset() wxOVERRIDE; + virtual void StartingClick() wxOVERRIDE; + virtual void StartingKey(wxKeyEvent& event) wxOVERRIDE; - virtual wxGridCellEditor *Clone() const + virtual wxGridCellEditor *Clone() const wxOVERRIDE { return new wxGridCellBoolEditor; } // added GetValue so we can get the value which is in the control, see // also UseStringValues() - virtual wxString GetValue() const; + virtual wxString GetValue() const wxOVERRIDE; // set the string values returned by GetValue() for the true and false // states, respectively @@ -297,28 +301,28 @@ public: virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); + wxEvtHandler* evtHandler) wxOVERRIDE; - virtual void SetSize(const wxRect& rect); + virtual void SetSize(const wxRect& rect) wxOVERRIDE; virtual void PaintBackground(wxDC& dc, const wxRect& rectCell, - const wxGridCellAttr& attr); + const wxGridCellAttr& attr) wxOVERRIDE; - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; - virtual void Reset(); + virtual void Reset() wxOVERRIDE; // parameters string format is "item1[,item2[...,itemN]]" - virtual void SetParameters(const wxString& params); + virtual void SetParameters(const wxString& params) wxOVERRIDE; - virtual wxGridCellEditor *Clone() const; + virtual wxGridCellEditor *Clone() const wxOVERRIDE; // added GetValue so we can get the value which is in the control - virtual wxString GetValue() const; + virtual wxString GetValue() const wxOVERRIDE; protected: wxComboBox *Combo() const { return (wxComboBox *)m_control; } @@ -340,12 +344,12 @@ public: wxGridCellEnumEditor( const wxString& choices = wxEmptyString ); virtual ~wxGridCellEnumEditor() {} - virtual wxGridCellEditor* Clone() const; + virtual wxGridCellEditor* Clone() const wxOVERRIDE; - virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual void BeginEdit(int row, int col, wxGrid* grid) wxOVERRIDE; virtual bool EndEdit(int row, int col, const wxGrid* grid, - const wxString& oldval, wxString *newval); - virtual void ApplyEdit(int row, int col, wxGrid* grid); + const wxString& oldval, wxString *newval) wxOVERRIDE; + virtual void ApplyEdit(int row, int col, wxGrid* grid) wxOVERRIDE; private: long m_index; @@ -361,9 +365,9 @@ public: wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { } virtual void Create(wxWindow* parent, wxWindowID id, - wxEvtHandler* evtHandler); + wxEvtHandler* evtHandler) wxOVERRIDE; - virtual wxGridCellEditor *Clone() const + virtual wxGridCellEditor *Clone() const wxOVERRIDE { return new wxGridCellAutoWrapStringEditor; } wxDECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor); diff --git a/Externals/wxWidgets3/include/wx/generic/headerctrlg.h b/Externals/wxWidgets3/include/wx/generic/headerctrlg.h index d2eceb2bfc..8a2a84ca1c 100644 --- a/Externals/wxWidgets3/include/wx/generic/headerctrlg.h +++ b/Externals/wxWidgets3/include/wx/generic/headerctrlg.h @@ -48,19 +48,19 @@ public: virtual ~wxHeaderCtrl(); protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: // implement base class pure virtuals - virtual void DoSetCount(unsigned int count); - virtual unsigned int DoGetCount() const; - virtual void DoUpdate(unsigned int idx); + virtual void DoSetCount(unsigned int count) wxOVERRIDE; + virtual unsigned int DoGetCount() const wxOVERRIDE; + virtual void DoUpdate(unsigned int idx) wxOVERRIDE; - virtual void DoScrollHorz(int dx); + virtual void DoScrollHorz(int dx) wxOVERRIDE; - virtual void DoSetColumnsOrder(const wxArrayInt& order); - virtual wxArrayInt DoGetColumnsOrder() const; + virtual void DoSetColumnsOrder(const wxArrayInt& order) wxOVERRIDE; + virtual wxArrayInt DoGetColumnsOrder() const wxOVERRIDE; // common part of all ctors void Init(); @@ -173,7 +173,7 @@ private: wxArrayInt m_colIndices; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/generic/helpext.h b/Externals/wxWidgets3/include/wx/generic/helpext.h index fe0c3e7eb2..b713cd854a 100644 --- a/Externals/wxWidgets3/include/wx/generic/helpext.h +++ b/Externals/wxWidgets3/include/wx/generic/helpext.h @@ -37,36 +37,36 @@ public: // Set viewer: new name for SetBrowser virtual void SetViewer(const wxString& viewer = wxEmptyString, - long flags = wxHELP_NETSCAPE); + long flags = wxHELP_NETSCAPE) wxOVERRIDE; - virtual bool Initialize(const wxString& dir, int WXUNUSED(server)) + virtual bool Initialize(const wxString& dir, int WXUNUSED(server)) wxOVERRIDE { return Initialize(dir); } - virtual bool Initialize(const wxString& dir); - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(void); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section); - virtual bool DisplayBlock(long blockNo); + virtual bool Initialize(const wxString& dir) wxOVERRIDE; + virtual bool LoadFile(const wxString& file = wxEmptyString) wxOVERRIDE; + virtual bool DisplayContents(void) wxOVERRIDE; + virtual bool DisplaySection(int sectionNo) wxOVERRIDE; + virtual bool DisplaySection(const wxString& section) wxOVERRIDE; + virtual bool DisplayBlock(long blockNo) wxOVERRIDE; virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + wxHelpSearchMode mode = wxHELP_SEARCH_ALL) wxOVERRIDE; - virtual bool Quit(void); - virtual void OnQuit(void); + virtual bool Quit(void) wxOVERRIDE; + virtual void OnQuit(void) wxOVERRIDE; virtual bool DisplayHelp(const wxString &) ; virtual void SetFrameParameters(const wxString& WXUNUSED(title), const wxSize& WXUNUSED(size), const wxPoint& WXUNUSED(pos) = wxDefaultPosition, - bool WXUNUSED(newFrameEachTime) = false) + bool WXUNUSED(newFrameEachTime) = false) wxOVERRIDE { // does nothing by default } virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL, wxPoint *WXUNUSED(pos) = NULL, - bool *WXUNUSED(newFrameEachTime) = NULL) + bool *WXUNUSED(newFrameEachTime) = NULL) wxOVERRIDE { return NULL; // does nothing by default } @@ -97,7 +97,7 @@ private: // Is the viewer a variant of netscape? bool m_BrowserIsNetscape; - DECLARE_CLASS(wxExtHelpController) + wxDECLARE_CLASS(wxExtHelpController); }; #endif // wxUSE_HELP diff --git a/Externals/wxWidgets3/include/wx/generic/icon.h b/Externals/wxWidgets3/include/wx/generic/icon.h index 7a336d37ce..0b98032a73 100644 --- a/Externals/wxWidgets3/include/wx/generic/icon.h +++ b/Externals/wxWidgets3/include/wx/generic/icon.h @@ -47,7 +47,7 @@ public: // unhide the base class version virtual bool LoadFile(const wxString& name, - wxBitmapType flags = wxICON_DEFAULT_TYPE) + wxBitmapType flags = wxICON_DEFAULT_TYPE) wxOVERRIDE { return wxBitmap::LoadFile(name, flags); } // create from bitmap (which should have a mask unless it's monochrome): @@ -56,7 +56,7 @@ public: void CopyFromBitmap(const wxBitmap& bmp); private: - DECLARE_DYNAMIC_CLASS(wxIcon) + wxDECLARE_DYNAMIC_CLASS(wxIcon); }; #endif // _WX_GENERIC_ICON_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/imaglist.h b/Externals/wxWidgets3/include/wx/generic/imaglist.h index 8fc145e03f..f87e19b43c 100644 --- a/Externals/wxWidgets3/include/wx/generic/imaglist.h +++ b/Externals/wxWidgets3/include/wx/generic/imaglist.h @@ -10,7 +10,7 @@ #ifndef _WX_IMAGLISTG_H_ #define _WX_IMAGLISTG_H_ -#include "wx/list.h" +#include "wx/gdicmn.h" class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxBitmap; @@ -29,6 +29,7 @@ public: virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; + virtual wxSize GetSize() const { return wxSize(m_width, m_height); } int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); @@ -52,7 +53,7 @@ private: int m_width; int m_height; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList); }; #ifndef wxHAS_NATIVE_IMAGELIST @@ -64,7 +65,7 @@ private: class WXDLLIMPEXP_CORE wxImageList: public wxGenericImageList { - DECLARE_DYNAMIC_CLASS(wxImageList) + wxDECLARE_DYNAMIC_CLASS(wxImageList); public: wxImageList() {} diff --git a/Externals/wxWidgets3/include/wx/generic/infobar.h b/Externals/wxWidgets3/include/wx/generic/infobar.h index 4a6bf2b3c1..2fb2312db2 100644 --- a/Externals/wxWidgets3/include/wx/generic/infobar.h +++ b/Externals/wxWidgets3/include/wx/generic/infobar.h @@ -38,13 +38,17 @@ public: // ---------------------------- virtual void ShowMessage(const wxString& msg, - int flags = wxICON_INFORMATION); + int flags = wxICON_INFORMATION) wxOVERRIDE; - virtual void Dismiss(); + virtual void Dismiss() wxOVERRIDE; - virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()); + virtual void AddButton(wxWindowID btnid, const wxString& label = wxString()) wxOVERRIDE; - virtual void RemoveButton(wxWindowID btnid); + virtual void RemoveButton(wxWindowID btnid) wxOVERRIDE; + + virtual size_t GetButtonCount() const wxOVERRIDE; + virtual wxWindowID GetButtonId(size_t idx) const wxOVERRIDE; + virtual bool HasButtonId(wxWindowID btnid) const wxOVERRIDE; // methods specific to this version // -------------------------------- @@ -77,15 +81,15 @@ public: // setting the font of this window sets it for the text control inside it // (default font is a larger and bold version of the normal one) - virtual bool SetFont(const wxFont& font); + virtual bool SetFont(const wxFont& font) wxOVERRIDE; // same thing with the colour: this affects the text colour - virtual bool SetForegroundColour(const wxColor& colour); + virtual bool SetForegroundColour(const wxColor& colour) wxOVERRIDE; protected: // info bar shouldn't have any border by default, the colour difference // between it and the main window separates it well enough - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // update the parent to take our new or changed size into account (notably @@ -127,7 +131,7 @@ private: m_hideEffect; int m_effectDuration; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric); }; diff --git a/Externals/wxWidgets3/include/wx/generic/laywin.h b/Externals/wxWidgets3/include/wx/generic/laywin.h index a38fd97fc1..1e56b5e12c 100644 --- a/Externals/wxWidgets3/include/wx/generic/laywin.h +++ b/Externals/wxWidgets3/include/wx/generic/laywin.h @@ -87,7 +87,7 @@ public: void SetAlignment(wxLayoutAlignment align) { m_alignment = align; } wxLayoutAlignment GetAlignment() const { return m_alignment; } - virtual wxEvent *Clone() const { return new wxQueryLayoutInfoEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxQueryLayoutInfoEvent(*this); } protected: int m_flags; @@ -97,7 +97,7 @@ protected: wxLayoutAlignment m_alignment; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryLayoutInfoEvent); }; typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&); @@ -130,14 +130,14 @@ public: void SetRect(const wxRect& rect) { m_rect = rect; } wxRect GetRect() const { return m_rect; } - virtual wxEvent *Clone() const { return new wxCalculateLayoutEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxCalculateLayoutEvent(*this); } protected: int m_flags; wxRect m_rect; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCalculateLayoutEvent); }; typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&); @@ -195,8 +195,8 @@ private: wxSize m_defaultSize; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSashLayoutWindow); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_SASH diff --git a/Externals/wxWidgets3/include/wx/generic/listctrl.h b/Externals/wxWidgets3/include/wx/generic/listctrl.h index 7e18eeccbf..d706cb813e 100644 --- a/Externals/wxWidgets3/include/wx/generic/listctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/listctrl.h @@ -63,10 +63,10 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString &name = wxListCtrlNameStr); - bool GetColumn( int col, wxListItem& item ) const; - bool SetColumn( int col, const wxListItem& item ); - int GetColumnWidth( int col ) const; - bool SetColumnWidth( int col, int width); + bool GetColumn( int col, wxListItem& item ) const wxOVERRIDE; + bool SetColumn( int col, const wxListItem& item ) wxOVERRIDE; + int GetColumnWidth( int col ) const wxOVERRIDE; + bool SetColumnWidth( int col, int width) wxOVERRIDE; int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think wxRect GetViewRect() const; @@ -87,7 +87,7 @@ public: bool GetItemPosition( long item, wxPoint& pos ) const; bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC int GetItemCount() const; - int GetColumnCount() const; + int GetColumnCount() const wxOVERRIDE; void SetItemSpacing( int spacing, bool isSmall = false ); wxSize GetItemSpacing() const; void SetItemTextColour( long item, const wxColour& col); @@ -101,25 +101,34 @@ public: void SetTextColour(const wxColour& col); long GetTopItem() const; + virtual bool HasCheckboxes() const wxOVERRIDE; + virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; + virtual bool IsItemChecked(long item) const wxOVERRIDE; + virtual void CheckItem(long item, bool check) wxOVERRIDE; + void SetSingleStyle( long style, bool add = true ) ; - void SetWindowStyleFlag( long style ); + void SetWindowStyleFlag( long style ) wxOVERRIDE; void RecreateWindow() {} long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const; - wxImageList *GetImageList( int which ) const; - void SetImageList( wxImageList *imageList, int which ); - void AssignImageList( wxImageList *imageList, int which ); + wxImageList *GetImageList( int which ) const wxOVERRIDE; + void SetImageList( wxImageList *imageList, int which ) wxOVERRIDE; + void AssignImageList( wxImageList *imageList, int which ) wxOVERRIDE; bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC void ClearAll(); bool DeleteItem( long item ); bool DeleteAllItems(); - bool DeleteAllColumns(); - bool DeleteColumn( int col ); + bool DeleteAllColumns() wxOVERRIDE; + bool DeleteColumn( int col ) wxOVERRIDE; void SetItemCount(long count); wxTextCtrl *EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + wxTextCtrl* GetEditControl() const; void Edit( long item ) { EditLabel(item); } @@ -143,18 +152,12 @@ public: void RefreshItem(long item); void RefreshItems(long itemFrom, long itemTo); - virtual void EnableBellOnNoMatch(bool on = true); - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete, don't use - wxDEPRECATED( int GetItemSpacing( bool isSmall ) const ); -#endif // WXWIN_COMPATIBILITY_2_6 - + virtual void EnableBellOnNoMatch(bool on = true) wxOVERRIDE; // overridden base class virtuals // ------------------------------ - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -162,7 +165,7 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - virtual void Update(); + virtual void Update() wxOVERRIDE; // implementation only from now on @@ -171,25 +174,25 @@ public: // generic version extension, don't use in portable code bool Update( long item ); - void OnInternalIdle( ); + void OnInternalIdle( ) wxOVERRIDE; // We have to hand down a few functions virtual void Refresh(bool eraseBackground = true, - const wxRect *rect = NULL); + const wxRect *rect = NULL) wxOVERRIDE; - virtual bool SetBackgroundColour( const wxColour &colour ); - virtual bool SetForegroundColour( const wxColour &colour ); + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; virtual wxColour GetBackgroundColour() const; virtual wxColour GetForegroundColour() const; - virtual bool SetFont( const wxFont &font ); - virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget *GetDropTarget() const; + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; + virtual wxDropTarget *GetDropTarget() const wxOVERRIDE; #endif - virtual bool ShouldInheritColours() const { return false; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } // implementation // -------------- @@ -205,12 +208,12 @@ public: protected: // Implement base class pure virtual methods. - long DoInsertColumn(long col, const wxListItem& info); + long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE; - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; - virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; // return the text for the given column of the given item virtual wxString OnGetItemText(long item, long column) const; @@ -226,9 +229,9 @@ protected: // it calls our OnGetXXX() functions friend class WXDLLIMPEXP_FWD_CORE wxListMainWindow; - virtual wxBorder GetDefaultBorder() const; + virtual wxBorder GetDefaultBorder() const wxOVERRIDE; - virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size); + virtual wxSize GetSizeAvailableForScrollTarget(const wxSize& size) wxOVERRIDE; private: void CreateOrDestroyHeaderWindowAsNeeded(); @@ -237,15 +240,15 @@ private: // we need to return a special WM_GETDLGCODE value to process just the // arrows but let the other navigation characters through -#if defined(__WXMSW__) && !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); #endif // __WXMSW__ WX_FORWARD_TO_SCROLL_HELPER() - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericListCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericListCtrl); }; #if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && (!(defined(__WXMAC__) && wxOSX_USE_CARBON) || defined(__WXUNIVERSAL__ )) @@ -256,7 +259,7 @@ private: class WXDLLIMPEXP_CORE wxListCtrl: public wxGenericListCtrl { - DECLARE_DYNAMIC_CLASS(wxListCtrl) + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); public: wxListCtrl() {} diff --git a/Externals/wxWidgets3/include/wx/generic/logg.h b/Externals/wxWidgets3/include/wx/generic/logg.h index 303b441e81..f45731d358 100644 --- a/Externals/wxWidgets3/include/wx/generic/logg.h +++ b/Externals/wxWidgets3/include/wx/generic/logg.h @@ -33,7 +33,7 @@ public: protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogText(const wxString& msg) wxOVERRIDE; private: // the control we use @@ -57,12 +57,12 @@ public: wxLogGui(); // show all messages that were logged since the last Flush() - virtual void Flush(); + virtual void Flush() wxOVERRIDE; protected: virtual void DoLogRecord(wxLogLevel level, const wxString& msg, - const wxLogRecordInfo& info); + const wxLogRecordInfo& info) wxOVERRIDE; // return the title to be used for the log dialog, depending on m_bErrors // and m_bWarnings values @@ -136,7 +136,7 @@ public: virtual void OnFrameDelete(wxFrame *frame); protected: - virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE; private: wxLogFrame *m_pLogFrame; // the log frame diff --git a/Externals/wxWidgets3/include/wx/generic/mask.h b/Externals/wxWidgets3/include/wx/generic/mask.h index f6aad1a86d..454ba11cda 100644 --- a/Externals/wxWidgets3/include/wx/generic/mask.h +++ b/Externals/wxWidgets3/include/wx/generic/mask.h @@ -46,7 +46,7 @@ private: wxBitmap m_bitmap; - DECLARE_DYNAMIC_CLASS(wxMask) + wxDECLARE_DYNAMIC_CLASS(wxMask); }; #endif // _WX_GENERIC_MASKG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/mdig.h b/Externals/wxWidgets3/include/wx/generic/mdig.h index 7c433edc40..d3469069c3 100644 --- a/Externals/wxWidgets3/include/wx/generic/mdig.h +++ b/Externals/wxWidgets3/include/wx/generic/mdig.h @@ -124,8 +124,8 @@ private: // and we forwarded the event to this child (as we do with menu events) wxMDIChildFrameBase *m_childHandler; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIParentFrame); }; // ---------------------------------------------------------------------------- @@ -202,8 +202,8 @@ private: void OnMenuHighlight(wxMenuEvent& event); void OnClose(wxCloseEvent& event); - DECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIChildFrame); + wxDECLARE_EVENT_TABLE(); friend class wxGenericMDIClientWindow; }; @@ -243,7 +243,7 @@ private: // the notebook containing all MDI children as its pages wxNotebook *m_notebook; - DECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow) + wxDECLARE_DYNAMIC_CLASS(wxGenericMDIClientWindow); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/generic/msgdlgg.h b/Externals/wxWidgets3/include/wx/generic/msgdlgg.h index 66bd5484ea..a5c3c115bd 100644 --- a/Externals/wxWidgets3/include/wx/generic/msgdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/msgdlgg.h @@ -22,7 +22,7 @@ public: long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; protected: // Creates a message dialog taking any options that have been set after @@ -48,8 +48,8 @@ private: wxPoint m_pos; bool m_created; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericMessageDialog); }; #endif // _WX_GENERIC_MSGDLGG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/notebook.h b/Externals/wxWidgets3/include/wx/generic/notebook.h index e328e0bfcf..807baebe2e 100644 --- a/Externals/wxWidgets3/include/wx/generic/notebook.h +++ b/Externals/wxWidgets3/include/wx/generic/notebook.h @@ -148,8 +148,8 @@ protected: wxTabView* m_tabView; - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_NOTEBOOK_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/notifmsg.h b/Externals/wxWidgets3/include/wx/generic/notifmsg.h index 1cd74ba7f0..ccc55108c5 100644 --- a/Externals/wxWidgets3/include/wx/generic/notifmsg.h +++ b/Externals/wxWidgets3/include/wx/generic/notifmsg.h @@ -10,8 +10,6 @@ #ifndef _WX_GENERIC_NOTIFMSG_H_ #define _WX_GENERIC_NOTIFMSG_H_ -class wxNotificationMessageDialog; - // ---------------------------------------------------------------------------- // wxGenericNotificationMessage // ---------------------------------------------------------------------------- @@ -19,40 +17,29 @@ class wxNotificationMessageDialog; class WXDLLIMPEXP_ADV wxGenericNotificationMessage : public wxNotificationMessageBase { public: - wxGenericNotificationMessage() { Init(); } - wxGenericNotificationMessage(const wxString& title, - const wxString& message = wxString(), - wxWindow *parent = NULL, - int flags = wxICON_INFORMATION) - : wxNotificationMessageBase(title, message, parent, flags) + wxGenericNotificationMessage() { Init(); } - virtual ~wxGenericNotificationMessage(); - - - virtual bool Show(int timeout = Timeout_Auto); - virtual bool Close(); + wxGenericNotificationMessage(const wxString& title, + const wxString& message = wxString(), + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + Init(); + Create(title, message, parent, flags); + } // generic implementation-specific methods // get/set the default timeout (used if Timeout_Auto is specified) - static int GetDefaultTimeout() { return ms_timeout; } + static int GetDefaultTimeout(); static void SetDefaultTimeout(int timeout); private: void Init(); - - // default timeout - static int ms_timeout; - - // notification message is represented by a modeless dialog in this - // implementation - wxNotificationMessageDialog *m_dialog; - - wxDECLARE_NO_COPY_CLASS(wxGenericNotificationMessage); }; diff --git a/Externals/wxWidgets3/include/wx/generic/numdlgg.h b/Externals/wxWidgets3/include/wx/generic/numdlgg.h index ac45ce915c..905efee6df 100644 --- a/Externals/wxWidgets3/include/wx/generic/numdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/numdlgg.h @@ -30,12 +30,27 @@ class WXDLLIMPEXP_CORE wxNumberEntryDialog : public wxDialog { public: + wxNumberEntryDialog() + { + m_value = m_min = m_max = 0; + } + wxNumberEntryDialog(wxWindow *parent, const wxString& message, const wxString& prompt, const wxString& caption, long value, long min, long max, - const wxPoint& pos = wxDefaultPosition); + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, prompt, caption, value, min, max, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& prompt, + const wxString& caption, + long value, long min, long max, + const wxPoint& pos = wxDefaultPosition); long GetValue() const { return m_value; } @@ -54,8 +69,8 @@ protected: long m_value, m_min, m_max; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxNumberEntryDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxNumberEntryDialog); wxDECLARE_NO_COPY_CLASS(wxNumberEntryDialog); }; diff --git a/Externals/wxWidgets3/include/wx/generic/paletteg.h b/Externals/wxWidgets3/include/wx/generic/paletteg.h index 0f6f5a4918..a475c7d18f 100644 --- a/Externals/wxWidgets3/include/wx/generic/paletteg.h +++ b/Externals/wxWidgets3/include/wx/generic/paletteg.h @@ -37,14 +37,14 @@ public: int GetPixel( unsigned char red, unsigned char green, unsigned char blue ) const; bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; - virtual int GetColoursCount() const; + virtual int GetColoursCount() const wxOVERRIDE; protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxPalette) + wxDECLARE_DYNAMIC_CLASS(wxPalette); }; #endif // __WX_PALETTEG_H__ diff --git a/Externals/wxWidgets3/include/wx/generic/printps.h b/Externals/wxWidgets3/include/wx/generic/printps.h index 388307297c..7d83738677 100644 --- a/Externals/wxWidgets3/include/wx/generic/printps.h +++ b/Externals/wxWidgets3/include/wx/generic/printps.h @@ -26,12 +26,12 @@ public: wxPostScriptPrinter(wxPrintDialogData *data = NULL); virtual ~wxPostScriptPrinter(); - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); - virtual bool Setup(wxWindow *parent); + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter) + wxDECLARE_DYNAMIC_CLASS(wxPostScriptPrinter); }; // ---------------------------------------------------------------------------- @@ -51,14 +51,14 @@ public: virtual ~wxPostScriptPrintPreview(); - virtual bool Print(bool interactive); - virtual void DetermineScaling(); + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; private: void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); private: - DECLARE_CLASS(wxPostScriptPrintPreview) + wxDECLARE_CLASS(wxPostScriptPrintPreview); }; #endif diff --git a/Externals/wxWidgets3/include/wx/generic/private/addremovectrl.h b/Externals/wxWidgets3/include/wx/generic/private/addremovectrl.h new file mode 100644 index 0000000000..2eea6fad1d --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/private/addremovectrl.h @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/addremovectrl.h +// Purpose: Generic wxAddRemoveImpl implementation, also used in wxMSW +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplWithButtons +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems) + { + m_btnAdd = new wxButton(parent, wxID_ADD, GetAddButtonLabel(), + wxDefaultPosition, wxDefaultSize, + wxBU_EXACTFIT | wxBORDER_NONE); + m_btnRemove = new wxButton(parent, wxID_REMOVE, GetRemoveButtonLabel(), + wxDefaultPosition, wxDefaultSize, + wxBU_EXACTFIT | wxBORDER_NONE); + + wxSizer* const sizerBtns = new wxBoxSizer(wxVERTICAL); + sizerBtns->Add(m_btnAdd, wxSizerFlags().Expand()); + sizerBtns->Add(m_btnRemove, wxSizerFlags().Expand()); + + wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL); + sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand()); + sizerTop->Add(sizerBtns, wxSizerFlags().Centre().Border(wxLEFT)); + parent->SetSizer(sizerTop); + + SetUpEvents(); + } + +private: + static wxString GetAddButtonLabel() + { +#if wxUSE_UNICODE + return wchar_t(0xFF0B); // FULLWIDTH PLUS SIGN +#else + return "+"; +#endif + } + + static wxString GetRemoveButtonLabel() + { +#if wxUSE_UNICODE + return wchar_t(0x2012); // FIGURE DASH +#else + return "-"; +#endif + } + +}; + +#endif // _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/private/grid.h b/Externals/wxWidgets3/include/wx/generic/private/grid.h index 7ef99700cf..0fb81f91ac 100644 --- a/Externals/wxWidgets3/include/wx/generic/private/grid.h +++ b/Externals/wxWidgets3/include/wx/generic/private/grid.h @@ -92,11 +92,11 @@ public: { } - virtual wxString GetTitle() const { return m_grid->GetColLabelValue(m_col); } - virtual wxBitmap GetBitmap() const { return wxNullBitmap; } - virtual int GetWidth() const { return m_grid->GetColSize(m_col); } - virtual int GetMinWidth() const { return 0; } - virtual wxAlignment GetAlignment() const + virtual wxString GetTitle() const wxOVERRIDE { return m_grid->GetColLabelValue(m_col); } + virtual wxBitmap GetBitmap() const wxOVERRIDE { return wxNullBitmap; } + virtual int GetWidth() const wxOVERRIDE { return m_grid->GetColSize(m_col); } + virtual int GetMinWidth() const wxOVERRIDE { return 0; } + virtual wxAlignment GetAlignment() const wxOVERRIDE { int horz, vert; @@ -105,7 +105,7 @@ public: return static_cast(horz); } - virtual int GetFlags() const + virtual int GetFlags() const wxOVERRIDE { // we can't know in advance whether we can sort by this column or not // with wxGrid API so suppose we can by default @@ -120,12 +120,12 @@ public: return flags; } - virtual bool IsSortKey() const + virtual bool IsSortKey() const wxOVERRIDE { return m_grid->IsSortingBy(m_col); } - virtual bool IsSortOrderAscending() const + virtual bool IsSortOrderAscending() const wxOVERRIDE { return m_grid->IsSortOrderAscending(); } @@ -153,7 +153,7 @@ public: } protected: - virtual const wxHeaderColumn& GetColumn(unsigned int idx) const + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const wxOVERRIDE { return m_columns[idx]; } @@ -171,7 +171,7 @@ private: } // override the base class method to update our m_columns array - virtual void OnColumnCountChanging(unsigned int count) + virtual void OnColumnCountChanging(unsigned int count) wxOVERRIDE { const unsigned countOld = m_columns.size(); if ( count < countOld ) @@ -191,7 +191,7 @@ private: } // override to implement column auto sizing - virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) + virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) wxOVERRIDE { // TODO: currently grid doesn't support computing the column best width // from its contents so we just use the best label width as is @@ -201,7 +201,7 @@ private: } // overridden to react to the actions using the columns popup menu - virtual void UpdateColumnVisibility(unsigned int idx, bool show) + virtual void UpdateColumnVisibility(unsigned int idx, bool show) wxOVERRIDE { GetOwner()->SetColSize(idx, show ? wxGRID_AUTOSIZE : 0); @@ -213,7 +213,7 @@ private: // overridden to react to the columns order changes in the customization // dialog - virtual void UpdateColumnsOrder(const wxArrayInt& order) + virtual void UpdateColumnsOrder(const wxArrayInt& order) wxOVERRIDE { GetOwner()->SetColumnsOrder(order); } @@ -285,7 +285,7 @@ private: wxVector m_columns; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridHeaderCtrl); }; @@ -304,9 +304,9 @@ public: m_owner = owner; } - virtual wxWindow *GetMainWindowOfCompositeControl() { return m_owner; } + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return m_owner; } - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } wxGrid *GetOwner() { return m_owner; } @@ -315,7 +315,7 @@ protected: wxGrid *m_owner; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridSubwindow); }; @@ -333,7 +333,7 @@ private: void OnMouseEvent( wxMouseEvent& event ); void OnMouseWheel( wxMouseEvent& event ); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridRowLabelWindow); }; @@ -352,7 +352,7 @@ private: void OnMouseEvent( wxMouseEvent& event ); void OnMouseWheel( wxMouseEvent& event ); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridColLabelWindow); }; @@ -370,7 +370,7 @@ private: void OnMouseWheel( wxMouseEvent& event ); void OnPaint( wxPaintEvent& event ); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridCornerLabelWindow); }; @@ -385,9 +385,9 @@ public: } - virtual void ScrollWindow( int dx, int dy, const wxRect *rect ); + virtual void ScrollWindow( int dx, int dy, const wxRect *rect ) wxOVERRIDE; - virtual bool AcceptsFocus() const { return true; } + virtual bool AcceptsFocus() const wxOVERRIDE { return true; } private: void OnPaint( wxPaintEvent &event ); @@ -399,7 +399,7 @@ private: void OnEraseBackground( wxEraseEvent& ); void OnFocus( wxFocusEvent& ); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGridWindow); }; @@ -574,135 +574,135 @@ public: class wxGridRowOperations : public wxGridOperations { public: - virtual wxGridOperations& Dual() const; + virtual wxGridOperations& Dual() const wxOVERRIDE; - virtual int GetNumberOfLines(const wxGrid *grid) const + virtual int GetNumberOfLines(const wxGrid *grid) const wxOVERRIDE { return grid->GetNumberRows(); } - virtual wxGrid::wxGridSelectionModes GetSelectionMode() const + virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE { return wxGrid::wxGridSelectRows; } - virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const + virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const wxOVERRIDE { return wxGridCellCoords(thisDir, otherDir); } - virtual int CalcScrolledPosition(wxGrid *grid, int pos) const + virtual int CalcScrolledPosition(wxGrid *grid, int pos) const wxOVERRIDE { return grid->CalcScrolledPosition(wxPoint(pos, 0)).x; } - virtual int Select(const wxGridCellCoords& c) const { return c.GetRow(); } - virtual int Select(const wxPoint& pt) const { return pt.x; } - virtual int Select(const wxSize& sz) const { return sz.x; } - virtual int Select(const wxRect& r) const { return r.x; } - virtual int& Select(wxRect& r) const { return r.x; } - virtual int& SelectSize(wxRect& r) const { return r.width; } - virtual wxSize MakeSize(int first, int second) const + virtual int Select(const wxGridCellCoords& c) const wxOVERRIDE { return c.GetRow(); } + virtual int Select(const wxPoint& pt) const wxOVERRIDE { return pt.x; } + virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.x; } + virtual int Select(const wxRect& r) const wxOVERRIDE { return r.x; } + virtual int& Select(wxRect& r) const wxOVERRIDE { return r.x; } + virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.width; } + virtual wxSize MakeSize(int first, int second) const wxOVERRIDE { return wxSize(first, second); } - virtual void Set(wxGridCellCoords& coords, int line) const + virtual void Set(wxGridCellCoords& coords, int line) const wxOVERRIDE { coords.SetRow(line); } - virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const + virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE { dc.DrawLine(start, pos, end, pos); } - virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const + virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const wxOVERRIDE { return grid->YToRow(pos, clip); } - virtual int GetLineStartPos(const wxGrid *grid, int line) const + virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetRowTop(line); } - virtual int GetLineEndPos(const wxGrid *grid, int line) const + virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetRowBottom(line); } - virtual int GetLineSize(const wxGrid *grid, int line) const + virtual int GetLineSize(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetRowHeight(line); } - virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const + virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const wxOVERRIDE { return grid->m_rowBottoms; } - virtual int GetDefaultLineSize(const wxGrid *grid) const + virtual int GetDefaultLineSize(const wxGrid *grid) const wxOVERRIDE { return grid->GetDefaultRowSize(); } - virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const + virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const wxOVERRIDE { return grid->GetRowMinimalAcceptableHeight(); } - virtual int GetMinimalLineSize(const wxGrid *grid, int line) const + virtual int GetMinimalLineSize(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetRowMinimalHeight(line); } - virtual void SetLineSize(wxGrid *grid, int line, int size) const + virtual void SetLineSize(wxGrid *grid, int line, int size) const wxOVERRIDE { grid->SetRowSize(line, size); } - virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const + virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const wxOVERRIDE { grid->SetDefaultRowSize(size, resizeExisting); } - virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int pos) const + virtual int GetLineAt(const wxGrid * WXUNUSED(grid), int pos) const wxOVERRIDE { return pos; } // TODO: implement row reordering - virtual int GetLinePos(const wxGrid * WXUNUSED(grid), int line) const + virtual int GetLinePos(const wxGrid * WXUNUSED(grid), int line) const wxOVERRIDE { return line; } // TODO: implement row reordering - virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const + virtual int GetLineBefore(const wxGrid* WXUNUSED(grid), int line) const wxOVERRIDE { return line - 1; } - virtual wxWindow *GetHeaderWindow(wxGrid *grid) const + virtual wxWindow *GetHeaderWindow(wxGrid *grid) const wxOVERRIDE { return grid->GetGridRowLabelWindow(); } - virtual int GetHeaderWindowSize(wxGrid *grid) const + virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE { return grid->GetRowLabelSize(); } }; class wxGridColumnOperations : public wxGridOperations { public: - virtual wxGridOperations& Dual() const; + virtual wxGridOperations& Dual() const wxOVERRIDE; - virtual int GetNumberOfLines(const wxGrid *grid) const + virtual int GetNumberOfLines(const wxGrid *grid) const wxOVERRIDE { return grid->GetNumberCols(); } - virtual wxGrid::wxGridSelectionModes GetSelectionMode() const + virtual wxGrid::wxGridSelectionModes GetSelectionMode() const wxOVERRIDE { return wxGrid::wxGridSelectColumns; } - virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const + virtual wxGridCellCoords MakeCoords(int thisDir, int otherDir) const wxOVERRIDE { return wxGridCellCoords(otherDir, thisDir); } - virtual int CalcScrolledPosition(wxGrid *grid, int pos) const + virtual int CalcScrolledPosition(wxGrid *grid, int pos) const wxOVERRIDE { return grid->CalcScrolledPosition(wxPoint(0, pos)).y; } - virtual int Select(const wxGridCellCoords& c) const { return c.GetCol(); } - virtual int Select(const wxPoint& pt) const { return pt.y; } - virtual int Select(const wxSize& sz) const { return sz.y; } - virtual int Select(const wxRect& r) const { return r.y; } - virtual int& Select(wxRect& r) const { return r.y; } - virtual int& SelectSize(wxRect& r) const { return r.height; } - virtual wxSize MakeSize(int first, int second) const + virtual int Select(const wxGridCellCoords& c) const wxOVERRIDE { return c.GetCol(); } + virtual int Select(const wxPoint& pt) const wxOVERRIDE { return pt.y; } + virtual int Select(const wxSize& sz) const wxOVERRIDE { return sz.y; } + virtual int Select(const wxRect& r) const wxOVERRIDE { return r.y; } + virtual int& Select(wxRect& r) const wxOVERRIDE { return r.y; } + virtual int& SelectSize(wxRect& r) const wxOVERRIDE { return r.height; } + virtual wxSize MakeSize(int first, int second) const wxOVERRIDE { return wxSize(second, first); } - virtual void Set(wxGridCellCoords& coords, int line) const + virtual void Set(wxGridCellCoords& coords, int line) const wxOVERRIDE { coords.SetCol(line); } - virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const + virtual void DrawParallelLine(wxDC& dc, int start, int end, int pos) const wxOVERRIDE { dc.DrawLine(pos, start, pos, end); } - virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const + virtual int PosToLine(const wxGrid *grid, int pos, bool clip = false) const wxOVERRIDE { return grid->XToCol(pos, clip); } - virtual int GetLineStartPos(const wxGrid *grid, int line) const + virtual int GetLineStartPos(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetColLeft(line); } - virtual int GetLineEndPos(const wxGrid *grid, int line) const + virtual int GetLineEndPos(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetColRight(line); } - virtual int GetLineSize(const wxGrid *grid, int line) const + virtual int GetLineSize(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetColWidth(line); } - virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const + virtual const wxArrayInt& GetLineEnds(const wxGrid *grid) const wxOVERRIDE { return grid->m_colRights; } - virtual int GetDefaultLineSize(const wxGrid *grid) const + virtual int GetDefaultLineSize(const wxGrid *grid) const wxOVERRIDE { return grid->GetDefaultColSize(); } - virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const + virtual int GetMinimalAcceptableLineSize(const wxGrid *grid) const wxOVERRIDE { return grid->GetColMinimalAcceptableWidth(); } - virtual int GetMinimalLineSize(const wxGrid *grid, int line) const + virtual int GetMinimalLineSize(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetColMinimalWidth(line); } - virtual void SetLineSize(wxGrid *grid, int line, int size) const + virtual void SetLineSize(wxGrid *grid, int line, int size) const wxOVERRIDE { grid->SetColSize(line, size); } - virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const + virtual void SetDefaultLineSize(wxGrid *grid, int size, bool resizeExisting) const wxOVERRIDE { grid->SetDefaultColSize(size, resizeExisting); } - virtual int GetLineAt(const wxGrid *grid, int pos) const + virtual int GetLineAt(const wxGrid *grid, int pos) const wxOVERRIDE { return grid->GetColAt(pos); } - virtual int GetLinePos(const wxGrid *grid, int line) const + virtual int GetLinePos(const wxGrid *grid, int line) const wxOVERRIDE { return grid->GetColPos(line); } - virtual int GetLineBefore(const wxGrid* grid, int line) const + virtual int GetLineBefore(const wxGrid* grid, int line) const wxOVERRIDE { int posBefore = grid->GetColPos(line) - 1; return posBefore >= 0 ? grid->GetColAt(posBefore) : wxNOT_FOUND; } - virtual wxWindow *GetHeaderWindow(wxGrid *grid) const + virtual wxWindow *GetHeaderWindow(wxGrid *grid) const wxOVERRIDE { return grid->GetGridColLabelWindow(); } - virtual int GetHeaderWindowSize(wxGrid *grid) const + virtual int GetHeaderWindowSize(wxGrid *grid) const wxOVERRIDE { return grid->GetColLabelSize(); } }; @@ -787,7 +787,7 @@ public: { } - virtual bool IsAtBoundary(const wxGridCellCoords& coords) const + virtual bool IsAtBoundary(const wxGridCellCoords& coords) const wxOVERRIDE { wxASSERT_MSG( m_oper.Select(coords) >= 0, "invalid row/column" ); @@ -808,7 +808,7 @@ public: return true; } - virtual void Advance(wxGridCellCoords& coords) const + virtual void Advance(wxGridCellCoords& coords) const wxOVERRIDE { int pos = GetLinePos(coords); for ( ;; ) @@ -825,7 +825,7 @@ public: } } - virtual int MoveByPixelDistance(int line, int distance) const + virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE { int pos = m_oper.GetLineStartPos(m_grid, line); return m_oper.PosToLine(m_grid, pos - distance + 1, true); @@ -843,7 +843,7 @@ public: { } - virtual bool IsAtBoundary(const wxGridCellCoords& coords) const + virtual bool IsAtBoundary(const wxGridCellCoords& coords) const wxOVERRIDE { wxASSERT_MSG( m_oper.Select(coords) < m_numLines, "invalid row/column" ); @@ -858,7 +858,7 @@ public: return true; } - virtual void Advance(wxGridCellCoords& coords) const + virtual void Advance(wxGridCellCoords& coords) const wxOVERRIDE { int pos = GetLinePos(coords); for ( ;; ) @@ -875,7 +875,7 @@ public: } } - virtual int MoveByPixelDistance(int line, int distance) const + virtual int MoveByPixelDistance(int line, int distance) const wxOVERRIDE { int pos = m_oper.GetLineStartPos(m_grid, line); return m_oper.PosToLine(m_grid, pos + distance, true); diff --git a/Externals/wxWidgets3/include/wx/generic/private/listctrl.h b/Externals/wxWidgets3/include/wx/generic/private/listctrl.h index 32afaada6f..9cd50707a8 100644 --- a/Externals/wxWidgets3/include/wx/generic/private/listctrl.h +++ b/Externals/wxWidgets3/include/wx/generic/private/listctrl.h @@ -200,6 +200,8 @@ public: // is this item selected? [NB: not used in virtual mode] bool m_highlighted; + bool m_checked; + // back pointer to the list ctrl wxListMainWindow *m_owner; @@ -249,6 +251,9 @@ public: void SetImage( int index, int image ); int GetImage( int index ) const; + void Check(bool check) { m_checked = check; } + bool IsChecked() { return m_checked; } + bool HasImage() const { return GetImage() != -1; } bool HasText() const { return !GetText(0).empty(); } @@ -349,7 +354,7 @@ public: virtual ~wxListHeaderWindow(); // We never need focus as we don't have any keyboard interface. - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } void DrawCurrent(); void AdjustDC( wxDC& dc ); @@ -365,7 +370,7 @@ public: int m_colToSend; int m_widthToSend; - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; private: // common part of all ctors @@ -375,7 +380,7 @@ private: // it wasn't vetoed, i.e. if we should proceed bool SendListEvent(wxEventType type, const wxPoint& pos); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; //----------------------------------------------------------------------------- @@ -389,7 +394,7 @@ private: public: wxListRenameTimer( wxListMainWindow *owner ); - void Notify(); + void Notify() wxOVERRIDE; }; //----------------------------------------------------------------------------- @@ -407,7 +412,7 @@ public: { } - virtual void Notify(); + virtual void Notify() wxOVERRIDE; private: wxListMainWindow *m_owner; @@ -458,7 +463,7 @@ private: size_t m_itemEdited; bool m_aboutToFinish; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; //----------------------------------------------------------------------------- @@ -564,6 +569,9 @@ public: // start editing the label of the given item wxTextCtrl *EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); + + bool EndEditLabel(bool cancel); + wxTextCtrl *GetEditControl() const { return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL; @@ -633,6 +641,11 @@ public: bool GetItemPosition( long item, wxPoint& pos ) const; int GetSelectedItemCount() const; + bool HasCheckboxes() const; + bool EnableCheckboxes(bool enable = true); + bool IsItemChecked(long item) const; + void CheckItem(long item, bool check); + wxString GetItemText(long item, int col = 0) const { wxListItem info; @@ -691,7 +704,7 @@ public: const wxPoint& point = wxDefaultPosition ); // override base class virtual to reset m_lineHeight when the font changes - virtual bool SetFont(const wxFont& font) + virtual bool SetFont(const wxFont& font) wxOVERRIDE { if ( !wxWindow::SetFont(font) ) return false; @@ -721,7 +734,7 @@ public: return m_hasFocus ? m_highlightBrush : m_highlightUnfocusedBrush; } - bool HasFocus() const + bool HasFocus() const wxOVERRIDE { return m_hasFocus; } @@ -776,8 +789,10 @@ protected: m_lineBeforeLastClicked, m_lineSelectSingleOnUp; + bool m_hasCheckboxes; + protected: - wxWindow *GetMainWindowOfCompositeControl() { return GetParent(); } + wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { return GetParent(); } // the total count of items in a virtual list control size_t m_countVirt; @@ -835,6 +850,10 @@ private: // Compute the minimal width needed to fully display the column header. int ComputeMinHeaderWidth(const wxListHeaderData* header) const; + // Check if the given point is inside the checkbox of this item. + // + // Always returns false if there are no checkboxes. + bool IsInsideCheckbox(long item, int x, int y); // the height of one line using the current font wxCoord m_lineHeight; @@ -857,9 +876,10 @@ private: wxListTextCtrlWrapper *m_textctrlWrapper; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); friend class wxGenericListCtrl; + friend class wxListCtrlMaxWidthCalculator; }; #endif // wxUSE_LISTCTRL diff --git a/Externals/wxWidgets3/include/wx/generic/private/notifmsg.h b/Externals/wxWidgets3/include/wx/generic/private/notifmsg.h new file mode 100644 index 0000000000..6c5fd90874 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/private/notifmsg.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/notifmsg.h +// Purpose: wxGenericNotificationMessage declarations +// Author: Tobias Taschner +// Created: 2015-08-04 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_NOTIFMSG_H_ +#define _WX_GENERIC_PRIVATE_NOTIFMSG_H_ + +#include "wx/private/notifmsg.h" + +class wxGenericNotificationMessageImpl : public wxNotificationMessageImpl +{ +public: + wxGenericNotificationMessageImpl(wxNotificationMessageBase* notification); + + virtual ~wxGenericNotificationMessageImpl(); + + virtual bool Show(int timeout) wxOVERRIDE; + + virtual bool Close() wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE; + + virtual void SetMessage(const wxString& message) wxOVERRIDE; + + virtual void SetParent(wxWindow *parent) wxOVERRIDE; + + virtual void SetFlags(int flags) wxOVERRIDE; + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE; + + virtual bool AddAction(wxWindowID actionid, const wxString &label) wxOVERRIDE; + + // get/set the default timeout (used if Timeout_Auto is specified) + static int GetDefaultTimeout() { return ms_timeout; } + static void SetDefaultTimeout(int timeout); + +private: + // default timeout + static int ms_timeout; + + // notification message is represented by a frame in this implementation + class wxNotificationMessageWindow *m_window; + + wxDECLARE_NO_COPY_CLASS(wxGenericNotificationMessageImpl); +}; + +#endif // _WX_GENERIC_PRIVATE_NOTIFMSG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/private/widthcalc.h b/Externals/wxWidgets3/include/wx/generic/private/widthcalc.h new file mode 100644 index 0000000000..cacfbf85f0 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/generic/private/widthcalc.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/widthcalc.h +// Purpose: wxMaxWidthCalculatorBase helper class. +// Author: Václav Slavík, Kinaou Hervé +// Copyright: (c) 2015 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_WIDTHCALC_H_ +#define _WX_GENERIC_PRIVATE_WIDTHCALC_H_ + +#include "wx/defs.h" + +#if wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#include "wx/log.h" +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxMaxWidthCalculatorBase: base class for calculating max column width +// ---------------------------------------------------------------------------- + +class wxMaxWidthCalculatorBase +{ +public: + // column of which calculate the width + explicit wxMaxWidthCalculatorBase(size_t column) + : m_column(column), + m_width(0) + { + } + + void UpdateWithWidth(int width) + { + m_width = wxMax(m_width, width); + } + + // Update the max with for the expected row + virtual void UpdateWithRow(int row) = 0; + + int GetMaxWidth() const { return m_width; } + size_t GetColumn() const { return m_column; } + + void + ComputeBestColumnWidth(size_t count, + size_t first_visible, + size_t last_visible) + { + // The code below deserves some explanation. For very large controls, we + // simply can't afford to calculate sizes for all items, it takes too + // long. So the best we can do is to check the first and the last N/2 + // items in the control for some sufficiently large N and calculate best + // sizes from that. That can result in the calculated best width being too + // small for some outliers, but it's better to get slightly imperfect + // result than to wait several seconds after every update. To avoid highly + // visible miscalculations, we also include all currently visible items + // no matter what. Finally, the value of N is determined dynamically by + // measuring how much time we spent on the determining item widths so far. + +#if wxUSE_STOPWATCH + size_t top_part_end = count; + static const long CALC_TIMEOUT = 20/*ms*/; + // don't call wxStopWatch::Time() too often + static const unsigned CALC_CHECK_FREQ = 100; + wxStopWatch timer; +#else + // use some hard-coded limit, that's the best we can do without timer + size_t top_part_end = wxMin(500, count); +#endif // wxUSE_STOPWATCH/!wxUSE_STOPWATCH + + size_t row = 0; + + for ( row = 0; row < top_part_end; row++ ) + { +#if wxUSE_STOPWATCH + if ( row % CALC_CHECK_FREQ == CALC_CHECK_FREQ-1 && + timer.Time() > CALC_TIMEOUT ) + break; +#endif // wxUSE_STOPWATCH + UpdateWithRow(row); + } + + // row is the first unmeasured item now; that's our value of N/2 + if ( row < count ) + { + top_part_end = row; + + // add bottom N/2 items now: + const size_t bottom_part_start = wxMax(row, count - row); + for ( row = bottom_part_start; row < count; row++ ) + { + UpdateWithRow(row); + } + + // finally, include currently visible items in the calculation: + first_visible = wxMax(first_visible, top_part_end); + last_visible = wxMin(bottom_part_start, last_visible); + + for ( row = first_visible; row < last_visible; row++ ) + { + UpdateWithRow(row); + } + + wxLogTrace("items container", + "determined best size from %zu top, %zu bottom " + "plus %zu more visible items out of %zu total", + top_part_end, + count - bottom_part_start, + last_visible - first_visible, + count); + } + } + +private: + const size_t m_column; + int m_width; + + wxDECLARE_NO_COPY_CLASS(wxMaxWidthCalculatorBase); +}; + +#endif // wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#endif // _WX_GENERIC_PRIVATE_WIDTHCALC_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/prntdlgg.h b/Externals/wxWidgets3/include/wx/generic/prntdlgg.h index 6c8f7bd5a7..7c4cd1b7fe 100644 --- a/Externals/wxWidgets3/include/wx/generic/prntdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/prntdlgg.h @@ -83,11 +83,11 @@ public: wxPostScriptPrintNativeData(); virtual ~wxPostScriptPrintNativeData(); - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return true; } + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE { return true; } const wxString& GetPrinterCommand() const { return m_printerCommand; } const wxString& GetPrinterOptions() const { return m_printerOptions; } @@ -128,7 +128,7 @@ private: #endif private: - DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) + wxDECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData); }; // ---------------------------------------------------------------------------- @@ -149,16 +149,16 @@ public: void OnRange(wxCommandEvent& event); void OnOK(wxCommandEvent& event); - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; - wxPrintData& GetPrintData() + wxPrintData& GetPrintData() wxOVERRIDE { return m_printDialogData.GetPrintData(); } - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - wxDC *GetPrintDC(); + wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } + wxDC *GetPrintDC() wxOVERRIDE; public: // wxStaticText* m_printerMessage; @@ -177,8 +177,8 @@ protected: void Init(wxWindow *parent); private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericPrintDialog); }; class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog @@ -193,8 +193,8 @@ public: void OnPrinter(wxListEvent& event); - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; virtual wxComboBox *CreatePaperTypeChoice(); @@ -213,8 +213,8 @@ public: wxPrintData* m_targetData; private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGenericPrintSetupDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGenericPrintSetupDialog); }; #endif // wxUSE_POSTSCRIPT @@ -226,10 +226,10 @@ public: wxPageSetupDialogData* data = NULL); virtual ~wxGenericPageSetupDialog(); - virtual bool TransferDataFromWindow(); - virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow() wxOVERRIDE; + virtual bool TransferDataToWindow() wxOVERRIDE; - virtual wxPageSetupDialogData& GetPageSetupDialogData(); + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE; void OnPrinter(wxCommandEvent& event); wxComboBox *CreatePaperTypeChoice(int* x, int* y); @@ -246,8 +246,8 @@ public: wxPageSetupDialogData m_pageData; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog); }; #endif diff --git a/Externals/wxWidgets3/include/wx/generic/progdlgg.h b/Externals/wxWidgets3/include/wx/generic/progdlgg.h index d29452f1f0..77b90f76f4 100644 --- a/Externals/wxWidgets3/include/wx/generic/progdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/progdlgg.h @@ -57,9 +57,9 @@ public: bool WasSkipped() const; // Must provide overload to avoid hiding it (and warnings about it) - virtual void Update() { wxDialog::Update(); } + virtual void Update() wxOVERRIDE { wxDialog::Update(); } - virtual bool Show( bool show = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; // This enum is an implementation detail and should not be used // by user code. @@ -134,7 +134,7 @@ protected: // the maximum value int m_maximum; -#if defined(__WXMSW__ ) || defined(__WXPM__) +#if defined(__WXMSW__) // the factor we use to always keep the value in 16 bit range as the native // control only supports ranges from 0 to 65,535 size_t m_factor; @@ -195,11 +195,9 @@ private: // skip some portion bool m_skip; -#if !defined(__SMARTPHONE__) // the abort and skip buttons (or NULL if none) wxButton *m_btnAbort; wxButton *m_btnSkip; -#endif // saves the time when elapsed time was updated so there is only one // update per second @@ -222,7 +220,7 @@ private: wxEventLoop *m_tempEventLoop; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGenericProgressDialog); }; diff --git a/Externals/wxWidgets3/include/wx/generic/propdlg.h b/Externals/wxWidgets3/include/wx/generic/propdlg.h index 6cb63efad9..5072dfdf0a 100644 --- a/Externals/wxWidgets3/include/wx/generic/propdlg.h +++ b/Externals/wxWidgets3/include/wx/generic/propdlg.h @@ -21,11 +21,8 @@ class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase; //----------------------------------------------------------------------------- // wxPropertySheetDialog -// A platform-independent properties dialog. -// -// * on PocketPC, a flat-look 'property sheet' notebook will be used, with -// no OK/Cancel/Help buttons -// * on other platforms, a normal notebook will be used, with standard buttons +// A platform-independent properties dialog with a notebook and standard +// buttons. // // To use this class, call Create from your derived class. // Then create pages and add to the book control. Finally call CreateButtons and @@ -106,7 +103,7 @@ public: wxBookCtrlBase* GetBookCtrl() const { return m_bookCtrl; } // Override function in base - virtual wxWindow* GetContentWindow() const; + virtual wxWindow* GetContentWindow() const wxOVERRIDE; // Set and get the inner sizer void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; } @@ -126,7 +123,7 @@ public: /// Operations - // Creates the buttons (none on PocketPC) + // Creates the buttons virtual void CreateButtons(int flags = wxOK|wxCANCEL); // Lay out the dialog, to be called after pages have been created @@ -141,9 +138,6 @@ public: // Adds the book control to the inner sizer. virtual void AddBookCtrl(wxSizer* sizer); - // Set the focus - void OnActivate(wxActivateEvent& event); - // Resize dialog if necessary void OnIdle(wxIdleEvent& event); @@ -158,8 +152,8 @@ protected: int m_sheetInnerBorder; int m_selectedPage; - DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxPropertySheetDialog); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_BOOKCTRL diff --git a/Externals/wxWidgets3/include/wx/generic/richmsgdlgg.h b/Externals/wxWidgets3/include/wx/generic/richmsgdlgg.h index 5446f87fef..ae955d0af0 100644 --- a/Externals/wxWidgets3/include/wx/generic/richmsgdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/richmsgdlgg.h @@ -20,27 +20,27 @@ class WXDLLIMPEXP_CORE wxGenericRichMessageDialog public: wxGenericRichMessageDialog(wxWindow *parent, const wxString& message, - const wxString& caption, - long style) + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK | wxCENTRE) : wxRichMessageDialogBase( parent, message, caption, style ), m_checkBox(NULL), m_detailsPane(NULL) { } - virtual bool IsCheckBoxChecked() const; + virtual bool IsCheckBoxChecked() const wxOVERRIDE; protected: wxCheckBox *m_checkBox; wxCollapsiblePane *m_detailsPane; // overrides methods in the base class - virtual void AddMessageDialogCheckBox(wxSizer *sizer); - virtual void AddMessageDialogDetails(wxSizer *sizer); + virtual void AddMessageDialogCheckBox(wxSizer *sizer) wxOVERRIDE; + virtual void AddMessageDialogDetails(wxSizer *sizer) wxOVERRIDE; private: void OnPaneChanged(wxCollapsiblePaneEvent& event); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxGenericRichMessageDialog); }; diff --git a/Externals/wxWidgets3/include/wx/generic/sashwin.h b/Externals/wxWidgets3/include/wx/generic/sashwin.h index e4f34d8296..44cf8861b4 100644 --- a/Externals/wxWidgets3/include/wx/generic/sashwin.h +++ b/Externals/wxWidgets3/include/wx/generic/sashwin.h @@ -40,15 +40,9 @@ class WXDLLIMPEXP_ADV wxSashEdge public: wxSashEdge() { m_show = false; -#if WXWIN_COMPATIBILITY_2_6 - m_border = false; -#endif m_margin = 0; } bool m_show; // Is the sash showing? -#if WXWIN_COMPATIBILITY_2_6 - bool m_border; // Do we draw a border? -#endif int m_margin; // The margin size }; @@ -97,16 +91,6 @@ public: // Get whether there's a sash in this position bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; } -#if WXWIN_COMPATIBILITY_2_6 - // Set whether there's a border in this position - // This value is unused in wxSashWindow. - void SetSashBorder(wxSashEdgePosition edge, bool border) { m_sashes[edge].m_border = border; } - - // Get whether there's a border in this position - // This value is unused in wxSashWindow. - bool HasBorder(wxSashEdgePosition edge) const { return m_sashes[edge].m_border; } -#endif - // Get border size int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; } @@ -197,8 +181,8 @@ private: wxCursor* m_currentCursor; private: - DECLARE_DYNAMIC_CLASS(wxSashWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxSashWindow); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxSashWindow); }; @@ -240,7 +224,7 @@ public: void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; } wxSashDragStatus GetDragStatus() const { return m_dragStatus; } - virtual wxEvent *Clone() const { return new wxSashEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSashEvent(*this); } private: wxSashEdgePosition m_edge; @@ -248,7 +232,7 @@ private: wxSashDragStatus m_dragStatus; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSashEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSashEvent); }; typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&); diff --git a/Externals/wxWidgets3/include/wx/generic/scrolwin.h b/Externals/wxWidgets3/include/wx/generic/scrolwin.h index 863cdf923e..efcbd0445e 100644 --- a/Externals/wxWidgets3/include/wx/generic/scrolwin.h +++ b/Externals/wxWidgets3/include/wx/generic/scrolwin.h @@ -10,6 +10,8 @@ #ifndef _WX_GENERIC_SCROLLWIN_H_ #define _WX_GENERIC_SCROLLWIN_H_ +#include "wx/recguard.h" + // ---------------------------------------------------------------------------- // generic wxScrollHelper implementation // ---------------------------------------------------------------------------- @@ -45,6 +47,7 @@ private: wxScrollbarVisibility m_xVisibility, m_yVisibility; + wxRecursionGuardFlag m_adjustScrollFlagReentrancy; wxDECLARE_NO_COPY_CLASS(wxScrollHelper); }; diff --git a/Externals/wxWidgets3/include/wx/generic/spinctlg.h b/Externals/wxWidgets3/include/wx/generic/spinctlg.h index a35cc8a4a4..b8c1c73a22 100644 --- a/Externals/wxWidgets3/include/wx/generic/spinctlg.h +++ b/Externals/wxWidgets3/include/wx/generic/spinctlg.h @@ -64,30 +64,27 @@ public: // T GetMin() const // T GetMax() const // T GetIncrement() const - virtual bool GetSnapToTicks() const { return m_snap_to_ticks; } + virtual bool GetSnapToTicks() const wxOVERRIDE { return m_snap_to_ticks; } // unsigned GetDigits() const - wxSpinCtrlDouble only // operations - virtual void SetValue(const wxString& text); + virtual void SetValue(const wxString& text) wxOVERRIDE; // void SetValue(T val) // void SetRange(T minVal, T maxVal) // void SetIncrement(T inc) - virtual void SetSnapToTicks(bool snap_to_ticks); + virtual void SetSnapToTicks(bool snap_to_ticks) wxOVERRIDE; // void SetDigits(unsigned digits) - wxSpinCtrlDouble only // Select text in the textctrl - void SetSelection(long from, long to); + void SetSelection(long from, long to) wxOVERRIDE; // implementation from now on // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif // wxUSE_TOOLTIPS + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Show(bool show = true) wxOVERRIDE; - virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; // get the subcontrols wxTextCtrl *GetText() const { return m_textCtrl; } @@ -101,16 +98,16 @@ public: // this window itself is used only as a container for its sub windows so it // shouldn't accept the focus at all and any attempts to explicitly set // focus to it should give focus to its text constol part - virtual bool AcceptsFocus() const { return false; } - virtual void SetFocus(); + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual void SetFocus() wxOVERRIDE; friend class wxSpinCtrlTextGeneric; protected: // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; - virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; #ifdef __WXMSW__ // and, for MSW, enabling this window itself @@ -168,9 +165,9 @@ private: void Init(); // Implement pure virtual function inherited from wxCompositeWindow. - virtual wxWindowList GetCompositeWindowParts() const; + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #else // !wxUSE_SPINBTN @@ -344,7 +341,7 @@ private: int m_base; - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); }; #endif // wxHAS_NATIVE_SPINCTRL @@ -426,7 +423,7 @@ private: wxString m_format; - DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble) + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble); }; #endif // _WX_GENERIC_SPINCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/splash.h b/Externals/wxWidgets3/include/wx/generic/splash.h index 24ad733d5d..48417bb956 100644 --- a/Externals/wxWidgets3/include/wx/generic/splash.h +++ b/Externals/wxWidgets3/include/wx/generic/splash.h @@ -54,7 +54,7 @@ public: int GetTimeout() const { return m_milliseconds; } // Override wxEventFilter method to hide splash screen on any user input. - virtual int FilterEvent(wxEvent& event); + virtual int FilterEvent(wxEvent& event) wxOVERRIDE; protected: // Common part of all ctors. @@ -65,8 +65,8 @@ protected: int m_milliseconds; wxTimer m_timer; - DECLARE_DYNAMIC_CLASS(wxSplashScreen) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxSplashScreen); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxSplashScreen); }; @@ -88,7 +88,7 @@ public: protected: wxBitmap m_bitmap; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow); }; diff --git a/Externals/wxWidgets3/include/wx/generic/splitter.h b/Externals/wxWidgets3/include/wx/generic/splitter.h index 61128a3959..d45cf54eb7 100644 --- a/Externals/wxWidgets3/include/wx/generic/splitter.h +++ b/Externals/wxWidgets3/include/wx/generic/splitter.h @@ -105,7 +105,7 @@ public: // and changing the split mode. // Does nothing and returns false if the window is already split. // A sashPosition of 0 means choose a default sash position, - // negative sashPosition specifies the size of right/lower pane as it's + // negative sashPosition specifies the size of right/lower pane as its // absolute value rather than the size of left/upper pane. virtual bool SplitVertically(wxWindow *window1, wxWindow *window2, @@ -202,7 +202,7 @@ public: void OnSize(wxSizeEvent& event); // In live mode, resize child windows in idle time - void OnInternalIdle(); + void OnInternalIdle() wxOVERRIDE; // Draws the sash virtual void DrawSash(wxDC& dc); @@ -217,7 +217,7 @@ public: virtual void SizeWindows(); #ifdef __WXMAC__ - virtual bool MacClipGrandChildren() const { return true ; } + virtual bool MacClipGrandChildren() const wxOVERRIDE { return true ; } #endif // Sets the sash size: this doesn't do anything and shouldn't be used at @@ -274,7 +274,7 @@ protected: // return the best size of the splitter equal to best sizes of its // subwindows - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; wxSplitMode m_splitMode; @@ -301,8 +301,8 @@ protected: bool m_isHot:1; private: - DECLARE_DYNAMIC_CLASS(wxSplitterWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxSplitterWindow); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxSplitterWindow); }; @@ -370,7 +370,7 @@ public: return m_data.pt.y; } - virtual wxEvent *Clone() const { return new wxSplitterEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSplitterEvent(*this); } private: friend class WXDLLIMPEXP_FWD_CORE wxSplitterWindow; @@ -386,7 +386,7 @@ private: } pt; // position of double click for DCLICK event } m_data; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSplitterEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSplitterEvent); }; typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&); diff --git a/Externals/wxWidgets3/include/wx/generic/srchctlg.h b/Externals/wxWidgets3/include/wx/generic/srchctlg.h index c61ddee751..3eb8d21c92 100644 --- a/Externals/wxWidgets3/include/wx/generic/srchctlg.h +++ b/Externals/wxWidgets3/include/wx/generic/srchctlg.h @@ -49,17 +49,17 @@ public: #if wxUSE_MENUS // get/set search button menu // -------------------------- - virtual void SetMenu( wxMenu* menu ); - virtual wxMenu* GetMenu(); + virtual void SetMenu( wxMenu* menu ) wxOVERRIDE; + virtual wxMenu* GetMenu() wxOVERRIDE; #endif // wxUSE_MENUS // get/set search options // ---------------------- - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; + virtual void ShowSearchButton( bool show ) wxOVERRIDE; + virtual bool IsSearchButtonVisible() const wxOVERRIDE; - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; + virtual void ShowCancelButton( bool show ) wxOVERRIDE; + virtual bool IsCancelButtonVisible() const wxOVERRIDE; // TODO: In 2.9 these should probably be virtual, and declared in the base class... void SetDescriptiveText(const wxString& text); @@ -68,48 +68,48 @@ public: // accessors // --------- - virtual wxString GetRange(long from, long to) const; + virtual wxString GetRange(long from, long to) const wxOVERRIDE; - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; - virtual bool IsModified() const; - virtual bool IsEditable() const; + virtual bool IsModified() const wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; // more readable flag testing methods virtual bool IsSingleLine() const; virtual bool IsMultiLine() const; // If the return values from and to are the same, there is no selection. - virtual void GetSelection(long* from, long* to) const; + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; - virtual wxString GetStringSelection() const; + virtual wxString GetStringSelection() const wxOVERRIDE; // operations // ---------- // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); + virtual void Clear() wxOVERRIDE; + virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; // load/save the controls contents from/to the file virtual bool LoadFile(const wxString& file); virtual bool SaveFile(const wxString& file = wxEmptyString); // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; // set the max number of characters which may be entered in a single line // text control - virtual void SetMaxLength(unsigned long WXUNUSED(len)); + virtual void SetMaxLength(unsigned long WXUNUSED(len)) wxOVERRIDE; // writing text inserts it at the current position, appending always // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void AppendText(const wxString& text) wxOVERRIDE; // insert the character which would have resulted from this key event, // return true if anything has been inserted @@ -118,53 +118,53 @@ public: // text control under some platforms supports the text styles: these // methods allow to apply the given text style to the given selection or to // set/get the style which will be used for all appended text - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); - virtual const wxTextAttr& GetDefaultStyle() const; + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; + virtual const wxTextAttr& GetDefaultStyle() const wxOVERRIDE; // translate between the position (which is just an index in the text ctrl // considering all its contents as a single strings) and (x, y) coordinates // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; - virtual void ShowPosition(long pos); + virtual void ShowPosition(long pos) wxOVERRIDE; // find the character at position given in pixels // // NB: pt is in device coords (not adjusted for the client area origin nor // scrolling) - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, - wxTextCoord *row) const; + wxTextCoord *row) const wxOVERRIDE; // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; // Undo/redo - virtual void Undo(); - virtual void Redo(); + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; - virtual bool CanUndo() const; - virtual bool CanRedo() const; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual void SetInsertionPointEnd() wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; - virtual void SetSelection(long from, long to); - virtual void SelectAll(); - virtual void SetEditable(bool editable); + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; #if 0 @@ -180,17 +180,17 @@ public: wxTextCtrl& operator<<(long i); wxTextCtrl& operator<<(float f); wxTextCtrl& operator<<(double d); - wxTextCtrl& operator<<(const wxChar c); + wxTextCtrl& operator<<(wxChar c); #endif // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE; - virtual bool ShouldInheritColours() const; + virtual bool ShouldInheritColours() const wxOVERRIDE; // wxWindow overrides - virtual bool SetFont(const wxFont& font); - virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetFont(const wxFont& font) wxOVERRIDE; + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; // search control generic only void SetSearchBitmap( const wxBitmap& bitmap ); @@ -200,16 +200,15 @@ public: #endif // wxUSE_MENUS protected: - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const; + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool DoSaveFile(const wxString& file, int fileType); + virtual bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE; + virtual bool DoSaveFile(const wxString& file, int fileType) wxOVERRIDE; // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void LayoutControls(int x, int y, int width, int height); + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; virtual void RecalcBitmaps(); @@ -236,7 +235,10 @@ private: friend class wxSearchButton; // Implement pure virtual function inherited from wxCompositeWindow. - virtual wxWindowList GetCompositeWindowParts() const; + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; + + // Position the child controls using the current window size. + void LayoutControls(); #if wxUSE_MENUS void PopupSearchMenu(); @@ -266,9 +268,9 @@ private: #endif // wxUSE_MENUS private: - DECLARE_DYNAMIC_CLASS(wxSearchCtrl) + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_SEARCHCTRL diff --git a/Externals/wxWidgets3/include/wx/generic/statbmpg.h b/Externals/wxWidgets3/include/wx/generic/statbmpg.h index f3d198df4e..e915473420 100644 --- a/Externals/wxWidgets3/include/wx/generic/statbmpg.h +++ b/Externals/wxWidgets3/include/wx/generic/statbmpg.h @@ -35,16 +35,16 @@ public: long style = 0, const wxString& name = wxStaticBitmapNameStr); - virtual void SetBitmap(const wxBitmap& bitmap) + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE { m_bitmap = bitmap; SetInitialSize(GetBitmapSize()); Refresh(); } - virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; } - virtual void SetIcon(const wxIcon& icon) + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE { m_bitmap.CopyFromIcon(icon); SetInitialSize(GetBitmapSize()); @@ -53,9 +53,16 @@ public: #if defined(__WXGTK20__) || defined(__WXMAC__) // icons and bitmaps are really the same thing in wxGTK and wxMac - wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; } + wxIcon GetIcon() const wxOVERRIDE { return (const wxIcon &)m_bitmap; } #endif + virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE + { + m_scaleMode = scaleMode; + Refresh(); + } + + virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; } private: wxSize GetBitmapSize() @@ -67,8 +74,9 @@ private: void OnPaint(wxPaintEvent& event); wxBitmap m_bitmap; + ScaleMode m_scaleMode; - DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap) + wxDECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap); }; diff --git a/Externals/wxWidgets3/include/wx/generic/statline.h b/Externals/wxWidgets3/include/wx/generic/statline.h index 8a7ccbf088..5cd06f3714 100644 --- a/Externals/wxWidgets3/include/wx/generic/statline.h +++ b/Externals/wxWidgets3/include/wx/generic/statline.h @@ -18,7 +18,7 @@ class wxStaticBox; class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase { - DECLARE_DYNAMIC_CLASS(wxStaticLine) + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); public: // constructors and pseudo-constructors diff --git a/Externals/wxWidgets3/include/wx/generic/stattextg.h b/Externals/wxWidgets3/include/wx/generic/stattextg.h index 918a4f4eb3..2a85d99c17 100644 --- a/Externals/wxWidgets3/include/wx/generic/stattextg.h +++ b/Externals/wxWidgets3/include/wx/generic/stattextg.h @@ -48,19 +48,19 @@ public: // overridden base class virtual methods - virtual void SetLabel(const wxString& label); - virtual bool SetFont(const wxFont &font); + virtual void SetLabel(const wxString& label) wxOVERRIDE; + virtual bool SetFont(const wxFont &font) wxOVERRIDE; protected: - virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; - virtual wxString DoGetLabel() const { return m_label; } - virtual void DoSetLabel(const wxString& label); + virtual wxString DoGetLabel() const wxOVERRIDE { return m_label; } + virtual void DoSetLabel(const wxString& label) wxOVERRIDE; - void DoSetSize(int x, int y, int width, int height, int sizeFlags); + void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; #if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; #endif // wxUSE_MARKUP private: @@ -83,7 +83,7 @@ private: class wxMarkupText *m_markupText; #endif // wxUSE_MARKUP - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText); }; #endif // _WX_GENERIC_STATTEXTG_H_ diff --git a/Externals/wxWidgets3/include/wx/generic/statusbr.h b/Externals/wxWidgets3/include/wx/generic/statusbr.h index bff20807e3..6d0edd6ec2 100644 --- a/Externals/wxWidgets3/include/wx/generic/statusbr.h +++ b/Externals/wxWidgets3/include/wx/generic/statusbr.h @@ -44,12 +44,12 @@ public: const wxString& name = wxStatusBarNameStr); // implement base class methods - virtual void SetStatusWidths(int n, const int widths_field[]); - virtual bool GetFieldRect(int i, wxRect& rect) const; - virtual void SetMinHeight(int height); + virtual void SetStatusWidths(int n, const int widths_field[]) wxOVERRIDE; + virtual bool GetFieldRect(int i, wxRect& rect) const wxOVERRIDE; + virtual void SetMinHeight(int height) wxOVERRIDE; - virtual int GetBorderX() const { return m_borderX; } - virtual int GetBorderY() const { return m_borderY; } + virtual int GetBorderX() const wxOVERRIDE { return m_borderX; } + virtual int GetBorderY() const wxOVERRIDE { return m_borderY; } // implementation only (not part of wxStatusBar public API): @@ -57,7 +57,7 @@ public: int GetFieldFromPoint(const wxPoint& point) const; protected: - virtual void DoUpdateStatusText(int number); + virtual void DoUpdateStatusText(int number) wxOVERRIDE; // event handlers void OnPaint(wxPaintEvent& event); @@ -103,14 +103,14 @@ protected: wxPen m_mediumShadowPen; wxPen m_hilightPen; - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: // Update m_lastClientSize and m_widthsAbs from the current size. void DoUpdateFieldWidths(); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric); }; #endif // wxUSE_STATUSBAR diff --git a/Externals/wxWidgets3/include/wx/generic/tabg.h b/Externals/wxWidgets3/include/wx/generic/tabg.h index d376b3b510..c9c4fe6021 100644 --- a/Externals/wxWidgets3/include/wx/generic/tabg.h +++ b/Externals/wxWidgets3/include/wx/generic/tabg.h @@ -28,7 +28,7 @@ class WXDLLIMPEXP_FWD_CORE wxTabView; class WXDLLIMPEXP_CORE wxTabControl: public wxObject { -DECLARE_DYNAMIC_CLASS(wxTabControl) + wxDECLARE_DYNAMIC_CLASS(wxTabControl); public: wxTabControl(wxTabView *v = NULL); virtual ~wxTabControl(void); @@ -95,7 +95,7 @@ WX_DECLARE_LIST(wxTabLayer, wxTabLayerList); class WXDLLIMPEXP_CORE wxTabView: public wxObject { -DECLARE_DYNAMIC_CLASS(wxTabView) + wxDECLARE_DYNAMIC_CLASS(wxTabView); public: wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); virtual ~wxTabView(); @@ -267,7 +267,7 @@ protected: class WXDLLIMPEXP_CORE wxTabbedDialog : public wxDialog { - DECLARE_DYNAMIC_CLASS(wxTabbedDialog) + wxDECLARE_DYNAMIC_CLASS(wxTabbedDialog); public: wxTabbedDialog(wxWindow *parent, @@ -290,7 +290,7 @@ protected: wxTabView* m_tabView; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; /* @@ -299,7 +299,7 @@ private: class WXDLLIMPEXP_CORE wxTabbedPanel : public wxPanel { - DECLARE_DYNAMIC_CLASS(wxTabbedPanel) + wxDECLARE_DYNAMIC_CLASS(wxTabbedPanel); public: wxTabbedPanel(wxWindow *parent, @@ -320,7 +320,7 @@ protected: wxTabView* m_tabView; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; WX_DECLARE_HASH_MAP(int, wxWindow*, wxIntegerHash, wxIntegerEqual, @@ -328,7 +328,7 @@ WX_DECLARE_HASH_MAP(int, wxWindow*, wxIntegerHash, wxIntegerEqual, class WXDLLIMPEXP_CORE wxPanelTabView : public wxTabView { - DECLARE_DYNAMIC_CLASS(wxPanelTabView) + wxDECLARE_DYNAMIC_CLASS(wxPanelTabView); public: wxPanelTabView(wxPanel *pan, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); diff --git a/Externals/wxWidgets3/include/wx/generic/textdlgg.h b/Externals/wxWidgets3/include/wx/generic/textdlgg.h index 023d497c30..a3749844fd 100644 --- a/Externals/wxWidgets3/include/wx/generic/textdlgg.h +++ b/Externals/wxWidgets3/include/wx/generic/textdlgg.h @@ -27,7 +27,7 @@ class WXDLLIMPEXP_FWD_CORE wxTextCtrl; extern WXDLLIMPEXP_DATA_CORE(const char) wxGetTextFromUserPromptStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxGetPasswordFromUserPromptStr[]; -#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY) +#define wxTextEntryDialogStyle (wxOK | wxCANCEL | wxCENTRE) // ---------------------------------------------------------------------------- // wxTextEntryDialog: a dialog with text control, [ok] and [cancel] buttons @@ -63,6 +63,8 @@ public: void SetMaxLength(unsigned long len); + void ForceUpper(); + #if wxUSE_VALIDATORS void SetTextValidator( const wxTextValidator& validator ); #if WXWIN_COMPATIBILITY_2_8 @@ -72,8 +74,8 @@ public: wxTextValidator* GetTextValidator() { return (wxTextValidator*)m_textctrl->GetValidator(); } #endif // wxUSE_VALIDATORS - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; // implementation only void OnOK(wxCommandEvent& event); @@ -84,8 +86,8 @@ protected: long m_dialogStyle; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxTextEntryDialog) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextEntryDialog); wxDECLARE_NO_COPY_CLASS(wxTextEntryDialog); }; @@ -96,14 +98,27 @@ private: class WXDLLIMPEXP_CORE wxPasswordEntryDialog : public wxTextEntryDialog { public: + wxPasswordEntryDialog() { } wxPasswordEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxGetPasswordFromUserPromptStr, const wxString& value = wxEmptyString, long style = wxTextEntryDialogStyle, - const wxPoint& pos = wxDefaultPosition); + const wxPoint& pos = wxDefaultPosition) + { + Create(parent, message, caption, value, style, pos); + } + + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption = wxGetPasswordFromUserPromptStr, + const wxString& value = wxEmptyString, + long style = wxTextEntryDialogStyle, + const wxPoint& pos = wxDefaultPosition); + + private: - DECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog) + wxDECLARE_DYNAMIC_CLASS(wxPasswordEntryDialog); wxDECLARE_NO_COPY_CLASS(wxPasswordEntryDialog); }; diff --git a/Externals/wxWidgets3/include/wx/generic/treectlg.h b/Externals/wxWidgets3/include/wx/generic/treectlg.h index 53b3942835..4fec700066 100644 --- a/Externals/wxWidgets3/include/wx/generic/treectlg.h +++ b/Externals/wxWidgets3/include/wx/generic/treectlg.h @@ -67,74 +67,74 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual unsigned int GetCount() const; + virtual unsigned int GetCount() const wxOVERRIDE; - virtual unsigned int GetIndent() const { return m_indent; } - virtual void SetIndent(unsigned int indent); + virtual unsigned int GetIndent() const wxOVERRIDE { return m_indent; } + virtual void SetIndent(unsigned int indent) wxOVERRIDE; - virtual void SetImageList(wxImageList *imageList); - virtual void SetStateImageList(wxImageList *imageList); + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; + virtual void SetStateImageList(wxImageList *imageList) wxOVERRIDE; - virtual wxString GetItemText(const wxTreeItemId& item) const; + virtual wxString GetItemText(const wxTreeItemId& item) const wxOVERRIDE; virtual int GetItemImage(const wxTreeItemId& item, - wxTreeItemIcon which = wxTreeItemIcon_Normal) const; - virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const; - virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; - virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; - virtual wxFont GetItemFont(const wxTreeItemId& item) const; + wxTreeItemIcon which = wxTreeItemIcon_Normal) const wxOVERRIDE; + virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemTextColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxFont GetItemFont(const wxTreeItemId& item) const wxOVERRIDE; - virtual void SetItemText(const wxTreeItemId& item, const wxString& text); + virtual void SetItemText(const wxTreeItemId& item, const wxString& text) wxOVERRIDE; virtual void SetItemImage(const wxTreeItemId& item, int image, - wxTreeItemIcon which = wxTreeItemIcon_Normal); - virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + wxTreeItemIcon which = wxTreeItemIcon_Normal) wxOVERRIDE; + virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) wxOVERRIDE; - virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true); - virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); - virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true); - virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); - virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); + virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true) wxOVERRIDE; + virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) wxOVERRIDE; + virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true) wxOVERRIDE; + virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col) wxOVERRIDE; + virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) wxOVERRIDE; - virtual bool IsVisible(const wxTreeItemId& item) const; - virtual bool ItemHasChildren(const wxTreeItemId& item) const; - virtual bool IsExpanded(const wxTreeItemId& item) const; - virtual bool IsSelected(const wxTreeItemId& item) const; - virtual bool IsBold(const wxTreeItemId& item) const; + virtual bool IsVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool ItemHasChildren(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsExpanded(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsSelected(const wxTreeItemId& item) const wxOVERRIDE; + virtual bool IsBold(const wxTreeItemId& item) const wxOVERRIDE; virtual size_t GetChildrenCount(const wxTreeItemId& item, - bool recursively = true) const; + bool recursively = true) const wxOVERRIDE; // navigation // ---------- - virtual wxTreeItemId GetRootItem() const { return m_anchor; } - virtual wxTreeItemId GetSelection() const + virtual wxTreeItemId GetRootItem() const wxOVERRIDE { return m_anchor; } + virtual wxTreeItemId GetSelection() const wxOVERRIDE { wxASSERT_MSG( !HasFlag(wxTR_MULTIPLE), wxT("must use GetSelections() with this control") ); return m_current; } - virtual size_t GetSelections(wxArrayTreeItemIds&) const; - virtual wxTreeItemId GetFocusedItem() const { return m_current; } + virtual size_t GetSelections(wxArrayTreeItemIds&) const wxOVERRIDE; + virtual wxTreeItemId GetFocusedItem() const wxOVERRIDE { return m_current; } - virtual void ClearFocusedItem(); - virtual void SetFocusedItem(const wxTreeItemId& item); + virtual void ClearFocusedItem() wxOVERRIDE; + virtual void SetFocusedItem(const wxTreeItemId& item) wxOVERRIDE; - virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; + virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const wxOVERRIDE; virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; + wxTreeItemIdValue& cookie) const wxOVERRIDE; virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, - wxTreeItemIdValue& cookie) const; - virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; - virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + wxTreeItemIdValue& cookie) const wxOVERRIDE; + virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const wxOVERRIDE; - virtual wxTreeItemId GetFirstVisibleItem() const; - virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; - virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + virtual wxTreeItemId GetFirstVisibleItem() const wxOVERRIDE; + virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const wxOVERRIDE; + virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const wxOVERRIDE; // operations @@ -142,41 +142,41 @@ public: virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, int selectedImage = -1, - wxTreeItemData *data = NULL); + wxTreeItemData *data = NULL) wxOVERRIDE; - virtual void Delete(const wxTreeItemId& item); - virtual void DeleteChildren(const wxTreeItemId& item); - virtual void DeleteAllItems(); + virtual void Delete(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteChildren(const wxTreeItemId& item) wxOVERRIDE; + virtual void DeleteAllItems() wxOVERRIDE; - virtual void Expand(const wxTreeItemId& item); - virtual void Collapse(const wxTreeItemId& item); - virtual void CollapseAndReset(const wxTreeItemId& item); - virtual void Toggle(const wxTreeItemId& item); + virtual void Expand(const wxTreeItemId& item) wxOVERRIDE; + virtual void Collapse(const wxTreeItemId& item) wxOVERRIDE; + virtual void CollapseAndReset(const wxTreeItemId& item) wxOVERRIDE; + virtual void Toggle(const wxTreeItemId& item) wxOVERRIDE; - virtual void Unselect(); - virtual void UnselectAll(); - virtual void SelectItem(const wxTreeItemId& item, bool select = true); - virtual void SelectChildren(const wxTreeItemId& parent); + virtual void Unselect() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; + virtual void SelectItem(const wxTreeItemId& item, bool select = true) wxOVERRIDE; + virtual void SelectChildren(const wxTreeItemId& parent) wxOVERRIDE; - virtual void EnsureVisible(const wxTreeItemId& item); - virtual void ScrollTo(const wxTreeItemId& item); + virtual void EnsureVisible(const wxTreeItemId& item) wxOVERRIDE; + virtual void ScrollTo(const wxTreeItemId& item) wxOVERRIDE; virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, - wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)); - virtual wxTextCtrl *GetEditControl() const; + wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl)) wxOVERRIDE; + virtual wxTextCtrl *GetEditControl() const wxOVERRIDE; virtual void EndEditLabel(const wxTreeItemId& item, - bool discardChanges = false); + bool discardChanges = false) wxOVERRIDE; - virtual void EnableBellOnNoMatch(bool on = true); + virtual void EnableBellOnNoMatch(bool on = true) wxOVERRIDE; - virtual void SortChildren(const wxTreeItemId& item); + virtual void SortChildren(const wxTreeItemId& item) wxOVERRIDE; // items geometry // -------------- virtual bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, - bool textOnly = false) const; + bool textOnly = false) const wxOVERRIDE; // this version specific methods @@ -191,21 +191,16 @@ public: wxTreeItemId GetNext(const wxTreeItemId& item) const; -#if WXWIN_COMPATIBILITY_2_6 - // use EditLabel() instead - void Edit( const wxTreeItemId& item ) { EditLabel(item); } -#endif // WXWIN_COMPATIBILITY_2_6 - // implementation only from now on // overridden base class virtuals - virtual bool SetBackgroundColour(const wxColour& colour); - virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; - virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL); + virtual void Refresh(bool eraseBackground = true, const wxRect *rect = NULL) wxOVERRIDE; - virtual bool SetFont( const wxFont &font ); - virtual void SetWindowStyle(const long styles); + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual void SetWindowStyleFlag(long styles) wxOVERRIDE; // callbacks void OnPaint( wxPaintEvent &event ); @@ -216,9 +211,9 @@ public: void OnMouse( wxMouseEvent &event ); void OnGetToolTip( wxTreeEvent &event ); void OnSize( wxSizeEvent &event ); - void OnInternalIdle( ); + void OnInternalIdle( ) wxOVERRIDE; - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -286,7 +281,7 @@ protected: void Init(); // overridden wxWindow methods - virtual void DoThaw(); + virtual void DoThaw() wxOVERRIDE; // misc helpers void SendDeleteEvent(wxGenericTreeItem *itemBeingDeleted); @@ -299,21 +294,21 @@ protected: bool unselect_others = true, bool extended_select = false); - virtual int DoGetItemState(const wxTreeItemId& item) const; - virtual void DoSetItemState(const wxTreeItemId& item, int state); + virtual int DoGetItemState(const wxTreeItemId& item) const wxOVERRIDE; + virtual void DoSetItemState(const wxTreeItemId& item, int state) wxOVERRIDE; virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent, size_t previous, const wxString& text, int image, int selectedImage, - wxTreeItemData *data); + wxTreeItemData *data) wxOVERRIDE; virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent, const wxTreeItemId& idPrevious, const wxString& text, int image = -1, int selImage = -1, - wxTreeItemData *data = NULL); - virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const; + wxTreeItemData *data = NULL) wxOVERRIDE; + virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const wxOVERRIDE; // called by wxTextTreeCtrl when it marks itself for deletion void ResetTextControl(); @@ -353,15 +348,15 @@ protected: void DoDirtyProcessing(); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: // Reset the state of the last find (i.e. keyboard incremental search) // operation. void ResetFindState(); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl); wxDECLARE_NO_COPY_CLASS(wxGenericTreeCtrl); }; @@ -373,7 +368,7 @@ private: class WXDLLIMPEXP_CORE wxTreeCtrl: public wxGenericTreeCtrl { - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); public: wxTreeCtrl() {} diff --git a/Externals/wxWidgets3/include/wx/generic/wizard.h b/Externals/wxWidgets3/include/wx/generic/wizard.h index 2161870077..3fbe31a466 100644 --- a/Externals/wxWidgets3/include/wx/generic/wizard.h +++ b/Externals/wxWidgets3/include/wx/generic/wizard.h @@ -46,13 +46,13 @@ public: virtual ~wxWizard(); // implement base class pure virtuals - virtual bool RunWizard(wxWizardPage *firstPage); - virtual wxWizardPage *GetCurrentPage() const; - virtual void SetPageSize(const wxSize& size); - virtual wxSize GetPageSize() const; - virtual void FitToPage(const wxWizardPage *firstPage); - virtual wxSizer *GetPageAreaSizer() const; - virtual void SetBorder(int border); + virtual bool RunWizard(wxWizardPage *firstPage) wxOVERRIDE; + virtual wxWizardPage *GetCurrentPage() const wxOVERRIDE; + virtual void SetPageSize(const wxSize& size) wxOVERRIDE; + virtual wxSize GetPageSize() const wxOVERRIDE; + virtual void FitToPage(const wxWizardPage *firstPage) wxOVERRIDE; + virtual wxSizer *GetPageAreaSizer() const wxOVERRIDE; + virtual void SetBorder(int border) wxOVERRIDE; /// set/get bitmap const wxBitmap& GetBitmap() const { return m_bitmap; } @@ -74,7 +74,7 @@ public: virtual void DoCreateControls(); // Do the adaptation - virtual bool DoLayoutAdaptation(); + virtual bool DoLayoutAdaptation() wxOVERRIDE; // Set/get bitmap background colour void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; } @@ -124,6 +124,7 @@ protected: // wizard state wxWizardPage *m_page; // the current page or NULL + wxWizardPage *m_firstpage; // the page RunWizard started on or NULL wxBitmap m_bitmap; // the default bitmap to show // wizard controls @@ -160,8 +161,8 @@ protected: friend class wxWizardSizer; - DECLARE_DYNAMIC_CLASS(wxWizard) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxWizard); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxWizard); }; diff --git a/Externals/wxWidgets3/include/wx/geometry.h b/Externals/wxWidgets3/include/wx/geometry.h index 37d3a74539..0d9e4551ab 100644 --- a/Externals/wxWidgets3/include/wx/geometry.h +++ b/Externals/wxWidgets3/include/wx/geometry.h @@ -49,7 +49,6 @@ public : wxDouble GetVectorAngle() const; inline void SetVectorLength( wxDouble length ); void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxInt32 angle , wxInt32 length ); // set the vector length to 1.0, preserving the angle inline void Normalize(); @@ -87,9 +86,12 @@ 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*(wxDouble n , const wxPoint2DInt& pt); inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n); inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2); inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n); +inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n); inline wxPoint2DInt::wxPoint2DInt() { @@ -202,15 +204,15 @@ inline wxPoint2DInt& wxPoint2DInt::operator-=(const wxPoint2DInt& pt) inline wxPoint2DInt& wxPoint2DInt::operator*=(const wxPoint2DInt& pt) { - m_x = m_x + pt.m_x; - m_y = m_y + pt.m_y; + m_x = m_x * pt.m_x; + m_y = m_y * pt.m_y; return *this; } inline wxPoint2DInt& wxPoint2DInt::operator/=(const wxPoint2DInt& pt) { - m_x = m_x - pt.m_x; - m_y = m_y - pt.m_y; + m_x = m_x / pt.m_x; + m_y = m_y / pt.m_y; return *this; } @@ -247,7 +249,8 @@ inline wxPoint2DInt operator*(wxInt32 n , const wxPoint2DInt& pt) inline wxPoint2DInt operator*(wxDouble n , const wxPoint2DInt& pt) { - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); + return wxPoint2DInt( static_cast(pt.m_x * n) , + static_cast(pt.m_y * n) ); } inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) @@ -257,7 +260,8 @@ inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxInt32 n) inline wxPoint2DInt operator*(const wxPoint2DInt& pt , wxDouble n) { - return wxPoint2DInt( (int) (pt.m_x * n) , (int) (pt.m_y * n) ); + return wxPoint2DInt( static_cast(pt.m_x * n) , + static_cast(pt.m_y * n) ); } inline wxPoint2DInt operator/(const wxPoint2DInt& pt1 , const wxPoint2DInt& pt2) @@ -272,7 +276,8 @@ inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxInt32 n) inline wxPoint2DInt operator/(const wxPoint2DInt& pt , wxDouble n) { - return wxPoint2DInt( (int) (pt.m_x / n) , (int) (pt.m_y / n) ); + return wxPoint2DInt( static_cast(pt.m_x / n) , + static_cast(pt.m_y / n) ); } // wxPoint2Ds represent a point or a vector in a 2d coordinate system @@ -296,7 +301,6 @@ public : wxDouble GetVectorAngle() const ; void SetVectorLength( wxDouble length ); void SetVectorAngle( wxDouble degrees ); - void SetPolarCoordinates( wxDouble angle , wxDouble length ); // set the vector length to 1.0, preserving the angle void Normalize(); diff --git a/Externals/wxWidgets3/include/wx/gifdecod.h b/Externals/wxWidgets3/include/wx/gifdecod.h index f0b84fc4bf..b0de4669e6 100644 --- a/Externals/wxWidgets3/include/wx/gifdecod.h +++ b/Externals/wxWidgets3/include/wx/gifdecod.h @@ -57,12 +57,12 @@ public: unsigned char* GetPalette(unsigned int frame) const; unsigned int GetNcolours(unsigned int frame) const; int GetTransparentColourIndex(unsigned int frame) const; - wxColour GetTransparentColour(unsigned int frame) const; + wxColour GetTransparentColour(unsigned int frame) const wxOVERRIDE; - virtual wxSize GetFrameSize(unsigned int frame) const; - virtual wxPoint GetFramePosition(unsigned int frame) const; - virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const; - virtual long GetDelay(unsigned int frame) const; + virtual wxSize GetFrameSize(unsigned int frame) const wxOVERRIDE; + virtual wxPoint GetFramePosition(unsigned int frame) const wxOVERRIDE; + virtual wxAnimationDisposal GetDisposalMethod(unsigned int frame) const wxOVERRIDE; + virtual long GetDelay(unsigned int frame) const wxOVERRIDE; // GIFs can contain both static images and animations bool IsAnimation() const @@ -75,19 +75,19 @@ public: void Destroy(); // implementation of wxAnimationDecoder's pure virtuals - virtual bool Load( wxInputStream& stream ) + virtual bool Load( wxInputStream& stream ) wxOVERRIDE { return LoadGIF(stream) == wxGIF_OK; } - bool ConvertToImage(unsigned int frame, wxImage *image) const; + bool ConvertToImage(unsigned int frame, wxImage *image) const wxOVERRIDE; - wxAnimationDecoder *Clone() const + wxAnimationDecoder *Clone() const wxOVERRIDE { return new wxGIFDecoder; } - wxAnimationType GetType() const + wxAnimationType GetType() const wxOVERRIDE { return wxANIMATION_TYPE_GIF; } private: // wxAnimationDecoder pure virtual - virtual bool DoCanRead( wxInputStream& stream ) const; + virtual bool DoCanRead( wxInputStream& stream ) const wxOVERRIDE; // modifies current stream position (see wxAnimationDecoder::CanRead) int getcode(wxInputStream& stream, int bits, int abfin); diff --git a/Externals/wxWidgets3/include/wx/glcanvas.h b/Externals/wxWidgets3/include/wx/glcanvas.h index 688d4788b0..545040d4bc 100644 --- a/Externals/wxWidgets3/include/wx/glcanvas.h +++ b/Externals/wxWidgets3/include/wx/glcanvas.h @@ -48,11 +48,121 @@ 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 antialiasing supersampling on most graphics cards + WX_GL_SAMPLES, // 4 for 2x2 antialiasing supersampling on most graphics cards + WX_GL_FRAMEBUFFER_SRGB,// capability for sRGB framebuffer + // Context attributes + WX_GL_CORE_PROFILE, // use an OpenGL core profile + WX_GL_MAJOR_VERSION, // major OpenGL version of the core profile + WX_GL_MINOR_VERSION, // minor OpenGL version of the core profile + wx_GL_COMPAT_PROFILE, // use compatible profile (use all versions features) + WX_GL_FORWARD_COMPAT, // forward compatible context. OpenGL >= 3.0 + WX_GL_ES2, // ES or ES2 context. + WX_GL_DEBUG, // create a debug context + WX_GL_ROBUST_ACCESS, // robustness. + WX_GL_NO_RESET_NOTIFY, // never deliver notification of reset events + WX_GL_LOSE_ON_RESET, // if graphics reset, all context state is lost + WX_GL_RESET_ISOLATION, // protect other apps or share contexts from reset side-effects + WX_GL_RELEASE_FLUSH, // on context release, flush pending commands + WX_GL_RELEASE_NONE // on context release, pending commands are not flushed }; #define wxGLCanvasName wxT("GLCanvas") +// ---------------------------------------------------------------------------- +// wxGLAttribsBase: OpenGL rendering attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAttribsBase +{ +public: + wxGLAttribsBase() { Reset(); } + + // Setters + void AddAttribute(int attribute) { m_GLValues.push_back(attribute); } + // Search for searchVal and combine the next value with combineVal + void AddAttribBits(int searchVal, int combineVal); + // ARB functions necessity + void SetNeedsARB(bool needsARB = true) { m_needsARB = needsARB; } + + // Delete contents + void Reset() + { + m_GLValues.clear(); + m_needsARB = false; + } + + // Accessors + const int* GetGLAttrs() const + { + return (m_GLValues.empty() || !m_GLValues[0]) ? NULL : &*m_GLValues.begin(); + } + + int GetSize() const { return (int)(m_GLValues.size()); } + + // ARB function (e.g. wglCreateContextAttribsARB) is needed + bool NeedsARB() const { return m_needsARB; } + +private: + wxVector m_GLValues; + bool m_needsARB; +}; + +// ---------------------------------------------------------------------------- +// wxGLContextAttrs: OpenGL rendering context attributes +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLContextAttrs : public wxGLAttribsBase +{ +public: + // Setters, allowing chained calls + wxGLContextAttrs& CoreProfile(); + wxGLContextAttrs& MajorVersion(int val); + wxGLContextAttrs& MinorVersion(int val); + wxGLContextAttrs& OGLVersion(int vmayor, int vminor) + { return MajorVersion(vmayor).MinorVersion(vminor); } + wxGLContextAttrs& CompatibilityProfile(); + wxGLContextAttrs& ForwardCompatible(); + wxGLContextAttrs& ES2(); + wxGLContextAttrs& DebugCtx(); + wxGLContextAttrs& Robust(); + wxGLContextAttrs& NoResetNotify(); + wxGLContextAttrs& LoseOnReset(); + wxGLContextAttrs& ResetIsolation(); + wxGLContextAttrs& ReleaseFlush(int val = 1); //'int' allows future values + wxGLContextAttrs& PlatformDefaults(); + void EndList(); // No more values can be chained + + // Currently only used for X11 context creation + bool x11Direct; // X11 direct render + bool renderTypeRGBA; +}; + +// ---------------------------------------------------------------------------- +// wxGLAttributes: canvas configuration +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_GL wxGLAttributes : public wxGLAttribsBase +{ +public: + // Setters, allowing chained calls + wxGLAttributes& RGBA(); + wxGLAttributes& BufferSize(int val); + wxGLAttributes& Level(int val); + wxGLAttributes& DoubleBuffer(); + wxGLAttributes& Stereo(); + wxGLAttributes& AuxBuffers(int val); + wxGLAttributes& MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha); + wxGLAttributes& Depth(int val); + wxGLAttributes& Stencil(int val); + wxGLAttributes& MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha); + wxGLAttributes& PlatformDefaults(); + wxGLAttributes& Defaults(); + wxGLAttributes& SampleBuffers(int val); + wxGLAttributes& Samplers(int val); + wxGLAttributes& FrameBuffersRGB(); + void EndList(); // No more values can be chained +}; + // ---------------------------------------------------------------------------- // wxGLContextBase: OpenGL rendering context // ---------------------------------------------------------------------------- @@ -60,14 +170,20 @@ enum class WXDLLIMPEXP_GL wxGLContextBase : public wxObject { public: - /* - The derived class should provide a ctor with this signature: - wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); - */ +// The derived class should provide a ctor with this signature: +// +// wxGLContext(wxGLCanvas *win, +// const wxGLContext *other = NULL, +// const wxGLContextAttrs *ctxAttrs = NULL); // set this context as the current one virtual bool SetCurrent(const wxGLCanvas& win) const = 0; + + bool IsOK() { return m_isOk; } + +protected: + bool m_isOk; }; // ---------------------------------------------------------------------------- @@ -87,8 +203,8 @@ public: The derived class should provide a ctor with this signature: wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, wxWindowID id = wxID_ANY, - int* attribList = 0, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -110,6 +226,7 @@ public: // --------- // check if the given attributes are supported without creating a canvas + static bool IsDisplaySupported(const wxGLAttributes& dispAttrs); static bool IsDisplaySupported(const int *attribList); #if wxUSE_PALETTE @@ -131,6 +248,11 @@ public: // compilation static bool IsExtensionSupported(const char *extension); + // Get the wxGLContextAttrs object filled with the context-related values + // of the list of attributes passed at ctor when no wxGLAttributes is used + // as a parameter + wxGLContextAttrs& GetGLCTXAttrs() { return m_GLCTXAttrs; } + // deprecated methods using the implicit wxGLContext #if WXWIN_COMPATIBILITY_2_8 wxDEPRECATED( wxGLContext* GetContext() const ); @@ -155,6 +277,15 @@ protected: // by glXQueryExtensionsString() or glGetString(GL_EXTENSIONS) static bool IsExtensionInList(const char *list, const char *extension); + // For the case of "int* attribList" at ctor is != 0 + wxGLContextAttrs m_GLCTXAttrs; + + // Extract pixel format and context attributes. + // Return false if an unknown attribute is found. + static bool ParseAttribList(const int* attribList, + wxGLAttributes& dispAttrs, + wxGLContextAttrs* ctxAttrs = NULL); + #if wxUSE_PALETTE // create default palette if we're not using RGBA mode // (not supported in most ports) @@ -194,8 +325,8 @@ public: #include "wx/gtk1/glcanvas.h" #elif defined(__WXMAC__) #include "wx/osx/glcanvas.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/glcanvas.h" +#elif defined(__WXQT__) + #include "wx/qt/glcanvas.h" #else #error "wxGLCanvas not supported in this wxWidgets port" #endif @@ -211,7 +342,7 @@ public: virtual bool InitGLVisual(const int *attribList); private: - DECLARE_DYNAMIC_CLASS(wxGLApp) + wxDECLARE_DYNAMIC_CLASS(wxGLApp); }; #endif // !wxGL_APP_DEFINED diff --git a/Externals/wxWidgets3/include/wx/graphics.h b/Externals/wxWidgets3/include/wx/graphics.h index 46f60b6884..f8d016f216 100644 --- a/Externals/wxWidgets3/include/wx/graphics.h +++ b/Externals/wxWidgets3/include/wx/graphics.h @@ -15,9 +15,11 @@ #if wxUSE_GRAPHICS_CONTEXT +#include "wx/affinematrix2d.h" #include "wx/geometry.h" +#include "wx/colour.h" #include "wx/dynarray.h" -#include "wx/dc.h" +#include "wx/font.h" #include "wx/image.h" #include "wx/vector.h" @@ -123,10 +125,10 @@ public: wxGraphicsRenderer* GetRenderer() const; wxGraphicsObjectRefData* GetGraphicsData() const; protected: - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; + virtual wxObjectRefData* CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxGraphicsObject) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsObject); }; class WXDLLIMPEXP_CORE wxGraphicsPen : public wxGraphicsObject @@ -135,7 +137,7 @@ public: wxGraphicsPen() {} virtual ~wxGraphicsPen() {} private: - DECLARE_DYNAMIC_CLASS(wxGraphicsPen) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsPen); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; @@ -146,7 +148,7 @@ public: wxGraphicsBrush() {} virtual ~wxGraphicsBrush() {} private: - DECLARE_DYNAMIC_CLASS(wxGraphicsBrush) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsBrush); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; @@ -157,7 +159,7 @@ public: wxGraphicsFont() {} virtual ~wxGraphicsFont() {} private: - DECLARE_DYNAMIC_CLASS(wxGraphicsFont) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsFont); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsFont) wxNullGraphicsFont; @@ -183,7 +185,7 @@ public: { return (wxGraphicsBitmapData*) GetRefData(); } private: - DECLARE_DYNAMIC_CLASS(wxGraphicsBitmap) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsBitmap); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; @@ -249,7 +251,7 @@ public: { return (wxGraphicsMatrixData*) GetRefData(); } private: - DECLARE_DYNAMIC_CLASS(wxGraphicsMatrix) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsMatrix); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix; @@ -335,7 +337,7 @@ public: { return (wxGraphicsPathData*) GetRefData(); } private: - DECLARE_DYNAMIC_CLASS(wxGraphicsPath) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsPath); }; extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; @@ -739,7 +741,7 @@ protected: const wxGraphicsBrush& backgroundBrush); wxDECLARE_NO_COPY_CLASS(wxGraphicsContext); - DECLARE_ABSTRACT_CLASS(wxGraphicsContext) + wxDECLARE_ABSTRACT_CLASS(wxGraphicsContext); }; #if 0 @@ -772,7 +774,7 @@ private: wxGraphicsMatrix* m_matrix; wxGraphicsPath* m_path; - DECLARE_DYNAMIC_CLASS(wxGraphicsFigure) + wxDECLARE_DYNAMIC_CLASS(wxGraphicsFigure); }; #endif @@ -793,6 +795,17 @@ public: static wxGraphicsRenderer* GetDefaultRenderer(); static wxGraphicsRenderer* GetCairoRenderer(); + +#ifdef __WXMSW__ +#if wxUSE_GRAPHICS_GDIPLUS + static wxGraphicsRenderer* GetGDIPlusRenderer(); +#endif + +#if wxUSE_GRAPHICS_DIRECT2D + static wxGraphicsRenderer* GetDirect2DRenderer(); +#endif +#endif + // Context virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0; @@ -868,9 +881,13 @@ public: // create a subimage from a native image representation virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) = 0; + virtual wxString GetName() const = 0; + virtual void + GetVersion(int* major, int* minor = NULL, int* micro = NULL) const = 0; + private: wxDECLARE_NO_COPY_CLASS(wxGraphicsRenderer); - DECLARE_ABSTRACT_CLASS(wxGraphicsRenderer) + wxDECLARE_ABSTRACT_CLASS(wxGraphicsRenderer); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/activityindicator.h b/Externals/wxWidgets3/include/wx/gtk/activityindicator.h new file mode 100644 index 0000000000..72889dfcd0 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/activityindicator.h @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/activityindicator.h +// Purpose: Declaration of wxActivityIndicator for wxGTK. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_ACTIVITYINDICATOR_H_ +#define _WX_GTK_ACTIVITYINDICATOR_H_ + +// With GTK+ 3 we can always be certain that this control is available, so use +// the normal base class. With GTK+ 2 however, we may determine during run-time +// that we need to fall back to the generic implementation because the GTK+ +// version is earlier than 2.20, so we need to inherit from the generic class. +#ifdef __WXGTK3__ + #define wxActivityIndicatorGtkBase wxActivityIndicatorBase +#else + #include "wx/generic/activityindicator.h" + + #define wxActivityIndicatorGtkBase wxActivityIndicatorGeneric +#endif + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: implementation using GtkSpinner. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicator : public wxActivityIndicatorGtkBase +{ +public: + wxActivityIndicator() + { + } + + explicit + wxActivityIndicator(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +protected: + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); + wxDECLARE_NO_COPY_CLASS(wxActivityIndicator); +}; + +#endif // _WX_GTK_ACTIVITYINDICATOR_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/animate.h b/Externals/wxWidgets3/include/wx/gtk/animate.h index 1cda545a41..f07fdea939 100644 --- a/Externals/wxWidgets3/include/wx/gtk/animate.h +++ b/Externals/wxWidgets3/include/wx/gtk/animate.h @@ -34,23 +34,23 @@ public: wxAnimation& operator= (const wxAnimation&); - virtual bool IsOk() const + virtual bool IsOk() const wxOVERRIDE { return m_pixbuf != NULL; } // unfortunately GdkPixbufAnimation does not expose these info: - virtual unsigned int GetFrameCount() const { return 0; } - virtual wxImage GetFrame(unsigned int frame) const; + virtual unsigned int GetFrameCount() const wxOVERRIDE { return 0; } + virtual wxImage GetFrame(unsigned int frame) const wxOVERRIDE; // we can retrieve the delay for a frame only after building // a GdkPixbufAnimationIter... - virtual int GetDelay(unsigned int WXUNUSED(frame)) const { return 0; } + virtual int GetDelay(unsigned int WXUNUSED(frame)) const wxOVERRIDE { return 0; } - virtual wxSize GetSize() const; + virtual wxSize GetSize() const wxOVERRIDE; - virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY); - virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; // Implementation public: // used by GTK callbacks @@ -66,7 +66,7 @@ private: void UnRef(); typedef wxAnimationBase base_type; - DECLARE_DYNAMIC_CLASS(wxAnimation) + wxDECLARE_DYNAMIC_CLASS(wxAnimation); }; @@ -109,24 +109,24 @@ public: // event handler public: // public API - virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY); - virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY); + virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; + virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY) wxOVERRIDE; - virtual void SetAnimation(const wxAnimation &anim); - virtual wxAnimation GetAnimation() const + virtual void SetAnimation(const wxAnimation &anim) wxOVERRIDE; + virtual wxAnimation GetAnimation() const wxOVERRIDE { return wxAnimation(m_anim); } - virtual bool Play(); - virtual void Stop(); + virtual bool Play() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; - virtual bool IsPlaying() const; + virtual bool IsPlaying() const wxOVERRIDE; - bool SetBackgroundColour( const wxColour &colour ); + bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; protected: - virtual void DisplayStaticImage(); - virtual wxSize DoGetBestSize() const; + virtual void DisplayStaticImage() wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; void FitToAnimation(); void ClearToBackgroundColour(); @@ -146,8 +146,8 @@ private: void Init(); - DECLARE_DYNAMIC_CLASS(wxAnimationCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GTKANIMATEH__ diff --git a/Externals/wxWidgets3/include/wx/gtk/anybutton.h b/Externals/wxWidgets3/include/wx/gtk/anybutton.h index 604c72c72a..ad0357a659 100644 --- a/Externals/wxWidgets3/include/wx/gtk/anybutton.h +++ b/Externals/wxWidgets3/include/wx/gtk/anybutton.h @@ -23,7 +23,7 @@ public: m_isPressed = false; } - virtual bool Enable( bool enable = true ); + virtual bool Enable( bool enable = true ) wxOVERRIDE; // implementation // -------------- @@ -39,11 +39,11 @@ public: void GTKReleased(); protected: - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - virtual wxBitmap DoGetBitmap(State which) const; - virtual void DoSetBitmap(const wxBitmap& bitmap, State which); - virtual void DoSetBitmapPosition(wxDirection dir); + virtual wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmap& bitmap, State which) wxOVERRIDE; + virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; private: typedef wxAnyButtonBase base_type; @@ -54,10 +54,10 @@ private: // 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; + // return the state whose bitmap is being currently shown (so this is + // different from the real current state, e.g. it could be State_Normal + // even if the button is pressed if no button was set for State_Pressed) + State GTKGetCurrentBitmapState() const; // show the given bitmap (must be valid) void GTKDoShowBitmap(const wxBitmap& bitmap); diff --git a/Externals/wxWidgets3/include/wx/gtk/app.h b/Externals/wxWidgets3/include/wx/gtk/app.h index 6f112a3c88..2682515592 100644 --- a/Externals/wxWidgets3/include/wx/gtk/app.h +++ b/Externals/wxWidgets3/include/wx/gtk/app.h @@ -13,10 +13,6 @@ // classes //----------------------------------------------------------------------------- -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 -typedef struct _HildonProgram HildonProgram; -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - //----------------------------------------------------------------------------- // wxApp //----------------------------------------------------------------------------- @@ -27,24 +23,24 @@ public: wxApp(); virtual ~wxApp(); - /* override for altering the way wxGTK intializes the GUI + /* override for altering the way wxGTK initializes the GUI * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by * default. when overriding this method, the code in it is likely to be * platform dependent, otherwise use OnInit(). */ - virtual bool SetNativeTheme(const wxString& theme); - virtual bool OnInitGui(); + virtual bool SetNativeTheme(const wxString& theme) wxOVERRIDE; + virtual bool OnInitGui() wxOVERRIDE; // override base class (pure) virtuals - virtual void WakeUpIdle(); + virtual void WakeUpIdle() wxOVERRIDE; - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + virtual void CleanUp() wxOVERRIDE; virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, - const wxChar *msg); + const wxChar *msg) wxOVERRIDE; // GTK-specific methods // ------------------- @@ -62,11 +58,6 @@ public: // various bugs arising due to this. static bool GTKIsUsingGlobalMenu(); -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // Maemo-specific method: get the main program object - HildonProgram *GetHildonProgram(); -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // implementation only from now on // ------------------------------- @@ -83,11 +74,7 @@ private: #endif unsigned m_idleSourceId; -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - HildonProgram *m_hildonProgram; -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - - DECLARE_DYNAMIC_CLASS(wxApp) + wxDECLARE_DYNAMIC_CLASS(wxApp); }; #endif // _WX_GTK_APP_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/bitmap.h b/Externals/wxWidgets3/include/wx/gtk/bitmap.h index d035f2c2c1..3b3cf99cff 100644 --- a/Externals/wxWidgets3/include/wx/gtk/bitmap.h +++ b/Externals/wxWidgets3/include/wx/gtk/bitmap.h @@ -15,6 +15,7 @@ typedef struct _cairo_surface cairo_surface_t; #endif typedef struct _GdkPixbuf GdkPixbuf; class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; +class WXDLLIMPEXP_FWD_CORE wxCursor; //----------------------------------------------------------------------------- // wxMask @@ -43,9 +44,9 @@ public: #endif protected: - virtual void FreeData(); - virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour); - virtual bool InitFromMonoBitmap(const wxBitmap& bitmap); + virtual void FreeData() wxOVERRIDE; + virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxOVERRIDE; + virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE; private: #ifdef __WXGTK3__ @@ -54,7 +55,7 @@ private: GdkPixmap* m_bitmap; #endif - DECLARE_DYNAMIC_CLASS(wxMask) + wxDECLARE_DYNAMIC_CLASS(wxMask); }; //----------------------------------------------------------------------------- @@ -78,41 +79,45 @@ public: #endif wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); #if wxUSE_IMAGE - wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH); + wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0); #endif // wxUSE_IMAGE wxBitmap(GdkPixbuf* pixbuf, int depth = 0); + wxEXPLICIT wxBitmap(const wxCursor& cursor); virtual ~wxBitmap(); - bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); - bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE; + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE { return Create(sz.GetWidth(), sz.GetHeight(), depth); } bool Create(int width, int height, const wxDC& WXUNUSED(dc)) { return Create(width,height); } - +#ifdef __WXGTK3__ + virtual bool CreateScaled(int w, int h, int depth, double scale) wxOVERRIDE; + virtual double GetScaleFactor() const wxOVERRIDE; +#endif - virtual int GetHeight() const; - virtual int GetWidth() const; - virtual int GetDepth() const; + virtual int GetHeight() const wxOVERRIDE; + virtual int GetWidth() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; #if wxUSE_IMAGE - wxImage ConvertToImage() const; + wxImage ConvertToImage() const wxOVERRIDE; #endif // wxUSE_IMAGE // copies the contents and mask of the given (colour) icon to the bitmap - virtual bool CopyFromIcon(const wxIcon& icon); + virtual bool CopyFromIcon(const wxIcon& icon) wxOVERRIDE; - wxMask *GetMask() const; - void SetMask( wxMask *mask ); + wxMask *GetMask() const wxOVERRIDE; + void SetMask( wxMask *mask ) wxOVERRIDE; - wxBitmap GetSubBitmap( const wxRect& rect ) const; + wxBitmap GetSubBitmap( const wxRect& rect ) const wxOVERRIDE; bool SaveFile(const wxString &name, wxBitmapType type, - const wxPalette *palette = NULL) const; - bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + const wxPalette *palette = NULL) const wxOVERRIDE; + bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) wxOVERRIDE; #if wxUSE_PALETTE - wxPalette *GetPalette() const; - void SetPalette(const wxPalette& palette); + wxPalette *GetPalette() const wxOVERRIDE; + void SetPalette(const wxPalette& palette) wxOVERRIDE; wxPalette *GetColourMap() const { return GetPalette(); } #endif // wxUSE_PALETTE @@ -121,9 +126,9 @@ public: // implementation // -------------- - void SetHeight( int height ); - void SetWidth( int width ); - void SetDepth( int depth ); + void SetHeight( int height ) wxOVERRIDE; + void SetWidth( int width ) wxOVERRIDE; + void SetDepth( int depth ) wxOVERRIDE; #ifdef __WXGTK3__ GdkPixbuf* GetPixbufNoMask() const; @@ -151,8 +156,8 @@ protected: #endif // wxUSE_IMAGE #endif - virtual wxGDIRefData* CreateGDIRefData() const; - virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const; + virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE; private: #ifndef __WXGTK3__ @@ -175,7 +180,7 @@ public: void PurgeOtherRepresentations(Representation keep); #endif - DECLARE_DYNAMIC_CLASS(wxBitmap) + wxDECLARE_DYNAMIC_CLASS(wxBitmap); }; #endif // _WX_GTK_BITMAP_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/bmpbuttn.h b/Externals/wxWidgets3/include/wx/gtk/bmpbuttn.h index f70e28ceb7..70b4d4326d 100644 --- a/Externals/wxWidgets3/include/wx/gtk/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/gtk/bmpbuttn.h @@ -40,7 +40,7 @@ public: const wxString& name = wxButtonNameStr); private: - DECLARE_DYNAMIC_CLASS(wxBitmapButton) + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); }; #endif // _WX_GTK_BMPBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/bmpcbox.h b/Externals/wxWidgets3/include/wx/gtk/bmpcbox.h index f5d00a517b..57b464aa81 100644 --- a/Externals/wxWidgets3/include/wx/gtk/bmpcbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/bmpcbox.h @@ -81,13 +81,13 @@ public: virtual ~wxBitmapComboBox(); // Sets the image for the given item. - virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap); + virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE; // Returns the image of the item with the given index. - virtual wxBitmap GetItemBitmap(unsigned int n) const; + virtual wxBitmap GetItemBitmap(unsigned int n) const wxOVERRIDE; // Returns size of the image used in list - virtual wxSize GetBitmapSize() const + virtual wxSize GetBitmapSize() const wxOVERRIDE { return m_bitmapSize; } @@ -106,33 +106,33 @@ public: unsigned int pos, wxClientData *clientData); // Override some wxTextEntry interface. - virtual void WriteText(const wxString& value); + virtual void WriteText(const wxString& value) wxOVERRIDE; - virtual wxString GetValue() const; - virtual void Remove(long from, long to); + virtual wxString GetValue() const wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; - virtual void SetSelection(long from, long to); - virtual void GetSelection(long *from, long *to) const; + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; - virtual void SetSelection(int n) { wxComboBox::SetSelection(n); } - virtual int GetSelection() const { return wxComboBox::GetSelection(); } + virtual void SetSelection(int n) wxOVERRIDE { wxComboBox::SetSelection(n); } + virtual int GetSelection() const wxOVERRIDE { return wxComboBox::GetSelection(); } - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; - virtual GtkWidget* GetConnectWidget(); + virtual GtkWidget* GetConnectWidget() wxOVERRIDE; protected: - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - virtual void GTKCreateComboBoxWidget(); - virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text ); + virtual void GTKCreateComboBoxWidget() wxOVERRIDE; + virtual void GTKInsertComboBoxTextItem( unsigned int n, const wxString& text ) wxOVERRIDE; - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; wxSize m_bitmapSize; int m_bitmapCellIndex; @@ -140,7 +140,7 @@ protected: private: void Init(); - DECLARE_DYNAMIC_CLASS(wxBitmapComboBox) + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); }; #endif // _WX_GTK_BMPCBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/brush.h b/Externals/wxWidgets3/include/wx/gtk/brush.h index 37a4845e6e..7f88eb1aef 100644 --- a/Externals/wxWidgets3/include/wx/gtk/brush.h +++ b/Externals/wxWidgets3/include/wx/gtk/brush.h @@ -22,34 +22,32 @@ public: wxBrush() { } wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); -#endif wxBrush( const wxBitmap &stippleBitmap ); virtual ~wxBrush(); bool operator==(const wxBrush& brush) const; bool operator!=(const wxBrush& brush) const { return !(*this == brush); } - wxBrushStyle GetStyle() const; - wxColour GetColour() const; - wxBitmap *GetStipple() const; + wxBrushStyle GetStyle() const wxOVERRIDE; + wxColour GetColour() const wxOVERRIDE; + wxBitmap *GetStipple() const wxOVERRIDE; - void SetColour( const wxColour& col ); - void SetColour( unsigned char r, unsigned char g, unsigned char b ); - void SetStyle( wxBrushStyle style ); - void SetStipple( const wxBitmap& stipple ); + void SetColour( const wxColour& col ) wxOVERRIDE; + void SetColour( unsigned char r, unsigned char g, unsigned char b ) wxOVERRIDE; + void SetStyle( wxBrushStyle style ) wxOVERRIDE; + void SetStipple( const wxBitmap& stipple ) wxOVERRIDE; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxBrush) + wxDECLARE_DYNAMIC_CLASS(wxBrush); }; #endif // _WX_GTK_BRUSH_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/button.h b/Externals/wxWidgets3/include/wx/gtk/button.h index 9e7a57d890..47e43b011e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/button.h +++ b/Externals/wxWidgets3/include/wx/gtk/button.h @@ -34,8 +34,8 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxButtonNameStr); - virtual wxWindow *SetDefault(); - virtual void SetLabel( const wxString &label ); + virtual wxWindow *SetDefault() wxOVERRIDE; + virtual void SetLabel( const wxString &label ) wxOVERRIDE; // implementation // -------------- @@ -54,11 +54,11 @@ public: void GTKReleased(); protected: - virtual wxSize DoGetBestSize() const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; #if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; #endif // wxUSE_MARKUP private: @@ -67,7 +67,7 @@ private: // Return the GtkLabel used by this button. GtkLabel *GTKGetLabel() const; - DECLARE_DYNAMIC_CLASS(wxButton) + wxDECLARE_DYNAMIC_CLASS(wxButton); }; #endif // _WX_GTK_BUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/calctrl.h b/Externals/wxWidgets3/include/wx/gtk/calctrl.h index 3fce698ee5..81be1cd638 100644 --- a/Externals/wxWidgets3/include/wx/gtk/calctrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/calctrl.h @@ -34,16 +34,16 @@ public: virtual ~wxGtkCalendarCtrl() {} - virtual bool SetDate(const wxDateTime& date); - virtual wxDateTime GetDate() const; + virtual bool SetDate(const wxDateTime& date) wxOVERRIDE; + virtual wxDateTime GetDate() const wxOVERRIDE; virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, - const wxDateTime& upperdate = wxDefaultDateTime); - virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const; + const wxDateTime& upperdate = wxDefaultDateTime) wxOVERRIDE; + virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const wxOVERRIDE; - virtual bool EnableMonthChange(bool enable = true); + virtual bool EnableMonthChange(bool enable = true) wxOVERRIDE; - virtual void Mark(size_t day, bool mark); + virtual void Mark(size_t day, bool mark) wxOVERRIDE; // implementation // -------------- @@ -62,7 +62,7 @@ private: // the control while a handler for day-selected is running. wxDateTime m_selectedDate; - DECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl) + wxDECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl); wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/checkbox.h b/Externals/wxWidgets3/include/wx/gtk/checkbox.h index 69985fc457..8068f0b556 100644 --- a/Externals/wxWidgets3/include/wx/gtk/checkbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/checkbox.h @@ -35,11 +35,11 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxCheckBoxNameStr ); - void SetValue( bool state ); - bool GetValue() const; + void SetValue( bool state ) wxOVERRIDE; + bool GetValue() const wxOVERRIDE; - virtual void SetLabel( const wxString& label ); - virtual bool Enable( bool enable = true ); + virtual void SetLabel( const wxString& label ) wxOVERRIDE; + virtual bool Enable( bool enable = true ) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -49,11 +49,11 @@ public: void GTKEnableEvents(); protected: - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - void DoSet3StateValue(wxCheckBoxState state); - wxCheckBoxState DoGet3StateValue() const; + void DoSet3StateValue(wxCheckBoxState state) wxOVERRIDE; + wxCheckBoxState DoGet3StateValue() const wxOVERRIDE; private: typedef wxCheckBoxBase base_type; @@ -61,7 +61,7 @@ private: GtkWidget *m_widgetCheckbox; GtkWidget *m_widgetLabel; - DECLARE_DYNAMIC_CLASS(wxCheckBox) + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); }; #endif // _WX_GTKCHECKBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/checklst.h b/Externals/wxWidgets3/include/wx/gtk/checklst.h index 3cfbd76407..a12eb180da 100644 --- a/Externals/wxWidgets3/include/wx/gtk/checklst.h +++ b/Externals/wxWidgets3/include/wx/gtk/checklst.h @@ -34,15 +34,15 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - virtual bool IsChecked(unsigned int index) const; - virtual void Check(unsigned int index, bool check = true); + virtual bool IsChecked(unsigned int index) const wxOVERRIDE; + virtual void Check(unsigned int index, bool check = true) wxOVERRIDE; int GetItemHeight() const; void DoCreateCheckList(); private: - DECLARE_DYNAMIC_CLASS(wxCheckListBox) + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); }; #endif // _WX_GTKCHECKLIST_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/choice.h b/Externals/wxWidgets3/include/wx/gtk/choice.h index d952a0fa2c..ce43533dd3 100644 --- a/Externals/wxWidgets3/include/wx/gtk/choice.h +++ b/Externals/wxWidgets3/include/wx/gtk/choice.h @@ -63,16 +63,16 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr ); - int GetSelection() const; - void SetSelection(int n); + int GetSelection() const wxOVERRIDE; + void SetSelection(int n) wxOVERRIDE; - virtual unsigned int GetCount() const; - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& string); + virtual unsigned int GetCount() const wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE; - virtual void SetColumns(int n=1); - virtual int GetColumns() const; + virtual void SetColumns(int n=1) wxOVERRIDE; + virtual int GetColumns() const wxOVERRIDE; virtual void GTKDisableEvents(); virtual void GTKEnableEvents(); @@ -91,18 +91,18 @@ protected: // index to GtkListStore cell which displays the item text int m_stringCellIndex; - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; virtual int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; // in derived classes, implement this to insert list store entry // with all items default except text @@ -111,7 +111,7 @@ protected: private: void Init(); - DECLARE_DYNAMIC_CLASS(wxChoice) + wxDECLARE_DYNAMIC_CLASS(wxChoice); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/clipbrd.h b/Externals/wxWidgets3/include/wx/gtk/clipbrd.h index 28d84df815..b2316067e5 100644 --- a/Externals/wxWidgets3/include/wx/gtk/clipbrd.h +++ b/Externals/wxWidgets3/include/wx/gtk/clipbrd.h @@ -30,31 +30,31 @@ public: virtual ~wxClipboard(); // open the clipboard before SetData() and GetData() - virtual bool Open(); + virtual bool Open() wxOVERRIDE; // close the clipboard after SetData() and GetData() - virtual void Close(); + virtual void Close() wxOVERRIDE; // query whether the clipboard is opened - virtual bool IsOpened() const; + virtual bool IsOpened() const wxOVERRIDE; // set the clipboard data. all other formats will be deleted. - virtual bool SetData( wxDataObject *data ); + virtual bool SetData( wxDataObject *data ) wxOVERRIDE; // add to the clipboard data. - virtual bool AddData( wxDataObject *data ); + virtual bool AddData( wxDataObject *data ) wxOVERRIDE; // ask if data in correct format is available - virtual bool IsSupported( const wxDataFormat& format ); + virtual bool IsSupported( const wxDataFormat& format ) wxOVERRIDE; // ask if data in correct format is available - virtual bool IsSupportedAsync( wxEvtHandler *sink ); + virtual bool IsSupportedAsync( wxEvtHandler *sink ) wxOVERRIDE; // fill data with data on the clipboard (if available) - virtual bool GetData( wxDataObject& data ); + virtual bool GetData( wxDataObject& data ) wxOVERRIDE; // clears wxTheClipboard and the system's clipboard if possible - virtual void Clear(); + virtual void Clear() wxOVERRIDE; @@ -129,7 +129,7 @@ public: private: GtkWidget *m_targetsWidgetAsync; // for getting list of supported formats - DECLARE_DYNAMIC_CLASS(wxClipboard) + wxDECLARE_DYNAMIC_CLASS(wxClipboard); }; #endif // _WX_GTK_CLIPBOARD_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/clrpicker.h b/Externals/wxWidgets3/include/wx/gtk/clrpicker.h index 4a375fb849..b9894b5309 100644 --- a/Externals/wxWidgets3/include/wx/gtk/clrpicker.h +++ b/Externals/wxWidgets3/include/wx/gtk/clrpicker.h @@ -47,7 +47,7 @@ public: virtual ~wxColourButton(); protected: - void UpdateColour(); + void UpdateColour() wxOVERRIDE; public: // used by the GTK callback only @@ -57,7 +57,7 @@ public: // used by the GTK callback only wxWindow *m_topParent; private: - DECLARE_DYNAMIC_CLASS(wxColourButton) + wxDECLARE_DYNAMIC_CLASS(wxColourButton); }; #endif // _WX_GTK_CLRPICKER_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/collpane.h b/Externals/wxWidgets3/include/wx/gtk/collpane.h index 7503b8e1b2..3942e5b4c8 100644 --- a/Externals/wxWidgets3/include/wx/gtk/collpane.h +++ b/Externals/wxWidgets3/include/wx/gtk/collpane.h @@ -43,15 +43,15 @@ public: const wxValidator& val = wxDefaultValidator, const wxString& name = wxCollapsiblePaneNameStr); - virtual void Collapse(bool collapse = true); - virtual bool IsCollapsed() const; - virtual void SetLabel(const wxString& str); + virtual void Collapse(bool collapse = true) wxOVERRIDE; + virtual bool IsCollapsed() const wxOVERRIDE; + virtual void SetLabel(const wxString& str) wxOVERRIDE; - virtual wxWindow *GetPane() const { return m_pPane; } - virtual wxString GetLabel() const { return m_strLabel; } + virtual wxWindow *GetPane() const wxOVERRIDE { return m_pPane; } + virtual wxString GetLabel() const wxOVERRIDE { return m_strLabel; } protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; public: // used by GTK callbacks bool m_bIgnoreNextChange; @@ -69,11 +69,11 @@ private: } void OnSize(wxSizeEvent&); - virtual void AddChildGTK(wxWindowGTK* child); - GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; + GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxCollapsiblePane) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxCollapsiblePane); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_COLLAPSABLE_PANEL_H_GTK_ diff --git a/Externals/wxWidgets3/include/wx/gtk/colordlg.h b/Externals/wxWidgets3/include/wx/gtk/colordlg.h index a1fdbb75ec..784c6545d4 100644 --- a/Externals/wxWidgets3/include/wx/gtk/colordlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/colordlg.h @@ -25,16 +25,16 @@ public: wxColourData &GetColourData() { return m_data; } - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; protected: // implement some base class methods to do nothing to avoid asserts and // GTK warnings, since this is not a real wxDialog. virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height)) {} + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} // copy data between the dialog and m_colourData: void ColourDataToDialog(); @@ -42,7 +42,7 @@ protected: wxColourData m_data; - DECLARE_DYNAMIC_CLASS(wxColourDialog) + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); }; #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/colour.h b/Externals/wxWidgets3/include/wx/gtk/colour.h index d48d707cbe..86e74e5720 100644 --- a/Externals/wxWidgets3/include/wx/gtk/colour.h +++ b/Externals/wxWidgets3/include/wx/gtk/colour.h @@ -33,10 +33,10 @@ public: bool operator==(const wxColour& col) const; bool operator!=(const wxColour& col) const { return !(*this == col); } - unsigned char Red() const; - unsigned char Green() const; - unsigned char Blue() const; - unsigned char Alpha() const; + unsigned char Red() const wxOVERRIDE; + unsigned char Green() const wxOVERRIDE; + unsigned char Blue() const wxOVERRIDE; + unsigned char Alpha() const wxOVERRIDE; // Implementation part #ifdef __WXGTK3__ @@ -49,11 +49,11 @@ public: protected: virtual void - InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) wxOVERRIDE; - virtual bool FromString(const wxString& str); + virtual bool FromString(const wxString& str) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxColour) + wxDECLARE_DYNAMIC_CLASS(wxColour); }; #endif // _WX_GTK_COLOUR_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/combobox.h b/Externals/wxWidgets3/include/wx/gtk/combobox.h index c655991e3c..880ec67c8e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/combobox.h +++ b/Externals/wxWidgets3/include/wx/gtk/combobox.h @@ -76,29 +76,25 @@ public: // Set/GetSelection() from wxTextEntry and wxChoice - virtual void SetSelection(int n) { wxChoice::SetSelection(n); } - virtual void SetSelection(long from, long to) + virtual void SetSelection(int n) wxOVERRIDE { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to) wxOVERRIDE { wxTextEntry::SetSelection(from, to); } - virtual int GetSelection() const { return wxChoice::GetSelection(); } - virtual void GetSelection(long *from, long *to) const + virtual int GetSelection() const wxOVERRIDE { return wxChoice::GetSelection(); } + virtual void GetSelection(long *from, long *to) const wxOVERRIDE { return wxTextEntry::GetSelection(from, to); } - virtual wxString GetStringSelection() const + virtual wxString GetStringSelection() const wxOVERRIDE { return wxItemContainer::GetStringSelection(); } - virtual void SetString(unsigned int n, const wxString& string); + virtual void SetString(unsigned int n, const wxString& string) wxOVERRIDE; virtual void Popup(); virtual void Dismiss(); - virtual void Clear() - { - wxTextEntry::Clear(); - wxItemContainer::Clear(); - } + virtual void Clear() wxOVERRIDE; // See wxComboBoxBase discussion of IsEmpty(). bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } @@ -106,7 +102,7 @@ public: void OnChar( wxKeyEvent &event ); - virtual void SetValue(const wxString& value); + virtual void SetValue(const wxString& value) wxOVERRIDE; // Standard event handling void OnCut(wxCommandEvent& event); @@ -125,42 +121,42 @@ public: void OnUpdateDelete(wxUpdateUIEvent& event); void OnUpdateSelectAll(wxUpdateUIEvent& event); - virtual void GTKDisableEvents(); - virtual void GTKEnableEvents(); - GtkWidget* GetConnectWidget(); + virtual void GTKDisableEvents() wxOVERRIDE; + virtual void GTKEnableEvents() wxOVERRIDE; + GtkWidget* GetConnectWidget() wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); protected: // From wxWindowGTK: - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; // Widgets that use the style->base colour for the BG colour should // override this and return true. - virtual bool UseGTKStyleBase() const { return true; } + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } // Override in derived classes to create combo box widgets with // custom list stores. virtual void GTKCreateComboBoxWidget(); - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; - virtual GtkEntry *GetEntry() const + virtual GtkEntry *GetEntry() const wxOVERRIDE { return m_entry; } GtkEntry* m_entry; private: // From wxTextEntry: - virtual wxWindow *GetEditableWindow() { return this; } - virtual GtkEditable *GetEditable() const; - virtual void EnableTextChangedEvents(bool enable); + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } + virtual GtkEditable *GetEditable() const wxOVERRIDE; + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE; void Init(); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GTK_COMBOBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/control.h b/Externals/wxWidgets3/include/wx/gtk/control.h index 454d1fc90d..1171f55919 100644 --- a/Externals/wxWidgets3/include/wx/gtk/control.h +++ b/Externals/wxWidgets3/include/wx/gtk/control.h @@ -37,13 +37,13 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxControlNameStr); - virtual wxVisualAttributes GetDefaultAttributes() const; + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE; #ifdef __WXGTK3__ - virtual bool SetFont(const wxFont& font); + virtual bool SetFont(const wxFont& font) wxOVERRIDE; #endif protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; void PostCreation(const wxSize& size); // sets the label to the given string and also sets it for the given widget @@ -87,7 +87,7 @@ protected: wxPoint GTKGetEntryMargins(GtkEntry* entry) const; private: - DECLARE_DYNAMIC_CLASS(wxControl) + wxDECLARE_DYNAMIC_CLASS(wxControl); }; #endif // _WX_GTK_CONTROL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/cursor.h b/Externals/wxWidgets3/include/wx/gtk/cursor.h index e1915efc1d..51d106d445 100644 --- a/Externals/wxWidgets3/include/wx/gtk/cursor.h +++ b/Externals/wxWidgets3/include/wx/gtk/cursor.h @@ -9,17 +9,13 @@ #ifndef _WX_GTK_CURSOR_H_ #define _WX_GTK_CURSOR_H_ -#include "wx/gdiobj.h" -#include "wx/gdicmn.h" - -class WXDLLIMPEXP_FWD_CORE wxColour; class WXDLLIMPEXP_FWD_CORE wxImage; //----------------------------------------------------------------------------- // wxCursor //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase { public: wxCursor(); @@ -37,6 +33,9 @@ public: int hotSpotX = -1, int hotSpotY = -1, const char maskBits[] = NULL, const wxColour* fg = NULL, const wxColour* bg = NULL); + + virtual wxPoint GetHotSpot() const wxOVERRIDE; + virtual ~wxCursor(); // implementation @@ -49,11 +48,11 @@ protected: void InitFromImage(const wxImage& image); #endif - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxCursor) + wxDECLARE_DYNAMIC_CLASS(wxCursor); }; #endif // _WX_GTK_CURSOR_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/dataobj2.h b/Externals/wxWidgets3/include/wx/gtk/dataobj2.h index 62f380a429..5e94b4e49c 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dataobj2.h +++ b/Externals/wxWidgets3/include/wx/gtk/dataobj2.h @@ -25,24 +25,24 @@ public: virtual ~wxBitmapDataObject(); // override base class virtual to update PNG data too - virtual void SetBitmap(const wxBitmap& bitmap); + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE; // implement base class pure virtuals // ---------------------------------- - virtual size_t GetDataSize() const { return m_pngSize; } - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const wxOVERRIDE { return m_pngSize; } + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } @@ -72,19 +72,19 @@ public: void AddFile( const wxString &filename ); - virtual size_t GetDataSize() const; - virtual bool GetDataHere(void *buf) const; - virtual bool SetData(size_t len, const void *buf); + virtual size_t GetDataSize() const wxOVERRIDE; + virtual bool GetDataHere(void *buf) const wxOVERRIDE; + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE; // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } diff --git a/Externals/wxWidgets3/include/wx/gtk/dataview.h b/Externals/wxWidgets3/include/wx/gtk/dataview.h index 44d2af93b2..f2064218aa 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dataview.h +++ b/Externals/wxWidgets3/include/wx/gtk/dataview.h @@ -34,44 +34,44 @@ public: // setters: - virtual void SetTitle( const wxString &title ); - virtual void SetBitmap( const wxBitmap &bitmap ); + virtual void SetTitle( const wxString &title ) wxOVERRIDE; + virtual void SetBitmap( const wxBitmap &bitmap ) wxOVERRIDE; - virtual void SetOwner( wxDataViewCtrl *owner ); + virtual void SetOwner( wxDataViewCtrl *owner ) wxOVERRIDE; - virtual void SetAlignment( wxAlignment align ); + virtual void SetAlignment( wxAlignment align ) wxOVERRIDE; - virtual void SetSortable( bool sortable ); - virtual void SetSortOrder( bool ascending ); + virtual void SetSortable( bool sortable ) wxOVERRIDE; + virtual void SetSortOrder( bool ascending ) wxOVERRIDE; - virtual void SetResizeable( bool resizable ); - virtual void SetHidden( bool hidden ); + virtual void SetResizeable( bool resizable ) wxOVERRIDE; + virtual void SetHidden( bool hidden ) wxOVERRIDE; - virtual void SetMinWidth( int minWidth ); - virtual void SetWidth( int width ); + virtual void SetMinWidth( int minWidth ) wxOVERRIDE; + virtual void SetWidth( int width ) wxOVERRIDE; - virtual void SetReorderable( bool reorderable ); + virtual void SetReorderable( bool reorderable ) wxOVERRIDE; - virtual void SetFlags(int flags) { SetIndividualFlags(flags); } + virtual void SetFlags(int flags) wxOVERRIDE { SetIndividualFlags(flags); } // getters: - virtual wxString GetTitle() const; - virtual wxAlignment GetAlignment() const; + virtual wxString GetTitle() const wxOVERRIDE; + virtual wxAlignment GetAlignment() const wxOVERRIDE; - virtual bool IsSortable() const; - virtual bool IsSortOrderAscending() const; - virtual bool IsSortKey() const; + virtual bool IsSortable() const wxOVERRIDE; + virtual bool IsSortOrderAscending() const wxOVERRIDE; + virtual bool IsSortKey() const wxOVERRIDE; - virtual bool IsResizeable() const; - virtual bool IsHidden() const; + virtual bool IsResizeable() const wxOVERRIDE; + virtual bool IsHidden() const wxOVERRIDE; - virtual int GetWidth() const; - virtual int GetMinWidth() const; + virtual int GetWidth() const wxOVERRIDE; + virtual int GetMinWidth() const wxOVERRIDE; - virtual bool IsReorderable() const; + virtual bool IsReorderable() const wxOVERRIDE; - virtual int GetFlags() const { return GetFromIndividualFlags(); } + virtual int GetFlags() const wxOVERRIDE { return GetFromIndividualFlags(); } // implementation GtkWidget* GetGtkHandle() const { return m_column; } @@ -126,49 +126,49 @@ public: virtual ~wxDataViewCtrl(); - virtual bool AssociateModel( wxDataViewModel *model ); + virtual bool AssociateModel( wxDataViewModel *model ) wxOVERRIDE; - virtual bool PrependColumn( wxDataViewColumn *col ); - virtual bool AppendColumn( wxDataViewColumn *col ); - virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); + virtual bool PrependColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool AppendColumn( wxDataViewColumn *col ) wxOVERRIDE; + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) wxOVERRIDE; - virtual unsigned int GetColumnCount() const; - virtual wxDataViewColumn* GetColumn( unsigned int pos ) const; - virtual bool DeleteColumn( wxDataViewColumn *column ); - virtual bool ClearColumns(); - virtual int GetColumnPosition( const wxDataViewColumn *column ) const; + virtual unsigned int GetColumnCount() const wxOVERRIDE; + virtual wxDataViewColumn* GetColumn( unsigned int pos ) const wxOVERRIDE; + virtual bool DeleteColumn( wxDataViewColumn *column ) wxOVERRIDE; + virtual bool ClearColumns() wxOVERRIDE; + virtual int GetColumnPosition( const wxDataViewColumn *column ) const wxOVERRIDE; - virtual wxDataViewColumn *GetSortingColumn() const; + virtual wxDataViewColumn *GetSortingColumn() const wxOVERRIDE; - virtual int GetSelectedItemsCount() const; - virtual int GetSelections( wxDataViewItemArray & sel ) const; - virtual void SetSelections( const wxDataViewItemArray & sel ); - virtual void Select( const wxDataViewItem & item ); - virtual void Unselect( const wxDataViewItem & item ); - virtual bool IsSelected( const wxDataViewItem & item ) const; - virtual void SelectAll(); - virtual void UnselectAll(); + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections( wxDataViewItemArray & sel ) const wxOVERRIDE; + virtual void SetSelections( const wxDataViewItemArray & sel ) wxOVERRIDE; + virtual void Select( const wxDataViewItem & item ) wxOVERRIDE; + virtual void Unselect( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsSelected( const wxDataViewItem & item ) const wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; virtual void EnsureVisible( const wxDataViewItem& item, - const wxDataViewColumn *column = NULL ); + const wxDataViewColumn *column = NULL ) wxOVERRIDE; virtual void HitTest( const wxPoint &point, wxDataViewItem &item, - wxDataViewColumn *&column ) const; + wxDataViewColumn *&column ) const wxOVERRIDE; virtual wxRect GetItemRect( const wxDataViewItem &item, - const wxDataViewColumn *column = NULL ) const; + const wxDataViewColumn *column = NULL ) const wxOVERRIDE; - virtual bool SetRowHeight( int rowHeight ); + virtual bool SetRowHeight( int rowHeight ) wxOVERRIDE; - virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column); + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; - virtual void Expand( const wxDataViewItem & item ); - virtual void Collapse( const wxDataViewItem & item ); - virtual bool IsExpanded( const wxDataViewItem & item ) const; + virtual void Expand( const wxDataViewItem & item ) wxOVERRIDE; + virtual void Collapse( const wxDataViewItem & item ) wxOVERRIDE; + virtual bool IsExpanded( const wxDataViewItem & item ) const wxOVERRIDE; - virtual bool EnableDragSource( const wxDataFormat &format ); - virtual bool EnableDropTarget( const wxDataFormat &format ); + virtual bool EnableDragSource( const wxDataFormat &format ) wxOVERRIDE; + virtual bool EnableDropTarget( const wxDataFormat &format ) wxOVERRIDE; - virtual wxDataViewColumn *GetCurrentColumn() const; + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -182,21 +182,21 @@ public: // failed. wxDataViewItem GTKPathToItem(struct _GtkTreePath *path) const; - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; int GTKGetUniformRowHeight() const { return m_uniformRowHeight; } protected: - virtual void DoSetExpanderColumn(); - virtual void DoSetIndent(); + virtual void DoSetExpanderColumn() wxOVERRIDE; + virtual void DoSetIndent() wxOVERRIDE; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; private: void Init(); - virtual wxDataViewItem DoGetCurrentItem() const; - virtual void DoSetCurrentItem(const wxDataViewItem& item); + virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; + virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; // Return wxDataViewColumn matching the given GtkTreeViewColumn. // @@ -218,11 +218,11 @@ private: // value to force the height of all rows to the given value. int m_uniformRowHeight; - virtual void AddChildGTK(wxWindowGTK* child); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; void GtkEnableSelectionEvents(); void GtkDisableSelectionEvents(); - DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/dc.h b/Externals/wxWidgets3/include/wx/gtk/dc.h index 7eb9dd1267..2c08c1f200 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dc.h +++ b/Externals/wxWidgets3/include/wx/gtk/dc.h @@ -19,18 +19,19 @@ class wxGTKCairoDCImpl: public wxGCDCImpl public: wxGTKCairoDCImpl(wxDC* owner); wxGTKCairoDCImpl(wxDC* owner, int); + wxGTKCairoDCImpl(wxDC* owner, double scaleFactor); wxGTKCairoDCImpl(wxDC* owner, wxWindow* window); - virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask); - virtual void DoDrawIcon(const wxIcon& icon, int x, int y); + virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask) wxOVERRIDE; + virtual void DoDrawIcon(const wxIcon& icon, int x, int y) wxOVERRIDE; #if wxUSE_IMAGE - virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style); + virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style) wxOVERRIDE; #endif - virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const; - virtual bool DoGetPixel(int x, int y, wxColour* col) const; - virtual void DoGetSize(int* width, int* height) const; - virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask); - virtual void* GetCairoContext() const; + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE; + virtual bool DoGetPixel(int x, int y, wxColour* col) const wxOVERRIDE; + virtual void DoGetSize(int* width, int* height) const wxOVERRIDE; + virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask) wxOVERRIDE; + virtual void* GetCairoContext() const wxOVERRIDE; protected: int m_width, m_height; @@ -86,10 +87,10 @@ public: wxMemoryDCImpl(wxMemoryDC* owner); wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap); wxMemoryDCImpl(wxMemoryDC* owner, wxDC* dc); - virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const; - virtual void DoSelect(const wxBitmap& bitmap); - virtual const wxBitmap& GetSelectedBitmap() const; - virtual wxBitmap& GetSelectedBitmap(); + virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE; + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE; + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE; private: void Setup(); @@ -103,7 +104,7 @@ class WXDLLIMPEXP_CORE wxGTKCairoDC: public wxDC { typedef wxDC base_type; public: - wxGTKCairoDC(cairo_t* cr); + wxGTKCairoDC(cairo_t* cr, wxWindow* window); wxDECLARE_NO_COPY_CLASS(wxGTKCairoDC); }; @@ -127,21 +128,21 @@ public: #endif // wxUSE_PALETTE // Resolution in pixels per logical inch - virtual wxSize GetPPI() const; + virtual wxSize GetPPI() const wxOVERRIDE; - virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; } - virtual void EndDoc() { } - virtual void StartPage() { } - virtual void EndPage() { } + virtual bool StartDoc( const wxString& WXUNUSED(message) ) wxOVERRIDE { return true; } + virtual void EndDoc() wxOVERRIDE { } + virtual void StartPage() wxOVERRIDE { } + virtual void EndPage() wxOVERRIDE { } virtual GdkWindow* GetGDKWindow() const { return NULL; } - virtual void* GetHandle() const { return GetGDKWindow(); } + virtual void* GetHandle() const wxOVERRIDE { return GetGDKWindow(); } // base class pure virtuals implemented here - virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - virtual void DoGetSizeMM(int* width, int* height) const; + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE; - DECLARE_ABSTRACT_CLASS(wxGTKDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxGTKDCImpl); }; // this must be defined when wxDC::Blit() honours the DC origin and needed to diff --git a/Externals/wxWidgets3/include/wx/gtk/dcclient.h b/Externals/wxWidgets3/include/wx/gtk/dcclient.h index 53469796a1..93e80960d0 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dcclient.h +++ b/Externals/wxWidgets3/include/wx/gtk/dcclient.h @@ -23,79 +23,79 @@ public: virtual ~wxWindowDCImpl(); - virtual bool CanDrawBitmap() const { return true; } - virtual bool CanGetTextExtent() const { return true; } + virtual bool CanDrawBitmap() const wxOVERRIDE { return true; } + virtual bool CanGetTextExtent() const wxOVERRIDE { return true; } - virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, - wxFloodFillStyle style=wxFLOOD_SURFACE ); - virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; + wxFloodFillStyle style=wxFLOOD_SURFACE ) wxOVERRIDE; + virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const wxOVERRIDE; - virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); - virtual void DoCrossHair( wxCoord x, wxCoord y ); + virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) wxOVERRIDE; + virtual void DoCrossHair( wxCoord x, wxCoord y ) wxOVERRIDE; virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, - wxCoord xc, wxCoord yc ); + wxCoord xc, wxCoord yc ) wxOVERRIDE; virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, - double sa, double ea ); - virtual void DoDrawPoint( wxCoord x, wxCoord y ); + double sa, double ea ) wxOVERRIDE; + virtual void DoDrawPoint( wxCoord x, wxCoord y ) wxOVERRIDE; virtual void DoDrawLines(int n, const wxPoint points[], - wxCoord xoffset, wxCoord yoffset); + wxCoord xoffset, wxCoord yoffset) wxOVERRIDE; virtual void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; - virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); - virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); - virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); + virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; + virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ) wxOVERRIDE; + virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; - virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); + virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) wxOVERRIDE; virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, - bool useMask = false ); + bool useMask = false ) wxOVERRIDE; virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode logical_func = wxCOPY, bool useMask = false, - wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ) wxOVERRIDE; - virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); + virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ) wxOVERRIDE; virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, - double angle); + double angle) wxOVERRIDE; virtual void DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL) const; - virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; - virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); - virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ); + const wxFont *theFont = NULL) const wxOVERRIDE; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const wxOVERRIDE; + virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) wxOVERRIDE; + virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ) wxOVERRIDE; - virtual wxCoord GetCharWidth() const; - virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const wxOVERRIDE; + virtual wxCoord GetCharHeight() const wxOVERRIDE; - virtual void Clear(); + virtual void Clear() wxOVERRIDE; - virtual void SetFont( const wxFont &font ); - virtual void SetPen( const wxPen &pen ); - virtual void SetBrush( const wxBrush &brush ); - virtual void SetBackground( const wxBrush &brush ); - virtual void SetLogicalFunction( wxRasterOperationMode function ); - virtual void SetTextForeground( const wxColour &col ); - virtual void SetTextBackground( const wxColour &col ); - virtual void SetBackgroundMode( int mode ); - virtual void SetPalette( const wxPalette& palette ); + virtual void SetFont( const wxFont &font ) wxOVERRIDE; + virtual void SetPen( const wxPen &pen ) wxOVERRIDE; + virtual void SetBrush( const wxBrush &brush ) wxOVERRIDE; + virtual void SetBackground( const wxBrush &brush ) wxOVERRIDE; + virtual void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + virtual void SetTextForeground( const wxColour &col ) wxOVERRIDE; + virtual void SetTextBackground( const wxColour &col ) wxOVERRIDE; + virtual void SetBackgroundMode( int mode ) wxOVERRIDE; + virtual void SetPalette( const wxPalette& palette ) wxOVERRIDE; - virtual void DestroyClippingRegion(); + virtual void DestroyClippingRegion() wxOVERRIDE; // Resolution in pixels per logical inch - virtual wxSize GetPPI() const; - virtual int GetDepth() const; + virtual wxSize GetPPI() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; // overrriden here for RTL - virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); - virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); + virtual void SetDeviceOrigin( wxCoord x, wxCoord y ) wxOVERRIDE; + virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) wxOVERRIDE; // protected: // implementation @@ -119,15 +119,15 @@ public: void SetUpDC( bool ismem = false ); void Destroy(); - virtual void ComputeScaleAndOrigin(); + virtual void ComputeScaleAndOrigin() wxOVERRIDE; - virtual GdkWindow *GetGDKWindow() const { return m_gdkwindow; } + virtual GdkWindow *GetGDKWindow() const wxOVERRIDE { return m_gdkwindow; } private: void DrawingSetup(GdkGC*& gc, bool& originChanged); GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const; - DECLARE_ABSTRACT_CLASS(wxWindowDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxWindowDCImpl); }; //----------------------------------------------------------------------------- @@ -140,9 +140,9 @@ public: wxClientDCImpl( wxDC *owner ); wxClientDCImpl( wxDC *owner, wxWindow *win ); - virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; - DECLARE_ABSTRACT_CLASS(wxClientDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxClientDCImpl); }; //----------------------------------------------------------------------------- @@ -155,7 +155,7 @@ public: wxPaintDCImpl( wxDC *owner ); wxPaintDCImpl( wxDC *owner, wxWindow *win ); - DECLARE_ABSTRACT_CLASS(wxPaintDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxPaintDCImpl); }; #endif // _WX_GTKDCCLIENT_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/dcmemory.h b/Externals/wxWidgets3/include/wx/gtk/dcmemory.h index 8afb45c52e..3f7e7c057a 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dcmemory.h +++ b/Externals/wxWidgets3/include/wx/gtk/dcmemory.h @@ -29,29 +29,29 @@ public: // more like their Win32 couterparts. They now interpret // wxWHITE, wxWHITE_BRUSH and wxWHITE_PEN as drawing 0 // and everything else as drawing 1. - virtual void SetPen( const wxPen &pen ); - virtual void SetBrush( const wxBrush &brush ); - virtual void SetBackground( const wxBrush &brush ); - virtual void SetTextForeground( const wxColour &col ); - virtual void SetTextBackground( const wxColour &col ); + virtual void SetPen( const wxPen &pen ) wxOVERRIDE; + virtual void SetBrush( const wxBrush &brush ) wxOVERRIDE; + virtual void SetBackground( const wxBrush &brush ) wxOVERRIDE; + virtual void SetTextForeground( const wxColour &col ) wxOVERRIDE; + virtual void SetTextBackground( const wxColour &col ) wxOVERRIDE; // overridden from wxDCImpl - virtual void DoGetSize( int *width, int *height ) const; - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; - virtual void* GetHandle() const; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const wxOVERRIDE; + virtual void* GetHandle() const wxOVERRIDE; // overridden for wxMemoryDC Impl - virtual void DoSelect(const wxBitmap& bitmap); + virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE; - virtual const wxBitmap& GetSelectedBitmap() const; - virtual wxBitmap& GetSelectedBitmap(); + virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE; + virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE; private: wxBitmap m_selected; void Init(); - DECLARE_ABSTRACT_CLASS(wxMemoryDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxMemoryDCImpl); }; #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/dcscreen.h b/Externals/wxWidgets3/include/wx/gtk/dcscreen.h index c91926b910..f59d6e3636 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dcscreen.h +++ b/Externals/wxWidgets3/include/wx/gtk/dcscreen.h @@ -22,12 +22,12 @@ public: wxScreenDCImpl( wxScreenDC *owner ); ~wxScreenDCImpl(); - virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; private: void Init(); - DECLARE_ABSTRACT_CLASS(wxScreenDCImpl) + wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl); }; #endif // _WX_GTKDCSCREEN_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/dialog.h b/Externals/wxWidgets3/include/wx/gtk/dialog.h index fcd7cd3db8..b64a0dc510 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dialog.h +++ b/Externals/wxWidgets3/include/wx/gtk/dialog.h @@ -34,10 +34,10 @@ public: const wxString &name = wxDialogNameStr ); virtual ~wxDialog(); - virtual bool Show( bool show = true ); - virtual int ShowModal(); - virtual void EndModal( int retCode ); - virtual bool IsModal() const; + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual int ShowModal() wxOVERRIDE; + virtual void EndModal( int retCode ) wxOVERRIDE; + virtual bool IsModal() const wxOVERRIDE; private: // common part of all ctors @@ -46,7 +46,7 @@ private: bool m_modalShowing; wxGUIEventLoop *m_modalLoop; - DECLARE_DYNAMIC_CLASS(wxDialog) + wxDECLARE_DYNAMIC_CLASS(wxDialog); }; #endif // _WX_GTKDIALOG_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/dirdlg.h b/Externals/wxWidgets3/include/wx/gtk/dirdlg.h index 8a05d55796..1e4473ee66 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/dirdlg.h @@ -37,8 +37,8 @@ public: public: // overrides from wxGenericDirDialog - wxString GetPath() const; - void SetPath(const wxString& path); + wxString GetPath() const wxOVERRIDE; + void SetPath(const wxString& path) wxOVERRIDE; // Implementation only. @@ -51,13 +51,13 @@ protected: // form doesn't have any m_wxwindow virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; private: wxString m_selectedDirectory; - DECLARE_DYNAMIC_CLASS(wxDirDialog) + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); }; #endif // __GTKDIRDLGH__ diff --git a/Externals/wxWidgets3/include/wx/gtk/dnd.h b/Externals/wxWidgets3/include/wx/gtk/dnd.h index 0aea7b41f6..3c771e2f68 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dnd.h +++ b/Externals/wxWidgets3/include/wx/gtk/dnd.h @@ -30,10 +30,10 @@ class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase public: wxDropTarget(wxDataObject *dataObject = NULL ); - virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); - virtual bool OnDrop(wxCoord x, wxCoord y); - virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); - virtual bool GetData(); + virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool OnDrop(wxCoord x, wxCoord y) wxOVERRIDE; + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) wxOVERRIDE; + virtual bool GetData() wxOVERRIDE; // Can only be called during OnXXX methods. wxDataFormat GetMatchingPair(); @@ -92,7 +92,7 @@ public: } // start drag action - virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) wxOVERRIDE; void PrepareIcon( int action, GdkDragContext *context ); diff --git a/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h b/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h index dfaba5609a..c5d3d74a4e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h +++ b/Externals/wxWidgets3/include/wx/gtk/dvrenderer.h @@ -25,14 +25,16 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - virtual void SetMode( wxDataViewCellMode mode ); - virtual wxDataViewCellMode GetMode() const; + virtual void SetMode( wxDataViewCellMode mode ) wxOVERRIDE; + virtual wxDataViewCellMode GetMode() const wxOVERRIDE; - virtual void SetAlignment( int align ); - virtual int GetAlignment() const; + virtual void SetAlignment( int align ) wxOVERRIDE; + virtual int GetAlignment() const wxOVERRIDE; - virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); - virtual wxEllipsizeMode GetEllipsizeMode() const; + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) wxOVERRIDE; + virtual wxEllipsizeMode GetEllipsizeMode() const wxOVERRIDE; + + virtual bool FinishEditing() wxOVERRIDE; // GTK-specific implementation // --------------------------- @@ -53,33 +55,25 @@ public: void GtkInitHandlers(); void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); } - // should be overridden to return true if the renderer supports properties - // corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc() - // for details - virtual bool GtkSupportsAttrs() const { return false; } - - // if GtkSupportsAttrs() returns true, this function will be called to - // effectively set the attribute to use for rendering the next item - // - // it should return true if the attribute had any non-default properties - virtual bool GtkSetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) - { return false; } - - - // these functions are only called if GtkSupportsAttrs() returns true and - // are used to remember whether the renderer currently uses the default - // attributes or if we changed (and not reset them) - bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; } - void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; } - // return the text renderer used by this renderer for setting text cell // specific attributes: can return NULL if this renderer doesn't render any // text virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; } - - wxDataViewCellMode GtkGetMode() { return m_mode; } + + // return the widget actually used by the renderer for editing, this may be + // different from the editor control widget for the custom renderers + virtual GtkWidget* GtkGetEditorWidget() const; + +private: + // Change the mode at GTK level without touching m_mode, this is useful for + // temporarily making the renderer insensitive but does mean that GetMode() + // may return a value different from the actual GTK renderer mode. + void GtkSetMode(wxDataViewCellMode mode); protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + virtual void SetEnabled(bool enabled) wxOVERRIDE; + virtual void GtkOnCellChanged(const wxVariant& value, const wxDataViewItem& item, unsigned col); @@ -90,6 +84,9 @@ protected: GtkCellRenderer *m_renderer; int m_alignment; + + // We store the renderer mode at wx level as it can differ from the mode of + // the corresponding GTK+ renderer as explained above. wxDataViewCellMode m_mode; // true if we hadn't changed any visual attributes or restored them since @@ -97,7 +94,7 @@ protected: bool m_usingDefaultAttrs; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); }; #endif // _WX_GTK_DVRENDERER_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h b/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h index 385fa73a0b..68e4d4a980 100644 --- a/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/gtk/dvrenderers.h @@ -25,16 +25,18 @@ class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer { public: - wxDataViewTextRenderer( const wxString &varianttype = "string", + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - virtual bool SetValue( const wxVariant &value ) + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE { return SetTextValue(value); } - virtual bool GetValue( wxVariant &value ) const + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE { wxString str; if ( !GetTextValue(str) ) @@ -45,20 +47,19 @@ public: return true; } - virtual void SetAlignment( int align ); + virtual void SetAlignment( int align ) wxOVERRIDE; - virtual bool GtkSupportsAttrs() const { return true; } - virtual bool GtkSetAttr(const wxDataViewItemAttr& attr); - - virtual GtkCellRendererText *GtkGetTextRenderer() const; + virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE; protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + // implementation of Set/GetValue() bool SetTextValue(const wxString& str); bool GetTextValue(wxString& str) const; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); }; // --------------------------------------------------------- @@ -68,15 +69,17 @@ protected: class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer { public: - wxDataViewBitmapRenderer( const wxString &varianttype = "wxBitmap", + static wxString GetDefaultType() { return wxS("wxBitmap"); } + + wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); }; // --------------------------------------------------------- @@ -86,15 +89,17 @@ protected: class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer { public: - wxDataViewToggleRenderer( const wxString &varianttype = "bool", + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); }; // --------------------------------------------------------- @@ -104,7 +109,9 @@ protected: class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewCustomRendererBase { public: - wxDataViewCustomRenderer( const wxString &varianttype = "string", + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT, bool no_init = false ); @@ -112,14 +119,14 @@ public: // Create DC on request - virtual wxDC *GetDC(); + virtual wxDC *GetDC() wxOVERRIDE; // override the base class function to use GTK text cell renderer virtual void RenderText(const wxString& text, int xoffset, wxRect cell, wxDC *dc, - int state); + int state) wxOVERRIDE; struct GTKRenderParams; @@ -129,17 +136,8 @@ public: m_renderParams = renderParams; } - // we may or not support attributes, as we don't know it, return true to - // make it possible to use them - virtual bool GtkSupportsAttrs() const { return true; } - - virtual bool GtkSetAttr(const wxDataViewItemAttr& attr) - { - SetAttr(attr); - return !attr.IsDefault(); - } - - virtual GtkCellRendererText *GtkGetTextRenderer() const; + virtual GtkCellRendererText *GtkGetTextRenderer() const wxOVERRIDE; + virtual GtkWidget* GtkGetEditorWidget() const wxOVERRIDE; private: bool Init(wxDataViewCellMode mode, int align); @@ -156,7 +154,7 @@ private: // them forward to m_text_renderer if our RenderText() is called GTKRenderParams* m_renderParams; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); }; // --------------------------------------------------------- @@ -166,17 +164,19 @@ private: class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer { public: + static wxString GetDefaultType() { return wxS("long"); } + wxDataViewProgressRenderer( const wxString &label = wxEmptyString, - const wxString &varianttype = "long", + const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); virtual ~wxDataViewProgressRenderer(); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; - virtual bool Render( wxRect cell, wxDC *dc, int state ); - virtual wxSize GetSize() const; + virtual bool Render( wxRect cell, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; private: void GTKSetLabel(); @@ -191,7 +191,7 @@ private: #endif // !wxUSE_UNICODE protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); }; // --------------------------------------------------------- @@ -201,20 +201,22 @@ protected: class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer { public: - wxDataViewIconTextRenderer( const wxString &varianttype = "wxDataViewIconText", + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT ); virtual ~wxDataViewIconTextRenderer(); - bool SetValue( const wxVariant &value ); - bool GetValue( wxVariant &value ) const; + bool SetValue( const wxVariant &value ) wxOVERRIDE; + bool GetValue( wxVariant &value ) const wxOVERRIDE; - virtual void GtkPackIntoColumn(GtkTreeViewColumn *column); + virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) wxOVERRIDE; protected: virtual void GtkOnCellChanged(const wxVariant& value, const wxDataViewItem& item, - unsigned col); + unsigned col) wxOVERRIDE; private: wxDataViewIconText m_value; @@ -222,7 +224,7 @@ private: // we use the base class m_renderer for the text and this one for the icon GtkCellRenderer *m_rendererIcon; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); }; // ------------------------------------- @@ -235,12 +237,12 @@ public: wxDataViewChoiceRenderer(const wxArrayString &choices, wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); - virtual bool Render( wxRect rect, wxDC *dc, int state ); - virtual wxSize GetSize() const; - virtual bool SetValue( const wxVariant &value ); - virtual bool GetValue( wxVariant &value ) const; + virtual bool Render( wxRect rect, wxDC *dc, int state ) wxOVERRIDE; + virtual wxSize GetSize() const wxOVERRIDE; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; - void SetAlignment( int align ); + void SetAlignment( int align ) wxOVERRIDE; wxString GetChoice(size_t index) const { return m_choices[index]; } const wxArrayString& GetChoices() const { return m_choices; } @@ -261,11 +263,11 @@ public: wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE, int alignment = wxDVR_DEFAULT_ALIGNMENT ); - virtual bool SetValue( const wxVariant &value ); - virtual bool GetValue( wxVariant &value ) const; + virtual bool SetValue( const wxVariant &value ) wxOVERRIDE; + virtual bool GetValue( wxVariant &value ) const wxOVERRIDE; private: - virtual void GtkOnTextEdited(const char *itempath, const wxString& str); + virtual void GtkOnTextEdited(const char *itempath, const wxString& str) wxOVERRIDE; }; diff --git a/Externals/wxWidgets3/include/wx/gtk/evtloop.h b/Externals/wxWidgets3/include/wx/gtk/evtloop.h index ba8db406d5..0e3c1b15ea 100644 --- a/Externals/wxWidgets3/include/wx/gtk/evtloop.h +++ b/Externals/wxWidgets3/include/wx/gtk/evtloop.h @@ -21,18 +21,18 @@ class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase public: wxGUIEventLoop(); - virtual void ScheduleExit(int rc = 0); - virtual bool Pending() const; - virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool YieldFor(long eventsToProcess); + virtual void ScheduleExit(int rc = 0) wxOVERRIDE; + virtual bool Pending() const wxOVERRIDE; + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; void StoreGdkEventForLaterProcessing(GdkEvent* ev) { m_arrGdkEvents.Add(ev); } protected: - virtual int DoRun(); + virtual int DoRun() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; private: // the exit code of this event loop diff --git a/Externals/wxWidgets3/include/wx/gtk/filectrl.h b/Externals/wxWidgets3/include/wx/gtk/filectrl.h index 3de17e3af8..b2fad39cb6 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filectrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/filectrl.h @@ -99,22 +99,22 @@ public: const wxSize& size = wxDefaultSize, const wxString& name = wxFileCtrlNameStr ); - virtual void SetWildcard( const wxString& wildCard ); - virtual void SetFilterIndex( int filterIndex ); - virtual bool SetDirectory( const wxString& dir ); - virtual bool SetFilename( const wxString& name ); - virtual bool SetPath( const wxString& path ); + virtual void SetWildcard( const wxString& wildCard ) wxOVERRIDE; + virtual void SetFilterIndex( int filterIndex ) wxOVERRIDE; + virtual bool SetDirectory( const wxString& dir ) wxOVERRIDE; + virtual bool SetFilename( const wxString& name ) wxOVERRIDE; + virtual bool SetPath( const wxString& path ) wxOVERRIDE; - virtual wxString GetFilename() const; - virtual wxString GetDirectory() const; - virtual wxString GetWildcard() const { return this->m_wildCard; } - virtual wxString GetPath() const; - virtual void GetPaths( wxArrayString& paths ) const; - virtual void GetFilenames( wxArrayString& files ) const; - virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); } + virtual wxString GetFilename() const wxOVERRIDE; + virtual wxString GetDirectory() const wxOVERRIDE; + virtual wxString GetWildcard() const wxOVERRIDE { return this->m_wildCard; } + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths( wxArrayString& paths ) const wxOVERRIDE; + virtual void GetFilenames( wxArrayString& files ) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE { return m_fc.GetFilterIndex(); } - virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); } - virtual void ShowHidden(bool show); + virtual bool HasMultipleFileSelection() const wxOVERRIDE { return HasFlag( wxFC_MULTIPLE ); } + virtual void ShowHidden(bool show) wxOVERRIDE; virtual bool HasFilterChoice() const { return m_fc.HasFilterChoice(); } @@ -135,7 +135,7 @@ protected: private: void Init(); - DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl ) + wxDECLARE_DYNAMIC_CLASS(wxGtkFileCtrl); }; #endif // wxUSE_FILECTRL diff --git a/Externals/wxWidgets3/include/wx/gtk/filedlg.h b/Externals/wxWidgets3/include/wx/gtk/filedlg.h index 377734db79..5db235f5c4 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filedlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/filedlg.h @@ -40,22 +40,22 @@ public: const wxString& name = wxFileDialogNameStr); virtual ~wxFileDialog(); - virtual wxString GetPath() const; - virtual void GetPaths(wxArrayString& paths) const; - virtual wxString GetFilename() const; - virtual void GetFilenames(wxArrayString& files) const; - virtual int GetFilterIndex() const; + virtual wxString GetPath() const wxOVERRIDE; + virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE; + virtual wxString GetFilename() const wxOVERRIDE; + virtual void GetFilenames(wxArrayString& files) const wxOVERRIDE; + virtual int GetFilterIndex() const wxOVERRIDE; - virtual void SetMessage(const wxString& message); - virtual void SetPath(const wxString& path); - virtual void SetDirectory(const wxString& dir); - virtual void SetFilename(const wxString& name); - virtual void SetWildcard(const wxString& wildCard); - virtual void SetFilterIndex(int filterIndex); + virtual void SetMessage(const wxString& message) wxOVERRIDE; + virtual void SetPath(const wxString& path) wxOVERRIDE; + virtual void SetDirectory(const wxString& dir) wxOVERRIDE; + virtual void SetFilename(const wxString& name) wxOVERRIDE; + virtual void SetWildcard(const wxString& wildCard) wxOVERRIDE; + virtual void SetFilterIndex(int filterIndex) wxOVERRIDE; - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; - virtual bool SupportsExtraControl() const { return true; } + virtual bool SupportsExtraControl() const wxOVERRIDE { return true; } // Implementation only. void GTKSelectionChanged(const wxString& filename); @@ -66,18 +66,18 @@ protected: // form doesn't have any m_wxwindow virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; private: void OnFakeOk( wxCommandEvent &event ); void OnSize(wxSizeEvent&); - virtual void AddChildGTK(wxWindowGTK* child); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; wxGtkFileChooser m_fc; - DECLARE_DYNAMIC_CLASS(wxFileDialog) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GTKFILEDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/filehistory.h b/Externals/wxWidgets3/include/wx/gtk/filehistory.h index 70a93d6f5e..edeb175455 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filehistory.h +++ b/Externals/wxWidgets3/include/wx/gtk/filehistory.h @@ -16,9 +16,9 @@ public: wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1) : wxFileHistoryBase(maxFiles, idBase) {} - virtual void AddFileToHistory(const wxString& file); + virtual void AddFileToHistory(const wxString& file) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxFileHistory) + wxDECLARE_DYNAMIC_CLASS(wxFileHistory); }; #endif // _WX_GTK_FILEHISTORY_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/filepicker.h b/Externals/wxWidgets3/include/wx/gtk/filepicker.h index 27e1fdc779..8da628866e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/filepicker.h +++ b/Externals/wxWidgets3/include/wx/gtk/filepicker.h @@ -28,7 +28,7 @@ /* needs to create the dialog in ::Create() and not for each user */ \ /* request in response to the user click as the generic implementation */ \ /* does. */ \ - virtual wxWindow *GetDialogParent() \ + virtual wxWindow *GetDialogParent() wxOVERRIDE \ { \ return NULL; \ } \ @@ -42,7 +42,7 @@ /* give us access to the internal GdkWindow of a GtkFileChooserButton */ \ protected: \ virtual GdkWindow * \ - GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const \ + GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const wxOVERRIDE \ { return NULL; } @@ -92,8 +92,8 @@ public: // overrides // event handler for the click void OnDialogOK(wxCommandEvent &); - virtual void SetPath(const wxString &str); - virtual void SetInitialDirectory(const wxString& dir); + virtual void SetPath(const wxString &str) wxOVERRIDE; + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; // see macro defined above FILEDIRBTN_OVERRIDES @@ -105,7 +105,7 @@ private: // common part of all ctors void Init() { m_dialog = NULL; } - DECLARE_DYNAMIC_CLASS(wxFileButton) + wxDECLARE_DYNAMIC_CLASS(wxFileButton); }; @@ -156,13 +156,13 @@ public: // overrides // GtkFileChooserButton does not support GTK_FILE_CHOOSER_CREATE_FOLDER // thus we must ensure that the wxDD_DIR_MUST_EXIST style was given - long GetDialogStyle() const + long GetDialogStyle() const wxOVERRIDE { return (wxGenericDirButton::GetDialogStyle() | wxDD_DIR_MUST_EXIST); } - virtual void SetPath(const wxString &str); - virtual void SetInitialDirectory(const wxString& dir); + virtual void SetPath(const wxString &str) wxOVERRIDE; + virtual void SetInitialDirectory(const wxString& dir) wxOVERRIDE; // see macro defined above FILEDIRBTN_OVERRIDES @@ -183,7 +183,7 @@ private: m_bIgnoreNextChange = false; } - DECLARE_DYNAMIC_CLASS(wxDirButton) + wxDECLARE_DYNAMIC_CLASS(wxDirButton); }; #undef FILEDIRBTN_OVERRIDES diff --git a/Externals/wxWidgets3/include/wx/gtk/font.h b/Externals/wxWidgets3/include/wx/gtk/font.h index a218a29dfe..d24c807c19 100644 --- a/Externals/wxWidgets3/include/wx/gtk/font.h +++ b/Externals/wxWidgets3/include/wx/gtk/font.h @@ -27,19 +27,6 @@ public: wxFont(const wxNativeFontInfo& info); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif - wxFont(int size, wxFontFamily family, wxFontStyle style, @@ -77,27 +64,39 @@ public: virtual ~wxFont(); // implement base class pure virtuals - virtual int GetPointSize() const; - virtual wxFontStyle GetStyle() const; - 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; + virtual int GetPointSize() const wxOVERRIDE; + virtual wxFontStyle GetStyle() const wxOVERRIDE; + virtual wxFontWeight GetWeight() const wxOVERRIDE; + virtual wxString GetFaceName() const wxOVERRIDE; + virtual bool GetUnderlined() const wxOVERRIDE; + virtual bool GetStrikethrough() const wxOVERRIDE; + virtual wxFontEncoding GetEncoding() const wxOVERRIDE; + virtual const wxNativeFontInfo *GetNativeFontInfo() const wxOVERRIDE; + virtual bool IsFixedWidth() const wxOVERRIDE; - virtual void SetPointSize( int pointSize ); - virtual void SetFamily(wxFontFamily family); - virtual void SetStyle(wxFontStyle style); - 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); + virtual void SetPointSize( int pointSize ) wxOVERRIDE; + virtual void SetFamily(wxFontFamily family) wxOVERRIDE; + virtual void SetStyle(wxFontStyle style) wxOVERRIDE; + virtual void SetWeight(wxFontWeight weight) wxOVERRIDE; + virtual bool SetFaceName( const wxString& faceName ) wxOVERRIDE; + virtual void SetUnderlined( bool underlined ) wxOVERRIDE; + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; + virtual void SetEncoding(wxFontEncoding encoding) wxOVERRIDE; wxDECLARE_COMMON_FONT_METHODS(); + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + // Set Pango attributes in the specified layout. Currently only // underlined and strike-through attributes are handled by this function. // @@ -111,17 +110,17 @@ public: // no data :-) protected: - virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ) wxOVERRIDE; - virtual wxGDIRefData* CreateGDIRefData() const; - virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const; + virtual wxGDIRefData* CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const wxOVERRIDE; - virtual wxFontFamily DoGetFamily() const; + virtual wxFontFamily DoGetFamily() const wxOVERRIDE; private: void Init(); - DECLARE_DYNAMIC_CLASS(wxFont) + wxDECLARE_DYNAMIC_CLASS(wxFont); }; #endif // _WX_GTK_FONT_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/fontdlg.h b/Externals/wxWidgets3/include/wx/gtk/fontdlg.h index 4c5b57a3e3..bab724c904 100644 --- a/Externals/wxWidgets3/include/wx/gtk/fontdlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/fontdlg.h @@ -25,22 +25,11 @@ public: virtual ~wxFontDialog(); -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use - wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: // create the GTK dialog - virtual bool DoCreate(wxWindow *parent); + virtual bool DoCreate(wxWindow *parent) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxFontDialog) + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); }; -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use -inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data) - : wxFontDialogBase(parent) { InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/fontpicker.h b/Externals/wxWidgets3/include/wx/gtk/fontpicker.h index 65bb5c9593..ce56da14d0 100644 --- a/Externals/wxWidgets3/include/wx/gtk/fontpicker.h +++ b/Externals/wxWidgets3/include/wx/gtk/fontpicker.h @@ -21,7 +21,7 @@ class WXDLLIMPEXP_CORE wxFontButton : public wxButton, public wxFontPickerWidgetBase { public: - wxFontButton() {} + wxFontButton() { Init(); } wxFontButton(wxWindow *parent, wxWindowID id, const wxFont& initial = wxNullFont, @@ -31,7 +31,9 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFontPickerWidgetNameStr) { - Create(parent, id, initial, pos, size, style, validator, name); + Init(); + + Create(parent, id, initial, pos, size, style, validator, name); } bool Create(wxWindow *parent, @@ -43,19 +45,33 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxFontPickerWidgetNameStr); + virtual wxColour GetSelectedColour() const wxOVERRIDE + { return m_selectedColour; } + + void SetSelectedColour(const wxColour &colour) wxOVERRIDE + { m_selectedColour = colour; } + virtual ~wxFontButton(); protected: - void UpdateFont(); + void UpdateFont() wxOVERRIDE; public: // used by the GTK callback only - - void SetNativeFontInfo(const char *gtkdescription) - { m_selectedFont.SetNativeFontInfo(wxString::FromAscii(gtkdescription)); } + void SetNativeFontInfo(const char* gtkdescription); private: - DECLARE_DYNAMIC_CLASS(wxFontButton) + // Common part of both ctors. + void Init() + { + m_selectedColour = *wxBLACK; + } + + // This can't be changed by the user, but is provided to + // satisfy the wxFontPickerWidgetBase interface. + wxColour m_selectedColour; + + wxDECLARE_DYNAMIC_CLASS(wxFontButton); }; #endif // _WX_GTK_FONTPICKER_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/frame.h b/Externals/wxWidgets3/include/wx/gtk/frame.h index 1f172c43c1..878ba99732 100644 --- a/Externals/wxWidgets3/include/wx/gtk/frame.h +++ b/Externals/wxWidgets3/include/wx/gtk/frame.h @@ -39,36 +39,29 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - virtual ~wxFrame(); - #if wxUSE_STATUSBAR - void SetStatusBar(wxStatusBar *statbar); + void SetStatusBar(wxStatusBar *statbar) wxOVERRIDE; #endif // wxUSE_STATUSBAR #if wxUSE_TOOLBAR - void SetToolBar(wxToolBar *toolbar); + void SetToolBar(wxToolBar *toolbar) wxOVERRIDE; #endif // wxUSE_TOOLBAR - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - wxPoint GetClientAreaOrigin() const { return wxPoint(0, 0); } - -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // in Hildon environment all frames are always shown maximized - virtual bool IsMaximized() const { return true; } -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + wxPoint GetClientAreaOrigin() const wxOVERRIDE { return wxPoint(0, 0); } // implementation from now on // -------------------------- - virtual bool SendIdleEvents(wxIdleEvent& event); + virtual bool SendIdleEvents(wxIdleEvent& event) wxOVERRIDE; protected: // override wxWindow methods to take into account tool/menu/statusbars - virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; #if wxUSE_MENUS_NATIVE - virtual void DetachMenuBar(); - virtual void AttachMenuBar(wxMenuBar *menubar); + virtual void DetachMenuBar() wxOVERRIDE; + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; #endif // wxUSE_MENUS_NATIVE private: @@ -76,7 +69,7 @@ private: long m_fsSaveFlag; - DECLARE_DYNAMIC_CLASS(wxFrame) + wxDECLARE_DYNAMIC_CLASS(wxFrame); }; #endif // _WX_GTK_FRAME_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/gauge.h b/Externals/wxWidgets3/include/wx/gtk/gauge.h index 8df47461e5..1e6ff39202 100644 --- a/Externals/wxWidgets3/include/wx/gtk/gauge.h +++ b/Externals/wxWidgets3/include/wx/gtk/gauge.h @@ -40,11 +40,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxGaugeNameStr ); - void SetShadowWidth( int WXUNUSED(w) ) { } - void SetBezelFace( int WXUNUSED(w) ) { } - int GetShadowWidth() const { return 0; } - int GetBezelFace() const { return 0; } - // determinate mode API void SetRange( int r ); void SetValue( int pos ); @@ -60,7 +55,7 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - virtual wxVisualAttributes GetDefaultAttributes() const; + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE; // implementation // ------------- @@ -73,12 +68,12 @@ protected: // set the gauge value to the value of m_gaugePos void DoSetGauge(); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; private: void Init() { m_rangeMax = m_gaugePos = 0; } - DECLARE_DYNAMIC_CLASS(wxGauge) + wxDECLARE_DYNAMIC_CLASS(wxGauge); }; #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/glcanvas.h b/Externals/wxWidgets3/include/wx/gtk/glcanvas.h index 01591149b5..f194e60f37 100644 --- a/Externals/wxWidgets3/include/wx/gtk/glcanvas.h +++ b/Externals/wxWidgets3/include/wx/gtk/glcanvas.h @@ -20,6 +20,16 @@ class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11 { public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + wxEXPLICIT // avoid implicitly converting a wxWindow* to wxGLCanvas wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, const int *attribList = NULL, @@ -29,6 +39,15 @@ public: const wxString& name = wxGLCanvasName, const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, @@ -38,12 +57,12 @@ public: const int *attribList = NULL, const wxPalette& palette = wxNullPalette); - virtual bool SetBackgroundStyle(wxBackgroundStyle style); + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; // implement wxGLCanvasX11 methods // -------------------------------- - virtual Window GetXWindow() const; + virtual Window GetXWindow() const wxOVERRIDE; // deprecated methods @@ -90,7 +109,7 @@ public: #endif // WXWIN_COMPATIBILITY_2_8 // implementation from now on - void OnInternalIdle(); + void OnInternalIdle() wxOVERRIDE; bool m_exposed; #ifdef __WXGTK3__ @@ -104,7 +123,7 @@ public: #endif // WXWIN_COMPATIBILITY_2_8 private: - DECLARE_CLASS(wxGLCanvas) + wxDECLARE_CLASS(wxGLCanvas); }; #endif // _WX_GLCANVAS_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h b/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Externals/wxWidgets3/include/wx/gtk/hildon/notifmsg.h b/Externals/wxWidgets3/include/wx/gtk/hildon/notifmsg.h deleted file mode 100644 index ade115fe8a..0000000000 --- a/Externals/wxWidgets3/include/wx/gtk/hildon/notifmsg.h +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/gtk/hildon/notifmsg.h -// Purpose: Hildon implementation of wxNotificationMessage -// Author: Vadim Zeitlin -// Created: 2007-11-21 -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GTK_HILDON_NOTIFMSG_H_ -#define _WX_GTK_HILDON_NOTIFMSG_H_ - -typedef struct _HildonBanner HildonBanner; - -// ---------------------------------------------------------------------------- -// wxNotificationMessage -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase -{ -public: - wxNotificationMessage() { Init(); } - wxNotificationMessage(const wxString& title, - const wxString& message = wxString(), - wxWindow *parent = NULL) - : wxNotificationMessageBase(title, message, parent) - { - Init(); - } - - virtual ~wxNotificationMessage(); - - - virtual bool Show(int timeout = Timeout_Auto); - virtual bool Close(); - -private: - void Init() { m_banner = NULL; } - - // return the string containing markup for both the title and, if - // specified, the message - wxString HildonGetMarkup() const; - - // returns the widget of the parent GtkWindow to use or NULL - GtkWidget *HildonGetWindow() const; - - - // the banner we're showing, only non-NULL if it's an animation or progress - // banner as the informational dialog times out on its own and we don't - // need to store it (nor do we have any way to get its widget anyhow) - GtkWidget *m_banner; - - - wxDECLARE_NO_COPY_CLASS(wxNotificationMessage); -}; - -#endif // _WX_GTK_HILDON_NOTIFMSG_H_ - diff --git a/Externals/wxWidgets3/include/wx/gtk/hyperlink.h b/Externals/wxWidgets3/include/wx/gtk/hyperlink.h index 0b6ce6bf9a..16ea5c02c7 100644 --- a/Externals/wxWidgets3/include/wx/gtk/hyperlink.h +++ b/Externals/wxWidgets3/include/wx/gtk/hyperlink.h @@ -13,27 +13,32 @@ #include "wx/generic/hyperlink.h" +#include "wx/scopedptr.h" + +#ifdef __WXGTK3__ +class wxHyperlinkCtrlColData; +#endif + // ---------------------------------------------------------------------------- // wxHyperlinkCtrl // ---------------------------------------------------------------------------- class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl { + typedef wxGenericHyperlinkCtrl base_type; public: - // Default constructor (for two-step construction). - wxHyperlinkCtrl() { } - - // Constructor. + // Constructors (notice that they can't be defined inline for this class + // because of m_colData which uses incomplete wxHyperlinkCtrlColData). + wxHyperlinkCtrl(); wxHyperlinkCtrl(wxWindow *parent, wxWindowID id, const wxString& label, const wxString& url, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxHL_DEFAULT_STYLE, - const wxString& name = wxHyperlinkCtrlNameStr) - { - (void)Create(parent, id, label, url, pos, size, style, name); - } + const wxString& name = wxHyperlinkCtrlNameStr); + + virtual ~wxHyperlinkCtrl(); // Creation function (for two-step construction). bool Create(wxWindow *parent, @@ -46,27 +51,43 @@ public: // get/set - virtual wxColour GetHoverColour() const; - virtual void SetHoverColour(const wxColour &colour); + virtual wxColour GetHoverColour() const wxOVERRIDE; + virtual void SetHoverColour(const wxColour &colour) wxOVERRIDE; - virtual wxColour GetNormalColour() const; - virtual void SetNormalColour(const wxColour &colour); + virtual wxColour GetNormalColour() const wxOVERRIDE; + virtual void SetNormalColour(const wxColour &colour) wxOVERRIDE; - virtual wxColour GetVisitedColour() const; - virtual void SetVisitedColour(const wxColour &colour); + virtual wxColour GetVisitedColour() const wxOVERRIDE; + virtual void SetVisitedColour(const wxColour &colour) wxOVERRIDE; - virtual wxString GetURL() const; - virtual void SetURL(const wxString &url); + virtual wxString GetURL() const wxOVERRIDE; + virtual void SetURL(const wxString &url) wxOVERRIDE; - virtual void SetLabel(const wxString &label); + virtual void SetVisited(bool visited = true) wxOVERRIDE; + virtual bool GetVisited() const wxOVERRIDE; + + virtual void SetLabel(const wxString &label) wxOVERRIDE; protected: - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetBestClientSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl) +private: + enum LinkKind + { + Link_Normal, + Link_Visited + }; + + void DoSetLinkColour(LinkKind linkKind, const wxColour& colour); + +#ifdef __WXGTK3__ + wxScopedPtr m_colData; +#endif + + wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl); }; #endif // _WX_GTKHYPERLINKCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/infobar.h b/Externals/wxWidgets3/include/wx/gtk/infobar.h index 45563eb275..26653df2f5 100644 --- a/Externals/wxWidgets3/include/wx/gtk/infobar.h +++ b/Externals/wxWidgets3/include/wx/gtk/infobar.h @@ -38,14 +38,18 @@ public: // ---------------------------- virtual void ShowMessage(const wxString& msg, - int flags = wxICON_INFORMATION); + int flags = wxICON_INFORMATION) wxOVERRIDE; - virtual void Dismiss(); + virtual void Dismiss() wxOVERRIDE; virtual void AddButton(wxWindowID btnid, - const wxString& label = wxString()); + const wxString& label = wxString()) wxOVERRIDE; - virtual void RemoveButton(wxWindowID btnid); + virtual void RemoveButton(wxWindowID btnid) wxOVERRIDE; + + virtual size_t GetButtonCount() const wxOVERRIDE; + virtual wxWindowID GetButtonId(size_t idx) const wxOVERRIDE; + virtual bool HasButtonId(wxWindowID btnid) const wxOVERRIDE; // implementation only // ------------------- @@ -53,7 +57,7 @@ public: void GTKResponse(int btnid); protected: - virtual void DoApplyWidgetStyle(GtkRcStyle *style); + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; private: void Init() { m_impl = NULL; } diff --git a/Externals/wxWidgets3/include/wx/gtk/listbox.h b/Externals/wxWidgets3/include/wx/gtk/listbox.h index c40bda6a27..a99dca5c43 100644 --- a/Externals/wxWidgets3/include/wx/gtk/listbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/listbox.h @@ -63,25 +63,27 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; - virtual bool IsSelected(int n) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; - virtual void EnsureVisible(int n); + virtual void EnsureVisible(int n) wxOVERRIDE; - virtual void Update(); + virtual int GetTopItem() const wxOVERRIDE; + + virtual void Update() wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); // implementation from now on - virtual GtkWidget *GetConnectWidget(); + virtual GtkWidget *GetConnectWidget() wxOVERRIDE; struct _GtkTreeView *m_treeview; struct _GtkListStore *m_liststore; @@ -99,23 +101,23 @@ public: void GTKOnActivated(int item); protected: - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - virtual wxSize DoGetBestSize() const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - virtual void DoSetSelection(int n, bool select); + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; virtual int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, - void **clientData, wxClientDataType type); - virtual int DoInsertOneItem(const wxString& item, unsigned int pos); + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual int DoInsertOneItem(const wxString& item, unsigned int pos) wxOVERRIDE; - virtual void DoSetFirstItem(int n); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - virtual int DoListHitTest(const wxPoint& point) const; + virtual void DoSetFirstItem(int n) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; + virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE; // get the iterator for the given index, returns false if invalid bool GTKGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const; @@ -129,7 +131,7 @@ protected: private: void Init(); //common construction - DECLARE_DYNAMIC_CLASS(wxListBox) + wxDECLARE_DYNAMIC_CLASS(wxListBox); }; #endif // _WX_GTK_LISTBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/mdi.h b/Externals/wxWidgets3/include/wx/gtk/mdi.h index 02a61eb899..013c5cf878 100644 --- a/Externals/wxWidgets3/include/wx/gtk/mdi.h +++ b/Externals/wxWidgets3/include/wx/gtk/mdi.h @@ -49,13 +49,13 @@ public: // we don't store the active child in m_currentChild unlike the base class // version so override this method to find it dynamically - virtual wxMDIChildFrame *GetActiveChild() const; + virtual wxMDIChildFrame *GetActiveChild() const wxOVERRIDE; // implement base class pure virtuals // ---------------------------------- - virtual void ActivateNext(); - virtual void ActivatePrevious(); + virtual void ActivateNext() wxOVERRIDE; + virtual void ActivatePrevious() wxOVERRIDE; static bool IsTDI() { return true; } @@ -63,16 +63,16 @@ public: bool m_justInserted; - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; protected: - virtual void DoGetClientSize(int* width, int* height) const; + virtual void DoGetClientSize(int* width, int* height) const wxOVERRIDE; private: friend class wxMDIChildFrame; void Init(); - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); }; //----------------------------------------------------------------------------- @@ -106,18 +106,18 @@ public: virtual ~wxMDIChildFrame(); - virtual void SetMenuBar( wxMenuBar *menu_bar ); - virtual wxMenuBar *GetMenuBar() const; + virtual void SetMenuBar( wxMenuBar *menu_bar ) wxOVERRIDE; + virtual wxMenuBar *GetMenuBar() const wxOVERRIDE; - virtual void Activate(); + virtual void Activate() wxOVERRIDE; - virtual void SetTitle(const wxString& title); + virtual void SetTitle(const wxString& title) wxOVERRIDE; // implementation void OnActivate( wxActivateEvent& event ); void OnMenuHighlight( wxMenuEvent& event ); - virtual void GTKHandleRealized(); + virtual void GTKHandleRealized() wxOVERRIDE; wxMenuBar *m_menuBar; bool m_justInserted; @@ -127,8 +127,8 @@ private: GtkNotebook *GTKGetNotebook() const; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); }; //----------------------------------------------------------------------------- @@ -142,12 +142,12 @@ public: ~wxMDIClientWindow(); virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL); + long style = wxVSCROLL | wxHSCROLL) wxOVERRIDE; private: - virtual void AddChildGTK(wxWindowGTK* child); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); }; #endif // _WX_GTK_MDI_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/menu.h b/Externals/wxWidgets3/include/wx/gtk/menu.h index fec12ba977..49126e5583 100644 --- a/Externals/wxWidgets3/include/wx/gtk/menu.h +++ b/Externals/wxWidgets3/include/wx/gtk/menu.h @@ -23,25 +23,25 @@ public: ~wxMenuBar(); // implement base class (pure) virtuals - virtual bool Append( wxMenu *menu, const wxString &title ); - virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); - virtual wxMenu *Remove(size_t pos); + virtual bool Append( wxMenu *menu, const wxString &title ) wxOVERRIDE; + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) wxOVERRIDE; + virtual wxMenu *Remove(size_t pos) wxOVERRIDE; virtual int FindMenuItem(const wxString& menuString, - const wxString& itemString) const; - virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; + const wxString& itemString) const wxOVERRIDE; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const wxOVERRIDE; - 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 void EnableTop( size_t pos, bool flag ) wxOVERRIDE; + virtual bool IsEnabledTop(size_t pos) const wxOVERRIDE; + virtual void SetMenuLabel( size_t pos, const wxString& label ) wxOVERRIDE; + virtual wxString GetMenuLabel( size_t pos ) const wxOVERRIDE; - void SetLayoutDirection(wxLayoutDirection dir); - wxLayoutDirection GetLayoutDirection() const; + void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; - virtual void Attach(wxFrame *frame); - virtual void Detach(); + virtual void Attach(wxFrame *frame) wxOVERRIDE; + virtual void Detach() wxOVERRIDE; private: // common part of Append and Insert @@ -51,11 +51,11 @@ private: // wxMenuBar is not a top level window but it still doesn't need a parent // window - virtual bool GTKNeedsParent() const { return false; } + virtual bool GTKNeedsParent() const wxOVERRIDE { return false; } GtkWidget* m_menubar; - DECLARE_DYNAMIC_CLASS(wxMenuBar) + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); }; //----------------------------------------------------------------------------- @@ -73,16 +73,16 @@ public: virtual ~wxMenu(); - void Attach(wxMenuBarBase *menubar); + void Attach(wxMenuBarBase *menubar) wxOVERRIDE; - void SetLayoutDirection(const wxLayoutDirection dir); + void SetLayoutDirection(wxLayoutDirection dir); wxLayoutDirection GetLayoutDirection() const; // Returns the title, with mnemonics translated to wx format wxString GetTitle() const; // Sets the title, with mnemonics translated to gtk format - virtual void SetTitle(const wxString& title); + virtual void SetTitle(const wxString& title) wxOVERRIDE; // implementation GTK only GtkWidget *m_menu; // GtkMenu @@ -91,9 +91,9 @@ public: bool m_popupShown; protected: - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); + virtual wxMenuItem* DoAppend(wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) wxOVERRIDE; + virtual wxMenuItem* DoRemove(wxMenuItem *item) wxOVERRIDE; private: // common code for all constructors: @@ -103,7 +103,7 @@ private: void GtkAppend(wxMenuItem* item, int pos = -1); - DECLARE_DYNAMIC_CLASS(wxMenu) + wxDECLARE_DYNAMIC_CLASS(wxMenu); }; #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/menuitem.h b/Externals/wxWidgets3/include/wx/gtk/menuitem.h index c17ad03a97..376959b32e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/menuitem.h +++ b/Externals/wxWidgets3/include/wx/gtk/menuitem.h @@ -27,10 +27,10 @@ public: virtual ~wxMenuItem(); // implement base class virtuals - virtual void SetItemLabel( const wxString& str ); - virtual void Enable( bool enable = true ); - virtual void Check( bool check = true ); - virtual bool IsChecked() const; + virtual void SetItemLabel( const wxString& str ) wxOVERRIDE; + virtual void Enable( bool enable = true ) wxOVERRIDE; + virtual void Check( bool check = true ) wxOVERRIDE; + virtual bool IsChecked() const wxOVERRIDE; virtual void SetBitmap(const wxBitmap& bitmap); virtual const wxBitmap& GetBitmap() const { return m_bitmap; } @@ -55,7 +55,7 @@ private: wxBitmap m_bitmap; // Bitmap for menuitem, if any GtkWidget *m_menuItem; // GtkMenuItem - DECLARE_DYNAMIC_CLASS(wxMenuItem) + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); }; #endif // _WX_GTKMENUITEM_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/minifram.h b/Externals/wxWidgets3/include/wx/gtk/minifram.h index 748f266a9a..57a6f28c3a 100644 --- a/Externals/wxWidgets3/include/wx/gtk/minifram.h +++ b/Externals/wxWidgets3/include/wx/gtk/minifram.h @@ -18,7 +18,7 @@ class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { - DECLARE_DYNAMIC_CLASS(wxMiniFrame) + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); public: wxMiniFrame() {} @@ -42,13 +42,13 @@ public: long style = wxCAPTION | wxRESIZE_BORDER, const wxString& name = wxFrameNameStr); - virtual void SetTitle( const wxString &title ); + virtual void SetTitle( const wxString &title ) wxOVERRIDE; protected: virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, - int incW, int incH ); - virtual void DoGetClientSize(int* width, int* height) const; + int incW, int incH ) wxOVERRIDE; + virtual void DoGetClientSize(int* width, int* height) const wxOVERRIDE; // implementation public: diff --git a/Externals/wxWidgets3/include/wx/gtk/msgdlg.h b/Externals/wxWidgets3/include/wx/gtk/msgdlg.h index 670d7f9782..5a55f32a50 100644 --- a/Externals/wxWidgets3/include/wx/gtk/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/gtk/msgdlg.h @@ -19,33 +19,33 @@ public: long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); - virtual int ShowModal(); - virtual bool Show(bool WXUNUSED(show) = true) { return false; } + virtual int ShowModal() wxOVERRIDE; + virtual bool Show(bool WXUNUSED(show) = true) wxOVERRIDE { return false; } protected: // implement some base class methods to do nothing to avoid asserts and // GTK warnings, since this is not a real wxDialog. virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height)) {} + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} // override to convert wx mnemonics to GTK+ ones and handle stock ids - virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label); + virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) wxOVERRIDE; private: // override to use stock GTK+ defaults instead of just string ones - virtual wxString GetDefaultYesLabel() const; - virtual wxString GetDefaultNoLabel() const; - virtual wxString GetDefaultOKLabel() const; - virtual wxString GetDefaultCancelLabel() const; - virtual wxString GetDefaultHelpLabel() const; + virtual wxString GetDefaultYesLabel() const wxOVERRIDE; + virtual wxString GetDefaultNoLabel() const wxOVERRIDE; + virtual wxString GetDefaultOKLabel() const wxOVERRIDE; + virtual wxString GetDefaultCancelLabel() const wxOVERRIDE; + virtual wxString GetDefaultHelpLabel() const wxOVERRIDE; // create the real GTK+ dialog: this is done from ShowModal() to allow // changing the message between constructing the dialog and showing it void GTKCreateMsgDialog(); - DECLARE_DYNAMIC_CLASS(wxMessageDialog) + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); }; #endif // _WX_GTK_MSGDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h b/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h index 70e853c1ce..bc4687b5c5 100644 --- a/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h +++ b/Externals/wxWidgets3/include/wx/gtk/nonownedwnd.h @@ -23,13 +23,13 @@ public: virtual ~wxNonOwnedWindow(); // Overridden to actually set the shape when the window becomes realized. - virtual void GTKHandleRealized(); + virtual void GTKHandleRealized() wxOVERRIDE; protected: - virtual bool DoClearShape(); - virtual bool DoSetRegionShape(const wxRegion& region); + virtual bool DoClearShape() wxOVERRIDE; + virtual bool DoSetRegionShape(const wxRegion& region) wxOVERRIDE; #if wxUSE_GRAPHICS_CONTEXT - virtual bool DoSetPathShape(const wxGraphicsPath& path); + virtual bool DoSetPathShape(const wxGraphicsPath& path) wxOVERRIDE; #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Externals/wxWidgets3/include/wx/gtk/notebook.h b/Externals/wxWidgets3/include/wx/gtk/notebook.h index 6edbb84fb1..395927cc69 100644 --- a/Externals/wxWidgets3/include/wx/gtk/notebook.h +++ b/Externals/wxWidgets3/include/wx/gtk/notebook.h @@ -51,35 +51,35 @@ public: // set the currently selected page, return the index of the previously // selected one (or wxNOT_FOUND on error) // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } + int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); } // get the currently selected page - int GetSelection() const; + int GetSelection() const wxOVERRIDE; // changes selected page without sending events - int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } + int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); } // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; + bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + wxString GetPageText(size_t nPage) const wxOVERRIDE; // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); + int GetPageImage(size_t nPage) const wxOVERRIDE; + bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; // control the appearance of the notebook pages // set the padding between tabs (in pixels) - void SetPadding(const wxSize& padding); + void SetPadding(const wxSize& padding) wxOVERRIDE; // sets the size of the tabs (assumes all tabs are the same size) - void SetTabSize(const wxSize& sz); + void SetTabSize(const wxSize& sz) wxOVERRIDE; // geometry - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; // operations // ---------- // remove all pages - bool DeleteAllPages(); + bool DeleteAllPages() wxOVERRIDE; // adds a new page to the notebook (it will be deleted by the notebook, // don't delete it yourself). If bSelect, this page becomes active. @@ -88,7 +88,7 @@ public: wxNotebookPage *win, const wxString& strText, bool bSelect = false, - int imageId = NO_IMAGE ); + int imageId = NO_IMAGE ) wxOVERRIDE; // handler for tab navigation // -------------------------- @@ -102,8 +102,8 @@ public: // -------------- #if wxUSE_CONSTRAINTS - void SetConstraintSizes(bool recurse); - bool DoPhase(int phase); + void SetConstraintSizes(bool recurse) wxOVERRIDE; + bool DoPhase(int phase) wxOVERRIDE; #endif // Called by GTK event handler when the current page is definitely changed. @@ -122,23 +122,23 @@ public: protected: // set all page's attributes - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; // remove one page from the notebook but do not destroy it - virtual wxNotebookPage *DoRemovePage(size_t nPage); + virtual wxNotebookPage *DoRemovePage(size_t nPage) wxOVERRIDE; - int DoSetSelection(size_t nPage, int flags = 0); + int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE; private: // the padding set by SetPadding() int m_padding; void Init(); - virtual void AddChildGTK(wxWindowGTK* child); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_GTKNOTEBOOK_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/notifmsg.h b/Externals/wxWidgets3/include/wx/gtk/notifmsg.h deleted file mode 100644 index 9135b3aee8..0000000000 --- a/Externals/wxWidgets3/include/wx/gtk/notifmsg.h +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/gtk/notifmsg.h -// Purpose: wxNotificationMessage for wxGTK. -// Author: Vadim Zeitlin -// Created: 2012-07-25 -// Copyright: (c) 2012 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GTK_NOTIFMSG_H_ -#define _WX_GTK_NOTIFMSG_H_ - -typedef struct _NotifyNotification NotifyNotification; - -// ---------------------------------------------------------------------------- -// wxNotificationMessage -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase -{ -public: - wxNotificationMessage() { Init(); } - wxNotificationMessage(const wxString& title, - const wxString& message = wxString(), - wxWindow *parent = NULL, - int flags = wxICON_INFORMATION) - : wxNotificationMessageBase(title, message, parent, flags) - { - Init(); - } - - virtual ~wxNotificationMessage(); - - - virtual bool Show(int timeout = Timeout_Auto); - virtual bool Close(); - - // Set the name of the icon to use, overriding the default icon determined - // by the flags. Call with empty string to reset custom icon. - bool GTKSetIconName(const wxString& name); - -private: - void Init() { m_notification = NULL; } - - NotifyNotification* m_notification; - wxString m_iconName; - - wxDECLARE_NO_COPY_CLASS(wxNotificationMessage); -}; - -#endif // _WX_GTK_NOTIFMSG_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/pen.h b/Externals/wxWidgets3/include/wx/gtk/pen.h index 85aa102747..40f809b5ef 100644 --- a/Externals/wxWidgets3/include/wx/gtk/pen.h +++ b/Externals/wxWidgets3/include/wx/gtk/pen.h @@ -21,44 +21,43 @@ public: wxPen() { } wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); -#endif virtual ~wxPen(); bool operator==(const wxPen& pen) const; bool operator!=(const wxPen& pen) const { return !(*this == pen); } - void SetColour( const wxColour &colour ); - void SetColour( unsigned char red, unsigned char green, unsigned char blue ); - void SetCap( wxPenCap capStyle ); - void SetJoin( wxPenJoin joinStyle ); - void SetStyle( wxPenStyle style ); - void SetWidth( int width ); - void SetDashes( int number_of_dashes, const wxDash *dash ); - void SetStipple(const wxBitmap& stipple); + void SetColour( const wxColour &colour ) wxOVERRIDE; + void SetColour( unsigned char red, unsigned char green, unsigned char blue ) wxOVERRIDE; + void SetCap( wxPenCap capStyle ) wxOVERRIDE; + void SetJoin( wxPenJoin joinStyle ) wxOVERRIDE; + void SetStyle( wxPenStyle style ) wxOVERRIDE; + void SetWidth( int width ) wxOVERRIDE; + void SetDashes( int number_of_dashes, const wxDash *dash ) wxOVERRIDE; + void SetStipple(const wxBitmap& stipple) wxOVERRIDE; - wxColour GetColour() const; - wxPenCap GetCap() const; - wxPenJoin GetJoin() const; - wxPenStyle GetStyle() const; - int GetWidth() const; - int GetDashes(wxDash **ptr) const; + wxColour GetColour() const wxOVERRIDE; + wxPenCap GetCap() const wxOVERRIDE; + wxPenJoin GetJoin() const wxOVERRIDE; + wxPenStyle GetStyle() const wxOVERRIDE; + int GetWidth() const wxOVERRIDE; + int GetDashes(wxDash **ptr) const wxOVERRIDE; int GetDashCount() const; wxDash* GetDash() const; - wxBitmap *GetStipple() const; + wxBitmap *GetStipple() const wxOVERRIDE; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxPenStyle)style); } -#endif + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxPen) + wxDECLARE_DYNAMIC_CLASS(wxPen); }; #endif // _WX_GTK_PEN_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/popupwin.h b/Externals/wxWidgets3/include/wx/gtk/popupwin.h index 1c848795b9..566a7c05b4 100644 --- a/Externals/wxWidgets3/include/wx/gtk/popupwin.h +++ b/Externals/wxWidgets3/include/wx/gtk/popupwin.h @@ -24,9 +24,9 @@ public: { (void)Create(parent, flags); } bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - virtual bool Show(bool show = true); + virtual bool Show(bool show = true) wxOVERRIDE; - virtual void SetFocus(); + virtual void SetFocus() wxOVERRIDE; // implementation // -------------- @@ -37,14 +37,14 @@ public: protected: virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; - virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; #ifdef __WXUNIVERSAL__ - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); #endif - DECLARE_DYNAMIC_CLASS(wxPopupWindow) + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); }; #endif // _WX_GTK_POPUPWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/print.h b/Externals/wxWidgets3/include/wx/gtk/print.h index e4eae1cef3..b01b3cd524 100644 --- a/Externals/wxWidgets3/include/wx/gtk/print.h +++ b/Externals/wxWidgets3/include/wx/gtk/print.h @@ -33,34 +33,34 @@ typedef struct _cairo cairo_t; class wxGtkPrintFactory: public wxPrintFactory { public: - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) wxOVERRIDE; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ); + wxPrintDialogData *data = NULL ) wxOVERRIDE; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout, - wxPrintData *data ); + wxPrintData *data ) wxOVERRIDE; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ); + wxPrintDialogData *data = NULL ) wxOVERRIDE; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ); + wxPrintData *data ) wxOVERRIDE; virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ); + wxPageSetupDialogData * data = NULL ) wxOVERRIDE; - virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) wxOVERRIDE; - virtual bool HasPrintSetupDialog(); - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); - virtual bool HasOwnPrintToFile(); - virtual bool HasPrinterLine(); - virtual wxString CreatePrinterLine(); - virtual bool HasStatusLine(); - virtual wxString CreateStatusLine(); + virtual bool HasPrintSetupDialog() wxOVERRIDE; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) wxOVERRIDE; + virtual bool HasOwnPrintToFile() wxOVERRIDE; + virtual bool HasPrinterLine() wxOVERRIDE; + virtual wxString CreatePrinterLine() wxOVERRIDE; + virtual bool HasStatusLine() wxOVERRIDE; + virtual wxString CreateStatusLine() wxOVERRIDE; - virtual wxPrintNativeDataBase *CreatePrintNativeData(); + virtual wxPrintNativeDataBase *CreatePrintNativeData() wxOVERRIDE; }; //---------------------------------------------------------------------------- @@ -75,19 +75,19 @@ public: wxGtkPrintDialog( wxWindow *parent, wxPrintData* data); virtual ~wxGtkPrintDialog(); - wxPrintData& GetPrintData() + wxPrintData& GetPrintData() wxOVERRIDE { return m_printDialogData.GetPrintData(); } - wxPrintDialogData& GetPrintDialogData() + wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } - wxDC *GetPrintDC() { return m_dc; } + wxDC *GetPrintDC() wxOVERRIDE { return m_dc; } void SetPrintDC(wxDC * printDC) { m_dc = printDC; } - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; - virtual bool Validate() { return true; } - virtual bool TransferDataToWindow() { return true; } - virtual bool TransferDataFromWindow() { return true; } + virtual bool Validate() wxOVERRIDE { return true; } + virtual bool TransferDataToWindow() wxOVERRIDE { return true; } + virtual bool TransferDataFromWindow() wxOVERRIDE { return true; } void SetShowDialog(bool show) { m_showDialog = show; } bool GetShowDialog() { return m_showDialog; } @@ -97,9 +97,9 @@ protected: // GTK warnings, since this is not a real wxDialog. virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height)) {} + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} private: wxPrintDialogData m_printDialogData; @@ -107,7 +107,7 @@ private: bool m_showDialog; wxDC *m_dc; - DECLARE_DYNAMIC_CLASS(wxGtkPrintDialog) + wxDECLARE_DYNAMIC_CLASS(wxGtkPrintDialog); }; //---------------------------------------------------------------------------- @@ -121,28 +121,28 @@ public: wxPageSetupDialogData* data = NULL ); virtual ~wxGtkPageSetupDialog(); - virtual wxPageSetupDialogData& GetPageSetupDialogData() { return m_pageDialogData; } + virtual wxPageSetupDialogData& GetPageSetupDialogData() wxOVERRIDE { return m_pageDialogData; } - virtual int ShowModal(); + virtual int ShowModal() wxOVERRIDE; - virtual bool Validate() { return true; } - virtual bool TransferDataToWindow() { return true; } - virtual bool TransferDataFromWindow() { return true; } + virtual bool Validate() wxOVERRIDE { return true; } + virtual bool TransferDataToWindow() wxOVERRIDE { return true; } + virtual bool TransferDataFromWindow() wxOVERRIDE { return true; } protected: // Implement some base class methods to do nothing to avoid asserts and // GTK warnings, since this is not a real wxDialog. virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) wxOVERRIDE {} virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height)) {} + int WXUNUSED(width), int WXUNUSED(height)) wxOVERRIDE {} private: wxPageSetupDialogData m_pageDialogData; wxWindow *m_parent; - DECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog) + wxDECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog); }; //---------------------------------------------------------------------------- @@ -157,9 +157,9 @@ public: virtual bool Print(wxWindow *parent, wxPrintout *printout, - bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); - virtual bool Setup(wxWindow *parent); + bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; + virtual bool Setup(wxWindow *parent) wxOVERRIDE; GtkPrintContext *GetPrintContext() { return m_gpc; } void SetPrintContext(GtkPrintContext *context) {m_gpc = context;} @@ -170,7 +170,7 @@ private: GtkPrintContext *m_gpc; wxDC *m_dc; - DECLARE_DYNAMIC_CLASS(wxGtkPrinter) + wxDECLARE_DYNAMIC_CLASS(wxGtkPrinter); wxDECLARE_NO_COPY_CLASS(wxGtkPrinter); }; @@ -184,11 +184,11 @@ public: wxGtkPrintNativeData(); virtual ~wxGtkPrintNativeData(); - virtual bool TransferTo( wxPrintData &data ); - virtual bool TransferFrom( const wxPrintData &data ); + virtual bool TransferTo( wxPrintData &data ) wxOVERRIDE; + virtual bool TransferFrom( const wxPrintData &data ) wxOVERRIDE; - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return true; } + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE { return true; } GtkPrintSettings* GetPrintConfig() { return m_config; } void SetPrintConfig( GtkPrintSettings * config ); @@ -210,7 +210,7 @@ private: GtkPrintOperation *m_job; GtkPrintContext *m_context; - DECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData) + wxDECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData); }; //----------------------------------------------------------------------------- @@ -224,75 +224,75 @@ public: virtual ~wxGtkPrinterDCImpl(); bool Ok() const { return IsOk(); } - bool IsOk() const; + bool IsOk() const wxOVERRIDE; - virtual void* GetCairoContext() const; - virtual void* GetHandle() const; + virtual void* GetCairoContext() const wxOVERRIDE; + virtual void* GetHandle() const wxOVERRIDE; - bool CanDrawBitmap() const { return true; } - void Clear(); - void SetFont( const wxFont& font ); - void SetPen( const wxPen& pen ); - void SetBrush( const wxBrush& brush ); - void SetLogicalFunction( wxRasterOperationMode function ); - void SetBackground( const wxBrush& brush ); - void DestroyClippingRegion(); - bool StartDoc(const wxString& message); - void EndDoc(); - void StartPage(); - void EndPage(); - wxCoord GetCharHeight() const; - wxCoord GetCharWidth() const; - bool CanGetTextExtent() const { return true; } - wxSize GetPPI() const; - virtual int GetDepth() const { return 24; } - void SetBackgroundMode(int mode); - void SetPalette(const wxPalette& WXUNUSED(palette)) { } + bool CanDrawBitmap() const wxOVERRIDE { return true; } + void Clear() wxOVERRIDE; + void SetFont( const wxFont& font ) wxOVERRIDE; + void SetPen( const wxPen& pen ) wxOVERRIDE; + void SetBrush( const wxBrush& brush ) wxOVERRIDE; + void SetLogicalFunction( wxRasterOperationMode function ) wxOVERRIDE; + void SetBackground( const wxBrush& brush ) wxOVERRIDE; + void DestroyClippingRegion() wxOVERRIDE; + bool StartDoc(const wxString& message) wxOVERRIDE; + void EndDoc() wxOVERRIDE; + void StartPage() wxOVERRIDE; + void EndPage() wxOVERRIDE; + wxCoord GetCharHeight() const wxOVERRIDE; + wxCoord GetCharWidth() const wxOVERRIDE; + bool CanGetTextExtent() const wxOVERRIDE { return true; } + wxSize GetPPI() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE { return 24; } + void SetBackgroundMode(int mode) wxOVERRIDE; + void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } void SetResolution(int ppi); // overridden for wxPrinterDC Impl - virtual int GetResolution() const; - virtual wxRect GetPaperRect() const; + virtual int GetResolution() const wxOVERRIDE; + virtual wxRect GetPaperRect() const wxOVERRIDE; protected: bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, - wxFloodFillStyle style=wxFLOOD_SURFACE ); - void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter); - void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST); - bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; - void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); - void DoCrossHair(wxCoord x, wxCoord y); - void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc); - void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea); - void DoDrawPoint(wxCoord x, wxCoord y); - void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0); - void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE); - void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE); - void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0); - void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + wxFloodFillStyle style=wxFLOOD_SURFACE ) wxOVERRIDE; + void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) wxOVERRIDE; + void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST) wxOVERRIDE; + bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const wxOVERRIDE; + void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) wxOVERRIDE; + void DoCrossHair(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) wxOVERRIDE; + void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) wxOVERRIDE; + void DoDrawPoint(wxCoord x, wxCoord y) wxOVERRIDE; + void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) wxOVERRIDE; + void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) wxOVERRIDE; + void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0) wxOVERRIDE; + void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; #if wxUSE_SPLINES - void DoDrawSpline(const wxPointList *points); + void DoDrawSpline(const wxPointList *points) wxOVERRIDE; #endif bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop = wxCOPY, bool useMask = false, - wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); - void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ); - void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false ); - void DoDrawText(const wxString& text, wxCoord x, wxCoord y ); - void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle); - void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); - void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) ) + wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) wxOVERRIDE; + void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) wxOVERRIDE; + void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false ) wxOVERRIDE; + void DoDrawText(const wxString& text, wxCoord x, wxCoord y ) wxOVERRIDE; + void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) wxOVERRIDE; + void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE; + void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) ) wxOVERRIDE { wxFAIL_MSG( "not implemented" ); } void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - const wxFont *theFont = NULL ) const; - void DoGetSize(int* width, int* height) const; - void DoGetSizeMM(int *width, int *height) const; + const wxFont *theFont = NULL ) const wxOVERRIDE; + void DoGetSize(int* width, int* height) const wxOVERRIDE; + void DoGetSizeMM(int *width, int *height) const wxOVERRIDE; wxPrintData& GetPrintData() { return m_printData; } void SetPrintData(const wxPrintData& data); @@ -314,7 +314,7 @@ private: double m_PS2DEV; double m_DEV2PS; - DECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl) + wxDECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl); wxDECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl); }; @@ -335,8 +335,8 @@ public: virtual ~wxGtkPrintPreview(); - virtual bool Print(bool interactive); - virtual void DetermineScaling(); + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; private: void Init(wxPrintout *printout, @@ -346,7 +346,7 @@ private: // resolution to use in DPI int m_resolution; - DECLARE_CLASS(wxGtkPrintPreview) + wxDECLARE_CLASS(wxGtkPrintPreview); }; #endif // wxUSE_GTKPRINT diff --git a/Externals/wxWidgets3/include/wx/gtk/private/addremovectrl.h b/Externals/wxWidgets3/include/wx/gtk/private/addremovectrl.h new file mode 100644 index 0000000000..5644801b6e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/addremovectrl.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/addremovectrl.h +// Purpose: GTK specific wxAddRemoveImpl implementation +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/artprov.h" +#include "wx/bmpbuttn.h" +#include "wx/toolbar.h" + +#include + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplBase +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplBase(adaptor, parent, ctrlItems), + m_tbar(new wxToolBar(parent, wxID_ANY)) + { + m_tbar->AddTool(wxID_ADD, wxString(), GetNamedBitmap("list-add")); + m_tbar->AddTool(wxID_REMOVE, wxString(), GetNamedBitmap("list-remove")); + +#ifdef __WXGTK3__ + // Tweak the toolbar appearance to correspond to how the toolbars used + // in other GNOME applications for similar purposes look. + GtkToolbar* const toolbar = m_tbar->GTKGetToolbar(); + GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(toolbar)); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_INLINE_TOOLBAR); + gtk_style_context_set_junction_sides(context, GTK_JUNCTION_TOP); +#endif // GTK+3 + + wxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL); + sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand()); + sizerTop->Add(m_tbar, wxSizerFlags().Expand()); + parent->SetSizer(sizerTop); + + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIRemove, this, wxID_REMOVE); + + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnAdd, this, wxID_ADD); + m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnRemove, this, wxID_REMOVE); + } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) wxOVERRIDE + { + m_tbar->SetToolShortHelp(wxID_ADD, addtip); + m_tbar->SetToolShortHelp(wxID_REMOVE, removetip); + } + +private: + static wxBitmap GetNamedBitmap(const wxString& name) + { + // GTK UI guidelines recommend using "symbolic" versions of the icons + // for these buttons, so try them first but fall back to the normal + // ones if symbolic theme is not installed. + wxBitmap bmp = wxArtProvider::GetBitmap(name + "-symbolic", wxART_MENU); + if ( !bmp.IsOk() ) + bmp = wxArtProvider::GetBitmap(name, wxART_MENU); + return bmp; + } + + wxToolBar* const m_tbar; +}; + +#endif // _WX_GTK_PRIVATE_ADDREMOVECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/eventsdisabler.h b/Externals/wxWidgets3/include/wx/gtk/private/eventsdisabler.h new file mode 100644 index 0000000000..5ca9c7b590 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/eventsdisabler.h @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/eventsdisabler.h +// Purpose: Helper for temporarily disabling events. +// Author: Vadim Zeitlin +// Created: 2016-02-06 +// Copyright: (c) 2016 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_EVENTSDISABLER_H_ +#define _GTK_PRIVATE_EVENTSDISABLER_H_ + +// ---------------------------------------------------------------------------- +// wxGtkEventsDisabler: calls GTKDisableEvents() and GTKEnableEvents() in dtor. +// ---------------------------------------------------------------------------- + +// Template parameter T must be a wxGTK class providing the required methods, +// e.g. wxCheckBox, wxChoice, ... +template +class wxGtkEventsDisabler +{ +public: + // Disable the events for the specified (non-NULL, having lifetime greater + // than ours) window for the lifetime of this object. + explicit wxGtkEventsDisabler(T* win) : m_win(win) + { + m_win->GTKDisableEvents(); + } + + ~wxGtkEventsDisabler() + { + m_win->GTKEnableEvents(); + } + +private: + T* const m_win; + + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxGtkEventsDisabler, T); +}; + +#endif // _GTK_PRIVATE_EVENTSDISABLER_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h b/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h index 20e9358d90..a3d45e2d92 100644 --- a/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h +++ b/Externals/wxWidgets3/include/wx/gtk/private/gtk2-compat.h @@ -193,6 +193,13 @@ static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* } #define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding +static inline void wx_gtk_cell_renderer_set_padding(GtkCellRenderer* cell, gint xpad, gint ypad) +{ + cell->xpad = xpad; + cell->ypad = ypad; +} +#define gtk_cell_renderer_set_padding wx_gtk_cell_renderer_set_padding + static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation) { *allocation = widget->allocation; @@ -298,6 +305,12 @@ static inline void wx_gtk_widget_set_allocation(GtkWidget* widget, const GtkAllo } #define gtk_widget_set_allocation wx_gtk_widget_set_allocation +static inline gboolean wx_gtk_widget_is_toplevel(GtkWidget* widget) +{ + return GTK_WIDGET_TOPLEVEL(widget); +} +#define gtk_widget_is_toplevel wx_gtk_widget_is_toplevel + // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.20 @@ -374,6 +387,8 @@ static inline gboolean wx_gtk_window_has_group(GtkWindow* window) // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 2.24 +#define gdk_window_get_visual gdk_drawable_get_visual + static inline GdkDisplay* wx_gdk_window_get_display(GdkWindow* window) { return gdk_drawable_get_display(window); @@ -511,5 +526,9 @@ static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequis } #define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size +// There is no equivalent in GTK+ 2, but it's not needed there anyhow as the +// backend is determined at compile time in that version. +#define GDK_IS_X11_DISPLAY(dpy) true + #endif // !__WXGTK3__ #endif // _WX_GTK_PRIVATE_COMPAT_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/gtk3-compat.h b/Externals/wxWidgets3/include/wx/gtk/private/gtk3-compat.h new file mode 100644 index 0000000000..2aa415d544 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/gtk3-compat.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/gtk3-compat.h +// Purpose: Compatibility code for older GTK+ 3 versions +// Author: Paul Cornett +// Created: 2015-10-10 +// Copyright: (c) 2015 Paul Cornett +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_COMPAT3_H_ +#define _WX_GTK_PRIVATE_COMPAT3_H_ + +#if defined(__WXGTK3__) + +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.12 + +static inline void wx_gtk_widget_set_margin_start(GtkWidget* widget, gint margin) +{ + gtk_widget_set_margin_left(widget, margin); +} +#define gtk_widget_set_margin_start wx_gtk_widget_set_margin_start + +static inline void wx_gtk_widget_set_margin_end(GtkWidget* widget, gint margin) +{ + gtk_widget_set_margin_right(widget, margin); +} +#define gtk_widget_set_margin_end wx_gtk_widget_set_margin_end + +wxGCC_WARNING_RESTORE() + +#endif // __WXGTK3__ +#endif // _WX_GTK_PRIVATE_COMPAT3_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/treeview.h b/Externals/wxWidgets3/include/wx/gtk/private/treeview.h new file mode 100644 index 0000000000..d029a8ff78 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/treeview.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/treeview.h +// Purpose: Private helpers for wxGTK controls using GtkTreeView +// Author: Vadim Zeitlin +// Created: 2016-02-06 (extracted from src/gtk/dataview.cpp) +// Copyright: (c) 2016 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _GTK_PRIVATE_TREEVIEW_H_ +#define _GTK_PRIVATE_TREEVIEW_H_ + +// ---------------------------------------------------------------------------- +// wxGtkTreePath: RAII wrapper for GtkTreePath +// ---------------------------------------------------------------------------- + +// Usually this object is initialized with the associated GtkTreePath +// immediately when it's constructed but it can also be changed later either by +// using Assign() or by getting the pointer to the internally stored pointer +// value using ByRef(). The latter should be avoided but is very convenient +// when using GTK functions with GtkTreePath output parameters. +class wxGtkTreePath +{ +public: + // Ctor takes ownership of the given path and will free it if non-NULL. + wxGtkTreePath(GtkTreePath *path = NULL) : m_path(path) { } + + // Creates a tree path for the given string path. + wxGtkTreePath(const gchar *strpath) + : m_path(gtk_tree_path_new_from_string(strpath)) + { + } + + // Set the stored pointer if not done by ctor. + void Assign(GtkTreePath *path) + { + wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); + + m_path = path; + } + + // Return the pointer to the internally stored pointer. This should only be + // used to initialize the object by passing it to some GTK function. + GtkTreePath **ByRef() + { + wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); + + return &m_path; + } + + + operator GtkTreePath *() const { return m_path; } + + ~wxGtkTreePath() { if ( m_path ) gtk_tree_path_free(m_path); } + +private: + GtkTreePath *m_path; + + wxDECLARE_NO_COPY_CLASS(wxGtkTreePath); +}; + +#endif // _GTK_PRIVATE_TREEVIEW_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/private/value.h b/Externals/wxWidgets3/include/wx/gtk/private/value.h new file mode 100644 index 0000000000..e6ce836a2f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/gtk/private/value.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/gtk/private/value.h +// Purpose: Helper wrapper for working with GValue. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_PRIVATE_VALUE_H_ +#define _WX_GTK_PRIVATE_VALUE_H_ + +// ---------------------------------------------------------------------------- +// wxGtkValue: RAII wrapper for GValue +// ---------------------------------------------------------------------------- + +class wxGtkValue +{ +public: + // Initialize the value of the specified type. + explicit wxGtkValue(GType gtype) + : m_val(G_VALUE_INIT) + { + g_value_init(&m_val, gtype); + } + + ~wxGtkValue() + { + g_value_unset(&m_val); + } + + // Unsafe but convenient access to the real value for GTK+ functions. + operator GValue*() { return &m_val; } + +private: + GValue m_val; + + // For now we just don't support copying at all for simplicity, it could be + // implemented later if needed. + wxDECLARE_NO_COPY_CLASS(wxGtkValue); +}; + +#endif // _WX_GTK_PRIVATE_VALUE_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/radiobox.h b/Externals/wxWidgets3/include/wx/gtk/radiobox.h index a7f6bd9125..9e7df61a93 100644 --- a/Externals/wxWidgets3/include/wx/gtk/radiobox.h +++ b/Externals/wxWidgets3/include/wx/gtk/radiobox.h @@ -83,38 +83,38 @@ public: // implement wxItemContainerImmutable methods - virtual unsigned int GetCount() const; + virtual unsigned int GetCount() const wxOVERRIDE; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; - virtual void SetSelection(int n); - virtual int GetSelection() const; + virtual void SetSelection(int n) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; // implement wxRadioBoxBase methods - virtual bool Show(unsigned int n, bool show = true); - virtual bool Enable(unsigned int n, bool enable = true); + virtual bool Show(unsigned int n, bool show = true) wxOVERRIDE; + virtual bool Enable(unsigned int n, bool enable = true) wxOVERRIDE; - virtual bool IsItemEnabled(unsigned int n) const; - virtual bool IsItemShown(unsigned int n) const; + virtual bool IsItemEnabled(unsigned int n) const wxOVERRIDE; + virtual bool IsItemShown(unsigned int n) const wxOVERRIDE; // override some base class methods to operate on radiobox itself too - virtual bool Show( bool show = true ); - virtual bool Enable( bool enable = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool Enable( bool enable = true ) wxOVERRIDE; - virtual void SetLabel( const wxString& label ); + virtual void SetLabel( const wxString& label ) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - virtual int GetItemFromPoint( const wxPoint& pt ) const; + virtual int GetItemFromPoint( const wxPoint& pt ) const wxOVERRIDE; #if wxUSE_HELP // override virtual wxWindow::GetHelpTextAtPoint to use common platform independent // wxRadioBoxBase::DoGetHelpTextAtPoint from the platform independent // base class-interface wxRadioBoxBase. - virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const + virtual wxString GetHelpTextAtPoint(const wxPoint & pt, wxHelpEvent::Origin origin) const wxOVERRIDE { return wxRadioBoxBase::DoGetHelpTextAtPoint( this, pt, origin ); } @@ -126,28 +126,28 @@ public: void GtkDisableEvents(); void GtkEnableEvents(); #if wxUSE_TOOLTIPS - virtual void GTKApplyToolTip(const char* tip); + virtual void GTKApplyToolTip(const char* tip) wxOVERRIDE; #endif // wxUSE_TOOLTIPS wxRadioBoxButtonsInfoList m_buttonsInfo; protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } #if wxUSE_TOOLTIPS - virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip); + virtual void DoSetItemToolTip(unsigned int n, wxToolTip *tooltip) wxOVERRIDE; #endif - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - virtual bool GTKNeedsToFilterSameWindowFocus() const { return true; } + virtual bool GTKNeedsToFilterSameWindowFocus() const wxOVERRIDE { return true; } - virtual bool GTKWidgetNeedsMnemonic() const; - virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxRadioBox) + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); }; #endif // _WX_GTK_RADIOBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/radiobut.h b/Externals/wxWidgets3/include/wx/gtk/radiobut.h index 165370aa12..340c671c1e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/radiobut.h +++ b/Externals/wxWidgets3/include/wx/gtk/radiobut.h @@ -38,24 +38,24 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioButtonNameStr ); - virtual void SetLabel(const wxString& label); + virtual void SetLabel(const wxString& label) wxOVERRIDE; virtual void SetValue(bool val); virtual bool GetValue() const; - virtual bool Enable( bool enable = true ); + virtual bool Enable( bool enable = true ) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; private: typedef wxControl base_type; - DECLARE_DYNAMIC_CLASS(wxRadioButton) + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); }; #endif // _WX_GTK_RADIOBUT_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/region.h b/Externals/wxWidgets3/include/wx/gtk/region.h index a2231a1950..f8282c6ba8 100644 --- a/Externals/wxWidgets3/include/wx/gtk/region.h +++ b/Externals/wxWidgets3/include/wx/gtk/region.h @@ -56,8 +56,8 @@ public: virtual ~wxRegion(); // wxRegionBase methods - virtual void Clear(); - virtual bool IsEmpty() const; + virtual void Clear() wxOVERRIDE; + virtual bool IsEmpty() const wxOVERRIDE; #ifdef __WXGTK3__ cairo_region_t* GetRegion() const; @@ -67,27 +67,27 @@ public: #endif protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; // wxRegionBase pure virtuals - virtual bool DoIsEqual(const wxRegion& region) const; - virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; - virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; - virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + virtual bool DoIsEqual(const wxRegion& region) const wxOVERRIDE; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const wxOVERRIDE; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const wxOVERRIDE; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const wxOVERRIDE; - virtual bool DoOffset(wxCoord x, wxCoord y); - virtual bool DoUnionWithRect(const wxRect& rect); - virtual bool DoUnionWithRegion(const wxRegion& region); - virtual bool DoIntersect(const wxRegion& region); - virtual bool DoSubtract(const wxRegion& region); - virtual bool DoXor(const wxRegion& region); + virtual bool DoOffset(wxCoord x, wxCoord y) wxOVERRIDE; + virtual bool DoUnionWithRect(const wxRect& rect) wxOVERRIDE; + virtual bool DoUnionWithRegion(const wxRegion& region) wxOVERRIDE; + virtual bool DoIntersect(const wxRegion& region) wxOVERRIDE; + virtual bool DoSubtract(const wxRegion& region) wxOVERRIDE; + virtual bool DoXor(const wxRegion& region) wxOVERRIDE; // common part of ctors for a rectangle region void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); private: - DECLARE_DYNAMIC_CLASS(wxRegion) + wxDECLARE_DYNAMIC_CLASS(wxRegion); }; // ---------------------------------------------------------------------------- @@ -130,7 +130,7 @@ private: int m_numRects; int m_current; - DECLARE_DYNAMIC_CLASS(wxRegionIterator) + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); }; diff --git a/Externals/wxWidgets3/include/wx/gtk/scrolbar.h b/Externals/wxWidgets3/include/wx/gtk/scrolbar.h index e49bb7a2ce..ceac3fd209 100644 --- a/Externals/wxWidgets3/include/wx/gtk/scrolbar.h +++ b/Externals/wxWidgets3/include/wx/gtk/scrolbar.h @@ -33,13 +33,13 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxScrollBarNameStr ); virtual ~wxScrollBar(); - int GetThumbPosition() const; - int GetThumbSize() const; - int GetPageSize() const; - int GetRange() const; - virtual void SetThumbPosition( int viewStart ); + int GetThumbPosition() const wxOVERRIDE; + int GetThumbSize() const wxOVERRIDE; + int GetPageSize() const wxOVERRIDE; + int GetRange() const wxOVERRIDE; + virtual void SetThumbPosition( int viewStart ) wxOVERRIDE; virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, - bool refresh = true ); + bool refresh = true ) wxOVERRIDE; void SetThumbSize(int thumbSize); void SetPageSize( int pageLength ); @@ -48,7 +48,7 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - DECLARE_DYNAMIC_CLASS(wxScrollBar) + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); }; #endif // _WX_GTK_SCROLLBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/setup0.h b/Externals/wxWidgets3/include/wx/gtk/setup0.h index ba0bee22fc..c734961a4d 100644 --- a/Externals/wxWidgets3/include/wx/gtk/setup0.h +++ b/Externals/wxWidgets3/include/wx/gtk/setup0.h @@ -26,16 +26,6 @@ // compatibility settings // ---------------------------------------------------------------------------- -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -44,7 +34,17 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -268,14 +268,21 @@ // Enable the use of compiler-specific thread local storage keyword, if any. // This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. // -// Default is 1, but set to 0 if the scenario above is applicable. +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. #define wxUSE_COMPILER_TLS 1 // ---------------------------------------------------------------------------- @@ -293,33 +300,30 @@ #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. +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // -// 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). +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. // -// 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 +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // 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 @@ -464,14 +468,7 @@ #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. +// allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // @@ -744,34 +741,21 @@ #define wxUSE_WEBVIEW_WEBKIT 0 #endif -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. +// as only MSVC is known to ship with at least gdiplus.h which is required to +// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later +// versions also include d2d1.h required for Direct2D-based implementation). +// For other compilers (e.g. mingw32) you may need to install the headers (and +// just the headers) yourself. If you do, change the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif +# define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. @@ -840,6 +824,7 @@ // Default is 1 // // Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton @@ -1009,6 +994,16 @@ // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1220,6 +1215,10 @@ // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 @@ -1310,8 +1309,7 @@ // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. @@ -1498,34 +1496,37 @@ /* --- start MSW options --- */ // ---------------------------------------------------------------------------- -// Windows-only settings +// Graphics backends choices for Windows // ---------------------------------------------------------------------------- -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. // -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net +// Default is 1. // -// Default is 0 +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. // -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 #endif -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- // Set this to 1 for generic OLE support: this is required for drag-and-drop, // clipboard, OLE Automation. Only set it to 0 if your compiler is very old and @@ -1552,6 +1553,19 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 @@ -1608,6 +1622,15 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/Externals/wxWidgets3/include/wx/gtk/slider.h b/Externals/wxWidgets3/include/wx/gtk/slider.h index f8833c4685..7dfc2ac772 100644 --- a/Externals/wxWidgets3/include/wx/gtk/slider.h +++ b/Externals/wxWidgets3/include/wx/gtk/slider.h @@ -41,20 +41,20 @@ public: const wxString& name = wxSliderNameStr); // implement the base class pure virtuals - virtual int GetValue() const; - virtual void SetValue(int value); + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int value) wxOVERRIDE; - virtual void SetRange(int minValue, int maxValue); - virtual int GetMin() const; - virtual int GetMax() const; + virtual void SetRange(int minValue, int maxValue) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; - virtual void SetLineSize(int lineSize); - virtual void SetPageSize(int pageSize); - virtual int GetLineSize() const; - virtual int GetPageSize() const; + virtual void SetLineSize(int lineSize) wxOVERRIDE; + virtual void SetPageSize(int pageSize) wxOVERRIDE; + virtual int GetLineSize() const wxOVERRIDE; + virtual int GetPageSize() const wxOVERRIDE; - virtual void SetThumbLength(int lenPixels); - virtual int GetThumbLength() const; + virtual void SetThumbLength(int lenPixels) wxOVERRIDE; + virtual int GetThumbLength() const wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -73,12 +73,12 @@ protected: GtkWidget *m_minLabel,*m_maxLabel; bool m_blockScrollEvent; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; // set the slider value unconditionally void GTKSetValue(int value); - DECLARE_DYNAMIC_CLASS(wxSlider) + wxDECLARE_DYNAMIC_CLASS(wxSlider); }; #endif // _WX_GTK_SLIDER_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/spinbutt.h b/Externals/wxWidgets3/include/wx/gtk/spinbutt.h index 4bd71f4746..ae974200b7 100644 --- a/Externals/wxWidgets3/include/wx/gtk/spinbutt.h +++ b/Externals/wxWidgets3/include/wx/gtk/spinbutt.h @@ -35,16 +35,16 @@ public: long style = wxSP_VERTICAL, const wxString& name = wxSPIN_BUTTON_NAME); - virtual int GetValue() const; - virtual void SetValue( int value ); - virtual void SetRange( int minVal, int maxVal ); - virtual int GetMin() const; - virtual int GetMax() const; + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue( int value ) wxOVERRIDE; + virtual void SetRange( int minVal, int maxVal ) wxOVERRIDE; + virtual int GetMin() const wxOVERRIDE; + virtual int GetMax() const wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - virtual bool Enable( bool enable = true ); + virtual bool Enable( bool enable = true ) wxOVERRIDE; // implementation int m_pos; @@ -53,13 +53,13 @@ protected: void GtkDisableEvents() const; void GtkEnableEvents() const; - virtual wxSize DoGetBestSize() const; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; private: typedef wxSpinButtonBase base_type; - DECLARE_DYNAMIC_CLASS(wxSpinButton) + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); }; #endif // _WX_GTK_SPINBUTT_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/spinctrl.h b/Externals/wxWidgets3/include/wx/gtk/spinctrl.h index ef7b6edb7d..4972737cf2 100644 --- a/Externals/wxWidgets3/include/wx/gtk/spinctrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/spinctrl.h @@ -39,17 +39,17 @@ public: // T GetMin() const // T GetMax() const // T GetIncrement() const - virtual bool GetSnapToTicks() const; + virtual bool GetSnapToTicks() const wxOVERRIDE; // operations - virtual void SetValue(const wxString& value); + virtual void SetValue(const wxString& value) wxOVERRIDE; // void SetValue(T val) // void SetRange(T minVal, T maxVal) // void SetIncrement(T inc) - void SetSnapToTicks( bool snap_to_ticks ); + void SetSnapToTicks( bool snap_to_ticks ) wxOVERRIDE; // Select text in the textctrl - void SetSelection(long from, long to); + void SetSelection(long from, long to) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -71,17 +71,17 @@ protected: void GtkDisableEvents() const; void GtkEnableEvents() const; - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; // Widgets that use the style->base colour for the BG colour should // override this and return true. - virtual bool UseGTKStyleBase() const { return true; } + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } friend class wxSpinCtrlEventDisabler; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; //----------------------------------------------------------------------------- @@ -126,13 +126,13 @@ public: int GetIncrement() const { return int(DoGetIncrement()); } // operations - void SetValue(const wxString& value) { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc + void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc void SetValue( int value ) { DoSetValue(value); } void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); } void SetIncrement(int inc) { DoSetIncrement(inc); } - virtual int GetBase() const { return m_base; } - virtual bool SetBase(int base); + virtual int GetBase() const wxOVERRIDE { return m_base; } + virtual bool SetBase(int base) wxOVERRIDE; private: // Common part of all ctors. @@ -143,7 +143,7 @@ private: int m_base; - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); }; //----------------------------------------------------------------------------- @@ -190,16 +190,16 @@ public: unsigned GetDigits() const; // operations - void SetValue(const wxString& value) { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc + void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc void SetValue(double value) { DoSetValue(value); } void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); } void SetIncrement(double inc) { DoSetIncrement(inc); } void SetDigits(unsigned digits); - virtual int GetBase() const { return 10; } - virtual bool SetBase(int WXUNUSED(base)) { return false; } + virtual int GetBase() const wxOVERRIDE { return 10; } + virtual bool SetBase(int WXUNUSED(base)) wxOVERRIDE { return false; } - DECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble) + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble); }; #endif // _WX_GTK_SPINCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/statbmp.h b/Externals/wxWidgets3/include/wx/gtk/statbmp.h index b7bba950d0..e79255ee3a 100644 --- a/Externals/wxWidgets3/include/wx/gtk/statbmp.h +++ b/Externals/wxWidgets3/include/wx/gtk/statbmp.h @@ -34,12 +34,12 @@ public: long style = 0, const wxString& name = wxStaticBitmapNameStr); - virtual void SetIcon(const wxIcon& icon) { SetBitmap( icon ); } - virtual void SetBitmap( const wxBitmap& bitmap ); - virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE { SetBitmap( icon ); } + virtual void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE; + virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; } // for compatibility with wxMSW - wxIcon GetIcon() const + wxIcon GetIcon() const wxOVERRIDE { // don't use wxDynamicCast, icons and bitmaps are really the same thing // in wxGTK @@ -52,7 +52,7 @@ public: private: wxBitmap m_bitmap; - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); }; #endif // __GTKSTATICBITMAPH__ diff --git a/Externals/wxWidgets3/include/wx/gtk/statbox.h b/Externals/wxWidgets3/include/wx/gtk/statbox.h index 80dbb7f594..7dd72b86ff 100644 --- a/Externals/wxWidgets3/include/wx/gtk/statbox.h +++ b/Externals/wxWidgets3/include/wx/gtk/statbox.h @@ -32,26 +32,26 @@ public: long style = 0, const wxString &name = wxStaticBoxNameStr ); - virtual void SetLabel( const wxString &label ); + virtual void SetLabel( const wxString &label ) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); // implementation - virtual bool GTKIsTransparentForMouse() const { return true; } + virtual bool GTKIsTransparentForMouse() const wxOVERRIDE { return true; } - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE; - virtual void AddChild( wxWindowBase *child ); + virtual void AddChild( wxWindowBase *child ) wxOVERRIDE; protected: - virtual bool GTKWidgetNeedsMnemonic() const; - virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; - void DoApplyWidgetStyle(GtkRcStyle *style); + void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxStaticBox) + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); }; #endif // _WX_GTKSTATICBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/statline.h b/Externals/wxWidgets3/include/wx/gtk/statline.h index aa4077671f..97501d609a 100644 --- a/Externals/wxWidgets3/include/wx/gtk/statline.h +++ b/Externals/wxWidgets3/include/wx/gtk/statline.h @@ -39,7 +39,7 @@ public: private: - DECLARE_DYNAMIC_CLASS(wxStaticLine) + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); }; #endif // wxUSE_STATLINE diff --git a/Externals/wxWidgets3/include/wx/gtk/stattext.h b/Externals/wxWidgets3/include/wx/gtk/stattext.h index f6d88cb83a..b94f399a50 100644 --- a/Externals/wxWidgets3/include/wx/gtk/stattext.h +++ b/Externals/wxWidgets3/include/wx/gtk/stattext.h @@ -33,9 +33,9 @@ public: long style = 0, const wxString &name = wxStaticTextNameStr ); - void SetLabel( const wxString &label ); + void SetLabel( const wxString &label ) wxOVERRIDE; - bool SetFont( const wxFont &font ); + bool SetFont( const wxFont &font ) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -44,15 +44,15 @@ public: // -------------- protected: - virtual bool GTKWidgetNeedsMnemonic() const; - virtual void GTKWidgetDoSetMnemonic(GtkWidget* w); + virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE; + virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE; - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; - virtual wxString DoGetLabel() const; - virtual void DoSetLabel(const wxString& str); + virtual wxString DoGetLabel() const wxOVERRIDE; + virtual void DoSetLabel(const wxString& str) wxOVERRIDE; #if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; #endif // wxUSE_MARKUP private: @@ -62,7 +62,7 @@ private: void GTKDoSetLabel(GTKLabelSetter setter, const wxString& label); - DECLARE_DYNAMIC_CLASS(wxStaticText) + wxDECLARE_DYNAMIC_CLASS(wxStaticText); }; #endif diff --git a/Externals/wxWidgets3/include/wx/gtk/taskbar.h b/Externals/wxWidgets3/include/wx/gtk/taskbar.h index 03bd8daff0..d351904c4b 100644 --- a/Externals/wxWidgets3/include/wx/gtk/taskbar.h +++ b/Externals/wxWidgets3/include/wx/gtk/taskbar.h @@ -15,9 +15,9 @@ class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase public: wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); ~wxTaskBarIcon(); - virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxString()); - virtual bool RemoveIcon(); - virtual bool PopupMenu(wxMenu* menu); + virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxString()) wxOVERRIDE; + virtual bool RemoveIcon() wxOVERRIDE; + virtual bool PopupMenu(wxMenu* menu) wxOVERRIDE; bool IsOk() const { return true; } bool IsIconInstalled() const; @@ -26,8 +26,8 @@ public: private: Private* m_priv; - DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) - DECLARE_NO_COPY_CLASS(wxTaskBarIcon) + wxDECLARE_DYNAMIC_CLASS(wxTaskBarIcon); + wxDECLARE_NO_COPY_CLASS(wxTaskBarIcon); }; #endif // _WX_GTK_TASKBARICON_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/textctrl.h b/Externals/wxWidgets3/include/wx/gtk/textctrl.h index 9fefd91975..921538b726 100644 --- a/Externals/wxWidgets3/include/wx/gtk/textctrl.h +++ b/Externals/wxWidgets3/include/wx/gtk/textctrl.h @@ -43,59 +43,59 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual void WriteText(const wxString& text); - virtual wxString GetValue() const; + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual wxString GetValue() const wxOVERRIDE; virtual bool IsEmpty() const; - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; - virtual bool IsModified() const; - virtual bool IsEditable() const; + virtual bool IsModified() const wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; - virtual void GetSelection(long* from, long* to) const; + virtual void GetSelection(long* from, long* to) const wxOVERRIDE; - virtual void Remove(long from, long to); + virtual void Remove(long from, long to) wxOVERRIDE; - virtual void MarkDirty(); - virtual void DiscardEdits(); + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; // translate between the position (which is just an index in the text ctrl // considering all its contents as a single strings) and (x, y) coordinates // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; - virtual void ShowPosition(long pos); + virtual void ShowPosition(long pos) wxOVERRIDE; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE; virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, - wxTextCoord *row) const + wxTextCoord *row) const wxOVERRIDE { return wxTextCtrlBase::HitTest(pt, col, row); } // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; // Insertion point - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual wxTextPos GetLastPosition() const wxOVERRIDE; - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; // Overridden wxWindow methods - virtual void SetWindowStyleFlag( long style ); - virtual bool Enable( bool enable = true ); + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + virtual bool Enable( bool enable = true ) wxOVERRIDE; // Implementation from now on void OnDropFiles( wxDropFilesEvent &event ); @@ -113,11 +113,11 @@ public: void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event); - bool SetFont(const wxFont& font); - bool SetForegroundColour(const wxColour& colour); - bool SetBackgroundColour(const wxColour& colour); + bool SetFont(const wxFont& font) wxOVERRIDE; + bool SetForegroundColour(const wxColour& colour) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE; - GtkWidget* GetConnectWidget(); + GtkWidget* GetConnectWidget() wxOVERRIDE; void SetUpdateFont(bool WXUNUSED(update)) { } @@ -137,7 +137,7 @@ public: bool MarkDirtyOnChange(); // always let GTK have mouse release events for multiline controls - virtual bool GTKProcessEvent(wxEvent& event) const; + virtual bool GTKProcessEvent(wxEvent& event) const wxOVERRIDE; static wxVisualAttributes @@ -145,26 +145,27 @@ public: protected: // overridden wxWindow virtual methods - virtual wxSize DoGetBestSize() const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; - virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; + virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const wxOVERRIDE; - virtual void DoFreeze(); - virtual void DoThaw(); + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; // Widgets that use the style->base colour for the BG colour should // override this and return true. - virtual bool UseGTKStyleBase() const { return true; } + virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; } - virtual void DoSetValue(const wxString &value, int flags = 0); + virtual void DoSetValue(const wxString &value, int flags = 0) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; // Override this to use either GtkEntry or GtkTextView IME depending on the // kind of control we are. - virtual int GTKIMFilterKeypress(GdkEventKey* event) const; + virtual int GTKIMFilterKeypress(GdkEventKey* event) const wxOVERRIDE; - virtual wxPoint DoPositionToCoords(long pos) const; + virtual wxPoint DoPositionToCoords(long pos) const wxOVERRIDE; // wrappers hiding the differences between functions doing the same thing // for GtkTextView and GtkEntry (all of them use current window style to @@ -179,9 +180,9 @@ private: void Init(); // overridden wxTextEntry virtual methods - virtual GtkEditable *GetEditable() const; - virtual GtkEntry *GetEntry() const; - virtual void EnableTextChangedEvents(bool enable); + virtual GtkEditable *GetEditable() const wxOVERRIDE; + virtual GtkEntry *GetEntry() const wxOVERRIDE; + virtual void EnableTextChangedEvents(bool enable) wxOVERRIDE; // change the font for everything in this control void ChangeFontGlobally(); @@ -220,8 +221,8 @@ private: // For wxTE_AUTO_URL void OnUrlMouseEvent(wxMouseEvent&); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxTextCtrl) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); }; #endif // _WX_GTK_TEXTCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/textentry.h b/Externals/wxWidgets3/include/wx/gtk/textentry.h index 3d9da824ec..f78dc7b0dd 100644 --- a/Externals/wxWidgets3/include/wx/gtk/textentry.h +++ b/Externals/wxWidgets3/include/wx/gtk/textentry.h @@ -21,41 +21,43 @@ typedef struct _GtkEntry GtkEntry; class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase { public: - wxTextEntry() { } + wxTextEntry() { m_isUpperCase = false; } // implement wxTextEntryBase pure virtual methods - virtual void WriteText(const wxString& text); - virtual void Remove(long from, long to); + virtual void WriteText(const wxString& text) wxOVERRIDE; + virtual void Remove(long from, long to) wxOVERRIDE; - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; - virtual void Undo(); - virtual void Redo(); - virtual bool CanUndo() const; - virtual bool CanRedo() const; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; - virtual void SetInsertionPoint(long pos); - virtual long GetInsertionPoint() const; - virtual long GetLastPosition() const; + virtual void SetInsertionPoint(long pos) wxOVERRIDE; + virtual long GetInsertionPoint() const wxOVERRIDE; + virtual long GetLastPosition() const wxOVERRIDE; - virtual void SetSelection(long from, long to); - virtual void GetSelection(long *from, long *to) const; + virtual void SetSelection(long from, long to) wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; - virtual bool IsEditable() const; - virtual void SetEditable(bool editable); + virtual bool IsEditable() const wxOVERRIDE; + virtual void SetEditable(bool editable) wxOVERRIDE; - virtual void SetMaxLength(unsigned long len); + virtual void SetMaxLength(unsigned long len) wxOVERRIDE; + virtual void ForceUpper() wxOVERRIDE; #ifdef __WXGTK3__ - virtual bool SetHint(const wxString& hint); - virtual wxString GetHint() const; + virtual bool SetHint(const wxString& hint) wxOVERRIDE; + virtual wxString GetHint() const wxOVERRIDE; #endif // implementation only from now on void SendMaxLenEvent(); bool GTKEntryOnInsertText(const char* text); + bool GTKIsUpperCase() const { return m_isUpperCase; } protected: // This method must be called from the derived class Create() to connect @@ -66,14 +68,14 @@ protected: void GTKConnectInsertTextSignal(GtkEntry* entry); - virtual void DoSetValue(const wxString& value, int flags); - virtual wxString DoGetValue() const; + virtual void DoSetValue(const wxString& value, int flags) wxOVERRIDE; + virtual wxString DoGetValue() const wxOVERRIDE; // margins functions - virtual bool DoSetMargins(const wxPoint& pt); - virtual wxPoint DoGetMargins() const; + virtual bool DoSetMargins(const wxPoint& pt) wxOVERRIDE; + virtual wxPoint DoGetMargins() const wxOVERRIDE; - virtual bool DoAutoCompleteStrings(const wxArrayString& choices); + virtual bool DoAutoCompleteStrings(const wxArrayString& choices) wxOVERRIDE; // Override the base class method to use GtkEntry IM context. virtual int GTKIMFilterKeypress(GdkEventKey* event) const; @@ -85,7 +87,12 @@ private: // implement this to return the associated GtkEntry virtual GtkEntry *GetEntry() const = 0; + + bool m_isUpperCase; }; +// We don't need the generic version. +#define wxHAS_NATIVE_TEXT_FORCEUPPER + #endif // _WX_GTK_TEXTENTRY_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/tglbtn.h b/Externals/wxWidgets3/include/wx/gtk/tglbtn.h index d6975311f4..40869c8b2e 100644 --- a/Externals/wxWidgets3/include/wx/gtk/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/gtk/tglbtn.h @@ -45,24 +45,24 @@ public: const wxString& name = wxCheckBoxNameStr); // Get/set the value - void SetValue(bool state); - bool GetValue() const; + void SetValue(bool state) wxOVERRIDE; + bool GetValue() const wxOVERRIDE; // Set the label - void SetLabel(const wxString& label); + void SetLabel(const wxString& label) wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); -protected: void GTKDisableEvents(); void GTKEnableEvents(); - virtual wxSize DoGetBestSize() const; - virtual void DoApplyWidgetStyle(GtkRcStyle *style); +protected: + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE; #if wxUSE_MARKUP - virtual bool DoSetLabelMarkup(const wxString& markup); + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; #endif // wxUSE_MARKUP private: @@ -71,7 +71,7 @@ private: // Return the GtkLabel used by this toggle button. GtkLabel *GTKGetLabel() const; - DECLARE_DYNAMIC_CLASS(wxToggleButton) + wxDECLARE_DYNAMIC_CLASS(wxToggleButton); }; //----------------------------------------------------------------------------- @@ -108,12 +108,12 @@ public: wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap), SetBitmapLabel(bitmap); ) // prevent virtual function hiding - virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } + virtual void SetLabel(const wxString& label) wxOVERRIDE { wxToggleButton::SetLabel(label); } private: typedef wxToggleButtonBase base_type; - DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) + wxDECLARE_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 d504b6c2e8..8ad323b5f0 100644 --- a/Externals/wxWidgets3/include/wx/gtk/toolbar.h +++ b/Externals/wxWidgets3/include/wx/gtk/toolbar.h @@ -9,8 +9,6 @@ #ifndef _WX_GTK_TOOLBAR_H_ #define _WX_GTK_TOOLBAR_H_ -#if wxUSE_TOOLBAR - typedef struct _GtkTooltips GtkTooltips; // ---------------------------------------------------------------------------- @@ -26,7 +24,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr ) { Init(); @@ -38,21 +36,21 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr ); virtual ~wxToolBar(); - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; - virtual void SetToolShortHelp(int id, const wxString& helpString); + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; - virtual void SetWindowStyleFlag( long style ); + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; - virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); + virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; - virtual bool Realize(); + virtual bool Realize() wxOVERRIDE; static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); @@ -64,41 +62,41 @@ public: wxItemKind kind = wxITEM_NORMAL, wxObject *clientData = NULL, const wxString& shortHelpString = wxEmptyString, - const wxString& longHelpString = wxEmptyString); + const wxString& longHelpString = wxEmptyString) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); + const wxString& label) wxOVERRIDE; // implementation from now on // -------------------------- + GtkToolbar* GTKGetToolbar() const { return m_toolbar; } + protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_DEFAULT; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_DEFAULT; } - virtual wxSize DoGetBestSize() const; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; private: void Init(); void GtkSetStyle(); GSList* GetRadioGroup(size_t pos); - virtual void AddChildGTK(wxWindowGTK* child); + virtual void AddChildGTK(wxWindowGTK* child) wxOVERRIDE; GtkToolbar* m_toolbar; GtkTooltips* m_tooltips; - DECLARE_DYNAMIC_CLASS(wxToolBar) + wxDECLARE_DYNAMIC_CLASS(wxToolBar); }; -#endif // wxUSE_TOOLBAR - #endif // _WX_GTK_TOOLBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/tooltip.h b/Externals/wxWidgets3/include/wx/gtk/tooltip.h index 25c682b428..dbed48993c 100644 --- a/Externals/wxWidgets3/include/wx/gtk/tooltip.h +++ b/Externals/wxWidgets3/include/wx/gtk/tooltip.h @@ -49,7 +49,7 @@ private: wxString m_text; wxWindow *m_window; - DECLARE_ABSTRACT_CLASS(wxToolTip) + wxDECLARE_ABSTRACT_CLASS(wxToolTip); }; #endif // _WX_GTKTOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/gtk/toplevel.h b/Externals/wxWidgets3/include/wx/gtk/toplevel.h index 9f9374b06b..b26ea6d4ad 100644 --- a/Externals/wxWidgets3/include/wx/gtk/toplevel.h +++ b/Externals/wxWidgets3/include/wx/gtk/toplevel.h @@ -43,38 +43,38 @@ public: virtual ~wxTopLevelWindowGTK(); // implement base class pure virtuals - virtual void Maximize(bool maximize = true); - virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = true); - virtual bool IsIconized() const; - virtual void SetIcons(const wxIconBundle& icons); - virtual void Restore(); + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + virtual void SetIcons(const wxIconBundle& icons) wxOVERRIDE; + virtual void Restore() wxOVERRIDE; - virtual bool EnableCloseButton(bool enable = true); + virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE; - virtual void ShowWithoutActivating(); - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); - virtual bool IsFullScreen() const { return m_fsIsShowing; } + virtual void ShowWithoutActivating() wxOVERRIDE; + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE { return m_fsIsShowing; } - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) wxOVERRIDE; - virtual void SetWindowStyleFlag( long style ); + virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; - virtual bool Show(bool show = true); + virtual bool Show(bool show = true) wxOVERRIDE; - virtual void Raise(); + virtual void Raise() wxOVERRIDE; - virtual bool IsActive(); + virtual bool IsActive() wxOVERRIDE; - virtual void SetTitle( const wxString &title ); - virtual wxString GetTitle() const { return m_title; } + virtual void SetTitle( const wxString &title ) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } - virtual void SetLabel(const wxString& label) { SetTitle( label ); } - virtual wxString GetLabel() const { return GetTitle(); } + virtual void SetLabel(const wxString& label) wxOVERRIDE { SetTitle( label ); } + virtual wxString GetLabel() const wxOVERRIDE { return GetTitle(); } - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; // Experimental, to allow help windows to be // viewable from within modal dialogs @@ -84,15 +84,13 @@ public: virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; // implementation from now on // -------------------------- // GTK callbacks - virtual void OnInternalIdle(); - - virtual void GTKHandleRealized(); + virtual void GTKHandleRealized() wxOVERRIDE; void GTKConfigureEvent(int x, int y); @@ -132,17 +130,17 @@ protected: // of the TLW can be changed by dragging virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, - int incW, int incH); + int incW, int incH) wxOVERRIDE; // move the window to the specified location and resize it - virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; // take into account WM decorations here virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; - virtual void DoSetClientSize(int width, int height); - virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; // string shown in the title bar wxString m_title; diff --git a/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h b/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h deleted file mode 100644 index 5a2c926151..0000000000 --- a/Externals/wxWidgets3/include/wx/gtk/treeentry_gtk.h +++ /dev/null @@ -1,76 +0,0 @@ -/* /////////////////////////////////////////////////////////////////////////// -// Name: wx/gtk/treeentry_gtk.h -// Purpose: GtkTreeEntry - a string/userdata combo for use with treeview -// Author: Ryan Norton -// Id: $Id: treeentry_gtk.h 67326 2011-03-28 06:27:49Z PC $ -// Copyright: (c) 2006 Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////// */ - -#ifndef __GTK_TREE_ENTRY_H__ -#define __GTK_TREE_ENTRY_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include /* for gpointer and gchar* etc. */ - -#include "wx/dlimpexp.h" - -#define GTK_TYPE_TREE_ENTRY (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; - -typedef void (*GtkTreeEntryDestroy) (GtkTreeEntry* entry, gpointer context); - -struct _GtkTreeEntry -{ - GObject parent; /* object instance */ - gchar* label; /* label - always copied by this object except on get */ - gchar* collate_key; /* collate key used for string comparisons/sorting */ - gpointer userdata; /* untouched userdata */ - GtkTreeEntryDestroy destroy_func; /* called upon destruction - use for freeing userdata etc. */ - gpointer destroy_func_data; /* context passed to destroy_func */ -}; - -struct _GtkTreeEntryClass -{ - GObjectClass parent; -}; - -WXDLLIMPEXP_CORE -GtkTreeEntry* gtk_tree_entry_new (void); - -WXDLLIMPEXP_CORE -GType gtk_tree_entry_get_type (void); - -WXDLLIMPEXP_CORE -gchar* gtk_tree_entry_get_collate_key (GtkTreeEntry* entry); - -WXDLLIMPEXP_CORE -gchar* gtk_tree_entry_get_label (GtkTreeEntry* entry); - -WXDLLIMPEXP_CORE -gpointer gtk_tree_entry_get_userdata (GtkTreeEntry* entry); - -WXDLLIMPEXP_CORE -void gtk_tree_entry_set_label (GtkTreeEntry* entry, const gchar* label); - -WXDLLIMPEXP_CORE -void gtk_tree_entry_set_userdata (GtkTreeEntry* entry, gpointer userdata); - -WXDLLIMPEXP_CORE -void gtk_tree_entry_set_destroy_func (GtkTreeEntry* entry, - GtkTreeEntryDestroy destroy_func, - gpointer destroy_func_data); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __GTK_TREE_ENTRY_H__ */ diff --git a/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h b/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h index e1a01bf811..48518369e6 100644 --- a/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h +++ b/Externals/wxWidgets3/include/wx/gtk/webview_webkit.h @@ -42,11 +42,11 @@ public: const wxString& url = wxWebViewDefaultURLStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxWebViewNameStr); + const wxString& name = wxWebViewNameStr) wxOVERRIDE; virtual ~wxWebViewWebKit(); - virtual bool Enable( bool enable = true ); + virtual bool Enable( bool enable = true ) wxOVERRIDE; // implementation // -------------- @@ -54,68 +54,68 @@ public: 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 = wxWEBVIEW_RELOAD_DEFAULT); - virtual bool CanGoBack() const; - virtual bool CanGoForward() const; - virtual void ClearHistory(); - virtual void EnableContextMenu(bool enable = true); - 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; - virtual void Print(); - virtual bool IsBusy() const; + virtual void Stop() wxOVERRIDE; + virtual void LoadURL(const wxString& url) wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + virtual bool CanGoBack() const wxOVERRIDE; + virtual bool CanGoForward() const wxOVERRIDE; + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableContextMenu(bool enable = true) wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual wxVector > GetBackwardHistory() wxOVERRIDE; + virtual wxVector > GetForwardHistory() wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr item) wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + virtual wxString GetPageSource() const wxOVERRIDE; + virtual wxString GetPageText() const wxOVERRIDE; + virtual void Print() wxOVERRIDE; + virtual bool IsBusy() const wxOVERRIDE; - void SetZoomType(wxWebViewZoomType); - wxWebViewZoomType GetZoomType() const; - bool CanSetZoomType(wxWebViewZoomType) const; - virtual wxWebViewZoom GetZoom() const; - virtual void SetZoom(wxWebViewZoom); + void SetZoomType(wxWebViewZoomType) wxOVERRIDE; + wxWebViewZoomType GetZoomType() const wxOVERRIDE; + bool CanSetZoomType(wxWebViewZoomType) const wxOVERRIDE; + virtual wxWebViewZoom GetZoom() const wxOVERRIDE; + virtual void SetZoom(wxWebViewZoom) wxOVERRIDE; //Clipboard functions - virtual bool CanCut() const; - virtual bool CanCopy() const; - virtual bool CanPaste() const; - virtual void Cut(); - virtual void Copy(); - virtual void Paste(); + virtual bool CanCut() const wxOVERRIDE; + virtual bool CanCopy() const wxOVERRIDE; + virtual bool CanPaste() const wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Copy() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; //Undo / redo functionality - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void Undo(); - virtual void Redo(); + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; //Find function - virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT); + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) wxOVERRIDE; //Editing functions - virtual void SetEditable(bool enable = true); - virtual bool IsEditable() const; + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; //Selection - virtual void DeleteSelection(); - virtual bool HasSelection() const; - virtual void SelectAll(); - virtual wxString GetSelectedText() const; - virtual wxString GetSelectedSource() const; - virtual void ClearSelection(); + virtual void DeleteSelection() wxOVERRIDE; + virtual bool HasSelection() const wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual wxString GetSelectedText() const wxOVERRIDE; + virtual wxString GetSelectedSource() const wxOVERRIDE; + virtual void ClearSelection() wxOVERRIDE; - virtual void RunScript(const wxString& javascript); + virtual void RunScript(const wxString& javascript) wxOVERRIDE; //Virtual Filesystem Support - virtual void RegisterHandler(wxSharedPtr handler); + virtual void RegisterHandler(wxSharedPtr handler) wxOVERRIDE; virtual wxVector > GetHandlers() { return m_handlerList; } - virtual void* GetNativeBackend() const { return m_web_view; } + virtual void* GetNativeBackend() const wxOVERRIDE { return m_web_view; } /** TODO: check if this can be made private * The native control has a getter to check for busy state, but except in @@ -135,9 +135,9 @@ public: bool m_creating; protected: - virtual void DoSetPage(const wxString& html, const wxString& baseUrl); + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; - virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; + virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE; private: @@ -169,14 +169,14 @@ private: class WXDLLIMPEXP_WEBVIEW wxWebViewFactoryWebKit : public wxWebViewFactory { public: - virtual wxWebView* Create() { return new wxWebViewWebKit; } + virtual wxWebView* Create() wxOVERRIDE { return new wxWebViewWebKit; } virtual wxWebView* Create(wxWindow* parent, wxWindowID id, const wxString& url = wxWebViewDefaultURLStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxWebViewNameStr) + const wxString& name = wxWebViewNameStr) wxOVERRIDE { return new wxWebViewWebKit(parent, id, url, pos, size, style, name); } }; diff --git a/Externals/wxWidgets3/include/wx/gtk/window.h b/Externals/wxWidgets3/include/wx/gtk/window.h index 6c36ce99c1..476b68a76a 100644 --- a/Externals/wxWidgets3/include/wx/gtk/window.h +++ b/Externals/wxWidgets3/include/wx/gtk/window.h @@ -14,8 +14,11 @@ #ifdef __WXGTK3__ typedef struct _cairo cairo_t; typedef struct _GtkStyleProvider GtkStyleProvider; + typedef struct _GtkCssProvider GtkCssProvider; + #define WXUNUSED_IN_GTK2(x) x #define WXUNUSED_IN_GTK3(x) #else + #define WXUNUSED_IN_GTK2(x) #define WXUNUSED_IN_GTK3(x) x #endif @@ -58,81 +61,83 @@ public: // implement base class (pure) virtual methods // ------------------------------------------- - virtual void Raise(); - virtual void Lower(); + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; - virtual bool Show( bool show = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool IsShown() const wxOVERRIDE; - virtual bool IsRetained() const; + virtual bool IsRetained() const wxOVERRIDE; - virtual void SetFocus(); + virtual void SetFocus() wxOVERRIDE; // hint from wx to native GTK+ tab traversal code - virtual void SetCanFocus(bool canFocus); + virtual void SetCanFocus(bool canFocus) wxOVERRIDE; - virtual bool Reparent( wxWindowBase *newParent ); + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; - virtual void WarpPointer(int x, int y); + virtual void WarpPointer(int x, int y) wxOVERRIDE; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = (const wxRect *) NULL ); - virtual void Update(); - virtual void ClearBackground(); + const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE; + virtual void Update() wxOVERRIDE; + virtual void ClearBackground() wxOVERRIDE; - virtual bool SetBackgroundColour( const wxColour &colour ); - virtual bool SetForegroundColour( const wxColour &colour ); - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; - virtual bool SetBackgroundStyle(wxBackgroundStyle style) ; - virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const; + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE ; + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; + virtual double GetContentScaleFactor() const wxOVERRIDE; virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; + int range, bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ); - virtual bool ScrollLines(int lines); - virtual bool ScrollPages(int pages); + const wxRect* rect = NULL ) wxOVERRIDE; + virtual bool ScrollLines(int lines) wxOVERRIDE; + virtual bool ScrollPages(int pages) wxOVERRIDE; #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; #endif // wxUSE_DRAG_AND_DROP - virtual void AddChild( wxWindowBase *child ); - virtual void RemoveChild( wxWindowBase *child ); + virtual void AddChild( wxWindowBase *child ) wxOVERRIDE; + virtual void RemoveChild( wxWindowBase *child ) wxOVERRIDE; - virtual void SetLayoutDirection(wxLayoutDirection dir); - virtual wxLayoutDirection GetLayoutDirection() const; + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; virtual wxCoord AdjustForLayoutDirection(wxCoord x, wxCoord width, - wxCoord widthTotal) const; + wxCoord widthTotal) const wxOVERRIDE; - virtual bool DoIsExposed( int x, int y ) const; - virtual bool DoIsExposed( int x, int y, int w, int h ) const; + virtual bool DoIsExposed( int x, int y ) const wxOVERRIDE; + virtual bool DoIsExposed( int x, int y, int w, int h ) const wxOVERRIDE; // currently wxGTK2-only void SetDoubleBuffered(bool on); - virtual bool IsDoubleBuffered() const; + virtual bool IsDoubleBuffered() const wxOVERRIDE; // SetLabel(), which does nothing in wxWindow - virtual void SetLabel(const wxString& label) { m_gtkLabel = label; } - virtual wxString GetLabel() const { return m_gtkLabel; } + virtual void SetLabel(const wxString& label) wxOVERRIDE { m_gtkLabel = label; } + virtual wxString GetLabel() const wxOVERRIDE { return m_gtkLabel; } // implementation // -------------- - virtual WXWidget GetHandle() const { return m_widget; } + virtual WXWidget GetHandle() const wxOVERRIDE { return m_widget; } // many important things are done here, this function must be called // regularly - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; // For compatibility across platforms (not in event table) void OnIdle(wxIdleEvent& WXUNUSED(event)) {} @@ -185,6 +190,7 @@ public: // This is called when capture is taken from the window. It will // fire off capture lost events. void GTKReleaseMouseAndNotify(); + static void GTKHandleCaptureLost(); GdkWindow* GTKGetDrawingWindow() const; @@ -253,6 +259,8 @@ public: // (because they have been validated by a size-allocate) and should // be used to report client size bool m_useCachedClientSize; + // Whether the GtkAllocation and GdkWindow positions are known to be correct + bool m_isGtkPositionValid; // see the docs in src/gtk/window.cpp GtkWidget *m_widget; // mostly the widget seen by the rest of GTK @@ -330,21 +338,23 @@ public: // find the direction of the given scrollbar (must be one of ours) ScrollDir ScrollDirFromRange(GtkRange *range) const; - // set the current cursor for all GdkWindows making part of this widget - // (see GTKGetWindow) - void GTKUpdateCursor(bool update_self = true, bool recurse = true); + void GTKUpdateCursor( + bool isBusyOrGlobalCursor = false, + bool isRealize = false, + const wxCursor* overrideCursor = NULL); // extra (wxGTK-specific) flags bool m_noExpose:1; // wxGLCanvas has its own redrawing bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" bool m_isScrolling:1; // dragging scrollbar thumb? bool m_clipPaintRegion:1; // true after ScrollWindow() - wxRegion m_nativeUpdateRegion; // not transformed for RTL bool m_dirtyTabOrder:1; // tab order changed, GTK focus // chain needs update bool m_mouseButtonDown:1; - bool m_showOnIdle:1; // postpone showing the window until idle + bool m_needCursorReset:1; + + wxRegion m_nativeUpdateRegion; // not transformed for RTL protected: // implement the base class pure virtuals @@ -352,36 +362,37 @@ protected: int *x, int *y, int *descent = NULL, int *externalLeading = NULL, - const wxFont *font = NULL) const; - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetClientSize( int *width, int *height ) const; + const wxFont *font = NULL) const wxOVERRIDE; + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); - virtual wxSize DoGetBorderSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoEnable(bool enable); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; + virtual wxSize DoGetBorderSize() const wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; + virtual void DoEnable(bool enable) wxOVERRIDE; #if wxUSE_MENUS_NATIVE - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; #endif // wxUSE_MENUS_NATIVE - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; - virtual void DoFreeze(); - virtual void DoThaw(); + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; + void GTKConnectFreezeWidget(GtkWidget* widget); void GTKFreezeWidget(GtkWidget *w); void GTKThawWidget(GtkWidget *w); void GTKDisconnect(void* instance); #if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; #endif // wxUSE_TOOLTIPS // Create a GtkScrolledWindow containing the given widget (usually @@ -392,14 +403,18 @@ protected: // style. void GTKCreateScrolledWindowWith(GtkWidget* view); - virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move); - virtual bool DoNavigateIn(int flags); + virtual void DoMoveInTabOrder(wxWindow *win, WindowOrder move) wxOVERRIDE; + virtual bool DoNavigateIn(int flags) wxOVERRIDE; // Copies m_children tab order to GTK focus chain: void RealizeTabOrder(); -#ifndef __WXGTK3__ +#ifdef __WXGTK3__ + // Use the given CSS string for styling the widget. The provider must be + // allocated, and remains owned, by the caller. + void ApplyCssStyle(GtkCssProvider* provider, const char* style); +#else // GTK+ < 3 // Called by ApplyWidgetStyle (which is called by SetFont() and // SetXXXColour etc to apply style changed to native widgets) to create // modified GTK style with non-standard attributes. @@ -425,6 +440,11 @@ protected: void ConstrainSize(); +#ifdef __WXGTK3__ + static GdkWindow* GTKFindWindow(GtkWidget* widget); + static void GTKFindWindow(GtkWidget* widget, wxArrayGdkWindows& windows); +#endif + private: void Init(); @@ -454,9 +474,10 @@ public: { return m_paintContext; } + void GTKSizeRevalidate(); #endif - DECLARE_DYNAMIC_CLASS(wxWindowGTK) + wxDECLARE_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 452040ba31..ea4e3021b2 100644 --- a/Externals/wxWidgets3/include/wx/hash.h +++ b/Externals/wxWidgets3/include/wx/hash.h @@ -241,7 +241,7 @@ protected: // m_curr to it and m_currBucket to its bucket void GetNextNode( size_t bucketStart ); private: - virtual void DoDeleteContents( wxHashTableBase_Node* node ); + virtual void DoDeleteContents( wxHashTableBase_Node* node ) wxOVERRIDE; // current node Node* m_curr; @@ -275,7 +275,7 @@ private: virtual void DoDeleteContents( wxHashTableBase_Node* node ) \ { delete (eltype*)node->GetData(); } \ \ - DECLARE_NO_COPY_CLASS(hashclass) \ + wxDECLARE_NO_COPY_CLASS(hashclass); \ } diff --git a/Externals/wxWidgets3/include/wx/hashmap.h b/Externals/wxWidgets3/include/wx/hashmap.h index ed26c35418..121a1febdc 100644 --- a/Externals/wxWidgets3/include/wx/hashmap.h +++ b/Externals/wxWidgets3/include/wx/hashmap.h @@ -62,11 +62,7 @@ #define wxNEEDS_WX_HASH_MAP -#ifdef __WXWINCE__ -typedef int ptrdiff_t; -#else #include // for ptrdiff_t -#endif // private struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase diff --git a/Externals/wxWidgets3/include/wx/headercol.h b/Externals/wxWidgets3/include/wx/headercol.h index 1002c0f562..1b2fa3d401 100644 --- a/Externals/wxWidgets3/include/wx/headercol.h +++ b/Externals/wxWidgets3/include/wx/headercol.h @@ -234,34 +234,34 @@ public: } // implement base class pure virtuals - virtual void SetTitle(const wxString& title) { m_title = title; } - virtual wxString GetTitle() const { return m_title; } + virtual void SetTitle(const wxString& title) wxOVERRIDE { m_title = title; } + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } - virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } - wxBitmap GetBitmap() const { return m_bitmap; } + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE { m_bitmap = bitmap; } + wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; } - virtual void SetWidth(int width) { m_width = width; } - virtual int GetWidth() const { return m_width; } + virtual void SetWidth(int width) wxOVERRIDE { m_width = width; } + virtual int GetWidth() const wxOVERRIDE { return m_width; } - virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; } - virtual int GetMinWidth() const { return m_minWidth; } + virtual void SetMinWidth(int minWidth) wxOVERRIDE { m_minWidth = minWidth; } + virtual int GetMinWidth() const wxOVERRIDE { return m_minWidth; } - virtual void SetAlignment(wxAlignment align) { m_align = align; } - virtual wxAlignment GetAlignment() const { return m_align; } + virtual void SetAlignment(wxAlignment align) wxOVERRIDE { m_align = align; } + virtual wxAlignment GetAlignment() const wxOVERRIDE { return m_align; } - virtual void SetFlags(int flags) { m_flags = flags; } - virtual int GetFlags() const { return m_flags; } + virtual void SetFlags(int flags) wxOVERRIDE { m_flags = flags; } + virtual int GetFlags() const wxOVERRIDE { return m_flags; } - virtual bool IsSortKey() const { return m_sort; } - virtual void UnsetAsSortKey() { m_sort = false; } + virtual bool IsSortKey() const wxOVERRIDE { return m_sort; } + virtual void UnsetAsSortKey() wxOVERRIDE { m_sort = false; } - virtual void SetSortOrder(bool ascending) + virtual void SetSortOrder(bool ascending) wxOVERRIDE { m_sort = true; m_sortAscending = ascending; } - virtual bool IsSortOrderAscending() const { return m_sortAscending; } + virtual bool IsSortOrderAscending() const wxOVERRIDE { return m_sortAscending; } private: // common part of all ctors diff --git a/Externals/wxWidgets3/include/wx/headerctrl.h b/Externals/wxWidgets3/include/wx/headerctrl.h index 78d7117b9f..928ed7aa5e 100644 --- a/Externals/wxWidgets3/include/wx/headerctrl.h +++ b/Externals/wxWidgets3/include/wx/headerctrl.h @@ -160,12 +160,12 @@ public: // ------------------------------- // the user doesn't need to TAB to this control - virtual bool AcceptsFocusFromKeyboard() const { return false; } + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } // this method is only overridden in order to synchronize the control with // the main window when it is scrolled, the derived class must implement // DoScrollHorz() - virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL); + virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL) wxOVERRIDE; protected: // this method must be implemented by the derived classes to return the @@ -211,7 +211,7 @@ protected: protected: // this window doesn't look nice with the border so don't use it by default - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } private: // methods implementing our public API and defined in platform-specific @@ -232,7 +232,7 @@ private: void OnRClick(wxHeaderCtrlEvent& event); #endif // wxUSE_MENUS - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; // ---------------------------------------------------------------------------- @@ -331,8 +331,8 @@ public: protected: // implement/override base class methods - virtual const wxHeaderColumn& GetColumn(unsigned int idx) const; - virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle); + virtual const wxHeaderColumn& GetColumn(unsigned int idx) const wxOVERRIDE; + virtual bool UpdateColumnWidthToFit(unsigned int idx, int widthTitle) wxOVERRIDE; // and define another one to be overridden in the derived classes: it // should return the best width for the given column contents or -1 if not @@ -405,7 +405,7 @@ public: unsigned int GetNewOrder() const { return m_order; } void SetNewOrder(unsigned int order) { m_order = order; } - virtual wxEvent *Clone() const { return new wxHeaderCtrlEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHeaderCtrlEvent(*this); } protected: // the column affected by the event @@ -418,7 +418,7 @@ protected: unsigned int m_order; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHeaderCtrlEvent); }; diff --git a/Externals/wxWidgets3/include/wx/help.h b/Externals/wxWidgets3/include/wx/help.h index 17539c1b32..e38bc870f9 100644 --- a/Externals/wxWidgets3/include/wx/help.h +++ b/Externals/wxWidgets3/include/wx/help.h @@ -17,11 +17,7 @@ #include "wx/helpbase.h" -#ifdef __WXWINCE__ - #include "wx/msw/wince/helpwce.h" - - #define wxHelpController wxWinceHelpController -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/helpchm.h" #define wxHelpController wxCHMHelpController diff --git a/Externals/wxWidgets3/include/wx/helpbase.h b/Externals/wxWidgets3/include/wx/helpbase.h index 9a924fd38e..f3cb199de4 100644 --- a/Externals/wxWidgets3/include/wx/helpbase.h +++ b/Externals/wxWidgets3/include/wx/helpbase.h @@ -96,7 +96,7 @@ public: protected: wxWindow* m_parentWindow; private: - DECLARE_CLASS(wxHelpControllerBase) + wxDECLARE_CLASS(wxHelpControllerBase); }; #endif // wxUSE_HELP diff --git a/Externals/wxWidgets3/include/wx/helpwin.h b/Externals/wxWidgets3/include/wx/helpwin.h index b73a62ebaf..599d62a410 100644 --- a/Externals/wxWidgets3/include/wx/helpwin.h +++ b/Externals/wxWidgets3/include/wx/helpwin.h @@ -13,8 +13,6 @@ #if defined(__WXMSW__) #include "wx/msw/helpwin.h" -#elif defined(__WXPM__) -#include "wx/os2/helpwin.h" #endif #endif diff --git a/Externals/wxWidgets3/include/wx/htmllbox.h b/Externals/wxWidgets3/include/wx/htmllbox.h index 27c3a36c30..e936699bbe 100644 --- a/Externals/wxWidgets3/include/wx/htmllbox.h +++ b/Externals/wxWidgets3/include/wx/htmllbox.h @@ -35,7 +35,7 @@ class WXDLLIMPEXP_HTML wxHtmlListBox : public wxVListBox, public wxHtmlWindowInterface, public wxHtmlWindowMouseHelper { - DECLARE_ABSTRACT_CLASS(wxHtmlListBox) + wxDECLARE_ABSTRACT_CLASS(wxHtmlListBox); public: // constructors and such // --------------------- @@ -68,10 +68,10 @@ public: virtual ~wxHtmlListBox(); // override some base class virtuals - virtual void RefreshRow(size_t line); - virtual void RefreshRows(size_t from, size_t to); - virtual void RefreshAll(); - virtual void SetItemCount(size_t count); + virtual void RefreshRow(size_t line) wxOVERRIDE; + virtual void RefreshRows(size_t from, size_t to) wxOVERRIDE; + virtual void RefreshAll() wxOVERRIDE; + virtual void SetItemCount(size_t count) wxOVERRIDE; #if wxUSE_FILESYSTEM // retrieve the file system used by the wxHtmlWinParser: if you use @@ -80,7 +80,7 @@ public: const wxFileSystem& GetFileSystem() const { return m_filesystem; } #endif // wxUSE_FILESYSTEM - virtual void OnInternalIdle(); + virtual void OnInternalIdle() wxOVERRIDE; protected: // this method must be implemented in the derived class and should return @@ -107,11 +107,11 @@ protected: // we implement both of these functions in terms of OnGetItem(), they are // not supposed to be overridden by our descendants - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; - virtual wxCoord OnMeasureItem(size_t n) const; + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + virtual wxCoord OnMeasureItem(size_t n) const wxOVERRIDE; // override this one to draw custom background for selected items correctly - virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; // this method may be overridden to handle clicking on a link in the // listbox (by default, clicks on links are simply ignored) @@ -131,23 +131,26 @@ protected: private: // wxHtmlWindowInterface methods: - virtual void SetHTMLWindowTitle(const wxString& title); - virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link); + virtual void SetHTMLWindowTitle(const wxString& title) wxOVERRIDE; + virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link) wxOVERRIDE; virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type, const wxString& url, - wxString *redirect) const; + wxString *redirect) const wxOVERRIDE; virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell, - const wxPoint& pos) const; - virtual wxWindow* GetHTMLWindow(); - virtual wxColour GetHTMLBackgroundColour() const; - virtual void SetHTMLBackgroundColour(const wxColour& clr); - virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg); - virtual void SetHTMLStatusText(const wxString& text); - virtual wxCursor GetHTMLCursor(HTMLCursor type) const; + const wxPoint& pos) const wxOVERRIDE; + virtual wxWindow* GetHTMLWindow() wxOVERRIDE; + virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE; + virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE; + virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) wxOVERRIDE; + virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE; + virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE; // returns index of item that contains given HTML cell size_t GetItemForCell(const wxHtmlCell *cell) const; + // Create the cell for the given item, caller is responsible for freeing it. + wxHtmlCell* CreateCellForItem(size_t n) const; + // return physical coordinates of root wxHtmlCell of n-th item wxPoint GetRootCellCoords(size_t n) const; @@ -183,7 +186,7 @@ private: friend class wxHtmlListBoxWinInterface; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxHtmlListBox); }; @@ -198,7 +201,7 @@ private: class WXDLLIMPEXP_HTML wxSimpleHtmlListBox : public wxWindowWithItems { - DECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox) + wxDECLARE_ABSTRACT_CLASS(wxSimpleHtmlListBox); public: // wxListbox-compatible constructors // --------------------------------- @@ -248,58 +251,58 @@ public: // these must be overloaded otherwise the compiler will complain // about wxItemContainerImmutable::[G|S]etSelection being pure virtuals... - void SetSelection(int n) + void SetSelection(int n) wxOVERRIDE { wxVListBox::SetSelection(n); } - int GetSelection() const + int GetSelection() const wxOVERRIDE { return wxVListBox::GetSelection(); } // accessing strings // ----------------- - virtual unsigned int GetCount() const + virtual unsigned int GetCount() const wxOVERRIDE { return m_items.GetCount(); } - virtual wxString GetString(unsigned int n) const; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; // override default unoptimized wxItemContainer::GetStrings() function wxArrayString GetStrings() const { return m_items; } - virtual void SetString(unsigned int n, const wxString& s); + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; // resolve ambiguity between wxItemContainer and wxVListBox versions - void Clear(); + void Clear() wxOVERRIDE; protected: virtual int DoInsertItems(const wxArrayStringsAdapter & items, unsigned int pos, - void **clientData, wxClientDataType type); + void **clientData, wxClientDataType type) wxOVERRIDE; - virtual void DoSetItemClientData(unsigned int n, void *clientData) + virtual void DoSetItemClientData(unsigned int n, void *clientData) wxOVERRIDE { m_HTMLclientData[n] = clientData; } - virtual void *DoGetItemClientData(unsigned int n) const + virtual void *DoGetItemClientData(unsigned int n) const wxOVERRIDE { return m_HTMLclientData[n]; } // wxItemContainer methods - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; // calls wxHtmlListBox::SetItemCount() and RefreshAll() void UpdateCount(); // override these functions just to change their visibility: users of // wxSimpleHtmlListBox shouldn't be allowed to call them directly! - virtual void SetItemCount(size_t count) + virtual void SetItemCount(size_t count) wxOVERRIDE { wxHtmlListBox::SetItemCount(count); } virtual void SetRowCount(size_t count) { wxHtmlListBox::SetRowCount(count); } - virtual wxString OnGetItem(size_t n) const + virtual wxString OnGetItem(size_t n) const wxOVERRIDE { return m_items[n]; } - virtual void InitEvent(wxCommandEvent& event, int n) + virtual void InitEvent(wxCommandEvent& event, int n) wxOVERRIDE { // we're not a virtual control and we can include the string // of the item which was clicked: diff --git a/Externals/wxWidgets3/include/wx/hyperlink.h b/Externals/wxWidgets3/include/wx/hyperlink.h index db183d5a2e..b74bcf140c 100644 --- a/Externals/wxWidgets3/include/wx/hyperlink.h +++ b/Externals/wxWidgets3/include/wx/hyperlink.h @@ -67,10 +67,10 @@ public: // NOTE: also wxWindow::Set/GetLabel, wxWindow::Set/GetBackgroundColour, // wxWindow::Get/SetFont, wxWindow::Get/SetCursor are important ! - virtual bool HasTransparentBackground() { return true; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // checks for validity some of the ctor/Create() function parameters void CheckParams(const wxString& label, const wxString& url, long style); @@ -110,14 +110,14 @@ public: void SetURL(const wxString &url) { m_url=url; } // default copy ctor, assignment operator and dtor are ok - virtual wxEvent *Clone() const { return new wxHyperlinkEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxHyperlinkEvent(*this); } private: // URL associated with the hyperlink control that the used clicked on. wxString m_url; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHyperlinkEvent); }; diff --git a/Externals/wxWidgets3/include/wx/icon.h b/Externals/wxWidgets3/include/wx/icon.h index 27bb3e6921..0f7c45e904 100644 --- a/Externals/wxWidgets3/include/wx/icon.h +++ b/Externals/wxWidgets3/include/wx/icon.h @@ -52,12 +52,9 @@ #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_PNG_RESOURCE #include "wx/generic/icon.h" #endif -#elif defined(__WXCOCOA__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICON_RESOURCE - #include "wx/cocoa/icon.h" -#elif defined(__WXPM__) - #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_ICO_RESOURCE - #include "wx/os2/icon.h" +#elif defined(__WXQT__) + #define wxICON_DEFAULT_TYPE wxBITMAP_TYPE_XPM + #include "wx/generic/icon.h" #endif //----------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/iconbndl.h b/Externals/wxWidgets3/include/wx/iconbndl.h index 50ad64261d..704c58f248 100644 --- a/Externals/wxWidgets3/include/wx/iconbndl.h +++ b/Externals/wxWidgets3/include/wx/iconbndl.h @@ -119,14 +119,14 @@ public: #endif // WXWIN_COMPATIBILITY_2_8 protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE; private: // delete all icons void DeleteIcons(); - DECLARE_DYNAMIC_CLASS(wxIconBundle) + wxDECLARE_DYNAMIC_CLASS(wxIconBundle); }; #endif // _WX_ICONBNDL_H_ diff --git a/Externals/wxWidgets3/include/wx/imagbmp.h b/Externals/wxWidgets3/include/wx/imagbmp.h index 262373a70e..a4a6527eed 100644 --- a/Externals/wxWidgets3/include/wx/imagbmp.h +++ b/Externals/wxWidgets3/include/wx/imagbmp.h @@ -51,21 +51,21 @@ public: } #if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, bool IsBmp, bool IsMask); bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors, int comp, wxFileOffset bmpOffset, wxInputStream& stream, - bool verbose, bool IsBmp, bool hasPalette); + bool verbose, bool IsBmp, bool hasPalette, int colEntrySize = 4); bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp); #endif // wxUSE_STREAMS private: - DECLARE_DYNAMIC_CLASS(wxBMPHandler) + wxDECLARE_DYNAMIC_CLASS(wxBMPHandler); }; #if wxUSE_ICO_CUR @@ -85,17 +85,17 @@ public: } #if wxUSE_STREAMS - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index ); protected: - virtual int DoGetImageCount( wxInputStream& stream ); - virtual bool DoCanRead( wxInputStream& stream ); + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif // wxUSE_STREAMS private: - DECLARE_DYNAMIC_CLASS(wxICOHandler) + wxDECLARE_DYNAMIC_CLASS(wxICOHandler); }; @@ -120,11 +120,11 @@ public: protected: #if wxUSE_STREAMS - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif // wxUSE_STREAMS private: - DECLARE_DYNAMIC_CLASS(wxCURHandler) + wxDECLARE_DYNAMIC_CLASS(wxCURHandler); }; // ---------------------------------------------------------------------------- // wxANIHandler @@ -143,16 +143,16 @@ public: #if wxUSE_STREAMS - virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;} - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); + virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ) wxOVERRIDE{return false ;} + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; protected: - virtual int DoGetImageCount( wxInputStream& stream ); - virtual bool DoCanRead( wxInputStream& stream ); + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif // wxUSE_STREAMS private: - DECLARE_DYNAMIC_CLASS(wxANIHandler) + wxDECLARE_DYNAMIC_CLASS(wxANIHandler); }; #endif // wxUSE_ICO_CUR diff --git a/Externals/wxWidgets3/include/wx/image.h b/Externals/wxWidgets3/include/wx/image.h index 3e7f39eb0d..c7e7a87e82 100644 --- a/Externals/wxWidgets3/include/wx/image.h +++ b/Externals/wxWidgets3/include/wx/image.h @@ -171,7 +171,7 @@ protected: wxBitmapType m_type; private: - DECLARE_CLASS(wxImageHandler) + wxDECLARE_CLASS(wxImageHandler); }; //----------------------------------------------------------------------------- @@ -408,6 +408,22 @@ public: // colour given. bool ConvertColourToAlpha( unsigned char r, unsigned char g, unsigned char b ); + // Methods for controlling LoadFile() behaviour. Currently they allow to + // specify whether the function should log warnings if there are any + // problems with the image file not completely preventing it from being + // loaded. By default the warnings are logged, but this can be disabled + // either globally or for a particular image object. + enum + { + Load_Verbose = 1 + }; + + static void SetDefaultLoadFlags(int flags); + static int GetDefaultLoadFlags(); + + void SetLoadFlags(int flags); + int GetLoadFlags() const; + static bool CanRead( const wxString& name ); static int GetImageCount( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY ); virtual bool LoadFile( const wxString& name, wxBitmapType type = wxBITMAP_TYPE_ANY, int index = -1 ); @@ -588,8 +604,8 @@ protected: // note that index must be multiplied by 3 when using it with RGB array long XYToIndex(int x, int y) const; - virtual wxObjectRefData* CreateRefData() const; - virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const; + virtual wxObjectRefData* CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData* CloneRefData(const wxObjectRefData* data) const wxOVERRIDE; private: friend class WXDLLIMPEXP_FWD_CORE wxImageHandler; @@ -622,7 +638,7 @@ private: bool DoSave(wxImageHandler& handler, wxOutputStream& stream) const; #endif // wxUSE_STREAMS - DECLARE_DYNAMIC_CLASS(wxImage) + wxDECLARE_DYNAMIC_CLASS(wxImage); }; diff --git a/Externals/wxWidgets3/include/wx/imaggif.h b/Externals/wxWidgets3/include/wx/imaggif.h index 1d76a632c8..b59744c0cb 100644 --- a/Externals/wxWidgets3/include/wx/imaggif.h +++ b/Externals/wxWidgets3/include/wx/imaggif.h @@ -38,17 +38,17 @@ public: #if wxUSE_STREAMS virtual bool LoadFile(wxImage *image, wxInputStream& stream, - bool verbose = true, int index = -1); + bool verbose = true, int index = -1) wxOVERRIDE; virtual bool SaveFile(wxImage *image, wxOutputStream& stream, - bool verbose=true); + bool verbose=true) wxOVERRIDE; // Save animated gif bool SaveAnimation(const wxImageArray& images, wxOutputStream *stream, bool verbose = true, int delayMilliSecs = 1000); protected: - virtual int DoGetImageCount(wxInputStream& stream); - virtual bool DoCanRead(wxInputStream& stream); + virtual int DoGetImageCount(wxInputStream& stream) wxOVERRIDE; + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; bool DoSaveFile(const wxImage&, wxOutputStream *, bool verbose, bool first, int delayMilliSecs, bool loop, @@ -84,7 +84,7 @@ protected: #endif private: - DECLARE_DYNAMIC_CLASS(wxGIFHandler) + wxDECLARE_DYNAMIC_CLASS(wxGIFHandler); }; #endif // wxUSE_GIF diff --git a/Externals/wxWidgets3/include/wx/imagiff.h b/Externals/wxWidgets3/include/wx/imagiff.h index f7307ba5e1..78c6561088 100644 --- a/Externals/wxWidgets3/include/wx/imagiff.h +++ b/Externals/wxWidgets3/include/wx/imagiff.h @@ -29,13 +29,13 @@ public: } #if wxUSE_STREAMS - virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1); - virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true); + virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1) wxOVERRIDE; + virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true) wxOVERRIDE; protected: - virtual bool DoCanRead(wxInputStream& stream); + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; #endif - DECLARE_DYNAMIC_CLASS(wxIFFHandler) + wxDECLARE_DYNAMIC_CLASS(wxIFFHandler); }; #endif // wxUSE_IMAGE && wxUSE_IFF diff --git a/Externals/wxWidgets3/include/wx/imagjpeg.h b/Externals/wxWidgets3/include/wx/imagjpeg.h index 53f6e06170..342aa7e99c 100644 --- a/Externals/wxWidgets3/include/wx/imagjpeg.h +++ b/Externals/wxWidgets3/include/wx/imagjpeg.h @@ -36,14 +36,14 @@ public: static wxVersionInfo GetLibraryVersionInfo(); #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: - DECLARE_DYNAMIC_CLASS(wxJPEGHandler) + wxDECLARE_DYNAMIC_CLASS(wxJPEGHandler); }; #endif // wxUSE_LIBJPEG diff --git a/Externals/wxWidgets3/include/wx/imagpcx.h b/Externals/wxWidgets3/include/wx/imagpcx.h index cc9d54fa8a..210bbb3233 100644 --- a/Externals/wxWidgets3/include/wx/imagpcx.h +++ b/Externals/wxWidgets3/include/wx/imagpcx.h @@ -29,14 +29,14 @@ public: } #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif // wxUSE_STREAMS private: - DECLARE_DYNAMIC_CLASS(wxPCXHandler) + wxDECLARE_DYNAMIC_CLASS(wxPCXHandler); }; #endif // wxUSE_PCX diff --git a/Externals/wxWidgets3/include/wx/imagpng.h b/Externals/wxWidgets3/include/wx/imagpng.h index 55adcd5f97..e30cf73845 100644 --- a/Externals/wxWidgets3/include/wx/imagpng.h +++ b/Externals/wxWidgets3/include/wx/imagpng.h @@ -50,14 +50,14 @@ public: static wxVersionInfo GetLibraryVersionInfo(); #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: - DECLARE_DYNAMIC_CLASS(wxPNGHandler) + wxDECLARE_DYNAMIC_CLASS(wxPNGHandler); }; #endif diff --git a/Externals/wxWidgets3/include/wx/imagpnm.h b/Externals/wxWidgets3/include/wx/imagpnm.h index aab7c76faa..0f3f460ad8 100644 --- a/Externals/wxWidgets3/include/wx/imagpnm.h +++ b/Externals/wxWidgets3/include/wx/imagpnm.h @@ -31,14 +31,14 @@ public: } #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: - DECLARE_DYNAMIC_CLASS(wxPNMHandler) + wxDECLARE_DYNAMIC_CLASS(wxPNMHandler); }; #endif diff --git a/Externals/wxWidgets3/include/wx/imagtga.h b/Externals/wxWidgets3/include/wx/imagtga.h index d11083785f..0c2c7d0a0d 100644 --- a/Externals/wxWidgets3/include/wx/imagtga.h +++ b/Externals/wxWidgets3/include/wx/imagtga.h @@ -31,14 +31,14 @@ public: #if wxUSE_STREAMS virtual bool LoadFile(wxImage* image, wxInputStream& stream, - bool verbose = true, int index = -1); + bool verbose = true, int index = -1) wxOVERRIDE; virtual bool SaveFile(wxImage* image, wxOutputStream& stream, - bool verbose = true); + bool verbose = true) wxOVERRIDE; protected: - virtual bool DoCanRead(wxInputStream& stream); + virtual bool DoCanRead(wxInputStream& stream) wxOVERRIDE; #endif // wxUSE_STREAMS - DECLARE_DYNAMIC_CLASS(wxTGAHandler) + wxDECLARE_DYNAMIC_CLASS(wxTGAHandler); }; #endif // wxUSE_TGA diff --git a/Externals/wxWidgets3/include/wx/imagtiff.h b/Externals/wxWidgets3/include/wx/imagtiff.h index 9182e67173..0c7be8884a 100644 --- a/Externals/wxWidgets3/include/wx/imagtiff.h +++ b/Externals/wxWidgets3/include/wx/imagtiff.h @@ -41,16 +41,16 @@ public: static wxVersionInfo GetLibraryVersionInfo(); #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual int DoGetImageCount( wxInputStream& stream ); - virtual bool DoCanRead( wxInputStream& stream ); + virtual int DoGetImageCount( wxInputStream& stream ) wxOVERRIDE; + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: - DECLARE_DYNAMIC_CLASS(wxTIFFHandler) + wxDECLARE_DYNAMIC_CLASS(wxTIFFHandler); }; #endif // wxUSE_LIBTIFF diff --git a/Externals/wxWidgets3/include/wx/imagxpm.h b/Externals/wxWidgets3/include/wx/imagxpm.h index 16477b2d57..1af34875e4 100644 --- a/Externals/wxWidgets3/include/wx/imagxpm.h +++ b/Externals/wxWidgets3/include/wx/imagxpm.h @@ -29,14 +29,14 @@ public: } #if wxUSE_STREAMS - virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ); - virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ); + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 ) wxOVERRIDE; + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true ) wxOVERRIDE; protected: - virtual bool DoCanRead( wxInputStream& stream ); + virtual bool DoCanRead( wxInputStream& stream ) wxOVERRIDE; #endif private: - DECLARE_DYNAMIC_CLASS(wxXPMHandler) + wxDECLARE_DYNAMIC_CLASS(wxXPMHandler); }; #endif // wxUSE_XPM diff --git a/Externals/wxWidgets3/include/wx/infobar.h b/Externals/wxWidgets3/include/wx/infobar.h index be390a856e..ebda4f695a 100644 --- a/Externals/wxWidgets3/include/wx/infobar.h +++ b/Externals/wxWidgets3/include/wx/infobar.h @@ -46,6 +46,11 @@ public: // remove a button previously added by AddButton() virtual void RemoveButton(wxWindowID btnid) = 0; + // get information about the currently shown buttons + virtual size_t GetButtonCount() const = 0; + virtual wxWindowID GetButtonId(size_t idx) const = 0; + virtual bool HasButtonId(wxWindowID btnid) const = 0; + private: wxDECLARE_NO_COPY_CLASS(wxInfoBarBase); }; diff --git a/Externals/wxWidgets3/include/wx/init.h b/Externals/wxWidgets3/include/wx/init.h index 6ce8e82876..0810cceb49 100644 --- a/Externals/wxWidgets3/include/wx/init.h +++ b/Externals/wxWidgets3/include/wx/init.h @@ -21,7 +21,7 @@ // do common initialization, return true if ok (in this case wxEntryCleanup // must be called later), otherwise the program can't use wxWidgets at all // -// this function also creates wxTheApp as a side effect, if IMPLEMENT_APP +// this function also creates wxTheApp as a side effect, if wxIMPLEMENT_APP // hadn't been used a dummy default application object is created // // note that the parameters may be modified, this is why we pass them by @@ -67,9 +67,9 @@ extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv); // initialize the library (may be called as many times as needed, but each // call to wxInitialize() must be matched by wxUninitialize()) extern bool WXDLLIMPEXP_BASE wxInitialize(); -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, wxChar **argv); +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, wxChar **argv); #if wxUSE_UNICODE -extern bool WXDLLIMPEXP_BASE wxInitialize(int argc, char **argv); +extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, char **argv); #endif // clean up -- the library can't be used any more after the last call to @@ -87,13 +87,13 @@ public: m_ok = wxInitialize(); } - wxInitializer(int argc, wxChar **argv) + wxInitializer(int& argc, wxChar **argv) { m_ok = wxInitialize(argc, argv); } #if wxUSE_UNICODE - wxInitializer(int argc, char **argv) + wxInitializer(int& argc, char **argv) { m_ok = wxInitialize(argc, argv); } diff --git a/Externals/wxWidgets3/include/wx/intl.h b/Externals/wxWidgets3/include/wx/intl.h index fea4d2d65b..c2020ddbfc 100644 --- a/Externals/wxWidgets3/include/wx/intl.h +++ b/Externals/wxWidgets3/include/wx/intl.h @@ -214,6 +214,17 @@ public: static wxString GetInfo(wxLocaleInfo index, wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); + // Same as GetInfo() but uses current locale at the OS level to retrieve + // the information. Normally it should be the same as the one used by + // GetInfo() but there are two exceptions: the most important one is that + // if no locale had been set, GetInfo() would fall back to "C" locale, + // while this one uses the default OS locale. Another, more rare, one is + // that some locales might not supported by the OS. + // + // Currently this is the same as GetInfo() under non-MSW platforms. + static wxString GetOSInfo(wxLocaleInfo index, + wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT); + // return true if the locale was set successfully bool IsOk() const { return m_pszOldLocale != NULL; } diff --git a/Externals/wxWidgets3/include/wx/ipcbase.h b/Externals/wxWidgets3/include/wx/ipcbase.h index 4d69958e4c..864a2ec3ea 100644 --- a/Externals/wxWidgets3/include/wx/ipcbase.h +++ b/Externals/wxWidgets3/include/wx/ipcbase.h @@ -91,7 +91,7 @@ public: { return DoPoke(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } - bool Poke(const wxString& item, const wxString s) + bool Poke(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoPoke(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); @@ -113,7 +113,7 @@ public: { return DoAdvise(item, ws, size == wxNO_LEN ? (wcslen(ws) + 1)*sizeof(wchar_t) : size, wxIPC_UNICODETEXT); } - bool Advise(const wxString& item, const wxString s) + bool Advise(const wxString& item, const wxString& s) { const wxScopedCharBuffer buf = s.utf8_str(); return DoAdvise(item, buf, strlen(buf) + 1, wxIPC_UTF8TEXT); @@ -222,7 +222,7 @@ protected: bool m_connected; wxDECLARE_NO_ASSIGN_CLASS(wxConnectionBase); - DECLARE_CLASS(wxConnectionBase) + wxDECLARE_CLASS(wxConnectionBase); }; @@ -238,7 +238,7 @@ public: // Callbacks to SERVER - override at will virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0; - DECLARE_CLASS(wxServerBase) + wxDECLARE_CLASS(wxServerBase); }; class WXDLLIMPEXP_BASE wxClientBase : public wxObject @@ -257,7 +257,7 @@ public: // Callbacks to CLIENT - override at will virtual wxConnectionBase *OnMakeConnection() = 0; - DECLARE_CLASS(wxClientBase) + wxDECLARE_CLASS(wxClientBase); }; #endif // _WX_IPCBASEH__ diff --git a/Externals/wxWidgets3/include/wx/joystick.h b/Externals/wxWidgets3/include/wx/joystick.h index 733ad7de8a..4a93a2518b 100644 --- a/Externals/wxWidgets3/include/wx/joystick.h +++ b/Externals/wxWidgets3/include/wx/joystick.h @@ -27,8 +27,8 @@ #include "wx/osx/core/joystick.h" #elif defined(__WXMAC__) #include "wx/osx/joystick.h" -#elif defined(__WXPM__) -#include "wx/os2/joystick.h" +#elif defined(__WXQT__) +#include "wx/unix/joystick.h" #endif #endif // wxUSE_JOYSTICK diff --git a/Externals/wxWidgets3/include/wx/language.h b/Externals/wxWidgets3/include/wx/language.h index 2d196b6639..5d788abcc2 100644 --- a/Externals/wxWidgets3/include/wx/language.h +++ b/Externals/wxWidgets3/include/wx/language.h @@ -31,7 +31,7 @@ */ enum wxLanguage { - /// User's default/preffered language as got from OS. + /// User's default/preferred language as got from OS. wxLANGUAGE_DEFAULT, /// Unknown language, returned if wxLocale::GetSystemLanguage fails. @@ -78,7 +78,6 @@ enum wxLanguage wxLANGUAGE_BRETON, wxLANGUAGE_BULGARIAN, wxLANGUAGE_BURMESE, - wxLANGUAGE_CAMBODIAN, wxLANGUAGE_CATALAN, wxLANGUAGE_CHINESE, wxLANGUAGE_CHINESE_SIMPLIFIED, @@ -149,11 +148,13 @@ enum wxLanguage wxLANGUAGE_ITALIAN_SWISS, wxLANGUAGE_JAPANESE, wxLANGUAGE_JAVANESE, + wxLANGUAGE_KABYLE, wxLANGUAGE_KANNADA, wxLANGUAGE_KASHMIRI, wxLANGUAGE_KASHMIRI_INDIA, wxLANGUAGE_KAZAKH, wxLANGUAGE_KERNEWEK, + wxLANGUAGE_KHMER, wxLANGUAGE_KINYARWANDA, wxLANGUAGE_KIRGHIZ, wxLANGUAGE_KIRUNDI, @@ -271,7 +272,11 @@ enum wxLanguage wxLANGUAGE_ZULU, /// For custom, user-defined languages. - wxLANGUAGE_USER_DEFINED + wxLANGUAGE_USER_DEFINED, + + + /// Obsolete synonym. + wxLANGUAGE_CAMBODIAN = wxLANGUAGE_KHMER }; // --- --- --- generated code ends here --- --- --- diff --git a/Externals/wxWidgets3/include/wx/layout.h b/Externals/wxWidgets3/include/wx/layout.h index 30d46c2490..829fa9d8e2 100644 --- a/Externals/wxWidgets3/include/wx/layout.h +++ b/Externals/wxWidgets3/include/wx/layout.h @@ -147,7 +147,7 @@ protected: wxEdge otherEdge; bool done; - DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint) + wxDECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint); }; // ---------------------------------------------------------------------------- @@ -182,7 +182,7 @@ public: width.GetDone() && height.GetDone(); } - DECLARE_DYNAMIC_CLASS(wxLayoutConstraints) + wxDECLARE_DYNAMIC_CLASS(wxLayoutConstraints); }; #endif // wxUSE_CONSTRAINTS diff --git a/Externals/wxWidgets3/include/wx/list.h b/Externals/wxWidgets3/include/wx/list.h index 160b3b8ba4..9278a4f148 100644 --- a/Externals/wxWidgets3/include/wx/list.h +++ b/Externals/wxWidgets3/include/wx/list.h @@ -65,8 +65,6 @@ typedef wxObjectListNode wxNode; #define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \ WX_DECLARE_LIST_XO(elT*, liT, decl) -#if !defined(__VISUALC__) || __VISUALC__ >= 1300 // == !VC6 - template class wxList_SortFunction { @@ -78,42 +76,6 @@ private: wxSortCompareFunction m_f; }; -#define WX_LIST_SORTFUNCTION( elT, f ) wxList_SortFunction(f) -#define WX_LIST_VC6_WORKAROUND(elT, liT, decl) - -#else // if defined( __VISUALC__ ) && __VISUALC__ < 1300 // == VC6 - -#define WX_LIST_SORTFUNCTION( elT, f ) std::greater( f ) -#define WX_LIST_VC6_WORKAROUND(elT, liT, decl) \ - decl liT; \ - \ - /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \ - /* to be passed into std::list::sort() */ \ - template <> \ - struct std::greater \ - { \ - private: \ - wxSortCompareFunction m_CompFunc; \ - public: \ - greater( wxSortCompareFunction compfunc = NULL ) \ - : m_CompFunc( compfunc ) {} \ - bool operator()(const elT X, const elT Y) const \ - { \ - return m_CompFunc ? \ - ( m_CompFunc( wxListCastElementToVoidPtr(X), \ - wxListCastElementToVoidPtr(Y) ) < 0 ) : \ - ( X > Y ); \ - } \ - }; - -// helper for std::greater above: -template -inline const void *wxListCastElementToVoidPtr(const T* ptr) { return ptr; } -inline const void *wxListCastElementToVoidPtr(const wxString& str) - { return (const char*)str; } - -#endif // VC6/!VC6 - /* Note 1: the outer helper class _WX_LIST_HELPER_##liT below is a workaround for mingw 3.2.3 compiler bug that prevents a static function of liT class @@ -154,7 +116,6 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \ }; \ \ - WX_LIST_VC6_WORKAROUND(elT, liT, decl) \ class liT : public std::list \ { \ private: \ @@ -166,8 +127,6 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) class compatibility_iterator \ { \ private: \ - /* Workaround for broken VC6 nested class name resolution */ \ - typedef std::list::iterator iterator; \ friend class liT; \ \ iterator m_iter; \ @@ -318,7 +277,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str) } \ /* Workaround for broken VC6 std::list::sort() see above */ \ void Sort( wxSortCompareFunction compfunc ) \ - { sort( WX_LIST_SORTFUNCTION( elT, compfunc ) ); } \ + { sort( wxList_SortFunction(compfunc ) ); } \ ~liT() { Clear(); } \ \ /* It needs access to our EmptyList */ \ @@ -695,7 +654,7 @@ private: protected: \ virtual void DeleteData(); \ \ - DECLARE_NO_COPY_CLASS(nodetype) \ + wxDECLARE_NO_COPY_CLASS(nodetype); \ }; \ \ classexp name : public wxListBase \ @@ -1216,7 +1175,6 @@ public: void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } #endif // !wxUSE_STD_CONTAINERS -#ifndef __VISUALC6__ template wxVector AsVector() const { @@ -1230,7 +1188,6 @@ public: return vector; } -#endif // !__VISUALC6__ }; diff --git a/Externals/wxWidgets3/include/wx/listbase.h b/Externals/wxWidgets3/include/wx/listbase.h index 5e6fb7cae3..1c79de0084 100644 --- a/Externals/wxWidgets3/include/wx/listbase.h +++ b/Externals/wxWidgets3/include/wx/listbase.h @@ -16,6 +16,7 @@ #include "wx/gdicmn.h" #include "wx/event.h" #include "wx/control.h" +#include "wx/systhemectrl.h" class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -83,11 +84,11 @@ int (wxCALLBACK *wxListCtrlCompare)(wxIntPtr item1, wxIntPtr item2, wxIntPtr sor #define wxLIST_STATE_FOCUSED 0x0002 #define wxLIST_STATE_SELECTED 0x0004 #define wxLIST_STATE_CUT 0x0008 // MSW only -#define wxLIST_STATE_DISABLED 0x0010 // OS2 only -#define wxLIST_STATE_FILTERED 0x0020 // OS2 only -#define wxLIST_STATE_INUSE 0x0040 // OS2 only -#define wxLIST_STATE_PICKED 0x0080 // OS2 only -#define wxLIST_STATE_SOURCE 0x0100 // OS2 only +#define wxLIST_STATE_DISABLED 0x0010 // Not used +#define wxLIST_STATE_FILTERED 0x0020 // Not used +#define wxLIST_STATE_INUSE 0x0040 // Not used +#define wxLIST_STATE_PICKED 0x0080 // Not used +#define wxLIST_STATE_SOURCE 0x0100 // Not used // Hit test flags, used in HitTest #define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. @@ -339,10 +340,6 @@ public: int m_format; // left, right, centre int m_width; // width of column -#ifdef __WXPM__ - int m_miniImage; // handle to the mini image for OS/2 -#endif - protected: // creates m_attr if we don't have it yet wxListItemAttr& Attributes() @@ -370,7 +367,7 @@ protected: wxListItemAttr *m_attr; // optional pointer to the items style private: - DECLARE_DYNAMIC_CLASS(wxListItem) + wxDECLARE_DYNAMIC_CLASS(wxListItem); }; // ---------------------------------------------------------------------------- @@ -381,7 +378,7 @@ private: // 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 +class WXDLLIMPEXP_CORE wxListCtrlBase : public wxSystemThemedControl { public: wxListCtrlBase() { } @@ -461,13 +458,20 @@ public: void EnableAlternateRowColours(bool enable = true); void SetAlternateRowColour(const wxColour& colour); + wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); } + + // Checkboxes support: only implemented in wxMSW currently. + virtual bool HasCheckboxes() const { return false; } + virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; } + virtual bool IsItemChecked(long WXUNUSED(item)) const { return false; } + virtual void CheckItem(long WXUNUSED(item), bool WXUNUSED(check)) { } 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; + virtual wxSize DoGetBestClientSize() const wxOVERRIDE; private: // user defined color to draw row lines, may be invalid @@ -522,7 +526,7 @@ public: bool IsEditCancelled() const { return m_editCancelled; } void SetEditCanceled(bool editCancelled) { m_editCancelled = editCancelled; } - virtual wxEvent *Clone() const { return new wxListEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxListEvent(*this); } //protected: -- not for backwards compatibility int m_code; @@ -537,7 +541,7 @@ protected: bool m_editCancelled; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListEvent); }; // ---------------------------------------------------------------------------- @@ -565,6 +569,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_BEGIN_DRAG, wxListEve wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_DRAGGING, wxListEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_COL_END_DRAG, wxListEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_FOCUSED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_CHECKED, wxListEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_LIST_ITEM_UNCHECKED, wxListEvent ); typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); @@ -595,6 +601,8 @@ typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); #define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) wx__DECLARE_LISTEVT(ITEM_MIDDLE_CLICK, id, fn) #define EVT_LIST_ITEM_ACTIVATED(id, fn) wx__DECLARE_LISTEVT(ITEM_ACTIVATED, id, fn) #define EVT_LIST_ITEM_FOCUSED(id, fn) wx__DECLARE_LISTEVT(ITEM_FOCUSED, id, fn) +#define EVT_LIST_ITEM_CHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_CHECKED, id, fn) +#define EVT_LIST_ITEM_UNCHECKED(id, fn) wx__DECLARE_LISTEVT(ITEM_UNCHECKED, id, fn) #define EVT_LIST_CACHE_HINT(id, fn) wx__DECLARE_LISTEVT(CACHE_HINT, id, fn) diff --git a/Externals/wxWidgets3/include/wx/listbook.h b/Externals/wxWidgets3/include/wx/listbook.h index 1c7cdbd923..5edfc0c6a8 100644 --- a/Externals/wxWidgets3/include/wx/listbook.h +++ b/Externals/wxWidgets3/include/wx/listbook.h @@ -61,31 +61,31 @@ public: // overridden base class methods - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - 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; - virtual void SetImageList(wxImageList *imageList); + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; - virtual bool DeleteAllPages(); + virtual bool DeleteAllPages() wxOVERRIDE; wxListView* GetListView() const { return (wxListView*)m_bookctrl; } protected: - virtual wxWindow *DoRemovePage(size_t page); + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; - void UpdateSelectedPage(size_t newsel); + void UpdateSelectedPage(size_t newsel) wxOVERRIDE; - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; // Get the correct wxListCtrl flags to use depending on our own flags. long GetListCtrlFlags() const; @@ -99,8 +99,8 @@ private: void UpdateSize(); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/listbox.h b/Externals/wxWidgets3/include/wx/listbox.h index afb0220036..8f649e75a7 100644 --- a/Externals/wxWidgets3/include/wx/listbox.h +++ b/Externals/wxWidgets3/include/wx/listbox.h @@ -48,7 +48,7 @@ public: // multiple selection logic virtual bool IsSelected(int n) const = 0; - virtual void SetSelection(int n); + virtual void SetSelection(int n) wxOVERRIDE; void SetSelection(int n, bool select) { DoSetSelection(n, select); } void Deselect(int n) { DoSetSelection(n, false); } void DeselectAll(int itemToLeaveSelected = -1); @@ -72,6 +72,9 @@ public: // necessary virtual void EnsureVisible(int n); + virtual int GetTopItem() const { return wxNOT_FOUND; } + virtual int GetCountPerPage() const; + // a combination of Append() and EnsureVisible(): appends the item to the // listbox and ensures that it is visible i.e. not scrolled out of view void AppendAndEnsureVisible(const wxString& s); @@ -84,11 +87,11 @@ public: } // override wxItemContainer::IsSorted - virtual bool IsSorted() const { return HasFlag( wxLB_SORT ); } + virtual bool IsSorted() const wxOVERRIDE { return HasFlag( wxLB_SORT ); } // emulate selecting or deselecting the item event.GetInt() (depending on // event.GetExtraLong()) - void Command(wxCommandEvent& event); + void Command(wxCommandEvent& event) wxOVERRIDE; // return the index of the item at this position or wxNOT_FOUND int HitTest(const wxPoint& point) const { return DoListHitTest(point); } @@ -133,6 +136,8 @@ protected: // single selection mode on platforms other than MSW). void UpdateOldSelections(); + wxCoord GetLineHeight() const; + private: wxDECLARE_NO_COPY_CLASS(wxListBoxBase); }; @@ -153,10 +158,8 @@ private: #include "wx/gtk1/listbox.h" #elif defined(__WXMAC__) #include "wx/osx/listbox.h" -#elif defined(__WXPM__) - #include "wx/os2/listbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/listbox.h" +#elif defined(__WXQT__) + #include "wx/qt/listbox.h" #endif #endif // wxUSE_LISTBOX diff --git a/Externals/wxWidgets3/include/wx/listctrl.h b/Externals/wxWidgets3/include/wx/listctrl.h index 51aca4a1b1..dfb87816da 100644 --- a/Externals/wxWidgets3/include/wx/listctrl.h +++ b/Externals/wxWidgets3/include/wx/listctrl.h @@ -29,8 +29,8 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxListCtrlNameStr[]; #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) #include "wx/msw/listctrl.h" -#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - #include "wx/osx/listctrl.h" +#elif defined(__WXQT__) && !defined(__WXUNIVERSAL__) + #include "wx/qt/listctrl.h" #else #include "wx/generic/listctrl.h" #endif @@ -100,7 +100,7 @@ public: void ClearColumnImage(int col) { SetColumnImage(col, -1); } private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListView) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListView); }; #endif // wxUSE_LISTCTRL diff --git a/Externals/wxWidgets3/include/wx/log.h b/Externals/wxWidgets3/include/wx/log.h index be0a245a49..cbc15efde9 100644 --- a/Externals/wxWidgets3/include/wx/log.h +++ b/Externals/wxWidgets3/include/wx/log.h @@ -57,9 +57,7 @@ class WXDLLIMPEXP_FWD_BASE wxObject; #include "wx/arrstr.h" -#ifndef __WXWINCE__ - #include // for time_t -#endif +#include // for time_t #include "wx/dynarray.h" #include "wx/hashmap.h" @@ -564,13 +562,6 @@ public: // this method exists for backwards compatibility only, don't use bool HasPendingMessages() const { return true; } -#if WXWIN_COMPATIBILITY_2_6 - // this function doesn't do anything any more, don't call it - static wxDEPRECATED_INLINE( - wxChar *SetLogBuffer(wxChar *, size_t = 0), return NULL; - ); -#endif // WXWIN_COMPATIBILITY_2_6 - // don't use integer masks any more, use string trace masks instead #if WXWIN_COMPATIBILITY_2_8 static wxDEPRECATED_INLINE( void SetTraceMask(wxTraceMask ulMask), @@ -712,10 +703,10 @@ public: // show the buffer contents to the user in the best possible way (this uses // wxMessageOutputMessageBox) and clear it - virtual void Flush(); + virtual void Flush() wxOVERRIDE; protected: - virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg); + virtual void DoLogTextAtLevel(wxLogLevel level, const wxString& msg) wxOVERRIDE; private: wxString m_str; @@ -733,7 +724,7 @@ public: protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogText(const wxString& msg) wxOVERRIDE; FILE *m_fp; @@ -751,7 +742,7 @@ public: protected: // implement sink function - virtual void DoLogText(const wxString& msg); + virtual void DoLogText(const wxString& msg) wxOVERRIDE; // using ptr here to avoid including from this file wxSTD ostream *m_ostr; @@ -818,7 +809,7 @@ public: wxLog *GetOldLog() const { return m_logOld; } // override base class version to flush the old logger as well - virtual void Flush(); + virtual void Flush() wxOVERRIDE; // call to avoid destroying the old log target void DetachOldLog() { m_logOld = NULL; } @@ -827,7 +818,7 @@ protected: // pass the record to the old logger if needed virtual void DoLogRecord(wxLogLevel level, const wxString& msg, - const wxLogRecordInfo& info); + const wxLogRecordInfo& info) wxOVERRIDE; private: // the current log target @@ -1025,89 +1016,6 @@ public: ) #endif // WXWIN_COMPATIBILITY_2_8 -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wxString&), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wxCStrData&), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const char*), - (wxFormatString(f1))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 1, (const wchar_t*), - (wxFormatString(f1))) - - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (long, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, Log, - 2, (wxObject *, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogAtLevel, - 2, (wxLogLevel, const wchar_t *), - (f1, wxFormatString(f2))) - - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wxString&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (const wxString&, const wchar_t *), - (f1, wxFormatString(f2))) - -#if WXWIN_COMPATIBILITY_2_8 - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, wxTraceMask), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const wxCStrData&), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const char *), - (f1, wxFormatString(f2))) - WX_VARARG_WATCOM_WORKAROUND(void, LogTrace, - 2, (wxTraceMask, const wchar_t *), - (f1, wxFormatString(f2))) -#endif // WXWIN_COMPATIBILITY_2_8 -#endif // __WATCOMC__ - private: #if !wxUSE_UTF8_LOCALE_ONLY void DoLog(const wxChar *format, ...) @@ -1342,21 +1250,6 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); // // See also #11829 for the problems with other simpler approaches, // notably the need for two macros due to buggy __LINE__ in MSVC. -// -// Note 2: Unfortunately we can't use the same solution for all compilers -// because the loop-based one results in problems with MSVC6 due to its -// wrong (pre-C++98) rules for the scope of the variables declared -// inside the loop, as this prevents us from using wxLogXXX() in switch -// statement clauses ("initialization of loopvar skipped by case"). So -// for now, i.e. while we still support VC6, use the previous solution -// for it (FIXME-VC6). -#ifdef __VISUALC6__ -#define wxDO_LOG_IF_ENABLED(level) \ - if ( !wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT) ) \ - {} \ - else \ - wxDO_LOG(level) -#else #define wxDO_LOG_IF_ENABLED_HELPER(level, loopvar) \ for ( bool loopvar = false; \ !loopvar && wxLog::IsLevelEnabled(wxLOG_##level, wxLOG_COMPONENT); \ @@ -1365,7 +1258,6 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); #define wxDO_LOG_IF_ENABLED(level) \ wxDO_LOG_IF_ENABLED_HELPER(level, wxMAKE_UNIQUE_NAME(wxlogcheck)) -#endif // wxLogFatalError() is special as it can't be disabled #define wxLogFatalError wxDO_LOG(FatalError) @@ -1380,6 +1272,10 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); #define wxLogMessage wxDO_LOG_IF_ENABLED(Message) #define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr) +#define wxLogInfo wxDO_LOG_IF_ENABLED(Info) +#define wxVLogInfo(format, argptr) wxDO_LOGV(Info, format, argptr) + + // this one is special as it only logs if we're in verbose mode #define wxLogVerbose \ if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \ @@ -1394,11 +1290,6 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); else \ wxDO_LOGV(Info, format, argptr) -// deprecated synonyms for wxLogVerbose() and wxVLogVerbose() -#define wxLogInfo wxLogVerbose -#define wxVLogInfo wxVLogVerbose - - // another special case: the level is passed as first argument of the function // and so is not available to the macro // @@ -1464,34 +1355,14 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); #undef wxUSE_LOG_TRACE #define wxUSE_LOG_TRACE 0 -#if defined(__WATCOMC__) || defined(__MINGW32__) - // Mingw has similar problem with wxLogSysError: - #define WX_WATCOM_OR_MINGW_ONLY_CODE( x ) x -#else - #define WX_WATCOM_OR_MINGW_ONLY_CODE( x ) -#endif - // define macros for defining log functions which do nothing at all -// -// WX_WATCOM_ONLY_CODE is needed to work around -// http://bugzilla.openwatcom.org/show_bug.cgi?id=351 #define wxDEFINE_EMPTY_LOG_FUNCTION(level) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxFormatString&)) \ - WX_WATCOM_ONLY_CODE( \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const char*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wchar_t*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 1, (const wxCStrData&)) \ - ) \ inline void wxVLog##level(const wxFormatString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) { } \ #define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \ - WX_WATCOM_OR_MINGW_ONLY_CODE( \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const char*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wchar_t*)) \ - WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxCStrData&)) \ - ) \ inline void wxVLog##level(argclass WXUNUSED(arg), \ const wxFormatString& WXUNUSED(format), \ va_list WXUNUSED(argptr)) {} @@ -1585,11 +1456,6 @@ public: WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (wxTraceMask, const wxFormatString&)) #endif WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wxString&, const wxFormatString&)) - #ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const char*, const char*)) - WX_DEFINE_VARARG_FUNC_NOP(wxLogTrace, 2, (const wchar_t*, const wchar_t*)) - #endif #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS #endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE @@ -1625,15 +1491,6 @@ wxSafeShowMessage(const wxString& title, const wxString& text); #define wxLogLastError(api) wxLogNop() #endif // wxUSE_LOG_DEBUG/!wxUSE_LOG_DEBUG -// wxCocoa has additiional trace masks -#if defined(__WXCOCOA__) -#include "wx/cocoa/log.h" -#endif - -#ifdef WX_WATCOM_ONLY_CODE - #undef WX_WATCOM_ONLY_CODE -#endif - // macro which disables debug logging in release builds: this is done by // default by wxIMPLEMENT_APP() so usually it doesn't need to be used explicitly #if defined(NDEBUG) && wxUSE_LOG_DEBUG diff --git a/Externals/wxWidgets3/include/wx/longlong.h b/Externals/wxWidgets3/include/wx/longlong.h index 8a2848c54a..f28a3635c8 100644 --- a/Externals/wxWidgets3/include/wx/longlong.h +++ b/Externals/wxWidgets3/include/wx/longlong.h @@ -45,12 +45,12 @@ #warning "Your compiler does not appear to support 64 bit "\ "integers, using emulation class instead.\n" \ "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" - #elif !(defined(__WATCOMC__) || defined(__VISAGECPP__)) + "wx-dev@googlegroups.com!" + #else #pragma warning "Your compiler does not appear to support 64 bit "\ "integers, using emulation class instead.\n" \ "Please report your compiler version to " \ - "wx-dev@lists.wxwidgets.org!" + "wx-dev@googlegroups.com!" #endif #define wxUSE_LONGLONG_WX 1 @@ -175,8 +175,12 @@ public: // convert to long with range checking in debug mode (only!) long ToLong() const { + // This assert is useless if long long is the same as long (which is + // the case under the standard Unix LP64 model). +#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), wxT("wxLongLong to long conversion loss of precision") ); +#endif return wx_truncate_cast(long, m_ll); } @@ -410,16 +414,7 @@ public: } // convert to double - // - // 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 // operations // addition @@ -1085,12 +1080,6 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &st #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 @@ -1108,8 +1097,6 @@ namespace std } // namespace std -#endif // !VC6 - #endif // wxUSE_LONGLONG_NATIVE // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/math.h b/Externals/wxWidgets3/include/wx/math.h index 89a1b94473..23ff2f031a 100644 --- a/Externals/wxWidgets3/include/wx/math.h +++ b/Externals/wxWidgets3/include/wx/math.h @@ -57,7 +57,7 @@ #if __cplusplus >= 201103 #include #define wxFinite(x) std::isfinite(x) -#elif defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) +#elif defined(__VISUALC__) || defined(__BORLANDC__) #include #define wxFinite(x) _finite(x) #elif defined(__MINGW64_TOOLCHAIN__) || defined(__clang__) @@ -71,7 +71,11 @@ #else #define wxFinite(x) isfinite(x) #endif -#elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ +#elif defined(wxNEEDS_STRICT_ANSI_WORKAROUNDS) + wxDECL_FOR_STRICT_MINGW32(int, _finite, (double)) + + #define wxFinite(x) _finite(x) +#elif ( defined(__GNUG__)||defined(__GNUWIN32__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 ) #ifdef __SOLARIS__ @@ -85,7 +89,7 @@ #if defined(__VISUALC__)||defined(__BORLAND__) #define wxIsNaN(x) _isnan(x) -#elif defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ +#elif defined(__GNUG__)||defined(__GNUWIN32__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ defined(__HPUX__) #define wxIsNaN(x) isnan(x) @@ -133,10 +137,14 @@ inline int wxRound(double x) #endif } +// Convert between degrees and radians. +inline double wxDegToRad(double deg) { return (deg * M_PI) / 180.0; } +inline double wxRadToDeg(double rad) { return (rad * 180.0) / M_PI; } + #endif /* __cplusplus */ -#if defined(__WINDOWS__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) #else #define wxMulDivInt32( a , b , c ) (wxRound((a)*(((wxDouble)b)/((wxDouble)c)))) @@ -161,5 +169,7 @@ inline int wxRound(double x) #endif #endif /* wxUSE_APPLE_IEEE */ +/* Compute the greatest common divisor of two positive integers */ +WXDLLIMPEXP_BASE unsigned int wxGCD(unsigned int u, unsigned int v); #endif /* _WX_MATH_H_ */ diff --git a/Externals/wxWidgets3/include/wx/mdi.h b/Externals/wxWidgets3/include/wx/mdi.h index 837c132822..4be67abda9 100644 --- a/Externals/wxWidgets3/include/wx/mdi.h +++ b/Externals/wxWidgets3/include/wx/mdi.h @@ -123,7 +123,7 @@ public: protected: // Override to pass menu/toolbar events to the active child first. - virtual bool TryBefore(wxEvent& event); + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; // This is wxMDIClientWindow for all the native implementations but not for @@ -177,17 +177,31 @@ public: // in most ports MDI children frames are not really top-level, the only // exception are the Mac ports in which MDI children are just normal top // level windows too - virtual bool IsTopLevel() const { return false; } + virtual bool IsTopLevel() const wxOVERRIDE { 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; } + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE + { + switch ( kind ) + { + case Navigation_Tab: + return true; + + case Navigation_Accel: + // Parent frame accelerators should work inside MDI child, so + // don't block their processing by returning true for them. + break; + } + + return false; + } // 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(); } + virtual void Raise() wxOVERRIDE { Activate(); } protected: wxMDIParentFrame *m_mdiParent; @@ -210,16 +224,16 @@ public: long WXUNUSED(style) = 1, wxWindowID WXUNUSED(id) = 1, const wxString& WXUNUSED(name) - = wxEmptyString) + = wxEmptyString) wxOVERRIDE { return NULL; } - virtual wxStatusBar *GetStatusBar() const + virtual wxStatusBar *GetStatusBar() const wxOVERRIDE { return NULL; } virtual void SetStatusText(const wxString &WXUNUSED(text), - int WXUNUSED(number)=0) + int WXUNUSED(number)=0) wxOVERRIDE { } virtual void SetStatusWidths(int WXUNUSED(n), - const int WXUNUSED(widths)[]) + const int WXUNUSED(widths)[]) wxOVERRIDE { } #endif // wxUSE_STATUSBAR @@ -229,29 +243,29 @@ public: // TODO: again, it should be possible to have tool bars virtual wxToolBar *CreateToolBar(long WXUNUSED(style), wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(name)) + const wxString& WXUNUSED(name)) wxOVERRIDE { return NULL; } - virtual wxToolBar *GetToolBar() const { return NULL; } + virtual wxToolBar *GetToolBar() const wxOVERRIDE { return NULL; } #endif // wxUSE_TOOLBAR // no icon - virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) { } + virtual void SetIcons(const wxIconBundle& WXUNUSED(icons)) wxOVERRIDE { } // title is used as the tab label - virtual wxString GetTitle() const { return m_title; } - virtual void SetTitle(const wxString& title) = 0; + virtual wxString GetTitle() const wxOVERRIDE { return m_title; } + virtual void SetTitle(const wxString& title) wxOVERRIDE = 0; // no maximize etc - virtual void Maximize(bool WXUNUSED(maximize) = true) { } - virtual bool IsMaximized() const { return true; } - virtual bool IsAlwaysMaximized() const { return true; } - virtual void Iconize(bool WXUNUSED(iconize) = true) { } - virtual bool IsIconized() const { return false; } - virtual void Restore() { } + virtual void Maximize(bool WXUNUSED(maximize) = true) wxOVERRIDE { } + virtual bool IsMaximized() const wxOVERRIDE { return true; } + virtual bool IsAlwaysMaximized() const wxOVERRIDE { return true; } + virtual void Iconize(bool WXUNUSED(iconize) = true) wxOVERRIDE { } + virtual bool IsIconized() const wxOVERRIDE { return false; } + virtual void Restore() wxOVERRIDE { } virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style)) { return false; } - virtual bool IsFullScreen() const { return false; } + long WXUNUSED(style)) wxOVERRIDE { return false; } + virtual bool IsFullScreen() const wxOVERRIDE { return false; } // we need to override these functions to ensure that a child window is @@ -259,9 +273,9 @@ public: // behave as just a wxWindow by short-circuiting wxTLW changes to the base // class behaviour - virtual void AddChild(wxWindowBase *child) { wxWindow::AddChild(child); } + virtual void AddChild(wxWindowBase *child) wxOVERRIDE { wxWindow::AddChild(child); } - virtual bool Destroy() { return wxWindow::Destroy(); } + virtual bool Destroy() wxOVERRIDE { return wxWindow::Destroy(); } // extra platform-specific hacks #ifdef __WXMSW__ @@ -282,30 +296,35 @@ public: #endif // __WXMSW__ protected: - virtual void DoGetSize(int *width, int *height) const + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE { wxWindow::DoGetSize(width, height); } - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE { wxWindow::DoSetSize(x, y, width, height, sizeFlags); } - virtual void DoGetClientSize(int *width, int *height) const + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE { wxWindow::DoGetClientSize(width, height); } - virtual void DoSetClientSize(int width, int height) + virtual void DoSetClientSize(int width, int height) wxOVERRIDE { wxWindow::DoSetClientSize(width, height); } + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE + { + wxWindow::DoMoveWindow(x, y, width, height); + } + // no size hints virtual void DoSetSizeHints(int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), int WXUNUSED(maxH), - int WXUNUSED(incW), int WXUNUSED(incH)) { } + int WXUNUSED(incW), int WXUNUSED(incH)) wxOVERRIDE { } wxString m_title; }; @@ -343,9 +362,7 @@ public: // wxUniv always uses the generic MDI implementation and so do the ports // without native version (although wxCocoa seems to have one -- but it's // probably not functional?) - #if defined(__WXCOCOA__) || \ - defined(__WXMOTIF__) || \ - defined(__WXPM__) || \ + #if defined(__WXMOTIF__) || \ defined(__WXUNIVERSAL__) #define wxUSE_GENERIC_MDI_AS_NATIVE 1 #else @@ -363,8 +380,8 @@ public: #include "wx/gtk1/mdi.h" #elif defined(__WXMAC__) #include "wx/osx/mdi.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/mdi.h" +#elif defined(__WXQT__) + #include "wx/qt/mdi.h" #endif inline wxMDIClientWindow *wxMDIParentFrameBase::OnCreateClient() diff --git a/Externals/wxWidgets3/include/wx/mediactrl.h b/Externals/wxWidgets3/include/wx/mediactrl.h index 4d0fd7b0f1..17b359dc15 100644 --- a/Externals/wxWidgets3/include/wx/mediactrl.h +++ b/Externals/wxWidgets3/include/wx/mediactrl.h @@ -106,12 +106,12 @@ public: // Allocates a copy of this object. // Required for wxEvtHandler::AddPendingEvent // ------------------------------------------------------------------------ - virtual wxEvent *Clone() const + virtual wxEvent *Clone() const wxOVERRIDE { return new wxMediaEvent(*this); } // Put this class on wxWidget's RTTI table - DECLARE_DYNAMIC_CLASS(wxMediaEvent) + wxDECLARE_DYNAMIC_CLASS(wxMediaEvent); }; // ---------------------------------------------------------------------------- @@ -215,21 +215,13 @@ protected: static const wxClassInfo* NextBackend(wxClassInfo::const_iterator* it); void OnMediaFinished(wxMediaEvent& evt); - virtual void DoMoveWindow(int x, int y, int w, int h); - wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int w, int h) wxOVERRIDE; + wxSize DoGetBestSize() const wxOVERRIDE; - //FIXME: This is nasty... find a better way to work around - //inheritance issues -#if defined(__WXOSX_CARBON__) - virtual void MacVisibilityChanged(); -#endif -#if defined(__WXOSX_CARBON__) || defined(__WXCOCOA__) - friend class wxQTMediaBackend; -#endif class wxMediaBackend* m_imp; bool m_bLoaded; - DECLARE_DYNAMIC_CLASS(wxMediaCtrl) + wxDECLARE_DYNAMIC_CLASS(wxMediaCtrl); }; // ---------------------------------------------------------------------------- @@ -237,7 +229,7 @@ protected: // wxMediaBackend // // Derive from this and use standard wxWidgets RTTI -// (DECLARE_DYNAMIC_CLASS and IMPLEMENT_CLASS) to make a backend +// (wxDECLARE_DYNAMIC_CLASS and wxIMPLEMENT_CLASS) to make a backend // for wxMediaCtrl. Backends are searched alphabetically - // the one with the earliest letter is tried first. // @@ -321,7 +313,7 @@ public: { } virtual void RESERVED9() {} - DECLARE_DYNAMIC_CLASS(wxMediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxMediaBackend); }; diff --git a/Externals/wxWidgets3/include/wx/memory.h b/Externals/wxWidgets3/include/wx/memory.h index 834ae4efd6..d6cc18301e 100644 --- a/Externals/wxWidgets3/include/wx/memory.h +++ b/Externals/wxWidgets3/include/wx/memory.h @@ -42,18 +42,13 @@ WXDLLIMPEXP_BASE void wxDebugFree(void * buf, bool isVect = false); #if defined(__SUNCC__) #define wxUSE_ARRAY_MEMORY_OPERATORS 0 -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 #elif defined (__SGI_CC_) // only supported by -n32 compilers #ifndef __EDG_ABI_COMPATIBILITY_VERSION #define wxUSE_ARRAY_MEMORY_OPERATORS 0 #endif -#elif !( defined (__VISUALC__) && (__VISUALC__ <= 1020) ) - #define wxUSE_ARRAY_MEMORY_OPERATORS 1 #else - // ::operator new[] is a recent C++ feature, so assume it's not supported - #define wxUSE_ARRAY_MEMORY_OPERATORS 0 + #define wxUSE_ARRAY_MEMORY_OPERATORS 1 #endif // devik 2000-8-29: All new/delete ops are now inline because they can't @@ -109,8 +104,7 @@ void operator delete[] (void * buf); #endif // wxUSE_ARRAY_MEMORY_OPERATORS #endif // defined(__WINDOWS__) && (defined(WXUSINGDLL) || defined(WXMAKINGDLL_BASE)) -// VC++ 6.0 -#if ( defined(__VISUALC__) && (__VISUALC__ >= 1200) ) +#if defined(__VISUALC__) inline void operator delete(void* pData, wxChar* /* fileName */, int /* lineNum */) { wxDebugFree(pData, false); @@ -119,7 +113,7 @@ inline void operator delete[](void* pData, wxChar* /* fileName */, int /* lineNu { wxDebugFree(pData, true); } -#endif // __VISUALC__>=1200 +#endif // __VISUALC__ #endif // wxUSE_GLOBAL_MEMORY_OPERATORS //********************************************************************************** @@ -221,7 +215,7 @@ protected: // Returns the amount of padding needed after something of the given // size. This is so that when we cast pointers backwards and forwards // the pointer value will be valid for a wxMarkerType. - static size_t GetPadding (const size_t size) ; + static size_t GetPadding (size_t size) ; // Traverse the list. static void TraverseList (PmSFV, wxMemStruct *from = NULL); @@ -250,17 +244,17 @@ public: // Calculated from the request size and any padding needed // before the final marker. - static size_t PaddedSize (const size_t reqSize); + static size_t PaddedSize (size_t reqSize); // Calc the total amount of space we need from the system // to satisfy a caller request. This includes all padding. - static size_t TotSize (const size_t reqSize); + static size_t TotSize (size_t reqSize); // Return valid pointers to offsets within the allocated memory. static char * StructPos (const char * buf); static char * MidMarkerPos (const char * buf); static char * CallerMemPos (const char * buf); - static char * EndMarkerPos (const char * buf, const size_t size); + static char * EndMarkerPos (const char * buf, size_t size); // Given a pointer to the start of the caller requested area // return a pointer to the start of the entire alloc\'d buffer. diff --git a/Externals/wxWidgets3/include/wx/menu.h b/Externals/wxWidgets3/include/wx/menu.h index e4dedcf2dd..b733467604 100644 --- a/Externals/wxWidgets3/include/wx/menu.h +++ b/Externals/wxWidgets3/include/wx/menu.h @@ -275,9 +275,11 @@ public: // implementation helpers // ---------------------- - // Updates the UI for a menu and all submenus recursively. source is the - // object that has the update event handlers defined for it. If NULL, the - // menu or associated window will be used. + // Updates the UI for a menu and all submenus recursively by generating + // wxEVT_UPDATE_UI for all the items. + // + // Do not use the "source" argument, it allows to override the event + // handler to use for these events, but this should never be needed. void UpdateUI(wxEvtHandler* source = NULL); // get the menu bar this menu is attached to (may be NULL, always NULL for @@ -309,6 +311,13 @@ public: // the checked parameter may have boolean value or -1 for uncheckable items bool SendEvent(int itemid, int checked = -1); + // called to dispatch a wxMenuEvent to the right recipients, menu pointer + // can be NULL if we failed to find the associated menu (this happens at + // least in wxMSW for the events from the system menus) + static + bool ProcessMenuEvent(wxMenu* menu, wxMenuEvent& event, wxWindow* win); + + // compatibility: these functions are deprecated, use the new ones instead // ----------------------------------------------------------------------- @@ -388,6 +397,12 @@ protected: static bool ms_locked; + +private: + // Common part of SendEvent() and ProcessMenuEvent(): sends the event to + // its intended recipients, returns true if it was processed. + static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win); + wxDECLARE_NO_COPY_CLASS(wxMenuBase); }; @@ -416,8 +431,8 @@ public: private: wxMenu *m_menu; wxString m_title; - - DECLARE_DYNAMIC_CLASS(wxMenuInfoHelper) + + wxDECLARE_DYNAMIC_CLASS(wxMenuInfoHelper); }; WX_DECLARE_EXPORTED_LIST(wxMenuInfoHelper, wxMenuInfoHelperList ); @@ -528,17 +543,17 @@ public: virtual void Detach(); // need to override these ones to avoid virtual function hiding - virtual bool Enable(bool enable = true) { return wxWindow::Enable(enable); } - virtual void SetLabel(const wxString& s) { wxWindow::SetLabel(s); } - virtual wxString GetLabel() const { return wxWindow::GetLabel(); } + virtual bool Enable(bool enable = true) wxOVERRIDE { return wxWindow::Enable(enable); } + virtual void SetLabel(const wxString& s) wxOVERRIDE { wxWindow::SetLabel(s); } + virtual wxString GetLabel() const wxOVERRIDE { return wxWindow::GetLabel(); } // don't want menu bars to accept the focus by tabbing to them - virtual bool AcceptsFocusFromKeyboard() const { return false; } + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } // update all menu item states in all menus virtual void UpdateMenus(); - virtual bool CanBeOutsideClientArea() const { return true; } + virtual bool CanBeOutsideClientArea() const wxOVERRIDE { return true; } #if wxUSE_EXTENDED_RTTI // XTI helpers: @@ -589,10 +604,8 @@ protected: #include "wx/gtk1/menu.h" #elif defined(__WXMAC__) #include "wx/osx/menu.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menu.h" -#elif defined(__WXPM__) - #include "wx/os2/menu.h" +#elif defined(__WXQT__) + #include "wx/qt/menu.h" #endif #endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY diff --git a/Externals/wxWidgets3/include/wx/menuitem.h b/Externals/wxWidgets3/include/wx/menuitem.h index 4eb80b7b5b..826086d118 100644 --- a/Externals/wxWidgets3/include/wx/menuitem.h +++ b/Externals/wxWidgets3/include/wx/menuitem.h @@ -204,10 +204,8 @@ inline void wxMenuItemBase::SetText(const wxString& text) { SetItemLabel(text); #include "wx/gtk1/menuitem.h" #elif defined(__WXMAC__) #include "wx/osx/menuitem.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/menuitem.h" -#elif defined(__WXPM__) - #include "wx/os2/menuitem.h" +#elif defined(__WXQT__) + #include "wx/qt/menuitem.h" #endif #endif // wxUSE_BASE_CLASSES_ONLY/!wxUSE_BASE_CLASSES_ONLY diff --git a/Externals/wxWidgets3/include/wx/meta/if.h b/Externals/wxWidgets3/include/wx/meta/if.h index f6f3672fc7..0d93e8188b 100644 --- a/Externals/wxWidgets3/include/wx/meta/if.h +++ b/Externals/wxWidgets3/include/wx/meta/if.h @@ -12,27 +12,11 @@ #include "wx/defs.h" -// NB: This code is intentionally written without partial templates -// specialization, because some older compilers (notably VC6) don't -// support it. - namespace wxPrivate { template -struct wxIfImpl - -// broken VC6 needs not just an incomplete template class declaration but a -// "skeleton" declaration of the specialized versions below as it apparently -// tries to look up the types in the generic template definition at some moment -// even though it ends up by using the correct specialization in the end -- but -// without this skeleton it doesn't recognize Result as a class at all below -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) -{ - template struct Result {}; -} -#endif // VC++ <= 6 -; +struct wxIfImpl; // specialization for true: template <> diff --git a/Externals/wxWidgets3/include/wx/meta/implicitconversion.h b/Externals/wxWidgets3/include/wx/meta/implicitconversion.h index d596a6b248..2207cb193b 100644 --- a/Externals/wxWidgets3/include/wx/meta/implicitconversion.h +++ b/Externals/wxWidgets3/include/wx/meta/implicitconversion.h @@ -29,28 +29,18 @@ namespace wxPrivate { -// Helper macro to define a constant inside a template class: it's needed -// because MSVC6 doesn't support initializing static integer members but the -// usual workaround of using enums instead doesn't work for Borland (at least -// in template classes). -#ifdef __VISUALC6__ - #define wxDEFINE_CLASS_INT_CONST(name, value) enum { name = value } -#else - #define wxDEFINE_CLASS_INT_CONST(name, value) static const int name = value -#endif - template struct TypeHierarchy { // consider unknown types (e.g. objects, pointers) to be of highest // level, always convert to them if they occur - wxDEFINE_CLASS_INT_CONST( level, 9999 ); + static const int level = 9999; }; #define WX_TYPE_HIERARCHY_LEVEL(level_num, type) \ template<> struct TypeHierarchy \ { \ - wxDEFINE_CLASS_INT_CONST( level, level_num ); \ + static const int level = level_num; \ } WX_TYPE_HIERARCHY_LEVEL( 1, char); diff --git a/Externals/wxWidgets3/include/wx/meta/movable.h b/Externals/wxWidgets3/include/wx/meta/movable.h index e3a9f9e96c..6e6aac9751 100644 --- a/Externals/wxWidgets3/include/wx/meta/movable.h +++ b/Externals/wxWidgets3/include/wx/meta/movable.h @@ -20,7 +20,7 @@ template struct wxIsMovable { - wxDEFINE_TEMPLATE_BOOL_VALUE(wxIsPod::value); + static const bool value = wxIsPod::value; }; // Macro to add wxIsMovable specialization for given type that marks it @@ -28,7 +28,7 @@ struct wxIsMovable #define WX_DECLARE_TYPE_MOVABLE(type) \ template<> struct wxIsMovable \ { \ - wxDEFINE_TEMPLATE_BOOL_VALUE(true); \ + static const bool value = true; \ }; // Our implementation of wxString is written in such way that it's safe to move diff --git a/Externals/wxWidgets3/include/wx/meta/pod.h b/Externals/wxWidgets3/include/wx/meta/pod.h index b9dde13d65..fa4395c62a 100644 --- a/Externals/wxWidgets3/include/wx/meta/pod.h +++ b/Externals/wxWidgets3/include/wx/meta/pod.h @@ -18,22 +18,11 @@ // , while GCC 4.3 and later have it in . // -// This macro declares something called "value" inside a class declaration. -// -// It has to be used because VC6 doesn't handle initialization of the static -// variables in the class declaration itself while BCC5.82 doesn't understand -// enums (it compiles the template fine but can't use it later) -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) - #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) enum { value = val } -#else - #define wxDEFINE_TEMPLATE_BOOL_VALUE(val) static const bool value = val -#endif - // Helper to decide if an object of type T is POD (Plain Old Data) template struct wxIsPod { - wxDEFINE_TEMPLATE_BOOL_VALUE(false); + static const bool value = false; }; // Macro to add wxIsPod specialization for given type that marks it @@ -41,7 +30,7 @@ struct wxIsPod #define WX_DECLARE_TYPE_POD(type) \ template<> struct wxIsPod \ { \ - wxDEFINE_TEMPLATE_BOOL_VALUE(true); \ + static const bool value = true; \ }; WX_DECLARE_TYPE_POD(bool) @@ -64,11 +53,6 @@ WX_DECLARE_TYPE_POD(wxLongLong_t) WX_DECLARE_TYPE_POD(wxULongLong_t) #endif -// Visual C++ 6.0 can't compile partial template specializations and as this is -// only an optimization, we can live with pointers not being recognized as -// POD types under VC6 -#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7) - // pointers are Plain Old Data: template struct wxIsPod @@ -82,6 +66,4 @@ struct wxIsPod static const bool value = true; }; -#endif // !VC++ < 7 - #endif // _WX_META_POD_H_ diff --git a/Externals/wxWidgets3/include/wx/meta/removeref.h b/Externals/wxWidgets3/include/wx/meta/removeref.h index e199d033f7..efef170fb8 100644 --- a/Externals/wxWidgets3/include/wx/meta/removeref.h +++ b/Externals/wxWidgets3/include/wx/meta/removeref.h @@ -13,10 +13,6 @@ // wxRemoveRef<> is similar to C++11 std::remove_reference<> but works with all // compilers (but, to compensate for this, doesn't work with rvalue references). -// Except that it doesn't work with VC++ 6 as there doesn't seem to be any way -// to partially specialize a template for references with it. -#ifndef __VISUALC6__ - template struct wxRemoveRef { @@ -29,8 +25,9 @@ struct wxRemoveRef typedef T type; }; +// Define this for compatibility with the previous versions in which +// wxRemoveRef() wasn't always defined as we supported MSVC6 for which it +// couldn't be implemented. #define wxHAS_REMOVEREF -#endif // !__VISUALC6__ - #endif // _WX_META_REMOVEREF_H_ diff --git a/Externals/wxWidgets3/include/wx/metafile.h b/Externals/wxWidgets3/include/wx/metafile.h index c34d8acef3..e5e6dd03da 100644 --- a/Externals/wxWidgets3/include/wx/metafile.h +++ b/Externals/wxWidgets3/include/wx/metafile.h @@ -42,8 +42,6 @@ #else // !wxUSE_ENH_METAFILE #include "wx/msw/metafile.h" #endif -#elif defined(__WXPM__) - #include "wx/os2/metafile.h" #elif defined(__WXMAC__) #include "wx/osx/metafile.h" #endif diff --git a/Externals/wxWidgets3/include/wx/mimetype.h b/Externals/wxWidgets3/include/wx/mimetype.h index b3ae6b77b0..c95d7775f9 100644 --- a/Externals/wxWidgets3/include/wx/mimetype.h +++ b/Externals/wxWidgets3/include/wx/mimetype.h @@ -175,49 +175,6 @@ public: const CtorString&, const CtorString&), VarArgInit, VarArgInit) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wxString&, - const wxString&, - const wxString&, - const wxString&), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wxCStrData&, - const wxCStrData&, - const wxCStrData&, - const wxCStrData&), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const char*, - const char*, - const char*, - const char*), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); - WX_VARARG_WATCOM_WORKAROUND_CTOR( - wxFileTypeInfo, - 4, (const wchar_t*, - const wchar_t*, - const wchar_t*, - const wchar_t*), - (CtorString(f1), - CtorString(f2), - CtorString(f3), - CtorString(f4))); -#endif // the array elements correspond to the parameters of the ctor above in // the same order @@ -396,6 +353,9 @@ public: // dtor (not virtual, shouldn't be derived from) ~wxFileType(); + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; private: // default ctor is private because the user code never creates us wxFileType(); diff --git a/Externals/wxWidgets3/include/wx/minifram.h b/Externals/wxWidgets3/include/wx/minifram.h index f769c5a691..bd03bbc939 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 -// Licence: wxWindows Licence +// Copyright: (c) 2014 wxWidgets dev team ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_MINIFRAM_H_BASE_ @@ -27,8 +27,8 @@ #include "wx/x11/minifram.h" #elif defined(__WXMAC__) #include "wx/osx/minifram.h" -#elif defined(__WXPM__) -#include "wx/os2/minifram.h" +#elif defined(__WXQT__) +#include "wx/qt/minifram.h" #else // TODO: it seems that wxMiniFrame could be just defined here generically // instead of having all the above port-specific headers diff --git a/Externals/wxWidgets3/include/wx/module.h b/Externals/wxWidgets3/include/wx/module.h index 96600b76ca..2fc8559dd8 100644 --- a/Externals/wxWidgets3/include/wx/module.h +++ b/Externals/wxWidgets3/include/wx/module.h @@ -113,7 +113,7 @@ private: } m_state; - DECLARE_CLASS(wxModule) + wxDECLARE_CLASS(wxModule); }; #endif // _WX_MODULE_H_ diff --git a/Externals/wxWidgets3/include/wx/mousemanager.h b/Externals/wxWidgets3/include/wx/mousemanager.h index caa2abeaec..997bee01ea 100644 --- a/Externals/wxWidgets3/include/wx/mousemanager.h +++ b/Externals/wxWidgets3/include/wx/mousemanager.h @@ -144,7 +144,7 @@ private: wxPoint m_posLast; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxMouseEventsManager); }; diff --git a/Externals/wxWidgets3/include/wx/msgdlg.h b/Externals/wxWidgets3/include/wx/msgdlg.h index 8a234ac48f..28e53d320b 100644 --- a/Externals/wxWidgets3/include/wx/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/msgdlg.h @@ -92,7 +92,7 @@ public: : m_message(message), m_caption(caption) { - m_parent = parent; + m_parent = GetParentForModalDialog(parent, style); SetMessageDialogStyle(style); } @@ -101,6 +101,12 @@ public: wxString GetCaption() const { return m_caption; } + // Title and caption are the same thing, GetCaption() mostly exists just + // for compatibility. + virtual void SetTitle(const wxString& title) wxOVERRIDE { m_caption = title; } + virtual wxString GetTitle() const wxOVERRIDE { return m_caption; } + + virtual void SetMessage(const wxString& message) { m_message = message; @@ -185,7 +191,6 @@ public: DoSetCustomLabel(m_help, help); return true; } - // test if any custom labels were set bool HasCustomLabels() const { @@ -292,8 +297,6 @@ private: (defined(__WXGTK__) && !defined(__WXGTK20__)) #define wxMessageDialog wxGenericMessageDialog -#elif defined(__WXCOCOA__) - #include "wx/cocoa/msgdlg.h" #elif defined(__WXMSW__) #include "wx/msw/msgdlg.h" #elif defined(__WXMOTIF__) @@ -302,8 +305,8 @@ private: #include "wx/gtk/msgdlg.h" #elif defined(__WXMAC__) #include "wx/osx/msgdlg.h" -#elif defined(__WXPM__) - #include "wx/os2/msgdlg.h" +#elif defined(__WXQT__) + #include "wx/qt/msgdlg.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/msgout.h b/Externals/wxWidgets3/include/wx/msgout.h index 63b39b92c2..006e0651c3 100644 --- a/Externals/wxWidgets3/include/wx/msgout.h +++ b/Externals/wxWidgets3/include/wx/msgout.h @@ -24,55 +24,7 @@ // something you can printf() to // ---------------------------------------------------------------------------- -// NB: VC6 has a bug that causes linker errors if you have template methods -// in a class using __declspec(dllimport). The solution is to split such -// class into two classes, one that contains the template methods and does -// *not* use WXDLLIMPEXP_BASE and another class that contains the rest -// (with DLL linkage). -class wxMessageOutputBase -{ -public: - virtual ~wxMessageOutputBase() { } - - // show a message to the user - // void Printf(const wxString& format, ...) = 0; - WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif - - // called by DoPrintf() to output formatted string but can also be called - // directly if no formatting is needed - virtual void Output(const wxString& str) = 0; - -protected: - // NB: this is pure virtual so that it can be implemented in dllexported - // wxMessagOutput class -#if !wxUSE_UTF8_LOCALE_ONLY - virtual void DoPrintfWchar(const wxChar *format, ...) = 0; -#endif -#if wxUSE_UNICODE_UTF8 - virtual void DoPrintfUtf8(const char *format, ...) = 0; -#endif -}; - -#ifdef __VISUALC__ - // "non dll-interface class 'wxStringPrintfMixin' used as base interface - // for dll-interface class 'wxString'" -- this is OK in our case - #pragma warning (push) - #pragma warning (disable:4275) -#endif - -class WXDLLIMPEXP_BASE wxMessageOutput : public wxMessageOutputBase +class WXDLLIMPEXP_BASE wxMessageOutput { public: virtual ~wxMessageOutput() { } @@ -84,22 +36,27 @@ public: // sets the global wxMessageOutput instance; returns the previous one static wxMessageOutput* Set(wxMessageOutput* msgout); + // show a message to the user + // void Printf(const wxString& format, ...) = 0; + WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), + DoPrintfWchar, DoPrintfUtf8) + + // called by DoPrintf() to output formatted string but can also be called + // directly if no formatting is needed + virtual void Output(const wxString& str) = 0; + protected: #if !wxUSE_UTF8_LOCALE_ONLY - virtual void DoPrintfWchar(const wxChar *format, ...); + void DoPrintfWchar(const wxChar *format, ...); #endif #if wxUSE_UNICODE_UTF8 - virtual void DoPrintfUtf8(const char *format, ...); + void DoPrintfUtf8(const char *format, ...); #endif private: static wxMessageOutput* ms_msgOut; }; -#ifdef __VISUALC__ - #pragma warning (pop) -#endif - // ---------------------------------------------------------------------------- // implementation which sends output to stderr or specified file // ---------------------------------------------------------------------------- @@ -109,7 +66,7 @@ class WXDLLIMPEXP_BASE wxMessageOutputStderr : public wxMessageOutput public: wxMessageOutputStderr(FILE *fp = stderr) : m_fp(fp) { } - virtual void Output(const wxString& str); + virtual void Output(const wxString& str) wxOVERRIDE; protected: // return the string with "\n" appended if it doesn't already terminate @@ -136,7 +93,7 @@ public: wxMessageOutputBest(wxMessageOutputFlags flags = wxMSGOUT_PREFER_STDERR) : m_flags(flags) { } - virtual void Output(const wxString& str); + virtual void Output(const wxString& str) wxOVERRIDE; private: wxMessageOutputFlags m_flags; @@ -153,7 +110,7 @@ class WXDLLIMPEXP_CORE wxMessageOutputMessageBox : public wxMessageOutput public: wxMessageOutputMessageBox() { } - virtual void Output(const wxString& str); + virtual void Output(const wxString& str) wxOVERRIDE; }; #endif // wxUSE_GUI && wxUSE_MSGDLG @@ -167,7 +124,7 @@ class WXDLLIMPEXP_BASE wxMessageOutputDebug : public wxMessageOutputStderr public: wxMessageOutputDebug() { } - virtual void Output(const wxString& str); + virtual void Output(const wxString& str) wxOVERRIDE; }; // ---------------------------------------------------------------------------- @@ -179,7 +136,7 @@ class WXDLLIMPEXP_BASE wxMessageOutputLog : public wxMessageOutput public: wxMessageOutputLog() { } - virtual void Output(const wxString& str); + virtual void Output(const wxString& str) wxOVERRIDE; }; #endif // _WX_MSGOUT_H_ diff --git a/Externals/wxWidgets3/include/wx/mstream.h b/Externals/wxWidgets3/include/wx/mstream.h index 435aebdfb8..b4e7303eaa 100644 --- a/Externals/wxWidgets3/include/wx/mstream.h +++ b/Externals/wxWidgets3/include/wx/mstream.h @@ -36,25 +36,20 @@ public: } virtual ~wxMemoryInputStream(); - virtual wxFileOffset GetLength() const { return m_length; } - virtual bool IsSeekable() const { return true; } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_length; } + virtual bool IsSeekable() const wxOVERRIDE { return true; } - virtual char Peek(); - virtual bool CanRead() const; + virtual char Peek() wxOVERRIDE; + virtual bool CanRead() const wxOVERRIDE; wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: wxStreamBuffer *m_i_streambuf; - size_t OnSysRead(void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + size_t OnSysRead(void *buffer, size_t nbytes) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; private: // common part of ctors taking wxInputStream @@ -63,7 +58,7 @@ private: size_t m_length; // copy ctor is implemented above: it copies the other stream in this one - DECLARE_ABSTRACT_CLASS(wxMemoryInputStream) + wxDECLARE_ABSTRACT_CLASS(wxMemoryInputStream); wxDECLARE_NO_ASSIGN_CLASS(wxMemoryInputStream); }; @@ -73,35 +68,25 @@ public: // if data is !NULL it must be allocated with malloc() wxMemoryOutputStream(void *data = NULL, size_t length = 0); virtual ~wxMemoryOutputStream(); - virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); } - virtual bool IsSeekable() const { return true; } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_o_streambuf->GetLastAccess(); } + virtual bool IsSeekable() const wxOVERRIDE { return true; } size_t CopyTo(void *buffer, size_t len) const; wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: wxStreamBuffer *m_o_streambuf; protected: - size_t OnSysWrite(const void *buffer, size_t nbytes); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + size_t OnSysWrite(const void *buffer, size_t nbytes) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxMemoryOutputStream) + wxDECLARE_DYNAMIC_CLASS(wxMemoryOutputStream); wxDECLARE_NO_COPY_CLASS(wxMemoryOutputStream); }; -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBuffer *wxMemoryInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxMemoryOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - #endif // wxUSE_STREAMS diff --git a/Externals/wxWidgets3/include/wx/msw/accel.h b/Externals/wxWidgets3/include/wx/msw/accel.h index 182662c209..325755784c 100644 --- a/Externals/wxWidgets3/include/wx/msw/accel.h +++ b/Externals/wxWidgets3/include/wx/msw/accel.h @@ -38,7 +38,7 @@ public: bool Translate(wxWindow *window, WXMSG *msg) const; private: - DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/anybutton.h b/Externals/wxWidgets3/include/wx/msw/anybutton.h index e8226d51c3..3c876aeb2d 100644 --- a/Externals/wxWidgets3/include/wx/msw/anybutton.h +++ b/Externals/wxWidgets3/include/wx/msw/anybutton.h @@ -36,7 +36,6 @@ public: 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; } @@ -73,6 +72,8 @@ protected: void MakeOwnerDrawn(); bool IsOwnerDrawn() const; + virtual bool MSWIsPushed() const; + private: wxDECLARE_NO_COPY_CLASS(wxAnyButton); }; diff --git a/Externals/wxWidgets3/include/wx/msw/app.h b/Externals/wxWidgets3/include/wx/msw/app.h index fa108cc125..29285adeab 100644 --- a/Externals/wxWidgets3/include/wx/msw/app.h +++ b/Externals/wxWidgets3/include/wx/msw/app.h @@ -29,7 +29,7 @@ public: virtual ~wxApp(); // override base class (pure) virtuals - virtual bool Initialize(int& _argc, wxChar **_argv); + virtual bool Initialize(int& argc, wxChar **argv); virtual void CleanUp(); virtual void WakeUpIdle(); @@ -74,6 +74,17 @@ public: // in the previous GetRegisteredClassName() calls static bool IsRegisteredClassName(const wxString& name); + // Return the layout direction to use for a window by default. + // + // If the parent is specified, use the same layout direction as it uses. + // Otherwise use the default global layout, either from wxTheApp, if it + // exists, or Windows itself. + // + // Notice that this normally should not be used for the child windows as + // they already inherit, just dialogs such as wxMessageDialog may want to + // use it. + static wxLayoutDirection MSWGetDefaultLayout(wxWindow* parent = NULL); + protected: int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT @@ -91,39 +102,15 @@ public: // wasn't found at all static int GetComCtl32Version(); - // the same for shell32.dll: returns 400, 471, 500, 600, ... (4.70 not - // currently detected) - static int GetShell32Version(); - // the SW_XXX value to be used for the frames opened by the application // (currently seems unused which is a bug -- TODO) static int m_nCmdShow; protected: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxApp); - DECLARE_DYNAMIC_CLASS(wxApp) + wxDECLARE_DYNAMIC_CLASS(wxApp); }; -#ifdef __WXWINCE__ - -// under CE provide a dummy implementation of GetComCtl32Version() returning -// the value passing all ">= 470" tests (which are the only ones used in our -// code currently) as commctrl.dll under CE 2.0 and later support comctl32.dll -// functionality -inline int wxApp::GetComCtl32Version() -{ - return 471; -} - -// this is not currently used at all under CE so it's not really clear what do -// we need to return from here -inline int wxApp::GetShell32Version() -{ - return 0; -} - -#endif // __WXWINCE__ - #endif // _WX_APP_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/appprogress.h b/Externals/wxWidgets3/include/wx/msw/appprogress.h new file mode 100644 index 0000000000..0840c075d4 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/appprogress.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/appprogress.h +// Purpose: wxAppProgressIndicator interface. +// Author: Chaobin Zhang +// Created: 2014-09-05 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPPROG_H_ +#define _WX_MSW_APPPROG_H_ + +#include "wx/vector.h" + +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; + +class WXDLLIMPEXP_CORE wxAppProgressIndicator + : public wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + virtual ~wxAppProgressIndicator(); + + virtual bool IsAvailable() const wxOVERRIDE; + + virtual void SetValue(int value) wxOVERRIDE; + virtual void SetRange(int range) wxOVERRIDE; + virtual void Pulse() wxOVERRIDE; + virtual void Reset() wxOVERRIDE; + +private: + int m_maxValue; + + wxVector m_taskBarButtons; + + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator); +}; + +#endif // _WX_MSW_APPPROG_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/apptbase.h b/Externals/wxWidgets3/include/wx/msw/apptbase.h index 65a1b5bff3..2442bf3b61 100644 --- a/Externals/wxWidgets3/include/wx/msw/apptbase.h +++ b/Externals/wxWidgets3/include/wx/msw/apptbase.h @@ -44,7 +44,6 @@ public: #endif // wxUSE_THREADS -#ifndef __WXWINCE__ // console helpers // --------------- @@ -58,7 +57,6 @@ public: // write text to the console, return true if ok or false on error virtual bool WriteToStderr(const wxString& text) = 0; -#endif // !__WXWINCE__ protected: #if wxUSE_THREADS diff --git a/Externals/wxWidgets3/include/wx/msw/apptrait.h b/Externals/wxWidgets3/include/wx/msw/apptrait.h index f190da6dab..d7466482a6 100644 --- a/Externals/wxWidgets3/include/wx/msw/apptrait.h +++ b/Externals/wxWidgets3/include/wx/msw/apptrait.h @@ -28,10 +28,8 @@ public: virtual bool DoMessageFromThreadWait(); virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags); #endif // wxUSE_THREADS -#ifndef __WXWINCE__ virtual bool CanUseStderr() { return true; } virtual bool WriteToStderr(const wxString& text); -#endif // !__WXWINCE__ }; #if wxUSE_GUI @@ -51,12 +49,12 @@ public: virtual bool DoMessageFromThreadWait(); virtual WXDWORD WaitForThread(WXHANDLE hThread, int flags); #endif // wxUSE_THREADS - virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const; + wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; -#ifndef __WXWINCE__ virtual bool CanUseStderr(); virtual bool WriteToStderr(const wxString& text); -#endif // !__WXWINCE__ }; #elif defined(__WXGTK__) @@ -81,12 +79,12 @@ public: virtual WXDWORD WaitForThread(WXHANDLE hThread, int WXUNUSED(flags)) { return DoSimpleWaitForThread(hThread); } #endif // wxUSE_THREADS - virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const; + virtual wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const; -#ifndef __WXWINCE__ virtual bool CanUseStderr() { return false; } virtual bool WriteToStderr(const wxString& WXUNUSED(text)) { return false; } -#endif // !__WXWINCE__ }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/bitmap.h b/Externals/wxWidgets3/include/wx/msw/bitmap.h index ef07317b1d..4ebc108894 100644 --- a/Externals/wxWidgets3/include/wx/msw/bitmap.h +++ b/Externals/wxWidgets3/include/wx/msw/bitmap.h @@ -81,7 +81,7 @@ public: #if wxUSE_IMAGE // Convert from wxImage - wxBitmap(const wxImage& image, int depth = -1) + wxBitmap(const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0) { (void)CreateFromImage(image, depth); } // Create a DDB compatible with the given DC from wxImage @@ -97,6 +97,12 @@ public: CopyFromIcon(icon, transp); } + // Convert from wxCursor + wxEXPLICIT wxBitmap(const wxCursor& cursor) + { + (void)CopyFromCursor(cursor, wxBitmapTransparency_Auto); + } + wxBitmap& operator=(const wxIcon& icon) { (void)CopyFromIcon(icon); @@ -104,12 +110,17 @@ public: return *this; } +#if WXWIN_COMPATIBILITY_3_0 + // This assignment operator is not portable as it is not implemented in any + // other ports. + wxDEPRECATED_MSG("Don't assign wxCursor to an existing wxBitmap, create a new wxBitmap from wxCursor instead.") wxBitmap& operator=(const wxCursor& cursor) { (void)CopyFromCursor(cursor); return *this; } +#endif // WXWIN_COMPATIBILITY_3_0 virtual ~wxBitmap(); @@ -136,6 +147,8 @@ public: #if wxUSE_WXDIB // copies from a device independent bitmap bool CopyFromDIB(const wxDIB& dib); + bool IsDIB() const; + bool ConvertToDIB(); #endif virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); @@ -168,7 +181,8 @@ public: // these functions are internal and shouldn't be used, they risk to // disappear in the future bool HasAlpha() const; - void UseAlpha(); + void UseAlpha(bool use = true); + void ResetAlpha() { UseAlpha(false); } // support for scaled bitmaps virtual double GetScaleFactor() const { return 1.0; } @@ -180,6 +194,10 @@ public: // implementation only from now on // ------------------------------- + // Set alpha flag to true if this is a 32bpp bitmap which has any non-0 + // values in its alpha channel. + void MSWUpdateAlpha(); + public: void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } @@ -212,7 +230,7 @@ private: wxBitmapTransparency transp = wxBitmapTransparency_Auto); - DECLARE_DYNAMIC_CLASS(wxBitmap) + wxDECLARE_DYNAMIC_CLASS(wxBitmap); }; // ---------------------------------------------------------------------------- @@ -256,7 +274,7 @@ public: protected: WXHBITMAP m_maskBitmap; - DECLARE_DYNAMIC_CLASS(wxMask) + wxDECLARE_DYNAMIC_CLASS(wxMask); }; @@ -304,7 +322,7 @@ public: const wxPalette *palette = NULL) const; private: - DECLARE_DYNAMIC_CLASS(wxBitmapHandler) + wxDECLARE_DYNAMIC_CLASS(wxBitmapHandler); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h b/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h index e435673c2b..066c0f4f4f 100644 --- a/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/msw/bmpbuttn.h @@ -42,8 +42,8 @@ public: const wxString& name = wxButtonNameStr); protected: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton); }; #endif // _WX_BMPBUTTN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/bmpcbox.h b/Externals/wxWidgets3/include/wx/msw/bmpcbox.h index 0462c46217..3530c1b591 100644 --- a/Externals/wxWidgets3/include/wx/msw/bmpcbox.h +++ b/Externals/wxWidgets3/include/wx/msw/bmpcbox.h @@ -127,9 +127,9 @@ private: bool m_inResize; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_DYNAMIC_CLASS(wxBitmapComboBox) + wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox); }; #endif // _WX_MSW_BMPCBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/brush.h b/Externals/wxWidgets3/include/wx/msw/brush.h index 9665fd1133..3de73c57e0 100644 --- a/Externals/wxWidgets3/include/wx/msw/brush.h +++ b/Externals/wxWidgets3/include/wx/msw/brush.h @@ -24,9 +24,6 @@ class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase public: wxBrush(); wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); -#endif wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); @@ -42,10 +39,12 @@ public: wxBrushStyle GetStyle() const; wxBitmap *GetStipple() const; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } // return the HBRUSH for this brush virtual WXHANDLE GetResourceHandle() const; @@ -55,7 +54,7 @@ protected: virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxBrush) + wxDECLARE_DYNAMIC_CLASS(wxBrush); }; #endif // _WX_BRUSH_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/calctrl.h b/Externals/wxWidgets3/include/wx/msw/calctrl.h index c5c51d9fde..8fe57f7749 100644 --- a/Externals/wxWidgets3/include/wx/msw/calctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/calctrl.h @@ -91,7 +91,7 @@ private: wxUint32 m_holidays; - DECLARE_DYNAMIC_CLASS(wxCalendarCtrl) + wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrl); wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/checkbox.h b/Externals/wxWidgets3/include/wx/msw/checkbox.h index c1f0eff868..a79a21da22 100644 --- a/Externals/wxWidgets3/include/wx/msw/checkbox.h +++ b/Externals/wxWidgets3/include/wx/msw/checkbox.h @@ -11,8 +11,10 @@ #ifndef _WX_CHECKBOX_H_ #define _WX_CHECKBOX_H_ +#include "wx/msw/ownerdrawnbutton.h" + // Checkbox item (single checkbox) -class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase +class WXDLLIMPEXP_CORE wxCheckBox : public wxMSWOwnerDrawnButton { public: wxCheckBox() { } @@ -45,15 +47,10 @@ public: virtual bool MSWCommand(WXUINT param, WXWORD id); virtual void Command(wxCommandEvent& event); - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } - // make the checkbox owner drawn or reset it to normal style - void MSWMakeOwnerDrawn(bool ownerDrawn); - // implementation only from now on virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; @@ -63,31 +60,21 @@ protected: virtual void DoSet3StateValue(wxCheckBoxState value); virtual wxCheckBoxState DoGet3StateValue() const; - // return true if this checkbox is owner drawn - bool IsOwnerDrawn() const; + // Implement wxMSWOwnerDrawnButtonBase methods. + virtual int MSWGetButtonStyle() const wxOVERRIDE; + virtual void MSWOnButtonResetOwnerDrawn() wxOVERRIDE; + virtual int MSWGetButtonCheckedFlag() const wxOVERRIDE; + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) wxOVERRIDE; private: // common part of all ctors void Init(); - // event handlers used by owner-drawn checkbox - void OnMouseEnterOrLeave(wxMouseEvent& event); - void OnMouseLeft(wxMouseEvent& event); - void OnFocus(wxFocusEvent& event); - - // current state of the checkbox wxCheckBoxState m_state; - // true if the checkbox is currently pressed - bool m_isPressed; - - // true if mouse is currently over the control - bool m_isHot; - - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox); }; -#endif - // _WX_CHECKBOX_H_ +#endif // _WX_CHECKBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/checklst.h b/Externals/wxWidgets3/include/wx/msw/checklst.h index 21b8651ac0..9392f3e399 100644 --- a/Externals/wxWidgets3/include/wx/msw/checklst.h +++ b/Externals/wxWidgets3/include/wx/msw/checklst.h @@ -81,8 +81,8 @@ protected: wxSize DoGetBestClientSize() const; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox); }; #endif //_CHECKLST_H diff --git a/Externals/wxWidgets3/include/wx/msw/chkconf.h b/Externals/wxWidgets3/include/wx/msw/chkconf.h index 367f9e411e..656ef98017 100644 --- a/Externals/wxWidgets3/include/wx/msw/chkconf.h +++ b/Externals/wxWidgets3/include/wx/msw/chkconf.h @@ -22,6 +22,14 @@ # endif #endif /* !defined(wxUSE_ACTIVEX) */ +#ifndef wxUSE_WINRT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_WINRT must be defined." +# else +# define wxUSE_WINRT 0 +# endif +#endif /* !defined(wxUSE_ACTIVEX) */ + #ifndef wxUSE_CRASHREPORT # ifdef wxABORT_ON_CONFIG_ERROR # error "wxUSE_CRASHREPORT must be defined." @@ -86,13 +94,13 @@ # endif #endif /* wxUSE_TASKBARICON_BALLOONS */ -#ifndef wxUSE_UNICODE_MSLU -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_UNICODE_MSLU must be defined." -# else -# define wxUSE_UNICODE_MSLU 0 -# endif -#endif /* wxUSE_UNICODE_MSLU */ +#ifndef wxUSE_TASKBARBUTTON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_TASKBARBUTTON must be defined." +# else +# define wxUSE_TASKBARBUTTON 0 +# endif +#endif /* wxUSE_TASKBARBUTTON */ #ifndef wxUSE_UXTHEME # ifdef wxABORT_ON_CONFIG_ERROR @@ -103,15 +111,23 @@ #endif /* wxUSE_UXTHEME */ /* - * We don't want to give an error if wxUSE_UNICODE_MSLU is enabled but - * wxUSE_UNICODE is not as this would make it impossible to simply set the - * former in wx/setup.h as then the library wouldn't compile in non-Unicode - * configurations, so instead simply unset it silently when it doesn't make - * sense. + * Unfortunately we can't use compiler TLS support if the library can be used + * inside a dynamically loaded DLL under Windows XP, as this can result in hard + * to diagnose crashes due to the bugs in Windows TLS support, see #13116. + * + * So we disable it unless we can be certain that the code will never run under + * XP, as is the case if we're using a compiler which doesn't support XP such + * as MSVC 11+, unless it's used with the special "_xp" toolset, in which case + * _USING_V110_SDK71_ is defined. + * + * However defining wxUSE_COMPILER_TLS as 2 overrides this safety check, see + * the comments in wx/setup.h. */ -#if wxUSE_UNICODE_MSLU && !wxUSE_UNICODE -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 +#if wxUSE_COMPILER_TLS == 1 + #if !wxCHECK_VISUALC_VERSION(11) || defined(_USING_V110_SDK71_) + #undef wxUSE_COMPILER_TLS + #define wxUSE_COMPILER_TLS 0 + #endif #endif @@ -119,25 +135,6 @@ * disable the settings which don't work for some compilers */ -#ifndef wxUSE_NORLANDER_HEADERS -# if ( wxCHECK_WATCOM_VERSION(1,0) || defined(__WINE__) ) || \ - ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) -# define wxUSE_NORLANDER_HEADERS 1 -# else -# define wxUSE_NORLANDER_HEADERS 0 -# endif -#endif - -/* - * See WINVER definition in wx/msw/wrapwin.h for the explanation of this test - * logic. - */ -#if (defined(__VISUALC__) && (__VISUALC__ < 1300)) && \ - (!defined(WINVER) || WINVER < 0x0500) -# undef wxUSE_TASKBARICON_BALLOONS -# define wxUSE_TASKBARICON_BALLOONS 0 -#endif - /* * All of the settings below require SEH support (__try/__catch) and can't work * without it. @@ -175,27 +172,6 @@ #endif /* __GNUWIN32__ */ -/* wxUSE_MFC is not defined when using configure as it doesn't make sense for - gcc or mingw32 anyhow */ -#ifndef wxUSE_MFC - #define wxUSE_MFC 0 -#endif /* !defined(wxUSE_MFC) */ - -/* MFC duplicates these operators */ -#if wxUSE_MFC -# undef wxUSE_GLOBAL_MEMORY_OPERATORS -# define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -# undef wxUSE_DEBUG_NEW_ALWAYS -# define wxUSE_DEBUG_NEW_ALWAYS 0 -#endif /* wxUSE_MFC */ - -#if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) - /* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */ -# undef wxUSE_DRAG_AND_DROP -# define wxUSE_DRAG_AND_DROP 0 -#endif - #if !wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) # undef wxUSE_CHECKLISTBOX # define wxUSE_CHECKLISTBOX 0 @@ -212,17 +188,6 @@ # endif #endif -/* - Win64-specific checks. - */ -#ifdef __WIN64__ -# if wxUSE_STACKWALKER -# undef wxUSE_CRASHREPORT -# define wxUSE_CRASHREPORT 0 -# endif -#endif /* __WIN64__ */ - - /* Compiler-specific checks. */ @@ -244,19 +209,6 @@ #endif /* __BORLANDC__ */ -/* DMC++ doesn't have definitions for date picker control, so use generic control - */ -#ifdef __DMC__ -# if wxUSE_DATEPICKCTRL -# undef wxUSE_DATEPICKCTRL_GENERIC -# undef wxUSE_DATEPICKCTRL -# endif -# define wxUSE_DATEPICKCTRL 0 -# define wxUSE_DATEPICKCTRL_GENERIC 1 -#endif - - - /* un/redefine the options which we can't compile (after checking that they're defined @@ -266,13 +218,18 @@ # undef wxUSE_ACTIVEX # define wxUSE_ACTIVEX 0 # endif /* wxUSE_ACTIVEX */ - -# if wxUSE_UNICODE_MSLU -# undef wxUSE_UNICODE_MSLU -# define wxUSE_UNICODE_MSLU 0 -# endif /* wxUSE_UNICODE_MSLU */ #endif /* __WINE__ */ +/* + Currently wxUSE_GRAPHICS_CONTEXT is only enabled with MSVC by default, so + only check for wxUSE_ACTIVITYINDICATOR dependency on it if it can be + enabled, otherwise turn the latter off to allow the library to compile. + */ +#if !wxUSE_GRAPHICS_CONTEXT && !defined(_MSC_VER) +# undef wxUSE_ACTIVITYINDICATOR +# define wxUSE_ACTIVITYINDICATOR 0 +#endif /* !wxUSE_ACTIVITYINDICATOR && !_MSC_VER */ + /* check settings consistency for MSW-specific ones */ #if wxUSE_CRASHREPORT && !wxUSE_ON_FATAL_EXCEPTION @@ -304,6 +261,17 @@ # endif #endif /* !wxUSE_VARIANT */ +#if !wxUSE_DATAOBJ +# if wxUSE_OLE +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_OLE requires wxDataObject" +# else +# undef wxUSE_OLE +# define wxUSE_OLE 0 +# endif +# endif +#endif /* !wxUSE_DATAOBJ */ + #if !wxUSE_DYNAMIC_LOADER # if wxUSE_MS_HTML_HELP # ifdef wxABORT_ON_CONFIG_ERROR @@ -406,6 +374,15 @@ # endif #endif /* !wxUSE_ACTIVEX */ +#if wxUSE_ACTIVITYINDICATOR && !wxUSE_GRAPHICS_CONTEXT +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ACTIVITYINDICATOR requires wxGraphicsContext" +# else +# undef wxUSE_ACTIVITYINDICATOR +# define wxUSE_ACTIVITYINDICATOR 0 +# endif +#endif /* wxUSE_ACTIVITYINDICATOR */ + #if !wxUSE_THREADS # if wxUSE_FSWATCHER # ifdef wxABORT_ON_CONFIG_ERROR diff --git a/Externals/wxWidgets3/include/wx/msw/choice.h b/Externals/wxWidgets3/include/wx/msw/choice.h index a6c5703efc..2758409c57 100644 --- a/Externals/wxWidgets3/include/wx/msw/choice.h +++ b/Externals/wxWidgets3/include/wx/msw/choice.h @@ -139,10 +139,6 @@ protected: // set the height of the visible part of the control to m_heightOwn void MSWUpdateVisibleHeight(); - // Call GetComboBoxInfo() and return false if it's not supported by this - // system. Notice that the caller must initialize info.cbSize. - bool MSWGetComboBoxInfo(tagCOMBOBOXINFO* info) const; - // create and initialize the control bool CreateAndInit(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -174,7 +170,7 @@ protected: // wxDefaultCoord if it hadn't int m_heightOwn; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice); }; #endif // _WX_CHOICE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/clipbrd.h b/Externals/wxWidgets3/include/wx/msw/clipbrd.h index 53e8a169f9..51c94afe04 100644 --- a/Externals/wxWidgets3/include/wx/msw/clipbrd.h +++ b/Externals/wxWidgets3/include/wx/msw/clipbrd.h @@ -81,7 +81,7 @@ private: IDataObject *m_lastDataObject; bool m_isOpened; - DECLARE_DYNAMIC_CLASS(wxClipboard) + wxDECLARE_DYNAMIC_CLASS(wxClipboard); }; #endif // wxUSE_CLIPBOARD diff --git a/Externals/wxWidgets3/include/wx/msw/colordlg.h b/Externals/wxWidgets3/include/wx/msw/colordlg.h index 76c7a37c74..c59bf4f468 100644 --- a/Externals/wxWidgets3/include/wx/msw/colordlg.h +++ b/Externals/wxWidgets3/include/wx/msw/colordlg.h @@ -48,13 +48,11 @@ protected: // common part of all ctors void Init(); -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetSize(int *width, int *height) const; virtual void DoGetClientSize(int *width, int *height) const; virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoCentre(int dir); -#endif // !(__SMARTPHONE__ && __WXWINCE__) wxColourData m_colourData; wxString m_title; @@ -67,7 +65,7 @@ protected: bool m_movedWindow; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog); }; #endif // _WX_COLORDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/colour.h b/Externals/wxWidgets3/include/wx/msw/colour.h index 4b359fb370..07d72dc682 100644 --- a/Externals/wxWidgets3/include/wx/msw/colour.h +++ b/Externals/wxWidgets3/include/wx/msw/colour.h @@ -66,7 +66,7 @@ private: unsigned char m_alpha; private: - DECLARE_DYNAMIC_CLASS(wxColour) + wxDECLARE_DYNAMIC_CLASS(wxColour); }; #endif // _WX_COLOUR_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/combo.h b/Externals/wxWidgets3/include/wx/msw/combo.h index 50dc6eba4f..17053c151c 100644 --- a/Externals/wxWidgets3/include/wx/msw/combo.h +++ b/Externals/wxWidgets3/include/wx/msw/combo.h @@ -17,11 +17,9 @@ #if wxUSE_COMBOCTRL -#if !defined(__WXWINCE__) && wxUSE_TIMER +#if wxUSE_TIMER #include "wx/timer.h" #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 -#else - #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0 #endif @@ -100,15 +98,15 @@ private: #if wxUSE_COMBOCTRL_POPUP_ANIMATION // Popup animation related - wxLongLong m_animStart; + wxMilliClock_t m_animStart; wxTimer m_animTimer; wxRect m_animRect; int m_animFlags; #endif - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_DYNAMIC_CLASS(wxComboCtrl) + wxDECLARE_DYNAMIC_CLASS(wxComboCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/combobox.h b/Externals/wxWidgets3/include/wx/msw/combobox.h index 5fc7cc5cf1..c016fd3e17 100644 --- a/Externals/wxWidgets3/include/wx/msw/combobox.h +++ b/Externals/wxWidgets3/include/wx/msw/combobox.h @@ -126,6 +126,8 @@ public: virtual bool SetHint(const wxString& hint); #endif // wxUSE_UXTHEME + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + protected: #if wxUSE_TOOLTIPS virtual void DoSetToolTip(wxToolTip *tip); @@ -165,8 +167,8 @@ private: // normally true, false if text events are currently disabled bool m_allowTextEvents; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_COMBOBOX diff --git a/Externals/wxWidgets3/include/wx/msw/control.h b/Externals/wxWidgets3/include/wx/msw/control.h index 35bf74e9fe..aeaccf982f 100644 --- a/Externals/wxWidgets3/include/wx/msw/control.h +++ b/Externals/wxWidgets3/include/wx/msw/control.h @@ -76,12 +76,6 @@ protected: // return default best size (doesn't really make any sense, override this) virtual wxSize DoGetBestSize() const; - // This is a helper for all wxControls made with UPDOWN native control. - // In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in - // WinCE of Smartphones this happens also for native wxTextCtrl, - // wxChoice and others. - virtual wxSize GetBestSpinnerSize(const bool is_vertical) const; - // create the control of the given Windows class: this is typically called // from Create() method of the derived class passing its label, pos and // size parameter (style parameter is not needed because m_windowStyle is @@ -124,12 +118,13 @@ protected: // Look in our GetSubcontrols() for the windows with the given ID. virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const; + // for controls like radiobuttons which are really composite this array // holds the ids (not HWNDs!) of the sub controls wxArrayLong m_subControls; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxControl); }; #endif // _WX_CONTROL_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/ctrlsub.h b/Externals/wxWidgets3/include/wx/msw/ctrlsub.h index 068be29e58..e3d9d6e63a 100644 --- a/Externals/wxWidgets3/include/wx/msw/ctrlsub.h +++ b/Externals/wxWidgets3/include/wx/msw/ctrlsub.h @@ -34,7 +34,7 @@ protected: virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); } private: - DECLARE_ABSTRACT_CLASS(wxControlWithItems) + wxDECLARE_ABSTRACT_CLASS(wxControlWithItems); wxDECLARE_NO_COPY_CLASS(wxControlWithItems); }; diff --git a/Externals/wxWidgets3/include/wx/msw/cursor.h b/Externals/wxWidgets3/include/wx/msw/cursor.h index aef2e2a516..7ff2d45de2 100644 --- a/Externals/wxWidgets3/include/wx/msw/cursor.h +++ b/Externals/wxWidgets3/include/wx/msw/cursor.h @@ -11,12 +11,10 @@ #ifndef _WX_CURSOR_H_ #define _WX_CURSOR_H_ -#include "wx/msw/gdiimage.h" - class WXDLLIMPEXP_FWD_CORE wxImage; // Cursor -class WXDLLIMPEXP_CORE wxCursor : public wxGDIImage +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase { public: // constructors @@ -29,6 +27,9 @@ public: #if WXWIN_COMPATIBILITY_2_8 wxCursor(int id) { InitFromStock((wxStockCursor)id); } #endif + + virtual wxPoint GetHotSpot() const wxOVERRIDE; + virtual ~wxCursor(); // implementation only @@ -41,7 +42,7 @@ protected: virtual wxGDIImageRefData *CreateData() const; private: - DECLARE_DYNAMIC_CLASS(wxCursor) + wxDECLARE_DYNAMIC_CLASS(wxCursor); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/datectrl.h b/Externals/wxWidgets3/include/wx/msw/datectrl.h index 7ec52f0349..aeb3d30830 100644 --- a/Externals/wxWidgets3/include/wx/msw/datectrl.h +++ b/Externals/wxWidgets3/include/wx/msw/datectrl.h @@ -60,7 +60,10 @@ protected: virtual bool MSWAllowsNone() const { return HasFlag(wxDP_ALLOWNONE); } virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl) +private: + wxDateTime MSWGetControlValue() const; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl); }; #endif // _WX_MSW_DATECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/dc.h b/Externals/wxWidgets3/include/wx/msw/dc.h index 8ec5a94729..b4f603023c 100644 --- a/Externals/wxWidgets3/include/wx/msw/dc.h +++ b/Externals/wxWidgets3/include/wx/msw/dc.h @@ -213,7 +213,7 @@ public: double radius); virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); -#if wxUSE_SPLINES && !defined(__WXWINCE__) +#if wxUSE_SPLINES virtual void DoDrawSpline(const wxPointList *points); #endif @@ -323,7 +323,7 @@ protected: static wxObjectList sm_dcCache; #endif - DECLARE_CLASS(wxMSWDCImpl) + wxDECLARE_CLASS(wxMSWDCImpl); wxDECLARE_NO_COPY_CLASS(wxMSWDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dcclient.h b/Externals/wxWidgets3/include/wx/msw/dcclient.h index 9399e5c4be..10ac3ab571 100644 --- a/Externals/wxWidgets3/include/wx/msw/dcclient.h +++ b/Externals/wxWidgets3/include/wx/msw/dcclient.h @@ -40,7 +40,7 @@ protected: // initialize the newly created DC void InitDC(); - DECLARE_CLASS(wxWindowDCImpl) + wxDECLARE_CLASS(wxWindowDCImpl); wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); }; @@ -60,7 +60,7 @@ public: protected: void InitDC(); - DECLARE_CLASS(wxClientDCImpl) + wxDECLARE_CLASS(wxClientDCImpl); wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); }; @@ -85,7 +85,7 @@ protected: // Find the DC for this window in the cache, return NULL if not found. static wxPaintDCInfo *FindInCache(wxWindow* win); - DECLARE_CLASS(wxPaintDCImpl) + wxDECLARE_CLASS(wxPaintDCImpl); wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); }; @@ -100,7 +100,7 @@ class WXDLLIMPEXP_CORE wxPaintDCEx : public wxPaintDC public: wxPaintDCEx(wxWindow *canvas, WXHDC dc); - DECLARE_CLASS(wxPaintDCEx) + wxDECLARE_CLASS(wxPaintDCEx); wxDECLARE_NO_COPY_CLASS(wxPaintDCEx); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dcmemory.h b/Externals/wxWidgets3/include/wx/msw/dcmemory.h index 59fdbc11b9..8c57173974 100644 --- a/Externals/wxWidgets3/include/wx/msw/dcmemory.h +++ b/Externals/wxWidgets3/include/wx/msw/dcmemory.h @@ -36,7 +36,7 @@ protected: // initialize the newly created DC void Init(); - DECLARE_CLASS(wxMemoryDCImpl) + wxDECLARE_CLASS(wxMemoryDCImpl); wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dcprint.h b/Externals/wxWidgets3/include/wx/msw/dcprint.h index 85a60246dd..c3f223b512 100644 --- a/Externals/wxWidgets3/include/wx/msw/dcprint.h +++ b/Externals/wxWidgets3/include/wx/msw/dcprint.h @@ -56,7 +56,7 @@ protected: wxPrintData m_printData; private: - DECLARE_CLASS(wxPrinterDCImpl) + wxDECLARE_CLASS(wxPrinterDCImpl); wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dcscreen.h b/Externals/wxWidgets3/include/wx/msw/dcscreen.h index f85bbe2ff3..839b585ab1 100644 --- a/Externals/wxWidgets3/include/wx/msw/dcscreen.h +++ b/Externals/wxWidgets3/include/wx/msw/dcscreen.h @@ -25,7 +25,7 @@ public: GetDeviceSize(w, h); } - DECLARE_CLASS(wxScreenDCImpl) + wxDECLARE_CLASS(wxScreenDCImpl); wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dde.h b/Externals/wxWidgets3/include/wx/msw/dde.h index 558f66c40e..cc3da0a1c3 100644 --- a/Externals/wxWidgets3/include/wx/msw/dde.h +++ b/Externals/wxWidgets3/include/wx/msw/dde.h @@ -73,7 +73,7 @@ public: wxIPCFormat m_dataType; wxDECLARE_NO_COPY_CLASS(wxDDEConnection); - DECLARE_DYNAMIC_CLASS(wxDDEConnection) + wxDECLARE_DYNAMIC_CLASS(wxDDEConnection); }; class WXDLLIMPEXP_BASE wxDDEServer : public wxServerBase @@ -98,7 +98,7 @@ protected: wxString m_serviceName; wxDDEConnectionList m_connections; - DECLARE_DYNAMIC_CLASS(wxDDEServer) + wxDECLARE_DYNAMIC_CLASS(wxDDEServer); }; class WXDLLIMPEXP_BASE wxDDEClient: public wxClientBase @@ -128,7 +128,7 @@ protected: int m_lastError; wxDDEConnectionList m_connections; - DECLARE_DYNAMIC_CLASS(wxDDEClient) + wxDECLARE_DYNAMIC_CLASS(wxDDEClient); }; void WXDLLIMPEXP_BASE wxDDEInitialize(); diff --git a/Externals/wxWidgets3/include/wx/msw/debughlp.h b/Externals/wxWidgets3/include/wx/msw/debughlp.h index 715814d0ae..b224c19a23 100644 --- a/Externals/wxWidgets3/include/wx/msw/debughlp.h +++ b/Externals/wxWidgets3/include/wx/msw/debughlp.h @@ -1,8 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // Name: wx/msw/debughlp.h // Purpose: wraps dbghelp.h standard file -// Author: Vadim Zeitlin -// Modified by: +// Author: Vadim Zeitlin, Suzumizaki-kimitaka // Created: 2005-01-08 (extracted from msw/crashrpt.cpp) // Copyright: (c) 2003-2005 Vadim Zeitlin // Licence: wxWindows licence @@ -14,27 +13,37 @@ #include "wx/dynlib.h" #include "wx/msw/wrapwin.h" -#ifndef __WXWINCE__ -#include -#endif // __WXWINCE__ -#include "wx/msw/private.h" -// All known versions of imagehlp.h define API_VERSION_NUMBER but it's not -// documented, so deal with the possibility that it's not defined just in case. -#ifndef API_VERSION_NUMBER - #define API_VERSION_NUMBER 0 +#ifdef __VISUALC__ + // Disable a warning that we can do nothing about: we get it at least for + // imagehlp.h from 8.1 Windows kit when using VC14. + #pragma warning(push) + + // 'typedef ': ignored on left of '' when no variable is declared + #pragma warning(disable:4091) #endif -// wxUSE_DBGHELP is a bit special as it is not defined in wx/setup.h and we try -// to auto-detect whether we should be using debug help API or not ourselves -// below. However if the auto-detection fails, you can always predefine it as 0 -// to avoid even trying. +#include + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + +#include "wx/msw/private.h" + +// wxUSE_DBGHELP can be predefined on the compiler command line to force using +// dbghelp.dll even if it's not detected or, on the contrary, avoid using even +// if it's available. #ifndef wxUSE_DBGHELP - // The version of imagehlp.h from VC6 (7) is too old and is missing some - // required symbols while the version from VC7 (9) is good enough. As we - // don't know anything about version 8, don't use it unless we can test it. - #if API_VERSION_NUMBER >= 9 - #define wxUSE_DBGHELP 1 + // The only compiler which is known to have the necessary headers is MSVC. + #ifdef __VISUALC__ + // MSVC7.1 shipped with API v9 and we don't support anything earlier + // anyhow. + #if API_VERSION_NUMBER >= 9 + #define wxUSE_DBGHELP 1 + #else + #define wxUSE_DBGHELP 0 + #endif #else #define wxUSE_DBGHELP 0 #endif @@ -42,6 +51,117 @@ #if wxUSE_DBGHELP +/* + +The table below shows which functions are exported by dbghelp.dll. + +On 64 bit Windows, there seems to be no difference between 32bit dll and 64bit +one. Vista-64 and Win8-64 look the same, but "Ex" and "ExW" versions exist only +in Windows 8. + +Note that SymGetLineFromAddrW and EnumerateLoadedModulesW DON'T exist at all. + +function | Windows | XP-32 Vista-64 Win8-64 +SymEnumSymbolsW n/a v v +SymFromAddrW n/a v v +SymInitializeW n/a v v + +SymEnumSymbols v v v +SymFromAddr v v v +SymInitialize v v v + +SymGetLineFromAddrW64 n/a v v +SymGetLineFromAddr64 v v v +SymGetLineFromAddrW n/a n/a n/a +SymGetLineFromAddr v v v + +EnumerateLoadedModulesW64 n/a v v +EnumerateLoadedModules64 v v v +EnumerateLoadedModulesW n/a n/a n/a +EnumerateLoadedModules v v v + +*/ + +// It's not really clear whether API v10 is used by anything as VC8 still used +// v9, just as MSVC7.1, while VC9 already used v11, but provide support for it +// just in case. +#if API_VERSION_NUMBER < 10/*{{{*/ + +typedef BOOL +(CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PWSTR ModuleName, + DWORD64 ModuleBase, + ULONG ModuleSize, + PVOID UserContext); + +typedef struct _IMAGEHLP_LINEW64 +{ + DWORD SizeOfStruct; + PVOID Key; + DWORD LineNumber; + PWSTR FileName; + DWORD64 Address; +} IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64; + +typedef struct _SYMBOL_INFOW +{ + ULONG SizeOfStruct; + ULONG TypeIndex; + ULONG64 Reserved[2]; + ULONG Index; + ULONG Size; + ULONG64 ModBase; + ULONG Flags; + ULONG64 Value; + ULONG64 Address; + ULONG Register; + ULONG Scope; + ULONG Tag; + ULONG NameLen; + ULONG MaxNameLen; + WCHAR Name[1]; +} SYMBOL_INFOW, *PSYMBOL_INFOW; + +typedef BOOL +(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW pSymInfo, + ULONG SymbolSize, + PVOID UserContext); + +typedef BOOL +(CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext); + +#endif // API_VERSION_NUMBER < 10/*}}}*/ + +// wx-prefixed types map to either the ANSI or Unicode ("W") version depending +// on the build of wx itself. +#ifdef UNICODE + #define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACKW +#else // !UNICODE + #define wxPSYM_ENUMERATESYMBOLS_CALLBACK PSYM_ENUMERATESYMBOLS_CALLBACK +#endif // UNICODE/!UNICODE + +// This one could be already defined by wx/msw/stackwalk.h +#ifndef wxSYMBOL_INFO + #ifdef UNICODE + #define wxSYMBOL_INFO SYMBOL_INFOW + #else // !UNICODE + #define wxSYMBOL_INFO SYMBOL_INFO + #endif // UNICODE/!UNICODE +#endif // !defined(wxSYMBOL_INFO) + +typedef wxSYMBOL_INFO* wxPSYMBOL_INFO; + +// This differs from PENUMLOADED_MODULES_CALLBACK[W]64 in that it always uses +// "const" for its first argument when the SDK used to pass a non-const string +// here until API_VERSION_NUMBER==11, so we can't just define it as an existing +// typedef. +typedef BOOL +(CALLBACK *wxPENUMLOADED_MODULES_CALLBACK)(const wxChar* moduleName, + DWORD64 moduleBase, + ULONG moduleSize, + void *userContext); + // ---------------------------------------------------------------------------- // wxDbgHelpDLL: dynamically load dbghelp.dll functions // ---------------------------------------------------------------------------- @@ -141,31 +261,61 @@ public: // function types typedef DWORD (WINAPI *SymGetOptions_t)(); typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); - typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL); + typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPCSTR, BOOL); + typedef BOOL (WINAPI *SymInitializeW_t)(HANDLE, LPCWSTR, BOOL); typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE); typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); + typedef BOOL (WINAPI *SymFromAddrW_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFOW); 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, + typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE); + typedef BOOL (WINAPI *SymGetLineFromAddr64_t)(HANDLE, DWORD64, + PDWORD, PIMAGEHLP_LINE64); + typedef BOOL (WINAPI *SymGetLineFromAddrW64_t)(HANDLE, DWORD64, + PDWORD, PIMAGEHLP_LINEW64); typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT); typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, - PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); + PSYM_ENUMERATESYMBOLS_CALLBACK, + const PVOID); + typedef BOOL (WINAPI *SymEnumSymbolsW_t)(HANDLE, ULONG64, PCWSTR, + PSYM_ENUMERATESYMBOLS_CALLBACKW, + const PVOID); typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); typedef BOOL (WINAPI *SymCleanup_t)(HANDLE); typedef BOOL (WINAPI *EnumerateLoadedModules_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID); + typedef BOOL (WINAPI *EnumerateLoadedModules64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID); + typedef BOOL (WINAPI *EnumerateLoadedModulesW64_t)(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID); typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, CONST PMINIDUMP_EXCEPTION_INFORMATION, CONST PMINIDUMP_USER_STREAM_INFORMATION, CONST PMINIDUMP_CALLBACK_INFORMATION); + // Higher level functions selecting the right debug help library function + // to call: for CallFoo(), it can be Foo(), Foo64(), FooW() or FooW64() + // depending on the build options and function availability. + // + // They also provide more convenient to use wx-specific API, e.g. work with + // wxString instead of char/wchar_t pointers and omit the arguments we + // don't need. + static BOOL CallSymInitialize(HANDLE, BOOL); + static BOOL CallEnumerateLoadedModules(HANDLE, wxPENUMLOADED_MODULES_CALLBACK, PVOID); + static BOOL CallSymFromAddr(HANDLE, DWORD64, + size_t* offset, wxString* name); + static BOOL CallSymGetLineFromAddr(HANDLE, DWORD64, + wxString* fileName, size_t* line); + static BOOL CallSymEnumSymbols(HANDLE hProcess, + ULONG64 baseOfDll, + wxPSYM_ENUMERATESYMBOLS_CALLBACK callback, + const PVOID callbackParam); + // 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" @@ -186,26 +336,56 @@ public: #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); \ + #define wxSYM_CALL_ALWAYS_W(what, name) what(name ## W, name ## W) + + #define wxSYM_CALL_ALTERNATIVES(what, name) \ + what(name, name); \ + what(name ## 64, name ## 64); \ + what(name ## W64, name ## W64) + + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what) \ + wxSYM_CALL_64(what, StackWalk); \ + wxSYM_CALL_64(what, SymFunctionTableAccess); \ + wxSYM_CALL_64(what, SymGetModuleBase); \ + \ + wxSYM_CALL(what, SymGetOptions); \ + wxSYM_CALL(what, SymSetOptions); \ + wxSYM_CALL(what, SymSetContext); \ + wxSYM_CALL(what, SymGetTypeInfo); \ + wxSYM_CALL(what, SymCleanup); \ wxSYM_CALL(what, MiniDumpWriteDump) + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what) \ + wxSYM_CALL(what, SymInitialize); \ + wxSYM_CALL(what, SymFromAddr); \ + wxSYM_CALL(what, SymEnumSymbols) + + #define wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what) \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(what); \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(what) + + // Alternation will work when the following functions are not found, + // therefore they are not included in REQUIRED version. + #define wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what) \ + wxSYM_CALL_ALTERNATIVES(what, SymGetLineFromAddr); \ + wxSYM_CALL_ALTERNATIVES(what, EnumerateLoadedModules); \ + wxSYM_CALL_ALWAYS_W(what, SymInitialize); \ + wxSYM_CALL_ALWAYS_W(what, SymFromAddr); \ + wxSYM_CALL_ALWAYS_W(what, SymEnumSymbols) + + #define wxDO_FOR_ALL_SYM_FUNCS(what) \ + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(what); \ + wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(what) + #define wxDECLARE_SYM_FUNCTION(func, name) static func ## _t func - wxDO_FOR_ALL_SYM_FUNCS(wxDECLARE_SYM_FUNCTION); + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PUBLIC(wxDECLARE_SYM_FUNCTION); + +private: + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED_PRIVATE(wxDECLARE_SYM_FUNCTION); + wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(wxDECLARE_SYM_FUNCTION); + +public: #undef wxDECLARE_SYM_FUNCTION @@ -219,10 +399,10 @@ public: static void LogError(const wxChar *func); // return textual representation of the value of given symbol - static wxString DumpSymbol(PSYMBOL_INFO pSymInfo, void *pVariable); + static wxString DumpSymbol(wxPSYMBOL_INFO pSymInfo, void *pVariable); // return the name of the symbol with given type index - static wxString GetSymbolName(PSYMBOL_INFO pSymInfo); + static wxString GetSymbolName(wxPSYMBOL_INFO pSymInfo); private: // dereference the given symbol, i.e. return symbol which is not a @@ -232,17 +412,20 @@ private: // dereferenced the symbol // // return the tag of the dereferenced symbol - static SymbolTag DereferenceSymbol(PSYMBOL_INFO pSymInfo, void **ppData); + static SymbolTag DereferenceSymbol(wxPSYMBOL_INFO pSymInfo, void **ppData); - static wxString DumpField(PSYMBOL_INFO pSymInfo, + static wxString DumpField(wxPSYMBOL_INFO pSymInfo, void *pVariable, unsigned level); static wxString DumpBaseType(BasicType bt, DWORD64 length, void *pVariable); - static wxString DumpUDT(PSYMBOL_INFO pSymInfo, + static wxString DumpUDT(wxPSYMBOL_INFO pSymInfo, void *pVariable, unsigned level = 0); + + static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp); + static bool DoInit(); }; #endif // wxUSE_DBGHELP diff --git a/Externals/wxWidgets3/include/wx/msw/dialog.h b/Externals/wxWidgets3/include/wx/msw/dialog.h index 5e6157426a..03f2ebad33 100644 --- a/Externals/wxWidgets3/include/wx/msw/dialog.h +++ b/Externals/wxWidgets3/include/wx/msw/dialog.h @@ -13,24 +13,10 @@ #include "wx/panel.h" -// 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 resizable and never show resize gripper anyhow so don't use it there -#ifdef __WXWINCE__ - #define wxUSE_DIALOG_SIZEGRIP 0 -#else - #define wxUSE_DIALOG_SIZEGRIP 1 -#endif - extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; class WXDLLIMPEXP_FWD_CORE wxDialogModalData; -#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) -class WXDLLIMPEXP_FWD_CORE wxToolBar; -extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; -#endif - // Dialog boxes class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase { @@ -69,39 +55,12 @@ public: virtual void EndModal(int retCode); - // we treat dialog toolbars specially under Windows CE -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - // create main toolbar by calling OnCreateToolBar() - virtual wxToolBar* CreateToolBar(long style = -1, - wxWindowID winid = wxID_ANY, - const wxString& name = wxToolBarNameStr); - // return a new toolbar - virtual wxToolBar *OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name ); - - // get the main toolbar - wxToolBar *GetToolBar() const { return m_dialogToolBar; } -#endif // wxUSE_TOOLBAR && __POCKETPC__ - - // implementation only from now on // ------------------------------- // override some base class virtuals virtual bool Show(bool show = true); - -#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 - // can be overridden, or you can change the id used for - // sending the event with SetAffirmativeId. Returns false - // if the event was not processed. - virtual bool DoOK(); -#endif // Windows callbacks WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); @@ -111,7 +70,6 @@ protected: void Init(); private: -#if wxUSE_DIALOG_SIZEGRIP // these functions deal with the gripper window shown in the corner of // resizable dialogs void CreateGripper(); @@ -125,16 +83,11 @@ private: // gripper window for a resizable dialog, NULL if we're not resizable WXHWND m_hGripper; -#endif // wxUSE_DIALOG_SIZEGRIP - -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - wxToolBar* m_dialogToolBar; -#endif // this pointer is non-NULL only while the modal event loop is running wxDialogModalData *m_modalData; - DECLARE_DYNAMIC_CLASS(wxDialog) + wxDECLARE_DYNAMIC_CLASS(wxDialog); wxDECLARE_NO_COPY_CLASS(wxDialog); }; diff --git a/Externals/wxWidgets3/include/wx/msw/dib.h b/Externals/wxWidgets3/include/wx/msw/dib.h index 28663c35fa..6fb4c3eca3 100644 --- a/Externals/wxWidgets3/include/wx/msw/dib.h +++ b/Externals/wxWidgets3/include/wx/msw/dib.h @@ -70,21 +70,19 @@ public: // operations // ---------- -#ifndef __WXWINCE__ // create a bitmap compatible with the given HDC (or screen by default) and // return its handle, the caller is responsible for freeing it (using // DeleteObject()) HBITMAP CreateDDB(HDC hdc = 0) const; -#endif // !__WXWINCE__ // get the handle from the DIB and reset it, i.e. this object won't destroy // the DIB after this (but the caller should do it) HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } -#if wxUSE_PALETTE +#if defined(__WXMSW__) && wxUSE_PALETTE // create a palette for this DIB (always a trivial/default one for 24bpp) wxPalette *CreatePalette() const; -#endif // wxUSE_PALETTE +#endif // defined(__WXMSW__) && wxUSE_PALETTE // save the DIB as a .BMP file to the file with the given name bool Save(const wxString& filename); @@ -119,7 +117,6 @@ public: // these functions are only used by wxWidgets internally right now, please // don't use them directly if possible as they're subject to change -#ifndef __WXWINCE__ // creates a DDB compatible with the given (or screen) DC from either // a plain DIB or a DIB section (in which case the last parameter must be // non NULL) @@ -137,7 +134,6 @@ public: // function (this overload is needed for wxBitmapDataObject code in // src/msw/ole/dataobj.cpp) static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); -#endif // __WXWINCE__ // wxImage conversion @@ -168,7 +164,18 @@ public: bool Create(const wxImage& image, PixelFormat pf = PixelFormat_PreMultiplied); // create wxImage having the same data as this DIB - wxImage ConvertToImage() const; + + // Possible options of conversion to wxImage + enum ConversionFlags + { + // Determine whether 32bpp DIB contains real alpha channel + // and return wxImage with or without alpha channel values. + Convert_AlphaAuto, + // Assume that 32bpp DIB contains valid alpha channel and always + // return wxImage with alpha channel values in this case. + Convert_AlphaAlwaysIf32bpp + }; + wxImage ConvertToImage(ConversionFlags flags = Convert_AlphaAuto) const; #endif // wxUSE_IMAGE diff --git a/Externals/wxWidgets3/include/wx/msw/dirdlg.h b/Externals/wxWidgets3/include/wx/msw/dirdlg.h index b6939581ee..365d97fea5 100644 --- a/Externals/wxWidgets3/include/wx/msw/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/dirdlg.h @@ -32,7 +32,7 @@ private: int ShowSHBrowseForFolder(WXHWND owner); int ShowIFileDialog(WXHWND owner); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/dragimag.h b/Externals/wxWidgets3/include/wx/msw/dragimag.h index e08723511a..28671c070a 100644 --- a/Externals/wxWidgets3/include/wx/msw/dragimag.h +++ b/Externals/wxWidgets3/include/wx/msw/dragimag.h @@ -235,7 +235,7 @@ protected: bool m_fullScreen; private: - DECLARE_DYNAMIC_CLASS(wxDragImage) + wxDECLARE_DYNAMIC_CLASS(wxDragImage); wxDECLARE_NO_COPY_CLASS(wxDragImage); }; diff --git a/Externals/wxWidgets3/include/wx/msw/enhmeta.h b/Externals/wxWidgets3/include/wx/msw/enhmeta.h index 3951bd7f5a..b3ae3bb4c6 100644 --- a/Externals/wxWidgets3/include/wx/msw/enhmeta.h +++ b/Externals/wxWidgets3/include/wx/msw/enhmeta.h @@ -52,13 +52,21 @@ public: // this method bool SetClipboard(int width = 0, int height = 0); + // Detach the HENHMETAFILE from this object, i.e. don't delete the handle + // in the dtor -- the caller is now responsible for doing this, e.g. using + // Free() method below. + WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = 0; return h; } + + // Destroy the given HENHMETAFILE object. + static void Free(WXHANDLE handle); + // implementation WXHANDLE GetHENHMETAFILE() const { return m_hMF; } void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } protected: void Init(); - void Free(); + void Free() { Free(m_hMF); } void Assign(const wxEnhMetaFile& mf); // we don't use these functions (but probably should) but have to implement @@ -70,7 +78,7 @@ private: wxString m_filename; WXHANDLE m_hMF; - DECLARE_DYNAMIC_CLASS(wxEnhMetaFile) + wxDECLARE_DYNAMIC_CLASS(wxEnhMetaFile); }; // ---------------------------------------------------------------------------- @@ -98,7 +106,7 @@ public: wxEnhMetaFile *Close(); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC); }; #if wxUSE_DRAG_AND_DROP diff --git a/Externals/wxWidgets3/include/wx/msw/evtloop.h b/Externals/wxWidgets3/include/wx/msw/evtloop.h index dee2c03db3..be8f597726 100644 --- a/Externals/wxWidgets3/include/wx/msw/evtloop.h +++ b/Externals/wxWidgets3/include/wx/msw/evtloop.h @@ -53,11 +53,10 @@ public: // override/implement base class virtuals virtual bool Dispatch(); virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool YieldFor(long eventsToProcess); protected: virtual void OnNextIteration(); + virtual void DoYieldFor(long eventsToProcess); private: // check if the given window is a child of ms_winCritical (which must be diff --git a/Externals/wxWidgets3/include/wx/msw/evtloopconsole.h b/Externals/wxWidgets3/include/wx/msw/evtloopconsole.h index 36da6f640a..a4eb6d54ac 100644 --- a/Externals/wxWidgets3/include/wx/msw/evtloopconsole.h +++ b/Externals/wxWidgets3/include/wx/msw/evtloopconsole.h @@ -15,9 +15,20 @@ class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual { public: wxMSWEventLoopBase(); + virtual ~wxMSWEventLoopBase(); // implement base class pure virtuals virtual bool Pending() const; + virtual void WakeUp(); + +#if wxUSE_THREADS + // MSW-specific method to wait for the termination of the specified (by its + // native handle) thread or any input message arriving (in GUI case). + // + // Return value is WAIT_OBJECT_0 if the thread terminated, WAIT_OBJECT_0+1 + // if a message arrived with anything else indicating an error. + WXDWORD MSWWaitForThread(WXHANDLE hThread); +#endif // wxUSE_THREADS protected: // get the next message from queue and return true or return false if we @@ -25,8 +36,13 @@ protected: bool GetNextMessage(WXMSG *msg); // same as above but with a timeout and return value can be -1 meaning that - // time out expired in addition to + // time out expired in addition to true/false int GetNextMessageTimeout(WXMSG *msg, unsigned long timeout); + +private: + // An auto-reset Win32 event which is signalled when we need to wake up the + // main thread waiting in GetNextMessage[Timeout](). + WXHANDLE m_heventWake; }; #if wxUSE_CONSOLE_EVENTLOOP @@ -39,11 +55,12 @@ public: // override/implement base class virtuals virtual bool Dispatch(); virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; } // Windows-specific function to process a single message virtual void ProcessMessage(WXMSG *msg); + +protected: + virtual void DoYieldFor(long eventsToProcess); }; #endif // wxUSE_CONSOLE_EVENTLOOP diff --git a/Externals/wxWidgets3/include/wx/msw/fdrepdlg.h b/Externals/wxWidgets3/include/wx/msw/fdrepdlg.h index af4de0d207..ac7ba48858 100644 --- a/Externals/wxWidgets3/include/wx/msw/fdrepdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/fdrepdlg.h @@ -54,7 +54,7 @@ protected: wxFindReplaceDialogImpl *m_impl; - DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) + wxDECLARE_DYNAMIC_CLASS(wxFindReplaceDialog); wxDECLARE_NO_COPY_CLASS(wxFindReplaceDialog); }; diff --git a/Externals/wxWidgets3/include/wx/msw/filedlg.h b/Externals/wxWidgets3/include/wx/msw/filedlg.h index a1958bace7..c3259f7f75 100644 --- a/Externals/wxWidgets3/include/wx/msw/filedlg.h +++ b/Externals/wxWidgets3/include/wx/msw/filedlg.h @@ -30,10 +30,8 @@ public: virtual void GetPaths(wxArrayString& paths) const; virtual void GetFilenames(wxArrayString& files) const; -#ifndef __WXWINCE__ virtual bool SupportsExtraControl() const { return true; } void MSWOnInitDialogHook(WXHWND hwnd); -#endif // __WXWINCE__ virtual int ShowModal(); @@ -48,12 +46,10 @@ public: protected: -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoCentre(int dir); virtual void DoGetSize( int *width, int *height ) const; virtual void DoGetPosition( int *x, int *y ) const; -#endif // !(__SMARTPHONE__ && __WXWINCE__) private: wxArrayString m_fileNames; @@ -63,7 +59,7 @@ private: bool m_bMovedWindow; int m_centreDir; // nothing to do if 0 - DECLARE_DYNAMIC_CLASS(wxFileDialog) + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); wxDECLARE_NO_COPY_CLASS(wxFileDialog); }; diff --git a/Externals/wxWidgets3/include/wx/msw/font.h b/Externals/wxWidgets3/include/wx/msw/font.h index 275c6d9962..e46a62ca6e 100644 --- a/Externals/wxWidgets3/include/wx/msw/font.h +++ b/Externals/wxWidgets3/include/wx/msw/font.h @@ -25,19 +25,6 @@ public: wxFont(const wxFontInfo& info); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif - wxFont(int size, wxFontFamily family, wxFontStyle style, @@ -61,20 +48,6 @@ public: weight, underlined, face, encoding); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(const wxSize& pixelSize, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, - underlined, face, encoding); - } -#endif - wxFont(const wxSize& pixelSize, wxFontFamily family, wxFontStyle style, @@ -137,6 +110,31 @@ public: virtual bool IsFixedWidth() const; + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } + + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD") + wxFont(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, + underlined, face, encoding); + } + // implementation only from now on // ------------------------------- @@ -168,7 +166,7 @@ protected: virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxFont) + wxDECLARE_DYNAMIC_CLASS(wxFont); }; #endif // _WX_FONT_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/fontdlg.h b/Externals/wxWidgets3/include/wx/msw/fontdlg.h index ea7e7ef7e8..9e5d1f66c7 100644 --- a/Externals/wxWidgets3/include/wx/msw/fontdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/fontdlg.h @@ -26,20 +26,9 @@ public: virtual int ShowModal(); -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use - wxDEPRECATED( wxFontDialog(wxWindow *parent, const wxFontData *data) ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog); }; -#if WXWIN_COMPATIBILITY_2_6 - // deprecated interface, don't use -inline wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData *data) - : wxFontDialogBase(parent) { InitFontData(data); Create(parent); } -#endif // WXWIN_COMPATIBILITY_2_6 - #endif // _WX_MSW_FONTDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/frame.h b/Externals/wxWidgets3/include/wx/msw/frame.h index 54ad3beec4..6cc4ae1279 100644 --- a/Externals/wxWidgets3/include/wx/msw/frame.h +++ b/Externals/wxWidgets3/include/wx/msw/frame.h @@ -11,6 +11,10 @@ #ifndef _WX_FRAME_H_ #define _WX_FRAME_H_ +#if wxUSE_TASKBARBUTTON +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; +#endif + class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase { public: @@ -36,7 +40,6 @@ public: const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - virtual ~wxFrame(); // implement base class pure virtuals @@ -104,10 +107,22 @@ public: // normal frames but is overridden by wxMDIParentFrame virtual WXHMENU MSWGetActiveMenu() const { return m_hMenu; } + virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); + virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu); + // Look up the menu in the menu bar. virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); #endif // wxUSE_MENUS +#if wxUSE_TASKBARBUTTON + // Return the taskbar button of the window. + // + // 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 the initialization of taskbar button failed. + wxTaskBarButton* MSWGetTaskBarButton(); +#endif // wxUSE_TASKBARBUTTON + protected: // common part of all ctors void Init(); @@ -150,6 +165,10 @@ protected: #if wxUSE_MENUS // frame menu, NULL if none WXHMENU m_hMenu; + + // The number of currently opened menus: 0 initially, 1 when a top level + // menu is opened, 2 when its submenu is opened and so on. + int m_menuDepth; #endif // wxUSE_MENUS private: @@ -160,8 +179,12 @@ private: // used by IconizeChildFrames(), see comments there bool m_wasMinimized; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) +#if wxUSE_TASKBARBUTTON + wxTaskBarButton* m_taskBarButton; +#endif + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/gauge.h b/Externals/wxWidgets3/include/wx/msw/gauge.h index ac820e99b7..4f54f34e08 100644 --- a/Externals/wxWidgets3/include/wx/msw/gauge.h +++ b/Externals/wxWidgets3/include/wx/msw/gauge.h @@ -33,6 +33,8 @@ public: (void)Create(parent, id, range, pos, size, style, validator, name); } + virtual ~wxGauge(); + bool Create(wxWindow *parent, wxWindowID id, int range, @@ -69,7 +71,7 @@ private: void SetIndeterminateMode(); void SetDeterminateMode(); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge); }; #endif // wxUSE_GAUGE diff --git a/Externals/wxWidgets3/include/wx/msw/gccpriv.h b/Externals/wxWidgets3/include/wx/msw/gccpriv.h index 31453015b2..b12efa9b2c 100644 --- a/Externals/wxWidgets3/include/wx/msw/gccpriv.h +++ b/Externals/wxWidgets3/include/wx/msw/gccpriv.h @@ -17,8 +17,51 @@ #define __GNUWIN32__ #endif -#if defined(__MINGW32__) && ( ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) ) +#if defined(__MINGW32__) + /* + Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION but check + that UNICODE or _UNICODE is already defined, as _mingw.h relies on them + being set and we'd get weird compilation errors later if it is included + without them being defined, better give a clearer error right now. + */ + #if !defined(UNICODE) + #ifndef wxUSE_UNICODE + #error "wxUSE_UNICODE must be defined before including this header." + #endif + #if wxUSE_UNICODE + #error "UNICODE must be defined before including this header." + #endif + #endif + #include <_mingw.h> + + /* + MinGW-w64 project provides compilers for both Win32 and Win64 but only + defines the same __MINGW32__ symbol for the former as MinGW32 toolchain + which is quite different (notably doesn't provide many SDK headers that + MinGW-w64 does include). So we define a separate symbol which, unlike + the predefined __MINGW64__, can be used to detect this toolchain in + both 32 and 64 bit builds. + + And define __MINGW32_TOOLCHAIN__ for consistency and also because it's + convenient as we often want to have some workarounds only for the (old) + MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__. + */ + #ifdef __MINGW64_VERSION_MAJOR + #ifndef __MINGW64_TOOLCHAIN__ + #define __MINGW64_TOOLCHAIN__ + #endif + #else + #ifndef __MINGW32_TOOLCHAIN__ + #define __MINGW32_TOOLCHAIN__ + #endif + #endif + + #define wxCHECK_MINGW32_VERSION( major, minor ) \ + ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \ + || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_MINGW32_VERSION( major, minor ) (0) #endif #if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H ) @@ -31,16 +74,11 @@ #endif #endif -#if wxCHECK_WATCOM_VERSION(1,0) - #define HAVE_W32API_H -#endif - /* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ #if defined( HAVE_W32API_H ) #include #endif -/* Watcom can't handle defined(xxx) here: */ #if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) #define wxCHECK_W32API_VERSION( major, minor ) \ ( ( ( __W32API_MAJOR_VERSION > (major) ) \ @@ -49,25 +87,6 @@ #define wxCHECK_W32API_VERSION( major, minor ) (0) #endif -/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which - are more ms-like (header author is Anders Norlander, hence the name) */ -#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95))) - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 1 - #endif -#else - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 0 - #endif -#endif - -/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the - standard Win32 headers and we define the used stuff ourselves for it - in wx/msw/gnuwin32/extra.h */ -#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS - #define __GNUWIN32_OLD__ -#endif - /* Cygwin 1.0 */ #if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) #define __CYGWIN10__ @@ -113,5 +132,37 @@ #endif #endif +/* + Traditional MinGW (but not MinGW-w64 nor TDM-GCC) omits many POSIX + functions from their headers when compiled with __STRICT_ANSI__ defined. + Unfortunately this means that they are not available when using -std=c++98 + (not very common) or -std=c++11 (much more so), but we still need them even + in this case. As the intention behind using -std=c++11 is probably to get + the new C++11 features and not disable the use of POSIX functions, we just + manually declare the functions we need in this case if necessary. + */ +#if defined(__MINGW32_TOOLCHAIN__) && defined(__STRICT_ANSI__) + #define wxNEEDS_STRICT_ANSI_WORKAROUNDS + + /* + This macro is somewhat unusual as it takes the list of parameters + inside parentheses and includes semicolon inside it as putting the + semicolon outside wouldn't do the right thing when this macro is empty. + */ + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \ + extern "C" _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ; + + /* + There is a bug resulting in a compilation error in MinGW standard + math.h header, see https://sourceforge.net/p/mingw/bugs/2250/, work + around it here because math.h is also included from several other + standard headers (e.g. ) and we don't want to duplicate this + hack everywhere this happens. + */ + wxDECL_FOR_STRICT_MINGW32(double, _hypot, (double, double)) +#else + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) +#endif + #endif /* _WX_MSW_GCCPRIV_H_ */ diff --git a/Externals/wxWidgets3/include/wx/msw/gdiimage.h b/Externals/wxWidgets3/include/wx/msw/gdiimage.h index d085e50a4a..18ebbb8f20 100644 --- a/Externals/wxWidgets3/include/wx/msw/gdiimage.h +++ b/Externals/wxWidgets3/include/wx/msw/gdiimage.h @@ -54,7 +54,7 @@ public: void SetSize(int w, int h) { m_width = w; m_height = h; } - // free the ressources we allocated + // free the resources we allocated virtual void Free() = 0; // for compatibility, the member fields are public diff --git a/Externals/wxWidgets3/include/wx/msw/glcanvas.h b/Externals/wxWidgets3/include/wx/msw/glcanvas.h index 52b82f42a0..fdcdd1faa5 100644 --- a/Externals/wxWidgets3/include/wx/msw/glcanvas.h +++ b/Externals/wxWidgets3/include/wx/msw/glcanvas.h @@ -24,7 +24,9 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: - wxGLContext(wxGLCanvas *win, const wxGLContext* other = NULL); + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const; @@ -35,7 +37,7 @@ protected: HGLRC m_glContext; private: - DECLARE_CLASS(wxGLContext) + wxDECLARE_CLASS(wxGLContext); }; // ---------------------------------------------------------------------------- @@ -46,6 +48,16 @@ class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase { public: wxEXPLICIT // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + wxEXPLICIT wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, const int *attribList = NULL, @@ -55,6 +67,15 @@ public: const wxString& name = wxGLCanvasName, const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, @@ -76,9 +97,12 @@ public: // get the HDC used for OpenGL rendering HDC GetHDC() const { return m_hDC; } - // try to find pixel format matching the given attributes list for the - // specified HDC, return 0 on error, otherwise pfd is filled in with the - // information from attribList if non-NULL + // Try to find pixel format matching the given attributes list for the + // specified HDC, return 0 on error, otherwise ppfd is filled in with the + // information from dispAttrs + static int FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, + PIXELFORMATDESCRIPTOR* ppfd = NULL); + // Same as FindMatchingPixelFormat static int ChooseMatchingPixelFormat(HDC hdc, const int *attribList, PIXELFORMATDESCRIPTOR *pfd = NULL); @@ -151,8 +175,8 @@ protected: HDC m_hDC; private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGLCanvas) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGLCanvas); }; #endif // _WX_GLCANVAS_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/helpbest.h b/Externals/wxWidgets3/include/wx/msw/helpbest.h index 4deffa4adb..a6f1b2cb0e 100644 --- a/Externals/wxWidgets3/include/wx/msw/helpbest.h +++ b/Externals/wxWidgets3/include/wx/msw/helpbest.h @@ -118,7 +118,7 @@ protected: wxHelpControllerBase* m_helpController; int m_style; - DECLARE_DYNAMIC_CLASS(wxBestHelpController) + wxDECLARE_DYNAMIC_CLASS(wxBestHelpController); wxDECLARE_NO_COPY_CLASS(wxBestHelpController); }; diff --git a/Externals/wxWidgets3/include/wx/msw/helpchm.h b/Externals/wxWidgets3/include/wx/msw/helpchm.h index 17cda8ce00..1aadac3bda 100644 --- a/Externals/wxWidgets3/include/wx/msw/helpchm.h +++ b/Externals/wxWidgets3/include/wx/msw/helpchm.h @@ -81,7 +81,7 @@ protected: wxString m_helpFile; - DECLARE_DYNAMIC_CLASS(wxCHMHelpController) + wxDECLARE_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 7cc5545435..e0f797a6d4 100644 --- a/Externals/wxWidgets3/include/wx/msw/helpwin.h +++ b/Externals/wxWidgets3/include/wx/msw/helpwin.h @@ -19,7 +19,7 @@ class WXDLLIMPEXP_CORE wxWinHelpController: public wxHelpControllerBase { - DECLARE_DYNAMIC_CLASS(wxWinHelpController) + wxDECLARE_DYNAMIC_CLASS(wxWinHelpController); public: wxWinHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} diff --git a/Externals/wxWidgets3/include/wx/msw/icon.h b/Externals/wxWidgets3/include/wx/msw/icon.h index 4737e449a4..6bf5acb897 100644 --- a/Externals/wxWidgets3/include/wx/msw/icon.h +++ b/Externals/wxWidgets3/include/wx/msw/icon.h @@ -89,7 +89,7 @@ protected: void CreateIconFromXpm(const char* const* data); private: - DECLARE_DYNAMIC_CLASS(wxIcon) + wxDECLARE_DYNAMIC_CLASS(wxIcon); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/imaglist.h b/Externals/wxWidgets3/include/wx/msw/imaglist.h index 3f831f1832..daedc31878 100644 --- a/Externals/wxWidgets3/include/wx/msw/imaglist.h +++ b/Externals/wxWidgets3/include/wx/msw/imaglist.h @@ -46,6 +46,9 @@ public: // Returns the size (same for all images) of the images in the list bool GetSize(int index, int &width, int &height) const; + // Returns the overall size + wxSize GetSize() const { return m_size; } + // Operations //////////////////////////////////////////////////////////////////////////// @@ -197,8 +200,9 @@ public: protected: WXHIMAGELIST m_hImageList; + wxSize m_size; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxImageList); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/iniconf.h b/Externals/wxWidgets3/include/wx/msw/iniconf.h index 63ebd00141..b08c52c857 100644 --- a/Externals/wxWidgets3/include/wx/msw/iniconf.h +++ b/Externals/wxWidgets3/include/wx/msw/iniconf.h @@ -97,7 +97,7 @@ private: m_strPath; // the rest of the path (no trailing '_'!) wxDECLARE_NO_COPY_CLASS(wxIniConfig); - DECLARE_ABSTRACT_CLASS(wxIniConfig) + wxDECLARE_ABSTRACT_CLASS(wxIniConfig); }; #endif // wxUSE_CONFIG && wxUSE_INICONF diff --git a/Externals/wxWidgets3/include/wx/msw/init.h b/Externals/wxWidgets3/include/wx/msw/init.h index 014dedbd09..847fb0888c 100644 --- a/Externals/wxWidgets3/include/wx/msw/init.h +++ b/Externals/wxWidgets3/include/wx/msw/init.h @@ -22,13 +22,8 @@ #define SW_SHOWNORMAL 1 #endif -// WinMain() is always ANSI, even in Unicode build, under normal Windows -// but is always Unicode under CE -#ifdef __WXWINCE__ - typedef wchar_t *wxCmdLineArgType; -#else - typedef char *wxCmdLineArgType; -#endif +// WinMain() is always ANSI, even in Unicode build. +typedef char *wxCmdLineArgType; // Windows-only overloads of wxEntry() and wxEntryStart() which take the // parameters passed to WinMain() instead of those passed to main() diff --git a/Externals/wxWidgets3/include/wx/msw/joystick.h b/Externals/wxWidgets3/include/wx/msw/joystick.h index b3f5e57105..09c8bcb7c8 100644 --- a/Externals/wxWidgets3/include/wx/msw/joystick.h +++ b/Externals/wxWidgets3/include/wx/msw/joystick.h @@ -15,8 +15,8 @@ class WXDLLIMPEXP_ADV wxJoystick: public wxObject { - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: /* * Public interface */ diff --git a/Externals/wxWidgets3/include/wx/msw/libraries.h b/Externals/wxWidgets3/include/wx/msw/libraries.h index 86e47195d1..abd0046a74 100644 --- a/Externals/wxWidgets3/include/wx/msw/libraries.h +++ b/Externals/wxWidgets3/include/wx/msw/libraries.h @@ -18,8 +18,7 @@ * support a way to do that. */ -/* VC++ 5 didn't include oleacc.lib, though it came with the PSDK */ -#if defined __VISUALC__ && (wxUSE_ACCESSIBILITY || __VISUALC__ >= 1200) +#if defined __VISUALC__ && wxUSE_ACCESSIBILITY #pragma comment(lib, "oleacc") #endif diff --git a/Externals/wxWidgets3/include/wx/msw/listbox.h b/Externals/wxWidgets3/include/wx/msw/listbox.h index 8d8bd01a87..ffd8b68752 100644 --- a/Externals/wxWidgets3/include/wx/msw/listbox.h +++ b/Externals/wxWidgets3/include/wx/msw/listbox.h @@ -26,7 +26,7 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); #endif // wxUSE_OWNER_DRAWN -// forward decl for GetSelections() +// forward declaration for GetSelections() class WXDLLIMPEXP_FWD_BASE wxArrayInt; // ---------------------------------------------------------------------------- @@ -93,6 +93,11 @@ public: int HitTest(const wxPoint& pt) const { return DoHitTestList(pt); } int HitTest(wxCoord x, wxCoord y) const { return DoHitTestList(wxPoint(x, y)); } + virtual void EnsureVisible(int n); + + virtual int GetTopItem() const; + virtual int GetCountPerPage() const; + // ownerdrawn wxListBox and wxCheckListBox support #if wxUSE_OWNER_DRAWN // override base class virtuals @@ -128,7 +133,7 @@ public: WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; // under XP when using "transition effect for menus and tooltips" if we - // return true for WM_PRINTCLIENT here then it causes noticable slowdown + // return true for WM_PRINTCLIENT here then it causes noticeable slowdown virtual bool MSWShouldPropagatePrintChild() { return false; @@ -192,7 +197,7 @@ private: bool m_updateHorizontalExtent; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox); }; #endif // wxUSE_LISTBOX diff --git a/Externals/wxWidgets3/include/wx/msw/listctrl.h b/Externals/wxWidgets3/include/wx/msw/listctrl.h index e3f0a7d1df..1b8beaed63 100644 --- a/Externals/wxWidgets3/include/wx/msw/listctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/listctrl.h @@ -216,6 +216,12 @@ public: void SetItemFont( long item, const wxFont &f); wxFont GetItemFont( long item ) const; + // Checkbox state of an item + virtual bool HasCheckboxes() const wxOVERRIDE; + virtual bool EnableCheckboxes(bool enable = true) wxOVERRIDE; + virtual bool IsItemChecked(long item) const wxOVERRIDE; + virtual void CheckItem(long item, bool check) wxOVERRIDE; + // Gets the number of selected items in the list control int GetSelectedItemCount() const; @@ -365,12 +371,6 @@ public: static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - -#if WXWIN_COMPATIBILITY_2_6 - // obsolete stuff, for compatibility only -- don't use - wxDEPRECATED( int GetItemSpacing(bool isSmall) const); -#endif // WXWIN_COMPATIBILITY_2_6 - // convert our styles to Windows virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; @@ -415,8 +415,6 @@ protected: int m_colCount; // Windows doesn't have GetColumnCount so must // keep track of inserted/deleted columns - long m_count; // Keep track of item count to save calls to - // ListView_GetItemCount // all wxMSWListItemData objects we use wxVector m_internalData; @@ -463,8 +461,8 @@ private: void OnCharHook(wxKeyEvent& event); - DECLARE_DYNAMIC_CLASS(wxListCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxListCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/mdi.h b/Externals/wxWidgets3/include/wx/msw/mdi.h index a699a3125c..125c5a6532 100644 --- a/Externals/wxWidgets3/include/wx/msw/mdi.h +++ b/Externals/wxWidgets3/include/wx/msw/mdi.h @@ -91,6 +91,7 @@ public: // Responds to colour changes void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnActivate(wxActivateEvent& event); void OnSize(wxSizeEvent& event); void OnIconized(wxIconizeEvent& event); @@ -103,9 +104,10 @@ public: virtual bool MSWTranslateMessage(WXMSG* msg); #if wxUSE_MENUS - // override wxFrameBase function to also look in the active child menu bar - // and the "Window" menu + // override the menu-relayed methods to also look in the active child menu + // bar and the "Window" menu virtual wxMenuItem *FindItemInMenuBar(int menuId) const; + virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); #endif // wxUSE_MENUS protected: @@ -144,11 +146,15 @@ private: // return the number of child frames we currently have (maybe 0) int GetChildFramesCount() const; + // if true, indicates whether the event wasn't really processed even though + // it was "handled", see OnActivate() and HandleActivate() + bool m_activationNotHandled; + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); wxDECLARE_NO_COPY_CLASS(wxMDIParentFrame); }; @@ -225,11 +231,10 @@ protected: void Init(); private: - bool m_needsInitialShow; // Show must be called in idle time after Creation bool m_needsResize; // flag which tells us to artificially resize the frame - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame); }; // --------------------------------------------------------------------------- @@ -258,8 +263,8 @@ protected: int m_scrollX, m_scrollY; private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow); }; #endif // _WX_MSW_MDI_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/menu.h b/Externals/wxWidgets3/include/wx/msw/menu.h index 5f4c9f1853..2260c6b4d1 100644 --- a/Externals/wxWidgets3/include/wx/msw/menu.h +++ b/Externals/wxWidgets3/include/wx/msw/menu.h @@ -20,24 +20,8 @@ class WXDLLIMPEXP_FWD_CORE wxFrame; -#if defined(__WXWINCE__) && wxUSE_TOOLBAR -class WXDLLIMPEXP_FWD_CORE wxToolBar; -#endif - class wxMenuRadioItemsData; -// Not using a combined wxToolBar/wxMenuBar? then use -// a commandbar in WinCE .NET to implement the -// menubar, since there is no ::SetMenu function. -#if defined(__WXWINCE__) -# if ((_WIN32_WCE >= 400) && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) || \ - defined(__HANDHELDPC__) -# define WINCE_WITH_COMMANDBAR -# else -# define WINCE_WITHOUT_COMMANDBAR -# endif -#endif - #include "wx/arrstr.h" @@ -67,6 +51,9 @@ public: // menu handle and will delete it when this object is destroyed. static wxMenu *MSWNewFromHMENU(WXHMENU hMenu) { return new wxMenu(hMenu); } + // Detaches HMENU so that it isn't deleted when this object is destroyed. + // Don't use this object after calling this method. + WXHMENU MSWDetachHMENU() { WXHMENU m = m_hMenu; m_hMenu = NULL; return m; } // implementation only from now on // ------------------------------- @@ -99,6 +86,9 @@ public: wxAcceleratorTable *CreateAccelTable() const; #endif // wxUSE_ACCEL + // get the menu with given handle (recursively) + wxMenu* MSWGetMenu(WXHMENU hMenu); + #if wxUSE_OWNER_DRAWN int GetMaxAccelWidth() @@ -113,9 +103,6 @@ public: m_maxAccelWidth = -1; } - // get the menu with given handle (recursively) - wxMenu* MSWGetMenu(WXHMENU hMenu); - private: void CalculateMaxAccelWidth(); @@ -170,7 +157,7 @@ private: int m_maxAccelWidth; #endif // wxUSE_OWNER_DRAWN - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu); }; // ---------------------------------------------------------------------------- @@ -205,17 +192,6 @@ public: virtual void Detach(); virtual void Attach(wxFrame *frame); -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - // Under WinCE, a menubar is owned by the frame's toolbar - void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; } - wxToolBar* GetToolBar() const { return m_toolBar; } -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND GetCommandBar() const { return m_commandBar; } - bool AddAdornments(long style); -#endif - #if wxUSE_ACCEL // update the accel table (must be called after adding/deleting a menu) void RebuildAccelTable(); @@ -232,8 +208,11 @@ 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); + // Get a top level menu position or wxNOT_FOUND from its handle. + int MSWGetTopMenuPos(WXHMENU hMenu) const; + + // Get a top level or sub menu with given handle (recursively). + wxMenu* MSWGetMenu(WXHMENU hMenu) const; protected: // common part of all ctors @@ -245,17 +224,8 @@ protected: // the wxWidgets position. int MSWPositionForWxMenu(wxMenu *menu, int wxpos); -#if defined(__WXWINCE__) && wxUSE_TOOLBAR - wxToolBar* m_toolBar; -#endif - -#ifdef WINCE_WITH_COMMANDBAR - WXHWND m_commandBar; - bool m_adornmentsAdded; -#endif - private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar); }; #endif // _WX_MENU_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/menuitem.h b/Externals/wxWidgets3/include/wx/msw/menuitem.h index d76bd11950..5847295f83 100644 --- a/Externals/wxWidgets3/include/wx/msw/menuitem.h +++ b/Externals/wxWidgets3/include/wx/msw/menuitem.h @@ -15,9 +15,10 @@ // headers // ---------------------------------------------------------------------------- +#include "wx/bitmap.h" + #if wxUSE_OWNER_DRAWN #include "wx/ownerdrw.h" - #include "wx/bitmap.h" struct tagRECT; #endif @@ -72,34 +73,28 @@ public: ); #endif -#if wxUSE_OWNER_DRAWN - void SetBitmaps(const wxBitmap& bmpChecked, const wxBitmap& bmpUnchecked = wxNullBitmap) { - m_bmpChecked = bmpChecked; - m_bmpUnchecked = bmpUnchecked; - SetOwnerDrawn(true); + DoSetBitmap(bmpChecked, true); + DoSetBitmap(bmpUnchecked, false); } void SetBitmap(const wxBitmap& bmp, bool bChecked = true) { - if ( bChecked ) - m_bmpChecked = bmp; - else - m_bmpUnchecked = bmp; - SetOwnerDrawn(true); + DoSetBitmap(bmp, bChecked); } + const wxBitmap& GetBitmap(bool bChecked = true) const + { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } + +#if wxUSE_OWNER_DRAWN void SetDisabledBitmap(const wxBitmap& bmpDisabled) { m_bmpDisabled = bmpDisabled; SetOwnerDrawn(true); } - const wxBitmap& GetBitmap(bool bChecked = true) const - { return (bChecked ? m_bmpChecked : m_bmpUnchecked); } - const wxBitmap& GetDisabledBitmap() const { return m_bmpDisabled; } @@ -118,30 +113,44 @@ private: // helper function for draw std menu check mark void DrawStdCheckMark(WXHDC hdc, const tagRECT* rc, wxODStatus stat); -#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 + // helper function to determine if the item must be owner-drawn + bool MSWMustUseOwnerDrawn(); +#endif // wxUSE_OWNER_DRAWN + + enum BitmapKind + { + Normal, + Checked, + Unchecked + }; + + // helper function to get a handle for bitmap associated with item + WXHBITMAP GetHBitmapForMenu(BitmapKind kind) const; + + // helper function to set/change the bitmap + void DoSetBitmap(const wxBitmap& bmp, bool bChecked); private: // common part of all ctors void Init(); + // Return the item position in the menu containing it. + // + // Returns -1 if the item is not attached to a menu or if we can't find its + // position (which is not really supposed to ever happen). + int MSGetMenuItemPos() const; -#if wxUSE_OWNER_DRAWN // item bitmaps wxBitmap m_bmpChecked, // bitmap to put near the item - m_bmpUnchecked, // (checked is used also for 'uncheckable' items) - m_bmpDisabled; + m_bmpUnchecked; // (checked is used also for 'uncheckable' items) +#if wxUSE_OWNER_DRAWN + wxBitmap m_bmpDisabled; #endif // wxUSE_OWNER_DRAWN - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) + // Give wxMenu access to our MSWMustUseOwnerDrawn() and GetHBitmapForMenu(). + friend class wxMenu; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem); }; #endif //_MENUITEM_H diff --git a/Externals/wxWidgets3/include/wx/msw/metafile.h b/Externals/wxWidgets3/include/wx/msw/metafile.h index 8991f58c91..8a7c6ce68f 100644 --- a/Externals/wxWidgets3/include/wx/msw/metafile.h +++ b/Externals/wxWidgets3/include/wx/msw/metafile.h @@ -73,7 +73,7 @@ protected: virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxMetafile) + wxDECLARE_DYNAMIC_CLASS(wxMetafile); }; class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxMSWDCImpl @@ -105,7 +105,7 @@ protected: wxMetafile* m_metaFile; private: - DECLARE_CLASS(wxMetafileDCImpl) + wxDECLARE_CLASS(wxMetafileDCImpl); wxDECLARE_NO_COPY_CLASS(wxMetafileDCImpl); }; @@ -131,7 +131,7 @@ public: { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } private: - DECLARE_CLASS(wxMetafileDC) + wxDECLARE_CLASS(wxMetafileDC); wxDECLARE_NO_COPY_CLASS(wxMetafileDC); }; diff --git a/Externals/wxWidgets3/include/wx/msw/microwin.h b/Externals/wxWidgets3/include/wx/msw/microwin.h deleted file mode 100644 index bb9861ab10..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/microwin.h +++ /dev/null @@ -1,234 +0,0 @@ -/* -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/microwin.h -// Purpose: Extra implementation for MicroWindows -// Author: Julian Smart -// Created: 2001-05-31 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// -*/ - -#ifndef _WX_MICROWIN_H_ -#define _WX_MICROWIN_H_ - -/* Implemented by microwin.cpp */ - -#ifdef __cplusplus -extern "C" { -#endif - -BOOL SetCursorPos(int x, int y); - -HCURSOR SetCursor(HCURSOR hCursor); - -/* Implemented with wrong number of args by MicroWindows */ -/* so we need to use a different name */ -int GetScrollPosWX (HWND hWnd, int iSBar); - -BOOL ScrollWindow(HWND, int xAmount, int yAmount, - CONST RECT* lpRect, CONST RECT* lpClipRect); - -HWND WindowFromPoint(POINT pt); -SHORT GetKeyState(int nVirtKey); -HWND SetParent(HWND hWndChild, HWND hWndNewParent); -VOID DragAcceptFiles(HWND, BOOL); -BOOL IsDialogMessage(HWND hWnd, MSG* msg); -DWORD GetMessagePos(VOID); -BOOL IsIconic(HWND hWnd); -int SetMapMode(HDC hDC, int mode); -int GetMapMode(HDC hDC); -HCURSOR LoadCursor(HINSTANCE hInst, int cursor); -DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz); -VOID DestroyIcon(HICON hIcon); -COLORREF GetTextColor(HDC hdc); -COLORREF GetBkColor(HDC hdc); -HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b); -BOOL IntersectClipRect(HDC hdc, int x, int y, - int w, int h); -BOOL GetClipBox(HDC hdc, RECT* rect); -BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); -BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize); -BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint); -BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize); -BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize); -BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags); -int SetPolyFillMode(HDC hdc, int mode); -BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2); -BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, - HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop); -UINT RealizePalette(HDC hDC); -BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint); -int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj); - -/* For some reason these aren't defined in the headers */ -BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable) ; -BOOL GetScrollPos (HWND hWnd, int iSBar, int* pPos); -BOOL GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos); -BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos); -BOOL SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos); -BOOL SetScrollInfo (HWND hWnd, int iSBar, - LPCSCROLLINFO lpsi, BOOL fRedraw); -BOOL GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi); -BOOL ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow); -HBITMAP WINAPI -CreateBitmap( int width, int height, int nPlanes, int bPP, LPCVOID lpData); - -#ifdef __cplusplus -} -#endif - -/* - * Key State Masks for Mouse Messages - */ -#ifndef MK_LBUTTON -#define MK_LBUTTON 0x0001 -#define MK_RBUTTON 0x0002 -#define MK_SHIFT 0x0004 -#define MK_CONTROL 0x0008 -#define MK_MBUTTON 0x0010 -#endif - -/* - * DrawIcon flags - */ - -#ifndef DI_MASK -#define DI_MASK 0x0001 -#define DI_IMAGE 0x0002 -#define DI_NORMAL 0x0003 -#define DI_COMPAT 0x0004 -#define DI_DEFAULTSIZE 0x0008 -#endif - -/* TODO: May have to fake these message */ -#ifndef WM_INITDIALOG -#define WM_INITDIALOG 0x0110 -#endif -#ifndef WM_QUERYENDSESSION -#define WM_QUERYENDSESSION 0x0011 -#endif -#ifndef WM_ENDSESSION -#define WM_ENDSESSION 0x0016 -#endif -#ifndef WM_SETCURSOR -#define WM_SETCURSOR 0x0020 -#endif -#ifndef WM_GETMINMAXINFO -#define WM_GETMINMAXINFO 0x0024 -typedef struct tagMINMAXINFO { - POINT ptReserved; - POINT ptMaxSize; - POINT ptMaxPosition; - POINT ptMinTrackSize; - POINT ptMaxTrackSize; -} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO; - -#endif -#ifndef WM_SYSCOMMAND -#define WM_SYSCOMMAND 0x0112 -#endif -#ifndef WM_SYSCOLORCHANGE -#define WM_SYSCOLORCHANGE 0x0015 -#endif -#ifndef WM_QUERYNEWPALETTE -#define WM_QUERYNEWPALETTE 0x030F -#endif -#ifndef WM_PALETTEISCHANGING -#define WM_PALETTEISCHANGING 0x0310 -#endif -#ifndef WM_PALETTECHANGED -#define WM_PALETTECHANGED 0x0311 -#endif -#ifndef WM_NOTIFY -#define WM_NOTIFY 0x004E -#endif -#ifndef WM_DROPFILES -#define WM_DROPFILES 0x0233 -#endif - -#ifndef PALETTERGB -#define PALETTERGB RGB -#endif - -#ifndef MM_TEXT -#define MM_TEXT 1 -#define MM_LOMETRIC 2 -#define MM_HIMETRIC 3 -#define MM_LOENGLISH 4 -#define MM_HIENGLISH 5 -#define MM_TWIPS 6 -#define MM_ISOTROPIC 7 -#define MM_ANISOTROPIC 8 -#endif - -#ifndef SC_MAXIMIZE -#define SC_MINIMIZE 0xF020 -#define SC_MAXIMIZE 0xF030 -#endif - -// TODO: all of them -#ifndef IDC_ARROW -#define IDC_ARROW 1 -#endif - -/* - * Standard Cursor IDs - */ -#ifndef MAKEINTRESOURCE -#define MAKEINTRESOURCE(r) r -#endif - -#ifndef IDC_ARROW -#define IDC_ARROW MAKEINTRESOURCE(32512) -#define IDC_IBEAM MAKEINTRESOURCE(32513) -#define IDC_WAIT MAKEINTRESOURCE(32514) -#define IDC_CROSS MAKEINTRESOURCE(32515) -#define IDC_UPARROW MAKEINTRESOURCE(32516) -#define IDC_SIZE MAKEINTRESOURCE(32640) /* OBSOLETE: use IDC_SIZEALL */ -#define IDC_ICON MAKEINTRESOURCE(32641) /* OBSOLETE: use IDC_ARROW */ -#define IDC_SIZENWSE MAKEINTRESOURCE(32642) -#define IDC_SIZENESW MAKEINTRESOURCE(32643) -#define IDC_SIZEWE MAKEINTRESOURCE(32644) -#define IDC_SIZENS MAKEINTRESOURCE(32645) -#define IDC_SIZEALL MAKEINTRESOURCE(32646) -#define IDC_NO MAKEINTRESOURCE(32648) /* not in win3.1 */ -#if(WINVER >= 0x0500) -#define IDC_HAND MAKEINTRESOURCE(32649) -#endif /* WINVER >= 0x0500 */ -#define IDC_APPSTARTING MAKEINTRESOURCE(32650) /* not in win3.1 */ -#if(WINVER >= 0x0400) -#define IDC_HELP MAKEINTRESOURCE(32651) -#endif /* WINVER >= 0x0400 */ -#endif - -/* ExtFloodFill style flags */ -#define FLOODFILLBORDER 0 -#define FLOODFILLSURFACE 1 - -/* PolyFill() Modes */ -#define ALTERNATE 1 -#define WINDING 2 -#define POLYFILL_LAST 2 - -/* Quaternary raster codes */ -#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) - -/* Device Parameters for GetDeviceCaps() */ -#define DRIVERVERSION 0 /* Device driver version */ -#define TECHNOLOGY 2 /* Device classification */ -#define HORZSIZE 4 /* Horizontal size in millimeters */ -#define VERTSIZE 6 /* Vertical size in millimeters */ - -/* Ternary raster operations */ -/* Now defined by MicroWindows */ -#if 0 -#define DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */ -#define WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */ -#define SRCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */ -#define MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */ -#define SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */ -#define NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */ -#endif - -#endif /* _WX_MICROWIN_H_ */ diff --git a/Externals/wxWidgets3/include/wx/msw/mimetype.h b/Externals/wxWidgets3/include/wx/msw/mimetype.h index 90a7013b6f..77becd7b84 100644 --- a/Externals/wxWidgets3/include/wx/msw/mimetype.h +++ b/Externals/wxWidgets3/include/wx/msw/mimetype.h @@ -5,7 +5,7 @@ // Modified by: // Created: 23.09.98 // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence (part of wxExtra library) +// Licence: wxWidgets licence (part of base library) ///////////////////////////////////////////////////////////////////////////// #ifndef _MIMETYPE_IMPL_H @@ -42,9 +42,18 @@ public: bool GetIcon(wxIconLocation *iconLoc) const; bool GetDescription(wxString *desc) const; bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const; + const wxFileType::MessageParameters& params) const + { + *openCmd = GetExpandedCommand(wxS("open"), params); + return !openCmd->empty(); + } + bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) const; + const wxFileType::MessageParameters& params) const + { + *printCmd = GetExpandedCommand(wxS("print"), params); + return !printCmd->empty(); + } size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, const wxFileType::MessageParameters& params) const; @@ -62,6 +71,23 @@ public: // this is called by Associate bool SetDescription (const wxString& desc); + // This is called by all our own methods modifying the registry to let the + // Windows Shell know about the changes. + // + // It is also called from Associate() and Unassociate() which suppress the + // internally generated notifications using the method below, which is why + // it has to be public. + void MSWNotifyShell(); + + // Call before/after performing several registry changes in a row to + // temporarily suppress multiple notifications that would be generated for + // them and generate a single one at the end using MSWNotifyShell() + // explicitly. + void MSWSuppressNotifications(bool supress); + + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; private: // helper function: reads the command corresponding to the specified verb // from the registry (returns an empty string if not found) @@ -76,6 +102,7 @@ private: wxString m_strFileType, // may be empty m_ext; + bool m_suppressNotify; // these methods are not publicly accessible (as wxMimeTypesManager // doesn't know about them), and should only be called by Unassociate diff --git a/Externals/wxWidgets3/include/wx/msw/minifram.h b/Externals/wxWidgets3/include/wx/msw/minifram.h index 5e12562ebc..c6d86c99da 100644 --- a/Externals/wxWidgets3/include/wx/msw/minifram.h +++ b/Externals/wxWidgets3/include/wx/msw/minifram.h @@ -44,7 +44,7 @@ public: } protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/missing.h b/Externals/wxWidgets3/include/wx/msw/missing.h index e7522ee753..5a248282b8 100644 --- a/Externals/wxWidgets3/include/wx/msw/missing.h +++ b/Externals/wxWidgets3/include/wx/msw/missing.h @@ -10,24 +10,6 @@ #ifndef _WX_MISSING_H_ #define _WX_MISSING_H_ -/* - * The following are required for VC++ 6. - */ - -// Needed by cursor.cpp -#ifndef IDC_HAND - #define IDC_HAND MAKEINTRESOURCE(32649) -#endif - -// Needed by strconv.cpp -#ifndef WC_NO_BEST_FIT_CHARS - #define WC_NO_BEST_FIT_CHARS 0x400 -#endif - -#ifndef WM_CONTEXTMENU - #define WM_CONTEXTMENU 0x007B -#endif - #ifndef WM_CHANGEUISTATE #define WM_CHANGEUISTATE 0x0127 #endif @@ -48,6 +30,10 @@ #define DT_HIDEPREFIX 0x00100000 #endif +#ifndef DSS_HIDEPREFIX + #define DSS_HIDEPREFIX 0x0200 +#endif + // Needed by toplevel.cpp #ifndef UIS_SET #define UIS_SET 1 @@ -155,74 +141,6 @@ #define QS_ALLPOSTMESSAGE 0 #endif -/* - * The following are required for VC++ 5 when the PSDK is not available. - */ - -#if defined __VISUALC__ && __VISUALC__ <= 1100 - -#ifndef VER_NT_WORKSTATION - -typedef struct _OSVERSIONINFOEXA { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - CHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; -typedef struct _OSVERSIONINFOEXW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW; - -#ifdef UNICODE -typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#else -typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; -typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; -#endif - -#endif // defined VER_NT_WORKSTATION - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// NMLVCUSTOMDRAW originally didn't have the iSubItem member. It was added -// with IE4, as was IPN_FIRST which is used as a test :-(. -// -#ifndef IPN_FIRST - -typedef struct wxtagNMLVCUSTOMDRAW_ { - NMCUSTOMDRAW nmcd; - COLORREF clrText; - COLORREF clrTextBk; - int iSubItem; -} wxNMLVCUSTOMDRAW_, *wxLPNMLVCUSTOMDRAW_; - -#define NMLVCUSTOMDRAW wxNMLVCUSTOMDRAW_ -#define LPNMLVCUSTOMDRAW wxLPNMLVCUSTOMDRAW_ - -#endif // defined IPN_FIRST - -#endif // defined __VISUALC__ && __VISUALC__ <= 1100 - // ---------------------------------------------------------------------------- // menu stuff // ---------------------------------------------------------------------------- @@ -258,8 +176,7 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #define LVS_EX_FULLROWSELECT 0x00000020 #endif -// LVS_EX_LABELTIP is not supported by Windows CE, don't define it there -#if !defined(LVS_EX_LABELTIP) && !defined(__WXWINCE__) +#if !defined(LVS_EX_LABELTIP) #define LVS_EX_LABELTIP 0x00004000 #endif @@ -267,6 +184,10 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #define LVS_EX_SUBITEMIMAGES 0x00000002 #endif +#ifndef LVS_EX_DOUBLEBUFFER + #define LVS_EX_DOUBLEBUFFER 0x00010000 +#endif + #ifndef HDN_GETDISPINFOW #define HDN_GETDISPINFOW (HDN_FIRST-29) #endif @@ -329,180 +250,7 @@ typedef struct wxtagNMLVCUSTOMDRAW_ { #endif /* - * The following are required for BC++ 5.5 (none at present.) - */ - - /* - * The following are specifically required for Digital Mars C++ - */ - -#ifdef __DMC__ - -#ifndef VER_NT_WORKSTATION -typedef struct _OSVERSIONINFOEX { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - TCHAR szCSDVersion[ 128 ]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; -} OSVERSIONINFOEX; -#endif // !defined(VER_NT_WORKSTATION) - -#ifndef _TrackMouseEvent - #define _TrackMouseEvent TrackMouseEvent -#endif - -#ifndef LVM_SETEXTENDEDLISTVIEWSTYLE - #define LVM_SETEXTENDEDLISTVIEWSTYLE (0x1000 + 54) -#endif - -#ifndef LVM_GETSUBITEMRECT - #define LVM_GETSUBITEMRECT (0x1000 + 56) -#endif - -#ifndef LVCF_IMAGE - #define LVCF_IMAGE 0x0010 -#endif - -#ifndef Header_GetItemRect - #define Header_GetItemRect(w,i,r) \ - (BOOL)SendMessage((w),HDM_GETITEMRECT,(WPARAM)(i),(LPARAM)(r)) -#endif - -#ifndef HDM_GETITEMRECT - #define HDM_GETITEMRECT (HDM_FIRST+7) -#endif - -#ifndef ListView_GetHeader - #define ListView_GetHeader(w) (HWND)SendMessage((w),LVM_GETHEADER,0,0) -#endif - -#ifndef ListView_GetSubItemRect - #define ListView_GetSubItemRect(w, i, s, c, p) (HWND)SendMessage(w,LVM_GETSUBITEMRECT,i, ((p) ? ((((LPRECT)(p))->top = s), (((LPRECT)(p))->left = c), (LPARAM)(p)) : (LPARAM)(LPRECT)NULL)) -#endif - -#ifndef LVM_GETHEADER - #define LVM_GETHEADER (LVM_FIRST+31) -#endif - -#ifndef HDLAYOUT - #define HDLAYOUT HD_LAYOUT -#endif - -#ifndef HDITEM - #define HDITEM HD_ITEM -#endif - -#ifndef NMHEADER - #define NMHEADER HD_NOTIFY -#endif - -#ifndef HDS_DRAGDROP - #define HDS_DRAGDROP 0x0040 -#endif -#ifndef HDS_FULLDRAG - #define HDS_FULLDRAG 0x0080 -#endif - - -#ifndef HDN_BEGINDRAG - #define HDN_BEGINDRAG (HDN_FIRST - 11) -#endif - -#ifndef HDN_ENDDRAG - #define HDN_ENDDRAG (HDN_FIRST - 10) -#endif - -#ifndef LVSICF_NOSCROLL - #define LVSICF_NOINVALIDATEALL 0x0001 - #define LVSICF_NOSCROLL 0x0002 -#endif - -#ifndef CP_SYMBOL - #define CP_SYMBOL 42 -#endif - -// ---------------------------------------------------------------------------- -// wxDisplay -// ---------------------------------------------------------------------------- - -// The windows headers with Digital Mars lack some typedefs. -// typedef them as my_XXX and then #define to rename to XXX in case -// a newer version of Digital Mars fixes the headers -// (or up to date PSDK is in use with older version) -// also we use any required definition (MONITOR_DEFAULTTONULL) to recognize -// whether whole missing block needs to be included - -#ifndef MONITOR_DEFAULTTONULL - - #define HMONITOR_DECLARED - DECLARE_HANDLE(HMONITOR); - typedef BOOL(CALLBACK* my_MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); - #define MONITORENUMPROC my_MONITORENUMPROC - typedef struct my_tagMONITORINFO { - DWORD cbSize; - RECT rcMonitor; - RECT rcWork; - DWORD dwFlags; - } my_MONITORINFO,*my_LPMONITORINFO; - #define MONITORINFO my_MONITORINFO - #define LPMONITORINFO my_LPMONITORINFO - - typedef struct my_MONITORINFOEX : public my_tagMONITORINFO - { - TCHAR szDevice[CCHDEVICENAME]; - } my_MONITORINFOEX, *my_LPMONITORINFOEX; - #define MONITORINFOEX my_MONITORINFOEX - #define LPMONITORINFOEX my_LPMONITORINFOEX - - #ifndef MONITOR_DEFAULTTONULL - #define MONITOR_DEFAULTTONULL 0 - #endif // MONITOR_DEFAULTTONULL - - #ifndef MONITORINFOF_PRIMARY - #define MONITORINFOF_PRIMARY 1 - #endif // MONITORINFOF_PRIMARY - - #ifndef DDENUM_ATTACHEDSECONDARYDEVICES - #define DDENUM_ATTACHEDSECONDARYDEVICES 1 - #endif - -#endif // MONITOR_DEFAULTTONULL - -// ---------------------------------------------------------------------------- -// Tree control -// ---------------------------------------------------------------------------- - -#ifndef TVIS_FOCUSED - #define TVIS_FOCUSED 0x0001 -#endif - -#ifndef TVS_CHECKBOXES - #define TVS_CHECKBOXES 0x0100 -#endif - -#ifndef TVITEM - #define TVITEM TV_ITEM -#endif - -#endif - // DMC++ - - /* - * The following are specifically required for OpenWatcom C++ (none at present) - */ - -#if defined(__WATCOMC__) -#endif - - /* - * The following are specifically required for MinGW (none at present) + * The following are specifically required for MinGW. */ #if defined (__MINGW32__) @@ -522,8 +270,7 @@ typedef struct #endif -//Various defines that will be needed by mingw and possibly VC++6 -//Used by the webview library +// Various defines used by the webview library that are needed by mingw #ifndef DISPID_COMMANDSTATECHANGE #define DISPID_COMMANDSTATECHANGE 105 @@ -657,29 +404,6 @@ typedef struct #define MUI_LANGUAGE_NAME 0x8 #endif -//We need to check if we are using MinGW or mingw-w64 as their -//definitions are different - -#ifdef __MINGW32__ -#include <_mingw.h> -#endif - -#ifdef __MINGW32_TOOLCHAIN__ -typedef enum CommandStateChangeConstants { - CSC_UPDATECOMMANDS = (int) 0xFFFFFFFF, - CSC_NAVIGATEFORWARD = 0x1, - CSC_NAVIGATEBACK = 0x2 -} CommandStateChangeConstants; -#endif - - /* - * In addition to the declarations for VC++, the following are required for WinCE - */ - -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" -#endif - /* * The following are specifically required for Wine */ diff --git a/Externals/wxWidgets3/include/wx/msw/mslu.h b/Externals/wxWidgets3/include/wx/msw/mslu.h deleted file mode 100644 index d8b9441b38..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/mslu.h +++ /dev/null @@ -1,22 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/mslu.h -// Purpose: MSLU-related declarations -// Author: Vaclav Slavik -// Modified by: Vadim Zeitlin to move out various functions to other files -// to fix header inter-dependencies -// Created: 2002/02/17 -// Copyright: (c) 2002 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSLU_H_ -#define _WX_MSLU_H_ - -#include "wx/defs.h" - -// Returns true if we are running under Unicode emulation in Win9x environment. -// Workaround hacks take effect only if this condition is met -// (NB: this function is needed even if !wxUSE_UNICODE_MSLU) -WXDLLIMPEXP_BASE bool wxUsingUnicowsDll(); - -#endif // _WX_MSLU_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/msvcrt.h b/Externals/wxWidgets3/include/wx/msw/msvcrt.h index e92a88d841..38a4582e25 100644 --- a/Externals/wxWidgets3/include/wx/msw/msvcrt.h +++ b/Externals/wxWidgets3/include/wx/msw/msvcrt.h @@ -22,7 +22,7 @@ // use debug CRT functions for memory leak detections in VC++ 5.0+ in debug // builds #undef wxUSE_VC_CRTDBG -#if defined(_DEBUG) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ +#if defined(_DEBUG) && defined(__VISUALC__) \ && !defined(UNDER_CE) // it doesn't combine well with wxWin own memory debugging methods #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) diff --git a/Externals/wxWidgets3/include/wx/msw/notebook.h b/Externals/wxWidgets3/include/wx/msw/notebook.h index ceda97127a..64d6bfc5d4 100644 --- a/Externals/wxWidgets3/include/wx/msw/notebook.h +++ b/Externals/wxWidgets3/include/wx/msw/notebook.h @@ -185,27 +185,21 @@ protected: bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL); #endif // wxUSE_UXTHEME - // these function are only used for reducing flicker on notebook resize and - // we don't need to do this for WinCE -#ifndef __WXWINCE__ + // these function are used for reducing flicker on notebook resize void OnEraseBackground(wxEraseEvent& event); void OnPaint(wxPaintEvent& event); // 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 // background brush used to paint the tab control WXHBRUSH m_hbrBackground; #endif // wxUSE_UXTHEME - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook); + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_NOTEBOOK diff --git a/Externals/wxWidgets3/include/wx/msw/notifmsg.h b/Externals/wxWidgets3/include/wx/msw/notifmsg.h deleted file mode 100644 index b7e0e0e867..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/notifmsg.h +++ /dev/null @@ -1,74 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/notifmsg.h -// Purpose: implementation of wxNotificationMessage for Windows -// Author: Vadim Zeitlin -// Created: 2007-12-01 -// Copyright: (c) 2007 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_NOTIFMSG_H_ -#define _WX_MSW_NOTIFMSG_H_ - -class WXDLLIMPEXP_FWD_ADV wxTaskBarIcon; - -// ---------------------------------------------------------------------------- -// wxNotificationMessage -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase -{ -public: - wxNotificationMessage() { Init(); } - wxNotificationMessage(const wxString& title, - const wxString& message = wxString(), - wxWindow *parent = NULL, - int flags = wxICON_INFORMATION) - : wxNotificationMessageBase(title, message, parent, flags) - { - Init(); - } - - virtual ~wxNotificationMessage(); - - - virtual bool Show(int timeout = Timeout_Auto); - virtual bool Close(); - - // MSW implementation-specific methods - - // by default, wxNotificationMessage under MSW creates a temporary taskbar - // icon to which it attaches the notification, if there is an existing - // taskbar icon object in the application you may want to call this method - // to attach the notification to it instead (we won't take ownership of it - // and you can also pass NULL to not use the icon for notifications any - // more) - // - // returns the task bar icon which was used previously (may be NULL) - static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon); - - // call this to always use the generic implementation, even if the system - // supports the balloon tooltips used by the native one - static void AlwaysUseGeneric(bool alwaysUseGeneric) - { - ms_alwaysUseGeneric = alwaysUseGeneric; - } - -private: - // common part of all ctors - void Init() { m_impl = NULL; } - - - // flag indicating whether we should always use generic implementation - static bool ms_alwaysUseGeneric; - - // the real implementation of this class (selected during run-time because - // the balloon task bar icons are not available in all Windows versions) - class wxNotifMsgImpl *m_impl; - - - wxDECLARE_NO_COPY_CLASS(wxNotificationMessage); -}; - -#endif // _WX_MSW_NOTIFMSG_H_ - diff --git a/Externals/wxWidgets3/include/wx/msw/ole/activex.h b/Externals/wxWidgets3/include/wx/msw/ole/activex.h index 76dca3c36e..1679d8dffd 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/activex.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/activex.h @@ -34,9 +34,7 @@ class FrameSite; #include #include -#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) #include -#endif #include diff --git a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h index c9f7eb88c8..57a99fb445 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h @@ -21,6 +21,7 @@ #include #include "wx/intl.h" #include "wx/log.h" +#include "wx/variant.h" // ============================================================================ // General purpose functions and macros @@ -36,11 +37,7 @@ inline bool wxOleInitialize() { HRESULT -#ifdef __WXWINCE__ - hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); -#else - hr = ::OleInitialize(NULL); -#endif + hr = ::OleInitialize(NULL); // RPC_E_CHANGED_MODE indicates that OLE had been already initialized // before, albeit with different mode. Don't consider it to be an error as @@ -59,11 +56,7 @@ inline bool wxOleInitialize() inline void wxOleUninitialize() { -#ifdef __WXWINCE__ - ::CoUninitialize(); -#else ::OleUninitialize(); -#endif } // ---------------------------------------------------------------------------- @@ -191,7 +184,7 @@ private: // VZ: I don't know it's not done for compilers other than VC++ but I leave it // as is. Please note, though, that tracing OLE interface calls may be // incredibly useful when debugging OLE programs. -#if defined(__WXDEBUG__) && (( defined(__VISUALC__) && (__VISUALC__ >= 1000) )) +#if defined(__WXDEBUG__) && defined(__VISUALC__) // ---------------------------------------------------------------------------- // All OLE specific log functions have DebugTrace level (as LogTrace) // ---------------------------------------------------------------------------- @@ -354,4 +347,30 @@ inline void wxOleUninitialize() { } #endif // wxUSE_OLE/!wxUSE_OLE +// RAII class initializing OLE in its ctor and undoing it in its dtor. +class wxOleInitializer +{ +public: + wxOleInitializer() + : m_ok(wxOleInitialize()) + { + } + + bool IsOk() const + { + return m_ok; + } + + ~wxOleInitializer() + { + if ( m_ok ) + wxOleUninitialize(); + } + +private: + const bool m_ok; + + wxDECLARE_NO_COPY_CLASS(wxOleInitializer); +}; + #endif //_WX_OLEUTILS_H diff --git a/Externals/wxWidgets3/include/wx/msw/ole/safearray.h b/Externals/wxWidgets3/include/wx/msw/ole/safearray.h index 04dc335fdc..fb5c70a399 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/safearray.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/safearray.h @@ -267,7 +267,7 @@ public: internT* data; - if ( FAILED( SafeArrayPtrOfIndex(m_array, indices, (void**)&data) ) ) + if ( FAILED( SafeArrayPtrOfIndex(m_array, (LONG *)indices, (void**)&data) ) ) return false; return Convertor::ToArray(element, *data); @@ -284,7 +284,7 @@ public: internT* data; - if ( FAILED( SafeArrayPtrOfIndex(m_array, indices, (void**)&data) ) ) + if ( FAILED( SafeArrayPtrOfIndex(m_array, (LONG *)indices, (void**)&data) ) ) return false; return Convertor::FromArray(*data, element); diff --git a/Externals/wxWidgets3/include/wx/msw/ole/uuid.h b/Externals/wxWidgets3/include/wx/msw/ole/uuid.h index 2408450611..c712b79dd2 100644 --- a/Externals/wxWidgets3/include/wx/msw/ole/uuid.h +++ b/Externals/wxWidgets3/include/wx/msw/ole/uuid.h @@ -20,7 +20,6 @@ // ----- taken from RPC.H #ifndef UUID_DEFINED // in some cases RPC.H will be already - #ifdef __WIN32__ // included, so avoid redefinition typedef struct { unsigned long Data1; @@ -28,7 +27,6 @@ unsigned short Data3; unsigned char Data4[8]; } UUID; // UUID = GUID = CLSID = LIBID = IID - #endif // WIN32 #endif // UUID_DEFINED #ifndef GUID_DEFINED diff --git a/Externals/wxWidgets3/include/wx/msw/ownerdrawnbutton.h b/Externals/wxWidgets3/include/wx/msw/ownerdrawnbutton.h new file mode 100644 index 0000000000..2cb6c785f9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/ownerdrawnbutton.h @@ -0,0 +1,139 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/ownerdrawnbutton.h +// Purpose: Common base class for wxCheckBox and wxRadioButton +// Author: Vadim Zeitlin +// Created: 2014-05-04 +// Copyright: (c) 2014 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_OWNERDRAWNBUTTON_H_ +#define _WX_MSW_OWNERDRAWNBUTTON_H_ + +// ---------------------------------------------------------------------------- +// wxMSWOwnerDrawnButton: base class for any kind of Windows buttons +// ---------------------------------------------------------------------------- + +// This class contains the type-independent part of wxMSWOwnerDrawnButton and +// is implemented in src/msw/control.cpp. +// +// Notice that this class is internal implementation detail only and is +// intentionally not documented. Ideally it wouldn't be even exported from the +// DLL but this somehow breaks building of applications using wxWidgets with +// Intel compiler using LTCG, so we do export it. +class WXDLLIMPEXP_CORE wxMSWOwnerDrawnButtonBase +{ +protected: + // Ctor takes the back pointer to the real window, must be non-NULL. + wxMSWOwnerDrawnButtonBase(wxWindow* win) : + m_win(win) + { + m_isPressed = + m_isHot = false; + } + + // Explicitly define the destructor even if it's trivial to make it + // protected. This avoids compiler warnings about the fact that this class + // has virtual functions, but no virtual destructor without making the dtor + // virtual which is not needed here as objects are never deleted via + // pointers to this class (and protected dtor enforces this). + // + // Unfortunately g++ 3.4.5 still complains about the dtor being non virtual + // even if it is protected, but actually does not give any warnings if the + // dtor is not defined at all, so work around this 3.4.5 bug inside our + // general g++ workaround. +#if wxCHECK_GCC_VERSION(4, 0) + ~wxMSWOwnerDrawnButtonBase() { } +#endif // g++ 4.0+ + + // Make the control owner drawn if necessary to implement support for the + // given foreground colour. + void MSWMakeOwnerDrawnIfNecessary(const wxColour& colFg); + + // Return true if the control is currently owner drawn. + bool MSWIsOwnerDrawn() const; + + // Draw the button if the message information about which is provided in + // the given DRAWITEMSTRUCT asks us to do it, otherwise just return false. + bool MSWDrawButton(WXDRAWITEMSTRUCT *item); + + + // Methods which must be overridden in the derived concrete class. + + // Return the style to use for the non-owner-drawn button. + virtual int MSWGetButtonStyle() const = 0; + + // Called after reverting button to non-owner drawn state, provides a hook + // for wxCheckBox-specific hack. + virtual void MSWOnButtonResetOwnerDrawn() { } + + // Return the flags (such as wxCONTROL_CHECKED) to use for the control when + // drawing it. Notice that this class already takes care of the common + // logic and sets the other wxCONTROL_XXX flags on its own, this method + // really only needs to return the flags depending on the checked state. + virtual int MSWGetButtonCheckedFlag() const = 0; + + // Actually draw the check or radio bitmap, typically just by using the + // appropriate wxRendererNative method. + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) = 0; + + +private: + // Make the control owner drawn or reset it to normal style. + void MSWMakeOwnerDrawn(bool ownerDrawn); + + // Event handlers used to update the appearance of owner drawn button. + void OnMouseEnterOrLeave(wxMouseEvent& event); + void OnMouseLeft(wxMouseEvent& event); + void OnFocus(wxFocusEvent& event); + + + // The real window. + wxWindow* const m_win; + + // true if the checkbox is currently pressed + bool m_isPressed; + + // true if mouse is currently over the control + bool m_isHot; + + + wxDECLARE_NO_COPY_CLASS(wxMSWOwnerDrawnButtonBase); +}; + +// This class uses a weak version of CRTP, i.e. it's a template class taking +// the base class that the class deriving from it would normally derive from. +template +class wxMSWOwnerDrawnButton + : public T, + private wxMSWOwnerDrawnButtonBase +{ +private: + typedef T Base; + +public: + wxMSWOwnerDrawnButton() : wxMSWOwnerDrawnButtonBase(this) + { + } + + virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE + { + if ( !Base::SetForegroundColour(colour) ) + return false; + + MSWMakeOwnerDrawnIfNecessary(colour); + + return true; + } + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item) wxOVERRIDE + { + return MSWDrawButton(item) || Base::MSWOnDraw(item); + } + +protected: + bool IsOwnerDrawn() const { return MSWIsOwnerDrawn(); } +}; + +#endif // _WX_MSW_OWNERDRAWNBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/palette.h b/Externals/wxWidgets3/include/wx/msw/palette.h index 78477b4320..1f1d15736f 100644 --- a/Externals/wxWidgets3/include/wx/msw/palette.h +++ b/Externals/wxWidgets3/include/wx/msw/palette.h @@ -35,7 +35,7 @@ public: GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; - // implemetation + // implementation WXHPALETTE GetHPALETTE() const; void SetHPALETTE(WXHPALETTE pal); @@ -44,7 +44,7 @@ protected: virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxPalette) + wxDECLARE_DYNAMIC_CLASS(wxPalette); }; #endif // _WX_PALETTE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/pen.h b/Externals/wxWidgets3/include/wx/msw/pen.h index cb68780b43..7641cd4293 100644 --- a/Externals/wxWidgets3/include/wx/msw/pen.h +++ b/Externals/wxWidgets3/include/wx/msw/pen.h @@ -23,9 +23,6 @@ class WXDLLIMPEXP_CORE wxPen : public wxPenBase public: wxPen() { } wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); -#endif wxPen(const wxBitmap& stipple, int width); virtual ~wxPen() { } @@ -54,10 +51,13 @@ public: int GetDashCount() const; wxBitmap* GetStipple() const; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxPenStyle)style); } -#endif + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + // internal: wxGDIObject methods virtual bool RealizeResource(); @@ -72,7 +72,7 @@ protected: // same as FreeResource() + RealizeResource() bool Recreate(); - DECLARE_DYNAMIC_CLASS(wxPen) + wxDECLARE_DYNAMIC_CLASS(wxPen); }; #endif // _WX_PEN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/popupwin.h b/Externals/wxWidgets3/include/wx/msw/popupwin.h index d95c1dabc0..3fbd2d4dcc 100644 --- a/Externals/wxWidgets3/include/wx/msw/popupwin.h +++ b/Externals/wxWidgets3/include/wx/msw/popupwin.h @@ -35,10 +35,7 @@ public: virtual WXHWND MSWGetParent() const; protected: - // popups handle the position like wxTopLevelWindow, not wxWindow - virtual void DoGetPosition(int *x, int *y) const; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); }; #endif // _WX_MSW_POPUPWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/printdlg.h b/Externals/wxWidgets3/include/wx/msw/printdlg.h index 2955b89b3c..b3419cbdbb 100644 --- a/Externals/wxWidgets3/include/wx/msw/printdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/printdlg.h @@ -50,7 +50,7 @@ private: short m_customWindowsPaperId; private: - DECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData) + wxDECLARE_DYNAMIC_CLASS(wxWindowsPrintNativeData); }; // --------------------------------------------------------------------------- @@ -86,8 +86,8 @@ private: void* m_printDlg; private: + wxDECLARE_CLASS(wxWindowsPrintDialog); wxDECLARE_NO_COPY_CLASS(wxWindowsPrintDialog); - DECLARE_CLASS(wxWindowsPrintDialog) }; // --------------------------------------------------------------------------- @@ -116,7 +116,7 @@ private: void* m_pageDlg; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog); }; #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/Externals/wxWidgets3/include/wx/msw/printwin.h b/Externals/wxWidgets3/include/wx/msw/printwin.h index e5ef80b043..b6fceef7c6 100644 --- a/Externals/wxWidgets3/include/wx/msw/printwin.h +++ b/Externals/wxWidgets3/include/wx/msw/printwin.h @@ -19,7 +19,7 @@ class WXDLLIMPEXP_CORE wxWindowsPrinter : public wxPrinterBase { - DECLARE_DYNAMIC_CLASS(wxWindowsPrinter) + wxDECLARE_DYNAMIC_CLASS(wxWindowsPrinter); public: wxWindowsPrinter(wxPrintDialogData *data = NULL); @@ -59,7 +59,7 @@ protected: virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum); #endif - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/private.h b/Externals/wxWidgets3/include/wx/msw/private.h index 0f966b841b..6af753ff27 100644 --- a/Externals/wxWidgets3/include/wx/msw/private.h +++ b/Externals/wxWidgets3/include/wx/msw/private.h @@ -15,11 +15,6 @@ #include "wx/msw/wrapwin.h" -#ifdef __WXMICROWIN__ - // Extra prototypes and symbols not defined by MicroWindows - #include "wx/msw/microwin.h" -#endif - #include "wx/log.h" #if wxUSE_GUI @@ -72,12 +67,6 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); // define things missing from some compilers' headers // --------------------------------------------------------------------------- -#if defined(__WXWINCE__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) -#ifndef ZeroMemory - inline void ZeroMemory(void *buf, size_t len) { memset(buf, 0, len); } -#endif -#endif // old mingw32 - // this defines a CASTWNDPROC macro which casts a pointer to the type of a // window proc #if defined(STRICT) || defined(__GNUC__) @@ -99,22 +88,6 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #define APIENTRY FAR PASCAL #endif -#ifdef __WIN32__ - #define _EXPORT -#else - #define _EXPORT _export -#endif - -#ifndef __WIN32__ - typedef signed short int SHORT; -#endif - -#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs -#ifndef STRICT - #define DLGPROC FARPROC -#endif -#endif - /* * Decide what window classes we're going to use * for this combination of CTl3D/FAFA settings @@ -152,7 +125,7 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); // Generic subclass proc, for panel item moving/sizing and intercept // EDIT control VK_RETURN messages -extern LONG APIENTRY _EXPORT +extern LONG APIENTRY wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); // --------------------------------------------------------------------------- @@ -160,48 +133,64 @@ extern LONG APIENTRY _EXPORT // --------------------------------------------------------------------------- // a wrapper macro for ZeroMemory() -#if defined(__WIN32__) && !defined(__WXMICROWIN__) #define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj)) -#else -#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj)) -#endif // This one is a macro so that it can be tested with #ifdef, it will be // undefined if it cannot be implemented for a given compiler. // Vc++, bcc, dmc, ow, mingw akk have _get_osfhandle() and Cygwin has // get_osfhandle. Others are currently unknown, e.g. Salford, Intel, Visual // Age. -#if defined(__WXWINCE__) - #define wxGetOSFHandle(fd) ((HANDLE)fd) - #define wxOpenOSFHandle(h, flags) ((int)wxPtrToUInt(h)) -#elif defined(__CYGWIN__) +#if defined(__CYGWIN__) #define wxGetOSFHandle(fd) ((HANDLE)get_osfhandle(fd)) #elif defined(__VISUALC__) \ || defined(__BORLANDC__) \ - || defined(__DMC__) \ - || defined(__WATCOMC__) \ || defined(__MINGW32__) #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) + + wxDECL_FOR_STRICT_MINGW32(FILE*, _fdopen, (int, const char*)) #define wx_fdopen _fdopen #endif // close the handle in the class dtor +template class AutoHANDLE { public: - wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { } + wxEXPLICIT AutoHANDLE(HANDLE handle = InvalidHandle()) : m_handle(handle) { } - bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; } + bool IsOk() const { return m_handle != InvalidHandle(); } operator HANDLE() const { return m_handle; } - ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); } + ~AutoHANDLE() { if ( IsOk() ) DoClose(); } + + void Close() + { + wxCHECK_RET(IsOk(), wxT("Handle must be valid")); + + DoClose(); + + m_handle = InvalidHandle(); + } protected: - HANDLE m_handle; + // We need this helper function because integer INVALID_VALUE is not + // implicitly convertible to HANDLE, which is a pointer. + static HANDLE InvalidHandle() + { + return static_cast(INVALID_VALUE); + } + + void DoClose() + { + if ( !::CloseHandle(m_handle) ) + wxLogLastError(wxT("CloseHandle")); + } + + WXHANDLE m_handle; }; -// a template to make initializing Windows styructs less painful: it zeroes all +// a template to make initializing Windows structs less painful: it zeros all // the struct fields and also sets cbSize member to the correct value (and so // can be only used with structures which have this member...) template @@ -323,7 +312,7 @@ extern HBITMAP wxInvertMask(HBITMAP hbmpMask, int w = 0, int h = 0); // mask is created using light grey as the transparent colour. extern HICON wxBitmapToHICON(const wxBitmap& bmp); -// Same requirments as above apply and the bitmap must also have the correct +// Same requirements as above apply and the bitmap must also have the correct // size. extern HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY); @@ -592,6 +581,33 @@ public: operator HRGN() const { return (HRGN)GetObject(); } }; +// Class automatically freeing ICONINFO struct fields after retrieving it using +// GetIconInfo(). +class AutoIconInfo : public ICONINFO +{ +public: + AutoIconInfo() { wxZeroMemory(*this); } + + bool GetFrom(HICON hIcon) + { + if ( !::GetIconInfo(hIcon, this) ) + { + wxLogLastError(wxT("GetIconInfo")); + return false; + } + + return true; + } + + ~AutoIconInfo() + { + if ( hbmColor ) + ::DeleteObject(hbmColor); + if ( hbmMask ) + ::DeleteObject(hbmMask); + } +}; + // class sets the specified clipping region during its life time class HDCClipper { @@ -617,12 +633,6 @@ private: }; // set the given map mode for the life time of this object -// -// NB: SetMapMode() is not supported by CE so we also define a helper macro -// to avoid using it there -#ifdef __WXWINCE__ - #define wxCHANGE_HDC_MAP_MODE(hdc, mm) -#else // !__WXWINCE__ class HDCMapModeChanger { public: @@ -651,7 +661,6 @@ private: #define wxCHANGE_HDC_MAP_MODE(hdc, mm) \ HDCMapModeChanger wxMAKE_UNIQUE_NAME(wxHDCMapModeChanger)(hdc, mm) -#endif // __WXWINCE__/!__WXWINCE__ // smart pointer using GlobalAlloc/GlobalFree() class GlobalPtr @@ -813,7 +822,7 @@ private: // --------------------------------------------------------------------------- // macros to make casting between WXFOO and FOO a bit easier: the GetFoo() -// returns Foo cast to the Windows type for oruselves, while GetFooOf() takes +// returns Foo cast to the Windows type for ourselves, while GetFooOf() takes // an argument which should be a pointer or reference to the object of the // corresponding class (this depends on the macro) // --------------------------------------------------------------------------- @@ -899,6 +908,9 @@ inline wxString wxGetFullModuleName() // 0x0502 Windows XP SP2, 2003 SP1 // 0x0600 Windows Vista, 2008 // 0x0601 Windows 7 +// 0x0602 Windows 8 (currently also returned for 8.1 if program does not have a manifest indicating 8.1 support) +// 0x0603 Windows 8.1 (currently only returned for 8.1 if program has a manifest indicating 8.1 support) +// 0x1000 Windows 10 (currently only returned for 10 if program has a manifest indicating 10 support) // // for the other Windows versions 0 is currently returned enum wxWinVersion @@ -926,7 +938,12 @@ enum wxWinVersion wxWinVersion_Vista = wxWinVersion_6, wxWinVersion_NT6 = wxWinVersion_6, - wxWinVersion_7 = 0x601 + wxWinVersion_7 = 0x601, + + wxWinVersion_8 = 0x602, + wxWinVersion_8_1 = 0x603, + + wxWinVersion_10 = 0x1000 }; WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion(); @@ -987,6 +1004,79 @@ inline long wxSetWindowExStyle(const wxWindowMSW *win, long style) return ::SetWindowLong(GetHwndOf(win), GWL_EXSTYLE, style); } +// Common helper of wxUpdate{,Edit}LayoutDirection() below: sets or clears the +// given flag(s) depending on wxLayoutDirection and returns true if the flags +// really changed. +inline bool +wxUpdateExStyleForLayoutDirection(WXHWND hWnd, + wxLayoutDirection dir, + LONG_PTR flagsForRTL) +{ + wxCHECK_MSG( hWnd, false, + wxS("Can't set layout direction for invalid window") ); + + const LONG_PTR styleOld = ::GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + LONG_PTR styleNew = styleOld; + switch ( dir ) + { + case wxLayout_LeftToRight: + styleNew &= ~flagsForRTL; + break; + + case wxLayout_RightToLeft: + styleNew |= flagsForRTL; + break; + + case wxLayout_Default: + wxFAIL_MSG(wxS("Invalid layout direction")); + } + + if ( styleNew == styleOld ) + return false; + + ::SetWindowLongPtr(hWnd, GWL_EXSTYLE, styleNew); + + return true; +} + +// Update layout direction flag for a generic window. +// +// See below for the special version that must be used with EDIT controls. +// +// Returns true if the layout direction did change. +inline bool wxUpdateLayoutDirection(WXHWND hWnd, wxLayoutDirection dir) +{ + return wxUpdateExStyleForLayoutDirection(hWnd, dir, WS_EX_LAYOUTRTL); +} + +// Update layout direction flag for an EDIT control. +// +// Returns true if anything changed or false if the direction flag was already +// set to the desired direction (which can't be wxLayout_Default). +inline bool wxUpdateEditLayoutDirection(WXHWND hWnd, wxLayoutDirection dir) +{ + return wxUpdateExStyleForLayoutDirection(hWnd, dir, + WS_EX_RIGHT | + WS_EX_RTLREADING | + WS_EX_LEFTSCROLLBAR); +} + +// Companion of the above function checking if an EDIT control uses RTL. +inline wxLayoutDirection wxGetEditLayoutDirection(WXHWND hWnd) +{ + wxCHECK_MSG( hWnd, wxLayout_Default, wxS("invalid window") ); + + // While we set 3 style bits above, we're only really interested in one of + // them here. In particularly, don't check for WS_EX_RIGHT as it can be set + // for a right-aligned control even if it doesn't use RTL. And while we + // could test WS_EX_LEFTSCROLLBAR, this doesn't really seem useful. + const LONG_PTR style = ::GetWindowLongPtr(hWnd, GWL_EXSTYLE); + + return style & WS_EX_RTLREADING ? wxLayout_RightToLeft + : wxLayout_LeftToRight; +} + // ---------------------------------------------------------------------------- // functions mapping HWND to wxWindow // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/msw/private/event.h b/Externals/wxWidgets3/include/wx/msw/private/event.h new file mode 100644 index 0000000000..27825e49a7 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/private/event.h @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/event.h +// Purpose: Simple Windows 'event object' wrapper. +// Author: Troelsk, Vadim Zeitlin +// Created: 2014-05-07 +// Copyright: (c) 2014 wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_EVENT_H_ +#define _WX_MSW_PRIVATE_EVENT_H_ + +#include "wx/msw/private.h" + +namespace wxWinAPI +{ + +class Event : public AutoHANDLE<0> +{ +public: + enum Kind + { + ManualReset, + AutomaticReset + }; + + enum InitialState + { + Signaled, + Nonsignaled + }; + + Event() + { + } + + // Wrappers around {Create,Set,Reset}Event() Windows API functions, with + // the same semantics. + bool Create(Kind kind = AutomaticReset, + InitialState initialState = Nonsignaled, + const wxChar* name = NULL); + bool Set(); + bool Reset(); + +private: + wxDECLARE_NO_COPY_CLASS(Event); +}; + +} // namespace wxWinAPI + +// ---------------------------------------------------------------------------- +// Implementations requiring windows.h; these are to moved out-of-line if +// this class is moved to a public header, or if [parts of] msw/private.h is +// changed to not depend on windows.h being included. +// ---------------------------------------------------------------------------- + +inline bool +wxWinAPI::Event::Create(wxWinAPI::Event::Kind kind, + wxWinAPI::Event::InitialState initialState, + const wxChar* name) +{ + wxCHECK_MSG( !IsOk(), false, wxS("Event can't be created twice") ); + + WXHANDLE handle = ::CreateEvent(NULL, + kind == ManualReset, + initialState == Signaled, + name); + if ( !handle ) + { + wxLogLastError(wxS("CreateEvent")); + return false; + } + + m_handle = handle; + return true; +} + +inline bool wxWinAPI::Event::Set() +{ + wxCHECK_MSG( m_handle, false, wxS("Event must be valid") ); + + if ( !::SetEvent(m_handle) ) + { + wxLogLastError(wxS("SetEvent")); + return false; + } + + return true; +} + +inline bool wxWinAPI::Event::Reset() +{ + wxCHECK_MSG( m_handle, false, wxS("Event must be valid") ); + + if ( !::ResetEvent(m_handle) ) + { + wxLogLastError(wxS("ResetEvent")); + return false; + } + + return true; +} + +#endif // _WX_MSW_PRIVATE_EVENT_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h b/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h index 86f91dc3d0..055617b77c 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/msw/private/fswatcher.h @@ -173,7 +173,7 @@ public: // 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_removedWatches.push_back(watch); m_watches.erase(it); return true; @@ -185,15 +185,20 @@ public: // 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; + for ( Watches::iterator it = m_removedWatches.begin(); + it != m_removedWatches.end(); + ++it ) + { + if ( (*it).get() == watch ) + { + // Removing the object from here will result in deleting the + // watch itself as it's not referenced from anywhere else now. + m_removedWatches.erase(it); + return true; + } + } - // 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; + return false; } // post completion packet @@ -201,6 +206,7 @@ public: { wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); + // The special values of 0 will make GetStatus() return Status_Exit. int ret = PostQueuedCompletionStatus(m_iocp, 0, 0, NULL); if (!ret) { @@ -210,25 +216,52 @@ public: return ret != 0; } + // Possible return values of GetStatus() + enum Status + { + // Status successfully retrieved into the provided arguments. + Status_OK, + + // Special status indicating that we should exit retrieved. + Status_Exit, + + // An error occurred because the watched directory was deleted. + Status_Deleted, + + // Some other error occurred. + Status_Error + }; + // Wait for completion status to arrive. // This function can block forever in it's wait for completion status. // Use PostEmptyStatus() to wake it up (and end the worker thread) - bool GetStatus(unsigned long* count, wxFSWatchEntryMSW** watch, - OVERLAPPED** overlapped) + Status + GetStatus(DWORD* count, wxFSWatchEntryMSW** watch, + OVERLAPPED** overlapped) { - wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, false, "IOCP not init" ); - wxCHECK_MSG( count != NULL, false, "Null out parameter 'count'"); - wxCHECK_MSG( watch != NULL, false, "Null out parameter 'watch'"); - wxCHECK_MSG( overlapped != NULL, false, - "Null out parameter 'overlapped'"); + wxCHECK_MSG( m_iocp != INVALID_HANDLE_VALUE, Status_Error, + "Invalid IOCP object" ); + wxCHECK_MSG( count && watch && overlapped, Status_Error, + "Output parameters can't be NULL" ); int ret = GetQueuedCompletionStatus(m_iocp, count, (ULONG_PTR *)watch, overlapped, INFINITE); - if (!ret) + if ( ret != 0 ) { - wxLogSysError(_("Unable to dequeue completion packet")); + return *count || *watch || *overlapped ? Status_OK : Status_Exit; } - return ret != 0; + + // An error is returned if the underlying directory has been deleted, + // but this is not really an unexpected failure, so handle it + // specially. + if ( wxSysErrorCode() == ERROR_ACCESS_DENIED && + *watch && !wxFileName::DirExists((*watch)->GetPath()) ) + return Status_Deleted; + + // Some other error, at least log it. + wxLogSysError(_("Unable to dequeue completion packet")); + + return Status_Error; } protected: @@ -249,7 +282,8 @@ protected: wxFSWatchEntries m_watches; // Contains the watches which had been removed but are still pending. - wxFSWatchEntries m_removedWatches; + typedef wxVector< wxSharedPtr > Watches; + Watches m_removedWatches; }; @@ -267,8 +301,8 @@ protected: struct wxEventProcessingData { wxEventProcessingData(const FILE_NOTIFY_INFORMATION* ne, - const wxFSWatchEntryMSW* watch) : - nativeEvent(ne), watch(watch) + const wxFSWatchEntryMSW* watch_) : + nativeEvent(ne), watch(watch_) {} const FILE_NOTIFY_INFORMATION* nativeEvent; @@ -278,7 +312,7 @@ protected: virtual ExitCode Entry(); // wait for events to occur, read them and send to interested parties - // returns false it empty status was read, which means we whould exit + // returns false it empty status was read, which means we would exit // true otherwise bool ReadEvents(); diff --git a/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h b/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h index 20ccc4fff0..cb56df484b 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/private/msgdlg.h @@ -18,10 +18,7 @@ // by the task dialogs only. Also notice that task dialogs are available for // Unicode applications only. #if defined(TD_WARNING_ICON) && wxUSE_UNICODE -// (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 + #define wxHAS_MSW_TASKDIALOG #endif // Provides methods for creating a task dialog. @@ -59,7 +56,7 @@ namespace wxMSWMessageDialog wxString btnCancelLabel; wxString btnHelpLabel; - // Will create a task dialog with it's paremeters for it's creation + // Will create a task dialog with it's parameters for it's creation // stored in the provided TASKDIALOGCONFIG parameter. // NOTE: The wxMSWTaskDialogConfig object needs to remain accessible // during the subsequent call to TaskDialogIndirect(). diff --git a/Externals/wxWidgets3/include/wx/msw/private/sockmsw.h b/Externals/wxWidgets3/include/wx/msw/private/sockmsw.h index e0f550d329..fdde2f7017 100644 --- a/Externals/wxWidgets3/include/wx/msw/private/sockmsw.h +++ b/Externals/wxWidgets3/include/wx/msw/private/sockmsw.h @@ -21,7 +21,7 @@ # include #endif -#if defined(__WXWINCE__) || defined(__CYGWIN__) +#if defined(__CYGWIN__) #include #endif diff --git a/Externals/wxWidgets3/include/wx/msw/radiobox.h b/Externals/wxWidgets3/include/wx/msw/radiobox.h index 53620db9b3..270337f3d5 100644 --- a/Externals/wxWidgets3/include/wx/msw/radiobox.h +++ b/Externals/wxWidgets3/include/wx/msw/radiobox.h @@ -100,6 +100,8 @@ public: virtual void SetFocus(); virtual bool SetFont(const wxFont& font); virtual bool ContainsHWND(WXHWND hWnd) const; + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour); #if wxUSE_TOOLTIPS virtual bool HasToolTips() const; #endif // wxUSE_TOOLTIPS @@ -158,9 +160,7 @@ protected: virtual void DoSetItemToolTip(unsigned int n, wxToolTip * tooltip); #endif -#ifndef __WXWINCE__ virtual WXHRGN MSWGetRegionWithoutChildren(); -#endif // __WXWINCE__ // resolve ambiguity in base classes virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); } @@ -181,7 +181,7 @@ protected: int m_selectedButton; private: - DECLARE_DYNAMIC_CLASS(wxRadioBox) + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); wxDECLARE_NO_COPY_CLASS(wxRadioBox); }; diff --git a/Externals/wxWidgets3/include/wx/msw/radiobut.h b/Externals/wxWidgets3/include/wx/msw/radiobut.h index 4e9af38f70..f5708fb6ad 100644 --- a/Externals/wxWidgets3/include/wx/msw/radiobut.h +++ b/Externals/wxWidgets3/include/wx/msw/radiobut.h @@ -11,7 +11,9 @@ #ifndef _WX_RADIOBUT_H_ #define _WX_RADIOBUT_H_ -class WXDLLIMPEXP_CORE wxRadioButton: public wxControl +#include "wx/msw/ownerdrawnbutton.h" + +class WXDLLIMPEXP_CORE wxRadioButton : public wxMSWOwnerDrawnButton { public: // ctors and creation functions @@ -47,6 +49,7 @@ public: // implementation only from now on virtual bool MSWCommand(WXUINT param, WXWORD id); virtual void Command(wxCommandEvent& event); + virtual bool HasTransparentBackground() { return true; } virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; @@ -55,16 +58,24 @@ protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } virtual wxSize DoGetBestSize() const; + // Implement wxMSWOwnerDrawnButtonBase methods. + virtual int MSWGetButtonStyle() const wxOVERRIDE; + virtual void MSWOnButtonResetOwnerDrawn() wxOVERRIDE; + virtual int MSWGetButtonCheckedFlag() const wxOVERRIDE; + virtual void + MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) wxOVERRIDE; + + private: // common part of all ctors void Init(); + // we need to store the state internally as the result of GetValue() // sometimes gets out of sync in WM_COMMAND handler bool m_isChecked; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton); }; -#endif - // _WX_RADIOBUT_H_ +#endif // _WX_RADIOBUT_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/regconf.h b/Externals/wxWidgets3/include/wx/msw/regconf.h index ec290ec88c..312d1ba5f9 100644 --- a/Externals/wxWidgets3/include/wx/msw/regconf.h +++ b/Externals/wxWidgets3/include/wx/msw/regconf.h @@ -106,7 +106,7 @@ private: wxString m_strPath; wxDECLARE_NO_COPY_CLASS(wxRegConfig); - DECLARE_ABSTRACT_CLASS(wxRegConfig) + wxDECLARE_ABSTRACT_CLASS(wxRegConfig); }; #endif // wxUSE_CONFIG && wxUSE_REGKEY diff --git a/Externals/wxWidgets3/include/wx/msw/region.h b/Externals/wxWidgets3/include/wx/msw/region.h index aba0d536dc..54b4935b66 100644 --- a/Externals/wxWidgets3/include/wx/msw/region.h +++ b/Externals/wxWidgets3/include/wx/msw/region.h @@ -55,7 +55,7 @@ protected: friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; - DECLARE_DYNAMIC_CLASS(wxRegion) + wxDECLARE_DYNAMIC_CLASS(wxRegion); }; class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject @@ -97,7 +97,7 @@ private: wxRegion m_region; wxRect* m_rects; - DECLARE_DYNAMIC_CLASS(wxRegionIterator) + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); }; #endif // _WX_MSW_REGION_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/registry.h b/Externals/wxWidgets3/include/wx/msw/registry.h index 20343a540b..2c17d36145 100644 --- a/Externals/wxWidgets3/include/wx/msw/registry.h +++ b/Externals/wxWidgets3/include/wx/msw/registry.h @@ -123,7 +123,7 @@ public: // hKey should be opened and will be closed in wxRegKey dtor void SetHkey(WXHKEY hKey); - // get infomation about the key + // get information about the key // get the (full) key name. Abbreviate std root keys if bShortPrefix. wxString GetName(bool bShortPrefix = true) const; // Retrieves the registry view used by this key. @@ -132,7 +132,7 @@ public: bool Exists() const; // get the info about key (any number of these pointers may be NULL) bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys - size_t *pnMaxKeyLen, // max len of subkey name + size_t *pnMaxKeyLen, // max length of subkey name size_t *pnValues, // number of values size_t *pnMaxValueLen) const; // return true if the key is opened diff --git a/Externals/wxWidgets3/include/wx/msw/richmsgdlg.h b/Externals/wxWidgets3/include/wx/msw/richmsgdlg.h index 20c8eb72da..51cdc63222 100644 --- a/Externals/wxWidgets3/include/wx/msw/richmsgdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/richmsgdlg.h @@ -15,8 +15,8 @@ class WXDLLIMPEXP_CORE wxRichMessageDialog : public wxGenericRichMessageDialog public: wxRichMessageDialog(wxWindow *parent, const wxString& message, - const wxString& caption, - long style) + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK | wxCENTRE) : wxGenericRichMessageDialog(parent, message, caption, style) { } diff --git a/Externals/wxWidgets3/include/wx/msw/rightarr.cur b/Externals/wxWidgets3/include/wx/msw/rightarr.cur deleted file mode 100644 index c54c3ac4b09fa88728c865d94ae7665a35103f42..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcma*hu?@mN429u$0nw&IbV*4`OO=em2yBpymQgYS14Q@uO%6p!6!Gah+ozLdsZvtg zN*5h!mc-a5| diff --git a/Externals/wxWidgets3/include/wx/msw/rt/private/notifmsg.h b/Externals/wxWidgets3/include/wx/msw/rt/private/notifmsg.h new file mode 100644 index 0000000000..018218e9bb --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/rt/private/notifmsg.h @@ -0,0 +1,26 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rt/private/notifmsg.h +// Purpose: WinRT implementation of wxNotificationMessageImpl +// Author: Tobias Taschner +// Created: 2015-09-13 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifndef _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ +#define _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ + +#include "wx/notifmsg.h" +#include "wx/private/notifmsg.h" + +class wxToastNotificationHelper +{ +public: + static bool UseToasts(const wxString& shortcutPath, + const wxString& appId); + + static bool IsEnabled(); + + static wxNotificationMessageImpl* CreateInstance(wxNotificationMessageBase* notification); +}; + +#endif // _WX_MSW_RT_PRIVATE_NOTIFMSG_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/rt/utils.h b/Externals/wxWidgets3/include/wx/msw/rt/utils.h new file mode 100644 index 0000000000..b315531090 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/rt/utils.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/rt/utils.h +// Purpose: Windows Runtime Objects helper functions and objects +// Author: Tobias Taschner +// Created: 2015-09-05 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_RTUTILS_H +#define _WX_MSW_RTUTILS_H + +#include "wx/defs.h" + +#if wxUSE_WINRT + +#include "wx/string.h" +#include "wx/msw/wrapwin.h" + +#include + +namespace wxWinRT +{ + +bool WXDLLIMPEXP_CORE IsAvailable(); + +bool WXDLLIMPEXP_CORE Initialize(); + +void WXDLLIMPEXP_CORE Uninitialize(); + +bool WXDLLIMPEXP_CORE GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory); + +// RAII class initializing WinRT in its ctor and undoing it in its dtor. +class WXDLLIMPEXP_CORE Initializer +{ +public: + Initializer() + : m_ok(Initialize()) + { + } + + bool IsOk() const + { + return m_ok; + } + + ~Initializer() + { + if (m_ok) + Uninitialize(); + } + +private: + const bool m_ok; + + wxDECLARE_NO_COPY_CLASS(Initializer); +}; + +// Simple class to convert wxString to HSTRING +// This just wraps a reference to the wxString object, +// which needs a life time greater than the TempStringRef object +class WXDLLIMPEXP_CORE TempStringRef +{ +public: + HSTRING Get() const { return m_hstring; } + + operator HSTRING() const { return m_hstring; }; + + static const TempStringRef Make(const wxString &str); + +private: + TempStringRef(const wxString &str); + + HSTRING m_hstring; + HSTRING_HEADER m_header; + + wxDECLARE_NO_COPY_CLASS(TempStringRef); +}; + +} // namespace wxWinRT + +#endif // wxUSE_WINRT + +#endif // _WX_MSW_RTUTILS_H diff --git a/Externals/wxWidgets3/include/wx/msw/scrolbar.h b/Externals/wxWidgets3/include/wx/msw/scrolbar.h index 1b7c86295d..1e3023203b 100644 --- a/Externals/wxWidgets3/include/wx/msw/scrolbar.h +++ b/Externals/wxWidgets3/include/wx/msw/scrolbar.h @@ -67,7 +67,7 @@ protected: int m_viewSize; int m_objectSize; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/seh.h b/Externals/wxWidgets3/include/wx/msw/seh.h index a331570d75..cf27714f38 100644 --- a/Externals/wxWidgets3/include/wx/msw/seh.h +++ b/Externals/wxWidgets3/include/wx/msw/seh.h @@ -14,11 +14,11 @@ // the exception handler which should be called from the exception filter // - // it calsl wxApp::OnFatalException() if possible - extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); + // it calls wxApp::OnFatalException() if wxTheApp object exists + WXDLLIMPEXP_BASE unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs); // helper macro for wxSEH_HANDLE -#if defined(__BORLANDC__) || (defined(__VISUALC__) && (__VISUALC__ <= 1200)) +#if defined(__BORLANDC__) // some compilers don't understand that this code is unreachable and warn // about no value being returned from the function without it, so calm them // down @@ -46,7 +46,7 @@ #define wxSEH_HANDLE(rc) #endif // wxUSE_ON_FATAL_EXCEPTION -#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) && !defined(__WXWINCE__) +#if wxUSE_ON_FATAL_EXCEPTION && defined(__VISUALC__) #include // C++ exception to structured exceptions translator: we need it in order @@ -54,11 +54,10 @@ // as division by 0 or access violation) to C++ pseudo-exceptions extern void wxSETranslator(unsigned int code, EXCEPTION_POINTERS *ep); - // up to VC 11 this warning ("calling _set_se_translator() requires /EHa") - // is harmless and it's easier to suppress it than use different makefiles - // for VC5 and 6 (which don't support /EHa at all) and VC7+ (which does - // accept it but it seems to change nothing for it anyhow) - #if __VISUALC__ < 1800 + // up to VC 12 this warning ("calling _set_se_translator() requires /EHa") + // is harmless and it's easier to suppress it than deal with it as make/ + // project file level as it seems to be harmless + #if __VISUALC__ < 1900 #pragma warning(disable: 4535) #endif diff --git a/Externals/wxWidgets3/include/wx/msw/setup0.h b/Externals/wxWidgets3/include/wx/msw/setup0.h index f0b2e646cb..8ade54c2e9 100644 --- a/Externals/wxWidgets3/include/wx/msw/setup0.h +++ b/Externals/wxWidgets3/include/wx/msw/setup0.h @@ -26,16 +26,6 @@ // compatibility settings // ---------------------------------------------------------------------------- -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -44,7 +34,17 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -268,14 +268,21 @@ // Enable the use of compiler-specific thread local storage keyword, if any. // This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. // -// Default is 1, but set to 0 if the scenario above is applicable. +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. #define wxUSE_COMPILER_TLS 1 // ---------------------------------------------------------------------------- @@ -293,33 +300,30 @@ #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. +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // -// 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). +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. // -// 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 +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // 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 @@ -464,14 +468,7 @@ #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. +// allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // @@ -744,34 +741,21 @@ #define wxUSE_WEBVIEW_WEBKIT 0 #endif -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. +// as only MSVC is known to ship with at least gdiplus.h which is required to +// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later +// versions also include d2d1.h required for Direct2D-based implementation). +// For other compilers (e.g. mingw32) you may need to install the headers (and +// just the headers) yourself. If you do, change the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif +# define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. @@ -840,6 +824,7 @@ // Default is 1 // // Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton @@ -1009,6 +994,16 @@ // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1220,6 +1215,10 @@ // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 @@ -1310,8 +1309,7 @@ // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. @@ -1498,34 +1496,37 @@ /* --- start MSW options --- */ // ---------------------------------------------------------------------------- -// Windows-only settings +// Graphics backends choices for Windows // ---------------------------------------------------------------------------- -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. // -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net +// Default is 1. // -// Default is 0 +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. // -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 #endif -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- // Set this to 1 for generic OLE support: this is required for drag-and-drop, // clipboard, OLE Automation. Only set it to 0 if your compiler is very old and @@ -1552,6 +1553,19 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_) + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 @@ -1608,6 +1622,15 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/Externals/wxWidgets3/include/wx/msw/setup_inc.h b/Externals/wxWidgets3/include/wx/msw/setup_inc.h index 6905a7a8e6..eb01cbd540 100644 --- a/Externals/wxWidgets3/include/wx/msw/setup_inc.h +++ b/Externals/wxWidgets3/include/wx/msw/setup_inc.h @@ -8,34 +8,37 @@ /////////////////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- -// Windows-only settings +// Graphics backends choices for Windows // ---------------------------------------------------------------------------- -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. // -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net +// Default is 1. // -// Default is 0 +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. // -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 #endif -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- // Set this to 1 for generic OLE support: this is required for drag-and-drop, // clipboard, OLE Automation. Only set it to 0 if your compiler is very old and @@ -62,6 +65,19 @@ // Recommended setting: 1, required by wxMediaCtrl #define wxUSE_ACTIVEX 1 +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 1 +#else + #define wxUSE_WINRT 0 +#endif + // wxDC caching implementation #define wxUSE_DC_CACHEING 1 @@ -118,6 +134,15 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 diff --git a/Externals/wxWidgets3/include/wx/msw/slider.h b/Externals/wxWidgets3/include/wx/msw/slider.h index a16c5952e0..7579e834f1 100644 --- a/Externals/wxWidgets3/include/wx/msw/slider.h +++ b/Externals/wxWidgets3/include/wx/msw/slider.h @@ -91,6 +91,8 @@ public: virtual bool Show(bool show = true); virtual bool Enable(bool show = true); virtual bool SetFont(const wxFont& font); + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour); virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; @@ -118,9 +120,15 @@ protected: virtual void DoMoveWindow(int x, int y, int width, int height); virtual wxSize DoGetBestSize() const; + WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) wxOVERRIDE; + + // the labels windows, if any wxSubwindows *m_labels; + // Last background brush we returned from DoMSWControlColor(), see there. + WXHBRUSH m_hBrushBg; + int m_rangeMin; int m_rangeMax; int m_pageSize; @@ -134,7 +142,7 @@ protected: // Platform-specific implementation of SetTickFreq virtual void DoSetTickFreq(int freq); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider); }; #endif // _WX_SLIDER_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/spinbutt.h b/Externals/wxWidgets3/include/wx/msw/spinbutt.h index d50912fbf8..051cadf428 100644 --- a/Externals/wxWidgets3/include/wx/msw/spinbutt.h +++ b/Externals/wxWidgets3/include/wx/msw/spinbutt.h @@ -66,7 +66,7 @@ protected: virtual void NormalizeValue(); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton); }; #endif // wxUSE_SPINBTN diff --git a/Externals/wxWidgets3/include/wx/msw/spinctrl.h b/Externals/wxWidgets3/include/wx/msw/spinctrl.h index 9250292de0..28c16f5437 100644 --- a/Externals/wxWidgets3/include/wx/msw/spinctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/spinctrl.h @@ -111,6 +111,8 @@ public: // recognize buddy window as part of this control at wx level virtual bool ContainsHWND(WXHWND hWnd) const { return hWnd == m_hwndBuddy; } + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + protected: virtual void DoGetPosition(int *x, int *y) const; virtual void DoMoveWindow(int x, int y, int width, int height); @@ -137,7 +139,6 @@ protected: // called to ensure that the value is in the correct range virtual void NormalizeValue(); - // the value of the control before the latest change (which might not have // changed anything in fact -- this is why we need this field) int m_oldValue; @@ -159,8 +160,8 @@ private: void UpdateBuddyStyle(); - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxSpinCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/stackwalk.h b/Externals/wxWidgets3/include/wx/msw/stackwalk.h index 6ff467205e..e068ea2d95 100644 --- a/Externals/wxWidgets3/include/wx/msw/stackwalk.h +++ b/Externals/wxWidgets3/include/wx/msw/stackwalk.h @@ -19,6 +19,13 @@ struct _EXCEPTION_POINTERS; // and these in dbghelp.h struct _SYMBOL_INFO; +struct _SYMBOL_INFOW; + +#if wxUSE_UNICODE + #define wxSYMBOL_INFO _SYMBOL_INFOW +#else // !wxUSE_UNICODE + #define wxSYMBOL_INFO _SYMBOL_INFO +#endif // wxUSE_UNICODE/!wxUSE_UNICODE // ---------------------------------------------------------------------------- // wxStackFrame @@ -52,7 +59,7 @@ public: GetParam(size_t n, wxString *type, wxString *name, wxString *value) const; // callback used by OnGetParam(), don't call directly - void OnParam(_SYMBOL_INFO *pSymInfo); + void OnParam(wxSYMBOL_INFO *pSymInfo); protected: virtual void OnGetName(); diff --git a/Externals/wxWidgets3/include/wx/msw/statbmp.h b/Externals/wxWidgets3/include/wx/msw/statbmp.h index 165ddb5af1..443440f130 100644 --- a/Externals/wxWidgets3/include/wx/msw/statbmp.h +++ b/Externals/wxWidgets3/include/wx/msw/statbmp.h @@ -60,7 +60,7 @@ protected: virtual wxSize DoGetBestClientSize() const; // ctor/dtor helpers - void Init() { m_isIcon = true; m_image = NULL; m_currentHandle = 0; } + void Init(); void Free(); // true if icon/bitmap is valid @@ -69,11 +69,9 @@ protected: void SetImage(const wxGDIImage* image); void SetImageNoCopy( wxGDIImage* image ); -#ifndef __WXWINCE__ // draw the bitmap ourselves here if the OS can't do it correctly (if it // can we leave it to it) void DoPaintManually(wxPaintEvent& event); -#endif // !__WXWINCE__ void WXHandleSize(wxSizeEvent& event); @@ -85,7 +83,18 @@ protected: WXHANDLE m_currentHandle; private: - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + // Flag indicating whether we own m_currentHandle, i.e. should delete it. + bool m_ownsCurrentHandle; + + // Replace the image at the native control level with the given HBITMAP or + // HICON (which can be 0) and destroy the previous image if necessary. + void MSWReplaceImageHandle(WXLPARAM handle); + + // Delete the current handle only if we own it. + void DeleteCurrentHandleIfNeeded(); + + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxStaticBitmap); }; diff --git a/Externals/wxWidgets3/include/wx/msw/statbox.h b/Externals/wxWidgets3/include/wx/msw/statbox.h index 7721ccacb1..6ce580861b 100644 --- a/Externals/wxWidgets3/include/wx/msw/statbox.h +++ b/Externals/wxWidgets3/include/wx/msw/statbox.h @@ -45,7 +45,6 @@ public: protected: virtual wxSize DoGetBestSize() const; -#ifndef __WXWINCE__ public: virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); @@ -63,9 +62,8 @@ protected: virtual void PaintForeground(wxDC& dc, const struct tagRECT& rc); void OnPaint(wxPaintEvent& event); -#endif // !__WXWINCE__ - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox); }; #endif // _WX_MSW_STATBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/statline.h b/Externals/wxWidgets3/include/wx/msw/statline.h index 1d2662b3bb..ce4569448b 100644 --- a/Externals/wxWidgets3/include/wx/msw/statline.h +++ b/Externals/wxWidgets3/include/wx/msw/statline.h @@ -43,7 +43,7 @@ public: // usually overridden base class virtuals virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine); }; #endif // _WX_MSW_STATLINE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/stattext.h b/Externals/wxWidgets3/include/wx/msw/stattext.h index 9bbcca7141..5a478c3500 100644 --- a/Externals/wxWidgets3/include/wx/msw/stattext.h +++ b/Externals/wxWidgets3/include/wx/msw/stattext.h @@ -50,7 +50,7 @@ protected: virtual wxString DoGetLabel() const; virtual void DoSetLabel(const wxString& str); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText); }; #endif diff --git a/Externals/wxWidgets3/include/wx/msw/statusbar.h b/Externals/wxWidgets3/include/wx/msw/statusbar.h index b1d352a7cc..4aa4349959 100644 --- a/Externals/wxWidgets3/include/wx/msw/statusbar.h +++ b/Externals/wxWidgets3/include/wx/msw/statusbar.h @@ -103,7 +103,7 @@ private: // return the various status bar metrics static const MSWMetrics& MSWGetMetrics(); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBar); }; #endif // wxUSE_NATIVE_STATUSBAR diff --git a/Externals/wxWidgets3/include/wx/msw/stdpaths.h b/Externals/wxWidgets3/include/wx/msw/stdpaths.h index 80ad985044..965c079226 100644 --- a/Externals/wxWidgets3/include/wx/msw/stdpaths.h +++ b/Externals/wxWidgets3/include/wx/msw/stdpaths.h @@ -11,6 +11,8 @@ #ifndef _WX_MSW_STDPATHS_H_ #define _WX_MSW_STDPATHS_H_ +struct _GUID; + // ---------------------------------------------------------------------------- // wxStandardPaths // ---------------------------------------------------------------------------- @@ -26,7 +28,7 @@ public: virtual wxString GetUserDataDir() const; virtual wxString GetUserLocalDataDir() const; virtual wxString GetPluginsDir() const; - virtual wxString GetDocumentsDir() const; + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; // MSW-specific methods @@ -72,6 +74,8 @@ protected: // get the path corresponding to the given standard CSIDL_XXX constant static wxString DoGetDirectory(int csidl); + static wxString DoGetKnownFolder(const _GUID& rfid); + // return the directory of the application itself wxString GetAppDir() const; diff --git a/Externals/wxWidgets3/include/wx/msw/subwin.h b/Externals/wxWidgets3/include/wx/msw/subwin.h index 9e48b9e35f..b38d2037ad 100644 --- a/Externals/wxWidgets3/include/wx/msw/subwin.h +++ b/Externals/wxWidgets3/include/wx/msw/subwin.h @@ -128,6 +128,18 @@ public: } } + // add all windows to update region to force redraw + void Refresh() + { + for ( size_t n = 0; n < m_count; n++ ) + { + if ( m_hwnds[n] ) + { + ::InvalidateRect(m_hwnds[n], NULL, FALSE /* don't erase bg */); + } + } + } + // find the bounding box for all windows wxRect GetBoundingBox() const { @@ -152,6 +164,7 @@ private: { m_count = 0; m_hwnds = NULL; + m_ids = NULL; } // number of elements in m_hwnds array @@ -211,7 +224,29 @@ private: subwins->SetFont(font); \ \ return true; \ - } + } \ + \ + bool cname::SetForegroundColour(const wxColour& colour) \ + { \ + if ( !base::SetForegroundColour(colour) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Refresh(); \ + \ + return true; \ + } \ + \ + bool cname::SetBackgroundColour(const wxColour& colour) \ + { \ + if ( !base::SetBackgroundColour(colour) ) \ + return false; \ + \ + if ( subwins ) \ + subwins->Refresh(); \ + \ + return true; \ + } \ #endif // _WX_MSW_SUBWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/taskbar.h b/Externals/wxWidgets3/include/wx/msw/taskbar.h index c9a4a11ca5..3fe5c9b61b 100644 --- a/Externals/wxWidgets3/include/wx/msw/taskbar.h +++ b/Externals/wxWidgets3/include/wx/msw/taskbar.h @@ -49,7 +49,8 @@ public: bool ShowBalloon(const wxString& title, const wxString& text, unsigned msec = 0, - int flags = 0); + int flags = 0, + const wxIcon& icon = wxNullIcon); #endif // wxUSE_TASKBARICON_BALLOONS protected: @@ -64,7 +65,7 @@ protected: wxIcon m_icon; wxString m_strTooltip; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); }; #endif // _WX_TASKBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/taskbarbutton.h b/Externals/wxWidgets3/include/wx/msw/taskbarbutton.h new file mode 100644 index 0000000000..ed24df01ed --- /dev/null +++ b/Externals/wxWidgets3/include/wx/msw/taskbarbutton.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/msw/taskbarbutton.h +// Purpose: Defines wxTaskBarButtonImpl class. +// Author: Chaobin Zhang +// Created: 2014-06-01 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TASKBARBUTTON_H_ +#define _WX_MSW_TASKBARBUTTON_H_ + +#include "wx/defs.h" + +#if wxUSE_TASKBARBUTTON + +#include "wx/vector.h" +#include "wx/taskbarbutton.h" + +class WXDLLIMPEXP_FWD_CORE wxITaskbarList3; + +class WXDLLIMPEXP_CORE wxTaskBarButtonImpl : public wxTaskBarButton +{ +public: + virtual ~wxTaskBarButtonImpl(); + + virtual void SetProgressRange(int range) wxOVERRIDE; + virtual void SetProgressValue(int value) wxOVERRIDE; + virtual void PulseProgress() wxOVERRIDE; + virtual void Show(bool show = true) wxOVERRIDE; + virtual void Hide() wxOVERRIDE; + virtual void SetThumbnailTooltip(const wxString& tooltip) wxOVERRIDE; + virtual void SetProgressState(wxTaskBarButtonState state) wxOVERRIDE; + virtual void SetOverlayIcon(const wxIcon& icon, + const wxString& description = wxString()) wxOVERRIDE; + virtual void SetThumbnailClip(const wxRect& rect) wxOVERRIDE; + virtual void SetThumbnailContents(const wxWindow *child) wxOVERRIDE; + virtual bool InsertThumbBarButton(size_t pos, + wxThumbBarButton *button) wxOVERRIDE; + virtual bool AppendThumbBarButton(wxThumbBarButton *button) wxOVERRIDE; + virtual bool AppendSeparatorInThumbBar() wxOVERRIDE; + virtual wxThumbBarButton* RemoveThumbBarButton( + wxThumbBarButton *button) wxOVERRIDE; + virtual wxThumbBarButton* RemoveThumbBarButton(int id) wxOVERRIDE; + wxThumbBarButton* GetThumbBarButtonByIndex(size_t index); + bool InitOrUpdateThumbBarButtons(); + virtual void Realize() wxOVERRIDE; + +private: + // This ctor is only used by wxTaskBarButton::New() + wxTaskBarButtonImpl(wxITaskbarList3* taskbarList, wxWindow* parent); + + wxWindow* m_parent; + wxITaskbarList3 *m_taskbarList; + + typedef wxVector wxThumbBarButtons; + wxThumbBarButtons m_thumbBarButtons; + + int m_progressRange; + int m_progressValue; + wxTaskBarButtonState m_progressState; + wxString m_thumbnailTooltip; + wxIcon m_overlayIcon; + wxString m_overlayIconDescription; + wxRect m_thumbnailClipRect; + bool m_hasInitThumbnailToolbar; + + friend wxTaskBarButton* wxTaskBarButton::New(wxWindow*); + + wxDECLARE_NO_COPY_CLASS(wxTaskBarButtonImpl); +}; + +#endif // wxUSE_TASKBARBUTTON + +#endif // _WX_MSW_TASKBARBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/textctrl.h b/Externals/wxWidgets3/include/wx/msw/textctrl.h index 14265e7983..a2027003f7 100644 --- a/Externals/wxWidgets3/include/wx/msw/textctrl.h +++ b/Externals/wxWidgets3/include/wx/msw/textctrl.h @@ -74,9 +74,7 @@ public: virtual void MarkDirty(); virtual void DiscardEdits(); -#ifdef __WIN32__ virtual bool EmulateKeyPress(const wxKeyEvent& event); -#endif // __WIN32__ #if wxUSE_RICHEDIT // apply text attribute to the range of text (only works with richedit @@ -101,6 +99,9 @@ public: return wxTextCtrlBase::HitTest(pt, col, row); } + virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE; + virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE; + // Caret handling (Windows only) bool ShowNativeCaret(bool show = true); bool HideNativeCaret() { return ShowNativeCaret(false); } @@ -170,12 +171,20 @@ public: // EDIT control has one already) void OnContextMenu(wxContextMenuEvent& event); + // Create context menu for RICHEDIT controls. This may be called once during + // the control's lifetime or every time the menu is shown, depending on + // implementation. + virtual wxMenu *MSWCreateContextMenu(); + // be sure the caret remains invisible if the user // called HideNativeCaret() before void OnSetFocus(wxFocusEvent& event); // intercept WM_GETDLGCODE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; @@ -184,8 +193,6 @@ protected: // common part of all ctors void Init(); - virtual bool DoLoadFile(const wxString& file, int fileType); - // creates the control of appropriate class (plain or rich edit) with the // styles corresponding to m_windowStyle // @@ -203,14 +210,7 @@ protected: // the limit is due to a previous call to SetMaxLength() and not built in) bool HasSpaceLimit(unsigned int *len) const; - // call this to increase the size limit (will do nothing if the current - // limit is big enough) - // - // returns true if we increased the limit to allow entering more text, - // false if we hit the limit set by SetMaxLength() and so didn't change it - bool AdjustSpaceLimit(); - -#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) +#if wxUSE_RICHEDIT && !wxUSE_UNICODE // replace the selection or the entire control contents with the given text // in the specified encoding bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); @@ -250,6 +250,9 @@ protected: // the paragraph styles globally. bool MSWSetParaFormat(const wxTextAttr& attr, long from, long to); + // Send wxEVT_CONTEXT_MENU event from here if the control doesn't do it on + // its own. + void OnRightUp(wxMouseEvent& event); // we're using RICHEDIT (and not simple EDIT) control if this field is not // 0, it also gives the version of the RICHEDIT control being used @@ -274,8 +277,15 @@ private: void OnKeyDown(wxKeyEvent& event); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) + // Used by EN_MAXTEXT handler to increase the size limit (will do nothing + // if the current limit is big enough). Should never be called directly. + // + // Returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it. + bool AdjustSpaceLimit(); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl); wxMenu* m_privateContextMenu; diff --git a/Externals/wxWidgets3/include/wx/msw/textentry.h b/Externals/wxWidgets3/include/wx/msw/textentry.h index 80b9e23966..2590b83191 100644 --- a/Externals/wxWidgets3/include/wx/msw/textentry.h +++ b/Externals/wxWidgets3/include/wx/msw/textentry.h @@ -47,6 +47,7 @@ public: virtual void SetEditable(bool editable); virtual void SetMaxLength(unsigned long len); + virtual void ForceUpper(); #if wxUSE_UXTHEME virtual bool SetHint(const wxString& hint); @@ -98,5 +99,8 @@ private: #endif // wxUSE_OLE }; +// We don't need the generic version. +#define wxHAS_NATIVE_TEXT_FORCEUPPER + #endif // _WX_MSW_TEXTENTRY_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/tglbtn.h b/Externals/wxWidgets3/include/wx/msw/tglbtn.h index 091978b865..0dec96fa11 100644 --- a/Externals/wxWidgets3/include/wx/msw/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/msw/tglbtn.h @@ -46,8 +46,6 @@ public: 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; } @@ -56,13 +54,15 @@ protected: virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + virtual bool MSWIsPushed() const; + void Init(); // current state of the button (when owner-drawn) bool m_state; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton); }; //----------------------------------------------------------------------------- @@ -103,7 +103,7 @@ public: virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); } private: - DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton) + wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton); }; #endif // _WX_TOGGLEBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/tls.h b/Externals/wxWidgets3/include/wx/msw/tls.h index 9d46cadf3e..e14fd541ca 100644 --- a/Externals/wxWidgets3/include/wx/msw/tls.h +++ b/Externals/wxWidgets3/include/wx/msw/tls.h @@ -34,7 +34,14 @@ public: // get the key value, there is no error return void *Get() const { - return ::TlsGetValue(m_slot); + // Exceptionally, TlsGetValue() calls SetLastError() even on success + // which means it overwrites the previous value. This is undesirable + // here, so explicitly preserve the last error here. + const DWORD dwLastError = ::GetLastError(); + void* const value = ::TlsGetValue(m_slot); + if ( dwLastError ) + ::SetLastError(dwLastError); + return value; } // change the key value, return true if ok diff --git a/Externals/wxWidgets3/include/wx/msw/toolbar.h b/Externals/wxWidgets3/include/wx/msw/toolbar.h index 0c6b7e9c9a..772e99aa12 100644 --- a/Externals/wxWidgets3/include/wx/msw/toolbar.h +++ b/Externals/wxWidgets3/include/wx/msw/toolbar.h @@ -26,7 +26,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr) { Init(); @@ -38,7 +38,7 @@ public: wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr); virtual ~wxToolBar(); @@ -56,6 +56,8 @@ public: virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); + virtual void SetToolPacking(int packing); + // implementation only from now on // ------------------------------- @@ -134,6 +136,8 @@ protected: // get the Windows toolbar style of this control long GetMSWToolbarStyle() const; + // set native toolbar padding + void MSWSetPadding(WXWORD padding); // the big bitmap containing all bitmaps of the toolbar buttons WXHBITMAP m_hBitmap; @@ -170,8 +174,8 @@ private: WXHBRUSH MSWGetToolbarBgBrush(); #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxToolBar); wxDECLARE_NO_COPY_CLASS(wxToolBar); }; diff --git a/Externals/wxWidgets3/include/wx/msw/tooltip.h b/Externals/wxWidgets3/include/wx/msw/tooltip.h index 39ffe0d6da..4c3be08cec 100644 --- a/Externals/wxWidgets3/include/wx/msw/tooltip.h +++ b/Externals/wxWidgets3/include/wx/msw/tooltip.h @@ -69,7 +69,14 @@ public: // makes sense to use it for tooltips associated with a single window only. void SetRect(const wxRect& rc); + // Called when TLW shown state is changed and hides the tooltip itself if + // the window it's associated with is hidden. + static void UpdateVisibility(); + private: + // This module calls our DeleteToolTipCtrl(). + friend class wxToolTipModule; + // Adds a window other than our main m_window to this tooltip. void DoAddHWND(WXHWND hWnd); @@ -88,12 +95,18 @@ private: // create the tooltip ctrl if it doesn't exist yet and return its HWND static WXHWND GetToolTipCtrl(); + // to be used in wxModule for deleting tooltip ctrl window when exiting mainloop + static void DeleteToolTipCtrl(); + // new tooltip maximum width, defaults to min(display width, 400) static int ms_maxWidth; // remove this tooltip from the tooltip control void Remove(); + // adjust tooltip max width based on current tooltip text + bool AdjustMaxWidth(); + wxString m_text; // tooltip text wxWindow* m_window; // main window we're associated with wxToolTipOtherWindows *m_others; // other windows associated with it or NULL @@ -101,7 +114,7 @@ private: // (or a rect with width/height == 0 to show it for the entire window) unsigned int m_id; // the id of this tooltip (ignored when m_rect width/height is 0) - DECLARE_ABSTRACT_CLASS(wxToolTip) + wxDECLARE_ABSTRACT_CLASS(wxToolTip); wxDECLARE_NO_COPY_CLASS(wxToolTip); }; diff --git a/Externals/wxWidgets3/include/wx/msw/toplevel.h b/Externals/wxWidgets3/include/wx/msw/toplevel.h index fd1de18d80..3a847e2f4d 100644 --- a/Externals/wxWidgets3/include/wx/msw/toplevel.h +++ b/Externals/wxWidgets3/include/wx/msw/toplevel.h @@ -68,6 +68,8 @@ public: // wxMSW only: EnableCloseButton(false) may be used to remove the "Close" // button from the title bar virtual bool EnableCloseButton(bool enable = true); + virtual bool EnableMaximizeButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable = true) wxOVERRIDE; // Set window transparency if the platform supports it virtual bool SetTransparent(wxByte alpha); @@ -97,18 +99,6 @@ public: void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } wxWindow *GetLastFocus() const { return m_winLastFocused; } -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); -#endif // __SMARTPHONE__ && __WXWINCE__ - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - // Soft Input Panel (SIP) change notification - virtual bool HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam); -#endif - // translate wxWidgets flags to Windows ones virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; @@ -121,22 +111,6 @@ public: // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } -#if wxUSE_MENUS - bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - - // 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); - - // Find the menu corresponding to the given handle. - virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); -#endif // wxUSE_MENUS - protected: // common part of all ctors void Init(); @@ -158,10 +132,8 @@ protected: // override those to return the normal window coordinates even when the // window is minimized -#ifndef __WXWINCE__ virtual void DoGetPosition(int *x, int *y) const; virtual void DoGetSize(int *width, int *height) const; -#endif // __WXWINCE__ // Top level windows have different freeze semantics on Windows virtual void DoFreeze(); @@ -206,56 +178,13 @@ protected: // from iconic state (done by wxFrame). wxWindow *m_winLastFocused; -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - class ButtonMenu - { - public: - ButtonMenu(); - ~ButtonMenu(); - - void SetButton(int id = wxID_ANY, - const wxString& label = wxEmptyString, - wxMenu *subMenu = NULL); - - bool IsAssigned() const {return m_assigned;} - bool IsMenu() const {return m_menu!=NULL;} - - int GetId() const {return m_id;} - wxMenu* GetMenu() const {return m_menu;} - wxString GetLabel() {return m_label;} - - static wxMenu *DuplicateMenu(wxMenu *menu); - - protected: - int m_id; - wxString m_label; - wxMenu *m_menu; - bool m_assigned; - }; - - ButtonMenu m_LeftButton; - ButtonMenu m_RightButton; - HWND m_MenuBarHWND; - - void ReloadButton(ButtonMenu& button, UINT menuID); - void ReloadAllButtons(); -#endif // __SMARTPHONE__ && __WXWINCE__ - private: -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - void* m_activateInfo; -#endif - // The system menu: initially NULL but can be set (once) by // MSWGetSystemMenu(). Owned by this window. wxMenu *m_menuSystem; - // The number of currently opened menus: 0 initially, 1 when a top level - // menu is opened, 2 when its submenu is opened and so on. - int m_menuDepth; - - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowMSW); }; diff --git a/Externals/wxWidgets3/include/wx/msw/treectrl.h b/Externals/wxWidgets3/include/wx/msw/treectrl.h index 341f31b528..914cddc395 100644 --- a/Externals/wxWidgets3/include/wx/msw/treectrl.h +++ b/Externals/wxWidgets3/include/wx/msw/treectrl.h @@ -33,15 +33,6 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_CORE wxDragImage; struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; -#if WXWIN_COMPATIBILITY_2_6 - // NB: all the following flags are for compatbility only and will be removed in the - // next versions - // flags for deprecated InsertItem() variant (their values are the same as of - // TVI_FIRST and TVI_LAST) - #define wxTREE_INSERT_FIRST 0xFFFF0001 - #define wxTREE_INSERT_LAST 0xFFFF0002 -#endif - // hash storing attributes for our items WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); @@ -348,7 +339,7 @@ private: friend class wxTreeItemIndirectData; friend class wxTreeSortHelper; - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) + wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl); wxDECLARE_NO_COPY_CLASS(wxTreeCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/msw/uxtheme.h b/Externals/wxWidgets3/include/wx/msw/uxtheme.h index 5c4eae981d..f15973e305 100644 --- a/Externals/wxWidgets3/include/wx/msw/uxtheme.h +++ b/Externals/wxWidgets3/include/wx/msw/uxtheme.h @@ -84,10 +84,32 @@ private: wxDECLARE_NO_COPY_CLASS(wxUxThemeFont); }; +typedef int(__stdcall *DTT_CALLBACK_PROC)(HDC hdc, const wchar_t * pszText, int cchText, RECT * prc, unsigned int dwFlags, WXLPARAM lParam); + +typedef struct _DTTOPTS +{ + DWORD dwSize; + DWORD dwFlags; + COLORREF crText; + COLORREF crBorder; + COLORREF crShadow; + int iTextShadowType; + POINT ptShadowOffset; + int iBorderSize; + int iFontPropId; + int iColorPropId; + int iStateId; + BOOL fApplyOverlay; + int iGlowSize; + DTT_CALLBACK_PROC pfnDrawTextCallback; + WXLPARAM lParam; +} DTTOPTS, *PDTTOPTS; + typedef HTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(HWND, const wchar_t *); typedef HRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(HTHEME); typedef HRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(HTHEME, HDC, int, int, const RECT *, const RECT *); typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, DWORD, const RECT *); +typedef HRESULT (__stdcall *PFNWXUDRAWTHEMETEXTEX)(HTHEME, HDC, int, int, const wchar_t *, int, DWORD, RECT *, const DTTOPTS *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(HTHEME, HDC, int, int, const RECT *, RECT *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(HTHEME, HDC, int, int, const RECT *, RECT *); typedef HRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(HTHEME, HDC, int, int, const RECT *, /* enum */ THEMESIZE, SIZE *); @@ -161,6 +183,7 @@ public: wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData) wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground) wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText) + wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXTEX, DrawThemeTextEx) wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect) wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent) wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize) diff --git a/Externals/wxWidgets3/include/wx/msw/webview_ie.h b/Externals/wxWidgets3/include/wx/msw/webview_ie.h index bc19ee85ae..07f7cc6738 100644 --- a/Externals/wxWidgets3/include/wx/msw/webview_ie.h +++ b/Externals/wxWidgets3/include/wx/msw/webview_ie.h @@ -143,7 +143,7 @@ public: void onActiveXEvent(wxActiveXEvent& evt); void onEraseBg(wxEraseEvent&) {} - DECLARE_EVENT_TABLE(); + wxDECLARE_EVENT_TABLE(); protected: virtual void DoSetPage(const wxString& html, const wxString& baseUrl); diff --git a/Externals/wxWidgets3/include/wx/msw/webview_missing.h b/Externals/wxWidgets3/include/wx/msw/webview_missing.h index fc2b8bc045..514ae1e56c 100644 --- a/Externals/wxWidgets3/include/wx/msw/webview_missing.h +++ b/Externals/wxWidgets3/include/wx/msw/webview_missing.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: include/wx/msw/webview_missing.h -// Purpose: Defintions / classes commonly missing used by wxWebViewIE +// Purpose: Definitions / classes commonly missing used by wxWebViewIE // Author: Steven Lamerton // Copyright: (c) 2012 Steven Lamerton // Licence: wxWindows licence @@ -692,7 +692,7 @@ public: virtual HRESULT wxSTDCALL get_onpropertychange(VARIANT *p) = 0; virtual HRESULT wxSTDCALL getClientRects(wxIHTMLRectCollection **pRectCol) = 0; virtual HRESULT wxSTDCALL getBoundingClientRect(wxIHTMLRect **pRect) = 0; - virtual HRESULT wxSTDCALL setExpression(BSTR propname, BSTR expression, BSTR language = L"") = 0; + virtual HRESULT wxSTDCALL setExpression(BSTR propname, BSTR expression, BSTR language) = 0; virtual HRESULT wxSTDCALL getExpression(BSTR propname, VARIANT *expression) = 0; virtual HRESULT wxSTDCALL removeExpression(BSTR propname, VARIANT_BOOL *pfSuccess) = 0; virtual HRESULT wxSTDCALL put_tabIndex(short v) = 0; diff --git a/Externals/wxWidgets3/include/wx/msw/wince/checklst.h b/Externals/wxWidgets3/include/wx/msw/wince/checklst.h deleted file mode 100644 index 61121298bc..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/checklst.h +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/checklst.h -// Purpose: wxCheckListBox class - a listbox with checkable items -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.10.2005 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef __CHECKLSTCE__H_ -#define __CHECKLSTCE__H_ - -class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase -{ -public: - // ctors - wxCheckListBox(); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int nStrings = 0, - const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - virtual ~wxCheckListBox(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - // items may be checked - virtual bool IsChecked(unsigned int uiIndex) const; - virtual void Check(unsigned int uiIndex, bool bCheck = true); - - // public interface derived from wxListBox and lower classes - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - virtual wxString GetString(unsigned int n) const; - virtual bool IsSelected(int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // Implementation - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); -protected: - - void OnSize(wxSizeEvent& event); - - // protected interface derived from wxListBox and lower classes - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - - virtual void* DoGetItemClientData(unsigned int n) const; - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void DoSetFirstItem(int n); - virtual void DoSetSelection(int n, bool select); - // convert our styles to Windows - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - -private: - wxArrayPtrVoid m_itemsClientData; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) -}; - -#endif //_CHECKLSTCE_H diff --git a/Externals/wxWidgets3/include/wx/msw/wince/chkconf.h b/Externals/wxWidgets3/include/wx/msw/wince/chkconf.h deleted file mode 100644 index 00785067ee..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/chkconf.h +++ /dev/null @@ -1,150 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/chkconf.h -// Purpose: WinCE-specific configuration options checks -// Author: Vadim Zeitlin -// Modified by: -// Created: 2005-03-07 -// Copyright: (c) 2005 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MSW_WINCE_CHKCONF_H_ -#define _WX_MSW_WINCE_CHKCONF_H_ - -// ---------------------------------------------------------------------------- -// Disable features which don't work or don't make sense under CE -// ---------------------------------------------------------------------------- - -// please keep the list in alphabetic order except for closely related settings -// (e.g. wxUSE_ENH_METAFILE is put immediately after wxUSE_METAFILE) - -#undef wxUSE_DEBUGREPORT -#define wxUSE_DEBUGREPORT 0 - -#if _WIN32_WCE < 400 - // not enough API and lack of ddraw.h - #undef wxUSE_DISPLAY - #define wxUSE_DISPLAY 0 -#endif - -// eVC doesn't have standard streams -#ifdef __EVC4__ - #undef wxUSE_STD_IOSTREAM - #define wxUSE_STD_IOSTREAM 0 -#endif - -// wxFSVolume currently doesn't compile under CE and it's not clear if it makes -// sense at all there (the drives and their names are fixed on CE systems) -#undef wxUSE_FSVOLUME -#define wxUSE_FSVOLUME 0 - -// no .INI files API under CE -#undef wxUSE_INICONF -#define wxUSE_INICONF 0 - -// DDE doesn't exist under WinCE and wxIPC is DDE-based under MSW -#undef wxUSE_IPC -#define wxUSE_IPC 0 - -// doesn't make sense for CE devices and doesn't compile anyhow -#undef wxUSE_JOYSTICK -#define wxUSE_JOYSTICK 0 - -// libtiff doesn't build with eVC but is ok with VC8 -#ifdef __EVC4__ - #undef wxUSE_LIBTIFF - #define wxUSE_LIBTIFF 0 -#endif - -// no AUI under CE: it's unnecessary and currently doesn't compile -#undef wxUSE_AUI -#define wxUSE_AUI 0 - -// no MDI under CE -#undef wxUSE_MDI -#define wxUSE_MDI 0 -#undef wxUSE_MDI_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 0 - -// metafiles are not supported neither -#undef wxUSE_METAFILE -#define wxUSE_METAFILE 0 -#undef wxUSE_ENH_METAFILE -#define wxUSE_ENH_METAFILE 0 - -// not sure if this is supported by CE but it doesn't compile currently anyhow -#undef wxUSE_MS_HTML_HELP -#define wxUSE_MS_HTML_HELP 0 - -// eVC doesn't support SEH -#undef wxUSE_ON_FATAL_EXCEPTION -#define wxUSE_ON_FATAL_EXCEPTION 0 - -// no owner drawn controls (not sure if this is possible at all but in any case -// the code doesn't currently compile) -#undef wxUSE_OWNER_DRAWN -#define wxUSE_OWNER_DRAWN 0 - -#undef wxUSE_PRINTING_ARCHITECTURE -#define wxUSE_PRINTING_ARCHITECTURE 0 - -// regex doesn't build with eVC but is ok with VC8 -#ifdef __EVC4__ - #undef wxUSE_REGEX - #define wxUSE_REGEX 0 -#endif - -#undef wxUSE_RICHEDIT -#define wxUSE_RICHEDIT 0 -#undef wxUSE_RICHEDIT2 -#define wxUSE_RICHEDIT2 0 - -// Standard SDK lacks a few things, forcefully disable them -#ifdef WCE_PLATFORM_STANDARDSDK - // no shell functions support - #undef wxUSE_STDPATHS - #define wxUSE_STDPATHS 0 -#endif // WCE_PLATFORM_STANDARDSDK - -// there is no support for balloon taskbar icons -#undef wxUSE_TASKBARICON_BALLOONS -#define wxUSE_TASKBARICON_BALLOONS 0 - -// not sure if this is supported by eVC but VC8 SDK lacks the tooltips control -// related declarations -#if wxCHECK_VISUALC_VERSION(8) - #undef wxUSE_TOOLTIPS - #define wxUSE_TOOLTIPS 0 -#endif - -#undef wxUSE_UNICODE_MSLU -#define wxUSE_UNICODE_MSLU 0 - -#undef wxUSE_UXTHEME -#define wxUSE_UXTHEME 0 - -#undef wxUSE_WXHTML_HELP -#define wxUSE_WXHTML_HELP 0 - - -// Disable features which don't make sense for MS Smartphones -// (due to pointer device usage, limited controls or dialogs, file system) -#if defined(__SMARTPHONE__) - #undef wxUSE_LISTBOOK - #define wxUSE_LISTBOOK 0 - - #undef wxUSE_NOTEBOOK - #define wxUSE_NOTEBOOK 0 - - #undef wxUSE_STATUSBAR - #define wxUSE_STATUSBAR 0 - - #undef wxUSE_COLOURPICKERCTRL - #define wxUSE_COLOURPICKERCTRL 0 - - #undef wxUSE_COLOURDLG - #define wxUSE_COLOURDLG 0 -#endif // __SMARTPHONE__ - -#endif // _WX_MSW_WINCE_CHKCONF_H_ - diff --git a/Externals/wxWidgets3/include/wx/msw/wince/choicece.h b/Externals/wxWidgets3/include/wx/msw/wince/choicece.h deleted file mode 100644 index e280be7fdc..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/choicece.h +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/choicece.h -// Purpose: wxChoice implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 29.07.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CHOICECE_H_BASE_ -#define _WX_CHOICECE_H_BASE_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" - -#if wxUSE_CHOICE - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxChoice; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); - -// ---------------------------------------------------------------------------- -// Choice item -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase -{ -public: - // ctors - wxChoice() { } - virtual ~wxChoice(); - - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - wxChoice(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr) - { - Create(parent, id, pos, size, choices, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxChoiceNameStr); - - // implement base class pure virtuals - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); - - virtual unsigned int GetCount() const; - virtual int GetSelection() const; - virtual void SetSelection(int n); - - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - - // get the subclassed window proc of the buddy list of choices - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // return the choice object whose buddy is the given window or NULL - static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - -protected: - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - - virtual WXHWND MSWGetItemsHWND() const { return m_hwndBuddy; } - - // MSW implementation - virtual void DoGetPosition(int *x, int *y) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - virtual void DoGetSize(int *width, int *height) const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // create and initialize the control - bool CreateAndInit(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name); - - // the data for the "buddy" list - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - - // all existing wxChoice - this allows to find the one corresponding to - // the given buddy window in GetSpinChoiceCtrl() - static wxArrayChoiceSpins ms_allChoiceSpins; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) -}; - -#endif // wxUSE_CHOICE - -#endif // _WX_CHOICECE_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/helpwce.h b/Externals/wxWidgets3/include/wx/msw/wince/helpwce.h deleted file mode 100644 index 20cd4e405c..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/helpwce.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/helpwce.h -// Purpose: Help system: Windows CE help implementation -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPWCE_H_ -#define _WX_HELPWCE_H_ - -#if wxUSE_HELP - -#include "wx/helpbase.h" - -class WXDLLIMPEXP_CORE wxWinceHelpController : public wxHelpControllerBase -{ -public: - wxWinceHelpController(wxWindow* parentWindow = NULL): wxHelpControllerBase(parentWindow) {} - virtual ~wxWinceHelpController() {} - - // Must call this to set the filename - virtual bool Initialize(const wxString& file); - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = wxEmptyString); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplaySection(const wxString& section); - virtual bool DisplayBlock(long blockNo); - virtual bool DisplayContextPopup(int contextId); - virtual bool DisplayTextPopup(const wxString& text, const wxPoint& pos); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - virtual bool Quit(); - - wxString GetHelpFile() const { return m_helpFile; } - -protected: - // Append extension if necessary. - wxString GetValidFilename(const wxString& file) const; - - // View topic, or just the HTML file - bool ViewURL(const wxString& topic = wxEmptyString); - -private: - wxString m_helpFile; - - DECLARE_CLASS(wxWinceHelpController) -}; - -#endif // wxUSE_MS_HTML_HELP - -#endif -// _WX_HELPWCE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/libraries.h b/Externals/wxWidgets3/include/wx/msw/wince/libraries.h deleted file mode 100644 index d05e604ca2..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/libraries.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/libraries.h -// Purpose: VC++ pragmas for linking against SDK libs -// Author: Vaclav Slavik -// Modified by: -// Created: 2004-04-11 -// Copyright: (c) 2004 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_LIBRARIES_H_ -#define _WX_LIBRARIES_H_ - -// NB: According to Microsoft, it is up to the OEM to decide whether -// some of libraries will be included in the system or not. For example, -// MS' STANDARDSDK does not include cyshell.lib and aygshell.lib, while -// Pocket PC 2003 SDK does. We depend on some symbols that are in these -// libraries in some SDKs and in different libs in others. Fortunately we -// can detect what SDK is used in C++ code, so we take advantage of -// VC++'s #pragma to link against the libraries conditionally, instead of -// including libraries in project files. - -#if defined(__VISUALC__) && defined(__WXWINCE__) - -#if (_WIN32_WCE >= 400) || defined(__POCKETPC__) - // No commdlg.lib in Mobile 5.0 Smartphone -#if !(defined(__SMARTPHONE__) && _WIN32_WCE >= 1200) - #pragma comment(lib,"commdlg.lib") -#endif -#endif - -// this library is only available for PocketPC targets using recent SDK and is -// needed for RTTI support -#if (_WIN32_WCE >= 400) && !defined(__WINCE_NET__) && !defined(wxNO_RTTI) - #pragma comment(lib,"ccrtrtti.lib") -#endif - -#if defined(__WINCE_STANDARDSDK__) - // DoDragDrop: - #pragma comment(lib,"olece400.lib") -#elif defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WINCE_NET__) - #pragma comment(lib,"ceshell.lib") - #pragma comment(lib,"aygshell.lib") -#elif defined(__HANDHELDPC__) - // Handheld PC builds. Maybe WindowsCE.NET 4.X needs another symbol. - #pragma comment(lib,"ceshell.lib") -#else - #error "Unknown SDK, please fill-in missing pieces" -#endif - -#endif // __VISUALC__ && __WXWINCE__ - -#endif // _WX_LIBRARIES_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/missing.h b/Externals/wxWidgets3/include/wx/msw/wince/missing.h deleted file mode 100644 index 73f48bea1e..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/missing.h +++ /dev/null @@ -1,139 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/missing.h -// Purpose: Missing things in WinCE -// Author: Marco Cavallini -// Modified by: -// Created: 16/11/2002 -// Copyright: (c) KOAN SAS ( www.koansoftware.com ) -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CE_MISSING_H_ -#define _WX_CE_MISSING_H_ - -#include "wx/msw/private.h" -#include "shellapi.h" - -inline BOOL IsIconic( HWND WXUNUSED(hWnd) ) -{ - // Probably not right... -#if 0 - long style = GetWindowLong(hWnd, GWL_STYLE); - return ((style & WS_MINIMIZE) == 0); -#endif - return FALSE; -} - -#ifdef __POCKETPC__ -#define SM_CXCURSOR 13 -#define SM_CYCURSOR 14 -#endif - -// Missing from eVC 4 for some reason -#ifndef I_IMAGENONE -#define I_IMAGENONE (-2) -#endif - -#ifndef TBSTYLE_NO_DROPDOWN_ARROW -#define TBSTYLE_NO_DROPDOWN_ARROW 0x0080 -#endif - -#ifndef SHCMBM_GETMENU -#define SHCMBM_GETMENU (WM_USER + 402) -#endif - -#ifndef SHCMBM_SETSUBMENU -#define SHCMBM_SETSUBMENU (WM_USER + 400) // wparam == id of button, lParam == hmenu, return is old hmenu -#endif - -#ifndef SHCMBM_GETSUBMENU -#define SHCMBM_GETSUBMENU (WM_USER + 401) // lParam == ID -#endif - -#ifndef LVS_EX_FULLROWSELECT - #define LVS_EX_FULLROWSELECT 0x00000020 -#endif - -#ifndef TVS_FULLROWSELECT - #define TVS_FULLROWSELECT 0x1000 -#endif - -#ifndef TVM_SETBKCOLOR - #define TVM_SETBKCOLOR (TV_FIRST + 29) - #define TVM_SETTEXTCOLOR (TV_FIRST + 30) -#endif - -// Used in msgdlg.cpp, evtloop.cpp -#ifndef MB_TASKMODAL -#define MB_TASKMODAL 0x2000 -#endif - -#ifndef HGDI_ERROR -#define HGDI_ERROR ((HANDLE)(0xFFFFFFFFL)) -#endif - -// some windows styles don't exist in CE SDK, replace them with closest -// equivalents -#ifndef WS_THICKFRAME - #define WS_THICKFRAME WS_BORDER -#endif - -#ifndef WS_MINIMIZE - #define WS_MINIMIZE 0 -#endif - -#ifndef WS_MAXIMIZE - #define WS_MAXIMIZE 0 -#endif - - -// global memory functions don't exist under CE (good riddance, of course, but -// the existing code still uses them in some places, so make it compile) -// -// update: they're defined in eVC 4 inside "#ifdef UNDER_CE" block -#ifndef UNDER_CE - #define GlobalAlloc LocalAlloc - #define GlobalFree LocalFree - #define GlobalSize LocalSize - #define GPTR LPTR - #define GHND LPTR - #define GMEM_MOVEABLE 0 - #define GMEM_SHARE 0 -#endif // !UNDER_CE - -// WinCE RTL doesn't implement bsearch() used in encconv.cpp -extern "C" void * -bsearch(const void *key, const void *base, size_t num, size_t size, - int (wxCMPFUNC_CONV *cmp)(const void *, const void *)); - -#define O_RDONLY 0x0000 /* open for reading only */ -#define O_WRONLY 0x0001 /* open for writing only */ -#define O_RDWR 0x0002 /* open for reading and writing */ -#define O_APPEND 0x0008 /* writes done at eof */ - -#define O_CREAT 0x0100 /* create and open file */ -#define O_TRUNC 0x0200 /* open and truncate */ -#define O_EXCL 0x0400 /* open only if file doesn't already exist */ - -#define O_TEXT 0x4000 /* file mode is text (translated) */ -#define O_BINARY 0x8000 /* file mode is binary (untranslated) */ - -#ifndef SS_SUNKEN - #define SS_SUNKEN 0x00001000L -#endif - -// unsupported flags for WINDOWPOS structure -#ifndef SWP_NOCOPYBITS - #define SWP_NOCOPYBITS 0 -#endif - -#ifndef SWP_NOOWNERZORDER - #define SWP_NOOWNERZORDER 0 -#endif - -#ifndef SWP_NOSENDCHANGING - #define SWP_NOSENDCHANGING 0 -#endif - -#endif // _WX_CE_MISSING_H_ - diff --git a/Externals/wxWidgets3/include/wx/msw/wince/net.h b/Externals/wxWidgets3/include/wx/msw/wince/net.h deleted file mode 100644 index f99209bd55..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/net.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 1998, Ben Goetter. All rights reserved. - -/* - patch holes in winsock - - WCE 2.0 lacks many of the 'database' winsock routines. - Stub just enough them for ss.dll. - - getprotobynumber - getservbyport - getservbyname - -*/ - -struct servent * WINSOCKAPI getservbyport(int port, const char * proto) ; - -struct servent * WINSOCKAPI getservbyname(const char * name, - const char * proto) ; -struct protoent * WINSOCKAPI getprotobynumber(int proto) ; - diff --git a/Externals/wxWidgets3/include/wx/msw/wince/resources.h b/Externals/wxWidgets3/include/wx/msw/wince/resources.h deleted file mode 100644 index f080518950..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/resources.h +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/resources.h -// Purpose: identifiers shared between resource compiler and eVC -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 01.05.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// Windows CE dummy menu for SHCreateMenuBar() -#define wxIDM_SHMENU 40000 - -#define IDM_LEFT 40001 -#define IDM_RIGHT 40002 -#define IDM_ITEM 40003 - -#define IDS_EMPTY 40010 - -#define IDR_POPUP_1 40020 -#define IDR_POPUP_2 40021 - -#define IDR_MENUBAR_ONE_BUTTON 40030 -#define IDR_MENUBAR_LEFT_MENU 40031 -#define IDR_MENUBAR_RIGHT_MENU 40032 -#define IDR_MENUBAR_BOTH_MENUS 40033 diff --git a/Externals/wxWidgets3/include/wx/msw/wince/setup.h b/Externals/wxWidgets3/include/wx/msw/wince/setup.h deleted file mode 100644 index 9da5f70df9..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/setup.h +++ /dev/null @@ -1,1596 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/setup.h -// Purpose: Configuration for the library -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SETUP_H_ -#define _WX_SETUP_H_ - -/* --- start common options --- */ -// ---------------------------------------------------------------------------- -// global settings -// ---------------------------------------------------------------------------- - -// define this to 0 when building wxBase library - this can also be done from -// makefile/project file overriding the value here -#ifndef wxUSE_GUI - #define wxUSE_GUI 1 -#endif // wxUSE_GUI - -// ---------------------------------------------------------------------------- -// compatibility settings -// ---------------------------------------------------------------------------- - -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - -// This setting determines the compatibility with 2.8 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 - -// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when -// default system font is used for wxWindow::GetCharWidth/Height() instead of -// the current font. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxDIALOG_UNIT_COMPATIBILITY 0 - -// ---------------------------------------------------------------------------- -// debugging settings -// ---------------------------------------------------------------------------- - -// wxDEBUG_LEVEL will be defined as 1 in wx/debug.h so normally there is no -// need to define it here. You may do it for two reasons: either completely -// disable/compile out the asserts in release version (then do it inside #ifdef -// NDEBUG) or, on the contrary, enable more asserts, including the usually -// disabled ones, in the debug build (then do it inside #ifndef NDEBUG) -// -// #ifdef NDEBUG -// #define wxDEBUG_LEVEL 0 -// #else -// #define wxDEBUG_LEVEL 2 -// #endif - -// wxHandleFatalExceptions() may be used to catch the program faults at run -// time and, instead of terminating the program with a usual GPF message box, -// call the user-defined wxApp::OnFatalException() function. If you set -// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. -// -// This setting is for Win32 only and can only be enabled if your compiler -// supports Win32 structured exception handling (currently only VC++ does) -// -// Default is 1 -// -// Recommended setting: 1 if your compiler supports it. -#define wxUSE_ON_FATAL_EXCEPTION 1 - -// Set this to 1 to be able to generate a human-readable (unlike -// machine-readable minidump created by wxCrashReport::Generate()) stack back -// trace when your program crashes using wxStackWalker -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_STACKWALKER 1 - -// Set this to 1 to compile in wxDebugReport class which allows you to create -// and optionally upload to your web site a debug report consisting of back -// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. -// -// Default is 1 if supported by the compiler. -// -// Recommended setting: 1, it is compiled into a separate library so there -// is no overhead if you don't use it -#define wxUSE_DEBUGREPORT 1 - -// Generic comment about debugging settings: they are very useful if you don't -// use any other memory leak detection tools such as Purify/BoundsChecker, but -// are probably redundant otherwise. Also, Visual C++ CRT has the same features -// as wxWidgets memory debugging subsystem built in since version 5.0 and you -// may prefer to use it instead of built in memory debugging code because it is -// faster and more fool proof. -// -// Using VC++ CRT memory debugging is enabled by default in debug build (_DEBUG -// is defined) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) -// and if __NO_VC_CRTDBG__ is not defined. - -// The rest of the options in this section are obsolete and not supported, -// enable them at your own risk. - -// If 1, enables wxDebugContext, for writing error messages to file, etc. If -// __WXDEBUG__ is not defined, will still use the normal memory operators. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_CONTEXT 0 - -// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* -// __WXDEBUG__ is also defined. -// -// WARNING: this code may not work with all architectures, especially if -// alignment is an issue. This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 1 if you are not using a memory debugging tool, else 0 -#define wxUSE_MEMORY_TRACING 0 - -// In debug mode, cause new and delete to be redefined globally. -// If this causes problems (e.g. link errors which is a common problem -// especially if you use another library which also redefines the global new -// and delete), set this to 0. -// This switch is currently ignored for mingw / cygwin -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 - -// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If -// this causes problems (e.g. link errors), set this to 0. You may need to set -// this to 0 if using templates (at least for VC++). This switch is currently -// ignored for MinGW/Cygwin. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_DEBUG_NEW_ALWAYS 0 - - -// ---------------------------------------------------------------------------- -// Unicode support -// ---------------------------------------------------------------------------- - -// These settings are obsolete: the library is always built in Unicode mode -// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if -// absolutely necessary -- updating it is strongly recommended as the ANSI mode -// will disappear completely in future wxWidgets releases. -#ifndef wxUSE_UNICODE - #define wxUSE_UNICODE 1 -#endif - -// wxUSE_WCHAR_T is required by wxWidgets now, don't change. -#define wxUSE_WCHAR_T 1 - -// ---------------------------------------------------------------------------- -// global features -// ---------------------------------------------------------------------------- - -// Compile library in exception-safe mode? If set to 1, the library will try to -// behave correctly in presence of exceptions (even though it still will not -// use the exceptions itself) and notify the user code about any unhandled -// exceptions. If set to 0, propagation of the exceptions through the library -// code will lead to undefined behaviour -- but the code itself will be -// slightly smaller and faster. -// -// Note that like wxUSE_THREADS this option is automatically set to 0 if -// wxNO_EXCEPTIONS is defined. -// -// Default is 1 -// -// Recommended setting: depends on whether you intend to use C++ exceptions -// in your own code (1 if you do, 0 if you don't) -#define wxUSE_EXCEPTIONS 1 - -// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI -// -// Default is 0 -// -// Recommended setting: 0 (this is still work in progress...) -#define wxUSE_EXTENDED_RTTI 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. -// -// Default is 1 -// -// Recommended setting: 1 (always) -#define wxUSE_LOG 1 - -// Recommended setting: 1 -#define wxUSE_LOGWINDOW 1 - -// Recommended setting: 1 -#define wxUSE_LOGGUI 1 - -// Recommended setting: 1 -#define wxUSE_LOG_DIALOG 1 - -// Support for command line parsing using wxCmdLineParser class. -// -// Default is 1 -// -// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) -#define wxUSE_CMDLINE_PARSER 1 - -// Support for multithreaded applications: if 1, compile in thread classes -// (thread.h) and make the library a bit more thread safe. Although thread -// support is quite stable by now, you may still consider recompiling the -// library without it if you have no use for it - this will result in a -// somewhat smaller and faster operation. -// -// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset -// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in -// build/msw/config.* file this value will have no effect. -// -// Default is 1 -// -// Recommended setting: 0 unless you do plan to develop MT applications -#define wxUSE_THREADS 1 - -// If enabled, compiles wxWidgets streams classes -// -// wx stream classes are used for image IO, process IO redirection, network -// protocols implementation and much more and so disabling this results in a -// lot of other functionality being lost. -// -// Default is 1 -// -// Recommended setting: 1 as setting it to 0 disables many other things -#define wxUSE_STREAMS 1 - -// 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 -// of wxVsnprintf. The standard vsnprintf() supports positional parameters on -// many Unix systems but usually doesn't under Windows. -// -// Positional parameters are very useful when translating a program since using -// them in formatting strings allow translators to correctly reorder the -// translated sentences. -// -// Default is 1 -// -// Recommended setting: 1 if you want to support multiple languages -#define wxUSE_PRINTF_POS_PARAMS 1 - -// Enable the use of compiler-specific thread local storage keyword, if any. -// This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. -// -// Default is 1, but set to 0 if the scenario above is applicable. -#define wxUSE_COMPILER_TLS 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 -// ---------------------------------------------------------------------------- - -// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit -// integer which is implemented in terms of native 64 bit integers if any or -// uses emulation otherwise. -// -// This class is required by wxDateTime and so you should enable it if you want -// to use wxDateTime. For most modern platforms, it will use the native 64 bit -// integers in which case (almost) all of its functions are inline and it -// almost does not take any space, so there should be no reason to switch it -// off. -// -// Recommended setting: 1 -#define wxUSE_LONGLONG 1 - -// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for -// storing binary data in wxConfig on most platforms. -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_BASE64 1 - -// Set this to 1 to be able to use wxEventLoop even in console applications -// (i.e. using base library only, without GUI). This is mostly useful for -// processing socket events but is also necessary to use timers in console -// applications -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_CONSOLE_EVENTLOOP 1 - -// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level -// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. -// -// Default is 1 -// -// Recommended setting: 1 (wxFile is highly recommended as it is required by -// i18n code, wxFileConfig and others) -#define wxUSE_FILE 1 -#define wxUSE_FFILE 1 - -// Use wxFSVolume class providing access to the configured/active mount points -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely disabled if you don't use it) -#define wxUSE_FSVOLUME 1 - -// Use wxStandardPaths class which allows to retrieve some standard locations -// in the file system -// -// Default is 1 -// -// Recommended setting: 1 (may be disabled to save space, but not much) -#define wxUSE_STDPATHS 1 - -// use wxTextBuffer class: required by wxTextFile -#define wxUSE_TEXTBUFFER 1 - -// use wxTextFile class: requires wxFile and wxTextBuffer, required by -// wxFileConfig -#define wxUSE_TEXTFILE 1 - -// i18n support: _() macro, wxLocale class. Requires wxTextFile. -#define wxUSE_INTL 1 - -// Provide wxFoo_l() functions similar to standard foo() functions but taking -// an extra locale parameter. -// -// Notice that this is fully implemented only for the systems providing POSIX -// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary -// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will -// only work for the current user locale and "C" locale. You can use -// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. -// -// Default is 1 -// -// Recommended setting: 1 but may be disabled if you are writing programs -// running only in C locale anyhow -#define wxUSE_XLOCALE 1 - -// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. -// -// Requires: wxUSE_LONGLONG -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_DATETIME 1 - -// Set wxUSE_TIMER to 1 to compile wxTimer class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_TIMER 1 - -// Use wxStopWatch clas. -// -// Default is 1 -// -// Recommended setting: 1 (needed by wxSocket) -#define wxUSE_STOPWATCH 1 - -// Set wxUSE_FSWATCHER to 1 if you want to enable wxFileSystemWatcher -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FSWATCHER 1 - -// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes -// which allow the application to store its settings in the persistent -// storage. Setting this to 1 will also enable on-demand creation of the -// global config object in wxApp. -// -// See also wxUSE_CONFIG_NATIVE below. -// -// Recommended setting: 1 -#define wxUSE_CONFIG 1 - -// If wxUSE_CONFIG is 1, you may choose to use either the native config -// classes under Windows (using .INI files under Win16 and the registry under -// Win32) or the portable text file format used by the config classes under -// Unix. -// -// Default is 1 to use native classes. Note that you may still use -// wxFileConfig even if you set this to 1 - just the config object created by -// default for the applications needs will be a wxRegConfig or wxIniConfig and -// not wxFileConfig. -// -// Recommended setting: 1 -#define wxUSE_CONFIG_NATIVE 1 - -// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows -// to connect/disconnect from the network and be notified whenever the dial-up -// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DIALUP_MANAGER 1 - -// Compile in classes for run-time DLL loading and function calling. -// Required by wxUSE_DIALUP_MANAGER. -// -// This setting is for Win32 only -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DYNLIB_CLASS 1 - -// experimental, don't use for now -#define wxUSE_DYNAMIC_LOADER 1 - -// Set to 1 to use socket classes -#define wxUSE_SOCKETS 1 - -// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) -// -// Notice that currently setting this option under Windows will result in -// programs which can only run on recent OS versions (with ws2_32.dll -// installed) which is why it is disabled by default. -// -// Default is 1. -// -// Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 - -// Set to 1 to enable virtual file systems (required by wxHTML) -#define wxUSE_FILESYSTEM 1 - -// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ZIP 1 - -// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_ARCHIVE 1 - -// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) -#define wxUSE_FS_INET 1 - -// wxArchive classes for accessing archives such as zip and tar -#define wxUSE_ARCHIVE_STREAMS 1 - -// Set to 1 to compile wxZipInput/OutputStream classes. -#define wxUSE_ZIPSTREAM 1 - -// Set to 1 to compile wxTarInput/OutputStream classes. -#define wxUSE_TARSTREAM 1 - -// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by -// wxUSE_LIBPNG -#define wxUSE_ZLIB 1 - -// If enabled, the code written by Apple will be used to write, in a portable -// way, float on the disk. See extended.c for the license which is different -// from wxWidgets one. -// -// Default is 1. -// -// Recommended setting: 1 unless you don't like the license terms (unlikely) -#define wxUSE_APPLE_IEEE 1 - -// Joystick support class -#define wxUSE_JOYSTICK 1 - -// wxFontEnumerator class -#define wxUSE_FONTENUM 1 - -// wxFontMapper class -#define wxUSE_FONTMAP 1 - -// wxMimeTypesManager class -#define wxUSE_MIMETYPE 1 - -// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP -// or wxURL you need to set this to 1. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_PROTOCOL 1 - -// The settings for the individual URL schemes -#define wxUSE_PROTOCOL_FILE 1 -#define wxUSE_PROTOCOL_FTP 1 -#define wxUSE_PROTOCOL_HTTP 1 - -// Define this to use wxURL class. -#define wxUSE_URL 1 - -// Define this to use native platform url and protocol support. -// Currently valid only for MS-Windows. -// Note: if you set this to 1, you can open ftp/http/gopher sites -// and obtain a valid input stream for these sites -// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. -// Doing so reduces the code size. -// -// This code is experimental and subject to change. -#define wxUSE_URL_NATIVE 0 - -// Support for wxVariant class used in several places throughout the library, -// notably in wxDataViewCtrl API. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size as much as -// possible in which case setting this to 0 can gain up to 100KB. -#define wxUSE_VARIANT 1 - -// Support for wxAny class, the successor for wxVariant. -// -// Default is 1. -// -// Recommended setting: 1 unless you want to reduce the library size by a small amount, -// or your compiler cannot for some reason cope with complexity of templates used. -#define wxUSE_ANY 1 - -// Support for regular expression matching via wxRegEx class: enable this to -// use POSIX regular expressions in your code. You need to compile regex -// library from src/regex to use it under Windows. -// -// Default is 0 -// -// Recommended setting: 1 if your compiler supports it, if it doesn't please -// contribute us a makefile for src/regex for it -#define wxUSE_REGEX 1 - -// wxSystemOptions class -#define wxUSE_SYSTEM_OPTIONS 1 - -// wxSound class -#define wxUSE_SOUND 1 - -// Use wxMediaCtrl -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 - -// Use wxWidget's XRC XML-based resource system. Recommended. -// -// Default is 1 -// -// Recommended setting: 1 (requires wxUSE_XML) -#define wxUSE_XRC 1 - -// XML parsing classes. Note that their API will change in the future, so -// using wxXmlDocument and wxXmlNode in your app is not recommended. -// -// Default is the same as wxUSE_XRC, i.e. 1 by default. -// -// Recommended setting: 1 (required by XRC) -#define wxUSE_XML wxUSE_XRC - -// Use wxWidget's AUI docking system -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_AUI 1 - -// Use wxWidget's Ribbon classes for interfaces -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_RIBBON 1 - -// Use wxPropertyGrid. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_PROPGRID 1 - -// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. -// -// Default is 1 -// -// 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) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. -// -// Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. -// -// Recommended setting: 1 if supported by the compilation environment - -// notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is -// included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined -#ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif -#else - // Disable support for other Windows compilers, enable it if your compiler - // comes with new enough SDK or you installed the headers manually. - // - // Notice that this will be set by configure under non-Windows platforms - // anyhow so the value there is not important. -# define wxUSE_GRAPHICS_CONTEXT 0 -#endif - -// Enable wxGraphicsContext implementation using Cairo library. -// -// This is not needed under Windows and detected automatically by configure -// under other systems, however you may set this to 1 manually if you installed -// Cairo under Windows yourself and prefer to use it instead the native GDI+ -// implementation. -// -// Default is 0 -// -// Recommended setting: 0 -#define wxUSE_CAIRO 0 - - -// ---------------------------------------------------------------------------- -// Individual GUI controls -// ---------------------------------------------------------------------------- - -// You must set wxUSE_CONTROLS to 1 if you are using any controls at all -// (without it, wxControl class is not compiled) -// -// Default is 1 -// -// Recommended setting: 1 (don't change except for very special programs) -#define wxUSE_CONTROLS 1 - -// Support markup in control labels, i.e. provide wxControl::SetLabelMarkup(). -// Currently markup is supported only by a few controls and only some ports but -// their number will increase with time. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you want to save on code size) -#define wxUSE_MARKUP 1 - -// wxPopupWindow class is a top level transient window. It is currently used -// to implement wxTipWindow -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) -#define wxUSE_POPUPWIN 1 - -// wxTipWindow allows to implement the custom tooltips, it is used by the -// context help classes. Requires wxUSE_POPUPWIN. -// -// Default is 1 -// -// Recommended setting: 1 (may be set to 0) -#define wxUSE_TIPWINDOW 1 - -// Each of the settings below corresponds to one wxWidgets control. They are -// all switched on by default but may be disabled if you are sure that your -// program (including any standard dialogs it can show!) doesn't need them and -// if you desperately want to save some space. If you use any of these you must -// set wxUSE_CONTROLS as well. -// -// Default is 1 -// -// 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 -#define wxUSE_CHECKBOX 1 // wxCheckBox -#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) -#define wxUSE_CHOICE 1 // wxChoice -#define wxUSE_COLLPANE 1 // wxCollapsiblePane -#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl -#define wxUSE_COMBOBOX 1 // wxComboBox -#define wxUSE_COMMANDLINKBUTTON 1 // wxCommandLinkButton -#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl -#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl -#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl -#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox -#define wxUSE_FILECTRL 1 // wxFileCtrl -#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl -#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl -#define wxUSE_GAUGE 1 // wxGauge -#define wxUSE_HEADERCTRL 1 // wxHeaderCtrl -#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl -#define wxUSE_LISTBOX 1 // wxListBox -#define wxUSE_LISTCTRL 1 // wxListCtrl -#define wxUSE_RADIOBOX 1 // wxRadioBox -#define wxUSE_RADIOBTN 1 // wxRadioButton -#define wxUSE_RICHMSGDLG 1 // wxRichMessageDialog -#define wxUSE_SCROLLBAR 1 // wxScrollBar -#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl -#define wxUSE_SLIDER 1 // wxSlider -#define wxUSE_SPINBTN 1 // wxSpinButton -#define wxUSE_SPINCTRL 1 // wxSpinCtrl -#define wxUSE_STATBOX 1 // wxStaticBox -#define wxUSE_STATLINE 1 // wxStaticLine -#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. -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_STATUSBAR 1 - -// Two status bar implementations are available under Win32: the generic one -// or the wrapper around native control. For native look and feel the native -// version should be used. -// -// Default is 1 for the platforms where native status bar is supported. -// -// Recommended setting: 1 (there is no advantage in using the generic one) -#define wxUSE_NATIVE_STATUSBAR 1 - -// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar -// classes at all. Otherwise, use the native toolbar class unless -// wxUSE_TOOLBAR_NATIVE is 0. -// -// Default is 1 for all settings. -// -// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. -#define wxUSE_TOOLBAR 1 -#define wxUSE_TOOLBAR_NATIVE 1 - -// wxNotebook is a control with several "tabs" located on one of its sides. It -// may be used to logically organise the data presented to the user instead of -// putting everything in one huge dialog. It replaces wxTabControl and related -// classes of wxWin 1.6x. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTEBOOK 1 - -// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_LISTBOOK 1 - -// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CHOICEBOOK 1 - -// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of -// the tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TREEBOOK 1 - -// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of -// tabs -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLBOOK 1 - -// wxTaskBarIcon is a small notification icon shown in the system toolbar or -// dock. -// -// Default is 1. -// -// Recommended setting: 1 (but can be set to 0 if you don't need it) -#define wxUSE_TASKBARICON 1 - -// wxGrid class -// -// Default is 1, set to 0 to cut down compilation time and binaries size if you -// don't use it. -// -// Recommended setting: 1 -// -#define wxUSE_GRID 1 - -// wxMiniFrame class: a frame with narrow title bar -// -// Default is 1. -// -// Recommended setting: 1 (it doesn't cost almost anything) -#define wxUSE_MINIFRAME 1 - -// wxComboCtrl and related classes: combobox with custom popup window and -// not necessarily a listbox. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it -// it used by wxComboBox -#define wxUSE_COMBOCTRL 1 - -// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox -// items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0, except where it is -// needed as a base class for generic wxBitmapComboBox. -#define wxUSE_ODCOMBOBOX 1 - -// wxBitmapComboBox is a combobox that can have images in front of text items. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 -#define wxUSE_BITMAPCOMBOBOX 1 - -// wxRearrangeCtrl is a wxCheckListBox with two buttons allowing to move items -// up and down in it. It is also used as part of wxRearrangeDialog. -// -// Default is 1. -// -// Recommended setting: 1 but can be safely set to 0 (currently used only by -// wxHeaderCtrl) -#define wxUSE_REARRANGECTRL 1 - -// ---------------------------------------------------------------------------- -// Miscellaneous GUI stuff -// ---------------------------------------------------------------------------- - -// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) -#define wxUSE_ACCEL 1 - -// Use the standard art provider. The icons returned by this provider are -// embedded into the library as XPMs so disabling it reduces the library size -// somewhat but this should only be done if you use your own custom art -// provider returning the icons or never use any icons not provided by the -// native art provider (which might not be implemented at all for some -// platforms) or by the Tango icons provider (if it's not itself disabled -// below). -// -// Default is 1. -// -// Recommended setting: 1 unless you use your own custom art provider. -#define wxUSE_ARTPROVIDER_STD 1 - -// Use art provider providing Tango icons: this art provider has higher quality -// icons than the default ones using smaller size XPM icons without -// transparency but the embedded PNG icons add to the library size. -// -// Default is 1 under non-GTK ports. Under wxGTK the native art provider using -// the GTK+ stock icons replaces it so it is normally not necessary. -// -// Recommended setting: 1 but can be turned off to reduce the library size. -#define wxUSE_ARTPROVIDER_TANGO 1 - -// Hotkey support (currently Windows only) -#define wxUSE_HOTKEY 1 - -// Use wxCaret: a class implementing a "cursor" in a text control (called caret -// under Windows). -// -// Default is 1. -// -// Recommended setting: 1 (can be safely set to 0, not used by the library) -#define wxUSE_CARET 1 - -// Use wxDisplay class: it allows enumerating all displays on a system and -// their geometries as well as finding the display on which the given point or -// window lies. -// -// Default is 1. -// -// Recommended setting: 1 if you need it, can be safely set to 0 otherwise -#define wxUSE_DISPLAY 1 - -// Miscellaneous geometry code: needed for Canvas library -#define wxUSE_GEOMETRY 1 - -// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and -// wxListCtrl. -// -// Default is 1. -// -// Recommended setting: 1 (set it to 0 if you don't use any of the controls -// enumerated above, then this class is mostly useless too) -#define wxUSE_IMAGLIST 1 - -// Use wxInfoBar class. -// -// Default is 1. -// -// Recommended setting: 1 (but can be disabled without problems as nothing -// depends on it) -#define wxUSE_INFOBAR 1 - -// Use wxMenu, wxMenuBar, wxMenuItem. -// -// Default is 1. -// -// Recommended setting: 1 (can't be disabled under MSW) -#define wxUSE_MENUS 1 - -// Use wxNotificationMessage. -// -// wxNotificationMessage allows to show non-intrusive messages to the user -// using balloons, banners, popups or whatever is the appropriate method for -// the current platform. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_NOTIFICATION_MESSAGE 1 - -// wxPreferencesEditor provides a common API for different ways of presenting -// the standard "Preferences" or "Properties" dialog under different platforms -// (e.g. some use modal dialogs, some use modeless ones; some apply the changes -// immediately while others require an explicit "Apply" button). -// -// Default is 1. -// -// Recommended setting: 1 (but can be safely disabled if you don't use it) -#define wxUSE_PREFERENCES_EDITOR 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. -// -// Recommended setting: 1 -#define wxUSE_SASH 1 - -// Use wxSplitterWindow class. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_SPLITTER 1 - -// Use wxToolTip and wxWindow::Set/GetToolTip() methods. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_TOOLTIPS 1 - -// wxValidator class and related methods -#define wxUSE_VALIDATORS 1 - -// Use reference counted ID management: this means that wxWidgets will track -// the automatically allocated ids (those used when you use wxID_ANY when -// creating a window, menu or toolbar item &c) instead of just supposing that -// the program never runs out of them. This is mostly useful only under wxMSW -// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where -// long-running programs can run into problems with ids reuse without this. On -// the other platforms, where the ids have the full int range, this shouldn't -// be necessary. -#ifdef __WXMSW__ -#define wxUSE_AUTOID_MANAGEMENT 1 -#else -#define wxUSE_AUTOID_MANAGEMENT 0 -#endif - -// ---------------------------------------------------------------------------- -// common dialogs -// ---------------------------------------------------------------------------- - -// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. -// file selector, printer dialog). Switching this off also switches off the -// printing architecture and interactive wxPrinterDC. -// -// Default is 1 -// -// Recommended setting: 1 (unless it really doesn't work) -#define wxUSE_COMMON_DIALOGS 1 - -// wxBusyInfo displays window with message when app is busy. Works in same way -// as wxBusyCursor -#define wxUSE_BUSYINFO 1 - -// Use single/multiple choice dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_CHOICEDLG 1 - -// Use colour picker dialog -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_COLOURDLG 1 - -// wxDirDlg class for getting a directory name from user -#define wxUSE_DIRDLG 1 - -// TODO: setting to choose the generic or native one - -// Use file open/save dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (used in many places in the library itself) -#define wxUSE_FILEDLG 1 - -// Use find/replace dialogs. -// -// Default is 1 -// -// Recommended setting: 1 (but may be safely set to 0) -#define wxUSE_FINDREPLDLG 1 - -// Use font picker dialog -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_FONTDLG 1 - -// Use wxMessageDialog and wxMessageBox. -// -// Default is 1 -// -// Recommended setting: 1 (used in the library itself) -#define wxUSE_MSGDLG 1 - -// progress dialog class for lengthy operations -#define wxUSE_PROGRESSDLG 1 - -// support for startup tips (wxShowTip &c) -#define wxUSE_STARTUP_TIPS 1 - -// text entry dialog and wxGetTextFromUser function -#define wxUSE_TEXTDLG 1 - -// number entry dialog -#define wxUSE_NUMBERDLG 1 - -// splash screen class -#define wxUSE_SPLASH 1 - -// wizards -#define wxUSE_WIZARDDLG 1 - -// Compile in wxAboutBox() function showing the standard "About" dialog. -// -// Default is 1 -// -// Recommended setting: 1 but can be set to 0 to save some space if you don't -// use this function -#define wxUSE_ABOUTDLG 1 - -// wxFileHistory class -// -// Default is 1 -// -// Recommended setting: 1 -#define wxUSE_FILE_HISTORY 1 - -// ---------------------------------------------------------------------------- -// Metafiles support -// ---------------------------------------------------------------------------- - -// Windows supports the graphics format known as metafile which is, though not -// portable, is widely used under Windows and so is supported by wxWin (under -// Windows only, of course). Win16 (Win3.1) used the so-called "Window -// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in -// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by -// default, WMFs will be used under Win16 and EMFs under Win32. This may be -// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting -// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile -// in any metafile related classes at all. -// -// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. -// -// Recommended setting: default or 0 for everything for portable programs. -#define wxUSE_METAFILE 1 -#define wxUSE_ENH_METAFILE 1 -#define wxUSE_WIN_METAFILES_ALWAYS 0 - -// ---------------------------------------------------------------------------- -// Big GUI components -// ---------------------------------------------------------------------------- - -// Set to 0 to disable MDI support. -// -// Requires wxUSE_NOTEBOOK under platforms other than MSW. -// -// Default is 1. -// -// Recommended setting: 1, can be safely set to 0. -#define wxUSE_MDI 1 - -// Set to 0 to disable document/view architecture -#define wxUSE_DOC_VIEW_ARCHITECTURE 1 - -// Set to 0 to disable MDI document/view architecture -// -// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 1 - -// Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 - -// wxHTML sublibrary allows to display HTML in wxWindow programs and much, -// much more. -// -// Default is 1. -// -// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a -// smaller library. -#define wxUSE_HTML 1 - -// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL -// headers and libraries to be able to compile the library with wxUSE_GLCANVAS -// set to 1 and, under Windows, also to add opengl32.lib and glu32.lib to the -// list of libraries used to link your application (although this is done -// implicitly for Microsoft Visual C++ users). -// -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). -// -// Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 -// otherwise. -#define wxUSE_GLCANVAS 1 - -// wxRichTextCtrl allows editing of styled text. -// -// Default is 1. -// -// Recommended setting: 1, set to 0 if you want compile a -// smaller library. -#define wxUSE_RICHTEXT 1 - -// ---------------------------------------------------------------------------- -// Data transfer -// ---------------------------------------------------------------------------- - -// Use wxClipboard class for clipboard copy/paste. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_CLIPBOARD 1 - -// Use wxDataObject and related classes. Needed for clipboard and OLE drag and -// drop -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DATAOBJ 1 - -// Use wxDropTarget and wxDropSource classes for drag and drop (this is -// different from "built in" drag and drop in wxTreeCtrl which is always -// available). Requires wxUSE_DATAOBJ. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_DRAG_AND_DROP 1 - -// Use wxAccessible for enhanced and customisable accessibility. -// Depends on wxUSE_OLE. -// -// Default is 0. -// -// Recommended setting (at present): 0 -#define wxUSE_ACCESSIBILITY 0 - -// ---------------------------------------------------------------------------- -// miscellaneous settings -// ---------------------------------------------------------------------------- - -// wxSingleInstanceChecker class allows to verify at startup if another program -// instance is running. -// -// Default is 1 -// -// Recommended setting: 1 (the class is tiny, disabling it won't save much -// space) -#define wxUSE_SNGLINST_CHECKER 1 - -#define wxUSE_DRAGIMAGE 1 - -#define wxUSE_IPC 1 - // 0 for no interprocess comms -#define wxUSE_HELP 1 - // 0 for no help facility - -// Should we use MS HTML help for wxHelpController? If disabled, neither -// wxCHMHelpController nor wxBestHelpController are available. -// -// Default is 1 under MSW, 0 is always used for the other platforms. -// -// Recommended setting: 1, only set to 0 if you have trouble compiling -// wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 - - -// Use wxHTML-based help controller? -#define wxUSE_WXHTML_HELP 1 - -#define wxUSE_CONSTRAINTS 1 - // 0 for no window layout constraint system - -#define wxUSE_SPLINES 1 - // 0 for no splines - -#define wxUSE_MOUSEWHEEL 1 - // Include mouse wheel support - -// Compile wxUIActionSimulator class? -#define wxUSE_UIACTIONSIMULATOR 1 - -// ---------------------------------------------------------------------------- -// wxDC classes for various output formats -// ---------------------------------------------------------------------------- - -// Set to 1 for PostScript device context. -#define wxUSE_POSTSCRIPT 0 - -// Set to 1 to use font metric files in GetTextExtent -#define wxUSE_AFM_FOR_POSTSCRIPT 1 - -// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows -// to create files in SVG (Scalable Vector Graphics) format. -#define wxUSE_SVG 1 - -// Should wxDC provide SetTransformMatrix() and related methods? -// -// 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. -#define wxUSE_DC_TRANSFORM_MATRIX 1 - -// ---------------------------------------------------------------------------- -// image format support -// ---------------------------------------------------------------------------- - -// wxImage supports many different image formats which can be configured at -// compile-time. BMP is always supported, others are optional and can be safely -// disabled if you don't plan to use images in such format sometimes saving -// substantial amount of code in the final library. -// -// Some formats require an extra library which is included in wxWin sources -// which is mentioned if it is the case. - -// Set to 1 for wxImage support (recommended). -#define wxUSE_IMAGE 1 - -// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. -#define wxUSE_LIBPNG 1 - -// Set to 1 for JPEG format support (requires libjpeg) -#define wxUSE_LIBJPEG 1 - -// Set to 1 for TIFF format support (requires libtiff) -#define wxUSE_LIBTIFF 1 - -// Set to 1 for TGA format support (loading only) -#define wxUSE_TGA 1 - -// Set to 1 for GIF format support -#define wxUSE_GIF 1 - -// Set to 1 for PNM format support -#define wxUSE_PNM 1 - -// Set to 1 for PCX format support -#define wxUSE_PCX 1 - -// Set to 1 for IFF format support (Amiga format) -#define wxUSE_IFF 0 - -// Set to 1 for XPM format support -#define wxUSE_XPM 1 - -// Set to 1 for MS Icons and Cursors format support -#define wxUSE_ICO_CUR 1 - -// Set to 1 to compile in wxPalette class -#define wxUSE_PALETTE 1 - -// ---------------------------------------------------------------------------- -// wxUniversal-only options -// ---------------------------------------------------------------------------- - -// Set to 1 to enable compilation of all themes, this is the default -#define wxUSE_ALL_THEMES 1 - -// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES -// is unset, if it is set these options are not used; notice that metal theme -// uses Win32 one -#define wxUSE_THEME_GTK 0 -#define wxUSE_THEME_METAL 0 -#define wxUSE_THEME_MONO 0 -#define wxUSE_THEME_WIN32 0 - - -/* --- end common options --- */ - -// ---------------------------------------------------------------------------- -// general Windows-specific stuff -// ---------------------------------------------------------------------------- - -// Set this to 1 for generic OLE support: this is required for drag-and-drop, -// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and -// can't compile/doesn't have the OLE headers. -// -// Default is 1. -// -// Recommended setting: 1 -#define wxUSE_OLE 1 - -// Set this to 1 to enable wxDIB (don't change unless you have reason to) -#define wxUSE_WXDIB 1 - -// Set this to 1 to compile in wxRegKey class. -// -// Default is 1 -// -// Recommended setting: 1, this is used internally by wx in a few places -#define wxUSE_REGKEY 1 - -// ---------------------------------------------------------------------------- -// Windows CE specific stuff -// ---------------------------------------------------------------------------- - -// list of things which don't make sense under Windows CE in alphabetical order -// (please keep it!) -// -// NB: stuff which doesn't work at all under CE is forcefully disabled in -// wx/msw/wince/chkconf.h - -// Windows CE doesn't use RAS so wxDialUpManager doesn't work under it -#undef wxUSE_DIALUP_MANAGER -#define wxUSE_DIALUP_MANAGER 0 - -#undef wxUSE_DRAG_AND_DROP -#define wxUSE_DRAG_AND_DROP 0 - -#undef wxUSE_FSVOLUME -#define wxUSE_FSVOLUME 0 - -// MDI is not supported under CE -#undef wxUSE_MDI -#define wxUSE_MDI 0 - -#undef wxUSE_MDI_ARCHITECTURE -#define wxUSE_MDI_ARCHITECTURE 0 - -// there is no difference between frame and mini frame decorations under CE -#undef wxUSE_MINIFRAME -#define wxUSE_MINIFRAME 0 - -// no CHM support under CE -#undef wxUSE_MS_HTML_HELP -#define wxUSE_MS_HTML_HELP 0 - -// ??? -#undef wxUSE_OWNER_DRAWN -#define wxUSE_OWNER_DRAWN 0 - -// there is usually no printer attached to a PDA... -#undef wxUSE_PRINTING_ARCHITECTURE -#define wxUSE_PRINTING_ARCHITECTURE 0 - -// doesn't make much sense in absence of mouse... -#undef wxUSE_TOOLTIPS -#define wxUSE_TOOLTIPS 0 - -// Do use commdlg.h -#undef wxUSE_COMMON_DIALOGS -#define wxUSE_COMMON_DIALOGS 1 - -// don't use wxRichTextCtrl on WinCE yet, it's not ready, plus it's -// probably overkill for a WinCE environment. -#undef wxUSE_RICHTEXT -#define wxUSE_RICHTEXT 0 - -// ---------------------------------------------------------------------------- -// Crash debugging helpers -// ---------------------------------------------------------------------------- - -// Set this to 1 to be able to use wxCrashReport::Generate() to create mini -// dumps of your program when it crashes (or at any other moment) -// -// Default is 1 if supported by the compiler (VC++ and recent BC++ only). -// -// Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 0 - -// ---------------------------------------------------------------------------- -// obsolete MSW settings, don't change -// ---------------------------------------------------------------------------- - -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 - -#endif // _WX_SETUP_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/smartphone.rc b/Externals/wxWidgets3/include/wx/msw/wince/smartphone.rc deleted file mode 100644 index 89ac65f450..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/smartphone.rc +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/smartphone.rc -// Purpose: resources for MS Smartphone build -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 01.05.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include - -STRINGTABLE -BEGIN - IDS_EMPTY "" -END - -IDR_POPUP_1 MENU -BEGIN - POPUP "" - BEGIN - MENUITEM "M", IDM_ITEM - END -END - -IDR_POPUP_2 MENU -BEGIN - POPUP "" - BEGIN - MENUITEM "M", IDM_ITEM - END - POPUP "" - BEGIN - MENUITEM "M", IDM_ITEM - END -END - -IDR_MENUBAR_ONE_BUTTON RCDATA -BEGIN - 0,2, - I_IMAGENONE, IDM_LEFT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, NOMENU, - I_IMAGENONE, IDM_RIGHT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, NOMENU, -END - -IDR_MENUBAR_LEFT_MENU RCDATA -BEGIN - IDR_POPUP_1,1, - I_IMAGENONE, IDM_LEFT, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, 0, -END - -IDR_MENUBAR_RIGHT_MENU RCDATA -BEGIN - IDR_POPUP_1,2, - I_IMAGENONE, IDM_LEFT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, NOMENU, - I_IMAGENONE, IDM_RIGHT, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, 0, -END - -IDR_MENUBAR_BOTH_MENUS RCDATA -BEGIN - IDR_POPUP_2,2, - I_IMAGENONE, IDM_LEFT, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, 0, - I_IMAGENONE, IDM_RIGHT, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_EMPTY, 0, 1, -END - diff --git a/Externals/wxWidgets3/include/wx/msw/wince/tbarwce.h b/Externals/wxWidgets3/include/wx/msw/wince/tbarwce.h deleted file mode 100644 index 12cfd7e8fe..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/tbarwce.h +++ /dev/null @@ -1,169 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/tbarwce.h -// Purpose: Windows CE wxToolBar class -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_BARWCE_H_ -#define _WX_BARWCE_H_ - -#if wxUSE_TOOLBAR - -#include "wx/dynarray.h" - -// Smartphones don't have toolbars, so use a dummy class -#ifdef __SMARTPHONE__ - -class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase -{ -public: - // ctors and dtor - wxToolBar() { } - - wxToolBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr) - { - Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - virtual bool Realize() { return true; } - -protected: - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - 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); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolBar) - wxDECLARE_NO_COPY_CLASS(wxToolBar); -}; - -#else - -// For __POCKETPC__ - -#include "wx/msw/toolbar.h" - -class WXDLLIMPEXP_CORE wxToolMenuBar : public wxToolBar -{ -public: - // ctors and dtor - wxToolMenuBar() { Init(); } - - wxToolMenuBar(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr, - wxMenuBar* menuBar = NULL) - { - Init(); - - Create(parent, id, pos, size, style, name, menuBar); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, - const wxString& name = wxToolBarNameStr, - wxMenuBar* menuBar = NULL); - - virtual ~wxToolMenuBar(); - - // override/implement base class virtuals - virtual bool Realize(); - - // implementation only from now on - // ------------------------------- - - // Override in order to bypass wxToolBar's overridden function - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - - // Return HMENU for the menu associated with the commandbar - WXHMENU GetHMenu(); - - // Set the wxMenuBar associated with this commandbar - void SetMenuBar(wxMenuBar* menuBar) { m_menuBar = menuBar; } - - // Returns the wxMenuBar associated with this commandbar - wxMenuBar* GetMenuBar() const { return m_menuBar; } - -protected: - // common part of all ctors - void Init(); - - // create the native toolbar control - bool MSWCreateToolbar(const wxPoint& pos, const wxSize& size, wxMenuBar* menuBar); - - // recreate the control completely - void Recreate(); - - // implement base class pure virtuals - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); - - 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); - - // The menubar associated with this toolbar - wxMenuBar* m_menuBar; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxToolMenuBar) - wxDECLARE_NO_COPY_CLASS(wxToolMenuBar); -}; - -#endif - // __SMARTPHONE__ - -#endif // wxUSE_TOOLBAR - -#endif - // _WX_BARWCE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/textctrlce.h b/Externals/wxWidgets3/include/wx/msw/wince/textctrlce.h deleted file mode 100644 index 3c51633b0a..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/textctrlce.h +++ /dev/null @@ -1,235 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/msw/wince/textctrlce.h -// Purpose: wxTextCtrl implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.08.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TEXTCTRLCE_H_ -#define _WX_TEXTCTRLCE_H_ - -#include "wx/dynarray.h" - -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -WX_DEFINE_EXPORTED_ARRAY_PTR(wxTextCtrl *, wxArrayTextSpins); - -class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase -{ -public: - // creation - // -------- - - wxTextCtrl() { Init(); } - wxTextCtrl(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr) - { - Init(); - - Create(parent, id, value, pos, size, style, validator, name); - } - virtual ~wxTextCtrl(); - - bool Create(wxWindow *parent, wxWindowID id, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxTextCtrlNameStr); - - // implement base class pure virtuals - // ---------------------------------- - - virtual wxString GetValue() const; - virtual void SetValue(const wxString& value) { DoSetValue(value, SetValue_SendEvent); } - - virtual void ChangeValue(const wxString &value) { DoSetValue(value); } - - virtual wxString GetRange(long from, long to) const; - - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; - - virtual bool IsModified() const; - virtual bool IsEditable() const; - - virtual void GetSelection(long* from, long* to) const; - - // operations - // ---------- - - // editing - virtual void Clear(); - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - - // load the controls contents from the file - virtual bool LoadFile(const wxString& file); - - // clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); - - virtual void SetMaxLength(unsigned long len); - - // writing text inserts it at the current position, appending always - // inserts it at the end - virtual void WriteText(const wxString& text); - virtual void AppendText(const wxString& text); - - // translate between the position (which is just an index in the text ctrl - // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; - - virtual void ShowPosition(long pos); - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, - wxTextCoord *col, - wxTextCoord *row) const - { - return wxTextCtrlBase::HitTest(pt, col, row); - } - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - - // Undo/redo - virtual void Undo(); - virtual void Redo(); - - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - // Insertion point - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // Caret handling (Windows only) - - bool ShowNativeCaret(bool show = true); - bool HideNativeCaret() { return ShowNativeCaret(false); } - - // Implementation from now on - // -------------------------- - - virtual void Command(wxCommandEvent& event); - virtual bool MSWCommand(WXUINT param, WXWORD id); - - virtual void AdoptAttributesFromHWND(); - - virtual bool AcceptsFocus() const; - - // callbacks - void OnDropFiles(wxDropFilesEvent& event); - void OnChar(wxKeyEvent& event); // Process 'enter' if required - - void OnCut(wxCommandEvent& event); - void OnCopy(wxCommandEvent& event); - void OnPaste(wxCommandEvent& event); - void OnUndo(wxCommandEvent& event); - void OnRedo(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - // Show a context menu for Rich Edit controls (the standard - // EDIT control has one already) - void OnRightClick(wxMouseEvent& event); - - // be sure the caret remains invisible if the user - // called HideNativeCaret() before - void OnSetFocus(wxFocusEvent& event); - - // get the subclassed window proc of the buddy - WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } - - // intercept WM_GETDLGCODE - virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - -protected: - // common part of all ctors - void Init(); - - // call this to increase the size limit (will do nothing if the current - // limit is big enough) - // - // returns true if we increased the limit to allow entering more text, - // false if we hit the limit set by SetMaxLength() and so didn't change it - bool AdjustSpaceLimit(); - - void DoSetValue(const wxString &value, int flags = 0); - - // replace the contents of the selection or of the entire control with the - // given text - void DoWriteText(const wxString& text, int flags = SetValue_SelectionOnly); - - // set the selection possibly without scrolling the caret into view - void DoSetSelection(long from, long to, bool scrollCaret = true); - - // return true if there is a non empty selection in the control - bool HasSelection() const; - - // get the length of the line containing the character at the given - // position - long GetLengthOfLineContainingPos(long pos) const; - - // send TEXT_UPDATED event, return true if it was handled, false otherwise - bool SendUpdateEvent(); - - // override some base class virtuals - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual wxSize DoGetBestSize() const; - - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - - // if true, SendUpdateEvent() will eat the next event (see comments in the - // code as to why this is needed) - bool m_suppressNextUpdate; - - // all existing wxTextCtrl - this allows to find the one corresponding to - // the given buddy window in GetSpinTextCtrl() - static wxArrayTextSpins ms_allTextSpins; - -protected: - - // the data for the "buddy" list - WXHWND m_hwndBuddy; - WXFARPROC m_wndProcBuddy; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) - - bool m_isNativeCaretShown; -}; - -#endif // _WX_TEXTCTRLCE_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wince/time.h b/Externals/wxWidgets3/include/wx/msw/wince/time.h deleted file mode 100644 index d711111c89..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/time.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - * time.h - * Missing time functions and structures for use under WinCE - */ - -#ifndef _WX_MSW_WINCE_TIME_H_ -#define _WX_MSW_WINCE_TIME_H_ - -#ifndef _TM_DEFINED - -#define _TM_DEFINED - -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag */ - }; - -extern "C" -{ - -time_t __cdecl time(time_t *); - -time_t __cdecl mktime(struct tm *); - -// VC8 CRT provides the other functions -#if !defined(__VISUALC__) || (__VISUALC__ < 1400) - -struct tm * __cdecl localtime(const time_t *); - -struct tm * __cdecl gmtime(const time_t *); - -#define _tcsftime wcsftime - -size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); - -extern long timezone; - -#endif // !VC8 - -} - -#endif // !_TM_DEFINED - -#endif // _WX_MSW_WINCE_TIME_H_ - diff --git a/Externals/wxWidgets3/include/wx/msw/wince/wince.rc b/Externals/wxWidgets3/include/wx/msw/wince/wince.rc deleted file mode 100644 index e9c7e28ef7..0000000000 --- a/Externals/wxWidgets3/include/wx/msw/wince/wince.rc +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "wx/msw/wince/resources.h" - -#ifdef WIN32_PLATFORM_WFSP - #include "wx/msw/wince/smartphone.rc" -#else // !smartphone - -// Dummy empty menubar/toolbar for WinCE -wxIDM_SHMENU RCDATA DISCARDABLE -BEGIN - wxIDM_SHMENU, - 0 -END - -#endif // smartphone/!smartphone diff --git a/Externals/wxWidgets3/include/wx/msw/window.h b/Externals/wxWidgets3/include/wx/msw/window.h index bd793e143b..fff738f338 100644 --- a/Externals/wxWidgets3/include/wx/msw/window.h +++ b/Externals/wxWidgets3/include/wx/msw/window.h @@ -14,15 +14,13 @@ #include "wx/settings.h" // solely for wxSystemColour +class WXDLLIMPEXP_FWD_CORE wxButton; + // if this is set to 1, we use deferred window sizing to reduce flicker when // resizing complicated window hierarchies, but this can in theory result in // different behaviour than the old code so we keep the possibility to use it // by setting this to 0 (in the future this should be removed completely) -#ifdef __WXWINCE__ - #define wxUSE_DEFERRED_SIZING 0 -#else - #define wxUSE_DEFERRED_SIZING 1 -#endif +#define wxUSE_DEFERRED_SIZING 1 // --------------------------------------------------------------------------- // wxWindow declaration for MSW @@ -33,9 +31,6 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase friend class wxSpinCtrl; friend class wxSlider; friend class wxRadioBox; -#if defined __VISUALC__ && __VISUALC__ <= 1200 - friend class wxWindowMSW; -#endif public: wxWindowMSW() { Init(); } @@ -66,6 +61,9 @@ public: virtual void Raise(); virtual void Lower(); + // No scaling. Device pixels are exposed directly. + virtual double GetContentScaleFactor() const { return 1.0; } + virtual bool BeginRepositioningChildren(); virtual void EndRepositioningChildren(); @@ -118,6 +116,8 @@ public: wxCoord width, wxCoord widthTotal) const; + virtual void SetId(wxWindowID winid); + #if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ); #endif // wxUSE_DRAG_AND_DROP @@ -128,7 +128,7 @@ public: #ifndef __WXUNIVERSAL__ // Native resource loading (implemented in src/msw/nativdlg.cpp) // FIXME: should they really be all virtual? - virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); + virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID id); virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); wxWindow* GetWindowChild1(wxWindowID id); wxWindow* GetWindowChild(wxWindowID id); @@ -140,11 +140,6 @@ public: virtual bool UnregisterHotKey(int hotkeyId); #endif // wxUSE_HOTKEY -#ifdef __POCKETPC__ - bool IsContextMenuEnabled() const { return m_contextMenuEnabled; } - void EnableContextMenu(bool enable = true) { m_contextMenuEnabled = enable; } -#endif - // window handle stuff // ------------------- @@ -189,9 +184,6 @@ public: // -------------- void OnPaint(wxPaintEvent& event); -#ifdef __WXWINCE__ - void OnInitDialog(wxInitDialogEvent& event); -#endif public: // Windows subclassing @@ -356,9 +348,7 @@ public: #if wxUSE_HOTKEY bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); #endif -#ifdef __WIN32__ int HandleMenuChar(int chAccel, WXLPARAM lParam); -#endif // Create and process a clipboard event specified by type. bool HandleClipboardEvent( WXUINT nMsg ); @@ -489,7 +479,7 @@ public: return InheritsBackgroundColour(); } -#if !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) +#if !defined(__WXUNIVERSAL__) #define wxHAS_MSW_BACKGROUND_ERASE_HOOK #endif @@ -536,6 +526,29 @@ public: // behaviour virtual void OnInternalIdle(); +#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) + virtual bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); + + // handle WM_(UN)INITMENUPOPUP message to generate wxEVT_MENU_OPEN/CLOSE + bool HandleMenuPopup(wxEventType evtType, WXHMENU hMenu); + + // Command part of HandleMenuPopup() and HandleExitMenuLoop(). + virtual bool DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu); + + // Find the menu corresponding to the given handle. + virtual wxMenu* MSWFindMenuFromHMENU(WXHMENU hMenu); +#endif // wxUSE_MENUS && !__WXUNIVERSAL__ + + // Return the default button for the TLW containing this window or NULL if + // none. + static wxButton* MSWGetDefaultButtonFor(wxWindow* win); + + // Simulate a click on the given button if it is non-null, enabled and + // shown. + // + // Return true if the button was clicked, false otherwise. + static bool MSWClickButtonIfPossible(wxButton* btn); + protected: // this allows you to implement standard control borders without // repeating the code in different classes that are not derived from @@ -682,6 +695,13 @@ private: bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); +#ifndef __WXUNIVERSAL__ + // Call ::IsDialogMessage() if it is safe to do it (i.e. if it's not going + // to hang or do something else stupid) with the given message, return true + // if the message was handled by it. + bool MSWSafeIsDialogMessage(WXMSG* msg); +#endif // __WXUNIVERSAL__ + #if wxUSE_DEFERRED_SIZING protected: // this function is called after the window was resized to its new size @@ -702,13 +722,9 @@ protected: #endif // wxUSE_DEFERRED_SIZING private: -#ifdef __POCKETPC__ - bool m_contextMenuEnabled; -#endif - - DECLARE_DYNAMIC_CLASS(wxWindowMSW) + wxDECLARE_DYNAMIC_CLASS(wxWindowMSW); wxDECLARE_NO_COPY_CLASS(wxWindowMSW); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; // window creation helper class: before creating a new HWND, instantiate an diff --git a/Externals/wxWidgets3/include/wx/msw/winundef.h b/Externals/wxWidgets3/include/wx/msw/winundef.h index af44c49aea..8d86f0cc7a 100644 --- a/Externals/wxWidgets3/include/wx/msw/winundef.h +++ b/Externals/wxWidgets3/include/wx/msw/winundef.h @@ -365,13 +365,9 @@ #ifdef IsMaximized #undef IsMaximized - inline BOOL IsMaximized(HWND WXUNUSED_IN_WINCE(hwnd)) + inline BOOL IsMaximized(HWND hwnd) { -#ifdef __WXWINCE__ - return FALSE; -#else return IsZoomed(hwnd); -#endif } #endif @@ -379,13 +375,9 @@ #ifdef GetFirstChild #undef GetFirstChild - inline HWND GetFirstChild(HWND WXUNUSED_IN_WINCE(hwnd)) + inline HWND GetFirstChild(HWND hwnd) { -#ifdef __WXWINCE__ - return 0; -#else return GetTopWindow(hwnd); -#endif } #endif @@ -462,15 +454,6 @@ #endif -#if defined(__WXWINCE__) && defined(DrawIcon) //#ifdef DrawIcon - #undef DrawIcon - inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hicon) - { - return DrawIconEx(hdc,x,y,hicon,0,0,0,NULL, DI_NORMAL) ; - } -#endif - - // GetWindowProc //ifdef GetWindowProc // #undef GetWindowProc diff --git a/Externals/wxWidgets3/include/wx/msw/wrapcctl.h b/Externals/wxWidgets3/include/wx/msw/wrapcctl.h index 036e191139..e19111ada5 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapcctl.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapcctl.h @@ -19,13 +19,9 @@ #include "wx/msw/missing.h" // Set Unicode format for a common control -inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd)) +inline void wxSetCCUnicodeFormat(HWND hwnd) { -#ifndef __WXWINCE__ ::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0); -#else // !__WXWINCE__ - // here it should be already in Unicode anyhow -#endif // __WXWINCE__/!__WXWINCE__ } #if wxUSE_GUI diff --git a/Externals/wxWidgets3/include/wx/msw/wrapcdlg.h b/Externals/wxWidgets3/include/wx/msw/wrapcdlg.h index fe663119ec..038a9bc6fc 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapcdlg.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapcdlg.h @@ -17,7 +17,7 @@ #include "wx/msw/private.h" #include "wx/msw/missing.h" -#if wxUSE_COMMON_DIALOGS && !defined(__SMARTPHONE__) && !defined(__WXMICROWIN__) +#if wxUSE_COMMON_DIALOGS #include #endif diff --git a/Externals/wxWidgets3/include/wx/msw/wrapgdip.h b/Externals/wxWidgets3/include/wx/msw/wrapgdip.h index 04d4009a67..7b12ea51f9 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapgdip.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapgdip.h @@ -24,8 +24,21 @@ #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +// There are many clashes between the names of the member fields and parameters +// in the standard gdiplus.h header and each of them results in C4458 with +// VC14, so disable this warning for this file as there is no other way to +// avoid it. +#ifdef __VISUALC__ + #pragma warning(push) + #pragma warning(disable:4458) // declaration of 'xxx' hides class member +#endif + #include using namespace Gdiplus; +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + #endif // _WX_MSW_WRAPGDIP_H_ diff --git a/Externals/wxWidgets3/include/wx/msw/wrapshl.h b/Externals/wxWidgets3/include/wx/msw/wrapshl.h index 8826a039ba..aa32ca9964 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapshl.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapshl.h @@ -13,13 +13,6 @@ #include "wx/msw/wrapwin.h" -#ifdef __WXWINCE__ - #include - #include - #include - #include -#endif - #include #include "wx/msw/winundef.h" diff --git a/Externals/wxWidgets3/include/wx/msw/wrapwin.h b/Externals/wxWidgets3/include/wx/msw/wrapwin.h index 266179847e..eb94226059 100644 --- a/Externals/wxWidgets3/include/wx/msw/wrapwin.h +++ b/Externals/wxWidgets3/include/wx/msw/wrapwin.h @@ -27,15 +27,7 @@ // before including windows.h, define version macros at (currently) maximal // values because we do all our checks at run-time anyhow #ifndef WINVER - // the only exception to the above is MSVC 6 which has a time bomb in its - // headers: they warn against using them with WINVER >= 0x0500 as they - // contain only part of the declarations and they're not always correct, so - // don't define WINVER for it at all as this allows everything to work as - // expected both with standard VC6 headers (which define WINVER as 0x0400 - // by default) and headers from a newer SDK (which may define it as 0x0500) - #if !defined(__VISUALC__) || (__VISUALC__ >= 1300) - #define WINVER 0x0600 - #endif + #define WINVER 0x0603 #endif // define _WIN32_WINNT and _WIN32_IE to the highest possible values because we @@ -44,18 +36,13 @@ // doesn't want to use APIs only available on later OS versions and had defined // them to (presumably lower) values #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 + #define _WIN32_WINNT 0x0603 #endif #ifndef _WIN32_IE #define _WIN32_IE 0x0700 #endif -/* Deal with clash with __WINDOWS__ include guard */ -#if defined(__WXWINCE__) && defined(__WINDOWS__) -#undef __WINDOWS__ -#endif - // For IPv6 support, we must include winsock2.h before winsock.h, and // windows.h include winsock.h so do it before including it #if wxUSE_IPV6 @@ -64,53 +51,7 @@ #include -#if defined(__WXWINCE__) && !defined(__WINDOWS__) -#define __WINDOWS__ -#endif - // #undef the macros defined in winsows.h which conflict with code elsewhere #include "wx/msw/winundef.h" -// Types DWORD_PTR, ULONG_PTR and so on are used for 64-bit compatibility -// in the WINAPI SDK (they are an integral type that is the size of a -// pointer) on MSVC 7 and later. However, they are not available in older -// Platform SDKs, and since they are typedefs and not #defines we simply -// overwrite them if there is a chance that they're not defined -#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 -#endif // !defined(_MSC_VER) || _MSC_VER < 1300 - -// ---------------------------------------------------------------------------- -// Fix the functions wrongly implemented in unicows.dll -// ---------------------------------------------------------------------------- - -#if wxUSE_UNICODE_MSLU - -#if wxUSE_GUI - -WXDLLIMPEXP_CORE int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, - WXLPARAM lData, WXWPARAM wData, - int x, int y, int cx, int cy, - unsigned int flags); -#define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \ - wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ - ld, wd, x, y, cx, cy, flags) - -WXDLLIMPEXP_CORE int wxMSLU_GetOpenFileNameW(void *ofn); -#define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) - -WXDLLIMPEXP_CORE int wxMSLU_GetSaveFileNameW(void *ofn); -#define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) - -#endif // wxUSE_GUI - -#endif // wxUSE_UNICODE_MSLU - #endif // _WX_WRAPWIN_H_ - - diff --git a/Externals/wxWidgets3/include/wx/msw/wx.rc b/Externals/wxWidgets3/include/wx/msw/wx.rc index 702861a287..f71bb61e0a 100644 --- a/Externals/wxWidgets3/include/wx/msw/wx.rc +++ b/Externals/wxWidgets3/include/wx/msw/wx.rc @@ -11,10 +11,6 @@ #include -#if defined(_WIN32_WCE) - #include "wx/msw/wince/wince.rc" -#endif - #include "wx/msw/rcdefs.h" ////////////////////////////////////////////////////////////////////////////// @@ -57,8 +53,12 @@ WXCURSOR_CROSS CURSOR DISCARDABLE "wx/msw/cross.cur" // Default Icons // -// First wx icon in alphabetical order, so it will be used by Explorer if the -// application doesn't have any icons of its own +// First wx icon in alphabetical order. +// +// Notice that it also may be used by Explorer as the application icon if the +// main program doesn't define any icons preceding this one in alphabetical +// order (i.e. any icons defined by it start with "wy", "x", "y" or "z") in +// 16*16 or 32*32 sizes. wxICON_AAA ICON "wx/msw/std.ico" //wxDEFAULT_FRAME ICON "wx/msw/std.ico" diff --git a/Externals/wxWidgets3/include/wx/nativewin.h b/Externals/wxWidgets3/include/wx/nativewin.h index e0328e9583..b2ebad0685 100644 --- a/Externals/wxWidgets3/include/wx/nativewin.h +++ b/Externals/wxWidgets3/include/wx/nativewin.h @@ -12,11 +12,13 @@ #include "wx/toplevel.h" -// this symbol can be tested in the user code to see if the current wx port has -// support for creating wxNativeContainerWindow from native windows +// These symbols can be tested in the user code to see if the current wx port +// has support for creating wxNativeContainerWindow and wxNativeWindow from +// native windows. // -// be optimistic by default, we undefine it below if we don't have it finally +// Be optimistic by default, we undefine them below if necessary. #define wxHAS_NATIVE_CONTAINER_WINDOW +#define wxHAS_NATIVE_WINDOW // we define the following typedefs for each of the platform supporting native // windows wrapping: @@ -28,16 +30,16 @@ // window, i.e. HWND/GdkNativeWindow/NSWindow (so it's the same as above for // all platforms except GTK where we also can work with Window/XID) // -// later we'll also have -// -// - wxNativeWindowHandle for child windows (which will be wrapped by -// wxNativeWindow class), it is HWND/GtkWidget*/ControlRef +// - wxNativeWindowHandle for child windows, i.e. HWND/GtkWidget*/NSControl #if defined(__WXMSW__) #include "wx/msw/wrapwin.h" typedef HWND wxNativeContainerWindowId; typedef HWND wxNativeContainerWindowHandle; + typedef HWND wxNativeWindowHandle; #elif defined(__WXGTK__) + #include + // GdkNativeWindow is guint32 under GDK/X11 and gpointer under GDK/WIN32 #ifdef __UNIX__ typedef unsigned long wxNativeContainerWindowId; @@ -45,11 +47,87 @@ typedef void *wxNativeContainerWindowId; #endif typedef GdkWindow *wxNativeContainerWindowHandle; + typedef GtkWidget *wxNativeWindowHandle; +#elif defined(__WXOSX_COCOA__) + typedef NSView *wxNativeWindowHandle; + + // no support for using native TLWs yet + #undef wxHAS_NATIVE_CONTAINER_WINDOW #else // no support for using native windows under this platform yet #undef wxHAS_NATIVE_CONTAINER_WINDOW + #undef wxHAS_NATIVE_WINDOW #endif +#ifdef wxHAS_NATIVE_WINDOW + +// ---------------------------------------------------------------------------- +// wxNativeWindow: for using native windows inside wxWidgets windows +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNativeWindow : public wxWindow +{ +public: + // Default ctor, Create() must be called later to really create the window. + wxNativeWindow() + { + Init(); + } + + // Create a window from an existing native window handle. + // + // Notice that this ctor doesn't take the usual pos and size parameters, + // they're taken from the window handle itself. + // + // Use GetHandle() to check if the creation was successful, it will return + // 0 if the handle was invalid. + wxNativeWindow(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle) + { + Init(); + + Create(parent, winid, handle); + } + + // Same as non-default ctor, but with a return code. + bool Create(wxWindow* parent, wxWindowID winid, wxNativeWindowHandle handle); + + // By default the native window with which this wxWindow is associated is + // owned by the user code and needs to be destroyed by it in a platform + // specific way, however this function can be called to let wxNativeWindow + // dtor take care of destroying the native window instead of having to do + // it from the user code. + void Disown() + { + wxCHECK_RET( m_ownedByUser, wxS("Can't disown more than once") ); + + m_ownedByUser = false; + + DoDisown(); + } + +#ifdef __WXMSW__ + // Prevent the native window, not owned by us, from being destroyed by the + // base class dtor, unless Disown() had been called. + virtual ~wxNativeWindow(); +#endif // __WXMSW__ + +private: + void Init() + { + m_ownedByUser = true; + } + + // This is implemented in platform-specific code. + void DoDisown(); + + // If the native widget owned by the user code. + bool m_ownedByUser; + + wxDECLARE_NO_COPY_CLASS(wxNativeWindow); +}; + +#endif // wxHAS_NATIVE_WINDOW + #ifdef wxHAS_NATIVE_CONTAINER_WINDOW // ---------------------------------------------------------------------------- @@ -92,55 +170,55 @@ public: // provide (trivial) implementation of the base class pure virtuals - virtual void SetTitle(const wxString& WXUNUSED(title)) + virtual void SetTitle(const wxString& WXUNUSED(title)) wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); } - virtual wxString GetTitle() const + virtual wxString GetTitle() const wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); return wxString(); } - virtual void Maximize(bool WXUNUSED(maximize) = true) + virtual void Maximize(bool WXUNUSED(maximize) = true) wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); } - virtual bool IsMaximized() const + virtual bool IsMaximized() const wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); return false; } - virtual void Iconize(bool WXUNUSED(iconize) = true) + virtual void Iconize(bool WXUNUSED(iconize) = true) wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); } - virtual bool IsIconized() const + virtual bool IsIconized() const wxOVERRIDE { // this is called by wxGTK implementation so don't assert return false; } - virtual void Restore() + virtual void Restore() wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); } virtual bool ShowFullScreen(bool WXUNUSED(show), - long WXUNUSED(style) = wxFULLSCREEN_ALL) + long WXUNUSED(style) = wxFULLSCREEN_ALL) wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); return false; } - virtual bool IsFullScreen() const + virtual bool IsFullScreen() const wxOVERRIDE { wxFAIL_MSG( "not implemented for native windows" ); @@ -148,7 +226,7 @@ public: } #ifdef __WXMSW__ - virtual bool IsShown() const; + virtual bool IsShown() const wxOVERRIDE; #endif // __WXMSW__ // this is an implementation detail: called when the native window is diff --git a/Externals/wxWidgets3/include/wx/nonownedwnd.h b/Externals/wxWidgets3/include/wx/nonownedwnd.h index 7d8709933d..9beb00da9b 100644 --- a/Externals/wxWidgets3/include/wx/nonownedwnd.h +++ b/Externals/wxWidgets3/include/wx/nonownedwnd.h @@ -62,13 +62,13 @@ public: // ------------------------------ virtual void AdjustForParentClientOrigin(int& WXUNUSED(x), int& WXUNUSED(y), - int WXUNUSED(sizeFlags) = 0) const + int WXUNUSED(sizeFlags) = 0) const wxOVERRIDE { // Non owned windows positions don't need to be adjusted for parent // client area origin so simply do nothing here. } - virtual void InheritAttributes() + virtual void InheritAttributes() wxOVERRIDE { // 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 @@ -100,7 +100,7 @@ protected: #include "wx/gtk/nonownedwnd.h" #elif defined(__WXMAC__) #include "wx/osx/nonownedwnd.h" -#elif defined(__WXMSW__) && !defined(__WXWINCE__) +#elif defined(__WXMSW__) #include "wx/msw/nonownedwnd.h" #else // No special class needed in other ports, they can derive both wxTLW and diff --git a/Externals/wxWidgets3/include/wx/notebook.h b/Externals/wxWidgets3/include/wx/notebook.h index 1535229aa0..2d5de60566 100644 --- a/Externals/wxWidgets3/include/wx/notebook.h +++ b/Externals/wxWidgets3/include/wx/notebook.h @@ -90,7 +90,7 @@ private: bool m_selected; int m_imageId; - DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) + wxDECLARE_DYNAMIC_CLASS(wxNotebookPageInfo); }; WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); @@ -125,7 +125,7 @@ public: // implement some base class functions - virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; // On platforms that support it, get the theme page background colour, else invalid colour virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; } @@ -142,7 +142,7 @@ public: // wxBookCtrlBase overrides this method to return false but we do need // focus because we have tabs - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } + virtual bool AcceptsFocus() const wxOVERRIDE { return wxControl::AcceptsFocus(); } #if wxUSE_EXTENDED_RTTI // XTI accessors @@ -193,10 +193,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBook #include "wx/gtk1/notebook.h" #elif defined(__WXMAC__) #include "wx/osx/notebook.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/notebook.h" -#elif defined(__WXPM__) - #include "wx/os2/notebook.h" +#elif defined(__WXQT__) + #include "wx/qt/notebook.h" #endif // old wxEVT_COMMAND_* constants diff --git a/Externals/wxWidgets3/include/wx/notifmsg.h b/Externals/wxWidgets3/include/wx/notifmsg.h index fe49c8763c..eb41f85ad4 100644 --- a/Externals/wxWidgets3/include/wx/notifmsg.h +++ b/Externals/wxWidgets3/include/wx/notifmsg.h @@ -29,8 +29,7 @@ public: // default ctor, use setters below to initialize it later wxNotificationMessageBase() { - m_parent = NULL; - m_flags = wxICON_INFORMATION; + Init(); } // create a notification object with the given title and message (the @@ -39,39 +38,38 @@ public: const wxString& message = wxEmptyString, wxWindow *parent = NULL, int flags = wxICON_INFORMATION) - : m_title(title), - m_message(message), - m_parent(parent) { - SetFlags(flags); + Init(); + Create(title, message, parent, flags); } + virtual ~wxNotificationMessageBase(); + // note that the setters must be called before Show() // set the title: short string, markup not allowed - void SetTitle(const wxString& title) { m_title = title; } + void SetTitle(const wxString& title); // set the text of the message: this is a longer string than the title and // some platforms allow simple HTML-like markup in it - void SetMessage(const wxString& message) { m_message = message; } + void SetMessage(const wxString& message); // set the parent for this notification: we'll be associated with the top // level parent of this window or, if this method is not called, with the // main application window by default - void SetParent(wxWindow *parent) { m_parent = parent; } + void SetParent(wxWindow *parent); // this method can currently be used to choose a standard icon to use: the // parameter may be one of wxICON_INFORMATION, wxICON_WARNING or // wxICON_ERROR only (but not wxICON_QUESTION) - void SetFlags(int flags) - { - wxASSERT_MSG( flags == wxICON_INFORMATION || - flags == wxICON_WARNING || flags == wxICON_ERROR, - "Invalid icon flags specified" ); + void SetFlags(int flags); - m_flags = flags; - } + // set a custom icon to use instead of the system provided specified via SetFlags + virtual void SetIcon(const wxIcon& icon); + // Add a button to the notification, returns false if the platform does not support + // actions in notifications + virtual bool AddAction(wxWindowID actionid, const wxString &label = wxString()); // showing and hiding // ------------------ @@ -87,72 +85,97 @@ public: // pass (special values Timeout_Auto and Timeout_Never can be used) // // returns false if an error occurred - virtual bool Show(int timeout = Timeout_Auto) = 0; + bool Show(int timeout = Timeout_Auto); // hide the notification, returns true if it was hidden or false if it // couldn't be done (e.g. on some systems automatically hidden // notifications can't be hidden manually) - virtual bool Close() = 0; + bool Close(); protected: - // accessors for the derived classes - const wxString& GetTitle() const { return m_title; } - const wxString& GetMessage() const { return m_message; } - wxWindow *GetParent() const { return m_parent; } - int GetFlags() const { return m_flags; } - - // return the concatenation of title and message separated by a new line, - // this is suitable for simple implementation which have no support for - // separate title and message parts of the notification - wxString GetFullMessage() const + // Common part of all ctors. + void Create(const wxString& title = wxEmptyString, + const wxString& message = wxEmptyString, + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) { - wxString text(m_title); - if ( !m_message.empty() ) - { - text << "\n\n" << m_message; - } - - return text; + SetTitle(title); + SetMessage(message); + SetParent(parent); + SetFlags(flags); } + class wxNotificationMessageImpl* m_impl; + private: - wxString m_title, - m_message; - wxWindow *m_parent; - - int m_flags; + void Init() + { + m_impl = NULL; + } wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase); }; -/* - TODO: Implement under OS X using notification centre (10.8+) or - Growl (http://growl.info/) for the previous versions. - */ -#if defined(__WXGTK__) && wxUSE_LIBNOTIFY - #include "wx/gtk/notifmsg.h" -#elif defined(__WXGTK__) && (wxUSE_LIBHILDON || wxUSE_LIBHILDON2) - #include "wx/gtk/hildon/notifmsg.h" -#elif defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS - #include "wx/msw/notifmsg.h" -#else - #include "wx/generic/notifmsg.h" +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_NOTIFICATION_MESSAGE_CLICK, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_NOTIFICATION_MESSAGE_DISMISSED, wxCommandEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_ADV, wxEVT_NOTIFICATION_MESSAGE_ACTION, wxCommandEvent ); - class wxNotificationMessage : public wxGenericNotificationMessage - { - public: - wxNotificationMessage() { } - wxNotificationMessage(const wxString& title, - const wxString& message = wxEmptyString, - wxWindow *parent = NULL, - int flags = wxICON_INFORMATION) - : wxGenericNotificationMessage(title, message, parent, flags) - { - } - }; +#if (defined(__WXGTK__) && wxUSE_LIBNOTIFY) || \ + (defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS) || \ + (defined(__WXOSX_COCOA__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8)) + #define wxHAS_NATIVE_NOTIFICATION_MESSAGE #endif +// ---------------------------------------------------------------------------- +// wxNotificationMessage +// ---------------------------------------------------------------------------- + +#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE + +#if defined(__WXMSW__) +class WXDLLIMPEXP_FWD_ADV wxTaskBarIcon; +#endif // defined(__WXMSW__) + +#else +#include "wx/generic/notifmsg.h" +#endif // wxHAS_NATIVE_NOTIFICATION_MESSAGE + +class WXDLLIMPEXP_ADV wxNotificationMessage : public +#ifdef wxHAS_NATIVE_NOTIFICATION_MESSAGE + wxNotificationMessageBase +#else + wxGenericNotificationMessage +#endif +{ +public: + wxNotificationMessage() { Init(); } + wxNotificationMessage(const wxString& title, + const wxString& message = wxString(), + wxWindow *parent = NULL, + int flags = wxICON_INFORMATION) + { + Init(); + Create(title, message, parent, flags); + } + +#if defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) + static bool MSWUseToasts( + const wxString& shortcutPath = wxString(), + const wxString& appId = wxString()); + + // returns the task bar icon which was used previously (may be NULL) + static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon); + +#endif // defined(__WXMSW__) && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) + +private: + // common part of all ctors + void Init(); + + wxDECLARE_NO_COPY_CLASS(wxNotificationMessage); +}; + #endif // wxUSE_NOTIFICATION_MESSAGE #endif // _WX_NOTIFMSG_H_ diff --git a/Externals/wxWidgets3/include/wx/object.h b/Externals/wxWidgets3/include/wx/object.h index 04c6512254..6a0140737b 100644 --- a/Externals/wxWidgets3/include/wx/object.h +++ b/Externals/wxWidgets3/include/wx/object.h @@ -152,16 +152,14 @@ name##PluginSentinel m_pluginsentinel #define wxDynamicCastThis(className) \ (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) -// FIXME-VC6: dummy argument needed because VC6 doesn't support explicitly -// choosing the template function to call template -inline T *wxCheckCast(const void *ptr, T * = NULL) +inline T *wxCheckCast(const void *ptr) { wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" ); return const_cast(static_cast(ptr)); } -#define wxStaticCast(obj, className) wxCheckCast((obj), (className *)NULL) +#define wxStaticCast(obj, className) wxCheckCast(obj) // ---------------------------------------------------------------------------- // set up memory debugging macros @@ -172,7 +170,6 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0) _WX_WANT_DELETE_VOID = void operator delete (void * buf) - _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line) _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int) _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0) _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf) @@ -181,21 +178,11 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) #if wxUSE_MEMORY_TRACING -// All compilers get this one +// All compilers get these ones #define _WX_WANT_NEW_SIZET_WXCHAR_INT +#define _WX_WANT_DELETE_VOID -// Everyone except Visage gets the next one -#ifndef __VISAGECPP__ - #define _WX_WANT_DELETE_VOID -#endif - -// Only visage gets this one under the correct circumstances -#if defined(__VISAGECPP__) && __DEBUG_ALLOC__ - #define _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET -#endif - -// Only VC++ 6 gets overloaded delete that matches new -#if (defined(__VISUALC__) && (__VISUALC__ >= 1200)) +#if defined(__VISUALC__) #define _WX_WANT_DELETE_VOID_WXCHAR_INT #endif @@ -220,7 +207,7 @@ inline T *wxCheckCast(const void *ptr, T * = NULL) // ---------------------------------------------------------------------------- // deprecated variants _not_ requiring a semicolon after them and without wx prefix. // (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) +// it's not always possible to force the compiler to require it) #define DECLARE_CLASS_INFO_ITERATORS() wxDECLARE_CLASS_INFO_ITERATORS(); #define DECLARE_ABSTRACT_CLASS(n) wxDECLARE_ABSTRACT_CLASS(n); @@ -389,10 +376,6 @@ public: void operator delete ( void * buf ); #endif -#ifdef _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET - void operator delete ( void *buf, const char *_fname, size_t _line ); -#endif - #ifdef _WX_WANT_DELETE_VOID_WXCHAR_INT void operator delete ( void *buf, const wxChar*, int ); #endif @@ -474,7 +457,7 @@ inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) // deprecated variants _not_ requiring a semicolon after them and without wx prefix. // (note that also some wx-prefixed macro do _not_ require a semicolon because -// it's not always possible to force the compire to require it) +// it's not always possible to force the compiler to require it) #define IMPLEMENT_DYNAMIC_CLASS(n,b) wxIMPLEMENT_DYNAMIC_CLASS(n,b) #define IMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) wxIMPLEMENT_DYNAMIC_CLASS2(n,b1,b2) diff --git a/Externals/wxWidgets3/include/wx/odcombo.h b/Externals/wxWidgets3/include/wx/odcombo.h index af0f1160d8..64cfc64fcf 100644 --- a/Externals/wxWidgets3/include/wx/odcombo.h +++ b/Externals/wxWidgets3/include/wx/odcombo.h @@ -77,22 +77,22 @@ public: virtual ~wxVListBoxComboPopup(); // required virtuals - virtual void Init(); - virtual bool Create(wxWindow* parent); - virtual void SetFocus(); - virtual wxWindow *GetControl() { return this; } - virtual void SetStringValue( const wxString& value ); - virtual wxString GetStringValue() const; + virtual void Init() wxOVERRIDE; + virtual bool Create(wxWindow* parent) wxOVERRIDE; + virtual void SetFocus() wxOVERRIDE; + virtual wxWindow *GetControl() wxOVERRIDE { return this; } + virtual void SetStringValue( const wxString& value ) wxOVERRIDE; + virtual wxString GetStringValue() const wxOVERRIDE; // more customization - virtual void OnPopup(); - virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ); - virtual void PaintComboControl( wxDC& dc, const wxRect& rect ); - virtual void OnComboKeyEvent( wxKeyEvent& event ); - virtual void OnComboCharEvent( wxKeyEvent& event ); - virtual void OnComboDoubleClick(); - virtual bool LazyCreate(); - virtual bool FindItem(const wxString& item, wxString* trueItem); + virtual void OnPopup() wxOVERRIDE; + virtual wxSize GetAdjustedSize( int minWidth, int prefHeight, int maxHeight ) wxOVERRIDE; + virtual void PaintComboControl( wxDC& dc, const wxRect& rect ) wxOVERRIDE; + virtual void OnComboKeyEvent( wxKeyEvent& event ) wxOVERRIDE; + virtual void OnComboCharEvent( wxKeyEvent& event ) wxOVERRIDE; + virtual void OnComboDoubleClick() wxOVERRIDE; + virtual bool LazyCreate() wxOVERRIDE; + virtual bool FindItem(const wxString& item, wxString* trueItem) wxOVERRIDE; // Item management void SetSelection( int item ); @@ -148,7 +148,7 @@ protected: virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags) const; // This is same as in wxVListBox - virtual wxCoord OnMeasureItem( size_t item ) const; + virtual wxCoord OnMeasureItem( size_t item ) const wxOVERRIDE; // Return item width, or -1 for calculating from text extent (default) virtual wxCoord OnMeasureItemWidth( size_t item ) const; @@ -158,8 +158,8 @@ protected: virtual void OnDrawBg(wxDC& dc, const wxRect& rect, int item, int flags) const; // Additional wxVListBox implementation (no need to override in derived classes) - virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const; - void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const; + virtual void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; + void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const wxOVERRIDE; // filter mouse move events happening outside the list box // move selection with cursor @@ -222,7 +222,7 @@ private: wxTimer m_partialCompletionTimer; #endif // wxUSE_TIMER - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; @@ -308,23 +308,27 @@ public: } // wxControlWithItems methods - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; virtual void Select(int n); - virtual int GetSelection() const; + virtual int GetSelection() const wxOVERRIDE; + + // See wxComboBoxBase discussion of IsEmpty(). + bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } + bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } // Override these just to maintain consistency with virtual methods // between classes. - virtual void Clear(); - virtual void GetSelection(long *from, long *to) const; + virtual void Clear() wxOVERRIDE; + virtual void GetSelection(long *from, long *to) const wxOVERRIDE; - virtual void SetSelection(int n) { Select(n); } + virtual void SetSelection(int n) wxOVERRIDE { Select(n); } // Prevent a method from being hidden - virtual void SetSelection(long from, long to) + virtual void SetSelection(long from, long to) wxOVERRIDE { wxComboCtrl::SetSelection(from,to); } @@ -335,11 +339,11 @@ public: // Return the index of the widest item (recalculating it if necessary) virtual int GetWidestItem() { EnsurePopupControl(); return GetVListBoxComboPopup()->GetWidestItem(); } - virtual bool IsSorted() const { return HasFlag(wxCB_SORT); } + virtual bool IsSorted() const wxOVERRIDE { return HasFlag(wxCB_SORT); } protected: - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; // Callback for drawing. Font, background and text colour have been // prepared according to selection, focus and such. @@ -356,14 +360,14 @@ protected: // override base implementation so we can return the size for the // largest item - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; // Callback for background drawing. Flags are same as with // OnDrawItem. virtual void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const; // NULL popup can be used to indicate default interface - virtual void DoSetPopupControl(wxComboPopup* popup); + virtual void DoSetPopupControl(wxComboPopup* popup) wxOVERRIDE; // clears all allocated client datas void ClearClientDatas(); @@ -375,9 +379,9 @@ protected: virtual int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, - void **clientData, wxClientDataType type); - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; + void **clientData, wxClientDataType type) wxOVERRIDE; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; // temporary storage for the initial choices //const wxString* m_baseChoices; @@ -387,9 +391,9 @@ protected: private: void Init(); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); - DECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox) + wxDECLARE_DYNAMIC_CLASS(wxOwnerDrawnComboBox); }; diff --git a/Externals/wxWidgets3/include/wx/osx/accel.h b/Externals/wxWidgets3/include/wx/osx/accel.h index a6690acf5f..70ba837e3e 100644 --- a/Externals/wxWidgets3/include/wx/osx/accel.h +++ b/Externals/wxWidgets3/include/wx/osx/accel.h @@ -16,7 +16,7 @@ class WXDLLIMPEXP_CORE wxAcceleratorTable: public wxObject { -DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) + wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable); public: wxAcceleratorTable(); wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array diff --git a/Externals/wxWidgets3/include/wx/osx/activityindicator.h b/Externals/wxWidgets3/include/wx/osx/activityindicator.h new file mode 100644 index 0000000000..a6f78231a8 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/activityindicator.h @@ -0,0 +1,59 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/activityindicator.h +// Purpose: Declaration of wxActivityIndicator for wxOSX (Cocoa only). +// Author: Vadim Zeitlin +// Created: 2015-03-08 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_ACTIVITYINDICATOR_H_ +#define _WX_OSX_ACTIVITYINDICATOR_H_ + +// ---------------------------------------------------------------------------- +// wxActivityIndicator: implementation using GtkSpinner. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxActivityIndicator : public wxActivityIndicatorBase +{ +public: + wxActivityIndicator() + { + Init(); + } + + explicit + wxActivityIndicator(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr) + { + Init(); + + Create(parent, winid, pos, size, style, name); + } + + bool Create(wxWindow* parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxActivityIndicatorNameStr); + + virtual void Start() wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual bool IsRunning() const wxOVERRIDE; + +private: + // Common part of all ctors. + void Init() { m_isRunning = false; } + + bool m_isRunning; + + wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator); + wxDECLARE_NO_COPY_CLASS(wxActivityIndicator); +}; + +#endif // _WX_OSX_ACTIVITYINDICATOR_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/anybutton.h b/Externals/wxWidgets3/include/wx/osx/anybutton.h index ffa28dfb6c..31b579a440 100644 --- a/Externals/wxWidgets3/include/wx/osx/anybutton.h +++ b/Externals/wxWidgets3/include/wx/osx/anybutton.h @@ -18,19 +18,19 @@ public: static wxSize GetDefaultSize(); - virtual void SetLabel(const wxString& label); + virtual void SetLabel(const wxString& label) wxOVERRIDE; protected: - virtual wxSize DoGetBestSize() const ; + virtual wxSize DoGetBestSize() const wxOVERRIDE; 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 wxBitmap DoGetBitmap(State which) const wxOVERRIDE; + virtual void DoSetBitmap(const wxBitmap& bitmap, State which) wxOVERRIDE; + virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; - virtual void DoSetBitmapMargins(int x, int y) + virtual void DoSetBitmapMargins(int x, int y) wxOVERRIDE { m_marginX = x; m_marginY = y; @@ -38,7 +38,7 @@ protected: } #if wxUSE_MARKUP && wxOSX_USE_COCOA - virtual bool DoSetLabelMarkup(const wxString& markup); + virtual bool DoSetLabelMarkup(const wxString& markup) wxOVERRIDE; #endif // wxUSE_MARKUP && wxOSX_USE_COCOA @@ -52,7 +52,7 @@ protected: wxBitmap m_bitmaps[State_Max]; wxDECLARE_NO_COPY_CLASS(wxAnyButton); - DECLARE_EVENT_TABLE() + wxDECLARE_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 0eba951444..cbd13b41a6 100644 --- a/Externals/wxWidgets3/include/wx/osx/app.h +++ b/Externals/wxWidgets3/include/wx/osx/app.h @@ -33,26 +33,26 @@ bool WXDLLIMPEXP_CORE wxYield(); // a new App object to start application class WXDLLIMPEXP_CORE wxApp: public wxAppBase { - DECLARE_DYNAMIC_CLASS(wxApp) + wxDECLARE_DYNAMIC_CLASS(wxApp); wxApp(); virtual ~wxApp(); - virtual void WakeUpIdle(); + virtual void WakeUpIdle() wxOVERRIDE; - virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual void SetPrintMode(int mode) wxOVERRIDE { m_printMode = mode; } virtual int GetPrintMode() const { return m_printMode; } // calling OnInit with an auto-release pool ready ... - virtual bool CallOnInit(); + virtual bool CallOnInit() wxOVERRIDE; #if wxUSE_GUI // setting up all MacOS Specific Event-Handlers etc - virtual bool OnInitGui(); + virtual bool OnInitGui() wxOVERRIDE; #endif // wxUSE_GUI - virtual int OnRun(); + virtual int OnRun() wxOVERRIDE; - virtual bool ProcessIdle(); + virtual bool ProcessIdle() wxOVERRIDE; // implementation only void OnIdle(wxIdleEvent& event); @@ -67,8 +67,8 @@ public: static bool sm_isEmbedded; // Implementation - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); + virtual bool Initialize(int& argc, wxChar **argv) wxOVERRIDE; + virtual void CleanUp() wxOVERRIDE; // the installed application event handler WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } @@ -119,15 +119,6 @@ public: bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , wxChar uniChar ) ; bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ; void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , wxChar uniChar ) ; -#if wxOSX_USE_CARBON - // we only have applescript on these - virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; -#endif // in response of an openFiles message with Cocoa and an // open-document apple event virtual void MacOpenFiles(const wxArrayString &fileNames) ; @@ -174,7 +165,7 @@ public: // Hide the application windows the same as the system hide command would do it. void MacHideApp(); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/appprogress.h b/Externals/wxWidgets3/include/wx/osx/appprogress.h new file mode 100644 index 0000000000..a64b2cc62f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/appprogress.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/appprogress.h +// Purpose: wxAppProgressIndicator OS X implementation +// Author: Tobias Taschner +// Created: 2014-10-22 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_APPPROG_H_ +#define _WX_OSX_APPPROG_H_ + +#include "wx/window.h" + +class WXDLLIMPEXP_CORE wxAppProgressIndicator + : public wxAppProgressIndicatorBase +{ +public: + wxAppProgressIndicator(wxWindow* parent = NULL, int maxValue = 100); + virtual ~wxAppProgressIndicator(); + + virtual bool IsAvailable() const wxOVERRIDE; + + virtual void SetValue(int value) wxOVERRIDE; + virtual void SetRange(int range) wxOVERRIDE; + virtual void Pulse() wxOVERRIDE; + virtual void Reset() wxOVERRIDE; + +private: + int m_maxValue; + void *m_dockIcon; + + wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator); +}; + +#endif // _WX_OSX_APPPROG_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/bitmap.h b/Externals/wxWidgets3/include/wx/osx/bitmap.h index 8f51d7678f..200d5a26fa 100644 --- a/Externals/wxWidgets3/include/wx/osx/bitmap.h +++ b/Externals/wxWidgets3/include/wx/osx/bitmap.h @@ -32,7 +32,7 @@ class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; class WXDLLIMPEXP_CORE wxMask: public wxObject { - DECLARE_DYNAMIC_CLASS(wxMask) + wxDECLARE_DYNAMIC_CLASS(wxMask); public: wxMask(); @@ -83,7 +83,7 @@ private: class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase { - DECLARE_DYNAMIC_CLASS(wxBitmap) + wxDECLARE_DYNAMIC_CLASS(wxBitmap); friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; diff --git a/Externals/wxWidgets3/include/wx/osx/bmpbuttn.h b/Externals/wxWidgets3/include/wx/osx/bmpbuttn.h index 4a045fe0b6..813a6dcb61 100644 --- a/Externals/wxWidgets3/include/wx/osx/bmpbuttn.h +++ b/Externals/wxWidgets3/include/wx/osx/bmpbuttn.h @@ -42,7 +42,7 @@ protected: virtual wxSize DoGetBestSize() const; - DECLARE_DYNAMIC_CLASS(wxBitmapButton) + wxDECLARE_DYNAMIC_CLASS(wxBitmapButton); }; #endif // _WX_OSX_BMPBUTTN_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/brush.h b/Externals/wxWidgets3/include/wx/osx/brush.h index dc04a09b3d..072cfa4d16 100644 --- a/Externals/wxWidgets3/include/wx/osx/brush.h +++ b/Externals/wxWidgets3/include/wx/osx/brush.h @@ -23,9 +23,6 @@ class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase public: wxBrush(); wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); -#endif wxBrush(const wxBitmap& stipple); virtual ~wxBrush(); @@ -41,17 +38,19 @@ public: wxBrushStyle GetStyle() const ; wxBitmap *GetStipple() const ; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } protected: virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxBrush) + wxDECLARE_DYNAMIC_CLASS(wxBrush); }; #endif // _WX_BRUSH_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/button.h b/Externals/wxWidgets3/include/wx/osx/button.h index 8e8752288c..5726b211b9 100644 --- a/Externals/wxWidgets3/include/wx/osx/button.h +++ b/Externals/wxWidgets3/include/wx/osx/button.h @@ -53,43 +53,7 @@ public: #endif protected: - DECLARE_DYNAMIC_CLASS(wxButton) -}; - -// OS X specific class, not part of public wx API -class WXDLLIMPEXP_CORE wxDisclosureTriangle : public wxControl -{ -public: - wxDisclosureTriangle(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBORDER_NONE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr) - { - Create(parent, id, label, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxBORDER_NONE, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - void SetOpen( bool open ); - bool IsOpen() const; - - // osx specific event handling common for all osx-ports - - virtual bool OSXHandleClicked( double timestampsec ); - -protected: - virtual wxSize DoGetBestSize() const ; + wxDECLARE_DYNAMIC_CLASS(wxButton); }; #endif // _WX_OSX_BUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h b/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h deleted file mode 100644 index 9c6bc30508..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Name: wx/osx/carbon/chkconf.h - * Purpose: Compiler-specific configuration checking - * Author: Julian Smart - * Modified by: - * Created: 01/02/97 - * Copyright: (c) Julian Smart - * Licence: wxWindows licence - */ - -#ifndef _WX_OSX_CARBON_CHKCONF_H_ -#define _WX_OSX_CARBON_CHKCONF_H_ - -/* - * native (1) or emulated (0) toolbar - * also support old notation wxMAC_USE_NATIVE_TOOLBAR - */ - - - -#ifdef wxMAC_USE_NATIVE_TOOLBAR - #define wxOSX_USE_NATIVE_TOOLBAR wxMAC_USE_NATIVE_TOOLBAR -#endif - -#ifndef wxOSX_USE_NATIVE_TOOLBAR - #define wxOSX_USE_NATIVE_TOOLBAR 1 -#endif - -/* - * text rendering system - */ - -#define wxOSX_USE_ATSU_TEXT 1 - -/* - * Audio System - */ - -#define wxOSX_USE_QUICKTIME 1 -#define wxOSX_USE_AUDIOTOOLBOX 0 - -#endif - /* _WX_OSX_CARBON_CHKCONF_H_ */ - diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h b/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h deleted file mode 100644 index 75185b092c..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h +++ /dev/null @@ -1,478 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/dataview.h -// Purpose: wxDataViewCtrl native implementation header for carbon -// Author: -// Copyright: (c) 2009 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DATAVIEWCTRL_CARBON_H_ -#define _WX_DATAVIEWCTRL_CARBON_H_ - -#include "wx/defs.h" - -#if wxUSE_GUI - -#include "wx/osx/core/dataview.h" -#include "wx/osx/private.h" - -// ============================================================================ -// wxDataViewColumnNativeData -// ============================================================================ -class wxDataViewColumnNativeData -{ -public: -// -// constructors / destructor -// - wxDataViewColumnNativeData() - { - } - wxDataViewColumnNativeData(DataBrowserPropertyID initPropertyID) - :m_PropertyID(initPropertyID) - { - } - -// -// data access methods -// - DataBrowserPropertyID GetPropertyID() const - { - return m_PropertyID; - } - - void SetPropertyID(DataBrowserPropertyID newPropertyID) - { - m_PropertyID = newPropertyID; - } - -protected: -private: -// -// variables -// - DataBrowserPropertyID m_PropertyID; // each column is identified by its unique property ID (NOT by the column's index) -}; - -// ============================================================================ -// wxDataViewRendererNativeData -// ============================================================================ -class wxDataViewRendererNativeData -{ -public: -// -// constructors / destructor -// - wxDataViewRendererNativeData() - { - } - wxDataViewRendererNativeData(DataBrowserPropertyType initPropertyType, DataBrowserItemDataRef initItemDataRef=NULL) - :m_ItemDataRef(initItemDataRef), m_PropertyType(initPropertyType) - { - } - -// -// data access methods -// - DataBrowserItemDataRef GetItemDataRef() const - { - return m_ItemDataRef; - } - DataBrowserPropertyType GetPropertyType() const - { - return m_PropertyType; - } - - void SetItemDataRef(DataBrowserItemDataRef newItemDataRef) - { - m_ItemDataRef = newItemDataRef; - } - void SetPropertyType(DataBrowserPropertyType newPropertyType) - { - m_PropertyType = newPropertyType; - } - -protected: -private: -// -// variables -// - DataBrowserItemDataRef m_ItemDataRef; - - DataBrowserPropertyType m_PropertyType; -}; - -// ============================================================================ -// wxMacDataBrowserTableViewControl -// ============================================================================ -// -// This is a wrapper class for the Mac OS X data browser environment. -// It covers all data brower functionality for the native browser's list -// and column style. -// - -// data browser's property IDs have a reserved ID range from 0 - 1023 -// therefore, the first usable property ID is 'kMinPropertyID' -DataBrowserPropertyID const kMinPropertyID = 1024; - -// array of data browser item IDs -WX_DEFINE_ARRAY_SIZE_T(size_t,wxArrayDataBrowserItemID); - -class wxMacDataBrowserTableViewControl : public wxMacControl -{ -public: -// -// constructors / destructor -// - wxMacDataBrowserTableViewControl(wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); - wxMacDataBrowserTableViewControl() - { - } - ~wxMacDataBrowserTableViewControl(); - -// -// callback handling -// - OSStatus SetCallbacks (DataBrowserCallbacks const* callbacks); - OSStatus SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks); - -// -// DnD handling -// - OSStatus EnableAutomaticDragTracking(bool enable=true); - -// -// header handling -// - OSStatus GetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc) const; - - OSStatus SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc); - -// -// layout handling -// - OSStatus AutoSizeColumns(); - - OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false) - - OSStatus GetAttributes (OptionBits* attributes); - OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels - OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels - OSStatus GetDefaultRowHeight (UInt16 * height ) const; - OSStatus GetHeaderButtonHeight(UInt16 *height ); - OSStatus GetPartBounds (DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds); - OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const; - OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const; - - OSStatus SetAttributes (OptionBits attributes); - OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels - OSStatus SetDefaultColumnWidth( UInt16 width ); - OSStatus SetDefaultRowHeight( UInt16 height ); - OSStatus SetHasScrollBars( bool horiz, bool vert ); - OSStatus SetHeaderButtonHeight( UInt16 height ); - OSStatus SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle); - OSStatus SetIndent(float Indent); - OSStatus SetItemRowHeight( DataBrowserItemID item , UInt16 height); - OSStatus SetScrollPosition( UInt32 top , UInt32 left ); - -// -// column handling -// - OSStatus GetColumnCount (UInt32* numColumns) const; - OSStatus GetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const; // returns for the passed property the corresponding column index - OSStatus GetFreePropertyID(DataBrowserPropertyID* propertyID) const; // this method returns a property id that is valid and currently not used; if it cannot be found 'errDataBrowerPropertyNotSupported' is returned - OSStatus GetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags ) const; - OSStatus GetPropertyID (DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID) const; // returns for the passed item data reference the corresponding property ID - OSStatus GetPropertyID (DataBrowserTableViewColumnIndex index, DataBrowserPropertyID* propertyID) const; // returns for the passed column index the corresponding property ID - - OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists - - OSStatus RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID); - OSStatus RemoveColumnByIndex (DataBrowserTableViewColumnIndex index); - - OSStatus SetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index); - OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=false); - OSStatus SetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags); - -// -// item handling -// - OSStatus AddItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // adds a single item - { - return AddItems(container,1,itemID,kDataBrowserItemNoProperty); - } - OSStatus AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); // adds items to the data browser - - OSStatus GetFreeItemID(DataBrowserItemID* id) const; // this method returns an item id that is valid and currently not used; if it cannot be found 'errDataBrowserItemNotAdded' is returned - OSStatus GetItemCount (ItemCount* numItems) const - { - return GetItemCount(kDataBrowserNoItem,true,kDataBrowserItemAnyState,numItems); - } - OSStatus GetItemCount (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const; - OSStatus GetItemID (DataBrowserTableViewRowIndex row, DataBrowserItemID* item) const; - OSStatus GetItems (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const; - OSStatus GetItemRow (DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const; - OSStatus GetItemState (DataBrowserItemID item, DataBrowserItemState* state) const; - - OSStatus IsUsedItemID(DataBrowserItemID itemID) const; // checks if the passed id is in use - - OSStatus RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const; - - OSStatus RemoveItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // removes a single item - { - return RemoveItems(container,1,itemID,kDataBrowserItemNoProperty); - } - OSStatus RemoveItems(void) // removes all items - { - return RemoveItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty); - } - OSStatus RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); - - OSStatus UpdateItem(DataBrowserItemID container, DataBrowserItemID const* item) // updates all columns of the passed item - { - return UpdateItems(container,1,item,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); - } - OSStatus UpdateItems(void) // updates all items - { - return UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); - } - OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const; - -// -// item selection -// - size_t GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const; // returns the number of selected item and the item IDs in the array - OSStatus GetSelectionAnchor(DataBrowserItemID *first, DataBrowserItemID *last) const; - OSStatus GetSelectionFlags (DataBrowserSelectionFlags* flags) const; - - bool IsItemSelected(DataBrowserItemID item) const; - - OSStatus SetSelectionFlags(DataBrowserSelectionFlags flags); - OSStatus SetSelectedItems (UInt32 numItems, DataBrowserItemID const* itemIDs, DataBrowserSetOption operation); - -// -// item sorting -// - OSStatus GetSortOrder (DataBrowserSortOrder* order) const; - OSStatus GetSortProperty(DataBrowserPropertyID* propertyID) const; - - OSStatus Resort(DataBrowserItemID container=kDataBrowserNoItem, Boolean sortChildren=true); - - OSStatus SetSortOrder (DataBrowserSortOrder order); - OSStatus SetSortProperty(DataBrowserPropertyID propertyID); - -// -// container handling -// - OSStatus CloseContainer(DataBrowserItemID containerID); - - OSStatus OpenContainer(DataBrowserItemID containerID); - -protected : -// -// standard callback functions -// - static pascal Boolean DataBrowserCompareProc (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); - static pascal void DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); - static pascal OSStatus DataBrowserGetSetItemDataProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); - static pascal void DataBrowserItemNotificationProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); - - virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0; - virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) = 0; - virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0; - virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0; - -// -// callback functions for customized types -// - static pascal void DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); - static pascal Boolean DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); - static pascal Boolean DataBrowserHitTestProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); - static pascal DataBrowserTrackingResult DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); - - virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0; - virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) = 0; - virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) = 0; - virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) = 0; - -// -// callback functions for drag & drop -/// - static pascal Boolean DataBrowserAcceptDragProc (ControlRef browser, DragReference dragRef, DataBrowserItemID itemID); - static pascal Boolean DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef); - static pascal Boolean DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID); - - virtual Boolean DataBrowserAcceptDragProc (DragReference dragRef, DataBrowserItemID itemID) = 0; - virtual Boolean DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) = 0; - virtual Boolean DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID) = 0; - -// -// event handler for hit testing -/// - void* m_macDataViewCtrlEventHandler; - -private: -// -// wxWidget internal stuff -// - DECLARE_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl) -}; - -// ============================================================================ -// wxMacDataBrowserListViewControl -// ============================================================================ -// -// This class is a wrapper for the native browser's list view style. It expands -// the inherited functionality of the table view control class. -// The term list view is in this case Mac OS X specific and is not related -// to any wxWidget naming conventions. -// -class wxMacDataBrowserListViewControl : public wxMacDataBrowserTableViewControl -{ -public: -// -// constructors / destructor -// - wxMacDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) : wxMacDataBrowserTableViewControl(peer,pos,size,style) - { - } - -// -// column handling -// - OSStatus AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position); - -protected: -private: -}; - - -// ============================================================================ -// wxMacDataViewDataBrowserListViewControl -// ============================================================================ -// -// This is the internal interface class between wxDataViewCtrl (wxWidget) and -// the native data browser (Mac OS X carbon). -// -class wxMacDataViewDataBrowserListViewControl : public wxMacDataBrowserListViewControl, public wxDataViewWidgetImpl -{ -public: -// -// constructors / destructor -// - wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style); - - // - // column related methods (inherited from wxDataViewWidgetImpl) - // - virtual bool ClearColumns (); - virtual bool DeleteColumn (wxDataViewColumn* columnPtr); - virtual void DoSetExpanderColumn(wxDataViewColumn const* columnPtr); - virtual wxDataViewColumn* GetColumn (unsigned int pos) const; - virtual int GetColumnPosition (wxDataViewColumn const* columnPtr) const; - virtual bool InsertColumn (unsigned int pos, wxDataViewColumn* columnPtr); - virtual void FitColumnWidthToContent(unsigned int WXUNUSED(pos)) { /*not implemented*/ } - - // - // item related methods (inherited from wxDataViewWidgetImpl) - // - virtual bool Add (wxDataViewItem const& parent, wxDataViewItem const& item); - virtual bool Add (wxDataViewItem const& parent, wxDataViewItemArray const& items); - virtual void Collapse (wxDataViewItem const& item); - virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr); - virtual void Expand (wxDataViewItem const& item); - virtual unsigned int GetCount () const; - virtual wxRect GetRectangle (wxDataViewItem const& item, wxDataViewColumn const* columnPtr); - virtual bool IsExpanded (wxDataViewItem const& item) const; - virtual bool Reload (); - virtual bool Remove (wxDataViewItem const& parent, wxDataViewItem const& item); - virtual bool Remove (wxDataViewItem const& parent, wxDataViewItemArray const& item); - virtual bool Update (wxDataViewColumn const* columnPtr); - virtual bool Update (wxDataViewItem const& parent, wxDataViewItem const& item); - virtual bool Update (wxDataViewItem const& parent, wxDataViewItemArray const& items); - - // - // model related methods - // - virtual bool AssociateModel(wxDataViewModel* model); - - // - // selection related methods (inherited from wxDataViewWidgetImpl) - // - 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); - virtual void SelectAll (); - virtual void Unselect (wxDataViewItem const& item); - virtual void UnselectAll (); - - // - // sorting related methods - // - virtual wxDataViewColumn* GetSortingColumn () const; - virtual void Resort (); - - // - // other methods (inherited from wxDataViewWidgetImpl) - // - virtual void DoSetIndent (int indent); - virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; - virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height); - virtual void OnSize (); - - virtual void StartEditor( const wxDataViewItem & item, unsigned int column ); - - // - // other methods - // - wxDataViewCtrl* GetDataViewCtrl() const - { - return dynamic_cast(GetWXPeer()); - } - -protected: -// -// standard callback functions (inherited from wxMacDataBrowserTableViewControl) -// - virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); - virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); - virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); - virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue); - -// -// callback functions for customized types (inherited from wxMacDataBrowserTableViewControl) -// - virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); - virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); - virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); - virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); - -// -// callback functions for drag & drop (inherited from wxMacDataBrowserTableViewControl) -// - virtual Boolean DataBrowserAcceptDragProc (DragReference dragRef, DataBrowserItemID itemID); - virtual Boolean DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef); - virtual Boolean DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID); - -// -// drag & drop helper methods -// - wxDataFormat GetDnDDataFormat(wxDataObjectComposite* dataObjects); - wxDataObjectComposite* GetDnDDataObjects(DragReference dragRef, ItemReference itemRef) const; // create the data objects from the native dragged object - -// -// other methods -// - wxDataViewColumn* GetColumnPtr(DataBrowserPropertyID propertyID) const; // returns for the passed property the corresponding pointer to a column; NULL is returned if not found - -private: -}; - -typedef wxMacDataViewDataBrowserListViewControl* wxMacDataViewDataBrowserListViewControlPointer; - -#endif // WX_GUI -#endif // _WX_MACCARBONDATAVIEWCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h b/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h deleted file mode 100644 index 6edb3921d4..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/drawer.h -// Purpose: Drawer child window class. -// Drawer windows appear under their parent window and -// behave like a drawer, opening and closing to reveal -// content that does not need to be visible at all times. -// Author: Jason Bagley -// Modified by: -// Created: 2004-30-01 -// Copyright: (c) Jason Bagley; Art & Logic, Inc. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_DRAWERWINDOW_H_ -#define _WX_DRAWERWINDOW_H_ - -#include "wx/toplevel.h" - -// -// NB: This is currently a private undocumented class - -// it is stable, but the API is not and will change in the -// near future -// - -class WXDLLIMPEXP_ADV wxDrawerWindow : public wxTopLevelWindow -{ - DECLARE_DYNAMIC_CLASS(wxDrawerWindow) - -public: - - wxDrawerWindow(); - - wxDrawerWindow(wxWindow* parent, - wxWindowID id, - const wxString& title, - wxSize size = wxDefaultSize, - wxDirection edge = wxLEFT, - const wxString& name = wxT("drawerwindow")) - { - this->Create(parent, id, title, size, edge, name); - } - - virtual ~wxDrawerWindow(); - - // Create a drawer window. - // If parent is NULL, create as a tool window. - // If parent is not NULL, then wxTopLevelWindow::Attach this window to parent. - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - wxSize size = wxDefaultSize, - wxDirection edge = wxLEFT, - const wxString& name = wxFrameNameStr); - - bool Open(bool show = true); // open or close the drawer, possibility for async param, i.e. animate - bool Close() { return this->Open(false); } - bool IsOpen() const; - - // Set the edge of the parent where the drawer attaches. - bool SetPreferredEdge(wxDirection edge); - wxDirection GetPreferredEdge() const; - wxDirection GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints -}; - -#endif // _WX_DRAWERWINDOW_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h b/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h deleted file mode 100644 index f18c7c9494..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/evtloop.h +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/evtloop.h -// Purpose: declaration of wxEventLoop for wxMac -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-01-12 -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_CARBON_EVTLOOP_H_ -#define _WX_MAC_CARBON_EVTLOOP_H_ - -struct OpaqueEventRef; -typedef OpaqueEventRef *EventRef; - -class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxCFEventLoop -{ -public: - wxGUIEventLoop(); - - virtual void WakeUp(); - -protected: - virtual int DoDispatchTimeout(unsigned long timeout); - - virtual void OSXDoRun(); - virtual void OSXDoStop(); - - virtual CFRunLoopRef CFGetCurrentRunLoop() const; -}; - -#endif // _WX_MAC_CARBON_EVTLOOP_H_ - diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/mimetype.h b/Externals/wxWidgets3/include/wx/osx/carbon/mimetype.h deleted file mode 100644 index 837275285a..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/mimetype.h +++ /dev/null @@ -1,117 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/mimetype.h -// Purpose: Mac Carbon implementation for wx mime-related classes -// Author: Ryan Norton -// Modified by: -// Created: 04/16/2005 -// Copyright: (c) 2005 Ryan Norton () -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/defs.h" -#include "wx/mimetype.h" - - -class wxMimeTypesManagerImpl -{ -public : - //kinda kooky but in wxMimeTypesManager::EnsureImpl it doesn't call - //intialize, so we do it ourselves - wxMimeTypesManagerImpl() : m_hIC(NULL) { Initialize(); } - ~wxMimeTypesManagerImpl() { ClearData(); } - - // load all data into memory - done when it is needed for the first time - void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, - const wxString& extraDir = wxEmptyString); - - // and delete the data here - void ClearData(); - - // implement containing class functions - wxFileType *GetFileTypeFromExtension(const wxString& ext); - wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ; - wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); - - size_t EnumAllFileTypes(wxArrayString& mimetypes); - - void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } - - // create a new filetype association - wxFileType *Associate(const wxFileTypeInfo& ftInfo); - // remove association - bool Unassociate(wxFileType *ft); - -private: - wxArrayFileTypeInfo m_fallbacks; - void* m_hIC; - void** m_hDatabase; - long m_lCount; - - void* pReserved1; - void* pReserved2; - void* pReserved3; - void* pReserved4; - void* pReserved5; - void* pReserved6; - - friend class wxFileTypeImpl; -}; - -class wxFileTypeImpl -{ -public: - //kind of nutty, but mimecmn.cpp creates one with an empty new - wxFileTypeImpl() : m_manager(NULL) {} - ~wxFileTypeImpl() {} //for those broken compilers - - // implement accessor functions - bool GetExtensions(wxArrayString& extensions); - bool GetMimeType(wxString *mimeType) const; - bool GetMimeTypes(wxArrayString& mimeTypes) const; - bool GetIcon(wxIconLocation *iconLoc) const; - bool GetDescription(wxString *desc) const; - bool GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters&) const; - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters&) const; - - size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, - const wxFileType::MessageParameters& params) const; - - // remove the record for this file type - // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead - bool Unassociate(wxFileType *ft) - { - return m_manager->Unassociate(ft); - } - - // set an arbitrary command, ask confirmation if it already exists and - // overwriteprompt is TRUE - bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true); - bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); - - private: - void Init(wxMimeTypesManagerImpl *manager, long lIndex) - { m_manager=(manager); m_lIndex=(lIndex); } - - // helper function - wxString GetCommand(const wxString& verb) const; - - wxMimeTypesManagerImpl *m_manager; - long m_lIndex; - - void* pReserved1; - void* pReserved2; - void* pReserved3; - void* pReserved4; - void* pReserved5; - void* pReserved6; - - friend class wxMimeTypesManagerImpl; -}; - -#endif - //_MIMETYPE_H diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/private.h b/Externals/wxWidgets3/include/wx/osx/carbon/private.h deleted file mode 100644 index 64fa447e14..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/private.h +++ /dev/null @@ -1,1045 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/private.h -// Purpose: Private declarations: as this header is only included by -// wxWidgets itself, it may contain identifiers which don't start -// with "wx". -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PRIVATE_H_ -#define _WX_PRIVATE_H_ - -#if wxUSE_GUI - -#include "wx/osx/uma.h" - -#include "wx/listbox.h" -#include "wx/osx/dc.h" -#include "wx/osx/dcclient.h" -#include "wx/osx/dcmemory.h" - -// app.h - -#endif // wxUSE_GUI - -// filefn.h -WXDLLIMPEXP_BASE wxString wxMacFSSpec2MacFilename( const FSSpec *spec ); -WXDLLIMPEXP_BASE void wxMacFilename2FSSpec( const wxString &path , FSSpec *spec ); - -// utils.h -WXDLLIMPEXP_BASE wxString wxMacFindFolderNoSeparator(short vRefNum, - OSType folderType, - Boolean createFolder); -WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum, - OSType folderType, - Boolean createFolder); - -template EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; } -template<> inline EventParamType wxMacGetEventParamType() { return typeHIShapeRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeQDRgnHandle; } -template<> inline EventParamType wxMacGetEventParamType() { return typeControlRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeWindowRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeMenuRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeEventRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeQDPoint; } -template<> inline EventParamType wxMacGetEventParamType() { return typeQDRectangle; } -template<> inline EventParamType wxMacGetEventParamType() { return typeBoolean; } -template<> inline EventParamType wxMacGetEventParamType() { return typeSInt16; } -template<> inline EventParamType wxMacGetEventParamType() { return typeSInt32; } -template<> inline EventParamType wxMacGetEventParamType() { return typeUInt32; } -template<> inline EventParamType wxMacGetEventParamType() { return typeRGBColor; } -template<> inline EventParamType wxMacGetEventParamType() { return typeHICommand; } -template<> inline EventParamType wxMacGetEventParamType() { return typeHIPoint; } -template<> inline EventParamType wxMacGetEventParamType() { return typeHISize; } -template<> inline EventParamType wxMacGetEventParamType() { return typeHIRect; } -template<> inline EventParamType wxMacGetEventParamType() { return typeVoidPtr; } -template<> inline EventParamType wxMacGetEventParamType() { return typeCFDictionaryRef; } -template<> inline EventParamType wxMacGetEventParamType() { return typeCollection; } -template<> inline EventParamType wxMacGetEventParamType() { return typeCGContextRef; } -/* - These are ambiguous - template<> EventParamType wxMacGetEventParamType() { return typeGrafPtr; } - template<> EventParamType wxMacGetEventParamType() { return typeOSStatus; } - template<> EventParamType wxMacGetEventParamType() { return typeCFIndex; } - template<> EventParamType wxMacGetEventParamType() { return typeGWorldPtr; } - */ - -class WXDLLIMPEXP_CORE wxMacCarbonEvent -{ - -public : - wxMacCarbonEvent() - { - m_eventRef = 0; - m_release = false; - } - - wxMacCarbonEvent( EventRef event , bool release = false ) - { - m_eventRef = event; - m_release = release; - } - - wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) - { - m_eventRef = NULL; - verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) ); - m_release = true; - } - - ~wxMacCarbonEvent() - { - if ( m_release ) - ReleaseEvent( m_eventRef ); - } - - OSStatus Create(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) - { - verify( (m_eventRef == NULL) || m_release ); - if ( m_eventRef && m_release ) - { - ReleaseEvent( m_eventRef ); - m_release = false; - m_eventRef = NULL; - } - OSStatus err = MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef); - if ( err == noErr ) - m_release = true; - return err; - } - - OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData); - - template OSStatus GetParameter( EventParamName inName, EventParamType type , T *data ) - { - return GetParameter( inName, type , sizeof( T ) , data ); - } - template OSStatus GetParameter( EventParamName inName, T *data ) - { - return GetParameter( inName, wxMacGetEventParamType() , data ); - } - - template T GetParameter( EventParamName inName ) - { - T value; - verify_noerr( GetParameter( inName, &value ) ); - return value; - } - template T GetParameter( EventParamName inName, EventParamType inDesiredType ) - { - T value; - verify_noerr( GetParameter( inName, inDesiredType , &value ) ); - return value; - } - - OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData); - template OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data ) - { - return SetParameter( inName, inDesiredType , sizeof( T ) , data ); - } - template OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data ) - { - return SetParameter( inName, inDesiredType , &data ); - } - template OSStatus SetParameter( EventParamName inName, const T *data ) - { - return SetParameter( inName, wxMacGetEventParamType() , data ); - } - template OSStatus SetParameter( EventParamName inName, const T& data ) - { - return SetParameter( inName, wxMacGetEventParamType() , &data ); - } - UInt32 GetClass() - { - return ::GetEventClass( m_eventRef ); - } - UInt32 GetKind() - { - return ::GetEventKind( m_eventRef ); - } - EventTime GetTime() - { - return ::GetEventTime( m_eventRef ); - } - UInt32 GetTicks() - { - return EventTimeToTicks( GetTime() ); - } - OSStatus SetCurrentTime( ) - { - return ::SetEventTime( m_eventRef , GetCurrentEventTime() ); - } - OSStatus SetTime( EventTime when ) - { - return ::SetEventTime( m_eventRef , when ); - } - operator EventRef () { return m_eventRef; } - - bool IsValid() { return m_eventRef != 0; } -protected : - EventRef m_eventRef; - bool m_release; -}; - -#if wxUSE_GUI - -class WXDLLIMPEXP_FWD_CORE wxMacToolTipTimer ; - -class WXDLLIMPEXP_CORE wxMacToolTip -{ -public : - wxMacToolTip() ; - ~wxMacToolTip() ; - - void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ; - void Draw() ; - void Clear() ; - - long GetMark() - { return m_mark ; } - - bool IsShown() - { return m_shown ; } - -private : - wxString m_label ; - wxPoint m_position ; - Rect m_rect ; - WindowRef m_window ; - PicHandle m_backpict ; - bool m_shown ; - long m_mark ; -#if wxUSE_TIMER - wxMacToolTipTimer* m_timer ; -#endif - wxCFStringRef m_helpTextRef ; -} ; - -// Quartz - -WXDLLIMPEXP_CORE void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ); -WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info ); - -#define MAC_WXHBITMAP(a) (GWorldPtr(a)) -#define MAC_WXHMETAFILE(a) (PicHandle(a)) -#define MAC_WXHICON(a) (IconRef(a)) -#define MAC_WXHCURSOR(a) (CursHandle(a)) -#define MAC_WXHRGN(a) (RgnHandle(a)) -#define MAC_WXHWND(a) (WindowPtr(a)) -#define MAC_WXRECPTR(a) ((Rect*)a) -#define MAC_WXPOINTPTR(a) ((Point*)a) -#define MAC_WXHMENU(a) ((MenuHandle)a) - -struct wxOpaqueWindowRef -{ - wxOpaqueWindowRef( WindowRef ref ) { m_data = ref; } - operator WindowRef() { return m_data; } -private : - WindowRef m_data; -}; - -WXDLLIMPEXP_CORE void wxMacRectToNative( const wxRect *wx , Rect *n ); -WXDLLIMPEXP_CORE void wxMacNativeToRect( const Rect *n , wxRect* wx ); -WXDLLIMPEXP_CORE void wxMacPointToNative( const wxPoint* wx , Point *n ); -WXDLLIMPEXP_CORE void wxMacNativeToPoint( const Point *n , wxPoint* wx ); - -WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef); - -WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId ); -WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId ); -WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item ); - -WXDLLIMPEXP_CORE pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ); -WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); - -ControlActionUPP GetwxMacLiveScrollbarActionProc(); - -// additional optional event defines - -class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl -{ -public : - wxMacControl( wxWindowMac* peer , bool isRootControl = false, bool isUserPane = false ); - wxMacControl() ; - virtual ~wxMacControl(); - - void Init(); - - void SetReferenceInNativeControl(); - static wxMacControl* GetReferenceFromNativeControl(ControlRef control); - - virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } - virtual ControlRef GetControlRef() const { return m_controlRef; } - - virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; } - - virtual bool IsVisible() const; - - virtual void Raise(); - - virtual void Lower(); - - virtual void ScrollRect( const wxRect *rect, int dx, int dy ); - - virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; - virtual void Move(int x, int y, int width, int height); - virtual void GetPosition( int &x, int &y ) const; - virtual void GetSize( int &width, int &height ) const; - virtual void SetControlSize( wxWindowVariant variant ) ; - - // where is in native window relative coordinates - virtual void SetNeedsDisplay( const wxRect* where = NULL ); - virtual bool GetNeedsDisplay() const; - - virtual bool CanFocus() const; - // return true if successful - virtual bool SetFocus(); - virtual bool HasFocus() const; - - void RemoveFromParent(); - void Embed( wxWidgetImpl *parent ); - - void SetDefaultButton( bool isDefault ); - void PerformClick(); - void SetLabel( const wxString& title, wxFontEncoding encoding ); - - void SetCursor( const wxCursor & cursor ); - void CaptureMouse(); - void ReleaseMouse(); - - wxInt32 GetValue() const; - void SetValue( wxInt32 v ); - wxBitmap GetBitmap() const; - void SetBitmap( const wxBitmap& bitmap ); - void SetBitmapPosition( wxDirection dir ); - - void GetBestRect( wxRect *r ) const; - bool IsEnabled() const; - void Enable( bool enable ); - bool ButtonClickDidStateChange() { return false ;} - void SetMinimum( wxInt32 v ); - void SetMaximum( wxInt32 v ); - void PulseGauge() ; - void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ); - - // temp convenience methods - - void GetBestRect( Rect *r ) const; - /* - void operator= (ControlRef c) { m_controlRef = c; } - operator ControlRef () { return m_controlRef; } - operator ControlRef * () { return &m_controlRef; } - */ - // accessing data and values - - virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ); - virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const; - virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const; - virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 ); - virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 ); - - virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ); - - virtual wxInt32 GetMaximum() const; - virtual wxInt32 GetMinimum() const; - - virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); - virtual void SetRange( SInt32 minimum , SInt32 maximum ); - - // templated helpers - - Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const - { - Size sz; - verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ); - return sz; - } - template OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data ) - { - return SetData( inPartCode , inTag , sizeof( T ) , data ); - } - template OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data ) - { - return SetData( inPartCode , inTag , sizeof( T ) , &data ); - } - template OSStatus SetData( ResType inTag , const T *data ) - { - return SetData( kControlEntireControl , inTag , sizeof( T ) , data ); - } - template OSStatus SetData( ResType inTag , const T& data ) - { - return SetData( kControlEntireControl , inTag , sizeof( T ) , &data ); - } - template OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const - { - Size dummy; - return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ); - } - template T GetData( ControlPartCode inPartCode , ResType inTag ) const - { - T value; - OSStatus err = GetData( inPartCode , inTag , &value ); - - if ( err != noErr ) - { - wxFAIL_MSG( wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"), - inPartCode, (int)inTag) ); - } - - return value; - } - template OSStatus GetData( ResType inTag , T *data ) const - { - Size dummy; - return GetData( kControlEntireControl , inTag , sizeof( T ) , data , &dummy ); - } - template T GetData( ResType inTag ) const - { - return GetData( kControlEntireControl , inTag ); - } - - // Flash the control for the specified amount of time - - virtual void VisibilityChanged( bool shown ); - virtual void SuperChangedPosition(); - - - virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); - virtual void SetBackgroundColour( const wxColour& col ); - virtual bool SetBackgroundStyle(wxBackgroundStyle style); - virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ); - void SetActionProc( ControlActionUPP actionProc ); - SInt32 GetViewSize() const; - - virtual void SetVisibility( bool visible ); - - virtual bool IsActive() const; - - // invalidates this control and all children - virtual void InvalidateWithChildren(); - virtual void SetDrawingEnabled( bool enable ); - - // in native parent window relative coordinates - - virtual void GetRectInWindowCoords( Rect *r ); - - - virtual void GetFeatures( UInt32 *features ); - - // to be moved into a tab control class - - virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); - - virtual void InstallEventHandler( WXWidget control = NULL ); -protected : - WXEVENTHANDLERREF m_macControlEventHandler ; - ControlRef m_controlRef; - wxFont m_font; - long m_windowStyle; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl) -}; - -// ============================================================================ -// DataBrowser Wrapper -// ============================================================================ -// -// basing on DataBrowserItemIDs -// - -class WXDLLIMPEXP_CORE wxMacDataBrowserControl : public wxMacControl -{ -public : - wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); - wxMacDataBrowserControl() {} - - OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks ); - - OSStatus GetItemCount( DataBrowserItemID container, - Boolean recurse, - DataBrowserItemState state, - ItemCount *numItems) const; - - OSStatus GetItems( DataBrowserItemID container, - Boolean recurse, - DataBrowserItemState state, - Handle items) const; - - - OSStatus AddColumn( DataBrowserListViewColumnDesc *columnDesc, - DataBrowserTableViewColumnIndex position ); - - OSStatus RemoveColumn( DataBrowserTableViewColumnIndex position ); - - OSStatus AutoSizeColumns(); - - OSStatus SetHasScrollBars( bool horiz, bool vert ); - OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ); - - OSStatus SetHeaderButtonHeight( UInt16 height ); - OSStatus GetHeaderButtonHeight( UInt16 *height ); - - OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty, - DataBrowserPropertyID propertyID ) const; - - OSStatus AddItems( DataBrowserItemID container, UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty ); - OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty ); - OSStatus RevealItem( DataBrowserItemID item, - DataBrowserPropertyID propertyID, - DataBrowserRevealOptions options ) const; - - OSStatus SetSelectionFlags( DataBrowserSelectionFlags ); - OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const; - bool IsItemSelected( DataBrowserItemID item ) const; - OSStatus SetSelectedItems( UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserSetOption operation ); - - OSStatus GetItemID( DataBrowserTableViewRowIndex row, - DataBrowserItemID * item ) const; - OSStatus GetItemRow( DataBrowserItemID item, - DataBrowserTableViewRowIndex * row ) const; - - OSStatus SetDefaultRowHeight( UInt16 height ); - OSStatus GetDefaultRowHeight( UInt16 * height ) const; - - OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height); - OSStatus GetRowHeight( DataBrowserItemID item , UInt16 *height) const; - - OSStatus GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const; - OSStatus SetColumnWidth( DataBrowserPropertyID column , UInt16 width ); - - OSStatus GetDefaultColumnWidth( UInt16 *width ) const; - OSStatus SetDefaultColumnWidth( UInt16 width ); - - OSStatus GetColumnCount( UInt32* numColumns) const; - - OSStatus GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ); - - OSStatus GetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex *position) const; - OSStatus SetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position); - - OSStatus GetScrollPosition( UInt32 *top , UInt32 *left ) const; - OSStatus SetScrollPosition( UInt32 top , UInt32 left ); - - OSStatus GetSortProperty( DataBrowserPropertyID *column ) const; - OSStatus SetSortProperty( DataBrowserPropertyID column ); - - OSStatus GetSortOrder( DataBrowserSortOrder *order ) const; - OSStatus SetSortOrder( DataBrowserSortOrder order ); - - OSStatus GetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags *flags ) const; - OSStatus SetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags flags ); - - OSStatus GetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ) const; - OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ); - - OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows ); - - OSStatus GetItemPartBounds( DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect * bounds ); -protected : - - static pascal void DataBrowserItemNotificationProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ); - - virtual void ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData) = 0; - - static pascal OSStatus DataBrowserGetSetItemDataProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ); - - virtual OSStatus GetSetItemData( - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ) = 0; - - static pascal Boolean DataBrowserCompareProc( - ControlRef browser, - DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty); - - virtual Boolean CompareItems(DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty) = 0; - DECLARE_ABSTRACT_CLASS(wxMacDataBrowserControl) -}; - -// ============================================================================ -// Higher-level Databrowser -// ============================================================================ -// -// basing on data item objects -// - -// forward decl - -class wxMacDataItemBrowserControl; -class wxMacListBoxItem; - -const DataBrowserPropertyID kTextColumnId = 1024; -const DataBrowserPropertyID kNumericOrderColumnId = 1025; - -// for multi-column controls, we will use this + the column ID to identify the -// column. We don't use kTextColumnId there, and ideally the two should merge. -const DataBrowserPropertyID kMinColumnId = 1050; - -// base API for high-level databrowser operations - -// base class for databrowser items - -enum DataItemType { - DataItem_Text -}; - -/* -class WXDLLIMPEXP_CORE wxMacDataItem -{ -public : - wxMacDataItem(); - virtual ~wxMacDataItem(); -} ; -*/ - -class WXDLLIMPEXP_CORE wxMacDataItem -{ -public : - wxMacDataItem(); - virtual ~wxMacDataItem(); - - virtual bool IsLessThan(wxMacDataItemBrowserControl *owner , - const wxMacDataItem*, - DataBrowserPropertyID property) const; - - // returns true if access was successful, otherwise false - virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - bool changeValue ); - - virtual void Notification(wxMacDataItemBrowserControl *owner , - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) const; - - void SetOrder( SInt32 order ); - SInt32 GetOrder() const; - -protected : - SInt32 m_order; - -}; - -enum ListSortOrder { - SortOrder_None, - SortOrder_Text_Ascending, - SortOrder_Text_Descending -}; - -typedef wxMacDataItem* wxMacDataItemPtr; -const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL; -typedef void * wxListColumnId ; - -WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE); - -class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl -{ -public : - wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style); - wxMacDataItemBrowserControl() {} - // create a list item (can be a subclass of wxMacListBoxItem) - - unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const; - void GetItems(const wxMacDataItem* container, bool recurse , - DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const; - - unsigned int GetSelectedItemCount( const wxMacDataItem* container, bool recurse ) const; - - unsigned int GetLineFromItem(const wxMacDataItem *item) const; - wxMacDataItem * GetItemFromLine(unsigned int n) const; - - void UpdateItem(const wxMacDataItem *container, const wxMacDataItem *item, - DataBrowserPropertyID property) const; - void UpdateItems(const wxMacDataItem *container, wxArrayMacDataItemPtr &items, - DataBrowserPropertyID property) const; - - void InsertColumn(int colId, DataBrowserPropertyType colType, - const wxString& title, SInt16 just = teFlushDefault, int defaultWidth = -1); - - int GetColumnWidth(int colId); - void SetColumnWidth(int colId, int width); - - void AddItem(wxMacDataItem *container, wxMacDataItem *item); - void AddItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items ); - - void RemoveAllItems(wxMacDataItem *container); - void RemoveItem(wxMacDataItem *container, wxMacDataItem* item); - void RemoveItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items); - - void SetSelectedItem( wxMacDataItem* item , DataBrowserSetOption option); - void SetSelectedItems( wxArrayMacDataItemPtr &items , DataBrowserSetOption option); - void SetSelectedAllItems( DataBrowserSetOption option); - Boolean IsItemSelected( const wxMacDataItem* item) const; - - void RevealItem( wxMacDataItem* item, DataBrowserRevealOptions options); - - void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const; - - // add and remove - - virtual void MacDelete( unsigned int n ); - virtual void MacInsert( unsigned int n, wxMacDataItem* item); - virtual void MacClear(); - - // accessing content - - virtual unsigned int MacGetCount() const; - -public : - - // as we are getting the same events for human and API selection we have to suppress - // events in the latter case, since this will be used from many subclasses we keep it here - - bool IsSelectionSuppressed() const { return m_suppressSelection; } - bool SuppressSelection( bool suppress ); - - // client data - - virtual wxClientDataType GetClientDataType() const; - virtual void SetClientDataType(wxClientDataType clientDataItemsType); - //virtual ListSortOrder GetSortOrder() const; - //virtual void SetSortOrder(const ListSortOrder sort); - - - -protected: - - ListSortOrder m_sortOrder; - wxClientDataType m_clientDataItemsType; - - // ID aware base methods, should be 'final' ie not changed in subclasses - - virtual Boolean CompareItems(DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty); - - virtual OSStatus GetSetItemData(DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ); - - virtual void ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); - - -private : - - bool m_suppressSelection; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataItemBrowserControl) -}; - -class WXDLLIMPEXP_CORE wxMacDataItemBrowserSelectionSuppressor -{ -public : - wxMacDataItemBrowserSelectionSuppressor(wxMacDataItemBrowserControl *browser); - ~wxMacDataItemBrowserSelectionSuppressor(); - -private : - - bool m_former; - wxMacDataItemBrowserControl* m_browser; -}; - -// ============================================================================ -// platform listbox implementation -// ============================================================================ - -// exposed for reuse in wxCheckListBox - -class WXDLLIMPEXP_CORE wxMacListBoxItem : public wxMacDataItem -{ -public : - wxMacListBoxItem(); - - virtual ~wxMacListBoxItem(); - - virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - bool changeValue ); - - virtual void Notification(wxMacDataItemBrowserControl *owner , - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) const; -protected : -}; - -class WXDLLIMPEXP_CORE wxMacDataBrowserColumn : public wxListWidgetColumn -{ -public : - wxMacDataBrowserColumn( DataBrowserPropertyID propertyId, DataBrowserPropertyType colType, bool editable ) - : m_property(propertyId), m_editable(editable), m_type( colType ) - { - } - ~wxMacDataBrowserColumn() - { - } - DataBrowserPropertyID GetProperty() const { return m_property ; } - - bool IsEditable() const { return m_editable; } - - DataBrowserPropertyType GetType() const { return m_type; } - -protected : - DataBrowserPropertyID m_property; - bool m_editable; - DataBrowserPropertyType m_type; -} ; - -WX_DEFINE_ARRAY_PTR(wxMacDataBrowserColumn *, wxArrayMacDataBrowserColumns); - - -class WXDLLIMPEXP_CORE wxMacDataBrowserCellValue : public wxListWidgetCellValue -{ -public : - wxMacDataBrowserCellValue(DataBrowserItemDataRef data) : m_data(data) {} - virtual ~wxMacDataBrowserCellValue() {} - - virtual void Set( CFStringRef value ); - virtual void Set( const wxString& value ); - virtual void Set( int value ) ; - virtual void Check( bool check ); - - virtual int GetIntValue() const ; - virtual wxString GetStringValue() const ; -protected : - DataBrowserItemDataRef m_data; -} ; - - -class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl, public wxListWidgetImpl -{ -public: - wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); - wxMacDataBrowserListControl() {} - virtual ~wxMacDataBrowserListControl(); - - // wxListWidgetImpl Methods - - wxListWidgetColumn* InsertTextColumn( unsigned int pos, const wxString& title, bool editable = false, - wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; - wxListWidgetColumn* InsertCheckColumn( unsigned int pos , const wxString& title, bool editable = false, - wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; - - wxMacDataBrowserColumn* DoInsertColumn( unsigned int pos, DataBrowserPropertyID property, - const wxString& title, bool editable, - DataBrowserPropertyType colType, SInt16 just, int width ); - // add and remove - - virtual void ListDelete( unsigned int n ); - virtual void ListInsert( unsigned int n ); - virtual void ListClear(); - - // selecting - - virtual void ListDeselectAll(); - virtual void ListSetSelection( unsigned int n, bool select, bool multi = false ); - virtual int ListGetSelection() const; - virtual int ListGetSelections( wxArrayInt& aSelections ) const; - virtual bool ListIsSelected( unsigned int n ) const; - - // display - - virtual void ListScrollTo( unsigned int n ); - - // accessing content - - virtual unsigned int ListGetCount() const; - virtual int DoListHitTest( const wxPoint& inpoint ) const; - - virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ); - virtual void UpdateLineToEnd( unsigned int n) ; - - // pointing back - - wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID ); - -protected: - virtual void ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); - -private: - wxArrayMacDataBrowserColumns m_columns; - int m_nextColumnId ; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) -}; - -// ============================================================================ -// graphics implementation -// ============================================================================ - -// draw the image 'upside down' corrected as HIViewDrawCGImage does - -OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( - CGContextRef inContext, - const HIRect * inBounds, - CGImageRef inImage) ; - -CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; - -#endif // wxUSE_GUI - -#define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \ -UPP Get##x() \ -{ \ - static UPP sHandler = NULL; \ - if ( sHandler == NULL ) \ - sHandler = New##UPP( x ); \ - return sHandler; \ -} - -//--------------------------------------------------------------------------- -// cocoa bridging utilities -//--------------------------------------------------------------------------- - -bool wxMacInitCocoa(); - -typedef Cursor ClassicCursor; - -// ------------- -// Common to all -// ------------- - -// Cursor support - -const short kwxCursorBullseye = 0; -const short kwxCursorBlank = 1; -const short kwxCursorPencil = 2; -const short kwxCursorMagnifier = 3; -const short kwxCursorNoEntry = 4; -const short kwxCursorPaintBrush = 5; -const short kwxCursorPointRight = 6; -const short kwxCursorPointLeft = 7; -const short kwxCursorQuestionArrow = 8; -const short kwxCursorRightArrow = 9; -const short kwxCursorSizeNS = 10; -const short kwxCursorSize = 11; -const short kwxCursorSizeNESW = 12; -const short kwxCursorSizeNWSE = 13; -const short kwxCursorRoller = 14; -const short kwxCursorWatch = 15; -const short kwxCursorLast = kwxCursorWatch; - -// exposing our fallback cursor map - -extern ClassicCursor gMacCursors[]; - -// -// -// - -#if wxUSE_GUI - -class wxNonOwnedWindowCarbonImpl : public wxNonOwnedWindowImpl -{ -public : - wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) ; - - wxNonOwnedWindowCarbonImpl(); - virtual ~wxNonOwnedWindowCarbonImpl(); - - virtual void WillBeDestroyed() ; - void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, - long style, long extraStyle, const wxString& name ) ; - void Create( wxWindow* parent, WXWindow nativeWindow ); - - WXWindow GetWXWindow() const; - void Raise(); - void Lower(); - bool Show(bool show); - bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); - - - void Update(); - bool SetTransparent(wxByte alpha); - bool SetBackgroundColour(const wxColour& col ); - void SetExtraStyle( long exStyle ); - bool SetBackgroundStyle(wxBackgroundStyle style); - bool CanSetTransparent(); - void MoveWindow(int x, int y, int width, int height); - void GetPosition( int &x, int &y ) const; - void GetSize( int &width, int &height ) const; - void GetContentArea( int &left , int &top , int &width , int &height ) const; - - bool SetShape(const wxRegion& region); - - virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; - - virtual bool IsMaximized() const; - - virtual bool IsIconized() const; - - virtual void Iconize( bool iconize ); - - virtual void Maximize(bool maximize); - - virtual bool IsFullScreen() const; - - virtual bool ShowFullScreen(bool show, long style); - - virtual void ShowWithoutActivating(); - - virtual void RequestUserAttention(int flags); - - virtual void ScreenToWindow( int *x, int *y ); - - virtual void WindowToScreen( int *x, int *y ); - virtual bool IsActive(); - - - bool MacGetUnifiedAppearance() const ; - void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; - wxUint32 MacGetWindowAttributes() const ; - void MacSetMetalAppearance( bool set ) ; - bool MacGetMetalAppearance() const ; - void MacSetUnifiedAppearance( bool set ); - - WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } - - wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } -protected : - void MacInstallTopLevelWindowEventHandler(); - - WXEVENTHANDLERREF m_macEventHandler ; - WindowRef m_macWindow; - void * m_macFullScreenData ; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCarbonImpl) -}; - -#endif // wxUSE_GUI - -#endif - // _WX_PRIVATE_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/private/mactext.h b/Externals/wxWidgets3/include/wx/osx/carbon/private/mactext.h deleted file mode 100644 index d665abaa0d..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/private/mactext.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/private/mactext.h -// Purpose: private wxMacTextControl base class -// Author: Stefan Csomor -// Modified by: -// Created: 03/02/99 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_PRIVATE_MACTEXT_H_ -#define _WX_MAC_PRIVATE_MACTEXT_H_ - -#include "wx/osx/private.h" - -// implementation exposed, so that search control can pull it - -class wxMacUnicodeTextControl : public wxMacControl, public wxTextWidgetImpl -{ -public : - wxMacUnicodeTextControl( wxTextCtrl *wxPeer ) ; - wxMacUnicodeTextControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) ; - virtual ~wxMacUnicodeTextControl(); - - virtual bool CanFocus() const - { return true; } - virtual void VisibilityChanged(bool shown); - virtual wxString GetStringValue() const ; - virtual void SetStringValue( const wxString &str) ; - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual bool CanPaste() const; - virtual void SetEditable(bool editable) ; - virtual void GetSelection( long* from, long* to) const ; - virtual void SetSelection( long from , long to ) ; - virtual void WriteText(const wxString& str) ; - -protected : - void InstallEventHandlers(); - - // contains the tag for the content (is different for password and non-password controls) - OSType m_valueTag ; - WXEVENTHANDLERREF m_macTextCtrlEventHandler ; -public : - ControlEditTextSelectionRec m_selection ; -}; - -#endif // _WX_MAC_PRIVATE_MACTEXT_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/private/print.h b/Externals/wxWidgets3/include/wx/osx/carbon/private/print.h index b00fd619ef..eeda2bef28 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/private/print.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/private/print.h @@ -28,10 +28,10 @@ public: virtual bool IsOk() const ; - virtual void TransferFrom( wxPageSetupDialogData * ); + virtual void TransferFrom( const wxPageSetupDialogData * ); virtual void TransferTo( wxPageSetupDialogData * ); - virtual void TransferFrom( wxPrintDialogData * ); + virtual void TransferFrom( const wxPrintDialogData * ); virtual void TransferTo( wxPrintDialogData * ); PMPrintSession GetPrintSession() { return m_macPrintSession; } @@ -55,22 +55,11 @@ protected : PMPrintSettings m_macPrintSettings ; PMPaper m_macPaper; private: - DECLARE_DYNAMIC_CLASS(wxOSXPrintData) + wxDECLARE_DYNAMIC_CLASS(wxOSXPrintData); } ; WXDLLIMPEXP_CORE wxPrintNativeDataBase* wxOSXCreatePrintData(); -#if wxOSX_USE_CARBON -class WXDLLIMPEXP_CORE wxOSXCarbonPrintData : public wxOSXPrintData -{ -public: - wxOSXCarbonPrintData(); - virtual ~wxOSXCarbonPrintData(); -private: - DECLARE_DYNAMIC_CLASS(wxOSXCarbonPrintData) -} ; -#endif - #if wxOSX_USE_COCOA class WXDLLIMPEXP_CORE wxOSXCocoaPrintData : public wxOSXPrintData { @@ -85,7 +74,7 @@ protected: WX_NSPrintInfo m_macPrintInfo; private: - DECLARE_DYNAMIC_CLASS(wxOSXCocoaPrintData) + wxDECLARE_DYNAMIC_CLASS(wxOSXCocoaPrintData); } ; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/private/timer.h b/Externals/wxWidgets3/include/wx/osx/carbon/private/timer.h deleted file mode 100644 index 0d68d7a204..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/private/timer.h +++ /dev/null @@ -1,32 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/private/timer.h -// Purpose: wxTimer class -// Author: Stefan Csomor -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_PRIVATE_TIMER_H_ -#define _WX_MAC_PRIVATE_TIMER_H_ - -#include "wx/private/timer.h" - -struct MacTimerInfo; - -class WXDLLIMPEXP_CORE wxCarbonTimerImpl : public wxTimerImpl -{ -public: - wxCarbonTimerImpl(wxTimer *timer); - virtual ~wxCarbonTimerImpl(); - - virtual bool Start(int milliseconds = -1, bool one_shot = false); - virtual void Stop(); - - virtual bool IsRunning() const; - -private: - MacTimerInfo *m_info; -}; - -#endif // _WX_MAC_PRIVATE_TIMER_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/region.h b/Externals/wxWidgets3/include/wx/osx/carbon/region.h index f9c3fe3dd3..1aa40e46e2 100644 --- a/Externals/wxWidgets3/include/wx/osx/carbon/region.h +++ b/Externals/wxWidgets3/include/wx/osx/carbon/region.h @@ -57,7 +57,7 @@ protected: virtual bool DoUnionWithRect(const wxRect& rect); private: - DECLARE_DYNAMIC_CLASS(wxRegion) + wxDECLARE_DYNAMIC_CLASS(wxRegion); friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; }; @@ -96,7 +96,7 @@ private: wxRegion m_region; wxRect* m_rects; - DECLARE_DYNAMIC_CLASS(wxRegionIterator) + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); }; #endif // _WX_MAC_CARBON_REGION_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h b/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h deleted file mode 100644 index 0f9ffb1763..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/statbmp.h +++ /dev/null @@ -1,64 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/statbmp.h -// Purpose: wxStaticBitmap class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_STATBMP_H_ -#define _WX_STATBMP_H_ - -#include "wx/icon.h" - -class WXDLLIMPEXP_CORE wxStaticBitmap: public wxStaticBitmapBase -{ - DECLARE_DYNAMIC_CLASS(wxStaticBitmap) - public: - wxStaticBitmap() { } - - wxStaticBitmap(wxWindow *parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr) - { - Create(parent, id, label, pos, size, style, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxBitmap& label, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxStaticBitmapNameStr); - - virtual void SetBitmap(const wxBitmap& bitmap); - - virtual void Command(wxCommandEvent& WXUNUSED(event)) {} - virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {} - void OnPaint( wxPaintEvent &event ) ; - - wxBitmap GetBitmap() const { return m_bitmap; } - wxIcon GetIcon() const - { - // icons and bitmaps are really the same thing in wxMac - return (const wxIcon &)m_bitmap; - } - void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; } - - // overridden base class virtuals - virtual bool AcceptsFocus() const { return false; } - - protected: - virtual wxSize DoGetBestSize() const; - - wxBitmap m_bitmap; - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_STATBMP_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/uma.h b/Externals/wxWidgets3/include/wx/osx/carbon/uma.h deleted file mode 100644 index 57b77f798c..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/carbon/uma.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/uma.h -// Purpose: Universal MacOS API -// Author: Stefan Csomor -// Modified by: -// Created: 03/02/99 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef H_UMA -#define H_UMA - -#include "wx/osx/private.h" - -#if wxUSE_GUI - -// menu manager - -MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding) ; -void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding) ; -void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ; - -void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , wxAcceleratorEntry *entry = NULL ) ; -void UMAInsertMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ; -void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ; - -void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title , wxFontEncoding encoding ) ; - -// Retrieves the Help menu handle. Warning: As a side-effect this functions also -// creates the Help menu if it didn't exist yet. -OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ - -// Same as UMAGetHelpMenu, but doesn't create the Help menu if UMAGetHelpMenu hasn't been called yet. -OSStatus UMAGetHelpMenuDontCreate( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ - -#endif // wxUSE_GUI - -#endif diff --git a/Externals/wxWidgets3/include/wx/osx/checkbox.h b/Externals/wxWidgets3/include/wx/osx/checkbox.h index 3ba0accc90..c81865fbce 100644 --- a/Externals/wxWidgets3/include/wx/osx/checkbox.h +++ b/Externals/wxWidgets3/include/wx/osx/checkbox.h @@ -42,7 +42,7 @@ protected: void DoSet3StateValue(wxCheckBoxState val); virtual wxCheckBoxState DoGet3StateValue() const; - DECLARE_DYNAMIC_CLASS(wxCheckBox) + wxDECLARE_DYNAMIC_CLASS(wxCheckBox); }; class WXDLLIMPEXP_FWD_CORE wxBitmap; @@ -76,7 +76,7 @@ public: virtual void SetLabel(const wxBitmap *bitmap); virtual void SetLabel( const wxString & WXUNUSED(name) ) {} - DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) + wxDECLARE_DYNAMIC_CLASS(wxBitmapCheckBox); }; #endif // _WX_CHECKBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/checklst.h b/Externals/wxWidgets3/include/wx/osx/checklst.h index c23d36f562..3039639a54 100644 --- a/Externals/wxWidgets3/include/wx/osx/checklst.h +++ b/Externals/wxWidgets3/include/wx/osx/checklst.h @@ -64,19 +64,19 @@ public: const wxString& name = wxListBoxNameStr); // items may be checked - bool IsChecked(unsigned int uiIndex) const; - void Check(unsigned int uiIndex, bool bCheck = true); + bool IsChecked(unsigned int uiIndex) const wxOVERRIDE; + void Check(unsigned int uiIndex, bool bCheck = true) wxOVERRIDE; // data callbacks - virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ) wxOVERRIDE; + virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ) wxOVERRIDE; protected: // override all methods which add/delete items to update m_checks array as // well - virtual void OnItemInserted(unsigned int pos); - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); + virtual void OnItemInserted(unsigned int pos) wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; + virtual void DoClear() wxOVERRIDE; // the array containing the checked status of the items wxArrayInt m_checks; @@ -86,8 +86,8 @@ protected: void Init(); private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxCheckListBox) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxCheckListBox); }; #endif // _WX_MAC_CHECKLST_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/chkconf.h b/Externals/wxWidgets3/include/wx/osx/chkconf.h index c960923cc8..113f8052c2 100644 --- a/Externals/wxWidgets3/include/wx/osx/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/chkconf.h @@ -40,25 +40,20 @@ #define wxOSX_USE_CARBON 0 #endif +#ifdef __WXOSX_IPHONE__ + #define wxOSX_USE_IPHONE 1 +#else + #define wxOSX_USE_IPHONE 0 +#endif + /* * setting flags according to the platform */ #ifdef __LP64__ - #if wxOSX_USE_COCOA == 0 - #undef wxOSX_USE_COCOA - #define wxOSX_USE_COCOA 1 - #endif #if wxOSX_USE_CARBON #error "Carbon does not support 64bit" #endif - #define wxOSX_USE_IPHONE 0 -#else - #ifdef __WXOSX_IPHONE__ - #define wxOSX_USE_IPHONE 1 - #else - #define wxOSX_USE_IPHONE 0 - #endif #endif /* @@ -79,8 +74,6 @@ #if wxOSX_USE_IPHONE #include "wx/osx/iphone/chkconf.h" -#elif wxOSX_USE_CARBON - #include "wx/osx/carbon/chkconf.h" #elif wxOSX_USE_COCOA #include "wx/osx/cocoa/chkconf.h" #endif diff --git a/Externals/wxWidgets3/include/wx/osx/choice.h b/Externals/wxWidgets3/include/wx/osx/choice.h index 0e108f4552..e261782ef6 100644 --- a/Externals/wxWidgets3/include/wx/osx/choice.h +++ b/Externals/wxWidgets3/include/wx/osx/choice.h @@ -21,7 +21,7 @@ WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; // Choice item class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase { - DECLARE_DYNAMIC_CLASS(wxChoice) + wxDECLARE_DYNAMIC_CLASS(wxChoice); public: wxChoice() diff --git a/Externals/wxWidgets3/include/wx/osx/clipbrd.h b/Externals/wxWidgets3/include/wx/osx/clipbrd.h index cba7a41e22..2c45068e24 100644 --- a/Externals/wxWidgets3/include/wx/osx/clipbrd.h +++ b/Externals/wxWidgets3/include/wx/osx/clipbrd.h @@ -59,7 +59,7 @@ private: bool m_open; wxCFRef m_pasteboard; - DECLARE_DYNAMIC_CLASS(wxClipboard) + wxDECLARE_DYNAMIC_CLASS(wxClipboard); }; #endif // wxUSE_CLIPBOARD diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h index 03fd501925..4cb5623b49 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h @@ -50,6 +50,16 @@ #define wxOSX_USE_QUICKTIME 0 #define wxOSX_USE_AUDIOTOOLBOX 1 +/* + Use the more efficient FSEvents API instead of kqueue + events for file system watcher, but only on OS X >= 10.7 since + that version introduced a flag that allows watching files as + well as sub directories. + */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 + #define wxHAVE_FSEVENTS_FILE_NOTIFICATIONS 1 +#endif + /* * turning off capabilities that don't work under cocoa yet */ diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h b/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h index 2d33fff661..65fc99c2b3 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/dataview.h @@ -249,7 +249,7 @@ private: // owned by the set. Furthermore, children of the last parent are stored // in a linear list. // -@interface wxCocoaOutlineDataSource : NSObject wxOSX_10_6_AND_LATER() +@interface wxCocoaOutlineDataSource : NSObject { // descriptors specifying the sorting (currently the array only holds one // object only) @@ -314,11 +314,9 @@ private: -(void) removeFromBuffer:(wxPointerObject*)item; // buffered children handling - -(void) appendChild:(wxPointerObject*)item; -(void) clearChildren; -(wxPointerObject*) getChild:(NSUInteger)index; -(NSUInteger) getChildCount; - -(void) removeChild:(NSUInteger)index; // buffer handling -(void) clearBuffers; @@ -397,7 +395,7 @@ private: // wxCocoaOutlineView // ============================================================================ -@interface wxCocoaOutlineView : NSOutlineView wxOSX_10_6_AND_LATER() +@interface wxCocoaOutlineView : NSOutlineView { @private // column and row of the cell being edited or -1 if none diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h index e92df39539..8c6553e5ac 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h @@ -32,9 +32,11 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( CGContextRef inContext, const CGRect * inBounds, CGImageRef inImage) ; -WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0 ); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false); +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ); CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scale = NULL ); -CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage); +CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg); +CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage, bool *isTemplate = NULL); wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size); WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow(); @@ -101,9 +103,9 @@ public : void SetCursor( const wxCursor & cursor ); void CaptureMouse(); void ReleaseMouse(); - +#if wxUSE_DRAG_AND_DROP void SetDropTarget(wxDropTarget* target); - +#endif wxInt32 GetValue() const; void SetValue( wxInt32 v ); wxBitmap GetBitmap() const; @@ -129,6 +131,8 @@ public : virtual bool DoHandleMouseEvent(NSEvent *event); virtual bool DoHandleKeyEvent(NSEvent *event); virtual bool DoHandleCharEvent(NSEvent *event, NSString *text); + virtual void DoNotifyFocusSet(); + virtual void DoNotifyFocusLost(); virtual void DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow); virtual void SetupKeyEvent(wxKeyEvent &wxevent, NSEvent * nsEvent, NSString* charString = NULL); @@ -146,10 +150,12 @@ public : // cocoa thunk connected calls +#if wxUSE_DRAG_AND_DROP virtual unsigned int draggingEntered(void* sender, WXWidget slf, void* _cmd); virtual void draggingExited(void* sender, WXWidget slf, void* _cmd); virtual unsigned int draggingUpdated(void* sender, WXWidget slf, void* _cmd); virtual bool performDragOperation(void* sender, WXWidget slf, void* _cmd); +#endif 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); @@ -181,7 +187,7 @@ protected: // events, don't resend them bool m_hasEditor; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetCocoaImpl); }; DECLARE_WXCOCOA_OBJC_CLASS( wxNSWindow ); @@ -194,75 +200,82 @@ public : virtual ~wxNonOwnedWindowCocoaImpl(); - virtual void WillBeDestroyed() ; + virtual void WillBeDestroyed() wxOVERRIDE; void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, - long style, long extraStyle, const wxString& name ) ; + long style, long extraStyle, const wxString& name ) wxOVERRIDE; void Create( wxWindow* parent, WXWindow nativeWindow ); - WXWindow GetWXWindow() const; - void Raise(); - void Lower(); - bool Show(bool show); + WXWindow GetWXWindow() const wxOVERRIDE; + void Raise() wxOVERRIDE; + void Lower() wxOVERRIDE; + bool Show(bool show) wxOVERRIDE; virtual bool ShowWithEffect(bool show, wxShowEffect effect, - unsigned timeout); + unsigned timeout) wxOVERRIDE; - void Update(); - bool SetTransparent(wxByte alpha); - bool SetBackgroundColour(const wxColour& col ); - void SetExtraStyle( long exStyle ); - void SetWindowStyleFlag( long style ); - bool SetBackgroundStyle(wxBackgroundStyle style); - bool CanSetTransparent(); + void Update() wxOVERRIDE; + bool SetTransparent(wxByte alpha) wxOVERRIDE; + bool SetBackgroundColour(const wxColour& col ) wxOVERRIDE; + void SetExtraStyle( long exStyle ) wxOVERRIDE; + void SetWindowStyleFlag( long style ) wxOVERRIDE; + bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; + bool CanSetTransparent() wxOVERRIDE; - void MoveWindow(int x, int y, int width, int height); - void GetPosition( int &x, int &y ) const; - void GetSize( int &width, int &height ) const; + void MoveWindow(int x, int y, int width, int height) wxOVERRIDE; + void GetPosition( int &x, int &y ) const wxOVERRIDE; + void GetSize( int &width, int &height ) const wxOVERRIDE; - void GetContentArea( int &left , int &top , int &width , int &height ) const; - bool SetShape(const wxRegion& region); + void GetContentArea( int &left , int &top , int &width , int &height ) const wxOVERRIDE; + bool SetShape(const wxRegion& region) wxOVERRIDE; - virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; + virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) wxOVERRIDE; - virtual bool IsMaximized() const; + virtual bool EnableCloseButton(bool enable) wxOVERRIDE; + virtual bool EnableMaximizeButton(bool enable) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable) wxOVERRIDE; - virtual bool IsIconized() const; + virtual bool IsMaximized() const wxOVERRIDE; - virtual void Iconize( bool iconize ); + virtual bool IsIconized() const wxOVERRIDE; - virtual void Maximize(bool maximize); + virtual void Iconize( bool iconize ) wxOVERRIDE; - virtual bool IsFullScreen() const; + virtual void Maximize(bool maximize) wxOVERRIDE; - virtual bool ShowFullScreen(bool show, long style); + virtual bool IsFullScreen() const wxOVERRIDE; - virtual void ShowWithoutActivating(); + bool EnableFullScreenView(bool enable) wxOVERRIDE; - virtual void RequestUserAttention(int flags); + virtual bool ShowFullScreen(bool show, long style) wxOVERRIDE; - virtual void ScreenToWindow( int *x, int *y ); + virtual void ShowWithoutActivating() wxOVERRIDE; - virtual void WindowToScreen( int *x, int *y ); + virtual void RequestUserAttention(int flags) wxOVERRIDE; - virtual bool IsActive(); + virtual void ScreenToWindow( int *x, int *y ) wxOVERRIDE; - virtual void SetModified(bool modified); - virtual bool IsModified() const; + virtual void WindowToScreen( int *x, int *y ) wxOVERRIDE; - virtual void SetRepresentedFilename(const wxString& filename); + virtual bool IsActive() wxOVERRIDE; + + virtual void SetModified(bool modified) wxOVERRIDE; + virtual bool IsModified() const wxOVERRIDE; + + virtual void SetRepresentedFilename(const wxString& filename) wxOVERRIDE; wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } - CGWindowLevel GetWindowLevel() const { return m_macWindowLevel; } - void RestoreWindowLevel(); + CGWindowLevel GetWindowLevel() const wxOVERRIDE { return m_macWindowLevel; } + void RestoreWindowLevel() wxOVERRIDE; static WX_NSResponder GetNextFirstResponder() ; + static WX_NSResponder GetFormerFirstResponder() ; protected : CGWindowLevel m_macWindowLevel; WXWindow m_macWindow; void * m_macFullScreenData ; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCocoaImpl); }; DECLARE_WXCOCOA_OBJC_CLASS( wxNSButton ); @@ -284,6 +297,8 @@ public: }; #ifdef __OBJC__ + + typedef NSRect WXRect; typedef void (*wxOSX_TextEventHandlerPtr)(NSView* self, SEL _cmd, NSString *event); typedef void (*wxOSX_EventHandlerPtr)(NSView* self, SEL _cmd, NSEvent *event); typedef BOOL (*wxOSX_PerformKeyEventHandlerPtr)(NSView* self, SEL _cmd, NSEvent *event); @@ -319,11 +334,13 @@ public: @interface wxNSTextFieldEditor : NSTextView { NSEvent* lastKeyDownEvent; + NSTextField* textField; } + - (void) setTextField:(NSTextField*) field; @end - @interface wxNSTextField : NSTextField wxOSX_10_6_AND_LATER() + @interface wxNSTextField : NSTextField { wxNSTextFieldEditor* fieldEditor; } @@ -333,14 +350,14 @@ public: @end - @interface wxNSSecureTextField : NSSecureTextField wxOSX_10_6_AND_LATER() + @interface wxNSSecureTextField : NSSecureTextField { } @end - @interface wxNSTextView : NSTextView wxOSX_10_6_AND_LATER() + @interface wxNSTextView : NSTextView { } @@ -419,7 +436,7 @@ public: #ifdef __LP64__ WXEXPORT #endif // 64 bit builds - @interface wxNSAppController : NSObject wxOSX_10_6_AND_LATER() + @interface wxNSAppController : NSObject { } @@ -466,7 +483,7 @@ extern ClassicCursor gMacCursors[]; extern NSLayoutManager* gNSLayoutManager; -#endif +#endif // wxUSE_GUI #endif // _WX_PRIVATE_COCOA_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h index 767f31cddb..2091b38188 100644 --- a/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private/textimpl.h @@ -14,6 +14,8 @@ #include "wx/combobox.h" #include "wx/osx/private.h" +@class wxTextEntryFormatter; + // implementation exposed, so that search control can pull it class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl @@ -29,7 +31,10 @@ public : virtual bool CanClipMaxLength() const { return true; } virtual void SetMaxLength(unsigned long len); - + + virtual bool CanForceUpper() { return true; } + virtual void ForceUpper(); + virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; @@ -48,7 +53,7 @@ public : virtual bool resignFirstResponder(WXWidget slf, void *_cmd); virtual void SetInternalSelection( long from , long to ); - + virtual void UpdateInternalSelectionFromEditor( wxNSTextFieldEditor* editor); protected : NSTextField* m_textField; long m_selStart; @@ -57,14 +62,19 @@ protected : private: // Common part of both ctors. void Init(WXWidget w); + + // Get our formatter, creating it if necessary. + wxTextEntryFormatter* GetFormatter(); }; class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl { public: - wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); + wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style ); virtual ~wxNSTextViewControl(); + virtual void insertText(NSString* text, WXWidget slf, void *_cmd); + virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/stdpaths.h b/Externals/wxWidgets3/include/wx/osx/cocoa/stdpaths.h new file mode 100644 index 0000000000..59c33f2019 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/cocoa/stdpaths.h @@ -0,0 +1,43 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/cocoa/stdpaths.h +// Purpose: wxStandardPaths for Cocoa +// Author: Tobias Taschner +// Created: 2015-09-09 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COCOA_STDPATHS_H_ +#define _WX_COCOA_STDPATHS_H_ + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPaths : public wxStandardPathsBase +{ +public: + virtual ~wxStandardPaths(); + + // implement base class pure virtuals + virtual wxString GetExecutablePath() const wxOVERRIDE; + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; + virtual wxString GetDataDir() const wxOVERRIDE; + virtual wxString GetLocalDataDir() const wxOVERRIDE; + virtual wxString GetUserDataDir() const wxOVERRIDE; + virtual wxString GetPluginsDir() const wxOVERRIDE; + virtual wxString GetResourcesDir() const wxOVERRIDE; + virtual wxString + GetLocalizedResourcesDir(const wxString& lang, + ResourceCat category = ResourceCat_None) const wxOVERRIDE; + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; + +protected: + // Ctor is protected, use wxStandardPaths::Get() instead of instantiating + // objects of this class directly. + wxStandardPaths(); +}; + + +#endif // _WX_COCOA_STDPATHS_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/colordlg.h b/Externals/wxWidgets3/include/wx/osx/colordlg.h index 832b46cf0d..c46f2f5d0f 100644 --- a/Externals/wxWidgets3/include/wx/osx/colordlg.h +++ b/Externals/wxWidgets3/include/wx/osx/colordlg.h @@ -20,7 +20,7 @@ class WXDLLIMPEXP_CORE wxColourDialog: public wxDialog { -DECLARE_DYNAMIC_CLASS(wxColourDialog) + wxDECLARE_DYNAMIC_CLASS(wxColourDialog); public: wxColourDialog(); wxColourDialog(wxWindow *parent, wxColourData *data = NULL); diff --git a/Externals/wxWidgets3/include/wx/osx/combobox.h b/Externals/wxWidgets3/include/wx/osx/combobox.h index d7d16f503f..95de0449d4 100644 --- a/Externals/wxWidgets3/include/wx/osx/combobox.h +++ b/Externals/wxWidgets3/include/wx/osx/combobox.h @@ -26,24 +26,14 @@ class wxComboWidgetImpl; // Combobox item class WXDLLIMPEXP_CORE wxComboBox : public wxWindowWithItems< -#if wxOSX_USE_CARBON - wxNavigationEnabled, -#else wxControl, -#endif wxComboBoxBase> { - DECLARE_DYNAMIC_CLASS(wxComboBox) + wxDECLARE_DYNAMIC_CLASS(wxComboBox); public: virtual ~wxComboBox(); -#if wxOSX_USE_CARBON - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); -#endif - // callback functions virtual void DelegateTextChanged( const wxString& value ); virtual void DelegateChoice( const wxString& value ); @@ -105,38 +95,6 @@ class WXDLLIMPEXP_CORE wxComboBox : virtual void SetValue(const wxString& value); // these methods are provided by wxTextEntry for the native impl. -#if wxOSX_USE_CARBON - // Text field functions - virtual wxString GetValue() const; - virtual void WriteText(const wxString& text); - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos GetLastPosition() const; - virtual void Replace(long from, long to, const wxString& value); - virtual void Remove(long from, long to); - virtual void SetEditable(bool editable); - virtual bool IsEditable() const; - - virtual void Undo(); - virtual void Redo(); - virtual void SelectAll(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - virtual wxClientDataType GetClientDataType() const; - - virtual wxTextWidgetImpl* GetTextPeer() const; -#endif // wxOSX_USE_CARBON #if wxOSX_USE_COCOA virtual void Popup(); @@ -157,16 +115,10 @@ protected: virtual void DoClear(); // wxTextEntry functions -#if wxOSX_USE_CARBON - virtual wxString DoGetValue() const; -#endif virtual wxWindow *GetEditableWindow() { return this; } // override the base class virtuals involved in geometry calculations virtual wxSize DoGetBestSize() const; -#if wxOSX_USE_CARBON - virtual void DoMoveWindow(int x, int y, int width, int height); -#endif virtual int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, @@ -175,9 +127,6 @@ protected: virtual void DoSetItemClientData(unsigned int n, void* clientData); virtual void * DoGetItemClientData(unsigned int n) const; -#if wxOSX_USE_CARBON - virtual void SetClientDataType(wxClientDataType clientDataItemsType); -#endif virtual void EnableTextChangedEvents(bool enable); diff --git a/Externals/wxWidgets3/include/wx/osx/config_xcode.h b/Externals/wxWidgets3/include/wx/osx/config_xcode.h index 510eb9f0b4..ca0619bc78 100644 --- a/Externals/wxWidgets3/include/wx/osx/config_xcode.h +++ b/Externals/wxWidgets3/include/wx/osx/config_xcode.h @@ -20,7 +20,6 @@ #define __BSD__ 1 #define __DARWIN__ 1 #define wx_USE_NANOX 0 -#define TARGET_CARBON 1 #define HAVE_EXPLICIT 1 #define HAVE_VA_COPY 1 @@ -28,10 +27,12 @@ #define HAVE_STD_WSTRING 1 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 2 ) -#define HAVE_TR1_UNORDERED_MAP 1 -#define HAVE_TR1_UNORDERED_SET 1 -#define HAVE_TR1_TYPE_TRAITS 1 -#define HAVE_GCC_ATOMIC_BUILTINS 1 + #if !defined(__has_include) + #define HAVE_TR1_UNORDERED_MAP 1 + #define HAVE_TR1_UNORDERED_SET 1 + #define HAVE_TR1_TYPE_TRAITS 1 + #endif + #define HAVE_GCC_ATOMIC_BUILTINS 1 #endif #endif #define HAVE_VISIBILITY 1 @@ -120,12 +121,11 @@ #define HAVE_LOCALE_T 1 #define wxHAS_KQUEUE 1 -#define WXWIN_OS_DESCRIPTION "Darwin 7.9.0 Power Macintosh" -#define PACKAGE_BUGREPORT "wx-dev@lists.wxwidgets.org" +#define PACKAGE_BUGREPORT "wx-dev@googlegroups.com" #define PACKAGE_NAME "wxWidgets" -#define PACKAGE_STRING "wxWidgets 3.1.0" +#define PACKAGE_STRING "wxWidgets 3.1.1" #define PACKAGE_TARNAME "wxwidgets" -#define PACKAGE_VERSION "3.1.0" +#define PACKAGE_VERSION "3.1.1" // for regex #define WX_NO_REGEX_ADVANCED 1 diff --git a/Externals/wxWidgets3/include/wx/osx/control.h b/Externals/wxWidgets3/include/wx/osx/control.h index f0d7c4606b..6e667fdd24 100644 --- a/Externals/wxWidgets3/include/wx/osx/control.h +++ b/Externals/wxWidgets3/include/wx/osx/control.h @@ -16,7 +16,7 @@ WXDLLIMPEXP_DATA_CORE(extern const char) wxControlNameStr[]; // General item class class WXDLLIMPEXP_CORE wxControl : public wxControlBase { - DECLARE_ABSTRACT_CLASS(wxControl) + wxDECLARE_ABSTRACT_CLASS(wxControl); public: wxControl(); diff --git a/Externals/wxWidgets3/include/wx/osx/core/cfstring.h b/Externals/wxWidgets3/include/wx/osx/core/cfstring.h index cbe092463b..8b939a29a6 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/cfstring.h +++ b/Externals/wxWidgets3/include/wx/osx/core/cfstring.h @@ -46,7 +46,7 @@ public: wxCFStringRef(const wxString &str, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; -#if wxOSX_USE_COCOA_OR_IPHONE +#ifdef __WXMAC__ wxCFStringRef(NSString* ref) : wxCFRef< CFStringRef >((CFStringRef) ref) { @@ -71,12 +71,10 @@ public: static wxString AsString( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; static wxString AsStringWithNormalizationFormC( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; -#if wxOSX_USE_COCOA_OR_IPHONE +#ifdef __WXMAC__ static wxString AsString( NSString* ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; static wxString AsStringWithNormalizationFormC( NSString* ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; -#endif -#if wxOSX_USE_COCOA_OR_IPHONE NSString* AsNSString() const { return (NSString*)(CFStringRef) *this; } #endif private: diff --git a/Externals/wxWidgets3/include/wx/osx/core/colour.h b/Externals/wxWidgets3/include/wx/osx/core/colour.h index 004b627f61..ff41bcb5dd 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/colour.h +++ b/Externals/wxWidgets3/include/wx/osx/core/colour.h @@ -58,7 +58,8 @@ public: wxColour& operator=(const RGBColor& col); #endif #if wxOSX_USE_COCOA - wxColour(WX_NSColor color); + // This ctor does not take ownership of the color. + explicit wxColour(WX_NSColor color); WX_NSColor OSXGetNSColor() const; #endif wxColour& operator=(CGColorRef col); @@ -71,7 +72,7 @@ protected : void InitRGBColor( const RGBColor& col ); #endif void InitCGColorRef( CGColorRef col ); - void InitFromComponents(const CGFloat* components, size_t numComponents ); + private: wxCFRef m_cgColour; @@ -80,7 +81,7 @@ private: ChannelType m_green; ChannelType m_alpha; - DECLARE_DYNAMIC_CLASS(wxColour) + wxDECLARE_DYNAMIC_CLASS(wxColour); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/core/dataview.h b/Externals/wxWidgets3/include/wx/osx/core/dataview.h index 61d05bf309..440be5e8e0 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/core/dataview.h @@ -12,11 +12,7 @@ #include "wx/dataview.h" -#if wxOSX_USE_CARBON -typedef wxMacControl wxWidgetImplType; -#else typedef wxWidgetImpl wxWidgetImplType; -#endif // --------------------------------------------------------- // Helper functions for dataview implementation on OSX diff --git a/Externals/wxWidgets3/include/wx/osx/core/evtloop.h b/Externals/wxWidgets3/include/wx/osx/core/evtloop.h index d2ff91d4c2..7c4f189fdf 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/evtloop.h +++ b/Externals/wxWidgets3/include/wx/osx/core/evtloop.h @@ -11,8 +11,8 @@ #ifndef _WX_OSX_CORE_EVTLOOP_H_ #define _WX_OSX_CORE_EVTLOOP_H_ -DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop ); -DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver ); +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop ) +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver ) class WXDLLIMPEXP_FWD_BASE wxCFEventLoopPauseIdleEvents; @@ -42,8 +42,6 @@ public: // to it (can be called from non main thread) virtual void WakeUp(); - virtual bool YieldFor(long eventsToProcess); - bool ShouldProcessIdleEvents() const { return m_processIdleEvents ; } #if wxUSE_UIACTIONSIMULATOR @@ -57,6 +55,12 @@ protected: // terminating when Exit() is called virtual int DoRun(); + // may be overridden to perform some action at the start of each new event + // loop iteration + virtual void OnNextIteration() {} + + virtual void DoYieldFor(long eventsToProcess); + void CommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity); void DefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity); diff --git a/Externals/wxWidgets3/include/wx/osx/core/joystick.h b/Externals/wxWidgets3/include/wx/osx/core/joystick.h index 36941b5b0b..51e373821a 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/joystick.h +++ b/Externals/wxWidgets3/include/wx/osx/core/joystick.h @@ -17,7 +17,7 @@ class WXDLLIMPEXP_FWD_CORE wxJoystickThread; class WXDLLIMPEXP_ADV wxJoystick: public wxObject { - DECLARE_DYNAMIC_CLASS(wxJoystick) + wxDECLARE_DYNAMIC_CLASS(wxJoystick); public: wxJoystick(int joystick = wxJOYSTICK1); diff --git a/Externals/wxWidgets3/include/wx/osx/core/mimetype.h b/Externals/wxWidgets3/include/wx/osx/core/mimetype.h index 7f92a990ff..2a97b3cda6 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/mimetype.h +++ b/Externals/wxWidgets3/include/wx/osx/core/mimetype.h @@ -105,6 +105,9 @@ public: bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); bool Unassociate(wxFileType *ft); + wxString + GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const; private: // All that is needed to query type info - UTI and pointer to the manager diff --git a/Externals/wxWidgets3/include/wx/osx/core/private.h b/Externals/wxWidgets3/include/wx/osx/core/private.h index 18c3cc7b89..182e25dff4 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/private.h +++ b/Externals/wxWidgets3/include/wx/osx/core/private.h @@ -20,17 +20,6 @@ #include "wx/osx/core/cfstring.h" #include "wx/osx/core/cfdataref.h" -// Define helper macros allowing to insert small snippets of code to be -// compiled for high enough OS X version only: this shouldn't be abused for -// anything big but it's handy for e.g. specifying OS X 10.6-only protocols in -// the Objective C classes declarations when they're not supported under the -// previous versions -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - #define wxOSX_10_6_AND_LATER(x) x -#else - #define wxOSX_10_6_AND_LATER(x) -#endif - // platform specific Clang analyzer support #ifndef NS_RETURNS_RETAINED # if WX_HAS_CLANG_FEATURE(attribute_ns_returns_retained) @@ -54,8 +43,6 @@ // wxBase part of it). #include -WXDLLIMPEXP_BASE long UMAGetSystemVersion() ; - void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to ); wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from ); @@ -141,11 +128,7 @@ class wxSearchCtrl; WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); -#if wxOSX_USE_CARBON -typedef wxMacControl wxWidgetImplType; -#else typedef wxWidgetImpl wxWidgetImplType; -#endif #if wxUSE_MENUS class wxMenuItemImpl : public wxObject @@ -179,7 +162,7 @@ public : protected : wxMenuItem* m_peer; - DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) + wxDECLARE_ABSTRACT_CLASS(wxMenuItemImpl); } ; class wxMenuImpl : public wxObject @@ -203,12 +186,17 @@ public : virtual void PopUp( wxWindow *win, int x, int y ) = 0; + virtual void GetMenuBarDimensions(int &x, int &y, int &width, int &height) const + { + x = y = width = height = -1; + } + static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); static wxMenuImpl* CreateRootMenu( wxMenu* peer ); protected : wxMenu* m_peer; - DECLARE_ABSTRACT_CLASS(wxMenuItemImpl) + wxDECLARE_ABSTRACT_CLASS(wxMenuItemImpl); } ; #endif @@ -313,7 +301,7 @@ public : virtual void SetBitmap( const wxBitmap& bitmap ) = 0; virtual void SetBitmapPosition( wxDirection dir ) = 0; virtual void SetupTabs( const wxNotebook& WXUNUSED(notebook) ) {} - virtual int TabHitTest( const wxPoint & WXUNUSED(pt), long *flags ) {*flags=1; return -1;}; + virtual int TabHitTest( const wxPoint & WXUNUSED(pt), long *flags ) {*flags=1; return -1;} virtual void GetBestRect( wxRect *r ) const = 0; virtual bool IsEnabled() const = 0; virtual void Enable( bool enable ) = 0; @@ -563,7 +551,7 @@ protected : bool m_needsFrame; bool m_shouldSendEvents; - DECLARE_ABSTRACT_CLASS(wxWidgetImpl) + wxDECLARE_ABSTRACT_CLASS(wxWidgetImpl); }; // @@ -621,6 +609,7 @@ public: // display virtual void ListScrollTo( unsigned int n ) = 0; + virtual int ListGetTopItem() const = 0; virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) = 0; virtual void UpdateLineToEnd( unsigned int n) = 0; @@ -663,7 +652,10 @@ public : virtual bool CanClipMaxLength() const { return false; } virtual void SetMaxLength(unsigned long WXUNUSED(len)) {} - + + virtual bool CanForceUpper() { return false; } + virtual void ForceUpper() {} + virtual bool GetStyle( long position, wxTextAttr& style); virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; virtual void Copy() ; @@ -855,6 +847,10 @@ public : virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) = 0; + virtual bool EnableCloseButton(bool enable) = 0; + virtual bool EnableMaximizeButton(bool enable) = 0; + virtual bool EnableMinimizeButton(bool enable) = 0; + virtual bool IsMaximized() const = 0; virtual bool IsIconized() const= 0; @@ -867,6 +863,8 @@ public : virtual void ShowWithoutActivating() { Show(true); } + virtual bool EnableFullScreenView(bool enable) = 0; + virtual bool ShowFullScreen(bool show, long style)= 0; virtual void RequestUserAttention(int flags) = 0; @@ -906,7 +904,7 @@ public : virtual void RestoreWindowLevel() {} protected : wxNonOwnedWindow* m_wxPeer; - DECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl) + wxDECLARE_ABSTRACT_CLASS(wxNonOwnedWindowImpl); }; #endif // wxUSE_GUI diff --git a/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h b/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h index 18778d7da5..213e047c69 100644 --- a/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h +++ b/Externals/wxWidgets3/include/wx/osx/core/private/datetimectrl.h @@ -29,8 +29,6 @@ enum wxDateTimeWidgetKind class wxDateTimeWidgetImpl #if wxOSX_USE_COCOA : public wxWidgetCocoaImpl -#elif wxOSX_USE_CARBON - : public wxMacControl #else #error "Unsupported platform" #endif @@ -58,10 +56,6 @@ protected: : 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 }; diff --git a/Externals/wxWidgets3/include/wx/osx/core/stdpaths.h b/Externals/wxWidgets3/include/wx/osx/core/stdpaths.h deleted file mode 100644 index 8ebe071e9c..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/core/stdpaths.h +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/core/stdpaths.h -// Purpose: wxStandardPaths for CoreFoundation systems -// Author: David Elliott -// Modified by: -// Created: 2004-10-27 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_STDPATHS_H_ -#define _WX_MAC_STDPATHS_H_ - -struct __CFBundle; -struct __CFURL; - -typedef const __CFURL * wxCFURLRef; -typedef __CFBundle * wxCFBundleRef; - -// we inherit the GUI CF-based wxStandardPaths implementation from the Unix one -// used for console programs if possible (i.e. if we're under a Unix system at -// all) -#if defined(__UNIX__) - #include "wx/unix/stdpaths.h" - #define wxStandardPathsCFBase wxStandardPaths -#else - #define wxStandardPathsCFBase wxStandardPathsBase -#endif - -// ---------------------------------------------------------------------------- -// wxStandardPaths -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_BASE wxStandardPathsCF : public wxStandardPathsCFBase -{ -public: - virtual ~wxStandardPathsCF(); - - // wxMac specific: allow user to specify a different bundle - wxStandardPathsCF(wxCFBundleRef bundle); - void SetBundle(wxCFBundleRef bundle); - - // implement base class pure virtuals - virtual wxString GetExecutablePath() const; - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; - virtual wxString GetDataDir() const; - virtual wxString GetLocalDataDir() const; - virtual wxString GetUserDataDir() const; - virtual wxString GetPluginsDir() const; - virtual wxString GetResourcesDir() const; - virtual wxString - GetLocalizedResourcesDir(const wxString& lang, - ResourceCat category = ResourceCat_None) const; - virtual wxString GetDocumentsDir() const; - -protected: - // Ctor is protected, use wxStandardPaths::Get() instead of instantiating - // objects of this class directly. - wxStandardPathsCF(); - - // this function can be called with any of CFBundleCopyXXXURL function - // pointer as parameter - wxString GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const; - - wxCFBundleRef m_bundle; -}; - -#endif // _WX_MAC_STDPATHS_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/cursor.h b/Externals/wxWidgets3/include/wx/osx/cursor.h index 0dcf5be22d..7af9a4176c 100644 --- a/Externals/wxWidgets3/include/wx/osx/cursor.h +++ b/Externals/wxWidgets3/include/wx/osx/cursor.h @@ -14,7 +14,7 @@ #include "wx/bitmap.h" // Cursor -class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase { public: wxCursor(); @@ -44,7 +44,7 @@ private: void CreateFromImage(const wxImage & image) ; - DECLARE_DYNAMIC_CLASS(wxCursor) + wxDECLARE_DYNAMIC_CLASS(wxCursor); }; extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor); diff --git a/Externals/wxWidgets3/include/wx/osx/dataview.h b/Externals/wxWidgets3/include/wx/osx/dataview.h index cffb3bf35f..2f7261cc1f 100644 --- a/Externals/wxWidgets3/include/wx/osx/dataview.h +++ b/Externals/wxWidgets3/include/wx/osx/dataview.h @@ -54,7 +54,7 @@ public: virtual void SetAlignment (wxAlignment align); virtual void SetBitmap (wxBitmap const& bitmap); - virtual void SetFlags (int flags) { SetIndividualFlags(flags); } + virtual void SetFlags (int flags) { m_flags = flags; /*SetIndividualFlags(flags); */ } virtual void SetHidden (bool hidden); virtual void SetMaxWidth (int maxWidth); virtual void SetMinWidth (int minWidth); @@ -155,39 +155,39 @@ public: } // inherited methods from wxDataViewCtrlBase: - virtual bool AssociateModel(wxDataViewModel* model); + virtual bool AssociateModel(wxDataViewModel* model) wxOVERRIDE; - virtual bool AppendColumn (wxDataViewColumn* columnPtr); - virtual bool ClearColumns (); - virtual bool DeleteColumn (wxDataViewColumn* columnPtr); - virtual wxDataViewColumn* GetColumn (unsigned int pos) const; - virtual unsigned int GetColumnCount () const; - virtual int GetColumnPosition(const wxDataViewColumn* columnPtr) const; - virtual wxDataViewColumn* GetSortingColumn () const; - virtual bool InsertColumn (unsigned int pos, wxDataViewColumn *col); - virtual bool PrependColumn (wxDataViewColumn* columnPtr); + virtual bool AppendColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual bool ClearColumns () wxOVERRIDE; + virtual bool DeleteColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; + virtual wxDataViewColumn* GetColumn (unsigned int pos) const wxOVERRIDE; + virtual unsigned int GetColumnCount () const wxOVERRIDE; + virtual int GetColumnPosition(const wxDataViewColumn* columnPtr) const wxOVERRIDE; + virtual wxDataViewColumn* GetSortingColumn () const wxOVERRIDE; + virtual bool InsertColumn (unsigned int pos, wxDataViewColumn *col) wxOVERRIDE; + virtual bool PrependColumn (wxDataViewColumn* columnPtr) wxOVERRIDE; - virtual void Collapse( const wxDataViewItem& item); - virtual void EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn* columnPtr=NULL); - virtual void Expand(const wxDataViewItem& item); - virtual bool IsExpanded(const wxDataViewItem & item) const; + virtual void Collapse( const wxDataViewItem& item) wxOVERRIDE; + virtual void EnsureVisible(const wxDataViewItem& item, const wxDataViewColumn* columnPtr=NULL) wxOVERRIDE; + virtual void Expand(const wxDataViewItem& item) wxOVERRIDE; + virtual bool IsExpanded(const wxDataViewItem & item) const wxOVERRIDE; virtual unsigned int GetCount() const; virtual wxRect GetItemRect(const wxDataViewItem& item, - const wxDataViewColumn* columnPtr = NULL) const; - virtual int GetSelectedItemsCount() const; - virtual int GetSelections(wxDataViewItemArray& sel) const; + const wxDataViewColumn* columnPtr = NULL) const wxOVERRIDE; + virtual int GetSelectedItemsCount() const wxOVERRIDE; + virtual int GetSelections(wxDataViewItemArray& sel) const wxOVERRIDE; - virtual void HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; + virtual void HitTest(const wxPoint& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const wxOVERRIDE; - virtual bool IsSelected(const wxDataViewItem& item) const; + virtual bool IsSelected(const wxDataViewItem& item) const wxOVERRIDE; - virtual void SelectAll(); - virtual void Select(const wxDataViewItem& item); - virtual void SetSelections(const wxDataViewItemArray& sel); + virtual void SelectAll() wxOVERRIDE; + virtual void Select(const wxDataViewItem& item) wxOVERRIDE; + virtual void SetSelections(const wxDataViewItemArray& sel) wxOVERRIDE; - virtual void Unselect(const wxDataViewItem& item); - virtual void UnselectAll(); + virtual void Unselect(const wxDataViewItem& item) wxOVERRIDE; + virtual void UnselectAll() wxOVERRIDE; // // implementation @@ -201,7 +201,7 @@ 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); + virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; // 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 @@ -256,9 +256,9 @@ public: m_Deleting = deleting; } - virtual wxDataViewColumn *GetCurrentColumn() const; + virtual wxDataViewColumn *GetCurrentColumn() const wxOVERRIDE; - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -268,10 +268,10 @@ public: protected: // inherited methods from wxDataViewCtrlBase - virtual void DoSetExpanderColumn(); - virtual void DoSetIndent(); + virtual void DoSetExpanderColumn() wxOVERRIDE; + virtual void DoSetIndent() wxOVERRIDE; - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; // event handling void OnSize(wxSizeEvent &event); @@ -281,8 +281,8 @@ private: // initializing of local variables: void Init(); - virtual wxDataViewItem DoGetCurrentItem() const; - virtual void DoSetCurrentItem(const wxDataViewItem& item); + virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; + virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; // // variables @@ -302,9 +302,9 @@ private: wxDataViewModelNotifier* m_ModelNotifier; // stores the model notifier for the control (does not own the notifier) // wxWidget internal stuff: - DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) - DECLARE_NO_COPY_CLASS(wxDataViewCtrl) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl); + wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_DATAVIEWCTRL_OSX_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/dcclient.h b/Externals/wxWidgets3/include/wx/osx/dcclient.h index fca62cf35b..4c88220d9e 100644 --- a/Externals/wxWidgets3/include/wx/osx/dcclient.h +++ b/Externals/wxWidgets3/include/wx/osx/dcclient.h @@ -36,7 +36,7 @@ protected: int m_width; int m_height; - DECLARE_CLASS(wxWindowDCImpl) + wxDECLARE_CLASS(wxWindowDCImpl); wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl); }; @@ -49,7 +49,7 @@ public: virtual ~wxClientDCImpl(); private: - DECLARE_CLASS(wxClientDCImpl) + wxDECLARE_CLASS(wxClientDCImpl); wxDECLARE_NO_COPY_CLASS(wxClientDCImpl); }; @@ -62,7 +62,7 @@ public: virtual ~wxPaintDCImpl(); protected: - DECLARE_CLASS(wxPaintDCImpl) + wxDECLARE_CLASS(wxPaintDCImpl); wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/osx/dcmemory.h b/Externals/wxWidgets3/include/wx/osx/dcmemory.h index bace3c5a95..05fccf5075 100644 --- a/Externals/wxWidgets3/include/wx/osx/dcmemory.h +++ b/Externals/wxWidgets3/include/wx/osx/dcmemory.h @@ -37,7 +37,7 @@ private: wxBitmap m_selected; - DECLARE_CLASS(wxMemoryDCImpl) + wxDECLARE_CLASS(wxMemoryDCImpl); wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/osx/dcprint.h b/Externals/wxWidgets3/include/wx/osx/dcprint.h index ec9f785167..7bebfbc37c 100644 --- a/Externals/wxWidgets3/include/wx/osx/dcprint.h +++ b/Externals/wxWidgets3/include/wx/osx/dcprint.h @@ -42,7 +42,7 @@ protected: wxNativePrinterDC* m_nativePrinterDC ; private: - DECLARE_CLASS(wxPrinterDC) + wxDECLARE_CLASS(wxPrinterDC); #endif // wxUSE_PRINTING_ARCHITECTURE }; diff --git a/Externals/wxWidgets3/include/wx/osx/dcscreen.h b/Externals/wxWidgets3/include/wx/osx/dcscreen.h index 374f0efcd8..c6fdd335a2 100644 --- a/Externals/wxWidgets3/include/wx/osx/dcscreen.h +++ b/Externals/wxWidgets3/include/wx/osx/dcscreen.h @@ -25,7 +25,7 @@ private: void* m_overlayWindow; private: - DECLARE_CLASS(wxScreenDCImpl) + wxDECLARE_CLASS(wxScreenDCImpl); wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl); }; diff --git a/Externals/wxWidgets3/include/wx/osx/dialog.h b/Externals/wxWidgets3/include/wx/osx/dialog.h index 3b0b724fb8..88d5462f15 100644 --- a/Externals/wxWidgets3/include/wx/osx/dialog.h +++ b/Externals/wxWidgets3/include/wx/osx/dialog.h @@ -19,7 +19,7 @@ class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ; // Dialog boxes class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase { - DECLARE_DYNAMIC_CLASS(wxDialog) + wxDECLARE_DYNAMIC_CLASS(wxDialog); public: wxDialog() { Init(); } diff --git a/Externals/wxWidgets3/include/wx/osx/dirdlg.h b/Externals/wxWidgets3/include/wx/osx/dirdlg.h index f355f604e8..c23cf71bf5 100644 --- a/Externals/wxWidgets3/include/wx/osx/dirdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/dirdlg.h @@ -64,7 +64,7 @@ private: // Common part of all ctors. void Init(); - DECLARE_DYNAMIC_CLASS(wxDirDialog) + wxDECLARE_DYNAMIC_CLASS(wxDirDialog); }; #endif // _WX_DIRDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/dvrenderer.h b/Externals/wxWidgets3/include/wx/osx/dvrenderer.h index d7ded78464..6ef28ed39e 100644 --- a/Externals/wxWidgets3/include/wx/osx/dvrenderer.h +++ b/Externals/wxWidgets3/include/wx/osx/dvrenderer.h @@ -31,31 +31,31 @@ public: // inherited methods from wxDataViewRendererBase // --------------------------------------------- - virtual int GetAlignment() const + virtual int GetAlignment() const wxOVERRIDE { return m_alignment; } - virtual wxDataViewCellMode GetMode() const + virtual wxDataViewCellMode GetMode() const wxOVERRIDE { return m_mode; } - virtual bool GetValue(wxVariant& value) const + virtual bool GetValue(wxVariant& value) const wxOVERRIDE { value = m_value; return true; } // NB: in Carbon this is always identical to the header alignment - virtual void SetAlignment(int align); - virtual void SetMode(wxDataViewCellMode mode); - virtual bool SetValue(const wxVariant& newValue) + virtual void SetAlignment(int align) wxOVERRIDE; + virtual void SetMode(wxDataViewCellMode mode) wxOVERRIDE; + virtual bool SetValue(const wxVariant& newValue) wxOVERRIDE { m_value = newValue; return true; } - virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE); - virtual wxEllipsizeMode GetEllipsizeMode() const; + virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) wxOVERRIDE; + virtual wxEllipsizeMode GetEllipsizeMode() const wxOVERRIDE; // implementation // -------------- @@ -83,13 +83,14 @@ public: const wxDataViewItem& item, unsigned col); - // called to ensure that the given attribute will be used for rendering the - // next cell (which had been already associated with this renderer before) - virtual void OSXApplyAttr(const wxDataViewItemAttr& attr); - - // called to set the state of the next cell to be rendered - virtual void OSXApplyEnabled(bool enabled); -#endif // Cocoa +protected: + virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE; + virtual void SetEnabled(bool enabled) wxOVERRIDE; +#else +protected: + void SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) wxOVERRIDE { }; + void SetEnabled(bool WXUNUSED(enabled)) wxOVERRIDE { }; +#endif private: // contains the alignment flags @@ -104,7 +105,7 @@ private: // value that is going to be rendered wxVariant m_value; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer); }; #endif // _WX_OSX_DVRENDERER_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/dvrenderers.h b/Externals/wxWidgets3/include/wx/osx/dvrenderers.h index d046b1a851..2e43251261 100644 --- a/Externals/wxWidgets3/include/wx/osx/dvrenderers.h +++ b/Externals/wxWidgets3/include/wx/osx/dvrenderers.h @@ -17,7 +17,9 @@ class WXDLLIMPEXP_ADV wxDataViewCustomRenderer : public wxDataViewCustomRendererBase { public: - wxDataViewCustomRenderer(const wxString& varianttype = "string", + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewCustomRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -29,10 +31,6 @@ public: virtual bool MacRender(); -#if wxOSX_USE_COCOA - virtual void OSXApplyAttr(const wxDataViewItemAttr& attr); -#endif // Cocoa - virtual wxDC* GetDC(); // creates a device context and keeps it void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer @@ -41,7 +39,7 @@ private: wxDC* m_DCPtr; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer); }; // --------------------------------------------------------- @@ -51,7 +49,9 @@ private: class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer { public: - wxDataViewTextRenderer(const wxString& varianttype = "string", + static wxString GetDefaultType() { return wxS("string"); } + + wxDataViewTextRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -64,7 +64,7 @@ public: #endif // Cocoa private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer); }; // --------------------------------------------------------- @@ -74,14 +74,16 @@ private: class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer { public: - wxDataViewBitmapRenderer(const wxString& varianttype = "wxBitmap", + static wxString GetDefaultType() { return wxS("wxBitmap"); } + + wxDataViewBitmapRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); virtual bool MacRender(); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer); }; #if wxOSX_USE_COCOA @@ -111,7 +113,7 @@ public: private: wxArrayString m_choices; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer); }; #endif // wxOSX_USE_COCOA @@ -122,7 +124,9 @@ private: class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer { public: - wxDataViewIconTextRenderer(const wxString& varianttype = "wxDataViewIconText", + static wxString GetDefaultType() { return wxS("wxDataViewIconText"); } + + wxDataViewIconTextRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -135,7 +139,7 @@ public: #endif // Cocoa private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer); }; // --------------------------------------------------------- @@ -145,7 +149,9 @@ private: class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer { public: - wxDataViewToggleRenderer(const wxString& varianttype = "bool", + static wxString GetDefaultType() { return wxS("bool"); } + + wxDataViewToggleRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -158,7 +164,7 @@ public: #endif // Cocoa private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer); }; // --------------------------------------------------------- @@ -168,8 +174,10 @@ private: class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer { public: + static wxString GetDefaultType() { return wxS("long"); } + wxDataViewProgressRenderer(const wxString& label = wxEmptyString, - const wxString& varianttype = "long", + const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -182,7 +190,7 @@ public: #endif // Cocoa private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer); }; // --------------------------------------------------------- @@ -192,7 +200,9 @@ private: class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer { public: - wxDataViewDateRenderer(const wxString& varianttype = "datetime", + static wxString GetDefaultType() { return wxS("datetime"); } + + wxDataViewDateRenderer(const wxString& varianttype = GetDefaultType(), wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE, int align = wxDVR_DEFAULT_ALIGNMENT); @@ -205,7 +215,7 @@ public: #endif // Cocoa private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer); }; #endif // _WX_OSX_DVRENDERERS_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/evtloop.h b/Externals/wxWidgets3/include/wx/osx/evtloop.h index 98772dd97f..cbbab016d6 100644 --- a/Externals/wxWidgets3/include/wx/osx/evtloop.h +++ b/Externals/wxWidgets3/include/wx/osx/evtloop.h @@ -13,11 +13,7 @@ #ifndef _WX_OSX_EVTLOOP_H_ #define _WX_OSX_EVTLOOP_H_ -#ifdef __WXOSX_COCOA__ - #include "wx/osx/cocoa/evtloop.h" -#else - #include "wx/osx/carbon/evtloop.h" -#endif +#include "wx/osx/cocoa/evtloop.h" class WXDLLIMPEXP_FWD_CORE wxWindow; class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; @@ -31,8 +27,6 @@ public: #ifdef __WXOSX_COCOA__ // skip wxGUIEventLoop to avoid missing Enter/Exit notifications virtual int Run() { return wxCFEventLoop::Run(); } - - virtual bool ProcessIdle(); #endif protected: virtual void OSXDoRun(); diff --git a/Externals/wxWidgets3/include/wx/osx/filedlg.h b/Externals/wxWidgets3/include/wx/osx/filedlg.h index 10342fa8a8..d8e8a862a6 100644 --- a/Externals/wxWidgets3/include/wx/osx/filedlg.h +++ b/Externals/wxWidgets3/include/wx/osx/filedlg.h @@ -24,7 +24,7 @@ class WXDLLIMPEXP_FWD_CORE wxChoice; class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase { -DECLARE_DYNAMIC_CLASS(wxFileDialog) + wxDECLARE_DYNAMIC_CLASS(wxFileDialog); protected: wxArrayString m_fileNames; wxArrayString m_paths; diff --git a/Externals/wxWidgets3/include/wx/osx/font.h b/Externals/wxWidgets3/include/wx/osx/font.h index 2c31c2daa7..93950f47a1 100644 --- a/Externals/wxWidgets3/include/wx/osx/font.h +++ b/Externals/wxWidgets3/include/wx/osx/font.h @@ -56,19 +56,6 @@ public: wxFont(WX_NSFont nsfont); #endif -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif - wxFont(int size, wxFontFamily family, wxFontStyle style, @@ -117,6 +104,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; @@ -129,10 +117,21 @@ 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(); + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + // implementation only from now on // ------------------------------- @@ -140,14 +139,6 @@ public: // Mac-specific, risks to change, don't use in portable code -#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT - wxUint16 MacGetThemeFontID() const ; - - // 'old' Quickdraw accessors - short MacGetFontNum() const; - wxByte MacGetFontStyle() const; -#endif - #if wxOSX_USE_COCOA_OR_CARBON CGFontRef OSXGetCGFont() const; #endif @@ -185,7 +176,7 @@ protected: private: - DECLARE_DYNAMIC_CLASS(wxFont) + wxDECLARE_DYNAMIC_CLASS(wxFont); }; #endif // _WX_FONT_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/fontdlg.h b/Externals/wxWidgets3/include/wx/osx/fontdlg.h index e271578cdf..817501e39b 100644 --- a/Externals/wxWidgets3/include/wx/osx/fontdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/fontdlg.h @@ -47,7 +47,7 @@ public: protected: wxFontData m_fontData; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog); }; extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ; @@ -87,10 +87,10 @@ class WXDLLIMPEXP_FWD_CORE wxCheckBox; class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog { -DECLARE_DYNAMIC_CLASS(wxFontDialog) + wxDECLARE_DYNAMIC_CLASS(wxFontDialog); #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX -DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); #endif public: diff --git a/Externals/wxWidgets3/include/wx/osx/frame.h b/Externals/wxWidgets3/include/wx/osx/frame.h index 5902dc0c9c..195145281f 100644 --- a/Externals/wxWidgets3/include/wx/osx/frame.h +++ b/Externals/wxWidgets3/include/wx/osx/frame.h @@ -43,17 +43,16 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - virtual ~wxFrame(); - // implementation only from now on // ------------------------------- // get the origin of the client area (which may be different from (0, 0) // if the frame has a toolbar) in client coordinates - virtual wxPoint GetClientAreaOrigin() const; + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; // override some more virtuals - virtual bool Enable(bool enable = true) ; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Enable(bool enable = true) wxOVERRIDE; // event handlers void OnActivate(wxActivateEvent& event); @@ -63,9 +62,9 @@ public: #if wxUSE_TOOLBAR virtual wxToolBar* CreateToolBar(long style = -1, wxWindowID id = -1, - const wxString& name = wxToolBarNameStr); + const wxString& name = wxToolBarNameStr) wxOVERRIDE; - virtual void SetToolBar(wxToolBar *toolbar); + virtual void SetToolBar(wxToolBar *toolbar) wxOVERRIDE; #endif // wxUSE_TOOLBAR // Status bar @@ -73,7 +72,7 @@ public: virtual wxStatusBar* OnCreateStatusBar(int number = 1, long style = wxSTB_DEFAULT_STYLE, wxWindowID id = 0, - const wxString& name = wxStatusLineNameStr); + const wxString& name = wxStatusLineNameStr) wxOVERRIDE; #endif // wxUSE_STATUSBAR // called by wxWindow whenever it gets focus @@ -83,35 +82,35 @@ public: void PositionBars(); // internal response to size events - virtual void MacOnInternalSize() { PositionBars(); } + virtual void MacOnInternalSize() wxOVERRIDE { PositionBars(); } protected: // common part of all ctors void Init(); #if wxUSE_TOOLBAR - virtual void PositionToolBar(); + virtual void PositionToolBar() wxOVERRIDE; #endif #if wxUSE_STATUSBAR - virtual void PositionStatusBar(); + virtual void PositionStatusBar() wxOVERRIDE; #endif // override base class virtuals - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); + virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; #if wxUSE_MENUS - virtual void DetachMenuBar(); - virtual void AttachMenuBar(wxMenuBar *menubar); + virtual void DetachMenuBar() wxOVERRIDE; + virtual void AttachMenuBar(wxMenuBar *menubar) wxOVERRIDE; #endif // the last focused child: we restore focus to it on activation wxWindow *m_winLastFocused; - virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; + virtual bool MacIsChildOfClientArea( const wxWindow* child ) const wxOVERRIDE; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxFrame); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/fswatcher_fsevents.h b/Externals/wxWidgets3/include/wx/osx/fswatcher_fsevents.h new file mode 100644 index 0000000000..bbaa95d951 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/fswatcher_fsevents.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/fswatcher_fsevents.h +// Purpose: File System watcher that uses the FSEvents API +// of OS X to efficiently watch trees +// Author: Roberto Perpuly +// Created: 2015-04-24 +// Copyright: (c) 2015 Roberto Perpuly +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FSWATCHER_FSEVENTS_H_ +#define _WX_FSWATCHER_FSEVENTS_H_ + +#include "wx/defs.h" + +#if wxUSE_FSWATCHER + +#include +#include "wx/unix/fswatcher_kqueue.h" + +WX_DECLARE_STRING_HASH_MAP(FSEventStreamRef, FSEventStreamRefMap); + +/* + The FSEvents watcher uses the newer FSEvents service + that is available in OS X, the service allows for + efficient watching of entire directory hierarchies. + Note that adding a single file watch (or directory + watch) still use kqueue events. + + We take care to only use this on OS X >= 10.7, as that + version introduced the ability to get file-level notifications. + + See the following docs that outline the FSEvents API + + https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html + + https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/index.html +*/ +class WXDLLIMPEXP_BASE wxFsEventsFileSystemWatcher : + public wxKqueueFileSystemWatcher +{ +public: + wxFsEventsFileSystemWatcher(); + + wxFsEventsFileSystemWatcher(const wxFileName& path, + int events = wxFSW_EVENT_ALL); + + ~wxFsEventsFileSystemWatcher(); + + // reimplement adding a tree so that it does not use + // kqueue at all + bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL, + const wxString& filespec = wxEmptyString) wxOVERRIDE; + + // reimplement removing a tree so that we + // cleanup the opened fs streams + bool RemoveTree(const wxFileName& path) wxOVERRIDE; + + // reimplement remove all so that we cleanup + // watches from kqeueue and from FSEvents + bool RemoveAll() wxOVERRIDE; + + // post an file change event to the owner + void PostChange(const wxFileName& oldFileName, + const wxFileName& newFileName, int event); + + // post a warning event to the owner + void PostWarning(wxFSWWarningType warning, const wxString& msg); + + // post an error event to the owner + void PostError(const wxString& msg); + + // reimplement count to include the FS stream watches + int GetWatchedPathsCount() const; + + // reimplement to include paths from FS stream watches + int GetWatchedPaths(wxArrayString* paths) const; + +private: + + // map of path => FSEventStreamRef + FSEventStreamRefMap m_streams; + +}; + +#endif /* wxUSE_FSWATCHER */ + +#endif /* _WX_FSWATCHER_FSEVENTS_H_ */ diff --git a/Externals/wxWidgets3/include/wx/osx/gauge.h b/Externals/wxWidgets3/include/wx/osx/gauge.h index 692c3b587a..cfd9ff5ce4 100644 --- a/Externals/wxWidgets3/include/wx/osx/gauge.h +++ b/Externals/wxWidgets3/include/wx/osx/gauge.h @@ -17,9 +17,9 @@ class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase { public: - inline wxGauge() { } + wxGauge() { } - inline wxGauge(wxWindow *parent, wxWindowID id, + wxGauge(wxWindow *parent, wxWindowID id, int range, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -46,7 +46,7 @@ class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase void Pulse(); protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/glcanvas.h b/Externals/wxWidgets3/include/wx/osx/glcanvas.h index 1789a900f0..24cac5b5d2 100644 --- a/Externals/wxWidgets3/include/wx/osx/glcanvas.h +++ b/Externals/wxWidgets3/include/wx/osx/glcanvas.h @@ -29,13 +29,18 @@ WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context ); WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext(); WXDLLIMPEXP_GL bool WXGLSetCurrentContext(WXGLContext context); -WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList); +WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs = NULL, + int n1 = 0, + const int *ctxAttrs = NULL, + int n2 = 0); WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ); class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: - wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const; @@ -52,6 +57,15 @@ private: class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase { public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, const int *attribList = NULL, @@ -61,6 +75,15 @@ public: const wxString& name = wxGLCanvasName, const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, @@ -73,7 +96,7 @@ public: virtual ~wxGLCanvas(); // implement wxGLCanvasBase methods - virtual bool SwapBuffers(); + virtual bool SwapBuffers() wxOVERRIDE; // Mac-specific functions @@ -85,6 +108,9 @@ public: // return the pixel format used by this window WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; } + // Return the copy of attributes passed at ctor + wxGLAttributes& GetGLDispAttrs() { return m_GLAttrs; } + // update the view port of the current context to match this window void SetViewport(); @@ -131,32 +157,12 @@ public: // implementation-only from now on -#if wxOSX_USE_CARBON - // Unlike some other platforms, this must get called if you override it, - // i.e. don't forget "event.Skip()" in your EVT_SIZE handler - void OnSize(wxSizeEvent& event); - - virtual void MacSuperChangedPosition(); - virtual void MacTopLevelWindowChangedPosition(); - virtual void MacVisibilityChanged(); - - void MacUpdateView(); - - GLint GetAglBufferName() const { return m_bufferName; } -#endif - protected: WXGLPixelFormat m_glFormat; + wxGLAttributes m_GLAttrs; -#if wxOSX_USE_CARBON - bool m_macCanvasIsShown, - m_needsUpdate; - WXGLContext m_dummyContext; - GLint m_bufferName; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGLCanvas) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxGLCanvas); }; #endif // _WX_GLCANVAS_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/helpxxxx.h b/Externals/wxWidgets3/include/wx/osx/helpxxxx.h deleted file mode 100644 index 9a9fe4c67f..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/helpxxxx.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/helpxxxx.h -// Purpose: Help system: native implementation for your system. Replace -// XXXX with suitable name. -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_HELPXXXX_H_ -#define _WX_HELPXXXX_H_ - -#include "wx/wx.h" - -#include "wx/helpbase.h" - -class WXDLLIMPEXP_CORE wxXXXXHelpController: public wxHelpControllerBase -{ - DECLARE_CLASS(wxXXXXHelpController) - - public: - wxXXXXHelpController(); - virtual ~wxXXXXHelpController(); - - // Must call this to set the filename and server name - virtual bool Initialize(const wxString& file); - - // If file is "", reloads file given in Initialize - virtual bool LoadFile(const wxString& file = ""); - virtual bool DisplayContents(); - virtual bool DisplaySection(int sectionNo); - virtual bool DisplayBlock(long blockNo); - virtual bool KeywordSearch(const wxString& k, - wxHelpSearchMode mode = wxHELP_SEARCH_ALL); - - virtual bool Quit(); - virtual void OnQuit(); - - inline wxString GetHelpFile() const { return m_helpFile; } - -protected: - wxString m_helpFile; -}; - -#endif - // _WX_HELPXXXX_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/icon.h b/Externals/wxWidgets3/include/wx/osx/icon.h index bc6b721db6..1ac332a2a2 100644 --- a/Externals/wxWidgets3/include/wx/osx/icon.h +++ b/Externals/wxWidgets3/include/wx/osx/icon.h @@ -53,12 +53,16 @@ public: WXHICON GetHICON() const; +#if wxOSX_USE_COCOA + WX_NSImage GetNSImage() const ; +#endif + protected: virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxIcon) + wxDECLARE_DYNAMIC_CLASS(wxIcon); bool LoadIconFromSystemResource(const wxString& resourceName, int desiredWidth, int desiredHeight); bool LoadIconFromBundleResource(const wxString& resourceName, int desiredWidth, int desiredHeight); @@ -89,7 +93,7 @@ public: { return LoadFile(bitmap, name, flags, -1, -1); } private: - DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) + wxDECLARE_DYNAMIC_CLASS(wxICONResourceHandler); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/imaglist.h b/Externals/wxWidgets3/include/wx/osx/imaglist.h index 0405f4cd43..0173832e75 100644 --- a/Externals/wxWidgets3/include/wx/osx/imaglist.h +++ b/Externals/wxWidgets3/include/wx/osx/imaglist.h @@ -30,6 +30,7 @@ public: virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; + virtual wxSize GetSize() const { return wxSize(m_width, m_height); } int Add( const wxIcon& bitmap ); int Add( const wxBitmap& bitmap ); @@ -53,7 +54,7 @@ private: int m_width; int m_height; - DECLARE_DYNAMIC_CLASS(wxImageList) + wxDECLARE_DYNAMIC_CLASS(wxImageList); }; #endif // _WX_IMAGLIST_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h index cd86c72f45..7b3dad1be2 100644 --- a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h +++ b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h @@ -131,6 +131,8 @@ #undef wxUSE_RICHTEXT #define wxUSE_RICHTEXT 0 +#undef wxUSE_ACTIVITYINDICATOR +#undef wxUSE_ADDREMOVECTRL #undef wxUSE_ANIMATIONCTRL #undef wxUSE_CALENDARCTRL #undef wxUSE_COMBOCTRL @@ -160,6 +162,8 @@ #undef wxUSE_BUSYINFO #undef wxUSE_SEARCHCTRL +#define wxUSE_ACTIVITYINDICATOR 0 +#define wxUSE_ADDREMOVECTRL 0 #define wxUSE_ANIMATIONCTRL 0 #define wxUSE_CALENDARCTRL 0 #define wxUSE_COMBOCTRL 0 @@ -321,6 +325,9 @@ #define wxUSE_NOTIFICATION_MESSAGE 0 #endif +#undef wxUSE_PREFERENCES_EDITOR +#define wxUSE_PREFERENCES_EDITOR 0 + #if wxUSE_PROPGRID #undef wxUSE_PROPGRID #define wxUSE_PROPGRID 0 diff --git a/Externals/wxWidgets3/include/wx/osx/iphone/private.h b/Externals/wxWidgets3/include/wx/osx/iphone/private.h index e21dd388b0..5b27fe7959 100644 --- a/Externals/wxWidgets3/include/wx/osx/iphone/private.h +++ b/Externals/wxWidgets3/include/wx/osx/iphone/private.h @@ -24,6 +24,8 @@ #if wxUSE_GUI +typedef CGRect WXRect; + OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( CGContextRef inContext, const CGRect * inBounds, @@ -119,7 +121,7 @@ public : virtual void controlTextDidChange(); protected: WXWidget m_osxView; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWidgetIPhoneImpl); }; class wxNonOwnedWindowIPhoneImpl : public wxNonOwnedWindowImpl @@ -157,6 +159,11 @@ public : virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; + // Title bar buttons don't exist in iOS. + virtual bool EnableCloseButton(bool WXUNUSED(enable)) { return false; } + virtual bool EnableMaximizeButton(bool WXUNUSED(enable)) { return false; } + virtual bool EnableMinimizeButton(bool WXUNUSED(enable)) { return false; } + virtual bool IsMaximized() const; virtual bool IsIconized() const; @@ -167,6 +174,8 @@ public : virtual bool IsFullScreen() const; + virtual bool EnableFullScreenView(bool enable); + virtual bool ShowFullScreen(bool show, long style); virtual void RequestUserAttention(int flags); @@ -185,7 +194,7 @@ protected : WX_UIWindow m_macWindow; void * m_macFullScreenData ; bool m_initialShowSent; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowIPhoneImpl); }; #ifdef __OBJC__ diff --git a/Externals/wxWidgets3/include/wx/osx/joystick.h b/Externals/wxWidgets3/include/wx/osx/joystick.h index e5f834390a..310cb6ddd0 100644 --- a/Externals/wxWidgets3/include/wx/osx/joystick.h +++ b/Externals/wxWidgets3/include/wx/osx/joystick.h @@ -15,8 +15,8 @@ class WXDLLIMPEXP_ADV wxJoystick: public wxObject { - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: /* * Public interface */ diff --git a/Externals/wxWidgets3/include/wx/osx/listbox.h b/Externals/wxWidgets3/include/wx/osx/listbox.h index 60f4199e74..53fd434d97 100644 --- a/Externals/wxWidgets3/include/wx/osx/listbox.h +++ b/Externals/wxWidgets3/include/wx/osx/listbox.h @@ -91,24 +91,26 @@ public: virtual ~wxListBox(); // implement base class pure virtuals - virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); + virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL) wxOVERRIDE; - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; + virtual unsigned int GetCount() const wxOVERRIDE; + virtual wxString GetString(unsigned int n) const wxOVERRIDE; + virtual void SetString(unsigned int n, const wxString& s) wxOVERRIDE; + virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE; // data callbacks virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - virtual bool IsSelected(int n) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; + virtual bool IsSelected(int n) const wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; + virtual int GetSelections(wxArrayInt& aSelections) const wxOVERRIDE; - virtual void EnsureVisible(int n); + virtual void EnsureVisible(int n) wxOVERRIDE; - virtual wxVisualAttributes GetDefaultAttributes() const + virtual int GetTopItem() const wxOVERRIDE; + + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -127,27 +129,27 @@ protected: // at a certain line - which cannot be predetermined for sorted list data virtual void OnItemInserted(unsigned int pos); - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear() wxOVERRIDE; + virtual void DoDeleteOneItem(unsigned int n) wxOVERRIDE; // from wxItemContainer virtual int DoInsertItems(const wxArrayStringsAdapter& items, unsigned int pos, - void **clientData, wxClientDataType type); + void **clientData, wxClientDataType type) wxOVERRIDE; - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; + virtual void DoSetItemClientData(unsigned int n, void* clientData) wxOVERRIDE; + virtual void* DoGetItemClientData(unsigned int n) const wxOVERRIDE; // from wxListBoxBase - virtual void DoSetSelection(int n, bool select); - virtual void DoSetFirstItem(int n); - virtual int DoListHitTest(const wxPoint& point) const; + virtual void DoSetSelection(int n, bool select) wxOVERRIDE; + virtual void DoSetFirstItem(int n) wxOVERRIDE; + virtual int DoListHitTest(const wxPoint& point) const wxOVERRIDE; // free memory (common part of Clear() and dtor) // prevent collision with some BSD definitions of macro Free() void FreeData(); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; bool m_blockEvents; @@ -167,13 +169,9 @@ protected: wxArrayPtrVoid m_itemsClientData; private: -#ifdef __WXOSX_CARBON__ - // It needs to call our CalcAndSendEvent(). - friend class wxMacDataBrowserListControl; -#endif // Carbon - DECLARE_DYNAMIC_CLASS(wxListBox) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxListBox); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_LISTBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/listctrl.h b/Externals/wxWidgets3/include/wx/osx/listctrl.h index 9f2fdfe984..652af605f0 100644 --- a/Externals/wxWidgets3/include/wx/osx/listctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/listctrl.h @@ -24,8 +24,8 @@ WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { - DECLARE_DYNAMIC_CLASS(wxListCtrl) - public: + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); +public: /* * Public interface */ @@ -170,22 +170,10 @@ class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase // Returns the item or -1 if unsuccessful. long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; - // Implementation: converts wxWidgets style to MSW style. - // Can be a single style flag or a bit list. - // oldStyle is 'normalised' so that it doesn't contain - // conflicting styles. - long ConvertToMSWStyle(long& oldStyle, long style) const; - // Gets one of the three image lists wxImageList *GetImageList(int which) const ; // Sets the image list - // N.B. There's a quirk in the Win95 list view implementation. - // If in wxLC_LIST mode, it'll *still* display images by the labels if - // there's a small-icon image list set for the control - even though you - // haven't specified wxLIST_MASK_IMAGE when inserting. - // So you have to set a NULL small-icon image list to be sure that - // the wxLC_LIST mode works without icons. Of course, you may want icons... void SetImageList(wxImageList *imageList, int which) ; // Operations diff --git a/Externals/wxWidgets3/include/wx/osx/mdi.h b/Externals/wxWidgets3/include/wx/osx/mdi.h index 7a859d198d..2bca063802 100644 --- a/Externals/wxWidgets3/include/wx/osx/mdi.h +++ b/Externals/wxWidgets3/include/wx/osx/mdi.h @@ -43,29 +43,29 @@ public: static bool IsTDI() { return false; } - virtual void AddChild(wxWindowBase *child); - virtual void RemoveChild(wxWindowBase *child); + virtual void AddChild(wxWindowBase *child) wxOVERRIDE; + virtual void RemoveChild(wxWindowBase *child) wxOVERRIDE; - virtual void ActivateNext() { /* TODO */ } - virtual void ActivatePrevious() { /* TODO */ } + virtual void ActivateNext() wxOVERRIDE { /* TODO */ } + virtual void ActivatePrevious() wxOVERRIDE { /* TODO */ } - virtual bool Show(bool show = true); + virtual bool Show(bool show = true) wxOVERRIDE; // Mac-specific implementation from now on // --------------------------------------- // Mac OS activate event - virtual void MacActivate(long timestamp, bool activating); + virtual void MacActivate(long timestamp, bool activating) wxOVERRIDE; // wxWidgets activate event void OnActivate(wxActivateEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event); - void SetMenuBar(wxMenuBar *menu_bar); + void SetMenuBar(wxMenuBar *menu_bar) wxOVERRIDE; // Get rect to be used to center top-level children - virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h) wxOVERRIDE; protected: // common part of all ctors @@ -88,8 +88,8 @@ protected: private: friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame); }; class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase @@ -132,7 +132,7 @@ protected: // common part of all ctors void Init(); - DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) + wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame); }; class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase @@ -147,7 +147,7 @@ public: protected: virtual void DoGetClientSize(int *width, int *height) const; - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow); }; #endif // _WX_OSX_CARBON_MDI_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/menu.h b/Externals/wxWidgets3/include/wx/osx/menu.h index 9eded8593b..1540b4055d 100644 --- a/Externals/wxWidgets3/include/wx/osx/menu.h +++ b/Externals/wxWidgets3/include/wx/osx/menu.h @@ -65,7 +65,6 @@ protected: // that are expected in the app menu void DoRearrange() ; - bool DoHandleMenuEvent( wxEvent& evt ); virtual wxMenuItem* DoAppend(wxMenuItem *item); virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); virtual wxMenuItem* DoRemove(wxMenuItem *item); @@ -92,7 +91,7 @@ private: wxMenuImpl* m_peer; - DECLARE_DYNAMIC_CLASS(wxMenu) + wxDECLARE_DYNAMIC_CLASS(wxMenu); }; #if wxOSX_USE_COCOA_OR_CARBON @@ -153,6 +152,7 @@ public: static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } + void MacUninstallMenuBar() ; void MacInstallMenuBar() ; static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } @@ -160,6 +160,11 @@ public: static WXHMENU MacGetWindowMenuHMenu() { return s_macWindowMenuHandle ; } + + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetClientSize(int *width, int *height) const; + protected: // common part of all ctors void Init(); @@ -174,7 +179,7 @@ private: wxMenu* m_rootMenu; wxMenu* m_appleMenu; - DECLARE_DYNAMIC_CLASS(wxMenuBar) + wxDECLARE_DYNAMIC_CLASS(wxMenuBar); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/menuitem.h b/Externals/wxWidgets3/include/wx/osx/menuitem.h index 69dc7e7bcb..b5e0000876 100644 --- a/Externals/wxWidgets3/include/wx/osx/menuitem.h +++ b/Externals/wxWidgets3/include/wx/osx/menuitem.h @@ -92,7 +92,7 @@ private: wxMenuItemImpl* m_peer; - DECLARE_DYNAMIC_CLASS(wxMenuItem) + wxDECLARE_DYNAMIC_CLASS(wxMenuItem); }; #endif //_MENUITEM_H diff --git a/Externals/wxWidgets3/include/wx/osx/metafile.h b/Externals/wxWidgets3/include/wx/osx/metafile.h index 973a5736a4..1851a08cad 100644 --- a/Externals/wxWidgets3/include/wx/osx/metafile.h +++ b/Externals/wxWidgets3/include/wx/osx/metafile.h @@ -59,7 +59,7 @@ protected: virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - DECLARE_DYNAMIC_CLASS(wxMetafile) + wxDECLARE_DYNAMIC_CLASS(wxMetafile); }; @@ -86,7 +86,7 @@ protected: wxMetafile* m_metaFile; private: - DECLARE_CLASS(wxMetafileDCImpl) + wxDECLARE_CLASS(wxMetafileDCImpl); wxDECLARE_NO_COPY_CLASS(wxMetafileDCImpl); }; @@ -108,7 +108,7 @@ class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } private: - DECLARE_CLASS(wxMetafileDC) + wxDECLARE_CLASS(wxMetafileDC); wxDECLARE_NO_COPY_CLASS(wxMetafileDC); }; diff --git a/Externals/wxWidgets3/include/wx/osx/minifram.h b/Externals/wxWidgets3/include/wx/osx/minifram.h index 00fe6e474a..a4180f975e 100644 --- a/Externals/wxWidgets3/include/wx/osx/minifram.h +++ b/Externals/wxWidgets3/include/wx/osx/minifram.h @@ -17,11 +17,11 @@ class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { - DECLARE_DYNAMIC_CLASS(wxMiniFrame) + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); public: - inline wxMiniFrame() {} - inline wxMiniFrame(wxWindow *parent, + wxMiniFrame() {} + wxMiniFrame(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, diff --git a/Externals/wxWidgets3/include/wx/osx/msgdlg.h b/Externals/wxWidgets3/include/wx/osx/msgdlg.h index 871d32f940..c4257aff57 100644 --- a/Externals/wxWidgets3/include/wx/osx/msgdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/msgdlg.h @@ -48,7 +48,7 @@ protected: #if wxOSX_USE_COCOA WX_NSObject m_sheetDelegate; #endif - DECLARE_DYNAMIC_CLASS(wxMessageDialog) + wxDECLARE_DYNAMIC_CLASS(wxMessageDialog); }; #endif // _WX_MSGBOXDLG_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h b/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h index edc3f04e62..9b0d3bea4e 100644 --- a/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h +++ b/Externals/wxWidgets3/include/wx/osx/nonownedwnd.h @@ -113,7 +113,9 @@ public: virtual void HandleResized( double timestampsec ); virtual void HandleMoved( double timestampsec ); virtual void HandleResizing( double timestampsec, wxRect* rect ); - + + void OSXHandleMiniaturize(double WXUNUSED(timestampsec), bool miniaturized); + void WindowWasPainted(); virtual bool Destroy(); diff --git a/Externals/wxWidgets3/include/wx/osx/notebook.h b/Externals/wxWidgets3/include/wx/osx/notebook.h index 7e0ac72291..c8e706f080 100644 --- a/Externals/wxWidgets3/include/wx/osx/notebook.h +++ b/Externals/wxWidgets3/include/wx/osx/notebook.h @@ -57,49 +57,48 @@ public: // set the currently selected page, return the index of the previously // selected one (or wxNOT_FOUND on error) // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events - int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } + int SetSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage, SetSelection_SendEvent); } // changes selected page without sending events - int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } + int ChangeSelection(size_t nPage) wxOVERRIDE { return DoSetSelection(nPage); } // set/get the title of a page - bool SetPageText(size_t nPage, const wxString& strText); - wxString GetPageText(size_t nPage) const; + bool SetPageText(size_t nPage, const wxString& strText) wxOVERRIDE; + wxString GetPageText(size_t nPage) const wxOVERRIDE; // sets/returns item's image index in the current image list - int GetPageImage(size_t nPage) const; - bool SetPageImage(size_t nPage, int nImage); + int GetPageImage(size_t nPage) const wxOVERRIDE; + bool SetPageImage(size_t nPage, int nImage) wxOVERRIDE; // control the appearance of the notebook pages // set the size (the same for all pages) - virtual void SetPageSize(const wxSize& size); + virtual void SetPageSize(const wxSize& size) wxOVERRIDE; // set the padding between tabs (in pixels) - virtual void SetPadding(const wxSize& padding); + virtual void SetPadding(const wxSize& padding) wxOVERRIDE; // sets the size of the tabs (assumes all tabs are the same size) - virtual void SetTabSize(const wxSize& sz); + virtual void SetTabSize(const wxSize& sz) wxOVERRIDE; // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; // calculate size for wxNotebookSizer - wxSize CalcSizeFromPage(const wxSize& sizePage) const; - wxRect GetPageRect() const ; + wxSize CalcSizeFromPage(const wxSize& sizePage) const wxOVERRIDE; + wxRect GetPageRect() const wxOVERRIDE; // operations // ---------- // remove all pages - bool DeleteAllPages(); + bool DeleteAllPages() wxOVERRIDE; // the same as AddPage(), but adds it at the specified position bool InsertPage(size_t nPage, wxNotebookPage *pPage, const wxString& strText, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = NO_IMAGE) wxOVERRIDE; // callbacks // --------- void OnSize(wxSizeEvent& event); - void OnSelChange(wxBookCtrlEvent& event); void OnSetFocus(wxFocusEvent& event); void OnNavigationKey(wxNavigationKeyEvent& event); @@ -107,20 +106,20 @@ public: // -------------- #if wxUSE_CONSTRAINTS - virtual void SetConstraintSizes(bool recurse = true); - virtual bool DoPhase(int nPhase); + virtual void SetConstraintSizes(bool recurse = true) wxOVERRIDE; + virtual bool DoPhase(int nPhase) wxOVERRIDE; #endif // base class virtuals // ------------------- - virtual void Command(wxCommandEvent& event); + virtual void Command(wxCommandEvent& event) wxOVERRIDE; // osx specific event handling common for all osx-ports - virtual bool OSXHandleClicked( double timestampsec ); + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; protected: - virtual wxNotebookPage *DoRemovePage(size_t page) ; + virtual wxNotebookPage *DoRemovePage(size_t page) wxOVERRIDE; // common part of all ctors void Init(); @@ -128,13 +127,13 @@ protected: void ChangePage(int nOldSel, int nSel); // change pages void MacSetupTabs(); - int DoSetSelection(size_t nPage, int flags = 0); + int DoSetSelection(size_t nPage, int flags = 0) wxOVERRIDE; // the icon indices wxArrayInt m_images; - DECLARE_DYNAMIC_CLASS(wxNotebook) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxNotebook); + wxDECLARE_EVENT_TABLE(); }; diff --git a/Externals/wxWidgets3/include/wx/osx/palette.h b/Externals/wxWidgets3/include/wx/osx/palette.h index 86e014f80f..7c695ec1c9 100644 --- a/Externals/wxWidgets3/include/wx/osx/palette.h +++ b/Externals/wxWidgets3/include/wx/osx/palette.h @@ -34,7 +34,7 @@ protected: virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; private: - DECLARE_DYNAMIC_CLASS(wxPalette) + wxDECLARE_DYNAMIC_CLASS(wxPalette); }; #endif // _WX_PALETTE_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/pen.h b/Externals/wxWidgets3/include/wx/osx/pen.h index 391344850c..c203e2faeb 100644 --- a/Externals/wxWidgets3/include/wx/osx/pen.h +++ b/Externals/wxWidgets3/include/wx/osx/pen.h @@ -21,9 +21,6 @@ class WXDLLIMPEXP_CORE wxPen : public wxPenBase public: wxPen(); wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); -#endif wxPen(const wxBitmap& stipple, int width); virtual ~wxPen(); @@ -52,10 +49,12 @@ public: wxBitmap *GetStipple() const ; -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxPenStyle)style); } -#endif + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } // Implementation @@ -69,7 +68,7 @@ protected: private: void Unshare(); - DECLARE_DYNAMIC_CLASS(wxPen) + wxDECLARE_DYNAMIC_CLASS(wxPen); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/pnghand.h b/Externals/wxWidgets3/include/wx/osx/pnghand.h deleted file mode 100644 index c040521337..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/pnghand.h +++ /dev/null @@ -1,38 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/pnghand.h -// Purpose: PNG bitmap handler -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PNGHAND_H_ -#define _WX_PNGHAND_H_ - -#include "wx/defs.h" - -#if wxUSE_LIBPNG - -class WXDLLIMPEXP_CORE wxPNGFileHandler: public wxBitmapHandler -{ - DECLARE_DYNAMIC_CLASS(wxPNGFileHandler) -public: - inline wxPNGFileHandler(void) - { - 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); - virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); -}; - -#endif //wxUSE_LIBPNG - -#endif - // _WX_PNGHAND_H_ - diff --git a/Externals/wxWidgets3/include/wx/osx/pngread.h b/Externals/wxWidgets3/include/wx/osx/pngread.h deleted file mode 100644 index bdf466b8a3..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/pngread.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * File: pngread.h - * Purpose: PNG file reader - * Author: Alejandro Aguilar Sierra/Julian Smart - * Created: 1995 - * Copyright: (c) 1995, Alejandro Aguilar Sierra - * - * - */ - -#ifndef _WX_PNGREAD__ -#define _WX_PNGREAD__ - -#ifndef byte -typedef unsigned char byte; -#endif - -#define WXIMA_COLORS DIB_PAL_COLORS - -typedef byte * ImagePointerType; - -typedef struct -{ - byte red; - byte green; - byte blue; -} rgb_color_struct; - - -#define COLORTYPE_PALETTE 1 -#define COLORTYPE_COLOR 2 -#define COLORTYPE_ALPHA 4 - -class wxPNGReader -{ -protected: - int filetype; - char filename[255]; - ImagePointerType RawImage; // Image data - - int Width, Height; // Dimensions - int Depth; // (bits x pixel) - int ColorType; // Bit 1 = Palette used - // Bit 2 = Color used - // Bit 3 = Alpha used - - long EfeWidth; // Efective Width - - void *lpbi; - int bgindex; - wxPalette* m_palette; - bool imageOK; -friend class wxPNGReaderIter; -public: - wxPNGReader(void); - wxPNGReader (char* ImageFileName); // Read an image file - virtual ~wxPNGReader (); - - void Create(int width, int height, int deep, int colortype=-1); - - 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 GetIndex(int x, int y); - bool GetRGB(int x, int y, byte* r, byte* g, byte* b); - - bool SetIndex(int x, int y, int index); - bool SetRGB(int x, int y, byte r, byte g, byte b); - - // ColorMap settings - bool SetPalette(wxPalette* colourmap); - bool SetPalette(int n, rgb_color_struct *rgb_struct); - bool SetPalette(int n, byte *r, byte *g=0, byte *b=0); - wxPalette* GetPalette() const { return m_palette; } - - void NullData(); - inline int GetBGIndex(void) { return bgindex; } - - inline bool Inside(int x, int y) - { return (0<=y && yRawImage; - Itx = Ity = 0; - Stepx = Stepy = 0; -} - -inline -wxPNGReaderIter::operator wxPNGReader* () -{ - return ima; -} - -inline -bool wxPNGReaderIter::ItOK () -{ - if (ima) - return ima->Inside(Itx, Ity); - else - return FALSE; -} - - -inline void wxPNGReaderIter::reset() -{ - IterImage = ima->RawImage; - Itx = Ity = 0; -} - -inline void wxPNGReaderIter::upset() -{ - Itx = 0; - Ity = ima->Height-1; - IterImage = ima->RawImage + ima->EfeWidth*(ima->Height-1); -} - -inline bool wxPNGReaderIter::NextRow() -{ - if (++Ity >= ima->Height) return 0; - IterImage += ima->EfeWidth; - return 1; -} - -inline bool wxPNGReaderIter::PrevRow() -{ - if (--Ity < 0) return 0; - IterImage -= ima->EfeWidth; - return 1; -} - -////////////////////////// AD - for interlace /////////////////////////////// -inline void wxPNGReaderIter::SetY(int y) -{ - if ((y < 0) || (y > ima->Height)) return; - Ity = y; - IterImage = ima->RawImage + ima->EfeWidth*y; -} - -///////////////////////////////////////////////////////////////////////////// - -inline void wxPNGReaderIter::SetRow(byte *buf, int n) -{ -// Here should be bcopy or memcpy - //_fmemcpy(IterImage, (void far *)buf, n); - if (n<0) - n = ima->GetWidth(); - - for (int i=0; iEfeWidth) - return 1; - else - if (++Ity < ima->Height) - { - IterImage += ima->EfeWidth; - Itx = 0; - return 1; - } else - return 0; -} - -inline bool wxPNGReaderIter::PrevByte() -{ - if (--Itx >= 0) - return 1; - else - if (--Ity >= 0) - { - IterImage -= ima->EfeWidth; - Itx = 0; - return 1; - } else - return 0; -} - -inline bool wxPNGReaderIter::NextStep() -{ - Itx += Stepx; - if (Itx < ima->EfeWidth) - return 1; - else { - Ity += Stepy; - if (Ity < ima->Height) - { - IterImage += ima->EfeWidth; - Itx = 0; - return 1; - } else - return 0; - } -} - -inline bool wxPNGReaderIter::PrevStep() -{ - Itx -= Stepx; - if (Itx >= 0) - return 1; - else { - Ity -= Stepy; - if (Ity >= 0 && Ity < ima->Height) - { - IterImage -= ima->EfeWidth; - Itx = 0; - return 1; - } else - return 0; - } -} - -#endif - diff --git a/Externals/wxWidgets3/include/wx/osx/popupwin.h b/Externals/wxWidgets3/include/wx/osx/popupwin.h index ac42cd64dd..8d9be37dee 100644 --- a/Externals/wxWidgets3/include/wx/osx/popupwin.h +++ b/Externals/wxWidgets3/include/wx/osx/popupwin.h @@ -26,7 +26,9 @@ public: bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) + virtual bool Show(bool show = true); + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); }; #endif // _WX_MAC_POPUPWIN_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/printdlg.h b/Externals/wxWidgets3/include/wx/osx/printdlg.h index d2601eccbe..83fbd58dde 100644 --- a/Externals/wxWidgets3/include/wx/osx/printdlg.h +++ b/Externals/wxWidgets3/include/wx/osx/printdlg.h @@ -46,7 +46,7 @@ private: wxWindow* m_dialogParent; private: - DECLARE_DYNAMIC_CLASS(wxPrintDialog) + wxDECLARE_DYNAMIC_CLASS(wxPrintDialog); }; /* @@ -70,7 +70,7 @@ private: wxWindow* m_dialogParent; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageSetupDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageSetupDialog); }; class WXDLLIMPEXP_FWD_CORE wxTextCtrl; @@ -104,7 +104,7 @@ private: bool CheckValue(wxTextCtrl* textCtrl, int *value, int minValue, const wxString& name); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageMarginsDialog) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageMarginsDialog); }; diff --git a/Externals/wxWidgets3/include/wx/osx/printmac.h b/Externals/wxWidgets3/include/wx/osx/printmac.h index fb68fd8d5f..caf4aca61b 100644 --- a/Externals/wxWidgets3/include/wx/osx/printmac.h +++ b/Externals/wxWidgets3/include/wx/osx/printmac.h @@ -19,9 +19,9 @@ class WXDLLIMPEXP_CORE wxMacPrinter: public wxPrinterBase { - DECLARE_DYNAMIC_CLASS(wxMacPrinter) + wxDECLARE_DYNAMIC_CLASS(wxMacPrinter); - public: +public: wxMacPrinter(wxPrintDialogData *data = NULL); virtual ~wxMacPrinter(); @@ -40,9 +40,9 @@ class WXDLLIMPEXP_CORE wxMacPrinter: public wxPrinterBase class WXDLLIMPEXP_CORE wxMacPrintPreview: public wxPrintPreviewBase { - DECLARE_CLASS(wxMacPrintPreview) + wxDECLARE_CLASS(wxMacPrintPreview); - public: +public: wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintDialogData *data = NULL); diff --git a/Externals/wxWidgets3/include/wx/osx/private.h b/Externals/wxWidgets3/include/wx/osx/private.h index 5b33475f99..23fd0025fb 100644 --- a/Externals/wxWidgets3/include/wx/osx/private.h +++ b/Externals/wxWidgets3/include/wx/osx/private.h @@ -5,8 +5,6 @@ #if wxOSX_USE_IPHONE #include "wx/osx/iphone/private.h" -#elif wxOSX_USE_CARBON - #include "wx/osx/carbon/private.h" #elif wxOSX_USE_COCOA #include "wx/osx/cocoa/private.h" #elif wxUSE_GUI diff --git a/Externals/wxWidgets3/include/wx/osx/private/addremovectrl.h b/Externals/wxWidgets3/include/wx/osx/private/addremovectrl.h new file mode 100644 index 0000000000..a5b342a8d2 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/osx/private/addremovectrl.h @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/private/addremovectrl.h +// Purpose: OS X specific wxAddRemoveImpl implementation +// Author: Vadim Zeitlin +// Created: 2015-02-05 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/artprov.h" +#include "wx/bmpbuttn.h" +#include "wx/panel.h" + +#include "wx/osx/private.h" + +// ---------------------------------------------------------------------------- +// wxAddRemoveImpl itself +// ---------------------------------------------------------------------------- + +class wxAddRemoveImpl : public wxAddRemoveImplWithButtons +{ +public: + wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems), + m_ctrlItems(ctrlItems) + { + // This size is hard coded for now as this is what the system dialogs + // themselves (e.g. the buttons under the lists in the "Users" or + // "Network" panes of the "System Preferences") use under OS X 10.8. + const wxSize sizeBtn(25, 23); + + m_btnAdd = new wxBitmapButton(parent, wxID_ADD, + wxArtProvider::GetBitmap("NSAddTemplate"), + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + + m_btnRemove = new wxBitmapButton(parent, wxID_REMOVE, + wxArtProvider::GetBitmap("NSRemoveTemplate"), + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + + // Under OS X the space to the right of the buttons is actually + // occupied by an inactive gradient button, so create one. + m_btnPlaceholder = new wxButton(parent, wxID_ANY, "", + wxDefaultPosition, + sizeBtn, + wxBORDER_SIMPLE); + m_btnPlaceholder->Disable(); + + + // We need to lay out our windows manually under OS X as it is the only + // way to achieve the required, for the correct look, overlap between + // their borders -- sizers would never allow this. + parent->Bind(wxEVT_SIZE, &wxAddRemoveImpl::OnSize, this); + + // We also have to ensure that the window with the items doesn't have + // any border as it wouldn't look correctly if it did. + long style = ctrlItems->GetWindowStyle(); + style &= ~wxBORDER_MASK; + style |= wxBORDER_SIMPLE; + ctrlItems->SetWindowStyle(style); + + + SetUpEvents(); + } + + // As we don't use sizers, we also need to compute our best size ourselves. + virtual wxSize GetBestClientSize() const wxOVERRIDE + { + wxSize size = m_ctrlItems->GetBestSize(); + + const wxSize sizeBtn = m_btnAdd->GetSize(); + + size.y += sizeBtn.y; + size.IncTo(wxSize(3*sizeBtn.x, -1)); + + return size; + } + +private: + void OnSize(wxSizeEvent& event) + { + const wxSize size = event.GetSize(); + + const wxSize sizeBtn = m_btnAdd->GetSize(); + + const int yBtn = size.y - sizeBtn.y; + + // There is a vertical overlap which hides the items control bottom + // border. + m_ctrlItems->SetSize(0, 0, size.x, yBtn + 2); + + // And there is also a horizontal 1px overlap between the buttons + // themselves, so subtract 1 from the next button position. + int x = 0; + m_btnAdd->Move(x, yBtn); + x += sizeBtn.x - 1; + + m_btnRemove->Move(x, yBtn); + x += sizeBtn.x - 1; + + // The last one needs to be resized to take up all the remaining space. + m_btnPlaceholder->SetSize(x, yBtn, size.x - x, sizeBtn.y); + } + + wxWindow* m_ctrlItems; + wxButton* /* const */ m_btnPlaceholder; +}; + +#endif // _WX_OSX_PRIVATE_ADDREMOVECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/private/glgrab.h b/Externals/wxWidgets3/include/wx/osx/private/glgrab.h deleted file mode 100644 index a3ceabe689..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/private/glgrab.h +++ /dev/null @@ -1,13 +0,0 @@ -#include - -#if defined __cplusplus - extern "C" { -#endif - - CF_RETURNS_RETAINED CGImageRef grabViaOpenGL(CGDirectDisplayID display, - CGRect srcRect); - -#if defined __cplusplus - } -#endif - diff --git a/Externals/wxWidgets3/include/wx/osx/private/print.h b/Externals/wxWidgets3/include/wx/osx/private/print.h index 6f33d3ba17..13c3d5cda1 100644 --- a/Externals/wxWidgets3/include/wx/osx/private/print.h +++ b/Externals/wxWidgets3/include/wx/osx/private/print.h @@ -1,5 +1 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/private/print.h" -#else #include "wx/osx/carbon/private/print.h" -#endif diff --git a/Externals/wxWidgets3/include/wx/osx/private/timer.h b/Externals/wxWidgets3/include/wx/osx/private/timer.h index cd990764c3..1eb8dd80e9 100644 --- a/Externals/wxWidgets3/include/wx/osx/private/timer.h +++ b/Externals/wxWidgets3/include/wx/osx/private/timer.h @@ -1,11 +1,3 @@ -/* common warning snippet for all osx direct includes */ - -#ifndef wxOSX_USE_CARBON -#error "this files should only be included after platform.h was included" -#endif - #if 1 // revert to wxOSX_USE_COCOA_OR_IPHONE in case of problems #include "wx/osx/core/private/timer.h" -#elif wxOSX_USE_CARBON - #include "wx/osx/carbon/private/timer.h" #endif diff --git a/Externals/wxWidgets3/include/wx/osx/radiobox.h b/Externals/wxWidgets3/include/wx/osx/radiobox.h index f591a7df9b..bbf61a7b37 100644 --- a/Externals/wxWidgets3/include/wx/osx/radiobox.h +++ b/Externals/wxWidgets3/include/wx/osx/radiobox.h @@ -18,11 +18,11 @@ class WXDLLIMPEXP_FWD_CORE wxRadioButton ; class WXDLLIMPEXP_CORE wxRadioBox: public wxControl, public wxRadioBoxBase { - DECLARE_DYNAMIC_CLASS(wxRadioBox) + wxDECLARE_DYNAMIC_CLASS(wxRadioBox); public: // Constructors & destructor wxRadioBox(); - inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDim = 0, long style = wxRA_SPECIFY_COLS, @@ -30,7 +30,7 @@ public: { Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); } - inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, int majorDim = 0, long style = wxRA_SPECIFY_COLS, @@ -54,42 +54,42 @@ public: const wxString& name = wxRadioBoxNameStr); // Enabling - virtual bool Enable(bool enable = true); - virtual bool Enable(unsigned int item, bool enable = true); - virtual bool IsItemEnabled(unsigned int item) const; + virtual bool Enable(bool enable = true) wxOVERRIDE; + virtual bool Enable(unsigned int item, bool enable = true) wxOVERRIDE; + virtual bool IsItemEnabled(unsigned int item) const wxOVERRIDE; // Showing - virtual bool Show(bool show = true); - virtual bool Show(unsigned int item, bool show = true); - virtual bool IsItemShown(unsigned int item) const; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool Show(unsigned int item, bool show = true) wxOVERRIDE; + virtual bool IsItemShown(unsigned int item) const wxOVERRIDE; // Specific functions (in wxWidgets2 reference) - virtual void SetSelection(int item); - virtual int GetSelection() const; + virtual void SetSelection(int item) wxOVERRIDE; + virtual int GetSelection() const wxOVERRIDE; - virtual unsigned int GetCount() const { return m_noItems; } + virtual unsigned int GetCount() const wxOVERRIDE { return m_noItems; } - virtual wxString GetString(unsigned int item) const; - virtual void SetString(unsigned int item, const wxString& label); + virtual wxString GetString(unsigned int item) const wxOVERRIDE; + virtual void SetString(unsigned int item, const wxString& label) wxOVERRIDE; - virtual wxString GetLabel() const; - virtual void SetLabel(const wxString& label) ; + virtual wxString GetLabel() const wxOVERRIDE; + virtual void SetLabel(const wxString& label) wxOVERRIDE; // protect native font of box - virtual bool SetFont( const wxFont &font ); + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; // Other external functions - void Command(wxCommandEvent& event); - void SetFocus(); + void Command(wxCommandEvent& event) wxOVERRIDE; + void SetFocus() wxOVERRIDE; // Other variable access functions - inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } - inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } void OnRadioButton( wxCommandEvent& event ) ; protected: // resolve ambiguity in base classes - virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxRadioBoxBase::GetDefaultBorder(); } wxRadioButton *m_radioButtonCycle; @@ -97,12 +97,12 @@ protected: int m_noRowsOrCols; // Internal functions - virtual wxSize DoGetBestSize() const ; + virtual wxSize DoGetBestSize() const wxOVERRIDE; virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/radiobut.h b/Externals/wxWidgets3/include/wx/osx/radiobut.h index 649a544c3c..714d1984e9 100644 --- a/Externals/wxWidgets3/include/wx/osx/radiobut.h +++ b/Externals/wxWidgets3/include/wx/osx/radiobut.h @@ -13,11 +13,11 @@ class WXDLLIMPEXP_CORE wxRadioButton: public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioButton) - protected: + wxDECLARE_DYNAMIC_CLASS(wxRadioButton); + public: - inline wxRadioButton() {} - inline wxRadioButton(wxWindow *parent, wxWindowID id, + wxRadioButton() {} + wxRadioButton(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -43,7 +43,7 @@ public: void Command(wxCommandEvent& event); wxRadioButton *AddInCycle(wxRadioButton *cycle); void RemoveFromCycle(); - inline wxRadioButton *NextInCycle() {return m_cycle;} + wxRadioButton *NextInCycle() {return m_cycle;} // osx specific event handling common for all osx-ports @@ -61,12 +61,12 @@ WXDLLIMPEXP_DATA_CORE(extern const wxChar) wxBitmapRadioButtonNameStr[]; class WXDLLIMPEXP_CORE wxBitmapRadioButton: public wxRadioButton { - DECLARE_DYNAMIC_CLASS(wxBitmapRadioButton) - protected: + wxDECLARE_DYNAMIC_CLASS(wxBitmapRadioButton); +protected: wxBitmap *theButtonBitmap; - public: - inline wxBitmapRadioButton() { theButtonBitmap = NULL; } - inline wxBitmapRadioButton(wxWindow *parent, wxWindowID id, +public: + wxBitmapRadioButton() { theButtonBitmap = NULL; } + wxBitmapRadioButton(wxWindow *parent, wxWindowID id, const wxBitmap *label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, diff --git a/Externals/wxWidgets3/include/wx/osx/scrolbar.h b/Externals/wxWidgets3/include/wx/osx/scrolbar.h index 2115ca5479..fdfc105d97 100644 --- a/Externals/wxWidgets3/include/wx/osx/scrolbar.h +++ b/Externals/wxWidgets3/include/wx/osx/scrolbar.h @@ -36,14 +36,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxScrollBarNameStr); - virtual int GetThumbPosition() const ; - virtual int GetThumbSize() const { return m_viewSize; } - virtual int GetPageSize() const { return m_pageSize; } - virtual int GetRange() const { return m_objectSize; } + virtual int GetThumbPosition() const wxOVERRIDE; + virtual int GetThumbSize() const wxOVERRIDE { return m_viewSize; } + virtual int GetPageSize() const wxOVERRIDE { return m_pageSize; } + virtual int GetRange() const wxOVERRIDE { return m_objectSize; } - virtual void SetThumbPosition(int viewStart); + virtual void SetThumbPosition(int viewStart) wxOVERRIDE; virtual void SetScrollbar(int position, int thumbSize, int range, - int pageSize, bool refresh = true); + int pageSize, bool refresh = true) wxOVERRIDE; // needed for RTTI void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } @@ -51,18 +51,18 @@ public: void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } // implementation only from now on - void Command(wxCommandEvent& event); - virtual void TriggerScrollEvent( wxEventType scrollEvent ) ; - virtual bool OSXHandleClicked( double timestampsec ); + void Command(wxCommandEvent& event) wxOVERRIDE; + virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE; + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; int m_pageSize; int m_viewSize; int m_objectSize; - DECLARE_DYNAMIC_CLASS(wxScrollBar) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxScrollBar); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_SCROLBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/setup0.h b/Externals/wxWidgets3/include/wx/osx/setup0.h index cbcd58af13..47046eb9a9 100644 --- a/Externals/wxWidgets3/include/wx/osx/setup0.h +++ b/Externals/wxWidgets3/include/wx/osx/setup0.h @@ -27,16 +27,6 @@ // compatibility settings // ---------------------------------------------------------------------------- -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -45,7 +35,17 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -269,14 +269,21 @@ // Enable the use of compiler-specific thread local storage keyword, if any. // This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. // -// Default is 1, but set to 0 if the scenario above is applicable. +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. #define wxUSE_COMPILER_TLS 1 // ---------------------------------------------------------------------------- @@ -294,33 +301,30 @@ #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. +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // -// 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). +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. // -// 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 +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // 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 @@ -465,14 +469,7 @@ #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. +// allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // @@ -745,34 +742,21 @@ #define wxUSE_WEBVIEW_WEBKIT 0 #endif -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. +// as only MSVC is known to ship with at least gdiplus.h which is required to +// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later +// versions also include d2d1.h required for Direct2D-based implementation). +// For other compilers (e.g. mingw32) you may need to install the headers (and +// just the headers) yourself. If you do, change the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif +# define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. @@ -841,6 +825,7 @@ // Default is 1 // // Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton @@ -1010,6 +995,16 @@ // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1106,11 +1101,7 @@ // Default is 1. // // Recommended setting: 1 (but can be safely disabled if you don't use it) -#ifdef __WXOSX_IPHONE__ -#define wxUSE_PREFERENCES_EDITOR 0 -#else #define wxUSE_PREFERENCES_EDITOR 1 -#endif // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. @@ -1225,6 +1216,10 @@ // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 @@ -1315,8 +1310,7 @@ // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. diff --git a/Externals/wxWidgets3/include/wx/osx/slider.h b/Externals/wxWidgets3/include/wx/osx/slider.h index bd99512dca..fffde4d3ee 100644 --- a/Externals/wxWidgets3/include/wx/osx/slider.h +++ b/Externals/wxWidgets3/include/wx/osx/slider.h @@ -11,19 +11,18 @@ #ifndef _WX_SLIDER_H_ #define _WX_SLIDER_H_ -#include "wx/control.h" -#include "wx/slider.h" +#include "wx/compositewin.h" #include "wx/stattext.h" // Slider -class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase +class WXDLLIMPEXP_CORE wxSlider: public wxCompositeWindow { - DECLARE_DYNAMIC_CLASS(wxSlider) + wxDECLARE_DYNAMIC_CLASS(wxSlider); public: wxSlider(); - inline wxSlider(wxWindow *parent, wxWindowID id, + wxSlider(wxWindow *parent, wxWindowID id, int value, int minValue, int maxValue, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -44,53 +43,53 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSliderNameStr); - virtual int GetValue() const ; - virtual void SetValue(int); + virtual int GetValue() const wxOVERRIDE; + virtual void SetValue(int) wxOVERRIDE; - void SetRange(int minValue, int maxValue); + void SetRange(int minValue, int maxValue) wxOVERRIDE; - inline int GetMin() const { return m_rangeMin; } - inline int GetMax() const { return m_rangeMax; } + int GetMin() const wxOVERRIDE { return m_rangeMin; } + int GetMax() const wxOVERRIDE { return m_rangeMax; } void SetMin(int minValue) { SetRange(minValue, m_rangeMax); } void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); } // For trackbars only - inline int GetTickFreq() const { return m_tickFreq; } - void SetPageSize(int pageSize); - int GetPageSize() const ; - void ClearSel() ; - void ClearTicks() ; - void SetLineSize(int lineSize); - int GetLineSize() const ; - int GetSelEnd() const ; - int GetSelStart() const ; - void SetSelection(int minPos, int maxPos); - void SetThumbLength(int len) ; - int GetThumbLength() const ; - void SetTick(int tickPos) ; + int GetTickFreq() const wxOVERRIDE { return m_tickFreq; } + void SetPageSize(int pageSize) wxOVERRIDE; + int GetPageSize() const wxOVERRIDE; + void ClearSel() wxOVERRIDE; + void ClearTicks() wxOVERRIDE; + void SetLineSize(int lineSize) wxOVERRIDE; + int GetLineSize() const wxOVERRIDE; + int GetSelEnd() const wxOVERRIDE; + int GetSelStart() const wxOVERRIDE; + void SetSelection(int minPos, int maxPos) wxOVERRIDE; + void SetThumbLength(int len) wxOVERRIDE; + int GetThumbLength() const wxOVERRIDE; + void SetTick(int tickPos) wxOVERRIDE; - void Command(wxCommandEvent& event); + void Command(wxCommandEvent& event) wxOVERRIDE; // osx specific event handling common for all osx-ports - virtual bool OSXHandleClicked( double timestampsec ); - virtual void TriggerScrollEvent( wxEventType scrollEvent ) ; + virtual bool OSXHandleClicked( double timestampsec ) wxOVERRIDE; + virtual void TriggerScrollEvent( wxEventType scrollEvent ) wxOVERRIDE; protected: // Platform-specific implementation of SetTickFreq - virtual void DoSetTickFreq(int freq); + virtual void DoSetTickFreq(int freq) wxOVERRIDE; - virtual wxSize DoGetBestSize() const; - virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags); - virtual void DoMoveWindow(int x, int y, int w, int h); + virtual wxSize DoGetBestSize() const wxOVERRIDE; + virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags) wxOVERRIDE; + virtual void DoMoveWindow(int x, int y, int w, int h) wxOVERRIDE; // set min/max size of the slider virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, - int incW, int incH); + int incW, int incH) wxOVERRIDE; // Common processing to invert slider values based on wxSL_INVERSE - virtual int ValueInvertOrNot(int value) const; + virtual int ValueInvertOrNot(int value) const wxOVERRIDE; wxStaticText* m_macMinimumStatic ; wxStaticText* m_macMaximumStatic ; @@ -102,7 +101,16 @@ protected: int m_lineSize; int m_tickFreq; private : -DECLARE_EVENT_TABLE() + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE + { + wxWindowList parts; + parts.push_back(m_macMinimumStatic); + parts.push_back(m_macMaximumStatic); + parts.push_back(m_macValueStatic); + return parts; + } + + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/sound.h b/Externals/wxWidgets3/include/wx/osx/sound.h index f406537927..e35d090894 100644 --- a/Externals/wxWidgets3/include/wx/osx/sound.h +++ b/Externals/wxWidgets3/include/wx/osx/sound.h @@ -27,19 +27,15 @@ public : virtual bool Play(unsigned int flags) = 0; // stops the sound and deletes the optional timer virtual void Stop(); - // can be called by a timer for repeated tasks during playback - virtual void SoundTask(); // mark this to be deleted virtual void MarkForDeletion(); virtual bool IsMarkedForDeletion() const { return m_markedForDeletion; } // does the true work of stopping and cleaning up virtual void DoStop() = 0; -protected : - void CreateAndStartTimer(); +protected: unsigned int m_flags; - wxSoundTimer* m_pTimer; bool m_markedForDeletion; } ; diff --git a/Externals/wxWidgets3/include/wx/osx/spinbutt.h b/Externals/wxWidgets3/include/wx/osx/spinbutt.h index b294851f96..e8b48f3f89 100644 --- a/Externals/wxWidgets3/include/wx/osx/spinbutt.h +++ b/Externals/wxWidgets3/include/wx/osx/spinbutt.h @@ -69,7 +69,7 @@ protected: virtual wxSize DoGetBestSize() const; private: - DECLARE_DYNAMIC_CLASS(wxSpinButton) + wxDECLARE_DYNAMIC_CLASS(wxSpinButton); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/spinctrl.h b/Externals/wxWidgets3/include/wx/osx/spinctrl.h deleted file mode 100644 index 3803f9d526..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/spinctrl.h +++ /dev/null @@ -1,192 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/spinctrl.h -// Purpose: generic wxSpinCtrl class -// Author: Vadim Zeitlin -// Modified by: -// Created: 28.10.99 -// RCS-ID: $Id: spinctrl.h 68366 2011-07-24 22:19:33Z VZ $ -// Copyright: (c) Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_SPINCTRL_H_ -#define _WX_MAC_SPINCTRL_H_ - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if -// wxSpinButton is available, this is what we do - but if it isn't, we still -// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but -// the different interface. This allows to write programs using wxSpinCtrl -// without tons of #ifdefs. -// ---------------------------------------------------------------------------- - -#if wxUSE_SPINBTN - -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxSpinButton; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrlText; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrlButton; - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxSpinCtrl : public wxNavigationEnabled -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = -1, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - 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); - } - - bool Create(wxWindow *parent, - wxWindowID id = -1, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")); - - // wxTextCtrl-like method - void SetSelection(long from, long to); - - virtual ~wxSpinCtrl(); - - // operations - void SetValue(int val); - void SetValue(const wxString& text); - void SetRange(int min, int max); - - // accessors - int GetValue() const; - int GetMin() const; - int GetMax() const; - - // implementation from now on - - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - - // get the subcontrols - wxTextCtrl *GetText() const { return m_text; } - wxSpinButton *GetSpinButton() const { return m_btn; } - - // set the value of the text (only) - void SetTextValue(int val); - - // put the numeric value of the string in the text ctrl into val and return - // TRUE or return FALSE if the text ctrl doesn't contain a number or if the - // number is out of range - bool GetTextValue(int *val) const; - -protected: - // override the base class virtuals involved into geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - - // common part of all ctors - void Init(); - -private: - // the subcontrols - wxTextCtrl *m_text; - wxSpinButton *m_btn; - - friend class wxSpinCtrlText; - friend class wxSpinCtrlButton; - - int m_oldValue; -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#else // !wxUSE_SPINBTN - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is just a text control -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" - -class WXDLLIMPEXP_CORE wxSpinCtrl : public wxTextCtrl -{ -public: - wxSpinCtrl() { Init(); } - - wxSpinCtrl(wxWindow *parent, - wxWindowID id = -1, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) - { - Create(parent, id, value, pos, size, style, min, max, initial, name); - } - - bool Create(wxWindow *parent, - wxWindowID id = -1, - const wxString& value = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxSP_ARROW_KEYS | wxALIGN_RIGHT, - int min = 0, int max = 100, int initial = 0, - const wxString& name = wxT("wxSpinCtrl")) - { - SetRange(min, max); - - bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, - wxDefaultValidator, name); - SetValue(initial); - - return ok; - } - - // accessors - int GetValue(int WXUNUSED(dummy) = 1) const - { - int n; - if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) - n = INT_MIN; - - return n; - } - - int GetMin() const { return m_min; } - int GetMax() const { return m_max; } - - // operations - void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } - void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } - void SetRange(int min, int max) { m_min = min; m_max = max; } - -protected: - // initialize m_min/max with the default values - void Init() { SetRange(0, 100); } - - int m_min; - int m_max; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN - -#endif // _WX_MAC_SPINCTRL_H_ - diff --git a/Externals/wxWidgets3/include/wx/osx/srchctrl.h b/Externals/wxWidgets3/include/wx/osx/srchctrl.h index ee926cf5f4..4a4d88af47 100644 --- a/Externals/wxWidgets3/include/wx/osx/srchctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/srchctrl.h @@ -39,18 +39,20 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxSearchCtrlNameStr); +#if wxUSE_MENUS // get/set search button menu // -------------------------- - virtual void SetMenu( wxMenu* menu ); - virtual wxMenu* GetMenu(); + virtual void SetMenu( wxMenu* menu ) wxOVERRIDE; + virtual wxMenu* GetMenu() wxOVERRIDE; +#endif // wxUSE_MENUS // get/set search options // ---------------------- - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; + virtual void ShowSearchButton( bool show ) wxOVERRIDE; + virtual bool IsSearchButtonVisible() const wxOVERRIDE; - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; + virtual void ShowCancelButton( bool show ) wxOVERRIDE; + virtual bool IsCancelButtonVisible() const wxOVERRIDE; // TODO: In 2.9 these should probably be virtual, and declared in the base class... void SetDescriptiveText(const wxString& text); @@ -63,18 +65,20 @@ public: protected: - wxSize DoGetBestSize() const; + wxSize DoGetBestSize() const wxOVERRIDE; void Init(); +#if wxUSE_MENUS wxMenu *m_menu; +#endif // wxUSE_MENUS wxString m_descriptiveText; private: - DECLARE_DYNAMIC_CLASS(wxSearchCtrl) + wxDECLARE_DYNAMIC_CLASS(wxSearchCtrl); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // wxUSE_SEARCHCTRL diff --git a/Externals/wxWidgets3/include/wx/osx/statbmp.h b/Externals/wxWidgets3/include/wx/osx/statbmp.h index 59bf91a8f0..45d1f3c9d5 100644 --- a/Externals/wxWidgets3/include/wx/osx/statbmp.h +++ b/Externals/wxWidgets3/include/wx/osx/statbmp.h @@ -1,6 +1,2 @@ -#if wxOSX_USE_CARBON -#include "wx/osx/carbon/statbmp.h" -#else #define wxGenericStaticBitmap wxStaticBitmap #include "wx/generic/statbmpg.h" -#endif diff --git a/Externals/wxWidgets3/include/wx/osx/statbox.h b/Externals/wxWidgets3/include/wx/osx/statbox.h index 5b5f049c58..981d2c3fdb 100644 --- a/Externals/wxWidgets3/include/wx/osx/statbox.h +++ b/Externals/wxWidgets3/include/wx/osx/statbox.h @@ -11,16 +11,13 @@ #ifndef _WX_STATBOX_H_ #define _WX_STATBOX_H_ -#include "wx/control.h" - -// Group box -class WXDLLIMPEXP_CORE wxStaticBox: public wxControl +class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase { - DECLARE_DYNAMIC_CLASS(wxStaticBox) + wxDECLARE_DYNAMIC_CLASS(wxStaticBox); - public: - inline wxStaticBox() {} - inline wxStaticBox(wxWindow *parent, wxWindowID id, +public: + wxStaticBox() {} + wxStaticBox(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, diff --git a/Externals/wxWidgets3/include/wx/osx/statline.h b/Externals/wxWidgets3/include/wx/osx/statline.h index bd94398239..204c8759bc 100644 --- a/Externals/wxWidgets3/include/wx/osx/statline.h +++ b/Externals/wxWidgets3/include/wx/osx/statline.h @@ -49,7 +49,7 @@ protected: // we implement the static line using a static box wxStaticBox *m_statbox; - DECLARE_DYNAMIC_CLASS(wxStaticLine) + wxDECLARE_DYNAMIC_CLASS(wxStaticLine); }; #endif // _WX_GENERIC_STATLINE_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/stattext.h b/Externals/wxWidgets3/include/wx/osx/stattext.h index 3b4b9b6637..28c89a05d8 100644 --- a/Externals/wxWidgets3/include/wx/osx/stattext.h +++ b/Externals/wxWidgets3/include/wx/osx/stattext.h @@ -50,7 +50,7 @@ protected : virtual bool DoSetLabelMarkup(const wxString& markup); #endif // wxUSE_MARKUP && wxOSX_USE_COCOA - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText); }; #endif diff --git a/Externals/wxWidgets3/include/wx/osx/statusbr.h b/Externals/wxWidgets3/include/wx/osx/statusbr.h index 74ae67758c..76d6bbaebd 100644 --- a/Externals/wxWidgets3/include/wx/osx/statusbr.h +++ b/Externals/wxWidgets3/include/wx/osx/statusbr.h @@ -27,16 +27,16 @@ public: const wxString& name = wxStatusBarNameStr); // Implementation - virtual void MacHiliteChanged(); + virtual void MacHiliteChanged() wxOVERRIDE; void OnPaint(wxPaintEvent& event); protected: - virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight); - virtual void DrawField(wxDC& dc, int i, int textHeight); - virtual void DoUpdateStatusText(int number = 0); + virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight) wxOVERRIDE; + virtual void DrawField(wxDC& dc, int i, int textHeight) wxOVERRIDE; + virtual void DoUpdateStatusText(int number = 0) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxStatusBarMac) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxStatusBarMac); + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_STATBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/taskbarosx.h b/Externals/wxWidgets3/include/wx/osx/taskbarosx.h index 7d13df747e..cf7056a2c0 100644 --- a/Externals/wxWidgets3/include/wx/osx/taskbarosx.h +++ b/Externals/wxWidgets3/include/wx/osx/taskbarosx.h @@ -16,7 +16,7 @@ class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase { - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon); public: wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE); virtual ~wxTaskBarIcon(); diff --git a/Externals/wxWidgets3/include/wx/osx/textctrl.h b/Externals/wxWidgets3/include/wx/osx/textctrl.h index a52620b5c7..31892a77c6 100644 --- a/Externals/wxWidgets3/include/wx/osx/textctrl.h +++ b/Externals/wxWidgets3/include/wx/osx/textctrl.h @@ -27,7 +27,7 @@ class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase { - DECLARE_DYNAMIC_CLASS(wxTextCtrl) + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); public: wxTextCtrl() @@ -60,46 +60,46 @@ public: // accessors // --------- - virtual int GetLineLength(long lineNo) const; - virtual wxString GetLineText(long lineNo) const; - virtual int GetNumberOfLines() const; + virtual int GetLineLength(long lineNo) const wxOVERRIDE; + virtual wxString GetLineText(long lineNo) const wxOVERRIDE; + virtual int GetNumberOfLines() const wxOVERRIDE; - virtual bool IsModified() const; + virtual bool IsModified() const wxOVERRIDE; // operations // ---------- // sets/clears the dirty flag - virtual void MarkDirty(); - virtual void DiscardEdits(); + virtual void MarkDirty() wxOVERRIDE; + virtual void DiscardEdits() wxOVERRIDE; // text control under some platforms supports the text styles: these // methods apply the given text style to the given selection or to // set/get the style which will be used for all appended text - virtual bool SetFont( const wxFont &font ); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; // translate between the position (which is just an index into the textctrl // considering all its contents as a single strings) and (x, y) coordinates // which represent column and line. - virtual long XYToPosition(long x, long y) const; - virtual bool PositionToXY(long pos, long *x, long *y) const; + virtual long XYToPosition(long x, long y) const wxOVERRIDE; + virtual bool PositionToXY(long pos, long *x, long *y) const wxOVERRIDE; - virtual void ShowPosition(long pos); + virtual void ShowPosition(long pos) wxOVERRIDE; // overrides so that we can send text updated events - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); + virtual void Copy() wxOVERRIDE; + virtual void Cut() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; // Implementation // -------------- - virtual void Command(wxCommandEvent& event); + virtual void Command(wxCommandEvent& event) wxOVERRIDE; - virtual bool AcceptsFocus() const; + virtual bool AcceptsFocus() const wxOVERRIDE; // callbacks void OnDropFiles(wxDropFilesEvent& event); @@ -124,22 +124,22 @@ public: void OnContextMenu(wxContextMenuEvent& event); - virtual bool MacSetupCursor( const wxPoint& pt ); + virtual bool MacSetupCursor( const wxPoint& pt ) wxOVERRIDE; - virtual void MacVisibilityChanged(); - virtual void MacSuperChangedPosition(); + virtual void MacVisibilityChanged() wxOVERRIDE; + virtual void MacSuperChangedPosition() wxOVERRIDE; virtual void MacCheckSpelling(bool check); protected: // common part of all ctors void Init(); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; // flag is set to true when the user edits the controls contents bool m_dirty; - virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) + virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) wxOVERRIDE { // nothing to do here as the events are never generated when we change // the controls value programmatically anyhow @@ -148,7 +148,7 @@ protected: private : wxMenu *m_privateContextMenu; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_TEXTCTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/textentry.h b/Externals/wxWidgets3/include/wx/osx/textentry.h index 12d780778a..29939d8383 100644 --- a/Externals/wxWidgets3/include/wx/osx/textentry.h +++ b/Externals/wxWidgets3/include/wx/osx/textentry.h @@ -50,6 +50,8 @@ public: // in a single line text control virtual void SetMaxLength(unsigned long len); + virtual void ForceUpper(); + // writing text inserts it at the current position; // appending always inserts it at the end virtual void WriteText(const wxString& text); diff --git a/Externals/wxWidgets3/include/wx/osx/tglbtn.h b/Externals/wxWidgets3/include/wx/osx/tglbtn.h index eaa48e8b81..1283d33f6c 100644 --- a/Externals/wxWidgets3/include/wx/osx/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/osx/tglbtn.h @@ -48,7 +48,7 @@ protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton); }; @@ -78,7 +78,7 @@ public: const wxString& name = wxCheckBoxNameStr); private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton); }; #endif // _WX_TOGGLEBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/toolbar.h b/Externals/wxWidgets3/include/wx/osx/toolbar.h index 2cbd0d7c6a..70a33f77a7 100644 --- a/Externals/wxWidgets3/include/wx/osx/toolbar.h +++ b/Externals/wxWidgets3/include/wx/osx/toolbar.h @@ -18,17 +18,17 @@ class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase { - DECLARE_DYNAMIC_CLASS(wxToolBar) - public: + wxDECLARE_DYNAMIC_CLASS(wxToolBar); +public: /* * Public interface */ wxToolBar() { Init(); } - inline wxToolBar(wxWindow *parent, wxWindowID id, + wxToolBar(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr) { Init(); @@ -37,37 +37,37 @@ class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase virtual ~wxToolBar(); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxTB_HORIZONTAL, + long style = wxTB_DEFAULT_STYLE, const wxString& name = wxToolBarNameStr); - virtual void SetWindowStyleFlag(long style); + virtual void SetWindowStyleFlag(long style) wxOVERRIDE; - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const wxOVERRIDE; #ifndef __WXOSX_IPHONE__ - virtual bool Show(bool show = true); - virtual bool IsShown() const; + virtual bool Show(bool show = true) wxOVERRIDE; + virtual bool IsShown() const wxOVERRIDE; #endif - virtual bool Realize(); + virtual bool Realize() wxOVERRIDE; - virtual void SetToolBitmapSize(const wxSize& size); - virtual wxSize GetToolSize() const; + virtual void SetToolBitmapSize(const wxSize& size) wxOVERRIDE; + virtual wxSize GetToolSize() const wxOVERRIDE; - virtual void SetRows(int nRows); + virtual void SetRows(int nRows) wxOVERRIDE; - virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); + virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; #ifndef __WXOSX_IPHONE__ // Add all the buttons - virtual wxString MacGetToolTipString( wxPoint &where ) ; + virtual wxString MacGetToolTipString( wxPoint &where ) wxOVERRIDE; void OnPaint(wxPaintEvent& event) ; void OnMouse(wxMouseEvent& event) ; - virtual void MacSuperChangedPosition() ; + virtual void MacSuperChangedPosition() wxOVERRIDE; #endif #if wxOSX_USE_NATIVE_TOOLBAR @@ -88,9 +88,9 @@ class WXDLLIMPEXP_CORE wxToolBar: public wxToolBarBase wxItemKind kind = wxITEM_NORMAL, wxObject *clientData = NULL, const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString); + const wxString& longHelp = wxEmptyString) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(wxControl *control, - const wxString& label); + const wxString& label) wxOVERRIDE; protected: // common part of all ctors @@ -98,23 +98,23 @@ protected: void DoLayout(); - void DoSetSize(int x, int y, int width, int height, int sizeFlags); + void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; #ifndef __WXOSX_IPHONE__ - virtual void DoGetSize(int *width, int *height) const; - virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; + virtual wxSize DoGetBestSize() const wxOVERRIDE; #endif #ifdef __WXOSX_COCOA__ - virtual void DoGetPosition(int*x, int *y) const; + virtual void DoGetPosition(int*x, int *y) const wxOVERRIDE; #endif - virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); - virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; - virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); - virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); - virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) wxOVERRIDE; + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); #if wxOSX_USE_NATIVE_TOOLBAR bool m_macUsesNativeToolbar ; void* m_macToolbar ; diff --git a/Externals/wxWidgets3/include/wx/osx/tooltip.h b/Externals/wxWidgets3/include/wx/osx/tooltip.h index f05122ba00..c229555071 100644 --- a/Externals/wxWidgets3/include/wx/osx/tooltip.h +++ b/Externals/wxWidgets3/include/wx/osx/tooltip.h @@ -51,7 +51,7 @@ public: private: wxString m_text; // tooltip text wxWindow *m_window; // window we're associated with - DECLARE_ABSTRACT_CLASS(wxToolTip) + wxDECLARE_ABSTRACT_CLASS(wxToolTip); }; #endif // _WX_MAC_TOOLTIP_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/toplevel.h b/Externals/wxWidgets3/include/wx/osx/toplevel.h index 73b218fe75..72f58c98a6 100644 --- a/Externals/wxWidgets3/include/wx/osx/toplevel.h +++ b/Externals/wxWidgets3/include/wx/osx/toplevel.h @@ -46,40 +46,50 @@ public: bool Create(wxWindow *parent, WXWindow nativeWindow); - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; - virtual wxPoint GetClientAreaOrigin() const; + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; // 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); + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) wxOVERRIDE; // implement base class pure virtuals - virtual void Maximize(bool maximize = true); - virtual bool IsMaximized() const; - virtual void Iconize(bool iconize = true); - virtual bool IsIconized() const; - virtual void Restore(); + virtual void Maximize(bool maximize = true) wxOVERRIDE; + virtual bool IsMaximized() const wxOVERRIDE; + virtual void Iconize(bool iconize = true) wxOVERRIDE; + virtual bool IsIconized() const wxOVERRIDE; + virtual void Restore() wxOVERRIDE; - virtual bool IsActive(); + virtual bool IsActive() wxOVERRIDE; - virtual void ShowWithoutActivating(); - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ; - virtual bool IsFullScreen() const ; + virtual void ShowWithoutActivating() wxOVERRIDE; + bool EnableFullScreenView(bool enable = true) wxOVERRIDE; + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; + virtual bool IsFullScreen() const wxOVERRIDE; // implementation from now on // -------------------------- - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; + virtual void SetTitle( const wxString& title) wxOVERRIDE; + virtual wxString GetTitle() const wxOVERRIDE; - virtual void SetLabel(const wxString& label) { SetTitle( label ); } - virtual wxString GetLabel() const { return GetTitle(); } + // EnableCloseButton(false) used to disable the "Close" + // button on the title bar + virtual bool EnableCloseButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMaximizeButton(bool enable = true) wxOVERRIDE; + virtual bool EnableMinimizeButton(bool enable = true) wxOVERRIDE; + + virtual void SetLabel(const wxString& label) wxOVERRIDE { SetTitle( label ); } + virtual wxString GetLabel() const wxOVERRIDE { return GetTitle(); } - virtual void OSXSetModified(bool modified); - virtual bool OSXIsModified() const; + virtual void OSXSetModified(bool modified) wxOVERRIDE; + virtual bool OSXIsModified() const wxOVERRIDE; - virtual void SetRepresentedFilename(const wxString& filename); + virtual void SetRepresentedFilename(const wxString& filename) wxOVERRIDE; + + // do *not* call this to iconize the frame, this is a private function! + void OSXSetIconizeState(bool iconic); protected: // common part of all ctors @@ -91,8 +101,9 @@ protected: // should the frame be maximized when it will be shown? set by Maximize() // when it is called while the frame is hidden bool m_maximizeOnShow; + private : - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_MSW_TOPLEVEL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/treectrl.h b/Externals/wxWidgets3/include/wx/osx/treectrl.h deleted file mode 100644 index 587325b85a..0000000000 --- a/Externals/wxWidgets3/include/wx/osx/treectrl.h +++ /dev/null @@ -1,306 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/treectrl.h -// Purpose: wxTreeCtrl class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TREECTRL_H_ -#define _WX_TREECTRL_H_ - -#include "wx/control.h" -#include "wx/event.h" -#include "wx/imaglist.h" - -#define wxTREE_MASK_HANDLE 0x0001 -#define wxTREE_MASK_STATE 0x0002 -#define wxTREE_MASK_TEXT 0x0004 -#define wxTREE_MASK_IMAGE 0x0008 -#define wxTREE_MASK_SELECTED_IMAGE 0x0010 -#define wxTREE_MASK_CHILDREN 0x0020 -#define wxTREE_MASK_DATA 0x0040 - -#define wxTREE_STATE_BOLD 0x0001 -#define wxTREE_STATE_DROPHILITED 0x0002 -#define wxTREE_STATE_EXPANDED 0x0004 -#define wxTREE_STATE_EXPANDEDONCE 0x0008 -#define wxTREE_STATE_FOCUSED 0x0010 -#define wxTREE_STATE_SELECTED 0x0020 -#define wxTREE_STATE_CUT 0x0040 - -#define wxTREE_HITTEST_ABOVE 0x0001 // Above the client area. -#define wxTREE_HITTEST_BELOW 0x0002 // Below the client area. -#define wxTREE_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. -#define wxTREE_HITTEST_ONITEMBUTTON 0x0010 // On the button associated with an item. -#define wxTREE_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. -#define wxTREE_HITTEST_ONITEMINDENT 0x0040 // In the indentation associated with an item. -#define wxTREE_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. -#define wxTREE_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. -#define wxTREE_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. -#define wxTREE_HITTEST_TOLEFT 0x0400 // To the right of the client area. -#define wxTREE_HITTEST_TORIGHT 0x0800 // To the left of the client area. - -#define wxTREE_HITTEST_ONITEM (wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMLABEL | wxTREE_HITTEST_ONITEMSTATEICON) - -// Flags for GetNextItem -enum { - wxTREE_NEXT_CARET, // Retrieves the currently selected item. - wxTREE_NEXT_CHILD, // Retrieves the first child item. The hItem parameter must be NULL. - wxTREE_NEXT_DROPHILITE, // Retrieves the item that is the target of a drag-and-drop operation. - wxTREE_NEXT_FIRSTVISIBLE, // Retrieves the first visible item. - wxTREE_NEXT_NEXT, // Retrieves the next sibling item. - wxTREE_NEXT_NEXTVISIBLE, // Retrieves the next visible item that follows the specified item. - wxTREE_NEXT_PARENT, // Retrieves the parent of the specified item. - wxTREE_NEXT_PREVIOUS, // Retrieves the previous sibling item. - wxTREE_NEXT_PREVIOUSVISIBLE, // Retrieves the first visible item that precedes the specified item. - wxTREE_NEXT_ROOT // Retrieves the first child item of the root item of which the specified item is a part. -}; - -#if WXWIN_COMPATIBILITY_2_6 - // Flags for InsertItem - enum { - wxTREE_INSERT_LAST = -1, - wxTREE_INSERT_FIRST = -2, - wxTREE_INSERT_SORT = -3 - }; -#endif - -class WXDLLIMPEXP_CORE wxTreeItem: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxTreeItem) - -public: - - long m_mask; - long m_itemId; - long m_state; - long m_stateMask; - wxString m_text; - int m_image; - int m_selectedImage; - int m_children; - long m_data; - - wxTreeItem(); - -// Accessors - inline long GetMask() const { return m_mask; } - inline long GetItemId() const { return m_itemId; } - inline long GetState() const { return m_state; } - inline long GetStateMask() const { return m_stateMask; } - inline wxString GetText() const { return m_text; } - inline int GetImage() const { return m_image; } - inline int GetSelectedImage() const { return m_selectedImage; } - inline int GetChildren() const { return m_children; } - inline long GetData() const { return m_data; } - - inline void SetMask(long mask) { m_mask = mask; } - inline void SetItemId(long id) { m_itemId = m_itemId = id; } - inline void SetState(long state) { m_state = state; } - inline void SetStateMask(long stateMask) { m_stateMask = stateMask; } - inline void GetText(const wxString& text) { m_text = text; } - inline void SetImage(int image) { m_image = image; } - inline void GetSelectedImage(int selImage) { m_selectedImage = selImage; } - inline void SetChildren(int children) { m_children = children; } - inline void SetData(long data) { m_data = data; } -}; - -class WXDLLIMPEXP_CORE wxTreeCtrl: public wxControl -{ -public: - /* - * Public interface - */ - - // creation - // -------- - wxTreeCtrl(); - - inline wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl") - { - Create(parent, id, pos, size, style, validator, name); - } - virtual ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = "wxTreeCtrl"); - - // accessors - // --------- - // - virtual unsigned int GetCount() const; - - // indent - int GetIndent() const; - void SetIndent(int indent); - // image list - wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const; - - // navigation inside the tree - long GetNextItem(long item, int code) const; - bool ItemHasChildren(long item) const; - long GetChild(long item) const; - long GetItemParent(long item) const; - long GetFirstVisibleItem() const; - long GetNextVisibleItem(long item) const; - long GetSelection() const; - long GetRootItem() const; - - // generic function for (g|s)etting item attributes - bool GetItem(wxTreeItem& info) const; - bool SetItem(wxTreeItem& info); - // item state - int GetItemState(long item, long stateMask) const; - bool SetItemState(long item, long state, long stateMask); - // item image - bool SetItemImage(long item, int image, int selImage); - // item text - wxString GetItemText(long item) const; - void SetItemText(long item, const wxString& str); - // custom data associated with the item - long GetItemData(long item) const; - bool SetItemData(long item, long data); - // convenience function - bool IsItemExpanded(long item) - { - return (GetItemState(item, wxTREE_STATE_EXPANDED) & - wxTREE_STATE_EXPANDED) != 0; - } - - // bounding rect - bool GetItemRect(long item, wxRect& rect, bool textOnly = false) const; - // - wxTextCtrl* GetEditControl() const; - - // operations - // ---------- - // adding/deleting items - bool DeleteItem(long item); - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( long InsertItem(long parent, wxTreeItem& info, - long insertAfter = wxTREE_INSERT_LAST) ); - // If image > -1 and selImage == -1, the same image is used for - // both selected and unselected items. - wxDEPRECATED( long InsertItem(long parent, const wxString& label, - int image = -1, int selImage = -1, - long insertAfter = wxTREE_INSERT_LAST) ); - - // use Expand, Collapse, CollapseAndReset or Toggle - wxDEPRECATED( bool ExpandItem(long item, int action) ); - wxDEPRECATED( void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // changing item state - bool ExpandItem(long item) { return ExpandItem(item, wxTREE_EXPAND_EXPAND); } - bool CollapseItem(long item) { return ExpandItem(item, wxTREE_EXPAND_COLLAPSE); } - bool ToggleItem(long item) { return ExpandItem(item, wxTREE_EXPAND_TOGGLE); } - - // - bool SelectItem(long item); - bool ScrollTo(long item); - bool DeleteAllItems(); - - // Edit the label (tree must have the focus) - wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl)); - - // End label editing, optionally cancelling the edit - bool EndEditLabel(bool cancel); - - long HitTest(const wxPoint& point, int& flags); - // wxImageList *CreateDragImage(long item); - bool SortChildren(long item); - bool EnsureVisible(long item); - - void Command(wxCommandEvent& event) { ProcessCommand(event); } - -protected: - wxTextCtrl* m_textCtrl; - wxImageList* m_imageListNormal; - wxImageList* m_imageListState; - - DECLARE_DYNAMIC_CLASS(wxTreeCtrl) -}; - -/* - wxEVT_TREE_BEGIN_DRAG, - wxEVT_TREE_BEGIN_RDRAG, - wxEVT_TREE_BEGIN_LABEL_EDIT, - wxEVT_TREE_END_LABEL_EDIT, - wxEVT_TREE_DELETE_ITEM, - wxEVT_TREE_GET_INFO, - wxEVT_TREE_SET_INFO, - wxEVT_TREE_ITEM_EXPANDED, - wxEVT_TREE_ITEM_EXPANDING, - wxEVT_TREE_ITEM_COLLAPSED, - wxEVT_TREE_ITEM_COLLAPSING, - wxEVT_TREE_SEL_CHANGED, - wxEVT_TREE_SEL_CHANGING, - wxEVT_TREE_KEY_DOWN -*/ - -class WXDLLIMPEXP_CORE wxTreeEvent: public wxCommandEvent -{ - DECLARE_DYNAMIC_CLASS(wxTreeEvent) - -public: - wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); - - int m_code; - wxTreeItem m_item; - long m_oldItem; - wxPoint m_pointDrag; - - inline long GetOldItem() const { return m_oldItem; } - inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } - inline wxPoint GetPoint() const { return m_pointDrag; } - inline int GetCode() const { return m_code; } -}; - -typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); - -#define EVT_TREE_BEGIN_DRAG(id, fn) { wxEVT_TREE_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_BEGIN_RDRAG(id, fn) { wxEVT_TREE_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) { wxEVT_TREE_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_END_LABEL_EDIT(id, fn) { wxEVT_TREE_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_GET_INFO(id, fn) { wxEVT_TREE_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_SET_INFO(id, fn) { wxEVT_TREE_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_ITEM_EXPANDED(id, fn) { wxEVT_TREE_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_ITEM_EXPANDING(id, fn) { wxEVT_TREE_ITEM_EXPANDING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_ITEM_COLLAPSED(id, fn) { wxEVT_TREE_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_ITEM_COLLAPSING(id, fn) { wxEVT_TREE_ITEM_COLLAPSING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_SEL_CHANGED(id, fn) { wxEVT_TREE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_SEL_CHANGING(id, fn) { wxEVT_TREE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, -#define EVT_TREE_KEY_DOWN(id, fn) { wxEVT_TREE_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL }, - -// old wxEVT_COMMAND_* constants -#define wxEVT_COMMAND_TREE_BEGIN_DRAG wxEVT_TREE_BEGIN_DRAG -#define wxEVT_COMMAND_TREE_BEGIN_RDRAG wxEVT_TREE_BEGIN_RDRAG -#define wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT wxEVT_TREE_BEGIN_LABEL_EDIT -#define wxEVT_COMMAND_TREE_END_LABEL_EDIT wxEVT_TREE_END_LABEL_EDIT -#define wxEVT_COMMAND_TREE_DELETE_ITEM wxEVT_TREE_DELETE_ITEM -#define wxEVT_COMMAND_TREE_GET_INFO wxEVT_TREE_GET_INFO -#define wxEVT_COMMAND_TREE_SET_INFO wxEVT_TREE_SET_INFO -#define wxEVT_COMMAND_TREE_ITEM_EXPANDED wxEVT_TREE_ITEM_EXPANDED -#define wxEVT_COMMAND_TREE_ITEM_EXPANDING wxEVT_TREE_ITEM_EXPANDING -#define wxEVT_COMMAND_TREE_ITEM_COLLAPSED wxEVT_TREE_ITEM_COLLAPSED -#define wxEVT_COMMAND_TREE_ITEM_COLLAPSING wxEVT_TREE_ITEM_COLLAPSING -#define wxEVT_COMMAND_TREE_SEL_CHANGED wxEVT_TREE_SEL_CHANGED -#define wxEVT_COMMAND_TREE_SEL_CHANGING wxEVT_TREE_SEL_CHANGING -#define wxEVT_COMMAND_TREE_KEY_DOWN wxEVT_TREE_KEY_DOWN - -#endif - // _WX_TREECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/osx/uma.h b/Externals/wxWidgets3/include/wx/osx/uma.h index 451f2f71f6..e69de29bb2 100644 --- a/Externals/wxWidgets3/include/wx/osx/uma.h +++ b/Externals/wxWidgets3/include/wx/osx/uma.h @@ -1,3 +0,0 @@ -#if wxOSX_USE_CARBON -#include "wx/osx/carbon/uma.h" -#endif diff --git a/Externals/wxWidgets3/include/wx/osx/webview_webkit.h b/Externals/wxWidgets3/include/wx/osx/webview_webkit.h index 803f8b0b29..b1982aeb89 100644 --- a/Externals/wxWidgets3/include/wx/osx/webview_webkit.h +++ b/Externals/wxWidgets3/include/wx/osx/webview_webkit.h @@ -12,10 +12,9 @@ #ifndef _WX_WEBKIT_H #define _WX_WEBKIT_H -#include "wx/setup.h" +#include "wx/defs.h" -#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \ - || defined(__WXOSX_CARBON__)) +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXOSX__) #include "wx/control.h" #include "wx/webview.h" @@ -46,47 +45,47 @@ public: const wxString& strURL = wxWebViewDefaultURLStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = wxWebViewNameStr); + const wxString& name = wxWebViewNameStr) wxOVERRIDE; virtual ~wxWebViewWebKit(); - virtual bool CanGoBack() const; - virtual bool CanGoForward() const; - virtual void GoBack(); - virtual void GoForward(); - virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT); - virtual void Stop(); - virtual wxString GetPageSource() const; - virtual wxString GetPageText() const; + virtual bool CanGoBack() const wxOVERRIDE; + virtual bool CanGoForward() const wxOVERRIDE; + virtual void GoBack() wxOVERRIDE; + virtual void GoForward() wxOVERRIDE; + virtual void Reload(wxWebViewReloadFlags flags = wxWEBVIEW_RELOAD_DEFAULT) wxOVERRIDE; + virtual void Stop() wxOVERRIDE; + virtual wxString GetPageSource() const wxOVERRIDE; + virtual wxString GetPageText() const wxOVERRIDE; - virtual void Print(); + virtual void Print() wxOVERRIDE; - 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 LoadURL(const wxString& url) wxOVERRIDE; + virtual wxString GetCurrentURL() const wxOVERRIDE; + virtual wxString GetCurrentTitle() const wxOVERRIDE; + virtual wxWebViewZoom GetZoom() const wxOVERRIDE; + virtual void SetZoom(wxWebViewZoom zoom) wxOVERRIDE; - virtual void SetZoomType(wxWebViewZoomType zoomType); - virtual wxWebViewZoomType GetZoomType() const; - virtual bool CanSetZoomType(wxWebViewZoomType type) const; + virtual void SetZoomType(wxWebViewZoomType zoomType) wxOVERRIDE; + virtual wxWebViewZoomType GetZoomType() const wxOVERRIDE; + virtual bool CanSetZoomType(wxWebViewZoomType type) const wxOVERRIDE; - virtual bool IsBusy() const { return m_busy; } + virtual bool IsBusy() const wxOVERRIDE { 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); + virtual void ClearHistory() wxOVERRIDE; + virtual void EnableHistory(bool enable = true) wxOVERRIDE; + virtual wxVector > GetBackwardHistory() wxOVERRIDE; + virtual wxVector > GetForwardHistory() wxOVERRIDE; + virtual void LoadHistoryItem(wxSharedPtr item) wxOVERRIDE; //Undo / redo functionality - virtual bool CanUndo() const; - virtual bool CanRedo() const; - virtual void Undo(); - virtual void Redo(); + virtual bool CanUndo() const wxOVERRIDE; + virtual bool CanRedo() const wxOVERRIDE; + virtual void Undo() wxOVERRIDE; + virtual void Redo() wxOVERRIDE; //Find function - virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) + virtual long Find(const wxString& text, int flags = wxWEBVIEW_FIND_DEFAULT) wxOVERRIDE { wxUnusedVar(text); wxUnusedVar(flags); @@ -94,31 +93,31 @@ public: } //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(); + virtual bool CanCut() const wxOVERRIDE { return true; } + virtual bool CanCopy() const wxOVERRIDE { return true; } + virtual bool CanPaste() const wxOVERRIDE { return true; } + virtual void Cut() wxOVERRIDE; + virtual void Copy() wxOVERRIDE; + virtual void Paste() wxOVERRIDE; //Editing functions - virtual void SetEditable(bool enable = true); - virtual bool IsEditable() const; + virtual void SetEditable(bool enable = true) wxOVERRIDE; + virtual bool IsEditable() const wxOVERRIDE; //Selection - virtual void DeleteSelection(); - virtual bool HasSelection() const; - virtual void SelectAll(); - virtual wxString GetSelectedText() const; - virtual wxString GetSelectedSource() const; - virtual void ClearSelection(); + virtual void DeleteSelection() wxOVERRIDE; + virtual bool HasSelection() const wxOVERRIDE; + virtual void SelectAll() wxOVERRIDE; + virtual wxString GetSelectedText() const wxOVERRIDE; + virtual wxString GetSelectedSource() const wxOVERRIDE; + virtual void ClearSelection() wxOVERRIDE; - void RunScript(const wxString& javascript); + void RunScript(const wxString& javascript) wxOVERRIDE; //Virtual Filesystem Support - virtual void RegisterHandler(wxSharedPtr handler); + virtual void RegisterHandler(wxSharedPtr handler) wxOVERRIDE; - virtual void* GetNativeBackend() const { return m_webView; } + virtual void* GetNativeBackend() const wxOVERRIDE { return m_webView; } // ---- methods not from the parent (common) interface bool CanGetPageSource() const; @@ -135,9 +134,9 @@ public: void SetWebkitZoom(float zoom); // don't hide base class virtuals - virtual void SetScrollPos( int orient, int pos, bool refresh = true ) + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE { return wxControl::SetScrollPos(orient, pos, refresh); } - virtual int GetScrollPos( int orient ) const + virtual int GetScrollPos( int orient ) const wxOVERRIDE { return wxControl::GetScrollPos(orient); } //we need to resize the webview when the control size changes @@ -146,19 +145,20 @@ public: void OnMouseEvents(wxMouseEvent &event); bool m_busy; + bool m_nextNavigationIsNewWindow; protected: - virtual void DoSetPage(const wxString& html, const wxString& baseUrl); + virtual void DoSetPage(const wxString& html, const wxString& baseUrl) wxOVERRIDE; - DECLARE_EVENT_TABLE() - void MacVisibilityChanged(); + wxDECLARE_EVENT_TABLE(); + void MacVisibilityChanged() wxOVERRIDE; private: wxWindow *m_parent; wxWindowID m_windowID; wxString m_pageTitle; - wxObjCID m_webView; + OSXWebViewPtr m_webView; // we may use this later to setup our own mouse events, // so leave it in for now. diff --git a/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h b/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h index f1c2d5f655..6a15e46526 100644 --- a/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h +++ b/Externals/wxWidgets3/include/wx/osx/webviewhistoryitem_webkit.h @@ -9,10 +9,9 @@ #ifndef _WX_OSX_WEBVIEWHISTORYITEM_H_ #define _WX_OSX_WEBVIEWHISTORYITEM_H_ -#include "wx/setup.h" +#include "wx/defs.h" -#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \ - || defined(__WXOSX_CARBON__)) +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXOSX__) #include "wx/osx/core/objcid.h" diff --git a/Externals/wxWidgets3/include/wx/osx/window.h b/Externals/wxWidgets3/include/wx/osx/window.h index 623493aa1e..192c420eaf 100644 --- a/Externals/wxWidgets3/include/wx/osx/window.h +++ b/Externals/wxWidgets3/include/wx/osx/window.h @@ -19,10 +19,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; class WXDLLIMPEXP_FWD_CORE wxPanel; class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; -#if wxOSX_USE_CARBON - class WXDLLIMPEXP_FWD_CORE wxMacControl ; - typedef wxMacControl wxOSXWidgetImpl; -#elif wxOSX_USE_COCOA_OR_IPHONE +#if wxOSX_USE_COCOA_OR_IPHONE class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ; typedef wxWidgetImpl wxOSXWidgetImpl; #endif @@ -30,7 +27,7 @@ class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase { - DECLARE_DYNAMIC_CLASS(wxWindowMac) + wxDECLARE_DYNAMIC_CLASS(wxWindowMac); friend class wxDC; friend class wxPaintDC; @@ -54,81 +51,81 @@ public: long style = 0, const wxString& name = wxPanelNameStr ); - virtual void SendSizeEvent(int flags = 0); + virtual void SendSizeEvent(int flags = 0) wxOVERRIDE; // implement base class pure virtuals - virtual void SetLabel( const wxString& label ); - virtual wxString GetLabel() const; + virtual void SetLabel( const wxString& label ) wxOVERRIDE; + virtual wxString GetLabel() const wxOVERRIDE; - virtual void Raise(); - virtual void Lower(); + virtual void Raise() wxOVERRIDE; + virtual void Lower() wxOVERRIDE; - virtual bool Show( bool show = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; virtual bool ShowWithEffect(wxShowEffect effect, - unsigned timeout = 0) + unsigned timeout = 0) wxOVERRIDE { return OSXShowWithEffect(true, effect, timeout); } virtual bool HideWithEffect(wxShowEffect effect, - unsigned timeout = 0) + unsigned timeout = 0) wxOVERRIDE { return OSXShowWithEffect(false, effect, timeout); } - virtual bool IsShownOnScreen() const; + virtual bool IsShownOnScreen() const wxOVERRIDE; - virtual void SetFocus(); + virtual void SetFocus() wxOVERRIDE; - virtual void WarpPointer( int x, int y ); + virtual void WarpPointer( int x, int y ) wxOVERRIDE; virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = NULL ); + const wxRect *rect = NULL ) wxOVERRIDE; - virtual void Update() ; - virtual void ClearBackground(); + virtual void Update() wxOVERRIDE; + virtual void ClearBackground() wxOVERRIDE; - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); - virtual bool SetBackgroundColour( const wxColour &colour ); - virtual bool SetForegroundColour( const wxColour &colour ); + virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE; + virtual bool SetFont( const wxFont &font ) wxOVERRIDE; + virtual bool SetBackgroundColour( const wxColour &colour ) wxOVERRIDE; + virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; - virtual bool SetBackgroundStyle(wxBackgroundStyle style); + virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; + virtual int GetCharHeight() const wxOVERRIDE; + virtual int GetCharWidth() const wxOVERRIDE; public: virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; + int range, bool refresh = true ) wxOVERRIDE; + virtual void SetScrollPos( int orient, int pos, bool refresh = true ) wxOVERRIDE; + virtual int GetScrollPos( int orient ) const wxOVERRIDE; + virtual int GetScrollThumb( int orient ) const wxOVERRIDE; + virtual int GetScrollRange( int orient ) const wxOVERRIDE; virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = NULL ); - virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true); - virtual bool IsScrollbarAlwaysShown(int orient) const + const wxRect* rect = NULL ) wxOVERRIDE; + virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true) wxOVERRIDE; + virtual bool IsScrollbarAlwaysShown(int orient) const wxOVERRIDE { return orient == wxHORIZONTAL ? m_hScrollBarAlwaysShown : m_vScrollBarAlwaysShown; } - virtual bool Reparent( wxWindowBase *newParent ); + virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE; #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); + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode) wxOVERRIDE; + virtual bool UnregisterHotKey(int hotkeyId) wxOVERRIDE; #endif // wxUSE_HOTKEY #if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; #endif // Accept files for dragging - virtual void DragAcceptFiles( bool accept ); + virtual void DragAcceptFiles( bool accept ) wxOVERRIDE; // implementation from now on // -------------------------- @@ -144,11 +141,11 @@ public: // simple accessors // ---------------- - virtual WXWidget GetHandle() const; + virtual WXWidget GetHandle() const wxOVERRIDE; - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); - virtual wxByte GetTransparent() const ; + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE; + virtual bool CanSetTransparent() wxOVERRIDE; + virtual wxByte GetTransparent() const; // event handlers // -------------- @@ -157,17 +154,17 @@ public: void MacOnScroll( wxScrollEvent&event ); - virtual bool AcceptsFocus() const; + virtual bool AcceptsFocus() const wxOVERRIDE; - virtual bool IsDoubleBuffered() const { return true; } + virtual bool IsDoubleBuffered() const wxOVERRIDE { return true; } public: - static long MacRemoveBordersFromStyle( long style ) ; + static long MacRemoveBordersFromStyle( long style ); public: // For implementation purposes: // sometimes decorations make the client area smaller - virtual wxPoint GetClientAreaOrigin() const; + virtual wxPoint GetClientAreaOrigin() const wxOVERRIDE; wxWindowMac *FindItem(long id) const; wxWindowMac *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const; @@ -175,7 +172,7 @@ public: virtual void TriggerScrollEvent( wxEventType scrollEvent ) ; // this should not be overridden in classes above wxWindowMac // because it is called from its destructor via DeleteChildren - virtual void RemoveChild( wxWindowBase *child ); + virtual void RemoveChild( wxWindowBase *child ) wxOVERRIDE; virtual bool MacDoRedraw( long time ) ; virtual void MacPaintChildrenBorders(); @@ -236,7 +233,7 @@ public: virtual bool MacClipGrandChildren() const { return false ; } bool MacIsWindowScrollbar( const wxWindow* sb ) const { return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; } - virtual bool IsClientAreaChild(const wxWindow *child) const + virtual bool IsClientAreaChild(const wxWindow *child) const wxOVERRIDE { return !MacIsWindowScrollbar(child) && !((wxWindow*)m_growBox==child) && wxWindowBase::IsClientAreaChild(child); @@ -291,7 +288,7 @@ public: bool IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; } - double GetContentScaleFactor() const ; + double GetContentScaleFactor() const wxOVERRIDE; // internal response to size events virtual void MacOnInternalSize() {} @@ -346,40 +343,40 @@ protected: int *x, int *y, int *descent = NULL, int *externalLeading = NULL, - const wxFont *theFont = NULL ) const; + const wxFont *theFont = NULL ) const wxOVERRIDE; - virtual void DoEnable( bool enable ); + virtual void DoEnable( bool enable ) wxOVERRIDE; #if wxUSE_MENUS - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; #endif - virtual void DoFreeze(); - virtual void DoThaw(); + virtual void DoFreeze() wxOVERRIDE; + virtual void DoThaw() wxOVERRIDE; - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; virtual wxSize DoGetSizeFromClientSize( const wxSize & size ) const; - virtual void DoClientToScreen( int *x, int *y ) const; - virtual void DoScreenToClient( int *x, int *y ) const; - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoClientToScreen( int *x, int *y ) const wxOVERRIDE; + virtual void DoScreenToClient( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetPosition( int *x, int *y ) const wxOVERRIDE; + virtual void DoGetSize( int *width, int *height ) const wxOVERRIDE; + virtual void DoGetClientSize( int *width, int *height ) const wxOVERRIDE; virtual void DoSetSize(int x, int y, int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); + int sizeFlags = wxSIZE_AUTO) wxOVERRIDE; + virtual void DoSetClientSize(int width, int height) wxOVERRIDE; - virtual void DoCaptureMouse(); - virtual void DoReleaseMouse(); + virtual void DoCaptureMouse() wxOVERRIDE; + virtual void DoReleaseMouse() wxOVERRIDE; // move the window to the specified location and resize it: this is called // from both DoSetSize() and DoSetClientSize() and would usually just call // ::MoveWindow() except for composite controls which will want to arrange // themselves inside the given rectangle - virtual void DoMoveWindow( int x, int y, int width, int height ); - virtual void DoSetWindowVariant( wxWindowVariant variant ); + virtual void DoMoveWindow( int x, int y, int width, int height ) wxOVERRIDE; + virtual void DoSetWindowVariant( wxWindowVariant variant ) wxOVERRIDE; #if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE; #endif // common part of Show/HideWithEffect() @@ -397,7 +394,7 @@ private: void DoUpdateScrollbarVisibility(); wxDECLARE_NO_COPY_CLASS(wxWindowMac); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; #endif // _WX_WINDOW_H_ diff --git a/Externals/wxWidgets3/include/wx/overlay.h b/Externals/wxWidgets3/include/wx/overlay.h index adde26db86..57b87b48df 100644 --- a/Externals/wxWidgets3/include/wx/overlay.h +++ b/Externals/wxWidgets3/include/wx/overlay.h @@ -13,9 +13,7 @@ #include "wx/defs.h" -#if defined(__WXMAC__) && wxOSX_USE_CARBON - #define wxHAS_NATIVE_OVERLAY 1 -#elif defined(__WXDFB__) +#if defined(__WXDFB__) #define wxHAS_NATIVE_OVERLAY 1 #else // don't define wxHAS_NATIVE_OVERLAY diff --git a/Externals/wxWidgets3/include/wx/ownerdrw.h b/Externals/wxWidgets3/include/wx/ownerdrw.h index b25f5cc71a..7ae3b71cb4 100644 --- a/Externals/wxWidgets3/include/wx/ownerdrw.h +++ b/Externals/wxWidgets3/include/wx/ownerdrw.h @@ -135,8 +135,6 @@ private: #if defined(__WXMSW__) #include "wx/msw/ownerdrw.h" -#elif defined(__WXPM__) - #include "wx/os2/ownerdrw.h" #endif #endif // wxUSE_OWNER_DRAWN diff --git a/Externals/wxWidgets3/include/wx/palette.h b/Externals/wxWidgets3/include/wx/palette.h index 85bf7dd689..00aa960159 100644 --- a/Externals/wxWidgets3/include/wx/palette.h +++ b/Externals/wxWidgets3/include/wx/palette.h @@ -31,12 +31,12 @@ public: #include "wx/msw/palette.h" #elif defined(__WXX11__) || defined(__WXMOTIF__) #include "wx/x11/palette.h" -#elif defined(__WXGTK__) || defined(__WXCOCOA__) +#elif defined(__WXGTK__) #include "wx/generic/paletteg.h" #elif defined(__WXMAC__) #include "wx/osx/palette.h" -#elif defined(__WXPM__) - #include "wx/os2/palette.h" +#elif defined(__WXQT__) + #include "wx/qt/palette.h" #endif #endif // wxUSE_PALETTE diff --git a/Externals/wxWidgets3/include/wx/panel.h b/Externals/wxWidgets3/include/wx/panel.h index 11fc2c6416..e11db6728b 100644 --- a/Externals/wxWidgets3/include/wx/panel.h +++ b/Externals/wxWidgets3/include/wx/panel.h @@ -54,7 +54,7 @@ public: // implementation from now on // -------------------------- - virtual void InitDialog(); + virtual void InitDialog() wxOVERRIDE; private: wxDECLARE_NO_COPY_CLASS(wxPanelBase); diff --git a/Externals/wxWidgets3/include/wx/paper.h b/Externals/wxWidgets3/include/wx/paper.h index d50d549804..19e6d26a45 100644 --- a/Externals/wxWidgets3/include/wx/paper.h +++ b/Externals/wxWidgets3/include/wx/paper.h @@ -62,7 +62,7 @@ public: wxString m_paperName; private: - DECLARE_DYNAMIC_CLASS(wxPrintPaperType) + wxDECLARE_DYNAMIC_CLASS(wxPrintPaperType); }; WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap); @@ -111,7 +111,7 @@ public: private: wxStringToPrintPaperTypeHashMap* m_map; wxPrintPaperTypeList* m_list; - // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) + //wxDECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase); }; extern WXDLLIMPEXP_DATA_CORE(wxPrintPaperDatabase*) wxThePrintPaperDatabase; diff --git a/Externals/wxWidgets3/include/wx/pen.h b/Externals/wxWidgets3/include/wx/pen.h index e55b046eff..e7eb2ff4a1 100644 --- a/Externals/wxWidgets3/include/wx/pen.h +++ b/Externals/wxWidgets3/include/wx/pen.h @@ -109,10 +109,8 @@ public: #include "wx/dfb/pen.h" #elif defined(__WXMAC__) #include "wx/osx/pen.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/pen.h" -#elif defined(__WXPM__) - #include "wx/os2/pen.h" +#elif defined(__WXQT__) + #include "wx/qt/pen.h" #endif class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase @@ -122,14 +120,9 @@ public: int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); -#if FUTURE_WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") wxPen *FindOrCreatePen(const wxColour& colour, int width, int style) { return FindOrCreatePen(colour, width, (wxPenStyle)style); } -#endif -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( void AddPen(wxPen*) ); - wxDEPRECATED( void RemovePen(wxPen*) ); -#endif }; extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; @@ -140,25 +133,24 @@ extern WXDLLIMPEXP_DATA_CORE(wxPenList*) wxThePenList; // // to compile without warnings which it would otherwise provoke from some // compilers as it compares elements of different enums -#if FUTURE_WXWIN_COMPATIBILITY_3_0 // Unfortunately some compilers have ambiguity issues when enum comparisons are // overloaded so we have to disable the overloads in this case, see // wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. #ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM +wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") inline bool operator==(wxPenStyle s, wxDeprecatedGUIConstants t) { return static_cast(s) == static_cast(t); } +wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") inline bool operator!=(wxPenStyle s, wxDeprecatedGUIConstants t) { - return !(s == t); + return static_cast(s) != static_cast(t); } #endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM -#endif // FUTURE_WXWIN_COMPATIBILITY_3_0 - #endif // _WX_PEN_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/persist.h b/Externals/wxWidgets3/include/wx/persist.h index 45ed61eb9e..757fad0355 100644 --- a/Externals/wxWidgets3/include/wx/persist.h +++ b/Externals/wxWidgets3/include/wx/persist.h @@ -55,8 +55,6 @@ public: static wxPersistenceManager& Get(); // trivial but virtual dtor - // - // FIXME-VC6: this only needs to be public because of VC6 bug virtual ~wxPersistenceManager(); @@ -231,15 +229,8 @@ private: wxDECLARE_NO_COPY_CLASS(wxPersistentObject); }; -// FIXME-VC6: VC6 has troubles with template methods of DLL-exported classes, -// apparently it believes they should be defined in the DLL (which -// is, of course, impossible as the DLL doesn't know for which types -// will they be instantiated) instead of compiling them when -// building the main application itself. Because of this problem -// (which only arises in debug build!) we can't use the usual -// RegisterAndRestore(obj) with it and need to explicitly create the -// persistence adapter. To hide this ugliness we define a global -// function which does it for us. +// Helper function calling RegisterAndRestore() on the global persistence +// manager object. template inline bool wxPersistentRegisterAndRestore(T *obj) { diff --git a/Externals/wxWidgets3/include/wx/persist/bookctrl.h b/Externals/wxWidgets3/include/wx/persist/bookctrl.h index 38eee262e9..6b48ebe0b4 100644 --- a/Externals/wxWidgets3/include/wx/persist/bookctrl.h +++ b/Externals/wxWidgets3/include/wx/persist/bookctrl.h @@ -34,12 +34,12 @@ public: { } - virtual void Save() const + virtual void Save() const wxOVERRIDE { SaveValue(wxPERSIST_BOOK_SELECTION, Get()->GetSelection()); } - virtual bool Restore() + virtual bool Restore() wxOVERRIDE { long sel; if ( RestoreValue(wxPERSIST_BOOK_SELECTION, &sel) ) @@ -55,7 +55,7 @@ public: return false; } - virtual wxString GetKind() const { return wxPERSIST_BOOK_KIND; } + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_BOOK_KIND; } }; inline wxPersistentObject *wxCreatePersistentObject(wxBookCtrlBase *book) diff --git a/Externals/wxWidgets3/include/wx/persist/splitter.h b/Externals/wxWidgets3/include/wx/persist/splitter.h index d8369c3783..46979d673f 100644 --- a/Externals/wxWidgets3/include/wx/persist/splitter.h +++ b/Externals/wxWidgets3/include/wx/persist/splitter.h @@ -35,7 +35,7 @@ public: { } - virtual void Save() const + virtual void Save() const wxOVERRIDE { wxSplitterWindow* const splitter = Get(); @@ -43,7 +43,7 @@ public: SaveValue(wxPERSIST_SPLITTER_POSITION, pos); } - virtual bool Restore() + virtual bool Restore() wxOVERRIDE { int pos; if ( !RestoreValue(wxPERSIST_SPLITTER_POSITION, &pos) ) @@ -57,7 +57,7 @@ public: return true; } - virtual wxString GetKind() const { return wxPERSIST_SPLITTER_KIND; } + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_SPLITTER_KIND; } }; inline wxPersistentObject *wxCreatePersistentObject(wxSplitterWindow* splitter) diff --git a/Externals/wxWidgets3/include/wx/persist/toplevel.h b/Externals/wxWidgets3/include/wx/persist/toplevel.h index 7d79f23460..722a66af59 100644 --- a/Externals/wxWidgets3/include/wx/persist/toplevel.h +++ b/Externals/wxWidgets3/include/wx/persist/toplevel.h @@ -46,7 +46,7 @@ public: { } - virtual void Save() const + virtual void Save() const wxOVERRIDE { const wxTopLevelWindow * const tlw = Get(); @@ -67,9 +67,15 @@ public: SaveValue(wxPERSIST_TLW_MAXIMIZED, tlw->IsMaximized()); SaveValue(wxPERSIST_TLW_ICONIZED, tlw->IsIconized()); +#ifdef __WXGTK20__ + SaveValue("decor_l", tlw->m_decorSize.left); + SaveValue("decor_r", tlw->m_decorSize.right); + SaveValue("decor_t", tlw->m_decorSize.top); + SaveValue("decor_b", tlw->m_decorSize.bottom); +#endif } - virtual bool Restore() + virtual bool Restore() wxOVERRIDE { wxTopLevelWindow * const tlw = Get(); @@ -81,6 +87,17 @@ public: RestoreValue(wxPERSIST_TLW_Y, &y); const bool hasSize = RestoreValue(wxPERSIST_TLW_W, &w) && RestoreValue(wxPERSIST_TLW_H, &h); +#ifdef __WXGTK20__ + wxTopLevelWindowGTK::DecorSize decorSize; + if (tlw->m_decorSize.top == 0 && + RestoreValue("decor_l", &decorSize.left) && + RestoreValue("decor_r", &decorSize.right) && + RestoreValue("decor_t", &decorSize.top) && + RestoreValue("decor_b", &decorSize.bottom)) + { + tlw->m_decorSize = decorSize; + } +#endif if ( hasPos ) { @@ -117,7 +134,7 @@ public: return hasSize; } - virtual wxString GetKind() const { return wxPERSIST_TLW_KIND; } + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_TLW_KIND; } }; inline wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *tlw) diff --git a/Externals/wxWidgets3/include/wx/persist/treebook.h b/Externals/wxWidgets3/include/wx/persist/treebook.h index 1c0ba94631..9a38296879 100644 --- a/Externals/wxWidgets3/include/wx/persist/treebook.h +++ b/Externals/wxWidgets3/include/wx/persist/treebook.h @@ -38,7 +38,7 @@ public: { } - virtual void Save() const + virtual void Save() const wxOVERRIDE { const wxTreebook * const book = GetTreeBook(); @@ -60,7 +60,7 @@ public: wxPersistentBookCtrl::Save(); } - virtual bool Restore() + virtual bool Restore() wxOVERRIDE { wxTreebook * const book = GetTreeBook(); @@ -83,7 +83,7 @@ public: return wxPersistentBookCtrl::Restore(); } - virtual wxString GetKind() const { return wxPERSIST_TREEBOOK_KIND; } + virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_TREEBOOK_KIND; } wxTreebook *GetTreeBook() const { return static_cast(Get()); } }; diff --git a/Externals/wxWidgets3/include/wx/persist/window.h b/Externals/wxWidgets3/include/wx/persist/window.h index 279e11d26d..db163a2f1a 100644 --- a/Externals/wxWidgets3/include/wx/persist/window.h +++ b/Externals/wxWidgets3/include/wx/persist/window.h @@ -21,19 +21,16 @@ // ---------------------------------------------------------------------------- // type-independent part of wxPersistentWindow -class wxPersistentWindowBase : - wxBIND_OR_CONNECT_HACK_BASE_CLASS - public wxPersistentObject +class wxPersistentWindowBase : public wxPersistentObject { public: wxPersistentWindowBase(wxWindow *win) : wxPersistentObject(win) { - wxBIND_OR_CONNECT_HACK(win, wxEVT_DESTROY, wxWindowDestroyEventHandler, - wxPersistentWindowBase::HandleDestroy, this); + win->Bind(wxEVT_DESTROY, &wxPersistentWindowBase::HandleDestroy, this); } - virtual wxString GetName() const + virtual wxString GetName() const wxOVERRIDE { const wxString name = GetWindow()->GetName(); wxASSERT_MSG( !name.empty(), "persistent windows should be named!" ); diff --git a/Externals/wxWidgets3/include/wx/pickerbase.h b/Externals/wxWidgets3/include/wx/pickerbase.h index 3c761da876..f4ec165784 100644 --- a/Externals/wxWidgets3/include/wx/pickerbase.h +++ b/Externals/wxWidgets3/include/wx/pickerbase.h @@ -91,9 +91,10 @@ public: // public API { int f = GetDefaultPickerCtrlFlag(); if ( grow ) + { + f &= ~wxALIGN_MASK; f |= wxGROW; - else - f &= ~wxGROW; + } GetPickerCtrlItem()->SetFlag(f); } @@ -117,7 +118,7 @@ public: // public API protected: // overridden base class methods #if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); + virtual void DoSetToolTip(wxToolTip *tip) wxOVERRIDE; #endif // wxUSE_TOOLTIPS @@ -151,25 +152,12 @@ protected: int GetDefaultPickerCtrlFlag() const { - // on macintosh, without additional borders - // there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL|wxGROW -#ifdef __WXMAC__ - | wxTOP | wxRIGHT | wxBOTTOM -#endif - ; + return wxALIGN_CENTER_VERTICAL; } int GetDefaultTextCtrlFlag() const { - // on macintosh, without wxALL there's not enough space for focus rect - return wxALIGN_CENTER_VERTICAL -#ifdef __WXMAC__ - | wxALL -#else - | wxRIGHT -#endif - ; + return wxALIGN_CENTER_VERTICAL | wxRIGHT; } void PostCreation(); @@ -180,7 +168,7 @@ protected: wxBoxSizer *m_sizer; private: - DECLARE_ABSTRACT_CLASS(wxPickerBase) + wxDECLARE_ABSTRACT_CLASS(wxPickerBase); }; diff --git a/Externals/wxWidgets3/include/wx/platform.h b/Externals/wxWidgets3/include/wx/platform.h index 97c669f7a4..b490d52a96 100644 --- a/Externals/wxWidgets3/include/wx/platform.h +++ b/Externals/wxWidgets3/include/wx/platform.h @@ -32,6 +32,12 @@ # ifndef MAC_OS_X_VERSION_10_8 # define MAC_OS_X_VERSION_10_8 1080 # endif +# ifndef MAC_OS_X_VERSION_10_9 +# define MAC_OS_X_VERSION_10_9 1090 +# endif +# ifndef MAC_OS_X_VERSION_10_10 +# define MAC_OS_X_VERSION_10_10 101000 +# endif # include "wx/osx/config_xcode.h" # ifndef __WXOSX__ # define __WXOSX__ 1 @@ -57,21 +63,6 @@ # endif /* !__WINDOWS__ */ #endif /* Any standard symbol indicating Windows */ -#if defined(_WIN64) -# ifndef _WIN32 - /* - a lot of code (mistakenly) uses #ifdef _WIN32 to either test for - Windows or to test for !__WIN16__, so we must define _WIN32 for - Win64 as well to ensure that the existing code continues to work. - */ -# define _WIN32 -# endif /* !_WIN32 */ - -# ifndef __WIN64__ -# define __WIN64__ -# endif /* !__WIN64__ */ -#endif /* _WIN64 */ - #if defined(__WINDOWS__) /* Select wxMSW under Windows if no other port is specified. */ # if !defined(__WXMSW__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) @@ -93,6 +84,15 @@ # ifndef __WIN32__ # define __WIN32__ # endif + + /* MSVC predefines _WIN64 for 64 bit builds, for gcc we use generic + architecture definitions. */ +# if defined(_WIN64) || defined(__x86_64__) +# ifndef __WIN64__ +# define __WIN64__ +# endif /* !__WIN64__ */ +# endif /* _WIN64 */ + #endif /* __WINDOWS__ */ /* @@ -118,59 +118,6 @@ #endif /* __WXGTK__ && __WINDOWS__ */ -/* detect MS SmartPhone */ -#if defined( WIN32_PLATFORM_WFSP ) -# ifndef __SMARTPHONE__ -# define __SMARTPHONE__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect PocketPC */ -#if defined( WIN32_PLATFORM_PSPC ) -# ifndef __POCKETPC__ -# define __POCKETPC__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -/* detect Standard WinCE SDK */ -#if defined( WCE_PLATFORM_STANDARDSDK ) -# ifndef __WINCE_STANDARDSDK__ -# define __WINCE_STANDARDSDK__ -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(_WIN32_WCE) && !defined(WIN32_PLATFORM_WFSP) && !defined(WIN32_PLATFORM_PSPC) -# if (_WIN32_WCE >= 400) -# ifndef __WINCE_NET__ -# define __WINCE_NET__ -# endif -# elif (_WIN32_WCE >= 200) -# ifndef __HANDHELDPC__ -# define __HANDHELDPC__ -# endif -# endif -# ifndef __WXWINCE__ -# define __WXWINCE__ -# endif -#endif - -#if defined(__WXWINCE__) && defined(_MSC_VER) && (_MSC_VER == 1201) - #define __EVC4__ -#endif - -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) || defined(__WXGPE__) -# define __WXHANDHELD__ -#endif - #ifdef __ANDROID__ # define __WXANDROID__ # include "wx/android/config_android.h" @@ -290,41 +237,20 @@ # define wxCOMPILER_BROKEN_CONCAT_OPER #endif /* __BORLANDC__ */ -/* - OS: first of all, test for MS-DOS platform. We must do this before testing - for Unix, because DJGPP compiler defines __unix__ under MS-DOS - */ -#if defined(__GO32__) || defined(__DJGPP__) || defined(__DOS__) -# ifndef __DOS__ -# define __DOS__ -# endif - /* size_t is the same as unsigned int for Watcom 11 compiler, */ - /* so define it if it hadn't been done by configure yet */ -# if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) -# ifdef __WATCOMC__ -# define wxSIZE_T_IS_UINT -# endif -# ifdef __DJGPP__ -# define wxSIZE_T_IS_ULONG -# endif -# endif - /* OS: then test for generic Unix defines, then for particular flavours and finally for Unix-like systems Mac OS X matches this case (__MACH__), prior Mac OS do not. */ -#elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ +#if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ - defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ - defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__) + defined(__hpux) || defined(__sun) || defined(__SUN__) || defined(_AIX) || \ + defined(__VMS) || defined(__BEOS__) || defined(__MACH__) # define __UNIX_LIKE__ - /* Helps SGI compilation, apparently */ # ifdef __SGI__ # ifdef __GNUG__ -# define __need_wchar_t # else /* !gcc */ /* Note I use the term __SGI_CC__ for both cc and CC, its not a good @@ -339,9 +265,6 @@ # endif # endif /* SGI */ -# ifdef __EMX__ -# define OS2EMX_PLAIN_CHAR -# endif # if defined(__INNOTEK_LIBC__) /* Ensure visibility of strnlen declaration */ # define _GNU_SOURCE @@ -352,12 +275,6 @@ # define __HPUX__ # endif /* HP-UX */ -# if defined(__CYGWIN__) || defined(__WINE__) -# if !defined(wxSIZE_T_IS_UINT) -# define wxSIZE_T_IS_UINT -# endif -# endif - /* All of these should already be defined by including configure- generated setup.h but we wish to support Xcode compilation without requiring the user to define these himself. @@ -372,10 +289,6 @@ /* __DARWIN__ is our own define to mean OS X or pure Darwin */ # ifndef __DARWIN__ # define __DARWIN__ 1 -# endif - /* NOTE: TARGET_CARBON is actually a 0/1 and must be 1 for OS X */ -# ifndef TARGET_CARBON -# define TARGET_CARBON 1 # endif /* OS X uses unsigned long size_t for both ILP32 and LP64 modes. */ # if !defined(wxSIZE_T_IS_UINT) && !defined(wxSIZE_T_IS_ULONG) @@ -383,29 +296,6 @@ # endif # endif -/* - OS: OS/2 - */ -#elif defined(__OS2__) - - /* wxOS2 vs. non wxOS2 ports on OS2 platform */ -# if !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) -# ifndef __WXPM__ -# define __WXPM__ -# endif -# endif - -# if defined(__IBMCPP__) -# define __VISAGEAVER__ __IBMCPP__ -# endif - - /* Place other OS/2 compiler environment defines here */ -# if defined(__VISAGECPP__) - /* VisualAge is the only thing that understands _Optlink */ -# define LINKAGEMODE _Optlink -# endif -# define wxSIZE_T_IS_UINT - /* OS: Windows */ @@ -446,9 +336,7 @@ #endif /* Force linking against required libraries under Windows: */ -#ifdef __WXWINCE__ -# include "wx/msw/wince/libraries.h" -#elif defined __WINDOWS__ +#if defined __WINDOWS__ # include "wx/msw/libraries.h" #endif @@ -456,17 +344,21 @@ #define wxNEEDS_CHARPP #endif +/* + Note that wx/msw/gccpriv.h must be included after defining UNICODE and + _UNICODE macros as it includes _mingw.h which relies on them being set. + */ #if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ - ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) || \ - wxCHECK_WATCOM_VERSION(1,0) ) && \ - !defined(__DOS__) && \ - !defined(__WXPM__) && \ + ( defined( __CYGWIN__ ) && defined( __WINDOWS__ ) ) ) && \ !defined(__WXMOTIF__) && \ !defined(__WXX11__) # include "wx/msw/gccpriv.h" #else # undef wxCHECK_W32API_VERSION # define wxCHECK_W32API_VERSION(maj, min) (0) +# undef wxCHECK_MINGW32_VERSION +# define wxCHECK_MINGW32_VERSION( major, minor ) (0) +# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) #endif @@ -519,10 +411,10 @@ whatever reason. The primary symbol remains __WXOSX_XXX__ one, __WXOSX__ exists to allow - checking for any OS X port (Carbon and Cocoa) and __WXMAC__ is an old name + checking for any OS X port (Cocoa) and __WXMAC__ is an old name for it. */ -#if defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) +#if defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) # ifndef __WXOSX__ # define __WXOSX__ 1 # endif @@ -539,8 +431,8 @@ # error "incorrect SDK for an iPhone build" # endif # else -# if wxUSE_GUI && !(defined(__WXOSX_CARBON__) || defined(__WXOSX_COCOA__)) -# error "one of __WXOSX_IPHONE__, __WXOSX_CARBON__ or __WXOSX_COCOA__ must be defined for the GUI build" +# if wxUSE_GUI && !defined(__WXOSX_COCOA__) +# error "one of __WXOSX_IPHONE__ or __WXOSX_COCOA__ must be defined for the GUI build" # endif # if !( defined(TARGET_OS_MAC) && TARGET_OS_MAC ) # error "incorrect SDK for a Mac OS X build" @@ -567,31 +459,21 @@ # ifndef MAC_OS_X_VERSION_10_8 # define MAC_OS_X_VERSION_10_8 1080 # endif +# ifndef MAC_OS_X_VERSION_10_9 +# define MAC_OS_X_VERSION_10_9 1090 +# endif +# ifndef MAC_OS_X_VERSION_10_10 +# define MAC_OS_X_VERSION_10_10 101000 +# endif # else # error "only mach-o configurations are supported" # endif #endif /* - __WXOSX_OR_COCOA__ is a common define to wxOSX (Carbon or Cocoa) and wxCocoa ports under OS X. - - DO NOT use this define in base library code. Although wxMac has its own - private base library (and thus __WXOSX_OR_COCOA__,__WXMAC__ and related defines are - valid there), wxCocoa shares its library with other ports like wxGTK and wxX11. - - To keep wx authors from screwing this up, only enable __WXOSX_OR_COCOA__ for wxCocoa when - not compiling the base library. We determine this by first checking if - wxUSE_BASE is not defined. If it is not defined, then we're not buildling - the base library, and possibly not building wx at all (but actually building - user code that's using wx). If it is defined then we must check to make sure - it is not true. If it is true, we're building base. - - If you want it in the common darwin base library then use __DARWIN__. You - can use any Darwin-available libraries like CoreFoundation but please avoid - using OS X libraries like Carbon or CoreServices. - + This is obsolete and kept for backwards compatibility only. */ -#if defined(__WXOSX__) || (defined(__WXCOCOA__) && (!defined(wxUSE_BASE) || !wxUSE_BASE)) +#if defined(__WXOSX__) # define __WXOSX_OR_COCOA__ 1 #endif @@ -611,9 +493,6 @@ #if defined(_MSC_VER) && (_MSC_VER >= 1310) # undef wxUSE_IOSTREAMH # define wxUSE_IOSTREAMH 0 -#elif defined(__DMC__) || defined(__WATCOMC__) -# undef wxUSE_IOSTREAMH -# define wxUSE_IOSTREAMH 1 #elif defined(__MINGW32__) # undef wxUSE_IOSTREAMH # define wxUSE_IOSTREAMH 0 diff --git a/Externals/wxWidgets3/include/wx/platinfo.h b/Externals/wxWidgets3/include/wx/platinfo.h index f82080e587..cc13959567 100644 --- a/Externals/wxWidgets3/include/wx/platinfo.h +++ b/Externals/wxWidgets3/include/wx/platinfo.h @@ -75,10 +75,11 @@ enum wxPortId 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_MAC = 1 << 7, // wxOSX (former wxMac), using Cocoa or iPhone API + wxPORT_OSX = wxPORT_MAC, // wxOSX, using Cocoa or iPhone API wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API - wxPORT_WINCE = 1 << 9 // wxWinCE, toolkit is WinCE SDK API + wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API + wxPORT_QT = 1 << 10 // wxQT, using QT4 }; // architecture of the operating system @@ -187,27 +188,27 @@ public: { return m_osVersionMajor; } int GetOSMinorVersion() const { return m_osVersionMinor; } + int GetOSMicroVersion() const + { return m_osVersionMicro; } // return true if the OS version >= major.minor - bool CheckOSVersion(int major, int minor) const - { - return DoCheckVersion(GetOSMajorVersion(), - GetOSMinorVersion(), - major, - minor); - } + bool CheckOSVersion(int major, int minor, int micro = 0) const; int GetToolkitMajorVersion() const { return m_tkVersionMajor; } int GetToolkitMinorVersion() const { return m_tkVersionMinor; } + int GetToolkitMicroVersion() const + { return m_tkVersionMicro; } - bool CheckToolkitVersion(int major, int minor) const + bool CheckToolkitVersion(int major, int minor, int micro = 0) const { return DoCheckVersion(GetToolkitMajorVersion(), GetToolkitMinorVersion(), + GetToolkitMicroVersion(), major, - minor); + minor, + micro); } bool IsUsingUniversalWidgets() const @@ -254,10 +255,19 @@ public: // setters // ----------------- - void SetOSVersion(int major, int minor) - { m_osVersionMajor=major; m_osVersionMinor=minor; } - void SetToolkitVersion(int major, int minor) - { m_tkVersionMajor=major; m_tkVersionMinor=minor; } + void SetOSVersion(int major, int minor, int micro = 0) + { + m_osVersionMajor = major; + m_osVersionMinor = minor; + m_osVersionMicro = micro; + } + + void SetToolkitVersion(int major, int minor, int micro = 0) + { + m_tkVersionMajor = major; + m_tkVersionMinor = minor; + m_tkVersionMicro = micro; + } void SetOperatingSystemId(wxOperatingSystemId n) { m_os = n; } @@ -282,9 +292,11 @@ public: bool IsOk() const { return m_osVersionMajor != -1 && m_osVersionMinor != -1 && + m_osVersionMicro != -1 && m_os != wxOS_UNKNOWN && !m_osDesc.IsEmpty() && m_tkVersionMajor != -1 && m_tkVersionMinor != -1 && + m_tkVersionMicro != -1 && m_port != wxPORT_UNKNOWN && m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID; @@ -294,11 +306,16 @@ public: protected: - static bool DoCheckVersion(int majorCur, int minorCur, int major, int minor) + static bool DoCheckVersion(int majorCur, int minorCur, int microCur, + int major, int minor, int micro) { - return majorCur > major || (majorCur == major && minorCur >= minor); + return majorCur > major + || (majorCur == major && minorCur > minor) + || (majorCur == major && minorCur == minor && microCur >= micro); } + bool m_initializedForCurrentPlatform; + void InitForCurrentPlatform(); @@ -308,7 +325,8 @@ protected: // Version of the OS; valid if m_os != wxOS_UNKNOWN // (-1 means not initialized yet). int m_osVersionMajor, - m_osVersionMinor; + m_osVersionMinor, + m_osVersionMicro; // Operating system ID. wxOperatingSystemId m_os; @@ -329,7 +347,7 @@ protected: // Version of the underlying toolkit // (-1 means not initialized yet; zero means no toolkit). - int m_tkVersionMajor, m_tkVersionMinor; + int m_tkVersionMajor, m_tkVersionMinor, m_tkVersionMicro; // name of the wxWidgets port wxPortId m_port; @@ -349,21 +367,5 @@ protected: }; -#if WXWIN_COMPATIBILITY_2_6 - #define wxUNKNOWN_PLATFORM wxOS_UNKNOWN - #define wxUnix wxOS_UNIX - #define wxWin95 wxOS_WINDOWS_9X - #define wxWIN95 wxOS_WINDOWS_9X - #define wxWINDOWS_NT wxOS_WINDOWS_NT - #define wxMSW wxOS_WINDOWS - #define wxWinCE wxOS_WINDOWS_CE - #define wxWIN32S wxOS_WINDOWS_9X - - #define wxOS2 wxPORT_OS2 - #define wxCocoa wxPORT_MAC - #define wxMac wxPORT_MAC - #define wxMotif wxPORT_MOTIF - #define wxGTK wxPORT_GTK -#endif // WXWIN_COMPATIBILITY_2_6 #endif // _WX_PLATINFO_H_ diff --git a/Externals/wxWidgets3/include/wx/popupwin.h b/Externals/wxWidgets3/include/wx/popupwin.h index 6b61517f39..ea6a4427a4 100644 --- a/Externals/wxWidgets3/include/wx/popupwin.h +++ b/Externals/wxWidgets3/include/wx/popupwin.h @@ -44,7 +44,7 @@ public: virtual void Position(const wxPoint& ptOrigin, const wxSize& size); - virtual bool IsTopLevel() const { return true; } + virtual bool IsTopLevel() const wxOVERRIDE { return true; } wxDECLARE_NO_COPY_CLASS(wxPopupWindowBase); }; @@ -53,8 +53,6 @@ public: // include the real class declaration #if defined(__WXMSW__) #include "wx/msw/popupwin.h" -#elif defined(__WXPM__) - #include "wx/os2/popupwin.h" #elif defined(__WXGTK20__) #include "wx/gtk/popupwin.h" #elif defined(__WXGTK__) @@ -67,6 +65,8 @@ public: #include "wx/dfb/popupwin.h" #elif defined(__WXMAC__) #include "wx/osx/popupwin.h" +#elif defined(__WXQT__) + #include "wx/qt/popupwin.h" #else #error "wxPopupWindow is not supported under this platform." #endif @@ -107,10 +107,10 @@ public: virtual bool ProcessLeftDown(wxMouseEvent& event); // Overridden to grab the input on some plaforms - virtual bool Show( bool show = true ); + virtual bool Show( bool show = true ) wxOVERRIDE; // Override to implement delayed destruction of this window. - virtual bool Destroy(); + virtual bool Destroy() wxOVERRIDE; protected: // common part of all ctors @@ -149,8 +149,8 @@ protected: wxPopupWindowHandler *m_handlerPopup; wxPopupFocusHandler *m_handlerFocus; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupTransientWindow) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupTransientWindow); wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); }; @@ -184,8 +184,8 @@ protected: // the parent combobox wxComboCtrl *m_combo; - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxPopupComboWindow) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupComboWindow); }; #endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) diff --git a/Externals/wxWidgets3/include/wx/power.h b/Externals/wxWidgets3/include/wx/power.h index 17e81b6efb..7c45abafb6 100644 --- a/Externals/wxWidgets3/include/wx/power.h +++ b/Externals/wxWidgets3/include/wx/power.h @@ -69,7 +69,7 @@ public: private: bool m_veto; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPowerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPowerEvent); }; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, wxPowerEvent ); @@ -95,6 +95,49 @@ typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&); #undef wxHAS_POWER_EVENTS #endif // support for power events/no support +// ---------------------------------------------------------------------------- +// wxPowerResourceBlocker +// ---------------------------------------------------------------------------- + +enum wxPowerResourceKind +{ + wxPOWER_RESOURCE_SCREEN, + wxPOWER_RESOURCE_SYSTEM +}; + +class WXDLLIMPEXP_BASE wxPowerResource +{ +public: + static bool Acquire(wxPowerResourceKind kind, + const wxString& reason = wxString()); + static void Release(wxPowerResourceKind kind); +}; + +class wxPowerResourceBlocker +{ +public: + explicit wxPowerResourceBlocker(wxPowerResourceKind kind, + const wxString& reason = wxString()) + : m_kind(kind), + m_acquired(wxPowerResource::Acquire(kind, reason)) + { + } + + bool IsInEffect() const { return m_acquired; } + + ~wxPowerResourceBlocker() + { + if ( m_acquired ) + wxPowerResource::Release(m_kind); + } + +private: + const wxPowerResourceKind m_kind; + const bool m_acquired; + + wxDECLARE_NO_COPY_CLASS(wxPowerResourceBlocker); +}; + // ---------------------------------------------------------------------------- // power management functions // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/preferences.h b/Externals/wxWidgets3/include/wx/preferences.h index 7eee648289..40dac7a0bd 100644 --- a/Externals/wxWidgets3/include/wx/preferences.h +++ b/Externals/wxWidgets3/include/wx/preferences.h @@ -79,9 +79,9 @@ public: wxStockPreferencesPage(Kind kind) : m_kind(kind) {} Kind GetKind() const { return m_kind; } - virtual wxString GetName() const; + virtual wxString GetName() const wxOVERRIDE; #ifdef __WXOSX_COCOA__ - virtual wxBitmap GetLargeIcon() const; + virtual wxBitmap GetLargeIcon() const wxOVERRIDE; #endif private: diff --git a/Externals/wxWidgets3/include/wx/print.h b/Externals/wxWidgets3/include/wx/print.h index 56ebcf6597..269f55cba4 100644 --- a/Externals/wxWidgets3/include/wx/print.h +++ b/Externals/wxWidgets3/include/wx/print.h @@ -23,10 +23,10 @@ #include "wx/osx/printmac.h" -#elif defined(__WXPM__) -#include "wx/os2/printos2.h" +#elif defined(__WXQT__) +#include "wx/qt/printqt.h" #else #include "wx/generic/printps.h" diff --git a/Externals/wxWidgets3/include/wx/printdlg.h b/Externals/wxWidgets3/include/wx/printdlg.h index d7e7e4e267..ecb2ce8819 100644 --- a/Externals/wxWidgets3/include/wx/printdlg.h +++ b/Externals/wxWidgets3/include/wx/printdlg.h @@ -41,7 +41,7 @@ public: virtual wxDC *GetPrintDC() = 0; private: - DECLARE_ABSTRACT_CLASS(wxPrintDialogBase) + wxDECLARE_ABSTRACT_CLASS(wxPrintDialogBase); wxDECLARE_NO_COPY_CLASS(wxPrintDialogBase); }; @@ -66,7 +66,7 @@ private: wxPrintDialogBase *m_pimpl; private: - DECLARE_DYNAMIC_CLASS(wxPrintDialog) + wxDECLARE_DYNAMIC_CLASS(wxPrintDialog); wxDECLARE_NO_COPY_CLASS(wxPrintDialog); }; @@ -88,7 +88,7 @@ public: virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0; private: - DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase) + wxDECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase); wxDECLARE_NO_COPY_CLASS(wxPageSetupDialogBase); }; @@ -111,7 +111,7 @@ private: wxPageSetupDialogBase *m_pimpl; private: - DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) + wxDECLARE_DYNAMIC_CLASS(wxPageSetupDialog); wxDECLARE_NO_COPY_CLASS(wxPageSetupDialog); }; diff --git a/Externals/wxWidgets3/include/wx/private/addremovectrl.h b/Externals/wxWidgets3/include/wx/private/addremovectrl.h new file mode 100644 index 0000000000..adb349f646 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/private/addremovectrl.h @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/addremovectrl.h +// Purpose: wxAddRemoveImpl helper class declaration +// Author: Vadim Zeitlin +// Created: 2015-02-04 +// Copyright: (c) 2015 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_ADDREMOVECTRL_H_ +#define _WX_PRIVATE_ADDREMOVECTRL_H_ + +#include "wx/button.h" +#include "wx/sizer.h" + +// ---------------------------------------------------------------------------- +// wxAddRemoveImplBase: implementation-only part of wxAddRemoveCtrl, base part +// ---------------------------------------------------------------------------- + +class wxAddRemoveImplBase +{ +public: + // Base class ctor just initializes the associated adaptor, the derived + // class is supposed to create the buttons and layout everything. + // + // Takes ownership of the adaptor pointer. + wxEXPLICIT wxAddRemoveImplBase(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* WXUNUSED(parent), + wxWindow* ctrlItems) + : m_adaptor(adaptor) + { + ctrlItems->Bind(wxEVT_CHAR, &wxAddRemoveImplBase::OnChar, this); + } + + // wxOSX implementation needs to override this as it doesn't use sizers, + // for the others it is not necessary. + virtual wxSize GetBestClientSize() const { return wxDefaultSize; } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) = 0; + + virtual ~wxAddRemoveImplBase() + { + delete m_adaptor; + } + + // Event handlers which must be connected to the appropriate sources by the + // derived classes. + + void OnUpdateUIAdd(wxUpdateUIEvent& event) + { + event.Enable( m_adaptor->CanAdd() ); + } + + void OnUpdateUIRemove(wxUpdateUIEvent& event) + { + event.Enable( m_adaptor->CanRemove() ); + } + + void OnAdd(wxCommandEvent& WXUNUSED(event)) + { + m_adaptor->OnAdd(); + } + + void OnRemove(wxCommandEvent& WXUNUSED(event)) + { + m_adaptor->OnRemove(); + } + +private: + // This event handler is connected by this class itself and doesn't need to + // be accessible to the derived classes. + + void OnChar(wxKeyEvent& event) + { + switch ( event.GetKeyCode() ) + { + case '+': + case WXK_INSERT: + case WXK_NUMPAD_INSERT: + if ( m_adaptor->CanAdd() ) + m_adaptor->OnAdd(); + return; + + case '-': + case WXK_DELETE: + case WXK_NUMPAD_DELETE: + if ( m_adaptor->CanRemove() ) + m_adaptor->OnRemove(); + return; + } + + event.Skip(); + } + + wxAddRemoveAdaptor* const m_adaptor; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveImplBase); +}; + +// GTK+ uses a wxToolBar-based implementation and so doesn't need this class. +#ifndef __WXGTK__ + +// Base class for the ports using actual wxButtons for the "+"/"-" buttons. +class wxAddRemoveImplWithButtons : public wxAddRemoveImplBase +{ +public: + wxEXPLICIT wxAddRemoveImplWithButtons(wxAddRemoveAdaptor* adaptor, + wxAddRemoveCtrl* parent, + wxWindow* ctrlItems) + : wxAddRemoveImplBase(adaptor, parent, ctrlItems) + { + m_btnAdd = + m_btnRemove = NULL; + } + + virtual void SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) wxOVERRIDE + { + m_btnAdd->SetToolTip(addtip); + m_btnRemove->SetToolTip(removetip); + } + +protected: + // Must be called by the derived class ctor after creating the buttons to + // set up the event handlers. + void SetUpEvents() + { + m_btnAdd->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIAdd, this); + m_btnRemove->Bind(wxEVT_UPDATE_UI, + &wxAddRemoveImplBase::OnUpdateUIRemove, this); + + m_btnAdd->Bind(wxEVT_BUTTON, &wxAddRemoveImplBase::OnAdd, this); + m_btnRemove->Bind(wxEVT_BUTTON, &wxAddRemoveImplBase::OnRemove, this); + } + + wxButton *m_btnAdd, + *m_btnRemove; + + wxDECLARE_NO_COPY_CLASS(wxAddRemoveImplWithButtons); +}; + +#endif // !wxGTK + +#ifdef __WXOSX__ + #include "wx/osx/private/addremovectrl.h" +#elif defined(__WXGTK__) + #include "wx/gtk/private/addremovectrl.h" +#else + #include "wx/generic/private/addremovectrl.h" +#endif + +#endif // _WX_PRIVATE_ADDREMOVECTRL_H_ diff --git a/Externals/wxWidgets3/include/wx/private/eventloopsourcesmanager.h b/Externals/wxWidgets3/include/wx/private/eventloopsourcesmanager.h index 54ce5b0fce..430a2f7f20 100644 --- a/Externals/wxWidgets3/include/wx/private/eventloopsourcesmanager.h +++ b/Externals/wxWidgets3/include/wx/private/eventloopsourcesmanager.h @@ -13,13 +13,17 @@ // For pulling in the value of wxUSE_EVENTLOOP_SOURCE #include "wx/evtloop.h" +#if wxUSE_EVENTLOOP_SOURCE + class WXDLLIMPEXP_BASE wxEventLoopSourcesManagerBase { public: -#if wxUSE_EVENTLOOP_SOURCE virtual wxEventLoopSource* AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) = 0; -#endif + + virtual ~wxEventLoopSourcesManagerBase() { } }; +#endif // wxUSE_EVENTLOOP_SOURCE + #endif // _WX_PRIVATE_EVENTLOOPSOURCESMANAGER_H_ diff --git a/Externals/wxWidgets3/include/wx/private/fdiodispatcher.h b/Externals/wxWidgets3/include/wx/private/fdiodispatcher.h index 0b85505cc0..704bd46377 100644 --- a/Externals/wxWidgets3/include/wx/private/fdiodispatcher.h +++ b/Externals/wxWidgets3/include/wx/private/fdiodispatcher.h @@ -100,13 +100,13 @@ public: // register handler for the given descriptor with the dispatcher, return // true on success or false on error - virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags); + virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags) wxOVERRIDE; // modify descriptor flags or handler, return true on success - virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags); + virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags) wxOVERRIDE; // unregister descriptor previously registered with RegisterFD() - virtual bool UnregisterFD(int fd); + virtual bool UnregisterFD(int fd) wxOVERRIDE; virtual ~wxMappedFDIODispatcher() { } diff --git a/Externals/wxWidgets3/include/wx/private/fdioeventloopsourcehandler.h b/Externals/wxWidgets3/include/wx/private/fdioeventloopsourcehandler.h index f457a09e5c..5ac17de240 100644 --- a/Externals/wxWidgets3/include/wx/private/fdioeventloopsourcehandler.h +++ b/Externals/wxWidgets3/include/wx/private/fdioeventloopsourcehandler.h @@ -25,9 +25,9 @@ public: } // Just forward to the real handler. - virtual void OnReadWaiting() { m_handler->OnReadWaiting(); } - virtual void OnWriteWaiting() { m_handler->OnWriteWaiting(); } - virtual void OnExceptionWaiting() { m_handler->OnExceptionWaiting(); } + virtual void OnReadWaiting() wxOVERRIDE { m_handler->OnReadWaiting(); } + virtual void OnWriteWaiting() wxOVERRIDE { m_handler->OnWriteWaiting(); } + virtual void OnExceptionWaiting() wxOVERRIDE { m_handler->OnExceptionWaiting(); } protected: wxEventLoopSourceHandler* const m_handler; diff --git a/Externals/wxWidgets3/include/wx/private/fileback.h b/Externals/wxWidgets3/include/wx/private/fileback.h index aaf5ab4afb..a4ca08aee7 100644 --- a/Externals/wxWidgets3/include/wx/private/fileback.h +++ b/Externals/wxWidgets3/include/wx/private/fileback.h @@ -58,17 +58,17 @@ public: // If the length of the backer's parent stream is unknown then GetLength() // returns wxInvalidOffset until the parent has been read to the end. - wxFileOffset GetLength() const; + wxFileOffset GetLength() const wxOVERRIDE; // Returns the length, reading the parent stream to the end if necessary. wxFileOffset FindLength() const; - bool IsSeekable() const { return true; } + bool IsSeekable() const wxOVERRIDE { return true; } protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE; private: wxBackingFile m_backer; diff --git a/Externals/wxWidgets3/include/wx/private/fswatcher.h b/Externals/wxWidgets3/include/wx/private/fswatcher.h index cfffba4a89..e2bf55a89d 100644 --- a/Externals/wxWidgets3/include/wx/private/fswatcher.h +++ b/Externals/wxWidgets3/include/wx/private/fswatcher.h @@ -84,8 +84,16 @@ public: virtual bool RemoveAll() { + bool ret = true; + for ( wxFSWatchEntries::iterator it = m_watches.begin(); + it != m_watches.end(); + ++it ) + { + if ( !DoRemove(it->second) ) + ret = false; + } m_watches.clear(); - return true; + return ret; } // Check whether any filespec matches the file's ext (if present) diff --git a/Externals/wxWidgets3/include/wx/private/launchbrowser.h b/Externals/wxWidgets3/include/wx/private/launchbrowser.h new file mode 100644 index 0000000000..984df897c9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/private/launchbrowser.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/launchbrowser.h +// Purpose: Helpers for wxLaunchDefaultBrowser() implementation. +// Author: Vadim Zeitlin +// Created: 2016-02-07 +// Copyright: (c) 2016 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_LAUNCHBROWSER_H_ +#define _WX_PRIVATE_LAUNCHBROWSER_H_ + +// ---------------------------------------------------------------------------- +// wxLaunchBrowserParams: passed to wxDoLaunchDefaultBrowser() +// ---------------------------------------------------------------------------- + +struct wxLaunchBrowserParams +{ + explicit wxLaunchBrowserParams(int f) : flags(f) { } + + // Return either the URL or the file depending on our scheme. + const wxString& GetPathOrURL() const + { + return scheme == wxS("file") ? path : url; + } + + + // The URL is always specified and is the real URL, always with the scheme + // part, which can be "file://". + wxString url; + + // The path is a local path which is only non-empty if the URL uses the + // "file://" scheme. + wxString path; + + // The scheme of the URL, e.g. "file" or "http". + wxString scheme; + + // The flags passed to wxLaunchDefaultBrowser(). + int flags; +}; + +#endif // _WX_PRIVATE_LAUNCHBROWSER_H_ diff --git a/Externals/wxWidgets3/include/wx/private/markupparserattr.h b/Externals/wxWidgets3/include/wx/private/markupparserattr.h index d433879daf..998a0414a9 100644 --- a/Externals/wxWidgets3/include/wx/private/markupparserattr.h +++ b/Externals/wxWidgets3/include/wx/private/markupparserattr.h @@ -68,33 +68,33 @@ public: // Implement all pure virtual methods inherited from the base class in // terms of our own ones. - virtual void OnBoldStart() { DoChangeFont(&wxFont::Bold); } - virtual void OnBoldEnd() { DoEndAttr(); } + virtual void OnBoldStart() wxOVERRIDE { DoChangeFont(&wxFont::Bold); } + virtual void OnBoldEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnItalicStart() { DoChangeFont(&wxFont::Italic); } - virtual void OnItalicEnd() { DoEndAttr(); } + virtual void OnItalicStart() wxOVERRIDE { DoChangeFont(&wxFont::Italic); } + virtual void OnItalicEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnUnderlinedStart() { DoChangeFont(&wxFont::Underlined); } - virtual void OnUnderlinedEnd() { DoEndAttr(); } + virtual void OnUnderlinedStart() wxOVERRIDE { DoChangeFont(&wxFont::Underlined); } + virtual void OnUnderlinedEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnStrikethroughStart() { DoChangeFont(&wxFont::Strikethrough); } - virtual void OnStrikethroughEnd() { DoEndAttr(); } + virtual void OnStrikethroughStart() wxOVERRIDE { DoChangeFont(&wxFont::Strikethrough); } + virtual void OnStrikethroughEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnBigStart() { DoChangeFont(&wxFont::Larger); } - virtual void OnBigEnd() { DoEndAttr(); } + virtual void OnBigStart() wxOVERRIDE { DoChangeFont(&wxFont::Larger); } + virtual void OnBigEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnSmallStart() { DoChangeFont(&wxFont::Smaller); } - virtual void OnSmallEnd() { DoEndAttr(); } + virtual void OnSmallStart() wxOVERRIDE { DoChangeFont(&wxFont::Smaller); } + virtual void OnSmallEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnTeletypeStart() + virtual void OnTeletypeStart() wxOVERRIDE { wxFont font(GetFont()); font.SetFamily(wxFONTFAMILY_TELETYPE); DoSetFont(font); } - virtual void OnTeletypeEnd() { DoEndAttr(); } + virtual void OnTeletypeEnd() wxOVERRIDE { DoEndAttr(); } - virtual void OnSpanStart(const wxMarkupSpanAttributes& spanAttr) + virtual void OnSpanStart(const wxMarkupSpanAttributes& spanAttr) wxOVERRIDE { wxFont font(GetFont()); if ( !spanAttr.m_fontFace.empty() ) @@ -147,7 +147,7 @@ public: m_attrs.push(attr); } - virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(spanAttr)) + virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(spanAttr)) wxOVERRIDE { DoEndAttr(); } diff --git a/Externals/wxWidgets3/include/wx/private/notifmsg.h b/Externals/wxWidgets3/include/wx/private/notifmsg.h new file mode 100644 index 0000000000..3f02a29e72 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/private/notifmsg.h @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/private/notifmsg.h +// Purpose: wxNotificationMessage declarations +// Author: Tobias Taschner +// Created: 2015-08-04 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_NOTIFMSG_H_ +#define _WX_PRIVATE_NOTIFMSG_H_ + +class wxNotificationMessageImpl +{ +public: + wxNotificationMessageImpl(wxNotificationMessageBase* notification): + m_notification(notification), + m_active(false) + { + + } + + virtual ~wxNotificationMessageImpl() { } + + virtual bool Show(int timeout) = 0; + + virtual bool Close() = 0; + + virtual void SetTitle(const wxString& title) = 0; + + virtual void SetMessage(const wxString& message) = 0; + + virtual void SetParent(wxWindow *parent) = 0; + + virtual void SetFlags(int flags) = 0; + + virtual void SetIcon(const wxIcon& icon) = 0; + + virtual bool AddAction(wxWindowID actionid, const wxString &label) = 0; + + virtual void Detach() + { + if (m_active) + m_notification = NULL; + else + delete this; + } + + bool ProcessNotificationEvent(wxEvent& event) + { + if (m_notification) + return m_notification->ProcessEvent(event); + else + return false; + } + + wxNotificationMessageBase* GetNotification() const + { + return m_notification; + } + +protected: + wxNotificationMessageBase* m_notification; + bool m_active; + + void SetActive(bool active) + { + m_active = active; + + // Delete the implementation if the notification is detached + if (!m_notification && !active) + delete this; + } +}; + +#endif // _WX_PRIVATE_NOTIFMSG_H_ diff --git a/Externals/wxWidgets3/include/wx/private/pipestream.h b/Externals/wxWidgets3/include/wx/private/pipestream.h index f14d9aba79..d4020b3e6d 100644 --- a/Externals/wxWidgets3/include/wx/private/pipestream.h +++ b/Externals/wxWidgets3/include/wx/private/pipestream.h @@ -20,9 +20,9 @@ // IsOpened() method. // // wxPipeOutputStream is similar but has no additional methods at all. -#ifdef __UNIX__ +#if defined(__UNIX__) && !defined(__WINDOWS__) #include "wx/unix/private/pipestream.h" -#elif defined(__WINDOWS__) && !defined(__WXWINCE__) +#elif defined(__WINDOWS__) #include "wx/msw/private/pipestream.h" #endif diff --git a/Externals/wxWidgets3/include/wx/private/sckaddr.h b/Externals/wxWidgets3/include/wx/private/sckaddr.h index ba2063ed9e..376812d6d7 100644 --- a/Externals/wxWidgets3/include/wx/private/sckaddr.h +++ b/Externals/wxWidgets3/include/wx/private/sckaddr.h @@ -50,11 +50,7 @@ union wxSockAddressStorage // ---------------------------------------------------------------------------- // helper class mapping sockaddr_xxx types to corresponding AF_XXX values -// -// FIXME-VC6: we could leave the template undefined if not for VC6 which -// absolutely does need to have a generic version defining the -// template "interface" to compile the code below -template struct AddressFamily { enum { value = AF_UNSPEC }; }; +template struct AddressFamily; template <> struct AddressFamily { enum { value = AF_INET }; }; @@ -249,11 +245,8 @@ private: m_len = len; } - // FIXME-VC6: VC6 doesn't grok Foo() call syntax so we need the extra - // dummy parameter of type T, use the macros in sckaddr.cpp to - // hide it template - T *Alloc(T *) + T *Alloc() { DoAlloc(sizeof(T)); @@ -261,7 +254,7 @@ private: } template - T *Get(T *) const + T *Get() const { wxCHECK_MSG( static_cast(m_family) == AddressFamily::value, NULL, diff --git a/Externals/wxWidgets3/include/wx/private/selectdispatcher.h b/Externals/wxWidgets3/include/wx/private/selectdispatcher.h index 644377739f..ba7a59a53a 100644 --- a/Externals/wxWidgets3/include/wx/private/selectdispatcher.h +++ b/Externals/wxWidgets3/include/wx/private/selectdispatcher.h @@ -14,19 +14,14 @@ #if wxUSE_SELECT_DISPATCHER -#if defined(HAVE_SYS_SELECT_H) || defined(__WATCOMC__) +#if defined(HAVE_SYS_SELECT_H) #include #include #endif -#ifdef __WATCOMC__ - #include - #include - #include -#else - #include -#endif +#include +#include "wx/thread.h" #include "wx/private/fdiodispatcher.h" // helper class storing all the select() fd sets @@ -91,11 +86,11 @@ public: wxSelectDispatcher() { m_maxFD = -1; } // implement pure virtual methods of the base class - virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL); - virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL); - virtual bool UnregisterFD(int fd); - virtual bool HasPending() const; - virtual int Dispatch(int timeout = TIMEOUT_INFINITE); + virtual bool RegisterFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool ModifyFD(int fd, wxFDIOHandler *handler, int flags = wxFDIO_ALL) wxOVERRIDE; + virtual bool UnregisterFD(int fd) wxOVERRIDE; + virtual bool HasPending() const wxOVERRIDE; + virtual int Dispatch(int timeout = TIMEOUT_INFINITE) wxOVERRIDE; private: // common part of RegisterFD() and ModifyFD() @@ -114,6 +109,10 @@ private: int DoSelect(wxSelectSets& sets, int timeout) const; +#if wxUSE_THREADS + wxCriticalSection m_cs; +#endif // wxUSE_THREADS + // the select sets containing all the registered fds wxSelectSets m_sets; diff --git a/Externals/wxWidgets3/include/wx/private/socket.h b/Externals/wxWidgets3/include/wx/private/socket.h index 973b764f7d..906c20c659 100644 --- a/Externals/wxWidgets3/include/wx/private/socket.h +++ b/Externals/wxWidgets3/include/wx/private/socket.h @@ -50,14 +50,10 @@ having been defined in sys/types.h" when winsock.h is included later and doesn't seem to be necessary anyhow. It's not needed under Mac neither. */ -#if !defined(__WXMAC__) && !defined(__WXMSW__) && !defined(__WXWINCE__) +#if !defined(__WXMAC__) && !defined(__WXMSW__) #include #endif -#ifdef __WXWINCE__ -#include -#endif - // 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 __WINDOWS__ @@ -308,6 +304,9 @@ public: protected: wxSocketImpl(wxSocketBase& wxsocket); + // get the associated socket flags + wxSocketFlags GetSocketFlags() const { return m_wxsocket->GetFlags(); } + // true if we're a listening stream socket bool m_server; diff --git a/Externals/wxWidgets3/include/wx/private/textmeasure.h b/Externals/wxWidgets3/include/wx/private/textmeasure.h index a4db67cb50..db96dcd38f 100644 --- a/Externals/wxWidgets3/include/wx/private/textmeasure.h +++ b/Externals/wxWidgets3/include/wx/private/textmeasure.h @@ -62,18 +62,6 @@ public: double scaleX); - // These functions are called by our public methods before and after each - // call to DoGetTextExtent(). Derived classes may override them to prepare - // for -- possibly several -- subsequent calls to DoGetTextExtent(). - // - // As these calls must be always paired, they're never called directly but - // only by our friend MeasuringGuard class. - // - // NB: They're public only to allow VC6 to compile this code, there doesn't - // seem to be any way to give MeasuringGuard access to them (FIXME-VC6) - virtual void BeginMeasuring() { } - virtual void EndMeasuring() { } - // This is another method which is only used by MeasuringGuard. bool IsUsingDCImpl() const { return m_useDCImpl; } @@ -101,6 +89,16 @@ protected: }; + // These functions are called by our public methods before and after each + // call to DoGetTextExtent(). Derived classes may override them to prepare + // for -- possibly several -- subsequent calls to DoGetTextExtent(). + // + // As these calls must be always paired, they're never called directly but + // only by our friend MeasuringGuard class. + virtual void BeginMeasuring() { } + virtual void EndMeasuring() { } + + // The main function of this class, to be implemented in platform-specific // way used by all our public methods. // diff --git a/Externals/wxWidgets3/include/wx/private/wxprintf.h b/Externals/wxWidgets3/include/wx/private/wxprintf.h index 00013c193a..e16b9f4e40 100644 --- a/Externals/wxWidgets3/include/wx/private/wxprintf.h +++ b/Externals/wxWidgets3/include/wx/private/wxprintf.h @@ -838,7 +838,7 @@ struct wxPrintfConvSpecParser for ( unsigned n = 0; n < numAsterisks; n++ ) { - if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) + if ( ++nargs == wxMAX_SVNPRINTF_ARGUMENTS ) break; // TODO: we need to support specifiers of the form "%2$*1$s" @@ -870,6 +870,11 @@ struct wxPrintfConvSpecParser spec = &specs[nargs]; } + + // If we hit the maximal number of arguments inside the inner + // loop, break out of the outer one as well. + if ( nargs == wxMAX_SVNPRINTF_ARGUMENTS ) + break; } @@ -890,7 +895,7 @@ struct wxPrintfConvSpecParser // this conversion specifier is tied to the pos-th argument... pspec[spec->m_pos] = spec; - if ( nargs++ == wxMAX_SVNPRINTF_ARGUMENTS ) + if ( ++nargs == wxMAX_SVNPRINTF_ARGUMENTS ) break; } diff --git a/Externals/wxWidgets3/include/wx/prntbase.h b/Externals/wxWidgets3/include/wx/prntbase.h index a6f22fa098..18987fffb3 100644 --- a/Externals/wxWidgets3/include/wx/prntbase.h +++ b/Externals/wxWidgets3/include/wx/prntbase.h @@ -122,34 +122,34 @@ private: class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory { public: - virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); + virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) wxOVERRIDE; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout = NULL, - wxPrintDialogData *data = NULL ); + wxPrintDialogData *data = NULL ) wxOVERRIDE; virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, wxPrintout *printout, - wxPrintData *data ); + wxPrintData *data ) wxOVERRIDE; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintDialogData *data = NULL ); + wxPrintDialogData *data = NULL ) wxOVERRIDE; virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, - wxPrintData *data ); + wxPrintData *data ) wxOVERRIDE; virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent, - wxPageSetupDialogData * data = NULL ); + wxPageSetupDialogData * data = NULL ) wxOVERRIDE; - virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ); + virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) wxOVERRIDE; - virtual bool HasPrintSetupDialog(); - virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); - virtual bool HasOwnPrintToFile(); - virtual bool HasPrinterLine(); - virtual wxString CreatePrinterLine(); - virtual bool HasStatusLine(); - virtual wxString CreateStatusLine(); + virtual bool HasPrintSetupDialog() wxOVERRIDE; + virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) wxOVERRIDE; + virtual bool HasOwnPrintToFile() wxOVERRIDE; + virtual bool HasPrinterLine() wxOVERRIDE; + virtual wxString CreatePrinterLine() wxOVERRIDE; + virtual bool HasStatusLine() wxOVERRIDE; + virtual wxString CreateStatusLine() wxOVERRIDE; - virtual wxPrintNativeDataBase *CreatePrintNativeData(); + virtual wxPrintNativeDataBase *CreatePrintNativeData() wxOVERRIDE; }; //---------------------------------------------------------------------------- @@ -164,14 +164,18 @@ public: virtual bool TransferTo( wxPrintData &data ) = 0; virtual bool TransferFrom( const wxPrintData &data ) = 0; - +#ifdef __WXOSX__ + // in order to expose functionality already to the result type of the ..PrintData->GetNativeData() + virtual void TransferFrom( const wxPageSetupDialogData * ) = 0; + virtual void TransferTo( wxPageSetupDialogData * ) = 0; +#endif virtual bool Ok() const { return IsOk(); } virtual bool IsOk() const = 0; int m_ref; private: - DECLARE_CLASS(wxPrintNativeDataBase) + wxDECLARE_CLASS(wxPrintNativeDataBase); wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase); }; @@ -215,7 +219,7 @@ public: static bool sm_abortIt; private: - DECLARE_CLASS(wxPrinterBase) + wxDECLARE_CLASS(wxPrinterBase); wxDECLARE_NO_COPY_CLASS(wxPrinterBase); }; @@ -229,20 +233,20 @@ public: wxPrinter(wxPrintDialogData *data = NULL); virtual ~wxPrinter(); - virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); - virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); + virtual wxPrintAbortDialog *CreateAbortWindow(wxWindow *parent, wxPrintout *printout) wxOVERRIDE; + virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message) wxOVERRIDE; - virtual bool Setup(wxWindow *parent); - virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); - virtual wxDC* PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent) wxOVERRIDE; + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) wxOVERRIDE; + virtual wxDC* PrintDialog(wxWindow *parent) wxOVERRIDE; - virtual wxPrintDialogData& GetPrintDialogData() const; + virtual wxPrintDialogData& GetPrintDialogData() const wxOVERRIDE; protected: wxPrinterBase *m_pimpl; private: - DECLARE_CLASS(wxPrinter) + wxDECLARE_CLASS(wxPrinter); wxDECLARE_NO_COPY_CLASS(wxPrinter); }; @@ -336,7 +340,7 @@ private: wxRect m_paperRectPixels; private: - DECLARE_ABSTRACT_CLASS(wxPrintout) + wxDECLARE_ABSTRACT_CLASS(wxPrintout); wxDECLARE_NO_COPY_CLASS(wxPrintout); }; @@ -374,8 +378,8 @@ private: wxPrintPreviewBase* m_printPreview; - DECLARE_CLASS(wxPreviewCanvas) - DECLARE_EVENT_TABLE() + wxDECLARE_CLASS(wxPreviewCanvas); + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas); }; @@ -436,8 +440,8 @@ protected: private: void OnChar(wxKeyEvent& event); - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxPreviewFrame) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_CLASS(wxPreviewFrame); wxDECLARE_NO_COPY_CLASS(wxPreviewFrame); }; @@ -476,7 +480,7 @@ private: class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel { - DECLARE_CLASS(wxPreviewControlBar) + wxDECLARE_CLASS(wxPreviewControlBar); public: wxPreviewControlBar(wxPrintPreviewBase *preview, @@ -554,7 +558,7 @@ private: void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); } void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); } - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar); }; @@ -670,7 +674,7 @@ private: void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase); - DECLARE_CLASS(wxPrintPreviewBase) + wxDECLARE_CLASS(wxPrintPreviewBase); }; //---------------------------------------------------------------------------- @@ -688,41 +692,41 @@ public: wxPrintData *data); virtual ~wxPrintPreview(); - virtual bool SetCurrentPage(int pageNum); - virtual int GetCurrentPage() const; - virtual void SetPrintout(wxPrintout *printout); - virtual wxPrintout *GetPrintout() const; - virtual wxPrintout *GetPrintoutForPrinting() const; - virtual void SetFrame(wxFrame *frame); - virtual void SetCanvas(wxPreviewCanvas *canvas); + virtual bool SetCurrentPage(int pageNum) wxOVERRIDE; + virtual int GetCurrentPage() const wxOVERRIDE; + virtual void SetPrintout(wxPrintout *printout) wxOVERRIDE; + virtual wxPrintout *GetPrintout() const wxOVERRIDE; + virtual wxPrintout *GetPrintoutForPrinting() const wxOVERRIDE; + virtual void SetFrame(wxFrame *frame) wxOVERRIDE; + virtual void SetCanvas(wxPreviewCanvas *canvas) wxOVERRIDE; - virtual wxFrame *GetFrame() const; - virtual wxPreviewCanvas *GetCanvas() const; - virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual bool UpdatePageRendering(); - virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); - virtual void AdjustScrollbars(wxPreviewCanvas *canvas); - virtual bool RenderPage(int pageNum); - virtual void SetZoom(int percent); - virtual int GetZoom() const; + virtual wxFrame *GetFrame() const wxOVERRIDE; + virtual wxPreviewCanvas *GetCanvas() const wxOVERRIDE; + virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc) wxOVERRIDE; + virtual bool UpdatePageRendering() wxOVERRIDE; + virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc) wxOVERRIDE; + virtual void AdjustScrollbars(wxPreviewCanvas *canvas) wxOVERRIDE; + virtual bool RenderPage(int pageNum) wxOVERRIDE; + virtual void SetZoom(int percent) wxOVERRIDE; + virtual int GetZoom() const wxOVERRIDE; - virtual bool Print(bool interactive); - virtual void DetermineScaling(); + virtual bool Print(bool interactive) wxOVERRIDE; + virtual void DetermineScaling() wxOVERRIDE; - virtual wxPrintDialogData& GetPrintDialogData(); + virtual wxPrintDialogData& GetPrintDialogData() wxOVERRIDE; - virtual int GetMaxPage() const; - virtual int GetMinPage() const; + virtual int GetMaxPage() const wxOVERRIDE; + virtual int GetMinPage() const wxOVERRIDE; - virtual bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - virtual void SetOk(bool ok); + virtual bool Ok() const wxOVERRIDE { return IsOk(); } + virtual bool IsOk() const wxOVERRIDE; + virtual void SetOk(bool ok) wxOVERRIDE; private: wxPrintPreviewBase *m_pimpl; private: - DECLARE_CLASS(wxPrintPreview) + wxDECLARE_CLASS(wxPrintPreview); wxDECLARE_NO_COPY_CLASS(wxPrintPreview); }; @@ -748,7 +752,7 @@ public: private: wxStaticText *m_progress; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog); }; diff --git a/Externals/wxWidgets3/include/wx/process.h b/Externals/wxWidgets3/include/wx/process.h index 4c0018e6a6..733275d99a 100644 --- a/Externals/wxWidgets3/include/wx/process.h +++ b/Externals/wxWidgets3/include/wx/process.h @@ -77,6 +77,12 @@ public: // before the process it started terminates void Detach(); + // Activates a GUI process by bringing its (main) window to the front. + // + // Currently only implemented in wxMSW, simply returns false under the + // other platforms. + bool Activate() const; + #if wxUSE_STREAMS // Pipe handling wxInputStream *GetInputStream() const { return m_inputStream; } @@ -137,7 +143,7 @@ protected: bool m_redirect; - DECLARE_DYNAMIC_CLASS(wxProcess) + wxDECLARE_DYNAMIC_CLASS(wxProcess); wxDECLARE_NO_COPY_CLASS(wxProcess); }; @@ -167,13 +173,13 @@ public: int GetExitCode() { return m_exitcode; } // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxProcessEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxProcessEvent(*this); } public: int m_pid, m_exitcode; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxProcessEvent); }; typedef void (wxEvtHandler::*wxProcessEventFunction)(wxProcessEvent&); diff --git a/Externals/wxWidgets3/include/wx/progdlg.h b/Externals/wxWidgets3/include/wx/progdlg.h index e17d37ea3e..087c75a3d1 100644 --- a/Externals/wxWidgets3/include/wx/progdlg.h +++ b/Externals/wxWidgets3/include/wx/progdlg.h @@ -30,9 +30,17 @@ #include "wx/generic/progdlgg.h" -#if defined(__WXMSW__) && wxUSE_THREADS && !defined(__WXUNIVERSAL__) - #include "wx/msw/progdlg.h" -#else +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + // The native implementation requires the use of threads and still has some + // problems, so it can be explicitly disabled. + #if wxUSE_THREADS && wxUSE_NATIVE_PROGRESSDLG + #define wxHAS_NATIVE_PROGRESSDIALOG + #include "wx/msw/progdlg.h" + #endif +#endif + +// If there is no native one, just use the generic version. +#ifndef wxHAS_NATIVE_PROGRESSDIALOG class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog { @@ -48,7 +56,7 @@ private: wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxProgressDialog ); }; -#endif // defined(__WXMSW__) && wxUSE_THREADS +#endif // !wxHAS_NATIVE_PROGRESSDIALOG #endif // wxUSE_PROGRESSDLG diff --git a/Externals/wxWidgets3/include/wx/protocol/file.h b/Externals/wxWidgets3/include/wx/protocol/file.h index fd44ce593a..4654728403 100644 --- a/Externals/wxWidgets3/include/wx/protocol/file.h +++ b/Externals/wxWidgets3/include/wx/protocol/file.h @@ -23,13 +23,13 @@ public: wxFileProto(); virtual ~wxFileProto(); - bool Abort() { return true; } - wxString GetContentType() const { return wxEmptyString; } + bool Abort() wxOVERRIDE { return true; } + wxString GetContentType() const wxOVERRIDE { return wxEmptyString; } - wxInputStream *GetInputStream(const wxString& path); + wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFileProto); DECLARE_PROTOCOL(wxFileProto) }; diff --git a/Externals/wxWidgets3/include/wx/protocol/ftp.h b/Externals/wxWidgets3/include/wx/protocol/ftp.h index a87a638066..426b6c9914 100644 --- a/Externals/wxWidgets3/include/wx/protocol/ftp.h +++ b/Externals/wxWidgets3/include/wx/protocol/ftp.h @@ -34,12 +34,12 @@ public: virtual ~wxFTP(); // Connecting and disconnecting - virtual bool Connect(const wxSockAddress& addr, bool wait = true); - virtual bool Connect(const wxString& host) { return Connect(host, 0); } + virtual bool Connect(const wxSockAddress& addr, bool wait = true) wxOVERRIDE; + virtual bool Connect(const wxString& host) wxOVERRIDE { return Connect(host, 0); } virtual bool Connect(const wxString& host, unsigned short port); // disconnect - virtual bool Close(); + virtual bool Close() wxOVERRIDE; // Parameters set up @@ -52,7 +52,7 @@ public: // Generic FTP interface // FTP doesn't know the MIME type of the last downloaded/uploaded file - virtual wxString GetContentType() const { return wxEmptyString; } + virtual wxString GetContentType() const wxOVERRIDE { return wxEmptyString; } // the last FTP server reply const wxString& GetLastResult() const { return m_lastResult; } @@ -87,9 +87,9 @@ public: bool FileExists(const wxString& fileName); // Download methods - bool Abort(); + bool Abort() wxOVERRIDE; - virtual wxInputStream *GetInputStream(const wxString& path); + virtual wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; virtual wxOutputStream *GetOutputStream(const wxString& path); // Directory listing @@ -163,7 +163,7 @@ protected: friend class wxInputFTPStream; friend class wxOutputFTPStream; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxFTP); DECLARE_PROTOCOL(wxFTP) }; diff --git a/Externals/wxWidgets3/include/wx/protocol/http.h b/Externals/wxWidgets3/include/wx/protocol/http.h index cfa2e6f944..90e044862a 100644 --- a/Externals/wxWidgets3/include/wx/protocol/http.h +++ b/Externals/wxWidgets3/include/wx/protocol/http.h @@ -25,13 +25,13 @@ public: virtual ~wxHTTP(); virtual bool Connect(const wxString& host, unsigned short port); - virtual bool Connect(const wxString& host) { return Connect(host, 0); } - virtual bool Connect(const wxSockAddress& addr, bool wait); - bool Abort(); + virtual bool Connect(const wxString& host) wxOVERRIDE { return Connect(host, 0); } + virtual bool Connect(const wxSockAddress& addr, bool wait = true) wxOVERRIDE; + bool Abort() wxOVERRIDE; - wxInputStream *GetInputStream(const wxString& path); + wxInputStream *GetInputStream(const wxString& path) wxOVERRIDE; - wxString GetContentType() const; + wxString GetContentType() const wxOVERRIDE; wxString GetHeader(const wxString& header) const; int GetResponse() const { return m_http_response; } @@ -85,7 +85,7 @@ protected: wxString m_contentType; int m_http_response; - DECLARE_DYNAMIC_CLASS(wxHTTP) + wxDECLARE_DYNAMIC_CLASS(wxHTTP); DECLARE_PROTOCOL(wxHTTP) wxDECLARE_NO_COPY_CLASS(wxHTTP); }; diff --git a/Externals/wxWidgets3/include/wx/protocol/protocol.h b/Externals/wxWidgets3/include/wx/protocol/protocol.h index e6a32ef55c..24f3dd7798 100644 --- a/Externals/wxWidgets3/include/wx/protocol/protocol.h +++ b/Externals/wxWidgets3/include/wx/protocol/protocol.h @@ -29,7 +29,7 @@ class WXDLLIMPEXP_FWD_NET wxProtocolLog; // constants // ---------------------------------------------------------------------------- -typedef enum +enum wxProtocolError { wxPROTO_NOERR = 0, wxPROTO_NETERR, @@ -41,7 +41,7 @@ typedef enum wxPROTO_ABRT, wxPROTO_RCNCT, wxPROTO_STREAMING -} wxProtocolError; +}; // ---------------------------------------------------------------------------- // wxProtocol: abstract base class for all protocols @@ -61,7 +61,7 @@ public: #if wxUSE_SOCKETS bool Reconnect(); virtual bool Connect( const wxString& WXUNUSED(host) ) { return false; } - virtual bool Connect( const wxSockAddress& addr, bool WXUNUSED(wait) = true) + virtual bool Connect( const wxSockAddress& addr, bool WXUNUSED(wait) = true) wxOVERRIDE { return wxSocketClient::Connect(addr); } // read a '\r\n' terminated line from the given socket and put it in @@ -87,7 +87,7 @@ public: // override wxSocketBase::SetTimeout function to avoid that the internal // m_uiDefaultTimeout goes out-of-sync: - virtual void SetTimeout(long seconds) + virtual void SetTimeout(long seconds) wxOVERRIDE { SetDefaultTimeout(seconds); } @@ -128,7 +128,7 @@ protected: private: wxProtocolLog *m_log; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProtocol); }; // ---------------------------------------------------------------------------- @@ -168,7 +168,7 @@ protected: friend class wxURL; - DECLARE_DYNAMIC_CLASS(wxProtoInfo) + wxDECLARE_DYNAMIC_CLASS(wxProtoInfo); wxDECLARE_NO_COPY_CLASS(wxProtoInfo); }; diff --git a/Externals/wxWidgets3/include/wx/quantize.h b/Externals/wxWidgets3/include/wx/quantize.h index d323a3504c..366194f1f3 100644 --- a/Externals/wxWidgets3/include/wx/quantize.h +++ b/Externals/wxWidgets3/include/wx/quantize.h @@ -36,7 +36,7 @@ class WXDLLIMPEXP_FWD_CORE wxPalette; class WXDLLIMPEXP_CORE wxQuantize: public wxObject { public: -DECLARE_DYNAMIC_CLASS(wxQuantize) + wxDECLARE_DYNAMIC_CLASS(wxQuantize); //// Constructor diff --git a/Externals/wxWidgets3/include/wx/radiobox.h b/Externals/wxWidgets3/include/wx/radiobox.h index acfa9e8f8a..ab9c22a681 100644 --- a/Externals/wxWidgets3/include/wx/radiobox.h +++ b/Externals/wxWidgets3/include/wx/radiobox.h @@ -163,10 +163,8 @@ private: #include "wx/gtk1/radiobox.h" #elif defined(__WXMAC__) #include "wx/osx/radiobox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobox.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobox.h" +#elif defined(__WXQT__) + #include "wx/qt/radiobox.h" #endif #endif // wxUSE_RADIOBOX diff --git a/Externals/wxWidgets3/include/wx/radiobut.h b/Externals/wxWidgets3/include/wx/radiobut.h index 427787341e..11f466cdbe 100644 --- a/Externals/wxWidgets3/include/wx/radiobut.h +++ b/Externals/wxWidgets3/include/wx/radiobut.h @@ -46,10 +46,8 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxRadioButtonNameStr[]; #include "wx/gtk1/radiobut.h" #elif defined(__WXMAC__) #include "wx/osx/radiobut.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/radiobut.h" -#elif defined(__WXPM__) - #include "wx/os2/radiobut.h" +#elif defined(__WXQT__) + #include "wx/qt/radiobut.h" #endif #endif // wxUSE_RADIOBTN diff --git a/Externals/wxWidgets3/include/wx/rawbmp.h b/Externals/wxWidgets3/include/wx/rawbmp.h index adcf81f398..12eb283723 100644 --- a/Externals/wxWidgets3/include/wx/rawbmp.h +++ b/Externals/wxWidgets3/include/wx/rawbmp.h @@ -121,14 +121,11 @@ struct wxPixelFormat // the type which may hold the entire pixel value typedef Pixel PixelType; - // NB: using static ints initialized inside the class declaration is not - // portable as it doesn't work with VC++ 6, so we must use enums - // size of one pixel in bits - enum { BitsPerPixel = Bpp }; + static const int BitsPerPixel = Bpp; // size of one pixel in ChannelType units (usually bytes) - enum { SizePixel = Bpp / (8 * sizeof(Channel)) }; + static const int SizePixel = Bpp / (8 * sizeof(Channel)); // the channels indices inside the pixel enum @@ -162,25 +159,19 @@ typedef wxPixelFormat wxImagePixelFormat; typedef wxPixelFormat wxNativePixelFormat; #define wxPIXEL_FORMAT_ALPHA 0 -#elif defined(__WXCOCOA__) - // Cocoa is standard RGB or RGBA (normally it is RGBA) - typedef wxPixelFormat wxNativePixelFormat; - - #define wxPIXEL_FORMAT_ALPHA 3 #elif defined(__WXGTK__) // 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 typedef wxPixelFormat wxNativePixelFormat; + #define wxPIXEL_FORMAT_ALPHA 3 +#elif defined(__WXQT__) + typedef wxPixelFormat wxNativePixelFormat; + #define wxPIXEL_FORMAT_ALPHA 3 #endif @@ -271,10 +262,10 @@ protected: into the CPU registers by the compiler any more. Implementation note: we use the standard workaround for lack of partial - template specialization support in VC (both 6 and 7): instead of partly - specializing the class Foo for some T we introduce FooOut and - FooIn nested in it, make Foo equivalent to FooOut::FooIn and - fully specialize FooOut. + template specialization support in VC7: instead of partly specializing the + class Foo for some T we introduce FooOut and FooIn nested in + it, make Foo equivalent to FooOut::FooIn and fully specialize + FooOut (FIXME-VC7). Also note that this class doesn't have any default definition because we can't really do anything without knowing the exact image class. We do @@ -381,7 +372,7 @@ struct wxPixelDataOut { m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; if ( m_pAlpha ) - m_pAlpha += data.GetWidth() + x; + m_pAlpha += data.GetWidth()*y + x; } // move x pixels to the right (again, no row wrapping) @@ -397,7 +388,7 @@ struct wxPixelDataOut { m_pRGB += data.GetRowStride()*y; if ( m_pAlpha ) - m_pAlpha += data.GetWidth(); + m_pAlpha += data.GetWidth()*y; } // go to the given position @@ -693,18 +684,8 @@ struct wxPixelDataOut #endif //wxUSE_GUI -// FIXME-VC6: VC6 doesn't like typename in default template parameters while -// it is necessary with standard-conforming compilers, remove this -// #define and just use typename when we drop VC6 support -#if defined(__VISUALC__) && !wxCHECK_VISUALC_VERSION(7) - #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM -#else - #define wxTYPENAME_IN_TEMPLATE_DEFAULT_PARAM typename -#endif - template ::Format > + class PixelFormat = typename wxPixelFormatFor::Format > class wxPixelData : public wxPixelDataOut::template wxPixelDataIn { @@ -747,7 +728,7 @@ typedef wxPixelData wxAlphaPixelData; Note that although it would have been much more intuitive to have a real class here instead of what we have now, this class would need two template parameters, and this can't be done because we'd need compiler support for - partial template specialization then and neither VC6 nor VC7 provide it. + partial template specialization then and VC7 doesn't provide it. */ template < class Image, class PixelFormat = wxPixelFormatFor > struct wxPixelIterator : public wxPixelData::Iterator diff --git a/Externals/wxWidgets3/include/wx/rearrangectrl.h b/Externals/wxWidgets3/include/wx/rearrangectrl.h index b54b04fa11..f9d7c324fe 100644 --- a/Externals/wxWidgets3/include/wx/rearrangectrl.h +++ b/Externals/wxWidgets3/include/wx/rearrangectrl.h @@ -95,6 +95,10 @@ public: bool MoveCurrentUp(); bool MoveCurrentDown(); + + // Override this to keep our m_order array in sync with the real item state. + virtual void Check(unsigned int item, bool check = true) wxOVERRIDE; + private: // swap two items at the given positions in the listbox void Swap(int pos1, int pos2); @@ -107,7 +111,7 @@ private: wxArrayInt m_order; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxRearrangeList); }; @@ -164,7 +168,7 @@ private: wxRearrangeList *m_list; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxRearrangeCtrl); }; diff --git a/Externals/wxWidgets3/include/wx/region.h b/Externals/wxWidgets3/include/wx/region.h index 64a8e05532..1ee8fcb1f4 100644 --- a/Externals/wxWidgets3/include/wx/region.h +++ b/Externals/wxWidgets3/include/wx/region.h @@ -181,8 +181,7 @@ protected: // implement individual wxRegion operations, factor out the common code for the // ports with Combine() in this class #if defined(__WXMSW__) || \ - ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || \ - defined(__WXPM__) + ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) #define wxHAS_REGION_COMBINE @@ -223,10 +222,8 @@ protected: #include "wx/dfb/region.h" #elif defined(__WXMAC__) #include "wx/osx/region.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/region.h" -#elif defined(__WXPM__) - #include "wx/os2/region.h" +#elif defined(__WXQT__) + #include "wx/qt/region.h" #endif // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/renderer.h b/Externals/wxWidgets3/include/wx/renderer.h index 97152e32e3..627c142e12 100644 --- a/Externals/wxWidgets3/include/wx/renderer.h +++ b/Externals/wxWidgets3/include/wx/renderer.h @@ -52,6 +52,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindow; // control state flags used in wxRenderer and wxColourScheme enum { + wxCONTROL_NONE = 0x00000000, // absence of any other flags wxCONTROL_DISABLED = 0x00000001, // control is disabled wxCONTROL_FOCUSED = 0x00000002, // currently has keyboard focus wxCONTROL_PRESSED = 0x00000004, // (button) is pressed @@ -61,6 +62,7 @@ enum wxCONTROL_EXPANDED = wxCONTROL_SPECIAL, // only for the tree items wxCONTROL_SIZEGRIP = wxCONTROL_SPECIAL, // only for the status bar panes wxCONTROL_FLAT = wxCONTROL_SPECIAL, // checkboxes only: flat border + wxCONTROL_CELL = wxCONTROL_SPECIAL, // only for item selection rect wxCONTROL_CURRENT = 0x00000010, // mouse is currently over the control wxCONTROL_SELECTED = 0x00000020, // selected item in e.g. listbox wxCONTROL_CHECKED = 0x00000040, // (check/radio button) is checked @@ -259,6 +261,17 @@ public: const wxRect& rect, int flags = 0) = 0; + // draw collapse button + // + // flags may use wxCONTROL_CHECKED, wxCONTROL_UNDETERMINED and wxCONTROL_CURRENT + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) = 0; + + // Returns the default size of a collapse button + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) = 0; + // draw rectangle indicating that an item in e.g. a list control // has been selected or focused // @@ -320,6 +333,22 @@ public: int flags = 0) = 0; #endif // wxHAS_DRAW_TITLE_BAR_BITMAP + // Draw a gauge with native style like a wxGauge would display + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0) = 0; + + // Draw text using the appropriate color for normal and selected states. + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) = 0; // geometry functions // ------------------ @@ -454,6 +483,15 @@ public: int flags = 0) { m_rendererNative.DrawPushButton( win, dc, rect, flags ); } + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) + { m_rendererNative.DrawCollapseButton(win, dc, rect, flags); } + + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) + { return m_rendererNative.GetCollapseButtonSize(win, dc); } + virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, @@ -499,6 +537,23 @@ public: { m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); } #endif // wxHAS_DRAW_TITLE_BAR_BITMAP + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0) + { m_rendererNative.DrawGauge(win, dc, rect, value, max, flags); } + + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) + { m_rendererNative.DrawItemText(win, dc, text, rect, align, flags, ellipsizeMode); } + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) { return m_rendererNative.GetSplitterParams(win); } diff --git a/Externals/wxWidgets3/include/wx/richmsgdlg.h b/Externals/wxWidgets3/include/wx/richmsgdlg.h index 1fbc96428f..ab49af7d00 100644 --- a/Externals/wxWidgets3/include/wx/richmsgdlg.h +++ b/Externals/wxWidgets3/include/wx/richmsgdlg.h @@ -73,8 +73,8 @@ private: public: wxRichMessageDialog( wxWindow *parent, const wxString& message, - const wxString& caption, - long style ) + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK | wxCENTRE ) : wxGenericRichMessageDialog( parent, message, caption, style ) { } diff --git a/Externals/wxWidgets3/include/wx/rtti.h b/Externals/wxWidgets3/include/wx/rtti.h index 51017baa2f..308b65767b 100644 --- a/Externals/wxWidgets3/include/wx/rtti.h +++ b/Externals/wxWidgets3/include/wx/rtti.h @@ -128,7 +128,9 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); #define wxDECLARE_ABSTRACT_CLASS(name) \ public: \ static wxClassInfo ms_classInfo; \ - virtual wxClassInfo *GetClassInfo() const + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \ + virtual wxClassInfo *GetClassInfo() const \ + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) #define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ wxDECLARE_NO_ASSIGN_CLASS(name); \ diff --git a/Externals/wxWidgets3/include/wx/sckaddr.h b/Externals/wxWidgets3/include/wx/sckaddr.h index 4ceefdf35c..5a568c3adc 100644 --- a/Externals/wxWidgets3/include/wx/sckaddr.h +++ b/Externals/wxWidgets3/include/wx/sckaddr.h @@ -64,7 +64,7 @@ protected: private: void Init(); - DECLARE_ABSTRACT_CLASS(wxSockAddress) + wxDECLARE_ABSTRACT_CLASS(wxSockAddress); }; // An IP address (either IPv4 or IPv6) @@ -113,7 +113,7 @@ private: virtual void DoInitImpl() = 0; - DECLARE_ABSTRACT_CLASS(wxIPaddress) + wxDECLARE_ABSTRACT_CLASS(wxIPaddress); }; // An IPv4 address @@ -124,32 +124,28 @@ public: wxIPV4address(const wxIPV4address& other) : wxIPaddress(other) { } // implement wxSockAddress pure virtuals: - virtual Family Type() { return IPV4; } - virtual wxSockAddress *Clone() const { return new wxIPV4address(*this); } + virtual Family Type() wxOVERRIDE { return IPV4; } + virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); } // implement wxIPaddress pure virtuals: - virtual bool IsLocalHost() const; + virtual bool IsLocalHost() const wxOVERRIDE; - virtual wxString IPAddress() const; + virtual wxString IPAddress() const wxOVERRIDE; // IPv4-specific methods: bool Hostname(unsigned long addr); // make base class methods hidden by our overload visible - // - // FIXME-VC6: replace this with "using IPAddress::Hostname" (not supported - // by VC6) when support for it is dropped - wxString Hostname() const { return wxIPaddress::Hostname(); } - bool Hostname(const wxString& name) { return wxIPaddress::Hostname(name); } + using wxIPaddress::Hostname; bool BroadcastAddress(); private: - virtual void DoInitImpl(); + virtual void DoInitImpl() wxOVERRIDE; - DECLARE_DYNAMIC_CLASS(wxIPV4address) + wxDECLARE_DYNAMIC_CLASS(wxIPV4address); }; @@ -180,7 +176,7 @@ public: private: virtual void DoInitImpl(); - DECLARE_DYNAMIC_CLASS(wxIPV6address) + wxDECLARE_DYNAMIC_CLASS(wxIPV6address); }; #endif // wxUSE_IPV6 @@ -202,8 +198,8 @@ public: void Filename(const wxString& name); wxString Filename() const; - virtual Family Type() { return UNIX; } - virtual wxSockAddress *Clone() const { return new wxUNIXaddress(*this); } + virtual Family Type() wxOVERRIDE { return UNIX; } + virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxUNIXaddress(*this); } private: wxSockAddressImpl& GetUNIX(); @@ -212,7 +208,7 @@ private: return const_cast(this)->GetUNIX(); } - DECLARE_DYNAMIC_CLASS(wxUNIXaddress) + wxDECLARE_DYNAMIC_CLASS(wxUNIXaddress); }; #endif // wxHAS_UNIX_DOMAIN_SOCKETS diff --git a/Externals/wxWidgets3/include/wx/sckipc.h b/Externals/wxWidgets3/include/wx/sckipc.h index 3801da8cf9..7d1e2c32d0 100644 --- a/Externals/wxWidgets3/include/wx/sckipc.h +++ b/Externals/wxWidgets3/include/wx/sckipc.h @@ -68,10 +68,10 @@ public: // implement base class pure virtual methods virtual const void *Request(const wxString& item, size_t *size = NULL, - wxIPCFormat format = wxIPC_TEXT); - virtual bool StartAdvise(const wxString& item); - virtual bool StopAdvise(const wxString& item); - virtual bool Disconnect(void); + wxIPCFormat format = wxIPC_TEXT) wxOVERRIDE; + virtual bool StartAdvise(const wxString& item) wxOVERRIDE; + virtual bool StopAdvise(const wxString& item) wxOVERRIDE; + virtual bool Disconnect(void) wxOVERRIDE; // Will be used in the future to enable the compression but does nothing // for now. @@ -79,11 +79,11 @@ public: protected: - virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format); + virtual bool DoExecute(const void *data, size_t size, wxIPCFormat format) wxOVERRIDE; virtual bool DoPoke(const wxString& item, const void *data, size_t size, - wxIPCFormat format); + wxIPCFormat format) wxOVERRIDE; virtual bool DoAdvise(const wxString& item, const void *data, size_t size, - wxIPCFormat format); + wxIPCFormat format) wxOVERRIDE; // notice that all the members below are only initialized once the @@ -109,7 +109,7 @@ private: friend class wxTCPEventHandler; wxDECLARE_NO_COPY_CLASS(wxTCPConnection); - DECLARE_DYNAMIC_CLASS(wxTCPConnection) + wxDECLARE_DYNAMIC_CLASS(wxTCPConnection); }; class WXDLLIMPEXP_NET wxTCPServer : public wxServerBase @@ -119,9 +119,9 @@ public: virtual ~wxTCPServer(); // Returns false on error (e.g. port number is already in use) - virtual bool Create(const wxString& serverName); + virtual bool Create(const wxString& serverName) wxOVERRIDE; - virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); + virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) wxOVERRIDE; protected: wxSocketServer *m_server; @@ -132,7 +132,7 @@ protected: #endif // __UNIX_LIKE__ wxDECLARE_NO_COPY_CLASS(wxTCPServer); - DECLARE_DYNAMIC_CLASS(wxTCPServer) + wxDECLARE_DYNAMIC_CLASS(wxTCPServer); }; class WXDLLIMPEXP_NET wxTCPClient : public wxClientBase @@ -140,18 +140,18 @@ class WXDLLIMPEXP_NET wxTCPClient : public wxClientBase public: wxTCPClient(); - virtual bool ValidHost(const wxString& host); + virtual bool ValidHost(const wxString& host) wxOVERRIDE; // Call this to make a connection. Returns NULL if cannot. virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, - const wxString& topic); + const wxString& topic) wxOVERRIDE; // Callbacks to CLIENT - override at will - virtual wxConnectionBase *OnMakeConnection(); + virtual wxConnectionBase *OnMakeConnection() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxTCPClient) + wxDECLARE_DYNAMIC_CLASS(wxTCPClient); }; #endif // wxUSE_SOCKETS && wxUSE_IPC diff --git a/Externals/wxWidgets3/include/wx/sckstrm.h b/Externals/wxWidgets3/include/wx/sckstrm.h index 31f32706e9..f90a2feeec 100644 --- a/Externals/wxWidgets3/include/wx/sckstrm.h +++ b/Externals/wxWidgets3/include/wx/sckstrm.h @@ -25,12 +25,12 @@ public: protected: wxSocketBase *m_o_socket; - size_t OnSysWrite(const void *buffer, size_t bufsize); + size_t OnSysWrite(const void *buffer, size_t bufsize) wxOVERRIDE; // socket streams are both un-seekable and size-less streams: - wxFileOffset OnSysTell() const + wxFileOffset OnSysTell() const wxOVERRIDE { return wxInvalidOffset; } - wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) + wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) wxOVERRIDE { return wxInvalidOffset; } wxDECLARE_NO_COPY_CLASS(wxSocketOutputStream); @@ -45,13 +45,13 @@ public: protected: wxSocketBase *m_i_socket; - size_t OnSysRead(void *buffer, size_t bufsize); + size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE; // socket streams are both un-seekable and size-less streams: - wxFileOffset OnSysTell() const + wxFileOffset OnSysTell() const wxOVERRIDE { return wxInvalidOffset; } - wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) + wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) wxOVERRIDE { return wxInvalidOffset; } wxDECLARE_NO_COPY_CLASS(wxSocketInputStream); diff --git a/Externals/wxWidgets3/include/wx/scopedarray.h b/Externals/wxWidgets3/include/wx/scopedarray.h index e6246a235e..2f80911fa2 100644 --- a/Externals/wxWidgets3/include/wx/scopedarray.h +++ b/Externals/wxWidgets3/include/wx/scopedarray.h @@ -25,6 +25,7 @@ public: typedef T element_type; wxEXPLICIT wxScopedArray(T * array = NULL) : m_array(array) { } + wxEXPLICIT wxScopedArray(size_t count) : m_array(new T[count]) { } ~wxScopedArray() { delete [] m_array; } @@ -59,7 +60,7 @@ public: private: T *m_array; - DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T) + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedArray, T); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/scopedptr.h b/Externals/wxWidgets3/include/wx/scopedptr.h index 5cc0c0770d..9cc8f3968e 100644 --- a/Externals/wxWidgets3/include/wx/scopedptr.h +++ b/Externals/wxWidgets3/include/wx/scopedptr.h @@ -101,7 +101,7 @@ public: private: T * m_ptr; - DECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T) + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxScopedPtr, T); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/scopeguard.h b/Externals/wxWidgets3/include/wx/scopeguard.h index 83bc1b5180..6f6607dc26 100644 --- a/Externals/wxWidgets3/include/wx/scopeguard.h +++ b/Externals/wxWidgets3/include/wx/scopeguard.h @@ -26,30 +26,6 @@ // helpers // ---------------------------------------------------------------------------- -#ifdef __WATCOMC__ - -// WATCOM-FIXME: C++ of Open Watcom 1.3 doesn't like OnScopeExit() created -// through template so it must be workarounded with dedicated inlined macro. -// For compatibility with Watcom compilers wxPrivate::OnScopeExit must be -// replaced with wxPrivateOnScopeExit but in user code (for everyone who -// doesn't care about OW compatibility) wxPrivate::OnScopeExit still works. - -#define wxPrivateOnScopeExit(guard) \ - { \ - if ( !(guard).WasDismissed() ) \ - { \ - wxTRY \ - { \ - (guard).Execute(); \ - } \ - wxCATCH_ALL(;) \ - } \ - } - -#define wxPrivateUse(n) wxUnusedVar(n) - -#else - namespace wxPrivate { // in the original implementation this was a member template function of @@ -79,8 +55,6 @@ namespace wxPrivate #define wxPrivateOnScopeExit(n) wxPrivate::OnScopeExit(n) #define wxPrivateUse(n) wxPrivate::Use(n) -#endif - // ============================================================================ // wxScopeGuard for functions and functors // ============================================================================ diff --git a/Externals/wxWidgets3/include/wx/scrolbar.h b/Externals/wxWidgets3/include/wx/scrolbar.h index 21f2d75a8a..1352ae6c61 100644 --- a/Externals/wxWidgets3/include/wx/scrolbar.h +++ b/Externals/wxWidgets3/include/wx/scrolbar.h @@ -74,10 +74,8 @@ private: #include "wx/gtk1/scrolbar.h" #elif defined(__WXMAC__) #include "wx/osx/scrolbar.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/scrolbar.h" -#elif defined(__WXPM__) - #include "wx/os2/scrolbar.h" +#elif defined(__WXQT__) + #include "wx/qt/scrolbar.h" #endif #endif // wxUSE_SCROLLBAR diff --git a/Externals/wxWidgets3/include/wx/scrolwin.h b/Externals/wxWidgets3/include/wx/scrolwin.h index 370969929e..e8f4ac8386 100644 --- a/Externals/wxWidgets3/include/wx/scrolwin.h +++ b/Externals/wxWidgets3/include/wx/scrolwin.h @@ -214,7 +214,7 @@ public: void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; } wxRect GetTargetRect() const { return m_rectToScroll; } - virtual void DoPrepareDC(wxDC& dc); + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; // are we generating the autoscroll events? bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; } @@ -341,13 +341,13 @@ protected: // methods to corresponding wxScrollHelper methods #define WX_FORWARD_TO_SCROLL_HELPER() \ public: \ - virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ - virtual bool Layout() { return ScrollLayout(); } \ - virtual bool CanScroll(int orient) const \ + virtual void PrepareDC(wxDC& dc) wxOVERRIDE { DoPrepareDC(dc); } \ + virtual bool Layout() wxOVERRIDE { return ScrollLayout(); } \ + virtual bool CanScroll(int orient) const wxOVERRIDE \ { return IsScrollbarShown(orient); } \ - virtual void DoSetVirtualSize(int x, int y) \ + virtual void DoSetVirtualSize(int x, int y) wxOVERRIDE \ { ScrollDoSetVirtualSize(x, y); } \ - virtual wxSize GetBestVirtualSize() const \ + virtual wxSize GetBestVirtualSize() const wxOVERRIDE \ { return ScrollGetBestVirtualSize(); } // include the declaration of the real wxScrollHelper @@ -446,26 +446,15 @@ public: WX_FORWARD_TO_SCROLL_HELPER() protected: - virtual wxSize DoGetBestSize() const + virtual wxSize DoGetBestSize() const wxOVERRIDE { return FilterBestSize(this, this, T::DoGetBestSize()); } private: - // VC++ 6 gives warning for the declaration of template member function - // without definition -#ifndef __VISUALC6__ wxDECLARE_NO_COPY_CLASS(wxScrolled); -#endif }; -#ifdef __VISUALC6__ - // disable the warning about non dll-interface class used as base for - // dll-interface class: it's harmless in this case - #pragma warning(push) - #pragma warning(disable:4275) -#endif - // for compatibility with existing code, we provide wxScrolledWindow // "typedef" for wxScrolled. It's not a real typedef because we // want wxScrolledWindow to show in wxRTTI information (the class is widely @@ -482,13 +471,9 @@ public: const wxString& name = wxPanelNameStr) : wxScrolled(parent, winid, pos, size, style, name) {} - DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow); }; typedef wxScrolled wxScrolledCanvas; -#ifdef __VISUALC6__ - #pragma warning(pop) -#endif - #endif // _WX_SCROLWIN_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/selstore.h b/Externals/wxWidgets3/include/wx/selstore.h index 62ff2298ce..2cf420dc63 100644 --- a/Externals/wxWidgets3/include/wx/selstore.h +++ b/Externals/wxWidgets3/include/wx/selstore.h @@ -47,12 +47,16 @@ public: // special case of SetItemCount(0) void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; } - // must be called when a new item is inserted/added - void OnItemAdd(unsigned WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); } + // must be called when new items are inserted/added + void OnItemsInserted(unsigned item, unsigned numItems); - // must be called when an item is deleted + // must be called when an items is deleted void OnItemDelete(unsigned item); + // more efficient version for notifying the selection about deleting + // several items at once, return true if any of them were selected + bool OnItemsDeleted(unsigned item, unsigned numItems); + // select one item, use SelectRange() insted if possible! // // returns true if the items selection really changed @@ -71,6 +75,13 @@ public: // return true if the given item is selected bool IsSelected(unsigned item) const; + // return true if no items are currently selected + bool IsEmpty() const + { + return m_defaultState ? m_itemsSel.size() == m_count + : m_itemsSel.empty(); + } + // return the total number of selected items unsigned GetSelectedCount() const { @@ -78,6 +89,19 @@ public: : m_itemsSel.GetCount(); } + // type of a "cookie" used to preserve the iteration state, this is an + // opaque type, don't rely on its current representation + typedef size_t IterationState; + + // constant representing absence of selection and hence end of iteration + static const unsigned NO_SELECTION; + + // get the first selected item in index order, return NO_SELECTION if none + unsigned GetFirstSelectedItem(IterationState& cookie) const; + + // get the next selected item, return NO_SELECTION if no more + unsigned GetNextSelectedItem(IterationState& cookie) const; + private: // (re)init void Init() { m_count = 0; m_defaultState = false; } diff --git a/Externals/wxWidgets3/include/wx/setup_gccxml.h b/Externals/wxWidgets3/include/wx/setup_gccxml.h deleted file mode 100644 index 55552d45b3..0000000000 --- a/Externals/wxWidgets3/include/wx/setup_gccxml.h +++ /dev/null @@ -1,23 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/setup_gccxml.h -// Purpose: setup.h settings for gccxml (see utils/ifacecheck) -// Author: Francesco Montorsi -// Modified by: -// RCS-ID: $Id: setup_gccxml.h 61724 2009-08-21 10:41:26Z VZ $ -// Copyright: (c) Francesco Montorsi -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - This file is included by wx/platform.h when gccxml is detected. - - Here we fix some of the things declared in the real setup.h which gccxml doesn't - like. -*/ - - -// gccxml 0.9.0 doesn't like the fcntl2.h which is part of GNU C library -// (at least it doesn't on x86_64 systems!) -#define _FCNTL_H -int open (const char *__path, int __oflag, ...); - diff --git a/Externals/wxWidgets3/include/wx/setup_inc.h b/Externals/wxWidgets3/include/wx/setup_inc.h index 7e1ec6f4b6..4b404fbed1 100644 --- a/Externals/wxWidgets3/include/wx/setup_inc.h +++ b/Externals/wxWidgets3/include/wx/setup_inc.h @@ -22,16 +22,6 @@ // compatibility settings // ---------------------------------------------------------------------------- -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -40,7 +30,17 @@ // in the version after it completely. // // Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_8 1 +#define WXWIN_COMPATIBILITY_2_8 0 + +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of @@ -264,14 +264,21 @@ // Enable the use of compiler-specific thread local storage keyword, if any. // This is used for wxTLS_XXX() macros implementation and normally should use -// the compiler-provided support as it's simpler and more efficient, but must -// not use it if wxWidgets is used in a dynamically loaded Win32 (i.e. using -// LoadLibrary()/GetProcAddress()) as this triggers a bug in compiler TLS -// support that results in crashes when any TLS variables are used. So if you -// are building a Win32 DLL using wxWidgets that can be loaded dynamically, set -// this to 0. +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. // -// Default is 1, but set to 0 if the scenario above is applicable. +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. #define wxUSE_COMPILER_TLS 1 // ---------------------------------------------------------------------------- @@ -289,33 +296,30 @@ #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. +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // -// 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). +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. // -// 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 +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // 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 @@ -460,14 +464,7 @@ #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. +// allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // @@ -740,34 +737,21 @@ #define wxUSE_WEBVIEW_WEBKIT 0 #endif -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. +// as only MSVC is known to ship with at least gdiplus.h which is required to +// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later +// versions also include d2d1.h required for Direct2D-based implementation). +// For other compilers (e.g. mingw32) you may need to install the headers (and +// just the headers) yourself. If you do, change the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif +# define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. @@ -836,6 +820,7 @@ // Default is 1 // // Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton @@ -1005,6 +990,16 @@ // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1216,6 +1211,10 @@ // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 @@ -1306,8 +1305,7 @@ // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. diff --git a/Externals/wxWidgets3/include/wx/simplebook.h b/Externals/wxWidgets3/include/wx/simplebook.h index d54ebc45b6..4d604bac8e 100644 --- a/Externals/wxWidgets3/include/wx/simplebook.h +++ b/Externals/wxWidgets3/include/wx/simplebook.h @@ -41,6 +41,16 @@ public: Init(); } + bool Create(wxWindow *parent, + wxWindowID winid = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxEmptyString) + { + return wxBookCtrlBase::Create(parent, winid, pos, size, style | wxBK_TOP, name); + } + // Methods specific to this class. @@ -85,7 +95,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE) + int imageId = NO_IMAGE) wxOVERRIDE { if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) return false; @@ -98,19 +108,19 @@ public: return true; } - virtual int SetSelection(size_t n) + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } - virtual int ChangeSelection(size_t n) + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } // Neither labels nor images are supported but we still store the labels // just in case the user code attaches some importance to them. - virtual bool SetPageText(size_t n, const wxString& strText) + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE { wxCHECK_MSG( n < GetPageCount(), false, wxS("Invalid page") ); @@ -119,41 +129,41 @@ public: return true; } - virtual wxString GetPageText(size_t n) const + virtual wxString GetPageText(size_t n) const wxOVERRIDE { wxCHECK_MSG( n < GetPageCount(), wxString(), wxS("Invalid page") ); return m_pageTexts[n]; } - virtual bool SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) + virtual bool SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) wxOVERRIDE { return false; } - virtual int GetPageImage(size_t WXUNUSED(n)) const + virtual int GetPageImage(size_t WXUNUSED(n)) const wxOVERRIDE { return NO_IMAGE; } protected: - virtual void UpdateSelectedPage(size_t newsel) + virtual void UpdateSelectedPage(size_t newsel) wxOVERRIDE { - m_selection = newsel; + m_selection = (int)newsel; } - virtual wxBookCtrlEvent* CreatePageChangingEvent() const + virtual wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE { return new wxBookCtrlEvent(wxEVT_BOOKCTRL_PAGE_CHANGING, GetId()); } - virtual void MakeChangedEvent(wxBookCtrlEvent& event) + virtual void MakeChangedEvent(wxBookCtrlEvent& event) wxOVERRIDE { event.SetEventType(wxEVT_BOOKCTRL_PAGE_CHANGED); } - virtual wxWindow *DoRemovePage(size_t page) + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE { wxWindow* const win = wxBookCtrlBase::DoRemovePage(page); if ( win ) @@ -166,14 +176,14 @@ protected: return win; } - virtual void DoSize() + virtual void DoSize() wxOVERRIDE { wxWindow* const page = GetCurrentPage(); if ( page ) page->SetSize(GetPageRect()); } - virtual void DoShowPage(wxWindow* page, bool show) + virtual void DoShowPage(wxWindow* page, bool show) wxOVERRIDE { if ( show ) page->ShowWithEffect(m_showEffect, m_showTimeout); diff --git a/Externals/wxWidgets3/include/wx/sizer.h b/Externals/wxWidgets3/include/wx/sizer.h index 7d20b548c8..14b446a71a 100644 --- a/Externals/wxWidgets3/include/wx/sizer.h +++ b/Externals/wxWidgets3/include/wx/sizer.h @@ -25,12 +25,7 @@ class WXDLLIMPEXP_FWD_CORE wxSizerItem; class WXDLLIMPEXP_FWD_CORE wxSizer; #ifndef wxUSE_BORDER_BY_DEFAULT - #ifdef __SMARTPHONE__ - // no borders by default on limited size screen - #define wxUSE_BORDER_BY_DEFAULT 0 - #else - #define wxUSE_BORDER_BY_DEFAULT 1 - #endif + #define wxUSE_BORDER_BY_DEFAULT 1 #endif // ---------------------------------------------------------------------------- @@ -78,6 +73,12 @@ public: wxSizerFlags& Centre() { return Align(wxALIGN_CENTRE); } wxSizerFlags& Center() { return Centre(); } + wxSizerFlags& CentreVertical() { return Align(wxALIGN_CENTRE_VERTICAL); } + wxSizerFlags& CenterVertical() { return CentreVertical(); } + + wxSizerFlags& CentreHorizontal() { return Align(wxALIGN_CENTRE_HORIZONTAL); } + wxSizerFlags& CenterHorizontal() { return CentreHorizontal(); } + wxSizerFlags& Top() { m_flags &= ~(wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL); @@ -111,10 +112,21 @@ public: // GNOME HIG says to use 6px as the base unit: // http://library.gnome.org/devel/hig-book/stable/design-window.html.en return 6; - #else - // FIXME: default border size shouldn't be hardcoded and at the very - // least they should depend on the current font size + #elif defined(__WXMAC__) + // Not sure if this is really the correct size for the border. return 5; + #else + // For the other platforms, we need to scale raw pixel values using the + // current DPI, do it once (and cache the result) in another function. + #define wxNEEDS_BORDER_IN_PX + + // We don't react to dynamic DPI changes, so we can cache the values of + // the border in on-screen pixels after computing it once. This + // could/should change in the future. + if ( !ms_defaultBorderInPx ) + ms_defaultBorderInPx = DoGetDefaultBorderInPx(); + + return ms_defaultBorderInPx; #endif #else return 0; @@ -216,6 +228,12 @@ public: int GetBorderInPixels() const { return m_borderInPixels; } private: +#ifdef wxNEEDS_BORDER_IN_PX + static int DoGetDefaultBorderInPx(); + + static int ms_defaultBorderInPx; +#endif // wxNEEDS_BORDER_IN_PX + int m_proportion; int m_flags; int m_borderInPixels; @@ -351,12 +369,6 @@ public: bool IsSizer() const { return m_kind == Item_Sizer; } bool IsSpacer() const { return m_kind == Item_Spacer; } -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6, use {G,S}etProportion instead. - wxDEPRECATED( void SetOption( int option ) ); - wxDEPRECATED( int GetOption() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - void SetProportion( int proportion ) { m_proportion = proportion; } int GetProportion() const @@ -481,7 +493,7 @@ protected: wxObject *m_userData; private: - DECLARE_CLASS(wxSizerItem) + wxDECLARE_CLASS(wxSizerItem); wxDECLARE_NO_COPY_CLASS(wxSizerItem); }; @@ -591,12 +603,6 @@ public: void SetContainingWindow(wxWindow *window); wxWindow *GetContainingWindow() const { return m_containingWindow; } -#if WXWIN_COMPATIBILITY_2_6 - // Deprecated in 2.6 since historically it does not delete the window, - // use Detach instead. - wxDEPRECATED( virtual bool Remove( wxWindow *window ) ); -#endif // WXWIN_COMPATIBILITY_2_6 - virtual bool Remove( wxSizer *sizer ); virtual bool Remove( int index ); @@ -741,7 +747,7 @@ protected: virtual wxSizerItem* DoInsert(size_t index, wxSizerItem *item); private: - DECLARE_CLASS(wxSizer) + wxDECLARE_CLASS(wxSizer); }; //--------------------------------------------------------------------------- @@ -760,8 +766,8 @@ public: wxGridSizer( int rows, int cols, int vgap, int hgap ); wxGridSizer( int rows, int cols, const wxSize& gap ); - virtual void RecalcSizes(); - virtual wxSize CalcMin(); + virtual void RecalcSizes() wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; void SetCols( int cols ) { @@ -799,7 +805,7 @@ protected: int m_vgap; int m_hgap; - virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item); + virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; void SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ); @@ -828,7 +834,7 @@ protected: } private: - DECLARE_CLASS(wxGridSizer) + wxDECLARE_CLASS(wxGridSizer); }; //--------------------------------------------------------------------------- @@ -891,8 +897,8 @@ public: const wxArrayInt& GetColWidths() const { return m_colWidths; } // implementation - virtual void RecalcSizes(); - virtual wxSize CalcMin(); + virtual void RecalcSizes() wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; protected: void AdjustForFlexDirection(); @@ -920,7 +926,7 @@ protected: wxSize m_calculatedMinSize; private: - DECLARE_CLASS(wxFlexGridSizer) + wxDECLARE_CLASS(wxFlexGridSizer); wxDECLARE_NO_COPY_CLASS(wxFlexGridSizer); }; @@ -940,7 +946,7 @@ public: wxT("invalid value for wxBoxSizer orientation") ); } - virtual wxSizerItem *AddSpacer(int size); + virtual wxSizerItem *AddSpacer(int size) wxOVERRIDE; int GetOrientation() const { return m_orient; } @@ -949,10 +955,13 @@ public: void SetOrientation(int orient) { m_orient = orient; } // implementation of our resizing logic - virtual wxSize CalcMin(); - virtual void RecalcSizes(); + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RecalcSizes() wxOVERRIDE; protected: + // Only overridden to perform extra debugging checks. + virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; + // helpers for our code: this returns the component of the given wxSize in // the direction of the sizer and in the other direction, respectively int GetSizeInMajorDir(const wxSize& sz) const @@ -1007,10 +1016,10 @@ protected: // the minimal size needed for this sizer as calculated by the last call to // our CalcMin() - wxSize m_minSize; + wxSize m_calculatedMinSize; private: - DECLARE_CLASS(wxBoxSizer) + wxDECLARE_CLASS(wxBoxSizer); }; //--------------------------------------------------------------------------- @@ -1028,25 +1037,25 @@ public: wxStaticBoxSizer(int orient, wxWindow *win, const wxString& label = wxEmptyString); virtual ~wxStaticBoxSizer(); - void RecalcSizes(); - wxSize CalcMin(); + void RecalcSizes() wxOVERRIDE; + wxSize CalcMin() wxOVERRIDE; wxStaticBox *GetStaticBox() const { return m_staticBox; } // override to hide/show the static box as well - virtual void ShowItems (bool show); - virtual bool AreAnyItemsShown() const; + virtual void ShowItems (bool show) wxOVERRIDE; + virtual bool AreAnyItemsShown() const wxOVERRIDE; - virtual bool Detach( wxWindow *window ); - virtual bool Detach( wxSizer *sizer ) { return wxBoxSizer::Detach(sizer); } - virtual bool Detach( int index ) { return wxBoxSizer::Detach(index); } + virtual bool Detach( wxWindow *window ) wxOVERRIDE; + virtual bool Detach( wxSizer *sizer ) wxOVERRIDE { return wxBoxSizer::Detach(sizer); } + virtual bool Detach( int index ) wxOVERRIDE { return wxBoxSizer::Detach(index); } protected: wxStaticBox *m_staticBox; private: - DECLARE_CLASS(wxStaticBoxSizer) + wxDECLARE_CLASS(wxStaticBoxSizer); wxDECLARE_NO_COPY_CLASS(wxStaticBoxSizer); }; @@ -1098,7 +1107,7 @@ protected: wxButton *m_buttonHelp; // wxID_HELP, wxID_CONTEXT_HELP private: - DECLARE_CLASS(wxStdDialogButtonSizer) + wxDECLARE_CLASS(wxStdDialogButtonSizer); wxDECLARE_NO_COPY_CLASS(wxStdDialogButtonSizer); }; diff --git a/Externals/wxWidgets3/include/wx/slider.h b/Externals/wxWidgets3/include/wx/slider.h index e3ab597b0c..7d615ca65f 100644 --- a/Externals/wxWidgets3/include/wx/slider.h +++ b/Externals/wxWidgets3/include/wx/slider.h @@ -41,11 +41,6 @@ #define wxSL_VALUE_LABEL 0x4000 #define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL) -#if WXWIN_COMPATIBILITY_2_6 - // obsolete - #define wxSL_NOTIFY_DRAG 0x0000 -#endif // WXWIN_COMPATIBILITY_2_6 - extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[]; // ---------------------------------------------------------------------------- @@ -113,7 +108,7 @@ protected: virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ } // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // adjust value according to wxSL_INVERSE style virtual int ValueInvertOrNot(int value) const @@ -144,10 +139,8 @@ private: #include "wx/gtk1/slider.h" #elif defined(__WXMAC__) #include "wx/osx/slider.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/slider.h" -#elif defined(__WXPM__) - #include "wx/os2/slider.h" +#elif defined(__WXQT__) + #include "wx/qt/slider.h" #endif #endif // wxUSE_SLIDER diff --git a/Externals/wxWidgets3/include/wx/socket.h b/Externals/wxWidgets3/include/wx/socket.h index 35ff266216..daded4bf05 100644 --- a/Externals/wxWidgets3/include/wx/socket.h +++ b/Externals/wxWidgets3/include/wx/socket.h @@ -300,8 +300,8 @@ private: friend class wxSocketReadGuard; friend class wxSocketWriteGuard; + wxDECLARE_CLASS(wxSocketBase); wxDECLARE_NO_COPY_CLASS(wxSocketBase); - DECLARE_CLASS(wxSocketBase) }; @@ -320,8 +320,8 @@ public: bool WaitForAccept(long seconds = -1, long milliseconds = 0); + wxDECLARE_CLASS(wxSocketServer); wxDECLARE_NO_COPY_CLASS(wxSocketServer); - DECLARE_CLASS(wxSocketServer) }; @@ -359,8 +359,8 @@ private: int m_initialRecvBufferSize; int m_initialSendBufferSize; + wxDECLARE_CLASS(wxSocketClient); wxDECLARE_NO_COPY_CLASS(wxSocketClient); - DECLARE_CLASS(wxSocketClient) }; @@ -388,8 +388,8 @@ public: */ private: + wxDECLARE_CLASS(wxDatagramSocket); wxDECLARE_NO_COPY_CLASS(wxDatagramSocket); - DECLARE_CLASS(wxDatagramSocket) }; @@ -410,14 +410,14 @@ public: { return (wxSocketBase *) GetEventObject(); } void *GetClientData() const { return m_clientData; } - virtual wxEvent *Clone() const { return new wxSocketEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_SOCKET; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSocketEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_SOCKET; } public: wxSocketNotify m_event; void *m_clientData; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent); }; diff --git a/Externals/wxWidgets3/include/wx/sound.h b/Externals/wxWidgets3/include/wx/sound.h index b81a11cb46..003a4b7ae2 100644 --- a/Externals/wxWidgets3/include/wx/sound.h +++ b/Externals/wxWidgets3/include/wx/sound.h @@ -56,12 +56,8 @@ protected: #if defined(__WINDOWS__) #include "wx/msw/sound.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/sound.h" #elif defined(__WXMAC__) #include "wx/osx/sound.h" -#elif defined(__WXPM__) - #include "wx/os2/sound.h" #elif defined(__UNIX__) #include "wx/unix/sound.h" #endif diff --git a/Externals/wxWidgets3/include/wx/spinbutt.h b/Externals/wxWidgets3/include/wx/spinbutt.h index cb11e29833..7370ebf600 100644 --- a/Externals/wxWidgets3/include/wx/spinbutt.h +++ b/Externals/wxWidgets3/include/wx/spinbutt.h @@ -86,10 +86,8 @@ protected: #include "wx/gtk1/spinbutt.h" #elif defined(__WXMAC__) #include "wx/osx/spinbutt.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/spinbutt.h" -#elif defined(__WXPM__) - #include "wx/os2/spinbutt.h" +#elif defined(__WXQT__) + #include "wx/qt/spinbutt.h" #endif // ---------------------------------------------------------------------------- @@ -113,10 +111,10 @@ public: int GetPosition() const { return m_commandInt; } void SetPosition(int pos) { m_commandInt = pos; } - virtual wxEvent *Clone() const { return new wxSpinEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinEvent(*this); } private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinEvent); }; typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); diff --git a/Externals/wxWidgets3/include/wx/spinctrl.h b/Externals/wxWidgets3/include/wx/spinctrl.h index 7a7b3a4bd9..4df89ff178 100644 --- a/Externals/wxWidgets3/include/wx/spinctrl.h +++ b/Externals/wxWidgets3/include/wx/spinctrl.h @@ -53,7 +53,6 @@ public: // The base for numbers display, e.g. 10 or 16. virtual int GetBase() const = 0; virtual bool SetBase(int base) = 0; - // Select text in the textctrl virtual void SetSelection(long from, long to) = 0; @@ -82,13 +81,13 @@ public: double GetValue() const { return m_value; } void SetValue(double value) { m_value = value; } - virtual wxEvent *Clone() const { return new wxSpinDoubleEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxSpinDoubleEvent(*this); } protected: double m_value; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSpinDoubleEvent); }; // ---------------------------------------------------------------------------- @@ -121,9 +120,6 @@ typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&); #elif defined(__WXMSW__) #define wxHAS_NATIVE_SPINCTRL #include "wx/msw/spinctrl.h" -#elif defined(__WXPM__) - #define wxHAS_NATIVE_SPINCTRL - #include "wx/os2/spinctrl.h" #elif defined(__WXGTK20__) #define wxHAS_NATIVE_SPINCTRL #define wxHAS_NATIVE_SPINCTRLDOUBLE @@ -131,12 +127,15 @@ typedef void (wxEvtHandler::*wxSpinDoubleEventFunction)(wxSpinDoubleEvent&); #elif defined(__WXGTK__) #define wxHAS_NATIVE_SPINCTRL #include "wx/gtk1/spinctrl.h" +#elif defined(__WXQT__) + #define wxHAS_NATIVE_SPINCTRL + #define wxHAS_NATIVE_SPINCTRLDOUBLE + #include "wx/qt/spinctrl.h" #endif // platform #if !defined(wxHAS_NATIVE_SPINCTRL) || !defined(wxHAS_NATIVE_SPINCTRLDOUBLE) #include "wx/generic/spinctlg.h" #endif - namespace wxPrivate { diff --git a/Externals/wxWidgets3/include/wx/splitter.h b/Externals/wxWidgets3/include/wx/splitter.h index f36d2923df..e1f953e9ea 100644 --- a/Externals/wxWidgets3/include/wx/splitter.h +++ b/Externals/wxWidgets3/include/wx/splitter.h @@ -28,12 +28,6 @@ #define wxSP_BORDER wxSP_3DBORDER #define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) -#if WXWIN_COMPATIBILITY_2_6 - // obsolete styles, don't do anything - #define wxSP_SASH_AQUA 0 - #define wxSP_FULLSASH 0 -#endif // WXWIN_COMPATIBILITY_2_6 - class WXDLLIMPEXP_FWD_CORE wxSplitterEvent; wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent ); diff --git a/Externals/wxWidgets3/include/wx/srchctrl.h b/Externals/wxWidgets3/include/wx/srchctrl.h index 3ca462258c..b28d3912d1 100644 --- a/Externals/wxWidgets3/include/wx/srchctrl.h +++ b/Externals/wxWidgets3/include/wx/srchctrl.h @@ -70,7 +70,7 @@ public: private: // implement wxTextEntry pure virtual method - virtual wxWindow *GetEditableWindow() { return this; } + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } }; diff --git a/Externals/wxWidgets3/include/wx/sstream.h b/Externals/wxWidgets3/include/wx/sstream.h index b0b2290fbc..19f37c58d3 100644 --- a/Externals/wxWidgets3/include/wx/sstream.h +++ b/Externals/wxWidgets3/include/wx/sstream.h @@ -26,13 +26,13 @@ public: // it wxStringInputStream(const wxString& s); - virtual wxFileOffset GetLength() const; - virtual bool IsSeekable() const { return true; } + virtual wxFileOffset GetLength() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return true; } protected: - virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysRead(void *buffer, size_t size); + virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; private: // the string that was passed in the ctor @@ -76,11 +76,11 @@ public: // get the string containing current output const wxString& GetString() const { return *m_str; } - virtual bool IsSeekable() const { return true; } + virtual bool IsSeekable() const wxOVERRIDE { return true; } protected: - virtual wxFileOffset OnSysTell() const; - virtual size_t OnSysWrite(const void *buffer, size_t size); + virtual wxFileOffset OnSysTell() const wxOVERRIDE; + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; private: // internal string, not used if caller provided his own string diff --git a/Externals/wxWidgets3/include/wx/statbmp.h b/Externals/wxWidgets3/include/wx/statbmp.h index e86f45b59c..ea888cd501 100644 --- a/Externals/wxWidgets3/include/wx/statbmp.h +++ b/Externals/wxWidgets3/include/wx/statbmp.h @@ -25,6 +25,14 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBitmapNameStr[]; class WXDLLIMPEXP_CORE wxStaticBitmapBase : public wxControl { public: + enum ScaleMode + { + Scale_None, + Scale_Fill, + Scale_AspectFit, + Scale_AspectFill + }; + wxStaticBitmapBase() { } virtual ~wxStaticBitmapBase(); @@ -38,16 +46,18 @@ public: // should) return wxIcon(); } + virtual void SetScaleMode(ScaleMode WXUNUSED(scaleMode)) { } + virtual ScaleMode GetScaleMode() const { return Scale_None; } // overridden base class virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; wxDECLARE_NO_COPY_CLASS(wxStaticBitmapBase); }; @@ -64,10 +74,8 @@ protected: #include "wx/gtk1/statbmp.h" #elif defined(__WXMAC__) #include "wx/osx/statbmp.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbmp.h" -#elif defined(__WXPM__) - #include "wx/os2/statbmp.h" +#elif defined(__WXQT__) + #include "wx/qt/statbmp.h" #endif #endif // wxUSE_STATBMP diff --git a/Externals/wxWidgets3/include/wx/statbox.h b/Externals/wxWidgets3/include/wx/statbox.h index d01f257969..968903b009 100644 --- a/Externals/wxWidgets3/include/wx/statbox.h +++ b/Externals/wxWidgets3/include/wx/statbox.h @@ -30,7 +30,7 @@ public: wxStaticBoxBase(); // overridden base class virtuals - virtual bool HasTransparentBackground() { return true; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } // implementation only: this is used by wxStaticBoxSizer to account for the // need for extra space taken by the static box @@ -39,7 +39,7 @@ public: // borderOther is the margin on all other sides virtual void GetBordersForSizer(int *borderTop, int *borderOther) const { - const int BORDER = 5; // FIXME: hardcoded value + const int BORDER = FromDIP(5); // FIXME: hardcoded value *borderTop = GetLabel().empty() ? BORDER : GetCharHeight(); *borderOther = BORDER; @@ -47,7 +47,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } wxDECLARE_NO_COPY_CLASS(wxStaticBoxBase); }; @@ -64,10 +64,8 @@ protected: #include "wx/gtk1/statbox.h" #elif defined(__WXMAC__) #include "wx/osx/statbox.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statbox.h" -#elif defined(__WXPM__) - #include "wx/os2/statbox.h" +#elif defined(__WXQT__) + #include "wx/qt/statbox.h" #endif #endif // wxUSE_STATBOX diff --git a/Externals/wxWidgets3/include/wx/statline.h b/Externals/wxWidgets3/include/wx/statline.h index 4f9e0f1561..49023d58ba 100644 --- a/Externals/wxWidgets3/include/wx/statline.h +++ b/Externals/wxWidgets3/include/wx/statline.h @@ -46,11 +46,11 @@ public: static int GetDefaultSize() { return 2; } // overridden base class virtuals - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // set the right size for the right dimension wxSize AdjustSize(const wxSize& size) const @@ -70,7 +70,7 @@ protected: return sizeReal; } - virtual wxSize DoGetBestSize() const + virtual wxSize DoGetBestSize() const wxOVERRIDE { return AdjustSize(wxDefaultSize); } @@ -90,12 +90,10 @@ protected: #include "wx/gtk/statline.h" #elif defined(__WXGTK__) #include "wx/gtk1/statline.h" -#elif defined(__WXPM__) - #include "wx/os2/statline.h" #elif defined(__WXMAC__) #include "wx/osx/statline.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/statline.h" +#elif defined(__WXQT__) + #include "wx/qt/statline.h" #else // use generic implementation for all other platforms #include "wx/generic/statline.h" #endif diff --git a/Externals/wxWidgets3/include/wx/stattext.h b/Externals/wxWidgets3/include/wx/stattext.h index fa29077526..237f93620e 100644 --- a/Externals/wxWidgets3/include/wx/stattext.h +++ b/Externals/wxWidgets3/include/wx/stattext.h @@ -26,6 +26,9 @@ #define wxST_ELLIPSIZE_MIDDLE 0x0008 #define wxST_ELLIPSIZE_END 0x0010 +#define wxST_ELLIPSIZE_MASK \ + (wxST_ELLIPSIZE_START | wxST_ELLIPSIZE_MIDDLE | wxST_ELLIPSIZE_END) + extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticTextNameStr[]; class WXDLLIMPEXP_CORE wxStaticTextBase : public wxControl @@ -39,20 +42,18 @@ public: void Wrap(int width); // overridden base virtuals - virtual bool AcceptsFocus() const { return false; } - virtual bool HasTransparentBackground() { return true; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } + virtual bool HasTransparentBackground() wxOVERRIDE { return true; } bool IsEllipsized() const { - return HasFlag(wxST_ELLIPSIZE_START) || - HasFlag(wxST_ELLIPSIZE_MIDDLE) || - HasFlag(wxST_ELLIPSIZE_END); + return (GetWindowStyle() & wxST_ELLIPSIZE_MASK) != 0; } protected: // functions required for wxST_ELLIPSIZE_* support // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // Calls Ellipsize() on the real label if necessary. Unlike GetLabelText(), // keeps the mnemonics instead of removing them. @@ -78,6 +79,10 @@ protected: // functions required for wxST_ELLIPSIZE_* support // but may contain the mnemonic characters. virtual void DoSetLabel(const wxString& WXUNUSED(str)) { } + // Update the current size to match the best size unless wxST_NO_AUTORESIZE + // style is explicitly used. + void AutoResizeIfNecessary(); + private: wxDECLARE_NO_COPY_CLASS(wxStaticTextBase); }; @@ -97,10 +102,8 @@ private: #include "wx/gtk1/stattext.h" #elif defined(__WXMAC__) #include "wx/osx/stattext.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/stattext.h" -#elif defined(__WXPM__) - #include "wx/os2/stattext.h" +#elif defined(__WXQT__) + #include "wx/qt/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 17e033ffc3..375ee8dfc0 100644 --- a/Externals/wxWidgets3/include/wx/statusbr.h +++ b/Externals/wxWidgets3/include/wx/statusbr.h @@ -181,10 +181,10 @@ public: // wxWindow overrides: // don't want status bars to accept the focus at all - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } // the client size of a toplevel window doesn't include the status bar - virtual bool CanBeOutsideClientArea() const { return true; } + virtual bool CanBeOutsideClientArea() const wxOVERRIDE { return true; } protected: // called after the status bar pane text changed and should update its @@ -195,14 +195,14 @@ protected: // wxWindow overrides: #if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ) + virtual void DoSetToolTip( wxToolTip *tip ) wxOVERRIDE { wxASSERT_MSG(!HasFlag(wxSTB_SHOW_TIPS), "Do not set tooltip(s) manually when using wxSTB_SHOW_TIPS!"); wxWindow::DoSetToolTip(tip); } #endif // wxUSE_TOOLTIPS - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // internal helpers & data: @@ -237,6 +237,8 @@ protected: #define wxStatusBarMac wxStatusBar #include "wx/generic/statusbr.h" #include "wx/osx/statusbr.h" +#elif defined(__WXQT__) + #include "wx/qt/statusbar.h" #else #define wxStatusBarGeneric wxStatusBar #include "wx/generic/statusbr.h" diff --git a/Externals/wxWidgets3/include/wx/stdpaths.h b/Externals/wxWidgets3/include/wx/stdpaths.h index 9d92044457..5528626e81 100644 --- a/Externals/wxWidgets3/include/wx/stdpaths.h +++ b/Externals/wxWidgets3/include/wx/stdpaths.h @@ -49,6 +49,15 @@ public: AppInfo_VendorName = 2 // the vendor name }; + enum Dir + { + Dir_Documents, + Dir_Desktop, + Dir_Downloads, + Dir_Music, + Dir_Pictures, + Dir_Videos + }; // return the global standard paths object static wxStandardPaths& Get(); @@ -130,7 +139,10 @@ public: // // C:\Documents and Settings\username\My Documents under Windows, // $HOME under Unix and ~/Documents under Mac - virtual wxString GetDocumentsDir() const; + virtual wxString GetDocumentsDir() const + { + return GetUserDir(Dir_Documents); + } // return the directory for the documents files used by this application: // it's a subdirectory of GetDocumentsDir() constructed using the @@ -140,6 +152,7 @@ public: // return the temporary directory for the current user virtual wxString GetTempDir() const; + virtual wxString GetUserDir(Dir userDir) const; // virtual dtor for the base class virtual ~wxStandardPathsBase(); @@ -174,12 +187,8 @@ protected: #if defined(__WINDOWS__) #include "wx/msw/stdpaths.h" #define wxHAS_NATIVE_STDPATHS - // We want CoreFoundation paths on both CarbonLib and Darwin (for all ports) - #elif defined(__WXMAC__) || defined(__DARWIN__) - #include "wx/osx/core/stdpaths.h" - #define wxHAS_NATIVE_STDPATHS - #elif defined(__OS2__) - #include "wx/os2/stdpaths.h" + #elif defined(__WXOSX_COCOA__) || defined(__WXOSX_IPHONE__) || defined(__DARWIN__) + #include "wx/osx/cocoa/stdpaths.h" #define wxHAS_NATIVE_STDPATHS #elif defined(__UNIX__) #include "wx/unix/stdpaths.h" @@ -208,7 +217,7 @@ public: virtual wxString GetLocalDataDir() const { return m_prefix; } virtual wxString GetUserDataDir() const { return m_prefix; } virtual wxString GetPluginsDir() const { return m_prefix; } - virtual wxString GetDocumentsDir() const { return m_prefix; } + virtual wxString GetUserDir(Dir WXUNUSED(userDir)) const { return m_prefix; } protected: // Ctor is protected because wxStandardPaths::Get() should always be used diff --git a/Externals/wxWidgets3/include/wx/stdstream.h b/Externals/wxWidgets3/include/wx/stdstream.h index 73ac0ac260..3cf565b624 100644 --- a/Externals/wxWidgets3/include/wx/stdstream.h +++ b/Externals/wxWidgets3/include/wx/stdstream.h @@ -30,21 +30,21 @@ public: virtual ~wxStdInputStreamBuffer() { } protected: - virtual std::streambuf *setbuf(char *s, std::streamsize n); + virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE; virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | - std::ios_base::out); + std::ios_base::out) wxOVERRIDE; virtual std::streampos seekpos(std::streampos sp, std::ios_base::openmode which = std::ios_base::in | - std::ios_base::out); - virtual std::streamsize showmanyc(); - virtual std::streamsize xsgetn(char *s, std::streamsize n); - virtual int underflow(); - virtual int uflow(); - virtual int pbackfail(int c = EOF); + std::ios_base::out) wxOVERRIDE; + virtual std::streamsize showmanyc() wxOVERRIDE; + virtual std::streamsize xsgetn(char *s, std::streamsize n) wxOVERRIDE; + virtual int underflow() wxOVERRIDE; + virtual int uflow() wxOVERRIDE; + virtual int pbackfail(int c = EOF) wxOVERRIDE; // 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 @@ -87,18 +87,18 @@ public: virtual ~wxStdOutputStreamBuffer() { } protected: - virtual std::streambuf *setbuf(char *s, std::streamsize n); + virtual std::streambuf *setbuf(char *s, std::streamsize n) wxOVERRIDE; virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | - std::ios_base::out); + std::ios_base::out) wxOVERRIDE; virtual std::streampos seekpos(std::streampos sp, std::ios_base::openmode which = std::ios_base::in | - std::ios_base::out); - virtual std::streamsize xsputn(const char *s, std::streamsize n); - virtual int overflow(int c); + std::ios_base::out) wxOVERRIDE; + virtual std::streamsize xsputn(const char *s, std::streamsize n) wxOVERRIDE; + virtual int overflow(int c) wxOVERRIDE; wxOutputStream& m_stream; }; diff --git a/Externals/wxWidgets3/include/wx/stopwatch.h b/Externals/wxWidgets3/include/wx/stopwatch.h index 248f757520..ef39f39169 100644 --- a/Externals/wxWidgets3/include/wx/stopwatch.h +++ b/Externals/wxWidgets3/include/wx/stopwatch.h @@ -89,16 +89,4 @@ private: #endif // wxUSE_STOPWATCH -#if wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - - // Starts a global timer - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( void WXDLLIMPEXP_BASE wxStartTimer() ); - - // Gets elapsed milliseconds since last wxStartTimer or wxGetElapsedTime - // -- DEPRECATED: use wxStopWatch instead - wxDEPRECATED( long WXDLLIMPEXP_BASE wxGetElapsedTime(bool resetTimer = true) ); - -#endif // wxUSE_LONGLONG && WXWIN_COMPATIBILITY_2_6 - #endif // _WX_STOPWATCH_H_ diff --git a/Externals/wxWidgets3/include/wx/strconv.h b/Externals/wxWidgets3/include/wx/strconv.h index 3dc3752186..470632ca4a 100644 --- a/Externals/wxWidgets3/include/wx/strconv.h +++ b/Externals/wxWidgets3/include/wx/strconv.h @@ -16,14 +16,6 @@ #include "wx/chartype.h" #include "wx/buffer.h" -#ifdef __DIGITALMARS__ -#include "typeinfo.h" -#endif - -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -# undef __BSEXCPT__ -#endif - #include class WXDLLIMPEXP_FWD_BASE wxString; @@ -183,13 +175,13 @@ public: class WXDLLIMPEXP_BASE wxMBConvLibc : public wxMBConv { public: - virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const; - virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const; + virtual size_t MB2WC(wchar_t *outputBuf, const char *psz, size_t outputSize) const wxOVERRIDE; + virtual size_t WC2MB(char *outputBuf, const wchar_t *psz, size_t outputSize) const wxOVERRIDE; - virtual wxMBConv *Clone() const { return new wxMBConvLibc; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; } #if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const { return wxLocaleIsUtf8; } + virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; } #endif }; @@ -213,27 +205,27 @@ public: } virtual ~wxConvBrokenFileNames() { delete m_conv; } - virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const + virtual size_t MB2WC(wchar_t *out, const char *in, size_t outLen) const wxOVERRIDE { return m_conv->MB2WC(out, in, outLen); } - virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const + virtual size_t WC2MB(char *out, const wchar_t *in, size_t outLen) const wxOVERRIDE { return m_conv->WC2MB(out, in, outLen); } - virtual size_t GetMBNulLen() const + virtual size_t GetMBNulLen() const wxOVERRIDE { // cast needed to call a private function return m_conv->GetMBNulLen(); } #if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const { return m_conv->IsUTF8(); } + virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); } #endif - virtual wxMBConv *Clone() const { return new wxConvBrokenFileNames(*this); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); } private: // the conversion object we forward to @@ -257,11 +249,11 @@ public: // (assuming it's ok to copy the shift state -- not really sure about it) virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; - virtual wxMBConv *Clone() const { return new wxMBConvUTF7; } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF7; } private: // UTF-7 decoder/encoder may be in direct mode or in shifted mode after a @@ -344,16 +336,16 @@ public: // compiler-generated default ctor and other methods are ok virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; - virtual wxMBConv *Clone() const { return new wxMBConvStrictUTF8(); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); } #if wxUSE_UNICODE_UTF8 // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't // take the shortcut in that case - virtual bool IsUTF8() const { return true; } + virtual bool IsUTF8() const wxOVERRIDE { return true; } #endif }; @@ -370,16 +362,16 @@ public: wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { } virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; - virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); } #if wxUSE_UNICODE_UTF8 // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't // take the shortcut in that case - virtual bool IsUTF8() const { return m_options == MAP_INVALID_UTF8_NOT; } + virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; } #endif private: @@ -395,7 +387,7 @@ class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv public: enum { BYTES_PER_CHAR = 2 }; - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } + virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } protected: // return the length of the buffer using srcLen if it's not wxNO_LEN and @@ -413,10 +405,10 @@ class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16LE; } + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16LE; } }; // ---------------------------------------------------------------------------- @@ -427,10 +419,10 @@ class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF16BE; } + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF16BE; } }; // ---------------------------------------------------------------------------- @@ -442,7 +434,7 @@ class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv public: enum { BYTES_PER_CHAR = 4 }; - virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; } + virtual size_t GetMBNulLen() const wxOVERRIDE { return BYTES_PER_CHAR; } protected: // this is similar to wxMBConvUTF16Base method with the same name except @@ -459,10 +451,10 @@ class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32LE; } + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32LE; } }; // ---------------------------------------------------------------------------- @@ -473,10 +465,10 @@ class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base { public: virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual wxMBConv *Clone() const { return new wxMBConvUTF32BE; } + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF32BE; } }; // ---------------------------------------------------------------------------- @@ -499,16 +491,16 @@ public: wxCSConv& operator=(const wxCSConv& conv); virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual size_t GetMBNulLen() const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMBNulLen() const wxOVERRIDE; #if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const; + virtual bool IsUTF8() const wxOVERRIDE; #endif - virtual wxMBConv *Clone() const { return new wxCSConv(*this); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); } void Clear(); @@ -551,6 +543,39 @@ private: wxMBConv *m_convReal; }; +// ---------------------------------------------------------------------------- +// wxWhateverWorksConv: use whatever encoding works for the input +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxWhateverWorksConv : public wxMBConv +{ +public: + wxWhateverWorksConv() + { + } + + // Try to interpret the string as UTF-8, if it fails fall back to the + // current locale encoding (wxConvLibc) and if this fails as well, + // interpret it as wxConvISO8859_1 (which is used because it never fails + // and this conversion is used when we really, really must produce + // something on output). + virtual size_t + ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + // Try to encode the string using the current locale encoding (wxConvLibc) + // and fall back to UTF-8 (which never fails) if it doesn't work. Note that + // we never use wxConvISO8859_1 here as we prefer to fall back on UTF-8 + // even for the strings containing only code points representable in 8869-1. + virtual size_t + FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + + virtual wxMBConv *Clone() const wxOVERRIDE + { + return new wxWhateverWorksConv(); + } +}; // ---------------------------------------------------------------------------- // declare predefined conversion objects @@ -586,6 +611,12 @@ WX_DECLARE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8) WX_DECLARE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7) #define wxConvUTF7 wxGet_wxConvUTF7() +// conversion used when we may not afford to lose data when outputting Unicode +// strings (should be avoid in the other direction as it can misinterpret the +// input encoding) +WX_DECLARE_GLOBAL_CONV(wxWhateverWorksConv, wxConvWhateverWorks) +#define wxConvWhateverWorks wxGet_wxConvWhateverWorks() + // conversion used for the file names on the systems where they're not Unicode // (basically anything except Windows) // @@ -635,7 +666,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; #define wxFNCONV(name) wxConvFileName->cWX2MB(name) #define wxFNSTRINGCAST wxMBSTRINGCAST #else -#if defined( __WXOSX_OR_COCOA__ ) && wxMBFILES +#if defined(__WXOSX__) && wxMBFILES #define wxFNCONV(name) wxConvFileName->cWC2MB( wxConvLocal.cWX2WC(name) ) #else #define wxFNCONV(name) name @@ -656,13 +687,15 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI; // function which would crash if we passed NULL to it), so these functions // always return a valid pointer if their argument is non-NULL - // this function safety is achieved by trying wxConvLibc first, wxConvUTF8 - // next if it fails and, finally, wxConvISO8859_1 which always succeeds - extern WXDLLIMPEXP_BASE wxWCharBuffer wxSafeConvertMB2WX(const char *s); + inline wxWCharBuffer wxSafeConvertMB2WX(const char *s) + { + return wxConvWhateverWorks.cMB2WC(s); + } - // this function uses wxConvLibc and wxConvUTF8(MAP_INVALID_UTF8_TO_OCTAL) - // if it fails - extern WXDLLIMPEXP_BASE wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws); + inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) + { + return wxConvWhateverWorks.cWC2MB(ws); + } #else // ANSI // no conversions to do #define wxConvertWX2MB(s) (s) diff --git a/Externals/wxWidgets3/include/wx/stream.h b/Externals/wxWidgets3/include/wx/stream.h index 0c380d6aaf..52217f6fd3 100644 --- a/Externals/wxWidgets3/include/wx/stream.h +++ b/Externals/wxWidgets3/include/wx/stream.h @@ -81,7 +81,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxStreamBase) + wxDECLARE_ABSTRACT_CLASS(wxStreamBase); wxDECLARE_NO_COPY_CLASS(wxStreamBase); }; @@ -221,7 +221,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxInputStream) + wxDECLARE_ABSTRACT_CLASS(wxInputStream); wxDECLARE_NO_COPY_CLASS(wxInputStream); }; @@ -263,7 +263,7 @@ protected: friend class wxStreamBuffer; - DECLARE_ABSTRACT_CLASS(wxOutputStream) + wxDECLARE_ABSTRACT_CLASS(wxOutputStream); wxDECLARE_NO_COPY_CLASS(wxOutputStream); }; @@ -280,19 +280,19 @@ class WXDLLIMPEXP_BASE wxCountingOutputStream : public wxOutputStream public: wxCountingOutputStream(); - virtual wxFileOffset GetLength() const; + virtual wxFileOffset GetLength() const wxOVERRIDE; bool Ok() const { return IsOk(); } - virtual bool IsOk() const { return true; } + virtual bool IsOk() const wxOVERRIDE { return true; } protected: - virtual size_t OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; size_t m_currentPos, m_lastPos; - DECLARE_DYNAMIC_CLASS(wxCountingOutputStream) + wxDECLARE_DYNAMIC_CLASS(wxCountingOutputStream); wxDECLARE_NO_COPY_CLASS(wxCountingOutputStream); }; @@ -308,9 +308,9 @@ public: wxFilterInputStream(wxInputStream *stream); virtual ~wxFilterInputStream(); - char Peek() { return m_parent_i_stream->Peek(); } + virtual char Peek() wxOVERRIDE { return m_parent_i_stream->Peek(); } - wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_i_stream->GetLength(); } wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; } @@ -318,7 +318,7 @@ protected: wxInputStream *m_parent_i_stream; bool m_owns; - DECLARE_ABSTRACT_CLASS(wxFilterInputStream) + wxDECLARE_ABSTRACT_CLASS(wxFilterInputStream); wxDECLARE_NO_COPY_CLASS(wxFilterInputStream); }; @@ -330,17 +330,17 @@ public: wxFilterOutputStream(wxOutputStream *stream); virtual ~wxFilterOutputStream(); - wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_parent_o_stream->GetLength(); } wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; } - bool Close(); + bool Close() wxOVERRIDE; protected: wxOutputStream *m_parent_o_stream; bool m_owns; - DECLARE_ABSTRACT_CLASS(wxFilterOutputStream) + wxDECLARE_ABSTRACT_CLASS(wxFilterOutputStream); wxDECLARE_NO_COPY_CLASS(wxFilterOutputStream); }; @@ -372,7 +372,7 @@ public: protected: wxString::size_type FindExtension(const wxString& location) const; - DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase) + wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase); }; class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase @@ -405,7 +405,7 @@ private: static wxFilterClassFactory *sm_first; wxFilterClassFactory *m_next; - DECLARE_ABSTRACT_CLASS(wxFilterClassFactory) + wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactory); }; // ============================================================================ @@ -495,11 +495,6 @@ public: wxInputStream *GetInputStream() const; wxOutputStream *GetOutputStream() const; -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBase *Stream() ); -#endif // WXWIN_COMPATIBILITY_2_6 - // this constructs a dummy wxStreamBuffer, used by (and exists for) // wxMemoryStreams only, don't use! wxStreamBuffer(BufMode mode); @@ -566,27 +561,22 @@ public: virtual ~wxBufferedInputStream(); - char Peek(); - wxInputStream& Read(void *buffer, size_t size); + virtual char Peek() wxOVERRIDE; + virtual wxInputStream& Read(void *buffer, size_t size) wxOVERRIDE; // Position functions - wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellI() const; - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } + virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE; + virtual wxFileOffset TellI() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); } // the buffer given to the stream will be deleted by it void SetInputStreamBuffer(wxStreamBuffer *buffer); wxStreamBuffer *GetInputStreamBuffer() const { return m_i_streambuf; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *InputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: - virtual size_t OnSysRead(void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; wxStreamBuffer *m_i_streambuf; @@ -614,43 +604,32 @@ public: virtual ~wxBufferedOutputStream(); - wxOutputStream& Write(const void *buffer, size_t size); + virtual wxOutputStream& Write(const void *buffer, size_t size) wxOVERRIDE; // Position functions - wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart); - wxFileOffset TellO() const; - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } + virtual wxFileOffset SeekO(wxFileOffset pos, wxSeekMode mode = wxFromStart) wxOVERRIDE; + virtual wxFileOffset TellO() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); } - void Sync(); - bool Close(); + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE; - wxFileOffset GetLength() const; + virtual wxFileOffset GetLength() const wxOVERRIDE; // the buffer given to the stream will be deleted by it void SetOutputStreamBuffer(wxStreamBuffer *buffer); wxStreamBuffer *GetOutputStreamBuffer() const { return m_o_streambuf; } -#if WXWIN_COMPATIBILITY_2_6 - // deprecated, for compatibility only - wxDEPRECATED( wxStreamBuffer *OutputStreamBuffer() const ); -#endif // WXWIN_COMPATIBILITY_2_6 - protected: - virtual size_t OnSysWrite(const void *buffer, size_t bufsize); - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysWrite(const void *buffer, size_t bufsize) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; wxStreamBuffer *m_o_streambuf; wxDECLARE_NO_COPY_CLASS(wxBufferedOutputStream); }; -#if WXWIN_COMPATIBILITY_2_6 - inline wxStreamBase *wxStreamBuffer::Stream() { return m_stream; } - inline wxStreamBuffer *wxBufferedInputStream::InputStreamBuffer() const { return m_i_streambuf; } - inline wxStreamBuffer *wxBufferedOutputStream::OutputStreamBuffer() const { return m_o_streambuf; } -#endif // WXWIN_COMPATIBILITY_2_6 - // --------------------------------------------------------------------------- // wxWrapperInputStream: forwards all IO to another stream. // --------------------------------------------------------------------------- @@ -668,13 +647,13 @@ public: wxWrapperInputStream(wxInputStream* stream); // Override the base class methods to forward to the wrapped stream. - virtual wxFileOffset GetLength() const; - virtual bool IsSeekable() const; + virtual wxFileOffset GetLength() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE; protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - virtual wxFileOffset OnSysTell() const; + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; // Ensure that our own last error is the same as that of the real stream. // diff --git a/Externals/wxWidgets3/include/wx/string.h b/Externals/wxWidgets3/include/wx/string.h index ef1a8d9aa8..c23586e314 100644 --- a/Externals/wxWidgets3/include/wx/string.h +++ b/Externals/wxWidgets3/include/wx/string.h @@ -23,24 +23,15 @@ #include "wx/defs.h" // everybody should include this -#if defined(__WXMAC__) || defined(__VISAGECPP__) +#if defined(__WXMAC__) #include #endif -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 - // problem in VACPP V4 with including stdlib.h multiple times - // strconv includes it anyway -# include -# include -# include -# include -#else -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include #include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc. #include "wx/strvararg.h" @@ -110,15 +101,6 @@ namespace wxPrivate // constants // ---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_6 - -// deprecated in favour of wxString::npos, don't use in new code -// -// maximum possible length for a string means "take all string" everywhere -#define wxSTRING_MAXLEN wxString::npos - -#endif // WXWIN_COMPATIBILITY_2_6 - // --------------------------------------------------------------------------- // global functions complementing standard C string library replacements for // strlen() and portable strcasecmp() @@ -253,106 +235,11 @@ private: friend class WXDLLIMPEXP_FWD_BASE wxString; }; -// ---------------------------------------------------------------------------- -// wxStringPrintfMixin -// --------------------------------------------------------------------------- - -// NB: VC6 has a bug that causes linker errors if you have template methods -// in a class using __declspec(dllimport). The solution is to split such -// class into two classes, one that contains the template methods and does -// *not* use WXDLLIMPEXP_BASE and another class that contains the rest -// (with DLL linkage). -// -// We only do this for VC6 here, because the code is less efficient -// (Printf() has to use dynamic_cast<>) and because OpenWatcom compiler -// cannot compile this code. - -#if defined(__VISUALC__) && __VISUALC__ < 1300 - #define wxNEEDS_WXSTRING_PRINTF_MIXIN -#endif - -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN -// this class contains implementation of wxString's vararg methods, it's -// exported from wxBase DLL -class WXDLLIMPEXP_BASE wxStringPrintfMixinBase -{ -protected: - wxStringPrintfMixinBase() {} - -#if !wxUSE_UTF8_LOCALE_ONLY - int DoPrintfWchar(const wxChar *format, ...); - static wxString DoFormatWchar(const wxChar *format, ...); -#endif -#if wxUSE_UNICODE_UTF8 - int DoPrintfUtf8(const char *format, ...); - static wxString DoFormatUtf8(const char *format, ...); -#endif -}; - -// this class contains template wrappers for wxString's vararg methods, it's -// intentionally *not* exported from the DLL in order to fix the VC6 bug -// described above -class wxStringPrintfMixin : public wxStringPrintfMixinBase -{ -private: - // to further complicate things, we can't return wxString from - // wxStringPrintfMixin::Format() because wxString is not yet declared at - // this point; the solution is to use this fake type trait template - this - // way the compiler won't know the return type until Format() is used - // (this doesn't compile with Watcom, but VC6 compiles it just fine): - template struct StringReturnType - { - typedef wxString type; - }; - -public: - // these are duplicated wxString methods, they're also declared below - // if !wxNEEDS_WXSTRING_PRINTF_MIXIN: - - // static wxString Format(const wString& format, ...) WX_ATTRIBUTE_PRINTF_1; - WX_DEFINE_VARARG_FUNC_SANS_N0(static typename StringReturnType::type, - Format, 1, (const wxFormatString&), - DoFormatWchar, DoFormatUtf8) - // We have to implement the version without template arguments manually - // because of the StringReturnType<> hack, although WX_DEFINE_VARARG_FUNC - // normally does it itself. It has to be a template so that we can use - // the hack, even though there's no real template parameter. We can't move - // it to wxStrig, because it would shadow these versions of Format() then. - template - inline static typename StringReturnType::type - Format(const T& fmt) - { - // NB: this doesn't compile if T is not (some form of) a string; - // this makes Format's prototype equivalent to - // Format(const wxFormatString& fmt) - return DoFormatWchar(wxFormatString(fmt)); - } - - // int Printf(const wxString& format, ...); - WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) - // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; - WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), - DoPrintfWchar, DoPrintfUtf8) - -protected: - wxStringPrintfMixin() : wxStringPrintfMixinBase() {} -}; -#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN - - // ---------------------------------------------------------------------------- // wxString: string class trying to be compatible with std::string, MFC // CString and wxWindows 1.x wxString all at once // --------------------------------------------------------------------------- -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - // "non dll-interface class 'wxStringPrintfMixin' used as base interface - // for dll-interface class 'wxString'" -- this is OK in our case - #pragma warning (push) - #pragma warning (disable:4275) -#endif - #if wxUSE_UNICODE_UTF8 // see the comment near wxString::iterator for why we need this class WXDLLIMPEXP_BASE wxStringIteratorNode @@ -391,9 +278,6 @@ private: #endif // wxUSE_UNICODE_UTF8 class WXDLLIMPEXP_BASE wxString -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - : public wxStringPrintfMixin -#endif { // NB: special care was taken in arranging the member functions in such order // that all inline functions can be effectively inlined, verify that all @@ -1157,7 +1041,7 @@ public: reverse_iterator_impl operator-=(ptrdiff_t n) { m_cur += n; return *this; } - unsigned operator-(const reverse_iterator_impl& i) const + difference_type operator-(const reverse_iterator_impl& i) const { return i.m_cur - m_cur; } bool operator==(const reverse_iterator_impl& ri) const @@ -1647,13 +1531,8 @@ public: // also optionally return the buffer length // // this is mostly/only useful for the template functions - // - // FIXME-VC6: the second argument only exists for VC6 which doesn't support - // explicit template function selection, do not use it unless - // you must support VC6! template - wxCharTypeBuffer tchar_str(size_t *len = NULL, - T * WXUNUSED(dummy) = NULL) const + wxCharTypeBuffer tchar_str(size_t *len = NULL) const { #if wxUSE_UNICODE // we need a helper dispatcher depending on type @@ -1677,13 +1556,13 @@ public: static wxString FromAscii(const char *ascii, size_t len); static wxString FromAscii(const char *ascii); static wxString FromAscii(char ascii); - const wxScopedCharBuffer ToAscii() const; + const wxScopedCharBuffer ToAscii(char replaceWith = '_') const; #else // ANSI static wxString FromAscii(const char *ascii) { return wxString( ascii ); } static wxString FromAscii(const char *ascii, size_t len) { return wxString( ascii, len ); } static wxString FromAscii(char ascii) { return wxString( ascii ); } - const char *ToAscii() const { return c_str(); } + const char *ToAscii(char WXUNUSED(replaceWith) = '_') const { return c_str(); } #endif // Unicode/!Unicode // also provide unsigned char overloads as signed/unsigned doesn't matter @@ -2294,45 +2173,19 @@ public: // in C locale static wxString FromCDouble(double val, int precision = -1); -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // formatted input/output // as sprintf(), returns the number of characters written or < 0 on error // (take 'this' into account in attribute parameter count) // int Printf(const wxString& format, ...); WX_DEFINE_VARARG_FUNC(int, Printf, 1, (const wxFormatString&), DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, Printf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif // !wxNEEDS_WXSTRING_PRINTF_MIXIN // as vprintf(), returns the number of characters written or < 0 on error int PrintfV(const wxString& format, va_list argptr); -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // returns the string containing the result of Printf() to it // static wxString Format(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_1; WX_DEFINE_VARARG_FUNC(static wxString, Format, 1, (const wxFormatString&), DoFormatWchar, DoFormatUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(static wxString, Format, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif // the same as above, but takes a va_list static wxString FormatV(const wxString& format, va_list argptr); @@ -2364,24 +2217,11 @@ public: // values for first parameter of Strip function enum stripType {leading = 0x1, trailing = 0x2, both = 0x3}; -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN // use Printf() // (take 'this' into account in attribute parameter count) // int sprintf(const wxString& format, ...) WX_ATTRIBUTE_PRINTF_2; WX_DEFINE_VARARG_FUNC(int, sprintf, 1, (const wxFormatString&), DoPrintfWchar, DoPrintfUtf8) -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxString&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wxCStrData&), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const char*), - (wxFormatString(f1))); - WX_VARARG_WATCOM_WORKAROUND(int, sprintf, 1, (const wchar_t*), - (wxFormatString(f1))); -#endif -#endif // wxNEEDS_WXSTRING_PRINTF_MIXIN // use Cmp() int CompareTo(const wxChar* psz, caseCompare cmp = exact) const @@ -2863,16 +2703,12 @@ public: return iterator(this, m_impl.erase(first.impl())); } -#ifdef wxSTRING_BASE_HASNT_CLEAR - void clear() { erase(); } -#else void clear() { wxSTRING_SET_CACHED_LENGTH(0); m_impl.clear(); } -#endif // replaces the substring of length nLen starting at nStart wxString& replace(size_t nStart, size_t nLen, const char* sz) @@ -3454,7 +3290,6 @@ private: } #endif // !wxUSE_STL_BASED_WXSTRING -#ifndef wxNEEDS_WXSTRING_PRINTF_MIXIN #if !wxUSE_UTF8_LOCALE_ONLY int DoPrintfWchar(const wxChar *format, ...); static wxString DoFormatWchar(const wxChar *format, ...); @@ -3463,7 +3298,6 @@ private: int DoPrintfUtf8(const char *format, ...); static wxString DoFormatUtf8(const char *format, ...); #endif -#endif #if !wxUSE_STL_BASED_WXSTRING // check string's data validity @@ -3608,10 +3442,6 @@ private: friend class wxStringInternalBufferLength; }; -#ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN - #pragma warning (pop) -#endif - // string iterator operators that satisfy STL Random Access Iterator // requirements: inline wxString::iterator operator+(ptrdiff_t n, wxString::iterator i) @@ -3787,10 +3617,8 @@ public: // access to wxString internal buffer, initialize ourselves with the // string initial contents - // FIXME-VC6: remove the ugly (CharType *)NULL and use normal - // tchar_str size_t len; - const wxCharTypeBuffer buf(str.tchar_str(&len, (CharType *)NULL)); + const wxCharTypeBuffer buf(str.tchar_str(&len)); if ( buf ) { if ( len > lenWanted ) @@ -3870,8 +3698,6 @@ public: #if wxUSE_STL_BASED_WXSTRING -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase ) - class wxStringInternalBuffer : public wxStringTypeBufferBase { public: @@ -3883,9 +3709,6 @@ public: wxDECLARE_NO_COPY_CLASS(wxStringInternalBuffer); }; -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( - wxStringTypeBufferLengthBase ) - class wxStringInternalBufferLength : public wxStringTypeBufferLengthBase { @@ -3917,8 +3740,6 @@ typedef wxStringInternalBuffer wxUTF8StringBuffer; typedef wxStringInternalBufferLength wxUTF8StringBufferLength; #elif wxUSE_UNICODE_WCHAR -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferBase ) - // Note about inlined dtors in the classes below: this is done not for // performance reasons but just to avoid linking errors in the MSVC DLL build // under Windows: if a class has non-inline methods it must be declared as @@ -3951,8 +3772,6 @@ public: wxDECLARE_NO_COPY_CLASS(wxUTF8StringBuffer); }; -WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxStringTypeBufferLengthBase ) - class wxUTF8StringBufferLength : public wxStringTypeBufferLengthBase { public: @@ -4096,6 +3915,40 @@ wxDEFINE_ALL_COMPARISONS(const char *, const wxCStrData&, wxCMP_CHAR_CSTRDATA) #undef wxCMP_CHAR_CSTRDATA #undef wxCMP_WCHAR_CSTRDATA +// ---------------------------------------------------------------------------- +// Implement hashing using C++11 std::hash<>. +// ---------------------------------------------------------------------------- + +// Check for both compiler and standard library support for C++11: normally the +// former implies the latter but under Mac OS X < 10.7 C++11 compiler can (and +// even has to be) used with non-C++11 standard library, so explicitly exclude +// this case. +#if (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(10)) \ + && ( (!defined __GLIBCXX__) || (__GLIBCXX__ > 20070719) ) + +// Don't do this if ToStdWstring() is not available. We could work around it +// but, presumably, if using std::wstring is undesirable, then so is using +// std::hash<> anyhow. +#if wxUSE_STD_STRING + +#include + +namespace std +{ + template<> + struct hash + { + size_t operator()(const wxString& s) const + { + return std::hash()(s.ToStdWstring()); + } + }; +} // namespace std + +#endif // wxUSE_STD_STRING + +#endif // C++11 + // --------------------------------------------------------------------------- // Implementation only from here until the end of file // --------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/stringimpl.h b/Externals/wxWidgets3/include/wx/stringimpl.h index 50d4af9c64..e46bb800de 100644 --- a/Externals/wxWidgets3/include/wx/stringimpl.h +++ b/Externals/wxWidgets3/include/wx/stringimpl.h @@ -87,13 +87,6 @@ extern WXDLLIMPEXP_DATA_BASE(const wxStringCharType*) wxEmptyStringImpl; #undef wxUSE_STD_STRING #define wxUSE_STD_STRING 1 - // the versions of std::string included with gcc 2.95 and VC6 (for which - // _MSC_VER == 1200) and eVC4 (_MSC_VER == 1201) lack clear() method - #if (defined(__GNUG__) && (__GNUG__ < 3)) || \ - !wxCHECK_VISUALC_VERSION(7) || defined(__EVC4__) - #define wxSTRING_BASE_HASNT_CLEAR - #endif - typedef wxStdString wxStringImpl; #else // if !wxUSE_STL_BASED_WXSTRING @@ -122,7 +115,7 @@ struct WXDLLIMPEXP_BASE wxStringData void Lock() { if ( !IsEmpty() ) nRefs++; } // VC++ will refuse to inline Unlock but profiling shows that it is wrong -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) +#if defined(__VISUALC__) __forceinline #endif // VC++ free must take place in same DLL as allocation when using non dll @@ -334,7 +327,7 @@ public: { return wxStdString(c_str(), length()); } #endif -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) +#if defined(__VISUALC__) // disable warning about Unlock() below not being inlined (first, it // seems to be inlined nevertheless and second, even if it isn't, there // is nothing we can do about this @@ -348,7 +341,7 @@ public: GetStringData()->Unlock(); } -#if defined(__VISUALC__) && (__VISUALC__ >= 1200) +#if defined(__VISUALC__) #pragma warning(pop) #endif diff --git a/Externals/wxWidgets3/include/wx/strvararg.h b/Externals/wxWidgets3/include/wx/strvararg.h index 6562ee3150..468cbf8bbb 100644 --- a/Externals/wxWidgets3/include/wx/strvararg.h +++ b/Externals/wxWidgets3/include/wx/strvararg.h @@ -11,9 +11,6 @@ #define _WX_STRVARARG_H_ #include "wx/platform.h" -#if wxONLY_WATCOM_EARLIER_THAN(1,4) - #error "OpenWatcom version >= 1.4 is required to compile this code" -#endif #include "wx/cpp.h" #include "wx/chartype.h" @@ -155,6 +152,9 @@ public: // a char* string is also a pointer and an integer is also a char. enum ArgumentType { + Arg_Unused = 0, // not used at all; the value of 0 is chosen to + // conveniently pass wxASSERT_ARG_TYPE's check + Arg_Char = 0x0001, // character as char %c Arg_Pointer = 0x0002, // %p Arg_String = 0x0004 | Arg_Pointer, // any form of string (%s and %p too) @@ -1156,67 +1156,4 @@ private: inline void name(_WX_VARARG_FIXED_UNUSED_EXPAND(numfixed, fixed)) \ {} - -// ---------------------------------------------------------------------------- -// workaround for OpenWatcom bug #351 -// ---------------------------------------------------------------------------- - -#ifdef __WATCOMC__ -// workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - -// This macro can be used to forward a 'vararg' template to another one with -// different fixed arguments types. Parameters are same as for -// WX_DEFINE_VARARG_FUNC (rettype=void can be used here), 'convfixed' is how -// to convert fixed arguments. For example, this is typical code for dealing -// with different forms of format string: -// -// WX_DEFINE_VARARG_FUNC_VOID(Printf, 1, (const wxFormatString&), -// DoPrintfWchar, DoPrintfUtf8) -// #ifdef __WATCOMC__ -// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const wxString&), -// (wxFormatString(f1))) -// WX_VARARG_WATCOM_WORKAROUND(void, Printf, 1, (const char*), -// (wxFormatString(f1))) -// ... -#define WX_VARARG_WATCOM_WORKAROUND(rettype, name, numfixed, fixed, convfixed)\ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_WATCOM_WORKAROUND, \ - rettype, name, convfixed, dummy, numfixed, fixed) - -#define WX_VARARG_WATCOM_WORKAROUND_CTOR(name, numfixed, fixed, convfixed) \ - _WX_VARARG_ITER(_WX_VARARG_MAX_ARGS, \ - _WX_VARARG_WATCOM_WORKAROUND_CTOR, \ - dummy, name, convfixed, dummy, numfixed, fixed) - -#define _WX_VARARG_WATCOM_UNPACK_1(a1) a1 -#define _WX_VARARG_WATCOM_UNPACK_2(a1, a2) a1, a2 -#define _WX_VARARG_WATCOM_UNPACK_3(a1, a2, a3) a1, a2, a3 -#define _WX_VARARG_WATCOM_UNPACK_4(a1, a2, a3, a4) a1, a2, a3, a4 -#define _WX_VARARG_WATCOM_UNPACK(N, convfixed) \ - _WX_VARARG_WATCOM_UNPACK_##N convfixed - -#define _WX_VARARG_PASS_WATCOM(i) a##i - -#define _WX_VARARG_WATCOM_WORKAROUND(N, rettype, name, \ - convfixed, dummy, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - rettype name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - return name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \ - } - -#define _WX_VARARG_WATCOM_WORKAROUND_CTOR(N, dummy1, name, \ - convfixed, dummy2, numfixed, fixed) \ - template<_WX_VARARG_JOIN(N, _WX_VARARG_TEMPL)> \ - name(_WX_VARARG_FIXED_EXPAND(numfixed, fixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_ARG)) \ - { \ - name(_WX_VARARG_WATCOM_UNPACK(numfixed, convfixed), \ - _WX_VARARG_JOIN(N, _WX_VARARG_PASS_WATCOM)); \ - } - -#endif // __WATCOMC__ - #endif // _WX_STRVARARG_H_ diff --git a/Externals/wxWidgets3/include/wx/systhemectrl.h b/Externals/wxWidgets3/include/wx/systhemectrl.h new file mode 100644 index 0000000000..0b9a9ab6ba --- /dev/null +++ b/Externals/wxWidgets3/include/wx/systhemectrl.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/systhemectrl.h +// Purpose: Class to make controls appear in the systems theme +// Author: Tobias Taschner +// Created: 2014-08-14 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SYSTHEMECTRL_H +#define _WX_SYSTHEMECTRL_H + +#include "wx/defs.h" + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_CORE wxSystemThemedControlBase +{ +public: + wxSystemThemedControlBase() { } + + virtual ~wxSystemThemedControlBase() { } + +protected: + // This method is virtual and can be overridden, e.g. composite controls do + // it to enable the system theme for all of their parts. + virtual void DoEnableSystemTheme(bool enable, wxWindow* window); + + wxDECLARE_NO_COPY_CLASS(wxSystemThemedControlBase); +}; + +// This class used CRTP, i.e. it should be instantiated for the real base class +// and inherited from. +template +class wxSystemThemedControl : public C, + public wxSystemThemedControlBase +{ +public: + wxSystemThemedControl() { } + + void EnableSystemTheme(bool enable = true) + { + DoEnableSystemTheme(enable, this); + } + +protected: + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxSystemThemedControl, C); +}; + +// Only __WXMSW__ has a non-trivial implementation currently. +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #define wxHAS_SYSTEM_THEMED_CONTROL +#endif + +#ifndef wxHAS_SYSTEM_THEMED_CONTROL + +inline void +wxSystemThemedControlBase::DoEnableSystemTheme(bool WXUNUSED(enable), + wxWindow* WXUNUSED(window)) +{ + // Nothing to do. +} + +#endif // !wxHAS_SYSTEM_THEMED_CONTROL + +#endif // _WX_SYSTHEMECTRL_H diff --git a/Externals/wxWidgets3/include/wx/tarstrm.h b/Externals/wxWidgets3/include/wx/tarstrm.h index 906d4383ec..37a1ab3a99 100644 --- a/Externals/wxWidgets3/include/wx/tarstrm.h +++ b/Externals/wxWidgets3/include/wx/tarstrm.h @@ -68,15 +68,15 @@ public: wxTarEntry& operator=(const wxTarEntry& entry); // Get accessors - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; - wxString GetInternalName() const { return m_Name; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE; + wxString GetInternalName() const wxOVERRIDE { return m_Name; } + wxPathFormat GetInternalFormat() const wxOVERRIDE { return wxPATH_UNIX; } int GetMode() const; int GetUserId() const { return m_UserId; } int GetGroupId() const { return m_GroupId; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxDateTime GetDateTime() const { return m_ModifyTime; } + wxFileOffset GetSize() const wxOVERRIDE { return m_Size; } + wxFileOffset GetOffset() const wxOVERRIDE { return m_Offset; } + wxDateTime GetDateTime() const wxOVERRIDE { return m_ModifyTime; } wxDateTime GetAccessTime() const { return m_AccessTime; } wxDateTime GetCreateTime() const { return m_CreateTime; } int GetTypeFlag() const { return m_TypeFlag; } @@ -87,16 +87,16 @@ public: int GetDevMinor() const { return m_DevMinor; } // is accessors - bool IsDir() const; - bool IsReadOnly() const { return !(m_Mode & 0222); } + bool IsDir() const wxOVERRIDE; + bool IsReadOnly() const wxOVERRIDE { return !(m_Mode & 0222); } // set accessors - void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE); + void SetName(const wxString& name, wxPathFormat format = wxPATH_NATIVE) wxOVERRIDE; void SetUserId(int id) { m_UserId = id; } void SetGroupId(int id) { m_GroupId = id; } void SetMode(int mode); - void SetSize(wxFileOffset size) { m_Size = size; } - void SetDateTime(const wxDateTime& dt) { m_ModifyTime = dt; } + void SetSize(wxFileOffset size) wxOVERRIDE { m_Size = size; } + void SetDateTime(const wxDateTime& dt) wxOVERRIDE { m_ModifyTime = dt; } void SetAccessTime(const wxDateTime& dt) { m_AccessTime = dt; } void SetCreateTime(const wxDateTime& dt) { m_CreateTime = dt; } void SetTypeFlag(int type) { m_TypeFlag = type; } @@ -107,8 +107,8 @@ public: void SetDevMinor(int dev) { m_DevMinor = dev; } // set is accessors - void SetIsDir(bool isDir = true); - void SetIsReadOnly(bool isReadOnly = true); + void SetIsDir(bool isDir = true) wxOVERRIDE; + void SetIsReadOnly(bool isReadOnly = true) wxOVERRIDE; static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, @@ -119,9 +119,9 @@ public: void SetNotifier(wxTarNotifier& WXUNUSED(notifier)) { } private: - void SetOffset(wxFileOffset offset) { m_Offset = offset; } + void SetOffset(wxFileOffset offset) wxOVERRIDE { m_Offset = offset; } - virtual wxArchiveEntry* DoClone() const { return Clone(); } + virtual wxArchiveEntry* DoClone() const wxOVERRIDE { return Clone(); } wxString m_Name; int m_Mode; @@ -142,7 +142,7 @@ private: friend class wxTarInputStream; - DECLARE_DYNAMIC_CLASS(wxTarEntry) + wxDECLARE_DYNAMIC_CLASS(wxTarEntry); }; @@ -161,23 +161,23 @@ public: virtual ~wxTarInputStream(); bool OpenEntry(wxTarEntry& entry); - bool CloseEntry(); + bool CloseEntry() wxOVERRIDE; wxTarEntry *GetNextEntry(); - wxFileOffset GetLength() const { return m_size; } - bool IsSeekable() const { return m_parent_i_stream->IsSeekable(); } + wxFileOffset GetLength() const wxOVERRIDE { return m_size; } + bool IsSeekable() const wxOVERRIDE { return m_parent_i_stream->IsSeekable(); } protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode); + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) wxOVERRIDE; private: void Init(); - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } - bool OpenEntry(wxArchiveEntry& entry); + wxArchiveEntry *DoGetNextEntry() wxOVERRIDE { return GetNextEntry(); } + bool OpenEntry(wxArchiveEntry& entry) wxOVERRIDE; bool IsOpened() const { return m_pos != wxInvalidOffset; } wxStreamError ReadHeaders(); @@ -221,34 +221,34 @@ public: bool PutNextEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); + wxFileOffset size = wxInvalidOffset) wxOVERRIDE; bool PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); + const wxDateTime& dt = wxDateTime::Now()) wxOVERRIDE; bool CopyEntry(wxTarEntry *entry, wxTarInputStream& inputStream); bool CopyArchiveMetaData(wxTarInputStream& WXUNUSED(s)) { return true; } - void Sync(); - bool CloseEntry(); - bool Close(); + void Sync() wxOVERRIDE; + bool CloseEntry() wxOVERRIDE; + bool Close() wxOVERRIDE; - bool IsSeekable() const { return m_parent_o_stream->IsSeekable(); } + bool IsSeekable() const wxOVERRIDE { return m_parent_o_stream->IsSeekable(); } void SetBlockingFactor(int factor) { m_BlockingFactor = factor; } int GetBlockingFactor() const { return m_BlockingFactor; } protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } + wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; private: void Init(wxTarFormat format); - bool PutNextEntry(wxArchiveEntry *entry); - bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) { return true; } + bool PutNextEntry(wxArchiveEntry *entry) wxOVERRIDE; + bool CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) wxOVERRIDE; + bool CopyArchiveMetaData(wxArchiveInputStream& WXUNUSED(s)) wxOVERRIDE { return true; } bool IsOpened() const { return m_pos != wxInvalidOffset; } bool WriteHeaders(wxTarEntry& entry); @@ -325,26 +325,26 @@ public: { return new wxTarOutputStream(stream, wxTAR_PAX, GetConv()); } wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const + wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE { return wxTarEntry::GetInternalName(name, format); } const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; + = wxSTREAM_PROTOCOL) const wxOVERRIDE; protected: - wxArchiveEntry *DoNewEntry() const + wxArchiveEntry *DoNewEntry() const wxOVERRIDE { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const wxOVERRIDE { return NewStream(stream); } private: - DECLARE_DYNAMIC_CLASS(wxTarClassFactory) + wxDECLARE_DYNAMIC_CLASS(wxTarClassFactory); }; diff --git a/Externals/wxWidgets3/include/wx/taskbar.h b/Externals/wxWidgets3/include/wx/taskbar.h index 4a81088b01..84b1c1dec6 100644 --- a/Externals/wxWidgets3/include/wx/taskbar.h +++ b/Externals/wxWidgets3/include/wx/taskbar.h @@ -43,7 +43,7 @@ class WXDLLIMPEXP_ADV wxTaskBarIconBase : public wxEvtHandler public: wxTaskBarIconBase() { } -#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXQT__) static bool IsAvailable(); #else static bool IsAvailable() { return true; } @@ -66,7 +66,7 @@ private: // default events handling, calls CreatePopupMenu: void OnRightButtonDown(wxTaskBarIconEvent& event); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTaskBarIconBase); }; @@ -83,8 +83,8 @@ private: #include "wx/unix/taskbarx11.h" #elif defined (__WXMAC__) #include "wx/osx/taskbarosx.h" -#elif defined (__WXCOCOA__) - #include "wx/cocoa/taskbar.h" +#elif defined (__WXQT__) + #include "wx/qt/taskbar.h" #endif // ---------------------------------------------------------------------------- @@ -100,7 +100,7 @@ public: SetEventObject(tbIcon); } - virtual wxEvent *Clone() const { return new wxTaskBarIconEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTaskBarIconEvent(*this); } private: wxDECLARE_NO_ASSIGN_CLASS(wxTaskBarIconEvent); diff --git a/Externals/wxWidgets3/include/wx/taskbarbutton.h b/Externals/wxWidgets3/include/wx/taskbarbutton.h new file mode 100644 index 0000000000..68759d21f3 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/taskbarbutton.h @@ -0,0 +1,253 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/taskbarbutton.h +// Purpose: Defines wxTaskBarButton class for manipulating buttons on the +// windows taskbar. +// Author: Chaobin Zhang +// Created: 2014-04-30 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TASKBARBUTTON_H_ +#define _WX_TASKBARBUTTON_H_ + +#include "wx/defs.h" + +#if wxUSE_TASKBARBUTTON + +#include "wx/icon.h" +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_CORE wxTaskBarButton; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListCategory; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpList; +class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl; + +// ---------------------------------------------------------------------------- +// wxTaskBarButton: define wxTaskBarButton interface. +// ---------------------------------------------------------------------------- + +/** + State of the task bar button. +*/ +enum wxTaskBarButtonState +{ + wxTASKBAR_BUTTON_NO_PROGRESS = 0, + wxTASKBAR_BUTTON_INDETERMINATE = 1, + wxTASKBAR_BUTTON_NORMAL = 2, + wxTASKBAR_BUTTON_ERROR = 4, + wxTASKBAR_BUTTON_PAUSED = 8 +}; + +class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject +{ +public: + wxThumbBarButton() : m_taskBarButtonParent(NULL) + { } + + wxThumbBarButton(int id, + const wxIcon& icon, + const wxString& tooltip = wxString(), + bool enable = true, + bool dismissOnClick = false, + bool hasBackground = true, + bool shown = true, + bool interactive = true); + + bool Create(int id, + const wxIcon& icon, + const wxString& tooltip = wxString(), + bool enable = true, + bool dismissOnClick = false, + bool hasBackground = true, + bool shown = true, + bool interactive = true); + int GetID() const { return m_id; } + const wxIcon& GetIcon() const { return m_icon; } + const wxString& GetTooltip() const { return m_tooltip; } + + bool IsEnable() const { return m_enable; } + void Enable(bool enable = true); + void Disable() { Enable(false); } + + bool IsDismissOnClick() const { return m_dismissOnClick; } + void EnableDismissOnClick(bool enable = true); + void DisableDimissOnClick() { EnableDismissOnClick(false); } + + bool HasBackground() const { return m_hasBackground; } + void SetHasBackground(bool has = true); + + bool IsShown() const { return m_shown; } + void Show(bool shown = true); + void Hide() { Show(false); } + + bool IsInteractive() const { return m_interactive; } + void SetInteractive(bool interactive = true); + + void SetParent(wxTaskBarButton *parent) { m_taskBarButtonParent = parent; } + wxTaskBarButton* GetParent() const { return m_taskBarButtonParent; } + +private: + bool UpdateParentTaskBarButton(); + + int m_id; + wxIcon m_icon; + wxString m_tooltip; + bool m_enable; + bool m_dismissOnClick; + bool m_hasBackground; + bool m_shown; + bool m_interactive; + wxTaskBarButton *m_taskBarButtonParent; + + wxDECLARE_DYNAMIC_CLASS(wxThumbBarButton); +}; + +class WXDLLIMPEXP_CORE wxTaskBarButton +{ +public: + // Factory function, may return NULL if task bar buttons are not supported + // by the current system. + static wxTaskBarButton* New(wxWindow* parent); + + virtual ~wxTaskBarButton() { } + + // Operations: + virtual void SetProgressRange(int range) = 0; + virtual void SetProgressValue(int value) = 0; + virtual void PulseProgress() = 0; + virtual void Show(bool show = true) = 0; + virtual void Hide() = 0; + virtual void SetThumbnailTooltip(const wxString& tooltip) = 0; + virtual void SetProgressState(wxTaskBarButtonState state) = 0; + virtual void SetOverlayIcon(const wxIcon& icon, + const wxString& description = wxString()) = 0; + virtual void SetThumbnailClip(const wxRect& rect) = 0; + virtual void SetThumbnailContents(const wxWindow *child) = 0; + virtual bool InsertThumbBarButton(size_t pos, wxThumbBarButton *button) = 0; + virtual bool AppendThumbBarButton(wxThumbBarButton *button) = 0; + virtual bool AppendSeparatorInThumbBar() = 0; + virtual wxThumbBarButton* RemoveThumbBarButton(wxThumbBarButton *button) = 0; + virtual wxThumbBarButton* RemoveThumbBarButton(int id) = 0; + virtual void Realize() = 0; + +protected: + wxTaskBarButton() { } + +private: + wxDECLARE_NO_COPY_CLASS(wxTaskBarButton); +}; + +enum wxTaskBarJumpListItemType +{ + wxTASKBAR_JUMP_LIST_SEPARATOR, + wxTASKBAR_JUMP_LIST_TASK, + wxTASKBAR_JUMP_LIST_DESTIONATION +}; + +class WXDLLIMPEXP_CORE wxTaskBarJumpListItem +{ +public: + wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parentCategory = NULL, + wxTaskBarJumpListItemType type = wxTASKBAR_JUMP_LIST_SEPARATOR, + const wxString& title = wxEmptyString, + const wxString& filePath = wxEmptyString, + const wxString& arguments = wxEmptyString, + const wxString& tooltip = wxEmptyString, + const wxString& iconPath = wxEmptyString, + int iconIndex = 0); + + wxTaskBarJumpListItemType GetType() const; + void SetType(wxTaskBarJumpListItemType type); + const wxString& GetTitle() const; + void SetTitle(const wxString& title); + const wxString& GetFilePath() const; + void SetFilePath(const wxString& filePath); + const wxString& GetArguments() const; + void SetArguments(const wxString& arguments); + const wxString& GetTooltip() const; + void SetTooltip(const wxString& tooltip); + const wxString& GetIconPath() const; + void SetIconPath(const wxString& iconPath); + int GetIconIndex() const; + void SetIconIndex(int iconIndex); + wxTaskBarJumpListCategory* GetCategory() const; + void SetCategory(wxTaskBarJumpListCategory *category); + +private: + wxTaskBarJumpListCategory *m_parentCategory; + wxTaskBarJumpListItemType m_type; + wxString m_title; + wxString m_filePath; + wxString m_arguments; + wxString m_tooltip; + wxString m_iconPath; + int m_iconIndex; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListItem); +}; + +typedef wxVector wxTaskBarJumpListItems; + +class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory +{ +public: + wxTaskBarJumpListCategory(wxTaskBarJumpList *parent = NULL, + const wxString& title = wxEmptyString); + virtual ~wxTaskBarJumpListCategory(); + + wxTaskBarJumpListItem* Append(wxTaskBarJumpListItem *item); + void Delete(wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* Remove(wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* FindItemByPosition(size_t pos) const; + wxTaskBarJumpListItem* Insert(size_t pos, wxTaskBarJumpListItem *item); + wxTaskBarJumpListItem* Prepend(wxTaskBarJumpListItem *item); + void SetTitle(const wxString& title); + const wxString& GetTitle() const; + const wxTaskBarJumpListItems& GetItems() const; + +private: + friend class wxTaskBarJumpListItem; + + void Update(); + + wxTaskBarJumpList *m_parent; + wxTaskBarJumpListItems m_items; + wxString m_title; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListCategory); +}; + +typedef wxVector wxTaskBarJumpListCategories; + +class WXDLLIMPEXP_CORE wxTaskBarJumpList +{ +public: + wxTaskBarJumpList(const wxString& appID = wxEmptyString); + virtual ~wxTaskBarJumpList(); + void ShowRecentCategory(bool shown = true); + void HideRecentCategory(); + void ShowFrequentCategory(bool shown = true); + void HideFrequentCategory(); + + wxTaskBarJumpListCategory& GetTasks() const; + const wxTaskBarJumpListCategory& GetFrequentCategory() const; + const wxTaskBarJumpListCategory& GetRecentCategory() const; + const wxTaskBarJumpListCategories& GetCustomCategories() const; + + void AddCustomCategory(wxTaskBarJumpListCategory* category); + wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title); + void DeleteCustomCategory(const wxString& title); + +private: + friend class wxTaskBarJumpListCategory; + + void Update(); + wxTaskBarJumpListImpl *m_jumpListImpl; + + wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpList); +}; + +#endif // wxUSE_TASKBARBUTTON + +#endif // _WX_TASKBARBUTTON_H_ diff --git a/Externals/wxWidgets3/include/wx/tbarbase.h b/Externals/wxWidgets3/include/wx/tbarbase.h index c9ff7f430c..145803ec4b 100644 --- a/Externals/wxWidgets3/include/wx/tbarbase.h +++ b/Externals/wxWidgets3/include/wx/tbarbase.h @@ -177,8 +177,8 @@ public: void Toggle() { Toggle(!IsToggled()); } - virtual void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } - virtual void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } + void SetNormalBitmap(const wxBitmap& bmp) { m_bmpNormal = bmp; } + void SetDisabledBitmap(const wxBitmap& bmp) { m_bmpDisabled = bmp; } virtual void SetLabel(const wxString& label) { m_label = label; } @@ -265,7 +265,7 @@ protected: wxMenu *m_dropdownMenu; #endif - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToolBarToolBase); }; // a list of toolbar tools @@ -597,10 +597,10 @@ public: // ------------------------------- // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) - virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) ; + virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) wxOVERRIDE ; // don't want toolbars to accept the focus - virtual bool AcceptsFocus() const { return false; } + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } #if wxUSE_MENUS // Set dropdown menu @@ -609,7 +609,7 @@ public: protected: // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } // to implement in derived classes // ------------------------------- @@ -695,7 +695,7 @@ protected: wxCoord m_defaultWidth, m_defaultHeight; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxToolBarBase); }; diff --git a/Externals/wxWidgets3/include/wx/testing.h b/Externals/wxWidgets3/include/wx/testing.h index 57d9d0990c..bc8e603394 100644 --- a/Externals/wxWidgets3/include/wx/testing.h +++ b/Externals/wxWidgets3/include/wx/testing.h @@ -34,8 +34,31 @@ class WXDLLIMPEXP_FWD_CORE wxFileDialogBase; #include "wx/msgdlg.h" #include "wx/filedlg.h" +#include + class wxTestingModalHook; +// This helper is used to construct the best possible name for the dialog of +// the given type using wxRTTI for this type, if any, and the C++ RTTI for +// either the type T statically or the dynamic type of "dlg" if it's non-null. +template +wxString wxGetDialogClassDescription(const wxClassInfo *ci, T* dlg = NULL) +{ + // We prefer to use the name from wxRTTI as it's guaranteed to be readable, + // unlike the name returned by type_info::name() which may need to be + // demangled, but if wxRTTI macros were not used for this object, it's + // better to return a not-very-readable-but-informative mangled name rather + // than a readable but useless "wxDialog". + if ( ci == wxCLASSINFO(wxDialog) ) + { + return wxString::Format("dialog of type \"%s\"", + (dlg ? typeid(*dlg) : typeid(T)).name()); + } + + // We consider that an unmangled name is clear enough to be used on its own. + return ci->GetClassName(); +} + // Non-template base class for wxExpectModal (via wxExpectModalBase). // Only used internally. class wxModalExpectation @@ -44,37 +67,72 @@ public: wxModalExpectation() : m_isOptional(false) {} virtual ~wxModalExpectation() {} + wxString GetDescription() const + { + return m_description.empty() ? GetDefaultDescription() : m_description; + } + bool IsOptional() const { return m_isOptional; } virtual int Invoke(wxDialog *dlg) const = 0; - virtual wxString GetDescription() const = 0; - protected: + // Override to return the default description of the expected dialog used + // if no specific description for this particular expectation is given. + virtual wxString GetDefaultDescription() const = 0; + + // User-provided description of the dialog, may be empty. + wxString m_description; + // Is this dialog optional, i.e. not required to be shown? bool m_isOptional; }; -// This must be specialized for each type. The specialization MUST be derived -// from wxExpectModalBase. -template class wxExpectModal {}; +// This template is specialized for some of the standard dialog classes and can +// also be specialized outside of the library for the custom dialogs. +// +// All specializations must derive from wxExpectModalBase. +template class wxExpectModal; /** - Base class for wxExpectModal specializations. + Base class for the expectation of a dialog of the given type T. - Every such specialization must be derived from wxExpectModalBase; there's - no other use for this class than to serve as wxExpectModal's base class. + Test code can derive ad hoc classes from this class directly and implement + its OnInvoked() to perform the necessary actions or derive wxExpectModal + and implement it once if the implementation of OnInvoked() is always the + same, i.e. depends just on the type T. - T must be a class derived from wxDialog. + T must be a class derived from wxDialog and E is the derived class type, + i.e. this is an example of using CRTP. The default value of E is fine in + case you're using this class as a base for your wxExpectModal<> + specialization anyhow but also if you don't use neither Optional() nor + Describe() methods, as the derived class type is only needed for them. */ -template +template > class wxExpectModalBase : public wxModalExpectation { public: typedef T DialogType; - typedef wxExpectModal ExpectationType; + typedef E ExpectationType; + + + // A note about these "modifier" methods: they return copies of this object + // and not a reference to the object itself (after modifying it) because + // this object is likely to be temporary and will be destroyed soon, while + // the new temporary created by these objects is bound to a const reference + // inside WX_TEST_IMPL_ADD_EXPECTATION() macro ensuring that its lifetime + // is prolonged until we can check if the expectations were met. + // + // This is also the reason these methods must be in this class and use + // CRTP: a copy of this object can't be created in the base class, which is + // abstract, and the copy must have the same type as the derived object to + // avoid slicing. + // + // Make sure you understand this comment in its entirety before considering + // modifying this code. + /** Returns a copy of the expectation where the expected dialog is marked @@ -90,6 +148,20 @@ public: return e; } + /** + Sets a description shown in the error message if the expectation fails. + + Using this method with unique descriptions for the different dialogs is + recommended to make it easier to find out which one of the expected + dialogs exactly was not shown. + */ + ExpectationType Describe(const wxString& description) const + { + ExpectationType e(*static_cast(this)); + e.m_description = description; + return e; + } + protected: virtual int Invoke(wxDialog *dlg) const { @@ -101,9 +173,9 @@ protected: } /// Returns description of the expected dialog (by default, its class). - virtual wxString GetDescription() const + virtual wxString GetDefaultDescription() const { - return wxCLASSINFO(T)->GetClassName(); + return wxGetDialogClassDescription(wxCLASSINFO(T)); } /** @@ -117,11 +189,12 @@ protected: // wxExpectModal specializations for common dialogs: -template<> -class wxExpectModal : public wxExpectModalBase +template +class wxExpectDismissableModal + : public wxExpectModalBase > { public: - wxExpectModal(int id) + explicit wxExpectDismissableModal(int id) { switch ( id ) { @@ -147,7 +220,7 @@ public: } protected: - virtual int OnInvoked(wxMessageDialog *WXUNUSED(dlg)) const + virtual int OnInvoked(T *WXUNUSED(dlg)) const { return m_id; } @@ -155,6 +228,55 @@ protected: int m_id; }; +template<> +class wxExpectModal + : public wxExpectDismissableModal +{ +public: + explicit wxExpectModal(int id) + : wxExpectDismissableModal(id) + { + } + +protected: + virtual wxString GetDefaultDescription() const + { + // It can be useful to show which buttons the expected message box was + // supposed to have, in case there could have been several of them. + wxString details; + switch ( m_id ) + { + case wxID_YES: + case wxID_NO: + details = "wxYES_NO style"; + break; + + case wxID_CANCEL: + details = "wxCANCEL style"; + break; + + case wxID_OK: + details = "wxOK style"; + break; + + default: + details.Printf("a button with ID=%d", m_id); + break; + } + + return "wxMessageDialog with " + details; + } +}; + +class wxExpectAny : public wxExpectDismissableModal +{ +public: + explicit wxExpectAny(int id) + : wxExpectDismissableModal(id) + { + } +}; + #if wxUSE_FILEDLG template<> @@ -185,7 +307,14 @@ protected: class wxTestingModalHook : public wxModalDialogHook { public: - wxTestingModalHook() + // This object is created with the location of the macro containing it by + // wxTEST_DIALOG macro, otherwise it falls back to the location of this + // line itself, which is not very useful, so normally you should provide + // your own values. + wxTestingModalHook(const char* file = NULL, + int line = 0, + const char* func = NULL) + : m_file(file), m_line(line), m_func(func) { Register(); } @@ -208,7 +337,7 @@ public: ( wxString::Format ( - "Expected %s dialog was not shown.", + "Expected %s was not shown.", expect->GetDescription() ) ); @@ -241,8 +370,8 @@ protected: ( wxString::Format ( - "A %s dialog was shown unexpectedly, expected %s.", - dlg->GetClassInfo()->GetClassName(), + "%s was shown unexpectedly, expected %s.", + DescribeUnexpectedDialog(dlg), expect->GetDescription() ) ); @@ -255,20 +384,54 @@ protected: ( wxString::Format ( - "A dialog (%s) was shown unexpectedly.", - dlg->GetClassInfo()->GetClassName() + "%s was shown unexpectedly.", + DescribeUnexpectedDialog(dlg) ) ); return wxID_NONE; } protected: + // This method may be overridden to provide a better description of + // (unexpected) dialogs, e.g. add knowledge of custom dialogs used by the + // program here. + virtual wxString DescribeUnexpectedDialog(wxDialog* dlg) const + { + // Message boxes are handled specially here just because they are so + // ubiquitous. + if ( wxMessageDialog *msgdlg = dynamic_cast(dlg) ) + { + return wxString::Format + ( + "A message box \"%s\"", + msgdlg->GetMessage() + ); + } + + return wxString::Format + ( + "A %s with title \"%s\"", + wxGetDialogClassDescription(dlg->GetClassInfo(), dlg), + dlg->GetTitle() + ); + } + + // This method may be overridden to change the way test failures are + // handled. By default they result in an assertion failure which, of + // course, can itself be customized. virtual void ReportFailure(const wxString& msg) { - wxFAIL_MSG( msg ); + wxFAIL_MSG_AT( msg, + m_file ? m_file : __FILE__, + m_line ? m_line : __LINE__, + m_func ? m_func : __WXFUNCTION__ ); } private: + const char* const m_file; + const int m_line; + const char* const m_func; + std::queue m_expectations; wxDECLARE_NO_COPY_CLASS(wxTestingModalHook); @@ -277,7 +440,9 @@ private: // Redefining this value makes it possible to customize the hook class, // including e.g. its error reporting. -#define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook +#ifndef wxTEST_DIALOG_HOOK_CLASS + #define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook +#endif #define WX_TEST_IMPL_ADD_EXPECTATION(pos, expect) \ const wxModalExpectation& wx_exp##pos = expect; \ @@ -337,9 +502,15 @@ private: method. */ #ifdef HAVE_VARIADIC_MACROS + +// See wx/cpp.h for the explanations of this hack. +#if defined(__GNUC__) && __GNUC__ == 3 + #pragma GCC system_header +#endif /* gcc-3.x */ + #define wxTEST_DIALOG(codeToRun, ...) \ { \ - wxTEST_DIALOG_HOOK_CLASS wx_hook; \ + wxTEST_DIALOG_HOOK_CLASS wx_hook(__FILE__, __LINE__, __WXFUNCTION__); \ wxCALL_FOR_EACH(WX_TEST_IMPL_ADD_EXPECTATION, __VA_ARGS__) \ codeToRun; \ wx_hook.CheckUnmetExpectations(); \ diff --git a/Externals/wxWidgets3/include/wx/textctrl.h b/Externals/wxWidgets3/include/wx/textctrl.h index ce922bb631..341409530e 100644 --- a/Externals/wxWidgets3/include/wx/textctrl.h +++ b/Externals/wxWidgets3/include/wx/textctrl.h @@ -24,12 +24,7 @@ #include "wx/dynarray.h" // wxArrayInt #include "wx/gdicmn.h" // wxPoint -// some compilers don't have standard compliant rdbuf() (and MSVC has it only -// in its new iostream library, not in the old one used with iostream.h) -#if defined(__WATCOMC__) || \ - ((defined(__VISUALC5__) || defined(__VISUALC6__)) && wxUSE_IOSTREAMH) - #define wxHAS_TEXT_WINDOW_STREAM 0 -#elif wxUSE_STD_IOSTREAM +#if wxUSE_STD_IOSTREAM #include "wx/ioswrap.h" #define wxHAS_TEXT_WINDOW_STREAM 1 #else @@ -100,11 +95,6 @@ const wxTextCoord wxInvalidTextCoord = -2; #define wxTE_WORDWRAP 0x0001 // wrap only at words boundaries #define wxTE_BESTWRAP 0x0000 // this is the default -#if WXWIN_COMPATIBILITY_2_6 - // obsolete synonym - #define wxTE_LINEWRAP wxTE_CHARWRAP -#endif // WXWIN_COMPATIBILITY_2_6 - #if WXWIN_COMPATIBILITY_2_8 // this style is (or at least should be) on by default now, don't use it #define wxTE_AUTO_SCROLL 0 @@ -114,8 +104,7 @@ const wxTextCoord wxInvalidTextCoord = -2; // wxTE_RICH controls - can be used together with or instead of wxTE_RICH #define wxTE_RICH2 0x8000 -// reuse wxTE_RICH2's value for CAPEDIT control on Windows CE -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) +#if defined(__WXOSX_IPHONE__) #define wxTE_CAPITALIZE wxTE_RICH2 #else #define wxTE_CAPITALIZE 0 @@ -649,17 +638,17 @@ public: wxTextCtrlIface() { } // wxTextAreaBase overrides - virtual wxString GetValue() const + virtual wxString GetValue() const wxOVERRIDE { return wxTextEntryBase::GetValue(); } - virtual void SetValue(const wxString& value) + virtual void SetValue(const wxString& value) wxOVERRIDE { wxTextEntryBase::SetValue(value); } protected: - virtual bool IsValidPosition(long pos) const + virtual bool IsValidPosition(long pos) const wxOVERRIDE { return pos >= 0 && pos <= GetLastPosition(); } @@ -707,45 +696,42 @@ public: // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event); + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE; - virtual bool ShouldInheritColours() const { return false; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } // work around the problem with having HitTest() both in wxControl and // wxTextAreaBase base classes - virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const wxOVERRIDE { return wxTextAreaBase::HitTest(pt, pos); } virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, - wxTextCoord *row) const + wxTextCoord *row) const wxOVERRIDE { return wxTextAreaBase::HitTest(pt, col, row); } // we provide stubs for these functions as not all platforms have styles // support, but we really should leave them pure virtual here - virtual bool SetStyle(long start, long end, const wxTextAttr& style); - virtual bool GetStyle(long position, wxTextAttr& style); - virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual bool SetStyle(long start, long end, const wxTextAttr& style) wxOVERRIDE; + virtual bool GetStyle(long position, wxTextAttr& style) wxOVERRIDE; + virtual bool SetDefaultStyle(const wxTextAttr& style) wxOVERRIDE; // wxTextAreaBase overrides - virtual wxString GetValue() const + virtual wxString GetValue() const wxOVERRIDE { return wxTextEntry::GetValue(); } - virtual void SetValue(const wxString& value) + virtual void SetValue(const wxString& value) wxOVERRIDE { wxTextEntry::SetValue(value); } - // wxTextEntry overrides - virtual bool SetHint(const wxString& hint); - // wxWindow overrides - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -757,22 +743,27 @@ public: } protected: + // Override wxEvtHandler method to check for a common problem of binding + // wxEVT_TEXT_ENTER to a control without wxTE_PROCESS_ENTER style, which is + // never going to work. + virtual bool OnDynamicBind(wxDynamicEventTableEntry& entry) wxOVERRIDE; + // override streambuf method #if wxHAS_TEXT_WINDOW_STREAM - int overflow(int i); + int overflow(int i) wxOVERRIDE; #endif // wxHAS_TEXT_WINDOW_STREAM // Another wxTextAreaBase override. - virtual bool IsValidPosition(long pos) const + virtual bool IsValidPosition(long pos) const wxOVERRIDE { return pos >= 0 && pos <= GetLastPosition(); } // implement the wxTextEntry pure virtual method - virtual wxWindow *GetEditableWindow() { return this; } + virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; } wxDECLARE_NO_COPY_CLASS(wxTextCtrlBase); - DECLARE_ABSTRACT_CLASS(wxTextCtrlBase) + wxDECLARE_ABSTRACT_CLASS(wxTextCtrlBase); }; // ---------------------------------------------------------------------------- @@ -783,8 +774,6 @@ protected: #include "wx/x11/textctrl.h" #elif defined(__WXUNIVERSAL__) #include "wx/univ/textctrl.h" -#elif defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/textctrlce.h" #elif defined(__WXMSW__) #include "wx/msw/textctrl.h" #elif defined(__WXMOTIF__) @@ -795,10 +784,8 @@ protected: #include "wx/gtk1/textctrl.h" #elif defined(__WXMAC__) #include "wx/osx/textctrl.h" -#elif defined(__WXCOCOA__) - #include "wx/cocoa/textctrl.h" -#elif defined(__WXPM__) - #include "wx/os2/textctrl.h" +#elif defined(__WXQT__) + #include "wx/qt/textctrl.h" #endif // ---------------------------------------------------------------------------- @@ -835,7 +822,7 @@ public: // get the end of the URL long GetURLEnd() const { return m_end; } - virtual wxEvent *Clone() const { return new wxTextUrlEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTextUrlEvent(*this); } protected: // the corresponding mouse event @@ -846,7 +833,7 @@ protected: m_end; private: - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTextUrlEvent); public: // for wxWin RTTI only, don't use diff --git a/Externals/wxWidgets3/include/wx/textentry.h b/Externals/wxWidgets3/include/wx/textentry.h index 2707afa203..e44f3f0124 100644 --- a/Externals/wxWidgets3/include/wx/textentry.h +++ b/Externals/wxWidgets3/include/wx/textentry.h @@ -57,7 +57,7 @@ public: virtual void Replace(long from, long to, const wxString& value); virtual void Remove(long from, long to) = 0; - virtual void Clear() { SetValue(wxString()); } + virtual void Clear() { Remove(0, -1); } void RemoveSelection(); @@ -138,10 +138,16 @@ public: virtual void SetEditable(bool editable) = 0; + // input restrictions + // ------------------ + // set the max number of characters which may be entered in a single line // text control virtual void SetMaxLength(unsigned long WXUNUSED(len)) { } + // convert any lower-case characters to upper-case on the fly in this entry + virtual void ForceUpper(); + // hints // ----- @@ -208,6 +214,10 @@ public: SuppressTextChangedEvents(); } + // change the entry value to be in upper case only, if needed (i.e. if it's + // not already the case) + void ConvertToUpperCase(); + protected: // flags for DoSetValue(): common part of SetValue() and ChangeValue() and // also used to implement WriteText() in wxMSW @@ -319,8 +329,8 @@ private: #include "wx/msw/textentry.h" #elif defined(__WXMOTIF__) #include "wx/motif/textentry.h" -#elif defined(__WXPM__) - #include "wx/os2/textentry.h" +#elif defined(__WXQT__) + #include "wx/qt/textentry.h" #else // no platform-specific implementation of wxTextEntry yet class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase diff --git a/Externals/wxWidgets3/include/wx/textfile.h b/Externals/wxWidgets3/include/wx/textfile.h index e6aa3ba663..64fefebc96 100644 --- a/Externals/wxWidgets3/include/wx/textfile.h +++ b/Externals/wxWidgets3/include/wx/textfile.h @@ -34,12 +34,12 @@ public: protected: // implement the base class pure virtuals - virtual bool OnExists() const; + virtual bool OnExists() const wxOVERRIDE; virtual bool OnOpen(const wxString &strBufferName, - wxTextBufferOpenMode OpenMode); - virtual bool OnClose(); - virtual bool OnRead(const wxMBConv& conv); - virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv); + wxTextBufferOpenMode openMode) wxOVERRIDE; + virtual bool OnClose() wxOVERRIDE; + virtual bool OnRead(const wxMBConv& conv) wxOVERRIDE; + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) wxOVERRIDE; private: diff --git a/Externals/wxWidgets3/include/wx/textwrapper.h b/Externals/wxWidgets3/include/wx/textwrapper.h index a708cebd75..02e37bd23e 100644 --- a/Externals/wxWidgets3/include/wx/textwrapper.h +++ b/Externals/wxWidgets3/include/wx/textwrapper.h @@ -101,7 +101,7 @@ protected: wxControl::EscapeMnemonics(line)); } - virtual void OnOutputLine(const wxString& line) + virtual void OnOutputLine(const wxString& line) wxOVERRIDE { if ( !line.empty() ) { diff --git a/Externals/wxWidgets3/include/wx/tglbtn.h b/Externals/wxWidgets3/include/wx/tglbtn.h index 8cb2a2e891..bb11446696 100644 --- a/Externals/wxWidgets3/include/wx/tglbtn.h +++ b/Externals/wxWidgets3/include/wx/tglbtn.h @@ -36,7 +36,13 @@ public: virtual void SetValue(bool state) = 0; virtual bool GetValue() const = 0; - void UpdateWindowUI(long flags) + // The current "normal" state for the toggle button depends upon its value. + virtual State GetNormalState() const wxOVERRIDE + { + return GetValue() ? State_Pressed : State_Normal; + } + + void UpdateWindowUI(long flags) wxOVERRIDE { wxControl::UpdateWindowUI(flags); @@ -57,15 +63,7 @@ public: } } - // 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 wxToggleButtonBase to make it consistent. - virtual bool ShouldInheritColours() const { return false; } - protected: - // choose the default border for this window - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - wxDECLARE_NO_COPY_CLASS(wxToggleButtonBase); }; @@ -88,8 +86,8 @@ protected: #elif defined(__WXMAC__) #include "wx/osx/tglbtn.h" #define wxHAS_BITMAPTOGGLEBUTTON -#elif defined(__WXPM__) - #include "wx/os2/tglbtn.h" +#elif defined(__WXQT__) + #include "wx/qt/tglbtn.h" #endif // old wxEVT_COMMAND_* constants diff --git a/Externals/wxWidgets3/include/wx/thread.h b/Externals/wxWidgets3/include/wx/thread.h index 6806d82fea..5ff109c970 100644 --- a/Externals/wxWidgets3/include/wx/thread.h +++ b/Externals/wxWidgets3/include/wx/thread.h @@ -277,7 +277,7 @@ private: wxCritSectBuffer m_buffer; }; -#endif // Unix&OS2/Win32 +#endif // Unix/Win32 wxDECLARE_NO_COPY_CLASS(wxCriticalSection); }; @@ -382,23 +382,12 @@ public: // on the associated mutex object before returning. wxCondError Broadcast(); - -#if WXWIN_COMPATIBILITY_2_6 - // deprecated version, don't use - wxDEPRECATED( bool Wait(unsigned long milliseconds) ); -#endif // WXWIN_COMPATIBILITY_2_6 - private: wxConditionInternal *m_internal; wxDECLARE_NO_COPY_CLASS(wxCondition); }; -#if WXWIN_COMPATIBILITY_2_6 - inline bool wxCondition::Wait(unsigned long milliseconds) - { return WaitTimeout(milliseconds) == wxCOND_NO_ERROR; } -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // wxSemaphore: a counter limiting the number of threads concurrently accessing // a shared resource @@ -524,8 +513,6 @@ public: // create a new thread and optionally set the stack size on // platforms that support that - call Run() to start it - // (special cased for watcom which won't accept 0 default) - wxThreadError Create(unsigned int stackSize = 0); // starts execution of the thread - from the moment Run() is called @@ -573,7 +560,8 @@ public: // Sets the priority to "prio" which must be in 0..100 range (see // also wxPRIORITY_XXX constants). // - // NB: the priority can only be set before the thread is created + // NB: under MSW the priority can only be set after the thread is + // created (but possibly before it is launched) void SetPriority(unsigned int prio); // Get the current priority. @@ -594,6 +582,11 @@ public: // identifies a thread inside a process wxThreadIdType GetId() const; +#ifdef __WINDOWS__ + // Get the internal OS handle + WXHANDLE MSWGetHandle() const; +#endif // __WINDOWS__ + wxThreadKind GetKind() const { return m_isDetached ? wxTHREAD_DETACHED : wxTHREAD_JOINABLE; } @@ -670,7 +663,7 @@ public: protected: // entry point for the thread -- calls Entry() in owner. - virtual void *Entry(); + virtual void *Entry() wxOVERRIDE; private: // the owner of the thread @@ -806,9 +799,7 @@ inline void wxMutexGuiLeave() { } // macros for entering/leaving critical sections which may be used without // having to take them inside "#if wxUSE_THREADS" -// (the implementation uses dummy structs to force semicolon after the macro; -// also notice that Watcom doesn't like declaring a struct as a member so we -// need to actually define it in wxCRIT_SECT_DECLARE_MEMBER) +// (the implementation uses dummy structs to force semicolon after the macro) #define wxENTER_CRIT_SECT(cs) do {} while (0) #define wxLEAVE_CRIT_SECT(cs) do {} while (0) #define wxCRIT_SECT_DECLARE(cs) struct wxDummyCS##cs @@ -855,7 +846,7 @@ public: #if wxUSE_THREADS -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) || defined(__DARWIN__) +#if defined(__WINDOWS__) || defined(__DARWIN__) // 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 000b24d589..b8d2eae7d9 100644 --- a/Externals/wxWidgets3/include/wx/thrimpl.cpp +++ b/Externals/wxWidgets3/include/wx/thrimpl.cpp @@ -75,7 +75,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(__WINDOWS__) || defined(__OS2__) || defined(__EMX__) +#if defined(__WINDOWS__) class wxConditionInternal { @@ -222,7 +222,7 @@ wxCondError wxConditionInternal::Broadcast() return wxCOND_NO_ERROR; } -#endif // __WINDOWS__ || __OS2__ || __EMX__ +#endif // __WINDOWS__ // ---------------------------------------------------------------------------- // wxCondition diff --git a/Externals/wxWidgets3/include/wx/time.h b/Externals/wxWidgets3/include/wx/time.h index 644422392f..918da125b8 100644 --- a/Externals/wxWidgets3/include/wx/time.h +++ b/Externals/wxWidgets3/include/wx/time.h @@ -57,7 +57,7 @@ wxLongLong WXDLLIMPEXP_BASE wxGetUTCTimeUSec(); #define wxLocaltime_r localtime_r #else WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) +#if wxUSE_THREADS && !defined(__WINDOWS__) // On Windows, localtime _is_ threadsafe! #warning using pseudo thread-safe wrapper for localtime to emulate localtime_r #endif @@ -67,7 +67,7 @@ WXDLLIMPEXP_BASE struct tm *wxLocaltime_r(const time_t*, struct tm*); #define wxGmtime_r gmtime_r #else WXDLLIMPEXP_BASE struct tm *wxGmtime_r(const time_t*, struct tm*); -#if wxUSE_THREADS && !defined(__WINDOWS__) && !defined(__WATCOMC__) +#if wxUSE_THREADS && !defined(__WINDOWS__) // On Windows, gmtime _is_ threadsafe! #warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r #endif diff --git a/Externals/wxWidgets3/include/wx/timer.h b/Externals/wxWidgets3/include/wx/timer.h index 8ee5684e00..956cc2a87e 100644 --- a/Externals/wxWidgets3/include/wx/timer.h +++ b/Externals/wxWidgets3/include/wx/timer.h @@ -174,13 +174,13 @@ public: wxTimer& GetTimer() const { return *m_timer; } // implement the base class pure virtual - virtual wxEvent *Clone() const { return new wxTimerEvent(*this); } - virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_TIMER; } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTimerEvent(*this); } + virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_TIMER; } private: wxTimer* m_timer; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent); }; typedef void (wxEvtHandler::*wxTimerEventFunction)(wxTimerEvent&); diff --git a/Externals/wxWidgets3/include/wx/tipdlg.h b/Externals/wxWidgets3/include/wx/tipdlg.h index e0093855fb..173bbf41cd 100644 --- a/Externals/wxWidgets3/include/wx/tipdlg.h +++ b/Externals/wxWidgets3/include/wx/tipdlg.h @@ -44,14 +44,15 @@ public: // from where to start the next time) size_t GetCurrentTip() const { return m_currentTip; } - // Allows any user-derived class to optionally override this function to - // modify the tip as soon as it is read. If return wxEmptyString, then - // the tip is skipped, and the next one is read. - virtual wxString PreprocessTip(const wxString& tip) { return tip; } - // virtual dtor for the base class virtual ~wxTipProvider() { } + +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("this method does nothing, simply don't call it") + wxString PreprocessTip(const wxString& tip) { return tip; } +#endif + protected: size_t m_currentTip; }; diff --git a/Externals/wxWidgets3/include/wx/tipwin.h b/Externals/wxWidgets3/include/wx/tipwin.h index a2ca0f13e2..08c0957e5b 100644 --- a/Externals/wxWidgets3/include/wx/tipwin.h +++ b/Externals/wxWidgets3/include/wx/tipwin.h @@ -73,7 +73,7 @@ protected: void OnActivate(wxActivateEvent& event); void OnKillFocus(wxFocusEvent& event); #else // wxUSE_POPUPWIN - virtual void OnDismiss(); + virtual void OnDismiss() wxOVERRIDE; #endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN private: @@ -85,7 +85,7 @@ private: wxTipWindow** m_windowPtr; wxRect m_rectBound; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); friend class wxTipWindowView; diff --git a/Externals/wxWidgets3/include/wx/tls.h b/Externals/wxWidgets3/include/wx/tls.h index 6a4ee03786..7e7592286b 100644 --- a/Externals/wxWidgets3/include/wx/tls.h +++ b/Externals/wxWidgets3/include/wx/tls.h @@ -32,7 +32,7 @@ #define wxTHREAD_SPECIFIC_DECL __thread // MSVC has its own version which might be supported by some other Windows // compilers, to be tested -#elif wxCHECK_VISUALC_VERSION(7) +#elif defined(__VISUALC__) #define wxHAS_COMPILER_TLS #define wxTHREAD_SPECIFIC_DECL __declspec(thread) #endif // compilers @@ -44,6 +44,7 @@ #ifdef wxHAS_COMPILER_TLS #define wxTLS_TYPE(T) wxTHREAD_SPECIFIC_DECL T + #define wxTLS_TYPE_REF(T) T& #define wxTLS_PTR(var) (&(var)) #define wxTLS_VALUE(var) (var) #else // !wxHAS_COMPILER_TLS @@ -55,8 +56,6 @@ #if defined(__WINDOWS__) #include "wx/msw/tls.h" - #elif defined(__OS2__) - #include "wx/os2/tls.h" #elif defined(__UNIX__) #include "wx/unix/tls.h" #else @@ -131,10 +130,11 @@ private: wxTlsKey m_key; - DECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T) + wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxTlsValue, T); }; #define wxTLS_TYPE(T) wxTlsValue + #define wxTLS_TYPE_REF(T) wxTLS_TYPE(T)& #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/tokenzr.h b/Externals/wxWidgets3/include/wx/tokenzr.h index 2eb6519709..45f91a0aef 100644 --- a/Externals/wxWidgets3/include/wx/tokenzr.h +++ b/Externals/wxWidgets3/include/wx/tokenzr.h @@ -47,6 +47,9 @@ public: wxStringTokenizer(const wxString& str, const wxString& delims = wxDEFAULT_DELIMITERS, wxStringTokenizerMode mode = wxTOKEN_DEFAULT); + // copy ctor and assignment operator + wxStringTokenizer(const wxStringTokenizer& src); + wxStringTokenizer& operator=(const wxStringTokenizer& src); // args are same as for the non default ctor above void SetString(const wxString& str, @@ -112,6 +115,8 @@ protected: bool DoHasMoreTokens() const; + void DoCopyFrom(const wxStringTokenizer& src); + enum MoreTokensState { MoreTokens_Unknown, diff --git a/Externals/wxWidgets3/include/wx/toolbar.h b/Externals/wxWidgets3/include/wx/toolbar.h index 49a446e777..f4f6afe1b5 100644 --- a/Externals/wxWidgets3/include/wx/toolbar.h +++ b/Externals/wxWidgets3/include/wx/toolbar.h @@ -61,7 +61,7 @@ enum // lay out toolbar at the right edge of the window wxTB_RIGHT = 0x4000, - wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL | wxTB_FLAT + wxTB_DEFAULT_STYLE = wxTB_HORIZONTAL }; #if wxUSE_TOOLBAR @@ -69,10 +69,8 @@ enum #if defined(__WXUNIVERSAL__) #include "wx/univ/toolbar.h" - #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) + #elif defined(__WXMSW__) #include "wx/msw/toolbar.h" - #elif defined(__WXWINCE__) - #include "wx/msw/wince/tbarwce.h" #elif defined(__WXMOTIF__) #include "wx/motif/toolbar.h" #elif defined(__WXGTK20__) @@ -81,10 +79,8 @@ enum #include "wx/gtk1/toolbar.h" #elif defined(__WXMAC__) #include "wx/osx/toolbar.h" - #elif defined(__WXCOCOA__) - #include "wx/cocoa/toolbar.h" - #elif defined(__WXPM__) - #include "wx/os2/toolbar.h" + #elif defined(__WXQT__) + #include "wx/qt/toolbar.h" #endif #endif // wxUSE_TOOLBAR diff --git a/Externals/wxWidgets3/include/wx/toolbook.h b/Externals/wxWidgets3/include/wx/toolbook.h index 45730cd9c4..ecd703cfc2 100644 --- a/Externals/wxWidgets3/include/wx/toolbook.h +++ b/Externals/wxWidgets3/include/wx/toolbook.h @@ -70,21 +70,21 @@ public: // implement base class virtuals - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text, bool bSelect = false, - 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); + int imageId = NO_IMAGE) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; - virtual bool DeleteAllPages(); - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + virtual bool DeleteAllPages() wxOVERRIDE; + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; // methods which are not part of base wxBookctrl API @@ -97,17 +97,17 @@ public: void Realize(); protected: - virtual wxWindow *DoRemovePage(size_t page); + virtual wxWindow *DoRemovePage(size_t page) wxOVERRIDE; // event handlers void OnToolSelected(wxCommandEvent& event); void OnSize(wxSizeEvent& event); void OnIdle(wxIdleEvent& event); - void UpdateSelectedPage(size_t newsel); + void UpdateSelectedPage(size_t newsel) wxOVERRIDE; - wxBookCtrlEvent* CreatePageChangingEvent() const; - void MakeChangedEvent(wxBookCtrlEvent &event); + wxBookCtrlEvent* CreatePageChangingEvent() const wxOVERRIDE; + void MakeChangedEvent(wxBookCtrlEvent &event) wxOVERRIDE; // whether the toolbar needs to be realized bool m_needsRealizing; @@ -119,8 +119,8 @@ private: // common part of all constructors void Init(); - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxToolbook); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/tooltip.h b/Externals/wxWidgets3/include/wx/tooltip.h index 0948e65eff..d65fef0b82 100644 --- a/Externals/wxWidgets3/include/wx/tooltip.h +++ b/Externals/wxWidgets3/include/wx/tooltip.h @@ -25,10 +25,8 @@ #include "wx/gtk1/tooltip.h" #elif defined(__WXMAC__) #include "wx/osx/tooltip.h" -#elif defined(__WXCOCOA__) -#include "wx/cocoa/tooltip.h" -#elif defined(__WXPM__) -#include "wx/os2/tooltip.h" +#elif defined(__WXQT__) +#include "wx/qt/tooltip.h" #endif #endif diff --git a/Externals/wxWidgets3/include/wx/toplevel.h b/Externals/wxWidgets3/include/wx/toplevel.h index b36b30e6cf..47c5798ebc 100644 --- a/Externals/wxWidgets3/include/wx/toplevel.h +++ b/Externals/wxWidgets3/include/wx/toplevel.h @@ -84,37 +84,8 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; #define wxTINY_CAPTION_VERT wxTINY_CAPTION #endif -#if WXWIN_COMPATIBILITY_2_6 - - // deprecated versions defined for compatibility reasons - #define wxRESIZE_BOX wxMAXIMIZE_BOX - #define wxTHICK_FRAME wxRESIZE_BORDER - - // obsolete styles, unused any more - #define wxDIALOG_MODAL 0 - #define wxDIALOG_MODELESS 0 - #define wxNO_3D 0 - #define wxUSER_COLOURS 0 - -#endif // WXWIN_COMPATIBILITY_2_6 - // default style -// -// under Windows CE (at least when compiling with eVC 4) we should create -// top level windows without any styles at all for them to appear -// "correctly", i.e. as full screen windows with a "hide" button (same as -// "close" but round instead of squared and just hides the applications -// instead of closing it) in the title bar -#if defined(__WXWINCE__) - #if defined(__SMARTPHONE__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE) - #elif defined(__WINCE_STANDARDSDK__) - #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX) - #else - #define wxDEFAULT_FRAME_STYLE (wxNO_BORDER) - #endif -#else // !__WXWINCE__ - #define wxDEFAULT_FRAME_STYLE \ +#define wxDEFAULT_FRAME_STYLE \ (wxSYSTEM_MENU | \ wxRESIZE_BORDER | \ wxMINIMIZE_BOX | \ @@ -122,7 +93,6 @@ class WXDLLIMPEXP_FWD_CORE wxTopLevelWindowBase; wxCLOSE_BOX | \ wxCAPTION | \ wxCLIP_CHILDREN) -#endif // Dialogs are created in a special way @@ -196,6 +166,11 @@ public: // set the frame icons virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; } + virtual bool EnableFullScreenView(bool WXUNUSED(enable) = true) + { + return false; + } + // maximize the window to cover entire screen virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0; @@ -214,7 +189,9 @@ public: virtual wxString GetTitle() const = 0; // enable/disable close button [x] - virtual bool EnableCloseButton(bool WXUNUSED(enable) ) { return false; } + virtual bool EnableCloseButton(bool WXUNUSED(enable) = true) { return false; } + virtual bool EnableMaximizeButton(bool WXUNUSED(enable) = true) { return false; } + virtual bool EnableMinimizeButton(bool WXUNUSED(enable) = true) { return false; } // Attracts the users attention to this window if the application is // inactive (should be called when a background event occurs) @@ -232,12 +209,6 @@ public: // so it can still veto it even if it returns false from here virtual bool ShouldPreventAppExit() const { return true; } - -#if defined(__SMARTPHONE__) - virtual void SetLeftMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; - virtual void SetRightMenu(int id = wxID_ANY, const wxString& label = wxEmptyString, wxMenu *subMenu = NULL) = 0; -#endif // __SMARTPHONE__ - // centre the window on screen: this is just a shortcut void CentreOnScreen(int dir = wxBOTH) { DoCentre(dir | wxCENTRE_ON_SCREEN); } void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } @@ -273,9 +244,9 @@ public: // ------------------------------- // override some base class virtuals - virtual bool Destroy(); - virtual bool IsTopLevel() const { return true; } - virtual bool IsTopNavigationDomain() const { return true; } + virtual bool Destroy() wxOVERRIDE; + virtual bool IsTopLevel() const wxOVERRIDE { return true; } + virtual bool IsTopNavigationDomain(NavigationKind kind) const wxOVERRIDE; virtual bool IsVisible() const { return IsShown(); } // event handlers @@ -290,36 +261,29 @@ public: void OnActivate(wxActivateEvent &WXUNUSED(event)) { } // do the window-specific processing after processing the update event - virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ; + virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) wxOVERRIDE ; // a different API for SetSizeHints - virtual void SetMinSize(const wxSize& minSize); - virtual void SetMaxSize(const wxSize& maxSize); + virtual void SetMinSize(const wxSize& minSize) wxOVERRIDE; + virtual void SetMaxSize(const wxSize& maxSize) wxOVERRIDE; virtual void OSXSetModified(bool modified) { m_modified = modified; } virtual bool OSXIsModified() const { return m_modified; } virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { } -#if wxUSE_MENUS || wxUSE_TOOLBAR - // show help text for the currently selected menu or toolbar item - // (typically in the status bar) or hide it and restore the status bar text - // originally shown before the menu was opened if show == false - virtual void DoGiveHelp(const wxString& WXUNUSED(text), bool WXUNUSED(show)) {} -#endif - protected: // the frame client to screen translation should take account of the // toolbar which may shift the origin of the client area - virtual void DoClientToScreen(int *x, int *y) const; - virtual void DoScreenToClient(int *x, int *y) const; + virtual void DoClientToScreen(int *x, int *y) const wxOVERRIDE; + virtual void DoScreenToClient(int *x, int *y) const wxOVERRIDE; // add support for wxCENTRE_ON_SCREEN - virtual void DoCentre(int dir); + virtual void DoCentre(int dir) wxOVERRIDE; // no need to do client to screen translation to get our position in screen // coordinates: this is already the case - virtual void DoGetScreenPosition(int *x, int *y) const + virtual void DoGetScreenPosition(int *x, int *y) const wxOVERRIDE { DoGetPosition(x, y); } @@ -355,7 +319,7 @@ protected: bool m_modified; wxDECLARE_NO_COPY_CLASS(wxTopLevelWindowBase); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; @@ -378,15 +342,12 @@ protected: #elif defined(__WXMAC__) #include "wx/osx/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMac -#elif defined(__WXCOCOA__) - #include "wx/cocoa/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowCocoa -#elif defined(__WXPM__) - #include "wx/os2/toplevel.h" - #define wxTopLevelWindowNative wxTopLevelWindowOS2 #elif defined(__WXMOTIF__) #include "wx/motif/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMotif +#elif defined(__WXQT__) + #include "wx/qt/toplevel.h" +#define wxTopLevelWindowNative wxTopLevelWindowQt #endif #ifdef __WXUNIVERSAL__ @@ -409,7 +370,7 @@ protected: { } - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTopLevelWindow); }; #endif // __WXUNIVERSAL__/!__WXUNIVERSAL__ diff --git a/Externals/wxWidgets3/include/wx/translation.h b/Externals/wxWidgets3/include/wx/translation.h index 187caf366b..2ca62cf4cc 100644 --- a/Externals/wxWidgets3/include/wx/translation.h +++ b/Externals/wxWidgets3/include/wx/translation.h @@ -183,6 +183,12 @@ private: wxTranslationsLoader *m_loader; wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs + + // In addition to keeping all the catalogs in the linked list, we also + // store them in a hash map indexed by the domain name to allow finding + // them by name efficiently. + WX_DECLARE_HASH_MAP(wxString, wxMsgCatalog *, wxStringHash, wxStringEqual, wxMsgCatalogMap); + wxMsgCatalogMap m_catalogMap; }; @@ -208,9 +214,9 @@ public: static void AddCatalogLookupPathPrefix(const wxString& prefix); virtual wxMsgCatalog *LoadCatalog(const wxString& domain, - const wxString& lang); + const wxString& lang) wxOVERRIDE; - virtual wxArrayString GetAvailableTranslations(const wxString& domain) const; + virtual wxArrayString GetAvailableTranslations(const wxString& domain) const wxOVERRIDE; }; diff --git a/Externals/wxWidgets3/include/wx/treebase.h b/Externals/wxWidgets3/include/wx/treebase.h index 4efbf05074..6ce145f603 100644 --- a/Externals/wxWidgets3/include/wx/treebase.h +++ b/Externals/wxWidgets3/include/wx/treebase.h @@ -24,19 +24,6 @@ #include "wx/dynarray.h" #include "wx/itemid.h" -#if WXWIN_COMPATIBILITY_2_6 - -// flags for deprecated `Expand(int action)', will be removed in next versions -enum -{ - wxTREE_EXPAND_EXPAND, - wxTREE_EXPAND_COLLAPSE, - wxTREE_EXPAND_COLLAPSE_RESET, - wxTREE_EXPAND_TOGGLE -}; - -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // 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(). @@ -159,13 +146,6 @@ static const int wxTREE_ITEMSTATE_PREV = -3; // cycle to the previous state #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT) #endif -#if WXWIN_COMPATIBILITY_2_6 -// deprecated, don't use -#define wxTR_MAC_BUTTONS 0 -#define wxTR_AQUA_BUTTONS 0 -#endif // WXWIN_COMPATIBILITY_2_6 - - // values for the `flags' parameter of wxTreeCtrl::HitTest() which determine // where exactly the specified point is situated: @@ -252,7 +232,7 @@ public: const wxTreeItemId &item = wxTreeItemId()); wxTreeEvent(const wxTreeEvent& event); - virtual wxEvent *Clone() const { return new wxTreeEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxTreeEvent(*this); } // accessors // get the item on which the operation was performed or the newly @@ -299,7 +279,7 @@ private: friend class WXDLLIMPEXP_FWD_CORE wxTreeCtrl; friend class WXDLLIMPEXP_FWD_CORE wxGenericTreeCtrl; - DECLARE_DYNAMIC_CLASS(wxTreeEvent) + wxDECLARE_DYNAMIC_CLASS(wxTreeEvent); }; typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); diff --git a/Externals/wxWidgets3/include/wx/treebook.h b/Externals/wxWidgets3/include/wx/treebook.h index bd59338952..8661349c78 100644 --- a/Externals/wxWidgets3/include/wx/treebook.h +++ b/Externals/wxWidgets3/include/wx/treebook.h @@ -74,7 +74,7 @@ public: wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = NO_IMAGE) wxOVERRIDE; // Inserts a new sub-page to the end of children of the page at given pos. virtual bool InsertSubPage(size_t pos, @@ -87,7 +87,7 @@ public: virtual bool AddPage(wxWindow *page, const wxString& text, bool bSelect = false, - int imageId = NO_IMAGE); + int imageId = NO_IMAGE) wxOVERRIDE; // Adds a new child-page to the last top-level page inserted. // Useful when constructing 1 level tree structure. @@ -99,7 +99,7 @@ public: // 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 // is selected (or the next page if no parent). - virtual bool DeletePage(size_t pos); + virtual bool DeletePage(size_t pos) wxOVERRIDE; // Tree operations @@ -126,23 +126,23 @@ public: // Standard operations inherited from wxBookCtrlBase // ------------------------------------------------- - virtual bool SetPageText(size_t n, const wxString& strText); - virtual wxString GetPageText(size_t n) const; - virtual int GetPageImage(size_t n) const; - virtual bool SetPageImage(size_t n, int imageId); - 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; - virtual void SetImageList(wxImageList *imageList); + virtual bool SetPageText(size_t n, const wxString& strText) wxOVERRIDE; + virtual wxString GetPageText(size_t n) const wxOVERRIDE; + virtual int GetPageImage(size_t n) const wxOVERRIDE; + virtual bool SetPageImage(size_t n, int imageId) wxOVERRIDE; + virtual int SetSelection(size_t n) wxOVERRIDE { return DoSetSelection(n, SetSelection_SendEvent); } + virtual int ChangeSelection(size_t n) wxOVERRIDE { return DoSetSelection(n); } + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const wxOVERRIDE; + virtual void SetImageList(wxImageList *imageList) wxOVERRIDE; virtual void AssignImageList(wxImageList *imageList); - virtual bool DeleteAllPages(); + virtual bool DeleteAllPages() wxOVERRIDE; protected: // Implementation of a page removal. See DeletPage for comments. - wxTreebookPage *DoRemovePage(size_t pos); + wxTreebookPage *DoRemovePage(size_t pos) wxOVERRIDE; // This subclass of wxBookCtrlBase accepts NULL page pointers (empty pages) - virtual bool AllowNullPage() const { return true; } + virtual bool AllowNullPage() const wxOVERRIDE { return true; } // event handlers void OnTreeSelectionChange(wxTreeEvent& event); @@ -181,7 +181,7 @@ private: int imageId = NO_IMAGE); // Sets selection in the tree control and updates the page being shown. - int DoSetSelection(size_t pos, int flags = 0); + int DoSetSelection(size_t pos, int flags = 0) wxOVERRIDE; // Returns currently shown page. In a case when selected the node // has empty (NULL) page finds first (sub)child with not-empty page. @@ -219,8 +219,8 @@ private: size_t DoInternalGetPageCount() const { return m_treeIds.GetCount(); } - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook) + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTreebook); }; diff --git a/Externals/wxWidgets3/include/wx/treectrl.h b/Externals/wxWidgets3/include/wx/treectrl.h index 89493c3bbb..9dfc85fb85 100644 --- a/Externals/wxWidgets3/include/wx/treectrl.h +++ b/Externals/wxWidgets3/include/wx/treectrl.h @@ -22,14 +22,19 @@ #include "wx/control.h" #include "wx/treebase.h" #include "wx/textctrl.h" // wxTextCtrl::ms_classinfo used through wxCLASSINFO macro +#include "wx/systhemectrl.h" class WXDLLIMPEXP_FWD_CORE wxImageList; +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) + #define wxHAS_GENERIC_TREECTRL +#endif + // ---------------------------------------------------------------------------- // wxTreeCtrlBase // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxControl +class WXDLLIMPEXP_CORE wxTreeCtrlBase : public wxSystemThemedControl { public: wxTreeCtrlBase(); @@ -391,14 +396,14 @@ public: // implementation // -------------- - virtual bool ShouldInheritColours() const { return false; } + virtual bool ShouldInheritColours() const wxOVERRIDE { return false; } // hint whether to calculate best size quickly or accurately void SetQuickBestSize(bool q) { m_quickBestSize = q; } bool GetQuickBestSize() const { return m_quickBestSize; } protected: - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const wxOVERRIDE; // common part of Get/SetItemState() virtual int DoGetItemState(const wxTreeItemId& item) const = 0; @@ -456,20 +461,12 @@ private: // include the platform-dependent wxTreeCtrl class // ---------------------------------------------------------------------------- -#if defined(__WXUNIVERSAL__) +#ifdef wxHAS_GENERIC_TREECTRL #include "wx/generic/treectlg.h" #elif defined(__WXMSW__) #include "wx/msw/treectrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/treectlg.h" -#elif defined(__WXGTK__) - #include "wx/generic/treectlg.h" -#elif defined(__WXMAC__) - #include "wx/generic/treectlg.h" -#elif defined(__WXCOCOA__) - #include "wx/generic/treectlg.h" -#elif defined(__WXPM__) - #include "wx/generic/treectlg.h" +#else + #error "unknown native wxTreeCtrl implementation" #endif #endif // wxUSE_TREECTRL diff --git a/Externals/wxWidgets3/include/wx/treelist.h b/Externals/wxWidgets3/include/wx/treelist.h index d06e35e869..9782903ef4 100644 --- a/Externals/wxWidgets3/include/wx/treelist.h +++ b/Externals/wxWidgets3/include/wx/treelist.h @@ -313,6 +313,7 @@ public: void SelectAll(); void UnselectAll(); + void EnsureVisible(wxTreeListItem item); // Checkbox handling // ----------------- @@ -395,7 +396,7 @@ private: void Init(); // Pure virtual method inherited from wxCompositeWindow. - virtual wxWindowList GetCompositeWindowParts() const; + virtual wxWindowList GetCompositeWindowParts() const wxOVERRIDE; // Implementation of AppendColumn(). int DoInsertColumn(const wxString& title, @@ -470,7 +471,7 @@ public: // COLUMN_SORTED event. unsigned GetColumn() const { return m_column; } - virtual wxEvent* Clone() const { return new wxTreeListEvent(*this); } + virtual wxEvent* Clone() const wxOVERRIDE { return new wxTreeListEvent(*this); } private: // Common part of all ctors. diff --git a/Externals/wxWidgets3/include/wx/txtstrm.h b/Externals/wxWidgets3/include/wx/txtstrm.h index 90e6bbb22a..8fc43a176f 100644 --- a/Externals/wxWidgets3/include/wx/txtstrm.h +++ b/Externals/wxWidgets3/include/wx/txtstrm.h @@ -46,9 +46,12 @@ public: const wxInputStream& GetInputStream() const { return m_input; } - wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format) + // base may be between 2 and 36, inclusive, or the special 0 (= C format) + wxUint64 Read64(int base = 10); + wxUint32 Read32(int base = 10); wxUint16 Read16(int base = 10); wxUint8 Read8(int base = 10); + wxInt64 Read64S(int base = 10); wxInt32 Read32S(int base = 10); wxInt16 Read16S(int base = 10); wxInt8 Read8S(int base = 10); @@ -68,17 +71,15 @@ public: #endif // wxUSE_UNICODE wxTextInputStream& operator>>(wxInt16& i); wxTextInputStream& operator>>(wxInt32& i); + wxTextInputStream& operator>>(wxInt64& i); wxTextInputStream& operator>>(wxUint16& i); wxTextInputStream& operator>>(wxUint32& i); + wxTextInputStream& operator>>(wxUint64& i); wxTextInputStream& operator>>(double& i); wxTextInputStream& operator>>(float& f); wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); } -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( wxString ReadString() ); // use ReadLine or ReadWord instead -#endif // WXWIN_COMPATIBILITY_2_6 - protected: wxInputStream &m_input; wxString m_separators; @@ -86,7 +87,16 @@ protected: #if wxUSE_UNICODE wxMBConv *m_conv; -#endif + + // The second half of a surrogate character when using UTF-16 for wchar_t: + // we can't return it immediately from GetChar() when we read a Unicode + // code point outside of the BMP, but we can't keep it in m_lastBytes + // neither because it can't separately decoded, so we have a separate 1 + // wchar_t buffer just for this case. +#if SIZEOF_WCHAR_T == 2 + wchar_t m_lastWChar; +#endif // SIZEOF_WCHAR_T == 2 +#endif // wxUSE_UNICODE bool EatEOL(const wxChar &c); void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues @@ -97,13 +107,13 @@ protected: wxDECLARE_NO_COPY_CLASS(wxTextInputStream); }; -typedef enum +enum wxEOL { wxEOL_NATIVE, wxEOL_UNIX, wxEOL_MAC, wxEOL_DOS -} wxEOL; +}; class WXDLLIMPEXP_BASE wxTextOutputStream { @@ -122,6 +132,16 @@ public: void SetMode( wxEOL mode = wxEOL_NATIVE ); wxEOL GetMode() { return m_mode; } + template + void Write(const T& i) + { + wxString str; + str << i; + + WriteString(str); + } + + void Write64(wxUint64 i); void Write32(wxUint32 i); void Write16(wxUint16 i); void Write8(wxUint8 i); @@ -139,8 +159,10 @@ public: #endif // wxUSE_UNICODE wxTextOutputStream& operator<<(wxInt16 c); wxTextOutputStream& operator<<(wxInt32 c); + wxTextOutputStream& operator<<(wxInt64 c); wxTextOutputStream& operator<<(wxUint16 c); wxTextOutputStream& operator<<(wxUint32 c); + wxTextOutputStream& operator<<(wxUint64 c); wxTextOutputStream& operator<<(double f); wxTextOutputStream& operator<<(float f); @@ -152,7 +174,13 @@ protected: #if wxUSE_UNICODE wxMBConv *m_conv; -#endif + +#if SIZEOF_WCHAR_T == 2 + // The first half of a surrogate character if one was passed to PutChar() + // and couldn't be output when it was called the last time. + wchar_t m_lastWChar; +#endif // SIZEOF_WCHAR_T == 2 +#endif // wxUSE_UNICODE wxDECLARE_NO_COPY_CLASS(wxTextOutputStream); }; diff --git a/Externals/wxWidgets3/include/wx/uiaction.h b/Externals/wxWidgets3/include/wx/uiaction.h index fb96523544..498da69821 100644 --- a/Externals/wxWidgets3/include/wx/uiaction.h +++ b/Externals/wxWidgets3/include/wx/uiaction.h @@ -65,6 +65,9 @@ public: bool Text(const char *text); + // Select the item with the given text in the currently focused control. + bool Select(const wxString& text); + private: // This is the common part of Key{Down,Up}() methods: while we keep them // separate at public API level for consistency with Mouse{Down,Up}(), at diff --git a/Externals/wxWidgets3/include/wx/unichar.h b/Externals/wxWidgets3/include/wx/unichar.h index e9726943ab..a966d5909e 100644 --- a/Externals/wxWidgets3/include/wx/unichar.h +++ b/Externals/wxWidgets3/include/wx/unichar.h @@ -14,6 +14,8 @@ #include "wx/chartype.h" #include "wx/stringimpl.h" +#include // only for std::swap specialization below + class WXDLLIMPEXP_FWD_BASE wxUniCharRef; class WXDLLIMPEXP_FWD_BASE wxString; @@ -289,6 +291,34 @@ inline wxUniChar& wxUniChar::operator=(const wxUniCharRef& c) return *this; } +// wxUniCharRef doesn't behave quite like a reference, notably because template +// deduction from wxUniCharRef doesn't yield wxUniChar as would have been the +// case if it were a real reference. This results in a number of problems and +// we can't fix all of them but we can at least provide a working swap() for +// it, instead of the default version which doesn't work because a "wrong" type +// is deduced. +namespace std +{ + +template <> +inline +void swap(wxUniCharRef& lhs, wxUniCharRef& rhs) +{ + if ( &lhs != &rhs ) + { + // The use of wxUniChar here is the crucial difference: in the default + // implementation, tmp would be wxUniCharRef and so assigning to lhs + // would modify it too. Here we make a real copy, not affected by + // changing lhs, instead. + wxUniChar tmp = lhs; + lhs = rhs; + rhs = tmp; + } +} + +} // namespace std + + // Comparison operators for the case when wxUniChar(Ref) is the second operand // implemented in terms of member comparison functions diff --git a/Externals/wxWidgets3/include/wx/unix/app.h b/Externals/wxWidgets3/include/wx/unix/app.h index f14df9ec3f..8b173548a8 100644 --- a/Externals/wxWidgets3/include/wx/unix/app.h +++ b/Externals/wxWidgets3/include/wx/unix/app.h @@ -22,7 +22,7 @@ public: virtual ~wxAppConsole(); // override base class initialization - virtual bool Initialize(int& argc, wxChar** argv); + virtual bool Initialize(int& argc, wxChar** argv) wxOVERRIDE; // Unix-specific: Unix signal handling diff --git a/Externals/wxWidgets3/include/wx/unix/apptbase.h b/Externals/wxWidgets3/include/wx/unix/apptbase.h index 6ce6f152c3..ff41981407 100644 --- a/Externals/wxWidgets3/include/wx/unix/apptbase.h +++ b/Externals/wxWidgets3/include/wx/unix/apptbase.h @@ -48,7 +48,7 @@ public: virtual wxFDIOManager *GetFDIOManager(); #endif // wxUSE_SOCKETS -#if wxUSE_CONSOLE_EVENTLOOP +#if wxUSE_EVENTLOOP_SOURCE // Return a non-NULL pointer to the object responsible for managing the // event loop sources in this kind of application. virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); diff --git a/Externals/wxWidgets3/include/wx/unix/apptrait.h b/Externals/wxWidgets3/include/wx/unix/apptrait.h index 3fbe4d82da..1095a3c37b 100644 --- a/Externals/wxWidgets3/include/wx/unix/apptrait.h +++ b/Externals/wxWidgets3/include/wx/unix/apptrait.h @@ -19,10 +19,10 @@ class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase { public: #if wxUSE_CONSOLE_EVENTLOOP - virtual wxEventLoopBase *CreateEventLoop(); + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; #endif // wxUSE_CONSOLE_EVENTLOOP #if wxUSE_TIMER - virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer); + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; #endif }; @@ -35,7 +35,7 @@ public: // TODO: Should we use XtAddInput() for wxX11 too? Or, vice versa, if there is // no advantage in doing this compared to the generic way currently used // by wxX11, should we continue to use GTK/Motif-specific stuff? -#if defined(__WXGTK__) || defined(__WXMOTIF__) +#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXQT__) #define wxHAS_GUI_FDIOMANAGER #define wxHAS_GUI_PROCESS_CALLBACKS #endif // ports using wxFDIOManager @@ -48,44 +48,45 @@ public: class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase { public: - virtual wxEventLoopBase *CreateEventLoop(); - virtual int WaitForChild(wxExecuteData& execData); + virtual wxEventLoopBase *CreateEventLoop() wxOVERRIDE; + virtual int WaitForChild(wxExecuteData& execData) wxOVERRIDE; #if wxUSE_TIMER - virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer); + virtual wxTimerImpl *CreateTimerImpl(wxTimer *timer) wxOVERRIDE; #endif #if wxUSE_THREADS && defined(__WXGTK20__) - virtual void MutexGuiEnter(); - virtual void MutexGuiLeave(); + virtual void MutexGuiEnter() wxOVERRIDE; + virtual void MutexGuiLeave() wxOVERRIDE; #endif -#if (defined(__WXMAC__) || defined(__WXCOCOA__)) && wxUSE_STDPATHS - virtual wxStandardPaths& GetStandardPaths(); -#endif - virtual wxPortId GetToolkitVersion(int *majVer = NULL, int *minVer = NULL) const; + wxPortId GetToolkitVersion(int *majVer = NULL, + int *minVer = NULL, + int *microVer = NULL) const wxOVERRIDE; #ifdef __WXGTK20__ - virtual wxString GetDesktopEnvironment() const; + virtual wxString GetDesktopEnvironment() const wxOVERRIDE; virtual wxString GetStandardCmdLineOptions(wxArrayString& names, - wxArrayString& desc) const; + wxArrayString& desc) const wxOVERRIDE; #endif // __WXGTK20____ #if defined(__WXGTK20__) - virtual bool ShowAssertDialog(const wxString& msg); + virtual bool ShowAssertDialog(const wxString& msg) wxOVERRIDE; #endif #if wxUSE_SOCKETS #ifdef wxHAS_GUI_SOCKET_MANAGER - virtual wxSocketManager *GetSocketManager(); + virtual wxSocketManager *GetSocketManager() wxOVERRIDE; #endif #ifdef wxHAS_GUI_FDIOMANAGER - virtual wxFDIOManager *GetFDIOManager(); + virtual wxFDIOManager *GetFDIOManager() wxOVERRIDE; #endif #endif // wxUSE_SOCKETS - virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); +#if wxUSE_EVENTLOOP_SOURCE + virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager() wxOVERRIDE; +#endif }; #endif // wxUSE_GUI diff --git a/Externals/wxWidgets3/include/wx/unix/evtloop.h b/Externals/wxWidgets3/include/wx/unix/evtloop.h index 2b91c72375..5c2d074620 100644 --- a/Externals/wxWidgets3/include/wx/unix/evtloop.h +++ b/Externals/wxWidgets3/include/wx/unix/evtloop.h @@ -33,15 +33,15 @@ public: virtual ~wxConsoleEventLoop(); // implement base class pure virtuals - virtual bool Pending() const; - virtual bool Dispatch(); - virtual int DispatchTimeout(unsigned long timeout); - virtual void WakeUp(); - virtual bool IsOk() const { return m_dispatcher != NULL; } - virtual bool YieldFor(long WXUNUSED(eventsToProcess)) { return true; } + virtual bool Pending() const wxOVERRIDE; + virtual bool Dispatch() wxOVERRIDE; + virtual int DispatchTimeout(unsigned long timeout) wxOVERRIDE; + virtual void WakeUp() wxOVERRIDE; + virtual bool IsOk() const wxOVERRIDE { return m_dispatcher != NULL; } protected: - virtual void OnNextIteration(); + virtual void OnNextIteration() wxOVERRIDE; + virtual void DoYieldFor(long eventsToProcess) wxOVERRIDE; private: // pipe used for wake up messages: when a child thread wants to wake up diff --git a/Externals/wxWidgets3/include/wx/unix/fontutil.h b/Externals/wxWidgets3/include/wx/unix/fontutil.h index 64cb3a3ccd..1c189379b6 100644 --- a/Externals/wxWidgets3/include/wx/unix/fontutil.h +++ b/Externals/wxWidgets3/include/wx/unix/fontutil.h @@ -22,9 +22,9 @@ // returns the handle of the nearest available font or 0 extern wxNativeFont wxLoadQueryNearestFont(int pointSize, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool underlined, const wxString &facename, wxFontEncoding encoding, diff --git a/Externals/wxWidgets3/include/wx/unix/glx11.h b/Externals/wxWidgets3/include/wx/unix/glx11.h index 34ed4dd46d..9295687a4b 100644 --- a/Externals/wxWidgets3/include/wx/unix/glx11.h +++ b/Externals/wxWidgets3/include/wx/unix/glx11.h @@ -12,6 +12,9 @@ #include +class wxGLContextAttrs; +class wxGLAttributes; + // ---------------------------------------------------------------------------- // wxGLContext // ---------------------------------------------------------------------------- @@ -19,10 +22,12 @@ class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: - wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); virtual ~wxGLContext(); - virtual bool SetCurrent(const wxGLCanvas& win) const; + virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; private: // attach context to the drawable or unset it (if NULL) @@ -30,7 +35,7 @@ private: GLXContext m_glContext; - DECLARE_CLASS(wxGLContext) + wxDECLARE_CLASS(wxGLContext); }; // ---------------------------------------------------------------------------- @@ -46,8 +51,8 @@ public: // default ctor doesn't do anything, InitVisual() must be called wxGLCanvasX11(); - // initializes the XVisualInfo corresponding to the given attributes - bool InitVisual(const int *attribList); + // initializes GLXFBConfig and XVisualInfo corresponding to the given attributes + bool InitVisual(const wxGLAttributes& dispAttrs); // frees XVisualInfo info virtual ~wxGLCanvasX11(); @@ -56,7 +61,7 @@ public: // implement wxGLCanvasBase methods // -------------------------------- - virtual bool SwapBuffers(); + virtual bool SwapBuffers() wxOVERRIDE; // X11-specific methods @@ -72,12 +77,15 @@ public: virtual Window GetXWindow() const = 0; + // GLX-specific methods + // -------------------- + // override some wxWindow methods // ------------------------------ // return true only if the window is realized: OpenGL context can't be // created until we are - virtual bool IsShownOnScreen() const; + virtual bool IsShownOnScreen() const wxOVERRIDE; // implementation only from now on @@ -101,17 +109,10 @@ public: // // returns false if XVisualInfo couldn't be initialized, otherwise caller // is responsible for freeing the pointers - static bool InitXVisualInfo(const int *attribList, + static bool InitXVisualInfo(const wxGLAttributes& dispAttrs, GLXFBConfig **pFBC, XVisualInfo **pXVisual); private: - // fills in glattrs with attributes defined by wxattrs which must be - // 0-terminated if it is non-NULL - // - // n is the max size of glattrs, false is returned if we overflow it, it - // should be at least 16 to accommodate the default attributes - static bool ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n); - // this is only used if it's supported i.e. if GL >= 1.3 GLXFBConfig *m_fbc; @@ -137,19 +138,19 @@ public: wxGLApp() : wxGLAppBase() { } // implement wxGLAppBase method - virtual bool InitGLVisual(const int *attribList) + virtual bool InitGLVisual(const int *attribList) wxOVERRIDE { return wxGLCanvasX11::InitDefaultVisualInfo(attribList); } // and implement this wxGTK::wxApp method too - virtual void *GetXVisualInfo() + virtual void *GetXVisualInfo() wxOVERRIDE { return wxGLCanvasX11::GetDefaultXVisualInfo(); } // and override this wxApp method to clean up - virtual int OnExit() + virtual int OnExit() wxOVERRIDE { wxGLCanvasX11::FreeDefaultVisualInfo(); @@ -157,7 +158,7 @@ public: } private: - DECLARE_DYNAMIC_CLASS(wxGLApp) + wxDECLARE_DYNAMIC_CLASS(wxGLApp); }; #endif // _WX_UNIX_GLX11_H_ diff --git a/Externals/wxWidgets3/include/wx/unix/joystick.h b/Externals/wxWidgets3/include/wx/unix/joystick.h index ef7a5db223..a20c936d29 100644 --- a/Externals/wxWidgets3/include/wx/unix/joystick.h +++ b/Externals/wxWidgets3/include/wx/unix/joystick.h @@ -17,8 +17,8 @@ class WXDLLIMPEXP_FWD_CORE wxJoystickThread; class WXDLLIMPEXP_ADV wxJoystick: public wxObject { - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: /* * Public interface */ diff --git a/Externals/wxWidgets3/include/wx/unix/mimetype.h b/Externals/wxWidgets3/include/wx/unix/mimetype.h index df76534aa5..27b303bbe7 100644 --- a/Externals/wxWidgets3/include/wx/unix/mimetype.h +++ b/Externals/wxWidgets3/include/wx/unix/mimetype.h @@ -157,11 +157,10 @@ public: bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = true); bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); -private: wxString GetExpandedCommand(const wxString & verb, const wxFileType::MessageParameters& params) const; - +private: wxMimeTypesManagerImpl *m_manager; wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays }; diff --git a/Externals/wxWidgets3/include/wx/unix/execute.h b/Externals/wxWidgets3/include/wx/unix/private/execute.h similarity index 98% rename from Externals/wxWidgets3/include/wx/unix/execute.h rename to Externals/wxWidgets3/include/wx/unix/private/execute.h index 9756c00a7d..e976d154c7 100644 --- a/Externals/wxWidgets3/include/wx/unix/execute.h +++ b/Externals/wxWidgets3/include/wx/unix/private/execute.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/unix/execute.h +// Name: wx/unix/private/execute.h // Purpose: private details of wxExecute() implementation // Author: Vadim Zeitlin // Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin diff --git a/Externals/wxWidgets3/include/wx/unix/private/wakeuppipe.h b/Externals/wxWidgets3/include/wx/unix/private/wakeuppipe.h index a601478a9f..5bd6db870a 100644 --- a/Externals/wxWidgets3/include/wx/unix/private/wakeuppipe.h +++ b/Externals/wxWidgets3/include/wx/unix/private/wakeuppipe.h @@ -64,10 +64,10 @@ private: // This class can be used from multiple threads, i.e. its WakeUp() can be // called concurrently. -#if wxUSE_THREADS class wxWakeUpPipeMT : public wxWakeUpPipe { +#if wxUSE_THREADS public: wxWakeUpPipeMT() { } @@ -90,12 +90,8 @@ public: private: // Protects access to m_pipeIsEmpty. wxCriticalSection m_pipeLock; + +#endif // wxUSE_THREADS }; -#else // !wxUSE_THREADS - -typedef wxWakeUpPipe wxWakeUpPipeMT; - -#endif // wxUSE_THREADS/!wxUSE_THREADS - #endif // _WX_UNIX_PRIVATE_WAKEUPPIPE_H_ diff --git a/Externals/wxWidgets3/include/wx/unix/sound.h b/Externals/wxWidgets3/include/wx/unix/sound.h index 76efeae3dc..b5aa3ca6a5 100644 --- a/Externals/wxWidgets3/include/wx/unix/sound.h +++ b/Externals/wxWidgets3/include/wx/unix/sound.h @@ -79,7 +79,7 @@ public: static void UnloadBackend(); protected: - bool DoPlay(unsigned flags) const; + bool DoPlay(unsigned flags) const wxOVERRIDE; static void EnsureBackend(); void Free(); diff --git a/Externals/wxWidgets3/include/wx/unix/stackwalk.h b/Externals/wxWidgets3/include/wx/unix/stackwalk.h index e99741934a..f7e3a7de41 100644 --- a/Externals/wxWidgets3/include/wx/unix/stackwalk.h +++ b/Externals/wxWidgets3/include/wx/unix/stackwalk.h @@ -32,7 +32,7 @@ public: } protected: - virtual void OnGetName(); + virtual void OnGetName() wxOVERRIDE; // optimized for the 2 step initialization done by wxStackWalker void Set(const wxString &name, const wxString &filename, const char* syminfo, @@ -72,9 +72,9 @@ public: FreeStack(); } - virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH); + virtual void Walk(size_t skip = 1, size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE; #if wxUSE_ON_FATAL_EXCEPTION - virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) { Walk(2, maxDepth); } + virtual void WalkFromException(size_t maxDepth = wxSTACKWALKER_MAX_DEPTH) wxOVERRIDE { Walk(2, maxDepth); } #endif // wxUSE_ON_FATAL_EXCEPTION static const wxString& GetExePath() { return ms_exepath; } diff --git a/Externals/wxWidgets3/include/wx/unix/stdpaths.h b/Externals/wxWidgets3/include/wx/unix/stdpaths.h index 2f111992a3..74f915398c 100644 --- a/Externals/wxWidgets3/include/wx/unix/stdpaths.h +++ b/Externals/wxWidgets3/include/wx/unix/stdpaths.h @@ -37,17 +37,17 @@ public: // implement base class pure virtuals - virtual wxString GetExecutablePath() const; - virtual wxString GetConfigDir() const; - virtual wxString GetUserConfigDir() const; - virtual wxString GetDataDir() const; - virtual wxString GetLocalDataDir() const; - virtual wxString GetUserDataDir() const; - virtual wxString GetPluginsDir() const; + virtual wxString GetExecutablePath() const wxOVERRIDE; + virtual wxString GetConfigDir() const wxOVERRIDE; + virtual wxString GetUserConfigDir() const wxOVERRIDE; + virtual wxString GetDataDir() const wxOVERRIDE; + virtual wxString GetLocalDataDir() const wxOVERRIDE; + virtual wxString GetUserDataDir() const wxOVERRIDE; + virtual wxString GetPluginsDir() const wxOVERRIDE; virtual wxString GetLocalizedResourcesDir(const wxString& lang, - ResourceCat category) const; + ResourceCat category) const wxOVERRIDE; #ifndef __VMS - virtual wxString GetDocumentsDir() const; + virtual wxString GetUserDir(Dir userDir) const wxOVERRIDE; #endif protected: diff --git a/Externals/wxWidgets3/include/wx/unix/taskbarx11.h b/Externals/wxWidgets3/include/wx/unix/taskbarx11.h index 02a9200941..ffd3e0435b 100644 --- a/Externals/wxWidgets3/include/wx/unix/taskbarx11.h +++ b/Externals/wxWidgets3/include/wx/unix/taskbarx11.h @@ -24,9 +24,9 @@ public: bool IsIconInstalled() const; // Operations: - bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - bool RemoveIcon(); - bool PopupMenu(wxMenu *menu); + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString) wxOVERRIDE; + bool RemoveIcon() wxOVERRIDE; + bool PopupMenu(wxMenu *menu) wxOVERRIDE; protected: wxTaskBarIconArea *m_iconWnd; @@ -34,7 +34,7 @@ protected: private: void OnDestroy(wxWindowDestroyEvent&); - DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) + wxDECLARE_DYNAMIC_CLASS(wxTaskBarIcon); }; #endif // _WX_UNIX_TASKBAR_H_ diff --git a/Externals/wxWidgets3/include/wx/unix/utilsx11.h b/Externals/wxWidgets3/include/wx/unix/utilsx11.h index 29898372fa..e3019acc67 100644 --- a/Externals/wxWidgets3/include/wx/unix/utilsx11.h +++ b/Externals/wxWidgets3/include/wx/unix/utilsx11.h @@ -30,6 +30,13 @@ typedef unsigned long WXKeySym; int wxCharCodeXToWX(WXKeySym keySym); WXKeySym wxCharCodeWXToX(int id); +int wxUnicodeCharXToWX(WXKeySym keySym); + +// Xlib keysym-unicode charactor pair +struct CodePair { + unsigned int keySym; + int uniChar; +}; class wxIconBundle; diff --git a/Externals/wxWidgets3/include/wx/uri.h b/Externals/wxWidgets3/include/wx/uri.h index 758bd72e27..828428e954 100644 --- a/Externals/wxWidgets3/include/wx/uri.h +++ b/Externals/wxWidgets3/include/wx/uri.h @@ -107,6 +107,7 @@ public: void Resolve(const wxURI& base, int flags = wxURI_STRICT); bool IsReference() const; + bool IsRelative() const; protected: void Clear(); @@ -136,11 +137,6 @@ protected: static bool ParseIPv6address(const char*& uri); static bool ParseIPvFuture(const char*& uri); - // should be called with i pointing to '%', returns the encoded character - // following it or -1 if invalid and advances i past it (so that it points - // to the last character consumed on return) - static int DecodeEscape(wxString::const_iterator& i); - // append next character pointer to by p to the string in an escaped form // and advance p past it // @@ -180,7 +176,7 @@ protected: size_t m_fields; - DECLARE_DYNAMIC_CLASS(wxURI) + wxDECLARE_DYNAMIC_CLASS(wxURI); }; #endif // _WX_URI_H_ diff --git a/Externals/wxWidgets3/include/wx/url.h b/Externals/wxWidgets3/include/wx/url.h index 572cae8b11..457b043b9f 100644 --- a/Externals/wxWidgets3/include/wx/url.h +++ b/Externals/wxWidgets3/include/wx/url.h @@ -22,7 +22,7 @@ #include "wx/protocol/http.h" #endif -typedef enum { +enum wxURLError { wxURL_NOERR = 0, wxURL_SNTXERR, wxURL_NOPROTO, @@ -30,7 +30,7 @@ typedef enum { wxURL_NOPATH, wxURL_CONNERR, wxURL_PROTOERR -} wxURLError; +}; #if wxUSE_URL_NATIVE class WXDLLIMPEXP_FWD_NET wxURL; @@ -107,7 +107,7 @@ protected: friend class wxURLModule; private: - DECLARE_DYNAMIC_CLASS(wxURL) + wxDECLARE_DYNAMIC_CLASS(wxURL); }; #endif // wxUSE_URL diff --git a/Externals/wxWidgets3/include/wx/ustring.h b/Externals/wxWidgets3/include/wx/ustring.h index 7c58fddd8a..7790ac1656 100644 --- a/Externals/wxWidgets3/include/wx/ustring.h +++ b/Externals/wxWidgets3/include/wx/ustring.h @@ -134,9 +134,9 @@ public: return utf16_str(); } #else - wchar_t *wc_str() const + const wchar_t *wc_str() const { - return (wchar_t*) c_str(); + return c_str(); } #endif @@ -154,18 +154,18 @@ public: } #if wxUSE_UNICODE_UTF8 - wxScopedCharBuffer wx_str() + wxScopedCharBuffer wx_str() const { return utf8_str(); } #else #if SIZEOF_WCHAR_T == 2 - wxScopedWCharBuffer wx_str() + wxScopedWCharBuffer wx_str() const { return utf16_str(); } #else - const wchar_t* wx_str() + const wchar_t* wx_str() const { return c_str(); } @@ -198,43 +198,17 @@ public: return (wxUString &) base->assign( str, pos, n ); } - // FIXME-VC6: VC 6.0 stl does not support all types of assign functions - #ifdef __VISUALC6__ - wxUString &assign( wxChar32 ch ) - { - wxChar32 chh[1]; - chh[0] = ch; - std::basic_string *base = this; - return (wxUString &)base->assign(chh); - } + wxUString &assign( wxChar32 ch ) + { + std::basic_string *base = this; + return (wxUString &) base->assign( (size_type) 1, ch ); + } - wxUString &assign( size_type n, wxChar32 ch ) - { - wxU32CharBuffer buffer(n); - wxChar32 *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = ch; - p++; - } - - std::basic_string *base = this; - return (wxUString &)base->assign(buffer.data()); - } - #else - wxUString &assign( wxChar32 ch ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( (size_type) 1, ch ); - } - - wxUString &assign( size_type n, wxChar32 ch ) - { - std::basic_string *base = this; - return (wxUString &) base->assign( n, ch ); - } - #endif // __VISUALC6__ + wxUString &assign( size_type n, wxChar32 ch ) + { + std::basic_string *base = this; + return (wxUString &) base->assign( n, ch ); + } wxUString &assign( const wxScopedU32CharBuffer &buf ) { @@ -381,29 +355,11 @@ public: return (wxUString &) base->append( s, n ); } - // FIXME-VC6: VC 6.0 stl does not support all types of append functions - #ifdef __VISUALC6__ - wxUString &append( size_type n, wxChar32 c ) - { - wxU32CharBuffer buffer(n); - wxChar32 *p = buffer.data(); - size_type i; - for (i = 0; i < n; i++) - { - *p = c; - p++; - } - - std::basic_string *base = this; - return (wxUString &) base->append(buffer.data()); - } - #else - wxUString &append( size_type n, wxChar32 c ) - { - std::basic_string *base = this; - return (wxUString &) base->append( n, c ); - } - #endif // __VISUALC6__ + wxUString &append( size_type n, wxChar32 c ) + { + std::basic_string *base = this; + return (wxUString &) base->append( n, c ); + } wxUString &append( wxChar32 c ) { @@ -593,13 +549,13 @@ public: { return assign( s ); } wxUString& operator=(const wxScopedU32CharBuffer &s) { return assign( s ); } - wxUString& operator=(const char ch) + wxUString& operator=(char ch) { return assign( ch ); } - wxUString& operator=(const wxChar16 ch) + wxUString& operator=(wxChar16 ch) { return assign( ch ); } - wxUString& operator=(const wxChar32 ch) + wxUString& operator=(wxChar32 ch) { return assign( ch ); } - wxUString& operator=(const wxUniChar ch) + wxUString& operator=(wxUniChar ch) { return assign( ch ); } wxUString& operator=(const wxUniCharRef ch) { return assign( ch ); } @@ -623,13 +579,13 @@ public: { return append( s ); } wxUString& operator+=(const wxScopedU32CharBuffer &s) { return append( s ); } - wxUString& operator+=(const char ch) + wxUString& operator+=(char ch) { return append( ch ); } - wxUString& operator+=(const wxChar16 ch) + wxUString& operator+=(wxChar16 ch) { return append( ch ); } - wxUString& operator+=(const wxChar32 ch) + wxUString& operator+=(wxChar32 ch) { return append( ch ); } - wxUString& operator+=(const wxUniChar ch) + wxUString& operator+=(wxUniChar ch) { return append( ch ); } wxUString& operator+=(const wxUniCharRef ch) { return append( ch ); } diff --git a/Externals/wxWidgets3/include/wx/utils.h b/Externals/wxWidgets3/include/wx/utils.h index 92701eae15..eda281cb8d 100644 --- a/Externals/wxWidgets3/include/wx/utils.h +++ b/Externals/wxWidgets3/include/wx/utils.h @@ -37,9 +37,7 @@ class WXDLLIMPEXP_FWD_BASE wxArrayInt; // needed for wxOperatingSystemId, wxLinuxDistributionInfo #include "wx/platinfo.h" -#ifdef __WATCOMC__ - #include -#elif defined(__X__) +#if defined(__X__) #include #include #endif @@ -142,8 +140,12 @@ WXDLLIMPEXP_CORE wxVersionInfo wxGetLibraryVersionInfo(); WXDLLIMPEXP_BASE wxString wxGetOsDescription(); // Get OS version -WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = NULL, - int *minorVsn = NULL); +WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *verMaj = NULL, + int *verMin = NULL, + int *verMicro = NULL); + +// Check is OS version is at least the specified major and minor version +WXDLLIMPEXP_BASE bool wxCheckOsVersion(int majorVsn, int minorVsn = 0, int microVsn = 0); // Get platform endianness WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian(); @@ -643,23 +645,6 @@ enum WXDLLIMPEXP_CORE wxString wxStripMenuCodes(const wxString& str, int flags = wxStrip_All); -#if WXWIN_COMPATIBILITY_2_6 -// obsolete and deprecated version, do not use, use the above overload instead -wxDEPRECATED( - WXDLLIMPEXP_CORE wxChar* wxStripMenuCodes(const wxChar *in, wxChar *out = NULL) -); - -#if wxUSE_ACCEL -class WXDLLIMPEXP_FWD_CORE wxAcceleratorEntry; - -// use wxAcceleratorEntry::Create() or FromString() methods instead -wxDEPRECATED( - WXDLLIMPEXP_CORE wxAcceleratorEntry *wxGetAccelFromString(const wxString& label) -); -#endif // wxUSE_ACCEL - -#endif // WXWIN_COMPATIBILITY_2_6 - // ---------------------------------------------------------------------------- // Window search // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/valgen.h b/Externals/wxWidgets3/include/wx/valgen.h index c24142e791..995db4f86a 100644 --- a/Externals/wxWidgets3/include/wx/valgen.h +++ b/Externals/wxWidgets3/include/wx/valgen.h @@ -57,18 +57,18 @@ public: // if you're passing a reference to a validator. // Another possibility is to always pass a pointer to a new validator // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxGenericValidator(*this); } + virtual wxObject *Clone() const wxOVERRIDE { return new wxGenericValidator(*this); } bool Copy(const wxGenericValidator& val); // Called when the value in the window must be validated: this is not used // by this class - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } + virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; } // Called to transfer data to the window - virtual bool TransferToWindow(); + virtual bool TransferToWindow() wxOVERRIDE; // Called to transfer data to the window - virtual bool TransferFromWindow(); + virtual bool TransferFromWindow() wxOVERRIDE; protected: void Initialize(); @@ -85,7 +85,7 @@ protected: double* m_pDouble; private: - DECLARE_CLASS(wxGenericValidator) + wxDECLARE_CLASS(wxGenericValidator); wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator); }; diff --git a/Externals/wxWidgets3/include/wx/validate.h b/Externals/wxWidgets3/include/wx/validate.h index 0adf3bf477..477af1019a 100644 --- a/Externals/wxWidgets3/include/wx/validate.h +++ b/Externals/wxWidgets3/include/wx/validate.h @@ -90,7 +90,7 @@ protected: private: static bool ms_isSilent; - DECLARE_DYNAMIC_CLASS(wxValidator) + wxDECLARE_DYNAMIC_CLASS(wxValidator); wxDECLARE_NO_ASSIGN_CLASS(wxValidator); }; @@ -104,7 +104,8 @@ extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" // everywhere class WXDLLIMPEXP_FWD_CORE wxValidator; - #define wxDefaultValidator (*reinterpret_cast(NULL)) + static const wxValidator* const wxDefaultValidatorPtr = NULL; + #define wxDefaultValidator (*wxDefaultValidatorPtr) // this macro allows to avoid warnings about unused parameters when // wxUSE_VALIDATORS == 0 diff --git a/Externals/wxWidgets3/include/wx/valnum.h b/Externals/wxWidgets3/include/wx/valnum.h index 2fbfe607b8..3e73a730f2 100644 --- a/Externals/wxWidgets3/include/wx/valnum.h +++ b/Externals/wxWidgets3/include/wx/valnum.h @@ -41,7 +41,7 @@ public: // Override base class method to not do anything but always return success: // we don't need this as we do our validation on the fly here. - virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } + virtual bool Validate(wxWindow * WXUNUSED(parent)) wxOVERRIDE { return true; } protected: wxNumValidatorBase(int style) @@ -135,17 +135,11 @@ public: typedef typename BaseValidator::LongestValueType LongestValueType; - // FIXME-VC6: This compiler fails to compile the assert below with a - // nonsensical error C2248: "'LongestValueType' : cannot access protected - // typedef declared in class 'wxIntegerValidatorBase'" so just disable the - // check for it. -#ifndef __VISUALC6__ wxCOMPILE_TIME_ASSERT ( sizeof(ValueType) <= sizeof(LongestValueType), UnsupportedType ); -#endif // __VISUALC6__ void SetMin(ValueType min) { @@ -285,7 +279,7 @@ protected: } // Implement wxNumValidatorBase pure virtual method. - virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const; + virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE; private: // Minimal and maximal values accepted (inclusive). @@ -380,7 +374,7 @@ protected: } // Implement wxNumValidatorBase pure virtual method. - virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const; + virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const wxOVERRIDE; private: // Maximum number of decimals digits after the decimal separator. diff --git a/Externals/wxWidgets3/include/wx/valtext.h b/Externals/wxWidgets3/include/wx/valtext.h index 93f5dd614e..7dbdec176f 100644 --- a/Externals/wxWidgets3/include/wx/valtext.h +++ b/Externals/wxWidgets3/include/wx/valtext.h @@ -46,18 +46,18 @@ public: // if you're passing a reference to a validator. // Another possibility is to always pass a pointer to a new validator // (so the calling code can use a copy constructor of the relevant class). - virtual wxObject *Clone() const { return new wxTextValidator(*this); } + virtual wxObject *Clone() const wxOVERRIDE { return new wxTextValidator(*this); } bool Copy(const wxTextValidator& val); // Called when the value in the window must be validated. // This function can pop up an error message. - virtual bool Validate(wxWindow *parent); + virtual bool Validate(wxWindow *parent) wxOVERRIDE; // Called to transfer data to the window - virtual bool TransferToWindow(); + virtual bool TransferToWindow() wxOVERRIDE; // Called to transfer data from the window - virtual bool TransferFromWindow(); + virtual bool TransferFromWindow() wxOVERRIDE; // Filter keystrokes void OnChar(wxKeyEvent& event); @@ -98,8 +98,8 @@ protected: private: wxDECLARE_NO_ASSIGN_CLASS(wxTextValidator); - DECLARE_DYNAMIC_CLASS(wxTextValidator) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxTextValidator); + wxDECLARE_EVENT_TABLE(); }; #endif diff --git a/Externals/wxWidgets3/include/wx/variant.h b/Externals/wxWidgets3/include/wx/variant.h index 39adc729b9..efb1b5b111 100644 --- a/Externals/wxWidgets3/include/wx/variant.h +++ b/Externals/wxWidgets3/include/wx/variant.h @@ -383,13 +383,13 @@ public: // Attributes protected: - virtual wxObjectRefData *CreateRefData() const; - virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + virtual wxObjectRefData *CreateRefData() const wxOVERRIDE; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE; wxString m_name; private: - DECLARE_DYNAMIC_CLASS(wxVariant) + wxDECLARE_DYNAMIC_CLASS(wxVariant); }; @@ -430,7 +430,7 @@ public: { } - virtual wxAnyValueType* GetAssociatedType() + virtual wxAnyValueType* GetAssociatedType() wxOVERRIDE { return wxAnyValueTypeImpl::GetInstance(); } @@ -438,7 +438,7 @@ private: }; #define DECLARE_WXANY_CONVERSION() \ -virtual bool GetAsAny(wxAny* any) const; \ +virtual bool GetAsAny(wxAny* any) const wxOVERRIDE; \ static wxVariantData* VariantDataFactory(const wxAny& any); #define _REGISTER_WXANY_CONVERSION(T, CLASSNAME, FUNC) \ @@ -457,7 +457,7 @@ bool CLASSNAME::GetAsAny(wxAny* any) const \ } \ wxVariantData* CLASSNAME::VariantDataFactory(const wxAny& any) \ { \ - return new CLASSNAME(wxANY_AS(any, T)); \ + return new CLASSNAME(any.As()); \ } \ REGISTER_WXANY_CONVERSION(T, CLASSNAME) @@ -489,12 +489,12 @@ public:\ \ classname &GetValue() { return m_value; } \ \ - virtual bool Eq(wxVariantData& data) const; \ + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; \ \ - virtual wxString GetType() const; \ - virtual wxClassInfo* GetValueClassInfo(); \ + virtual wxString GetType() const wxOVERRIDE; \ + virtual wxClassInfo* GetValueClassInfo() wxOVERRIDE; \ \ - virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \ + virtual wxVariantData* Clone() const wxOVERRIDE { return new classname##VariantData(m_value); } \ \ DECLARE_WXANY_CONVERSION() \ protected:\ diff --git a/Externals/wxWidgets3/include/wx/variantbase.h b/Externals/wxWidgets3/include/wx/variantbase.h index 732671bdd5..22f4c32788 100644 --- a/Externals/wxWidgets3/include/wx/variantbase.h +++ b/Externals/wxWidgets3/include/wx/variantbase.h @@ -215,7 +215,7 @@ public: } // get a ref to the stored data - template T& Get(wxTEMPLATED_MEMBER_FIX(T)) + template T& Get() { wxVariantDataT *dataptr = wx_dynamic_cast(wxVariantDataT*, m_data); @@ -225,7 +225,7 @@ public: } // get a const ref to the stored data - template const T& Get(wxTEMPLATED_MEMBER_FIX(T)) const + template const T& Get() const { const wxVariantDataT *dataptr = wx_dynamic_cast(const wxVariantDataT*, m_data); @@ -234,7 +234,7 @@ public: return dataptr->Get(); } - template bool HasData(wxTEMPLATED_MEMBER_FIX(T)) const + template bool HasData() const { const wxVariantDataT *dataptr = wx_dynamic_cast(const wxVariantDataT*, m_data); @@ -266,11 +266,11 @@ template void wxStringWriteValue( wxString &s, const T &data); template -void wxToStringConverter( const wxVariantBase &v, wxString &s wxTEMPLATED_FUNCTION_FIX(T)) \ - { wxStringWriteValue( s, v.wxTEMPLATED_MEMBER_CALL(Get, T) ); } +void wxToStringConverter( const wxVariantBase &v, wxString &s ) \ + { wxStringWriteValue( s, v.Get() ); } template -void wxFromStringConverter( const wxString &s, wxVariantBase &v wxTEMPLATED_FUNCTION_FIX(T)) \ +void wxFromStringConverter( const wxString &s, wxVariantBase &v ) \ { T d; wxStringReadValue( s, d ); v = wxVariantBase(d); } diff --git a/Externals/wxWidgets3/include/wx/vector.h b/Externals/wxWidgets3/include/wx/vector.h index e81cafb082..4eb0f856f4 100644 --- a/Externals/wxWidgets3/include/wx/vector.h +++ b/Externals/wxWidgets3/include/wx/vector.h @@ -123,10 +123,6 @@ private: // This cryptic expression means "typedef Ops to wxVectorMemOpsMovable if // type T is movable type, otherwise to wxVectorMemOpsGeneric". // - // Note that we use typedef instead of privately deriving from this (which - // would allowed us to omit "Ops::" prefixes below) to keep VC6 happy, - // it can't compile code that derives from wxIf<...>::value. - // // Note that bcc needs the extra parentheses for non-type template // arguments to compile this expression. typedef typename wxIf< (wxIsMovable::value), @@ -494,9 +490,8 @@ public: #endif // WXWIN_COMPATIBILITY_2_8 private: - // VC6 can't compile static const int members - enum { ALLOC_INITIAL_SIZE = 16 }; - enum { ALLOC_MAX_SIZE = 4096 }; + static const size_type ALLOC_INITIAL_SIZE = 16; + static const size_type ALLOC_MAX_SIZE = 4096; void Copy(const wxVector& vb) { diff --git a/Externals/wxWidgets3/include/wx/version.h b/Externals/wxWidgets3/include/wx/version.h index 16578dc283..57ec66fa40 100644 --- a/Externals/wxWidgets3/include/wx/version.h +++ b/Externals/wxWidgets3/include/wx/version.h @@ -27,9 +27,9 @@ /* NB: this file is parsed by automatic tools so don't change its format! */ #define wxMAJOR_VERSION 3 #define wxMINOR_VERSION 1 -#define wxRELEASE_NUMBER 0 +#define wxRELEASE_NUMBER 1 #define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING wxT("wxWidgets 3.1.0") +#define wxVERSION_STRING wxT("wxWidgets 3.1.1") /* nothing to update below this line when updating the version */ /* ---------------------------------------------------------------------------- */ diff --git a/Externals/wxWidgets3/include/wx/vlbox.h b/Externals/wxWidgets3/include/wx/vlbox.h index 1981110509..2bee9267a1 100644 --- a/Externals/wxWidgets3/include/wx/vlbox.h +++ b/Externals/wxWidgets3/include/wx/vlbox.h @@ -193,7 +193,7 @@ public: void RefreshSelected(); - virtual wxVisualAttributes GetDefaultAttributes() const + virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE { return GetClassDefaultAttributes(GetWindowVariant()); } @@ -202,7 +202,7 @@ public: GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_THEME; } + virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_THEME; } // the derived class must implement this function to actually draw the item // with the given index on the provided DC @@ -232,7 +232,7 @@ protected: // allows us to add borders to the items easily // // this function is not supposed to be overridden by the derived classes - virtual wxCoord OnGetRowHeight(size_t line) const; + virtual wxCoord OnGetRowHeight(size_t line) const wxOVERRIDE; // event handlers @@ -302,9 +302,9 @@ private: // the selection bg colour wxColour m_colBgSel; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxVListBox); - DECLARE_ABSTRACT_CLASS(wxVListBox) + wxDECLARE_ABSTRACT_CLASS(wxVListBox); }; #endif // _WX_VLBOX_H_ diff --git a/Externals/wxWidgets3/include/wx/vscroll.h b/Externals/wxWidgets3/include/wx/vscroll.h index 2312d78f0b..550d2cd471 100644 --- a/Externals/wxWidgets3/include/wx/vscroll.h +++ b/Externals/wxWidgets3/include/wx/vscroll.h @@ -124,7 +124,7 @@ public: // change the DC origin according to the scroll position. To properly // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() // derived class - virtual void DoPrepareDC(wxDC& dc); + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; // the methods to be called from the window event handlers void HandleOnScroll(wxScrollWinEvent& event); @@ -326,23 +326,23 @@ public: size_t GetVisibleRowsEnd() const { return GetVisibleEnd(); } bool IsRowVisible(size_t row) const { return IsVisible(row); } - virtual int GetOrientationTargetSize() const + virtual int GetOrientationTargetSize() const wxOVERRIDE { return GetTargetWindow()->GetClientSize().y; } - virtual int GetNonOrientationTargetSize() const + virtual int GetNonOrientationTargetSize() const wxOVERRIDE { return GetTargetWindow()->GetClientSize().x; } - virtual wxOrientation GetOrientation() const { return wxVERTICAL; } + virtual wxOrientation GetOrientation() const wxOVERRIDE { return wxVERTICAL; } protected: // this function must be overridden in the derived class and it should // return the size of the given row in pixels virtual wxCoord OnGetRowHeight(size_t n) const = 0; - wxCoord OnGetUnitSize(size_t n) const { return OnGetRowHeight(n); } + wxCoord OnGetUnitSize(size_t n) const wxOVERRIDE { return OnGetRowHeight(n); } virtual void OnGetRowsHeightHint(size_t WXUNUSED(rowMin), size_t WXUNUSED(rowMax)) const { } // forward calls to OnGetRowsHeightHint() - virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const + virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const wxOVERRIDE { OnGetRowsHeightHint(unitMin, unitMax); } // again, if not overridden, it will fall back on default method @@ -350,7 +350,7 @@ protected: { return DoEstimateTotalSize(); } // forward calls to EstimateTotalHeight() - virtual wxCoord EstimateTotalSize() const { return EstimateTotalHeight(); } + virtual wxCoord EstimateTotalSize() const wxOVERRIDE { return EstimateTotalHeight(); } wxCoord GetRowsHeight(size_t rowMin, size_t rowMax) const { return GetUnitsSize(rowMin, rowMax); } @@ -406,31 +406,31 @@ public: { return IsVisible(column); } - virtual int GetOrientationTargetSize() const + virtual int GetOrientationTargetSize() const wxOVERRIDE { return GetTargetWindow()->GetClientSize().x; } - virtual int GetNonOrientationTargetSize() const + virtual int GetNonOrientationTargetSize() const wxOVERRIDE { return GetTargetWindow()->GetClientSize().y; } - virtual wxOrientation GetOrientation() const { return wxHORIZONTAL; } + virtual wxOrientation GetOrientation() const wxOVERRIDE { return wxHORIZONTAL; } protected: // this function must be overridden in the derived class and it should // return the size of the given column in pixels virtual wxCoord OnGetColumnWidth(size_t n) const = 0; - wxCoord OnGetUnitSize(size_t n) const { return OnGetColumnWidth(n); } + wxCoord OnGetUnitSize(size_t n) const wxOVERRIDE { return OnGetColumnWidth(n); } virtual void OnGetColumnsWidthHint(size_t WXUNUSED(columnMin), size_t WXUNUSED(columnMax)) const { } // forward calls to OnGetColumnsWidthHint() - virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const + virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const wxOVERRIDE { OnGetColumnsWidthHint(unitMin, unitMax); } // again, if not overridden, it will fall back on default method virtual wxCoord EstimateTotalWidth() const { return DoEstimateTotalSize(); } // forward calls to EstimateTotalWidth() - virtual wxCoord EstimateTotalSize() const { return EstimateTotalWidth(); } + virtual wxCoord EstimateTotalSize() const wxOVERRIDE { return EstimateTotalWidth(); } wxCoord GetColumnsWidth(size_t columnMin, size_t columnMax) const { return GetUnitsSize(columnMin, columnMax); } @@ -513,7 +513,7 @@ public: // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER() // derived class. We use this version to call both base classes' // DoPrepareDC() - virtual void DoPrepareDC(wxDC& dc); + virtual void DoPrepareDC(wxDC& dc) wxOVERRIDE; // replacement implementation of wxWindow::Layout virtual method. To // properly forward calls to wxWindow::Layout use @@ -655,8 +655,8 @@ typedef wxVarVScrollHelper wxVarVScrollLegacyAdaptor; // classes #define WX_FORWARD_TO_VAR_SCROLL_HELPER() \ public: \ - virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } \ - virtual bool Layout() { return ScrollLayout(); } + virtual void PrepareDC(wxDC& dc) wxOVERRIDE { DoPrepareDC(dc); } \ + virtual bool Layout() wxOVERRIDE { return ScrollLayout(); } @@ -727,12 +727,12 @@ public: #ifdef __WXMAC__ protected: - virtual void UpdateMacScrollWindow() { Update(); } + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } #endif // __WXMAC__ private: wxDECLARE_NO_COPY_CLASS(wxVScrolledWindow); - DECLARE_ABSTRACT_CLASS(wxVScrolledWindow) + wxDECLARE_ABSTRACT_CLASS(wxVScrolledWindow); }; @@ -794,12 +794,12 @@ public: #ifdef __WXMAC__ protected: - virtual void UpdateMacScrollWindow() { Update(); } + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } #endif // __WXMAC__ private: wxDECLARE_NO_COPY_CLASS(wxHScrolledWindow); - DECLARE_ABSTRACT_CLASS(wxHScrolledWindow) + wxDECLARE_ABSTRACT_CLASS(wxHScrolledWindow); }; @@ -859,12 +859,12 @@ public: #ifdef __WXMAC__ protected: - virtual void UpdateMacScrollWindow() { Update(); } + virtual void UpdateMacScrollWindow() wxOVERRIDE { Update(); } #endif // __WXMAC__ private: wxDECLARE_NO_COPY_CLASS(wxHVScrolledWindow); - DECLARE_ABSTRACT_CLASS(wxHVScrolledWindow) + wxDECLARE_ABSTRACT_CLASS(wxHVScrolledWindow); }; #endif // _WX_VSCROLL_H_ diff --git a/Externals/wxWidgets3/include/wx/weakref.h b/Externals/wxWidgets3/include/wx/weakref.h index b692f037e8..4794c85ef0 100644 --- a/Externals/wxWidgets3/include/wx/weakref.h +++ b/Externals/wxWidgets3/include/wx/weakref.h @@ -13,22 +13,6 @@ #include "wx/tracker.h" -// Some compilers (VC6, Borland, g++ < 3.3) have problem with template specialization. -// However, this is only used for optimization purposes (a smaller wxWeakRef pointer) -// (and the corner case of wxWeakRef). So for those compilers, we can fall -// back to the non-optimal case, where we use the same type of weak ref (static one) -// in all cases. See defs.h for various setting these defines depending on compiler. - -#if !defined(HAVE_PARTIAL_SPECIALIZATION) || \ - !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) || \ - (defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 3)) - #define USE_ONLY_STATIC_WEAKREF -#endif - - -#ifndef USE_ONLY_STATIC_WEAKREF - -// Avoid including this for simpler compilers #include "wx/meta/convertible.h" #include "wx/meta/int2type.h" @@ -38,200 +22,35 @@ struct wxIsStaticTrackable enum { value = wxConvertibleTo::value }; }; -#endif // !USE_ONLY_STATIC_WEAKREF - -// Weak ref implementation when T has wxTrackable as a known base class +// A weak reference to an object of type T (which must inherit from wxTrackable) template -class wxWeakRefStatic : public wxTrackerNode -{ -public: - wxWeakRefStatic() : m_pobj(NULL) { } - - void Release() - { - // Release old object if any - if ( m_pobj ) - { - // Remove ourselves from object tracker list - wxTrackable *pt = static_cast(m_pobj); - pt->RemoveNode(this); - m_pobj = NULL; - } - } - - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT(m_pobj != NULL); - m_pobj = NULL; - } - -protected: - void Assign(T* pobj) - { - if ( m_pobj == pobj ) - return; - - Release(); - - // Now set new trackable object - if ( pobj ) - { - // Add ourselves to object tracker list - wxTrackable *pt = static_cast(pobj); - pt->AddNode(this); - m_pobj = pobj; - } - } - - void AssignCopy(const wxWeakRefStatic& wr) - { - Assign( wr.m_pobj ); - } - - T *m_pobj; -}; - - - -#ifndef USE_ONLY_STATIC_WEAKREF - -template -struct wxWeakRefImpl; - -// Intermediate class, to select the static case above. -template -struct wxWeakRefImpl : public wxWeakRefStatic -{ - enum { value = 1 }; -}; - -// Weak ref implementation when T does not have wxTrackable as known base class -template -struct wxWeakRefImpl : public wxTrackerNode -{ - void Release() - { - // Release old object if any - if ( m_pobj ) - { - // Remove ourselves from object tracker list - m_ptbase->RemoveNode(this); - m_pobj = NULL; - m_ptbase = NULL; - } - } - - virtual void OnObjectDestroy() - { - // Tracked object itself removes us from list of trackers - wxASSERT(m_pobj != NULL); - m_pobj = NULL; - m_ptbase = NULL; - } - -protected: - wxWeakRefImpl() : m_pobj(NULL), m_ptbase(NULL) { } - - // Assign receives most derived class here and can use that - template - void Assign( TDerived* pobj ) - { - AssignHelper( pobj, wxInt2Type::value>() ); - } - - template - void AssignHelper(TDerived* pobj, wxInt2Type) - { - wxTrackable *ptbase = static_cast(pobj); - DoAssign( pobj, ptbase ); - } - -#ifndef wxNO_RTTI - void AssignHelper(T* pobj, wxInt2Type) - { - // A last way to get a trackable pointer - wxTrackable *ptbase = dynamic_cast(pobj); - if ( ptbase ) - { - DoAssign( pobj, ptbase ); - } - else - { - wxFAIL_MSG( "Tracked class should inherit from wxTrackable" ); - - Release(); - } - } -#endif // RTTI enabled - - void AssignCopy(const wxWeakRefImpl& wr) - { - DoAssign(wr.m_pobj, wr.m_ptbase); - } - - void DoAssign( T* pobj, wxTrackable *ptbase ) { - if( m_pobj==pobj ) return; - Release(); - - // Now set new trackable object - if( pobj ) - { - // Add ourselves to object tracker list - wxASSERT( ptbase ); - ptbase->AddNode( this ); - m_pobj = pobj; - m_ptbase = ptbase; - } - } - - T *m_pobj; - wxTrackable *m_ptbase; -}; - -#endif // #ifndef USE_ONLY_STATIC_WEAKREF - - - -// A weak reference to an object of type T, where T has base wxTrackable -// (usually statically but if not dynamic_cast<> is tried). -template -class wxWeakRef : public -#ifdef USE_ONLY_STATIC_WEAKREF - wxWeakRefStatic -#else - wxWeakRefImpl::value != 0> -#endif +class wxWeakRef : public wxTrackerNode { public: typedef T element_type; // Default ctor - wxWeakRef() { } + wxWeakRef() : m_pobj(NULL), m_ptbase(NULL) { } - // Enabling this ctor for VC6 results in mysterious compilation failures in - // wx/window.h when assigning wxWindow pointers (FIXME-VC6) -#ifndef __VISUALC6__ // Ctor from the object of this type: this is needed as the template ctor // below is not used by at least g++4 when a literal NULL is used - wxWeakRef(T *pobj) + wxWeakRef(T *pobj) : m_pobj(NULL), m_ptbase(NULL) { this->Assign(pobj); } -#endif // !__VISUALC6__ // When we have the full type here, static_cast<> will always work // (or give a straight compiler error). template - wxWeakRef(TDerived* pobj) + wxWeakRef(TDerived* pobj) : m_pobj(NULL), m_ptbase(NULL) { this->Assign(pobj); } // We need this copy ctor, since otherwise a default compiler (binary) copy // happens (if embedded as an object member). - wxWeakRef(const wxWeakRef& wr) + wxWeakRef(const wxWeakRef& wr) : m_pobj(NULL), m_ptbase(NULL) { this->Assign(wr.get()); } @@ -250,6 +69,64 @@ public: T* get() const { return this->m_pobj; } operator T*() const { return this->m_pobj; } + +public: + void Release() + { + // Release old object if any + if ( m_pobj ) + { + // Remove ourselves from object tracker list + m_ptbase->RemoveNode(this); + m_pobj = NULL; + m_ptbase = NULL; + } + } + + virtual void OnObjectDestroy() wxOVERRIDE + { + // Tracked object itself removes us from list of trackers + wxASSERT(m_pobj != NULL); + m_pobj = NULL; + m_ptbase = NULL; + } + +protected: + // Assign receives most derived class here and can use that + template + void Assign( TDerived* pobj ) + { + wxCOMPILE_TIME_ASSERT( wxIsStaticTrackable::value, + Tracked_class_should_inherit_from_wxTrackable ); + wxTrackable *ptbase = static_cast(pobj); + DoAssign(pobj, ptbase); + } + + void AssignCopy(const wxWeakRef& wr) + { + DoAssign(wr.m_pobj, wr.m_ptbase); + } + + void DoAssign(T* pobj, wxTrackable *ptbase) + { + if ( m_pobj == pobj ) + return; + + Release(); + + // Now set new trackable object + if ( pobj ) + { + // Add ourselves to object tracker list + wxASSERT( ptbase ); + ptbase->AddNode( this ); + m_pobj = pobj; + m_ptbase = ptbase; + } + } + + T *m_pobj; + wxTrackable *m_ptbase; }; @@ -300,7 +177,7 @@ public: } } - virtual void OnObjectDestroy() + virtual void OnObjectDestroy() wxOVERRIDE { wxASSERT_MSG(m_pobj, "tracked object should have removed us itself"); diff --git a/Externals/wxWidgets3/include/wx/webview.h b/Externals/wxWidgets3/include/wx/webview.h index 25a235da9d..4f18bada70 100644 --- a/Externals/wxWidgets3/include/wx/webview.h +++ b/Externals/wxWidgets3/include/wx/webview.h @@ -237,8 +237,8 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewEvent : public wxNotifyEvent { public: wxWebViewEvent() {} - wxWebViewEvent(wxEventType type, int id, const wxString url, - const wxString target) + wxWebViewEvent(wxEventType type, int id, const wxString& url, + const wxString& target) : wxNotifyEvent(type, id), m_url(url), m_target(target) {} @@ -246,7 +246,7 @@ public: const wxString& GetURL() const { return m_url; } const wxString& GetTarget() const { return m_target; } - virtual wxEvent* Clone() const { return new wxWebViewEvent(*this); } + virtual wxEvent* Clone() const wxOVERRIDE { return new wxWebViewEvent(*this); } private: wxString m_url; wxString m_target; diff --git a/Externals/wxWidgets3/include/wx/webviewarchivehandler.h b/Externals/wxWidgets3/include/wx/webviewarchivehandler.h index 8b2eb19908..6157b6b107 100644 --- a/Externals/wxWidgets3/include/wx/webviewarchivehandler.h +++ b/Externals/wxWidgets3/include/wx/webviewarchivehandler.h @@ -26,7 +26,7 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewArchiveHandler : public wxWebViewHandler public: wxWebViewArchiveHandler(const wxString& scheme); virtual ~wxWebViewArchiveHandler(); - virtual wxFSFile* GetFile(const wxString &uri); + virtual wxFSFile* GetFile(const wxString &uri) wxOVERRIDE; private: wxFileSystem* m_fileSystem; }; diff --git a/Externals/wxWidgets3/include/wx/webviewfshandler.h b/Externals/wxWidgets3/include/wx/webviewfshandler.h index ebdbbcb906..275410ab3f 100644 --- a/Externals/wxWidgets3/include/wx/webviewfshandler.h +++ b/Externals/wxWidgets3/include/wx/webviewfshandler.h @@ -27,7 +27,7 @@ class WXDLLIMPEXP_WEBVIEW wxWebViewFSHandler : public wxWebViewHandler public: wxWebViewFSHandler(const wxString& scheme); virtual ~wxWebViewFSHandler(); - virtual wxFSFile* GetFile(const wxString &uri); + virtual wxFSFile* GetFile(const wxString &uri) wxOVERRIDE; private: wxFileSystem* m_fileSystem; }; diff --git a/Externals/wxWidgets3/include/wx/wfstream.h b/Externals/wxWidgets3/include/wx/wfstream.h index 613b4c273b..990e4ab114 100644 --- a/Externals/wxWidgets3/include/wx/wfstream.h +++ b/Externals/wxWidgets3/include/wx/wfstream.h @@ -35,20 +35,20 @@ public: wxFileInputStream(int fd); virtual ~wxFileInputStream(); - wxFileOffset GetLength() const; + virtual wxFileOffset GetLength() const wxOVERRIDE; bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } wxFile* GetFile() const { return m_file; } protected: wxFileInputStream(); - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; protected: wxFile *m_file; @@ -65,22 +65,22 @@ public: wxFileOutputStream(int fd); virtual ~wxFileOutputStream(); - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE { return m_file_destroy ? m_file->Close() : true; } + virtual wxFileOffset GetLength() const wxOVERRIDE; bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } wxFile* GetFile() const { return m_file; } protected: wxFileOutputStream(); - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; protected: wxFile *m_file; @@ -95,18 +95,18 @@ public: wxTempFileOutputStream(const wxString& fileName); virtual ~wxTempFileOutputStream(); - bool Close() { return Commit(); } + bool Close() wxOVERRIDE { return Commit(); } WXDLLIMPEXP_INLINE_BASE virtual bool Commit() { return m_file->Commit(); } WXDLLIMPEXP_INLINE_BASE virtual void Discard() { m_file->Discard(); } - wxFileOffset GetLength() const { return m_file->Length(); } - bool IsSeekable() const { return true; } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_file->Length(); } + virtual bool IsSeekable() const wxOVERRIDE { return true; } protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE { return m_file->Seek(pos, mode); } - wxFileOffset OnSysTell() const { return m_file->Tell(); } + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_file->Tell(); } private: wxTempFile *m_file; @@ -119,29 +119,29 @@ class WXDLLIMPEXP_BASE wxFileStream : public wxFileInputStream, { public: wxFileStream(const wxString& fileName); - virtual bool IsOk() const; + virtual bool IsOk() const wxOVERRIDE; // override (some) virtual functions inherited from both classes to resolve // ambiguities (this wouldn't be necessary if wxStreamBase were a virtual // base class but it isn't) - virtual bool IsSeekable() const + virtual bool IsSeekable() const wxOVERRIDE { return wxFileInputStream::IsSeekable(); } - virtual wxFileOffset GetLength() const + virtual wxFileOffset GetLength() const wxOVERRIDE { return wxFileInputStream::GetLength(); } protected: - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE { return wxFileInputStream::OnSysSeek(pos, mode); } - virtual wxFileOffset OnSysTell() const + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return wxFileInputStream::OnSysTell(); } @@ -166,20 +166,20 @@ public: wxFFileInputStream(FILE *file); virtual ~wxFFileInputStream(); - wxFileOffset GetLength() const; + virtual wxFileOffset GetLength() const wxOVERRIDE; bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } wxFFile* GetFile() const { return m_file; } protected: wxFFileInputStream(); - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; protected: wxFFile *m_file; @@ -196,22 +196,22 @@ public: wxFFileOutputStream(FILE *file); virtual ~wxFFileOutputStream(); - void Sync(); - bool Close() { return m_file_destroy ? m_file->Close() : true; } - wxFileOffset GetLength() const; + void Sync() wxOVERRIDE; + bool Close() wxOVERRIDE { return m_file_destroy ? m_file->Close() : true; } + virtual wxFileOffset GetLength() const wxOVERRIDE; bool Ok() const { return IsOk(); } - virtual bool IsOk() const; - bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } + virtual bool IsOk() const wxOVERRIDE; + virtual bool IsSeekable() const wxOVERRIDE { return m_file->GetKind() == wxFILE_KIND_DISK; } wxFFile* GetFile() const { return m_file; } protected: wxFFileOutputStream(); - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode); - wxFileOffset OnSysTell() const; + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE; protected: wxFFile *m_file; @@ -229,25 +229,25 @@ public: // override some virtual functions to resolve ambiguities, just as in // wxFileStream - virtual bool IsOk() const; + virtual bool IsOk() const wxOVERRIDE; - virtual bool IsSeekable() const + virtual bool IsSeekable() const wxOVERRIDE { return wxFFileInputStream::IsSeekable(); } - virtual wxFileOffset GetLength() const + virtual wxFileOffset GetLength() const wxOVERRIDE { return wxFFileInputStream::GetLength(); } protected: - virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) + virtual wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode) wxOVERRIDE { return wxFFileInputStream::OnSysSeek(pos, mode); } - virtual wxFileOffset OnSysTell() const + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return wxFFileInputStream::OnSysTell(); } diff --git a/Externals/wxWidgets3/include/wx/window.h b/Externals/wxWidgets3/include/wx/window.h index fc37b81944..80938e9fb1 100644 --- a/Externals/wxWidgets3/include/wx/window.h +++ b/Externals/wxWidgets3/include/wx/window.h @@ -54,7 +54,10 @@ // Otherwise wx itself must ensure that when the parent is disabled its // children are disabled too, and their initial state is restored when the // parent is enabled back. -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) + // must do everything ourselves + #undef wxHAS_NATIVE_ENABLED_MANAGEMENT +#elif defined(__WXOSX__) // must do everything ourselves #undef wxHAS_NATIVE_ENABLED_MANAGEMENT #else @@ -67,7 +70,6 @@ class WXDLLIMPEXP_FWD_CORE wxCaret; class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; class WXDLLIMPEXP_FWD_CORE wxDC; class WXDLLIMPEXP_FWD_CORE wxDropTarget; class WXDLLIMPEXP_FWD_CORE wxLayoutConstraints; @@ -230,7 +232,7 @@ public: // window id uniquely identifies the window among its siblings unless // it is wxID_ANY which means "don't care" - void SetId( wxWindowID winid ) { m_windowId = winid; } + virtual void SetId( wxWindowID winid ) { m_windowId = winid; } wxWindowID GetId() const { return m_windowId; } // generate a unique id (or count of them consecutively), returns a @@ -402,8 +404,6 @@ public: wxDEPRECATED_MSG("use GetEffectiveMinSize() instead") wxSize GetBestFittingSize() const; - wxDEPRECATED_MSG("use GetEffectiveMinSize() instead") - wxSize GetAdjustedMinSize() const; // A 'Smart' SetSize that will fill in default size values with 'best' // size. Sets the minsize to what was passed in. @@ -527,9 +527,8 @@ public: // returns the magnification of the content of this window // eg 2.0 for a window on a retina screen - virtual double GetContentScaleFactor() const - { return 1.0; } - + virtual double GetContentScaleFactor() const; + // return the size of the left/right and top/bottom borders in x and y // components of the result respectively virtual wxSize GetWindowBorderSize() const; @@ -876,13 +875,10 @@ public: bool HandleWindowEvent(wxEvent& event) const; // disable wxEvtHandler double-linked list mechanism: - virtual void SetNextHandler(wxEvtHandler *handler); - virtual void SetPreviousHandler(wxEvtHandler *handler); + virtual void SetNextHandler(wxEvtHandler *handler) wxOVERRIDE; + virtual void SetPreviousHandler(wxEvtHandler *handler) wxOVERRIDE; - // Watcom doesn't allow reducing access with using access declaration, see - // #10749 -#ifndef __WATCOMC__ protected: // NOTE: we change the access specifier of the following wxEvtHandler functions @@ -903,7 +899,6 @@ protected: using wxEvtHandler::ProcessPendingEvents; using wxEvtHandler::AddPendingEvent; using wxEvtHandler::QueueEvent; -#endif // __WATCOMC__ public: @@ -949,8 +944,54 @@ public: #endif // wxUSE_HOTKEY - // dialog units translations - // ------------------------- + // translation between different units + // ----------------------------------- + + // DPI-independent pixels, or DIPs, are pixel values for the standard + // 96 DPI display, they are scaled to take the current resolution into + // account (i.e. multiplied by the same factor as returned by + // GetContentScaleFactor()) if necessary for the current platform. + // + // Currently the conversion factor is the same for all windows but this + // will change with the monitor-specific resolution support in the + // future, so prefer using the non-static member functions. + // + // Similarly, currently in practice the factor is the same in both + // horizontal and vertical directions, but this could, in principle, + // change too, so prefer using the overloads taking wxPoint or wxSize. + + static wxSize FromDIP(const wxSize& sz, const wxWindowBase* w); + static wxPoint FromDIP(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = FromDIP(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int FromDIP(int d, const wxWindowBase* w) + { + return FromDIP(wxSize(d, 0), w).x; + } + + wxSize FromDIP(const wxSize& sz) const { return FromDIP(sz, this); } + wxPoint FromDIP(const wxPoint& pt) const { return FromDIP(pt, this); } + int FromDIP(int d) const { return FromDIP(d, this); } + + static wxSize ToDIP(const wxSize& sz, const wxWindowBase* w); + static wxPoint ToDIP(const wxPoint& pt, const wxWindowBase* w) + { + const wxSize sz = ToDIP(wxSize(pt.x, pt.y), w); + return wxPoint(sz.x, sz.y); + } + static int ToDIP(int d, const wxWindowBase* w) + { + return ToDIP(wxSize(d, 0), w).x; + } + + wxSize ToDIP(const wxSize& sz) const { return ToDIP(sz, this); } + wxPoint ToDIP(const wxPoint& pt) const { return ToDIP(pt, this); } + int ToDIP(int d) const { return ToDIP(d, this); } + + + // Dialog units are based on the size of the current font. wxPoint ConvertPixelsToDialog( const wxPoint& pt ) const; wxPoint ConvertDialogToPixels( const wxPoint& pt ) const; @@ -1310,7 +1351,7 @@ public: #if wxUSE_TOOLTIPS // the easiest way to set a tooltip for a window is to use this method - void SetToolTip( const wxString &tip ); + void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); } // attach a tooltip to the window, pointer can be NULL to remove // existing tooltip void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } @@ -1330,7 +1371,7 @@ public: 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 + // that doesn't support tooltips void SetToolTip(const wxString & WXUNUSED(tip)) { } void UnsetToolTip() { } #endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS @@ -1496,13 +1537,23 @@ public: virtual wxWindow *GetMainWindowOfCompositeControl() { return (wxWindow*)this; } - // If this function returns true, keyboard navigation events shouldn't + enum NavigationKind + { + Navigation_Tab, + Navigation_Accel + }; + + // If this function returns true, keyboard events of the given kind can'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; } + // returns false) but still are self-contained navigation domains for the + // purposes of TAB navigation -- but not for the accelerators. + virtual bool IsTopNavigationDomain(NavigationKind WXUNUSED(kind)) const + { + return false; + } protected: @@ -1525,8 +1576,8 @@ protected: const wxString& name); // event handling specific to wxWindow - virtual bool TryBefore(wxEvent& event); - virtual bool TryAfter(wxEvent& event); + virtual bool TryBefore(wxEvent& event) wxOVERRIDE; + virtual bool TryAfter(wxEvent& event) wxOVERRIDE; enum WindowOrder { @@ -1785,6 +1836,7 @@ protected: virtual void DoCentre(int dir); #if wxUSE_TOOLTIPS + virtual void DoSetToolTipText( const wxString &tip ); virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS @@ -1839,9 +1891,9 @@ private: unsigned int m_freezeCount; - DECLARE_ABSTRACT_CLASS(wxWindowBase) + wxDECLARE_ABSTRACT_CLASS(wxWindowBase); wxDECLARE_NO_COPY_CLASS(wxWindowBase); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; @@ -1889,6 +1941,9 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) #define wxWindowGTK wxWindow #endif // wxUniv #include "wx/gtk/window.h" + #ifdef __WXGTK3__ + #define wxHAVE_DPI_INDEPENDENT_PIXELS + #endif #elif defined(__WXGTK__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowGTK @@ -1913,20 +1968,14 @@ inline void wxWindowBase::SetInitialBestSize(const wxSize& size) #define wxWindowMac wxWindow #endif // wxUniv #include "wx/osx/window.h" -#elif defined(__WXCOCOA__) + #define wxHAVE_DPI_INDEPENDENT_PIXELS +#elif defined(__WXQT__) #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowCocoa + #define wxWindowNative wxWindowQt #else // !wxUniv - #define wxWindowCocoa wxWindow + #define wxWindowQt wxWindow #endif // wxUniv - #include "wx/cocoa/window.h" -#elif defined(__WXPM__) - #ifdef __WXUNIVERSAL__ - #define wxWindowNative wxWindowOS2 - #else // !wxUniv - #define wxWindowOS2 wxWindow - #endif // wxUniv/!wxUniv - #include "wx/os2/window.h" + #include "wx/qt/window.h" #endif // for wxUniversal, we now derive the real wxWindow from wxWindow, @@ -1949,6 +1998,27 @@ inline wxWindow *wxWindowBase::GetGrandParent() const return m_parent ? m_parent->GetParent() : NULL; } +#ifdef wxHAVE_DPI_INDEPENDENT_PIXELS + +// FromDIP() and ToDIP() become trivial in this case, so make them inline to +// avoid any overhead. + +/* static */ +inline wxSize +wxWindowBase::FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) +{ + return sz; +} + +/* static */ +inline wxSize +wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) +{ + return sz; +} + +#endif // wxHAVE_DPI_INDEPENDENT_PIXELS + // ---------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------- @@ -1966,11 +2036,6 @@ extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); // get the (first) top level parent window WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win); -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED_MSG("use wxWindow::NewControlId() instead") - inline wxWindowID NewControlId() { return wxWindowBase::NewControlId(); } -#endif // WXWIN_COMPATIBILITY_2_6 - #if wxUSE_ACCESSIBILITY // ---------------------------------------------------------------------------- // accessible object for windows diff --git a/Externals/wxWidgets3/include/wx/wizard.h b/Externals/wxWidgets3/include/wx/wizard.h index 82dc438ac4..0adffd253e 100644 --- a/Externals/wxWidgets3/include/wx/wizard.h +++ b/Externals/wxWidgets3/include/wx/wizard.h @@ -80,19 +80,19 @@ public: #if wxUSE_VALIDATORS // Override the base functions to allow a validator to be assigned to this page. - virtual bool TransferDataToWindow() + virtual bool TransferDataToWindow() wxOVERRIDE { return GetValidator() ? GetValidator()->TransferToWindow() : wxPanel::TransferDataToWindow(); } - virtual bool TransferDataFromWindow() + virtual bool TransferDataFromWindow() wxOVERRIDE { return GetValidator() ? GetValidator()->TransferFromWindow() : wxPanel::TransferDataFromWindow(); } - virtual bool Validate() + virtual bool Validate() wxOVERRIDE { return GetValidator() ? GetValidator()->Validate(this) : wxPanel::Validate(); @@ -106,7 +106,7 @@ protected: wxBitmap m_bitmap; private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPage); }; // ---------------------------------------------------------------------------- @@ -165,8 +165,8 @@ public: } // base class pure virtuals - virtual wxWizardPage *GetPrev() const; - virtual wxWizardPage *GetNext() const; + virtual wxWizardPage *GetPrev() const wxOVERRIDE; + virtual wxWizardPage *GetNext() const wxOVERRIDE; private: // common part of ctors: @@ -180,7 +180,7 @@ private: wxWizardPage *m_prev, *m_next; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWizardPageSimple); }; // ---------------------------------------------------------------------------- @@ -246,9 +246,9 @@ public: /// Override these functions to stop InitDialog from calling TransferDataToWindow /// for _all_ pages when the wizard starts. Instead 'ShowPage' will call /// TransferDataToWindow for the first page only. - bool TransferDataToWindow() { return true; } - bool TransferDataFromWindow() { return true; } - bool Validate() { return true; } + bool TransferDataToWindow() wxOVERRIDE { return true; } + bool TransferDataFromWindow() wxOVERRIDE { return true; } + bool Validate() wxOVERRIDE { return true; } private: wxDECLARE_NO_COPY_CLASS(wxWizardBase); @@ -279,13 +279,13 @@ public: wxWizardPage* GetPage() const { return m_page; } - virtual wxEvent *Clone() const { return new wxWizardEvent(*this); } + virtual wxEvent *Clone() const wxOVERRIDE { return new wxWizardEvent(*this); } private: bool m_direction; wxWizardPage* m_page; - DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWizardEvent) + wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWizardEvent); }; // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/wrapsizer.h b/Externals/wxWidgets3/include/wx/wrapsizer.h index a4d6145002..f401c260df 100644 --- a/Externals/wxWidgets3/include/wx/wrapsizer.h +++ b/Externals/wxWidgets3/include/wx/wrapsizer.h @@ -35,12 +35,12 @@ public: virtual ~wxWrapSizer(); // override base class virtual methods - virtual wxSize CalcMin(); - virtual void RecalcSizes(); + virtual wxSize CalcMin() wxOVERRIDE; + virtual void RecalcSizes() wxOVERRIDE; virtual bool InformFirstDirection(int direction, int size, - int availableOtherDir); + int availableOtherDir) wxOVERRIDE; protected: // This method is called to decide if an item represents empty space or @@ -93,7 +93,7 @@ protected: wxBoxSizer m_rows; // Sizer containing multiple rows of our items - DECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxWrapSizer); }; #endif // _WX_WRAPSIZER_H_ diff --git a/Externals/wxWidgets3/include/wx/wx_cw.h b/Externals/wxWidgets3/include/wx/wx_cw.h deleted file mode 100644 index 9a74cb1790..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cw.h +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cw.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#else - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#else - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wx_cw_cm.h b/Externals/wxWidgets3/include/wx/wx_cw_cm.h deleted file mode 100644 index c6c64b9e07..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cw_cm.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Name: wx/wx_cw_cm.h - Purpose: wxWidgets definitions for CodeWarrior builds - Author: Stefan Csomor - Modified by: - Created: - RCS-ID: $Id: wx_cw_cm.h 42655 2006-10-29 20:17:29Z VZ $ - Copyright: (c) Stefan Csomor - Licence: wxWindows licence -*/ - -#define MSL_USE_PRECOMPILED_HEADERS 0 -#if __WXDEBUG__ - // mac os assert levels - #define DEBUG 1 - #define DEBUG_INTERNAL 1 -#endif -#if !defined( __MWERKS__ ) - #error "this file is only for builds with Metrowerks CodeWarrior" -#endif - -// defined if the compiler does not want the classname repeated for inlines -// within a class definition -#define WX_COMP_INLINE_NO_CLASS - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ - #define __MAC__ - #define __WXMAC__ -#elif (__MWERKS__ >= 0x0900) && __INTEL__ - #define WIN32 - #define _WINDOWS - #define __WXMSW__ - #define __WINDOWS__ - #define __WIN95__ - #define __WIN32__ - #define STRICT - #define NOMINMAX -#elif __BEOS__ - #include - #include -#else - #error unknown MW compiler -#endif - -#ifdef __WXMSW__ - #include - #include - #ifdef __MWERKS__ - #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 - #define fileno _fileno - #define fdopen _fdopen - #define tell _tell - #endif - #endif -#elif defined( __WXMAC__) - /* Set to 0 if you don't want to use precompiled MacHeaders */ - #define USE_PRECOMPILED_MAC_HEADERS 0 - #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 - #define OPAQUE_TOOLBOX_STRUCTS 1 - - /* CW8.3+ has mbstate_t */ - #if defined(__MACH__) && __MWERKS__ < 0x3003 - typedef int mbstate_t; - #define _MBSTATE_T - #endif - - /* CW8.3+ has ssize_t */ - #if defined(__MACH__) && __MWERKS__ >= 0x3003 - #define HAVE_SSIZE_T - #endif - - #include - // for getting the correct expat includes - #define MACOS_CLASSIC - /* - #include - #if UNIVERSAL_INTERFACES_VERSION < 0x0340 - #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" - #endif - */ -#endif - -#define USE_DEFINE - diff --git a/Externals/wxWidgets3/include/wx/wx_cw_d.h b/Externals/wxWidgets3/include/wx/wx_cw_d.h deleted file mode 100644 index 57817419d2..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cw_d.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cw_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#else - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wx_cwc.h b/Externals/wxWidgets3/include/wx/wx_cwc.h deleted file mode 100644 index ba7103117f..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwc.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwc.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwc.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++_prof.mch" - #elif __POWERPC__ - #include "wx_Carbon++_prof.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach_prof.mch" - #elif __POWERPC__ - #include "wx_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++.mch" - #elif __POWERPC__ - #include "wx_Carbon++.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach.mch" - #elif __POWERPC__ - #include "wx_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wx_cwc_d.h b/Externals/wxWidgets3/include/wx/wx_cwc_d.h deleted file mode 100644 index 1c4e169b9b..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwc_d.h +++ /dev/null @@ -1,38 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwc_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwc_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ < 0x3200 - #pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wx_Mach++_d.mch" - #elif __POWERPC__ - #include "wx_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wx_Mach_d.mch" - #elif __POWERPC__ - #include "wx_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wx_cwcocoa.h b/Externals/wxWidgets3/include/wx/wx_cwcocoa.h deleted file mode 100644 index 8d56aaf377..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwcocoa.h +++ /dev/null @@ -1,66 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwcocoa.h -// Purpose: Metrowerks Prefix Header File (wxCocoa Release) -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: David Elliott -// Created: 10/22/2004 -// RCS-ID: $Id: wx_cwcocoa.h 64943 2010-07-13 13:29:58Z VZ $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW_COCOA__ -#define _WX_CW_COCOA__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm_prof.mch" - #else - #include "wx_cocoaMach-Omm_prof.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++_prof.mch" - #else - #include "wx_cocoaMach-O++_prof.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX_prof.mch" - #else - #include "wx_cocoaMach-O_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm.mch" - #else - #include "wx_cocoaMach-Omm.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++.mch" - #else - #include "wx_cocoaMach-O++.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX.mch" - #else - #include "wx_cocoaMach-O.mch" - #endif -#endif -#endif - -#endif - // _WX_CW_COCOA__ diff --git a/Externals/wxWidgets3/include/wx/wx_cwcocoa_cm.h b/Externals/wxWidgets3/include/wx/wx_cwcocoa_cm.h deleted file mode 100644 index ead817a924..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwcocoa_cm.h +++ /dev/null @@ -1,85 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwcocoa_cm.h -// Purpose: Metrowerks wxCocoa PCH common definitions -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: -// Created: 10/04/2004 -// RCS-ID: $Id: wx_cwcocoa_cm.h 64943 2010-07-13 13:29:58Z VZ $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#define MSL_USE_PRECOMPILED_HEADERS 0 -#if __WXDEBUG__ - // mac os assert levels - #define DEBUG 1 - #define DEBUG_INTERNAL 1 -#endif -#if !defined( __MWERKS__ ) - #error "this file is only for builds with Metrowerks CodeWarrior" -#endif - -#define WX_COMP_INLINE_NO_CLASS // defined if the compiler does not want the classname repeated for inlines within a class definition - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if (__MWERKS__ < 0x0900) || macintosh || __MACH__ - #define __MAC__ - #define __WXCOCOA__ -#elif (__MWERKS__ >= 0x0900) && __INTEL__ - #define WIN32 - #define _WINDOWS - #define __WXMSW__ - #define __WINDOWS__ - #define __WIN95__ - #define __WIN32__ - #define STRICT - #define NOMINMAX -#elif __BEOS__ - #include - #include -#else - #error unknown MW compiler -#endif - -#ifdef __WXMSW__ - #include - #include - #ifdef __MWERKS__ - #if defined( __MSL__ ) && __MSL__ >= 0x5012 && __MSL__ < 0x7000 - #define fileno _fileno - #define fdopen _fdopen - #define tell _tell - #endif - #endif -#elif defined( __WXMAC__) - #define USE_PRECOMPILED_MAC_HEADERS 0 /*Set to 0 if you don't want to use precompiled MacHeaders*/ - #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 - #define OPAQUE_TOOLBOX_STRUCTS 1 - #ifdef __MACH__ - #include - #include - #include - #undef WCHAR_MAX - #include - #else - #include - #endif - // for getting the correct expat includes - #define MACOS_CLASSIC - /* - #include - #if UNIVERSAL_INTERFACES_VERSION < 0x0340 - #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" - #endif - */ -#elif defined( __WXCOCOA__) //tommy - #if defined(__OBJC__) - #include "CocoaHeaders.m" - #endif //defined(__OBJC__) -#endif - -#define USE_DEFINE - diff --git a/Externals/wxWidgets3/include/wx/wx_cwcocoa_d.h b/Externals/wxWidgets3/include/wx/wx_cwcocoa_d.h deleted file mode 100644 index 8a3c37138f..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwcocoa_d.h +++ /dev/null @@ -1,47 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwcocoa_d.h -// Purpose: Metrowerks Prefix Header File (wxCocoa Debug) -// Author: Tommy Tian (tommy.tian@webex.com) -// Modified by: David Elliott -// Created: 10/04/2004 -// RCS-ID: $Id: wx_cwcocoa_d.h 64943 2010-07-13 13:29:58Z VZ $ -// Copyright: (c) Tommy Tian -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#ifndef _WX_CW_COCOA__ -#define _WX_CW_COCOA__ - -#if __MWERKS__ >= 0x2400 && __MWERKS__ <= 0x3200 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __OBJC__ - #if __mwlinker__ - #include "wx_cocoaMacOSXmm_d.mch" - #else - #include "wx_cocoaMach-Omm_d.mch" - #endif - #else - #if __mwlinker__ - #include "wx_cocoaMacOSX++_d.mch" - #else - #include "wx_cocoaMach-O++_d.mch" - #endif - #endif -#else - #if __mwlinker__ - #include "wx_cocoaMacOSX_d.mch" - #else - #include "wx_cocoaMach-O_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW_COCOA__ diff --git a/Externals/wxWidgets3/include/wx/wx_cwu_d.h b/Externals/wxWidgets3/include/wx/wx_cwu_d.h deleted file mode 100644 index ee658e5703..0000000000 --- a/Externals/wxWidgets3/include/wx/wx_cwu_d.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wx_cwu_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wx_cwu_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#else - #if __POWERPC__ - #include - #elif __INTEL__ - #include - #elif __CFM68K__ - #include - #else - #include - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxcrt.h b/Externals/wxWidgets3/include/wx/wxcrt.h index dd579364fa..dbf556310c 100644 --- a/Externals/wxWidgets3/include/wx/wxcrt.h +++ b/Externals/wxWidgets3/include/wx/wxcrt.h @@ -16,8 +16,8 @@ #include "wx/string.h" #ifndef __WX_SETUP_H__ -// For non-configure builds assume vsscanf is available, if not Visual C or DMC -#if !defined (__VISUALC__) && !defined (__DMC__) +// For non-configure builds assume vsscanf is available, if not Visual C +#if !defined (__VISUALC__) #define HAVE_VSSCANF 1 #endif #endif @@ -95,7 +95,7 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar)); } - inline wxChar* wxTmemset(wxChar* szOut, const wxChar cIn, size_t len) + inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len) { wxChar* szRet = szOut; @@ -117,7 +117,7 @@ inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) { return (char*)memcpy(szOut, szIn, len); } inline char* wxTmemmove(char* szOut, const char* szIn, size_t len) { return (char*)memmove(szOut, szIn, len); } -inline char* wxTmemset(char* szOut, const char cIn, size_t len) +inline char* wxTmemset(char* szOut, char cIn, size_t len) { return (char*)memset(szOut, cIn, len); } @@ -464,9 +464,8 @@ WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) // the template's implementation uses overloaded function declared later (see // the wxStrcoll() call in wxStrcoll_String()), so we have to // 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) && !wxCHECK_GCC_VERSION(4,7))) || defined(__clang__) +// this causes problems with GCC visibility in newer GCC versions. +#if !(wxCHECK_GCC_VERSION(3,5) && !wxCHECK_GCC_VERSION(4,7)) || defined(__clang__) #define wxNEEDS_DECL_BEFORE_TEMPLATE #endif @@ -907,9 +906,6 @@ WX_STRTOX_FUNC(wxULongLong_t, wxStrtoull, wxCRT_StrtoullA, wxCRT_StrtoullW) #undef WX_STRTOX_FUNC -// there is no command interpreter under CE, hence no system() -#ifndef __WXWINCE__ - // mingw32 doesn't provide _tsystem() even though it provides other stdlib.h // functions in their wide versions #ifdef wxCRT_SystemW @@ -918,8 +914,6 @@ inline int wxSystem(const wxString& str) { return wxCRT_SystemW(str.wc_str()); } inline int wxSystem(const wxString& str) { return wxCRT_SystemA(str.mb_str()); } #endif -#endif // !__WXWINCE__/__WXWINCE__ - inline char* wxGetenv(const char *name) { return wxCRT_GetenvA(name); } inline wchar_t* wxGetenv(const wchar_t *name) { return wxCRT_GetenvW(name); } inline char* wxGetenv(const wxString& name) { return wxCRT_GetenvA(name.mb_str()); } diff --git a/Externals/wxWidgets3/include/wx/wxcrtbase.h b/Externals/wxWidgets3/include/wx/wxcrtbase.h index 1c3522ec66..9b84d737bd 100644 --- a/Externals/wxWidgets3/include/wx/wxcrtbase.h +++ b/Externals/wxWidgets3/include/wx/wxcrtbase.h @@ -37,7 +37,7 @@ #include #include -#if defined(__WINDOWS__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) #include #endif @@ -46,61 +46,29 @@ #endif /* - Using -std=c++{98,0x} option with mingw32 disables most of standard - library extensions, so we can't rely on the presence of common non-ANSI - functions, define a special symbol to test for this. Notice that this - doesn't need to be done for g++ under Linux where _GNU_SOURCE (which is - defined by default) still makes all common extensions available even in - ANSI mode. - */ -#if defined(__MINGW32__) && defined(__STRICT_ANSI__) - #define __WX_STRICT_ANSI_GCC__ -#endif - -/* - a few compilers don't have the (non standard but common) isascii function, - define it ourselves for them + Traditional MinGW doesn't declare isascii() in strict ANSI mode and we can't + declare it here ourselves as it's an inline function, so use our own + replacement instead. */ #ifndef isascii - #if defined(__WX_STRICT_ANSI_GCC__) + #if defined(wxNEEDS_STRICT_ANSI_WORKAROUNDS) #define wxNEED_ISASCII - #elif defined(_WIN32_WCE) - #if _WIN32_WCE <= 211 - #define wxNEED_ISASCII - #endif #endif #endif /* isascii */ #ifdef wxNEED_ISASCII inline int isascii(int c) { return (unsigned)c < 0x80; } + + // Avoid further (re)definitions of it. + #define isascii isascii #endif -#ifdef _WIN32_WCE - #if _WIN32_WCE <= 211 - #define isspace(c) ((c) == wxT(' ') || (c) == wxT('\t')) - #endif -#endif /* _WIN32_WCE */ - /* string.h functions */ -#ifndef strdup - #if defined(__WXWINCE__) - #if _WIN32_WCE <= 211 - #define wxNEED_STRDUP - #endif - #endif -#endif /* strdup */ #ifdef wxNEED_STRDUP WXDLLIMPEXP_BASE char *strdup(const char* s); #endif -/* missing functions in some WinCE versions */ -#ifdef _WIN32_WCE -#if (_WIN32_WCE < 300) -WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); -#endif -#endif /* _WIN32_WCE */ - /* ------------------------------------------------------------------------- UTF-8 locale handling @@ -154,30 +122,26 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrspnW wcsspn #define wxCRT_StrstrW wcsstr -/* these functions are not defined under CE, at least in VC8 CRT */ -#if !defined(__WXWINCE__) - #define wxCRT_StrcollA strcoll - #define wxCRT_StrxfrmA strxfrm +#define wxCRT_StrcollA strcoll +#define wxCRT_StrxfrmA strxfrm - #define wxCRT_StrcollW wcscoll - #define wxCRT_StrxfrmW wcsxfrm -#endif /* __WXWINCE__ */ +#define wxCRT_StrcollW wcscoll +#define wxCRT_StrxfrmW wcsxfrm /* Almost all compilers have strdup(), but VC++ and MinGW call it _strdup(). - And it's not available in MinGW strict ANSI mode nor under Windows CE. */ + And we need to declare it manually for MinGW in strict ANSI mode. */ #if (defined(__VISUALC__) && __VISUALC__ >= 1400) #define wxCRT_StrdupA _strdup #elif defined(__MINGW32__) - #ifndef __WX_STRICT_ANSI_GCC__ - #define wxCRT_StrdupA _strdup - #endif -#elif !defined(__WXWINCE__) + wxDECL_FOR_STRICT_MINGW32(char*, _strdup, (const char *)) + #define wxCRT_StrdupA _strdup +#else #define wxCRT_StrdupA strdup #endif -/* most Windows compilers provide _wcsdup() */ -#if defined(__WINDOWS__) && \ - !(defined(__CYGWIN__) || defined(__WX_STRICT_ANSI_GCC__)) +/* Windows compilers provide _wcsdup() except for (old) Cygwin */ +#if defined(__WINDOWS__) && !defined(__CYGWIN__) + wxDECL_FOR_STRICT_MINGW32(wchar_t*, _wcsdup, (const wchar_t*)) #define wxCRT_StrdupW _wcsdup #elif defined(HAVE_WCSDUP) #define wxCRT_StrdupW wcsdup @@ -197,18 +161,38 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxCRT_StrtodA strtod #define wxCRT_StrtolA strtol #define wxCRT_StrtoulA strtoul + +#ifdef __ANDROID__ // these functions are broken on android + +extern double android_wcstod(const wchar_t *nptr, wchar_t **endptr); +extern long android_wcstol(const wchar_t *nptr, wchar_t **endptr, int base); +extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int base); + +#define wxCRT_StrtodW android_wcstod +#define wxCRT_StrtolW android_wcstol +#define wxCRT_StrtoulW android_wcstoul +#else #define wxCRT_StrtodW wcstod #define wxCRT_StrtolW wcstol #define wxCRT_StrtoulW wcstoul +#endif #ifdef __VISUALC__ - #if __VISUALC__ >= 1300 && !defined(__WXWINCE__) - #define wxCRT_StrtollA _strtoi64 - #define wxCRT_StrtoullA _strtoui64 - #define wxCRT_StrtollW _wcstoi64 - #define wxCRT_StrtoullW _wcstoui64 - #endif /* VC++ 7+ */ + #define wxCRT_StrtollA _strtoi64 + #define wxCRT_StrtoullA _strtoui64 + #define wxCRT_StrtollW _wcstoi64 + #define wxCRT_StrtoullW _wcstoui64 #else + /* Both of these functions are implemented in C++11 compilers */ + #if defined(__cplusplus) && __cplusplus >= 201103L + #ifndef HAVE_STRTOULL + #define HAVE_STRTOULL + #endif + #ifndef HAVE_WCSTOULL + #define HAVE_WCSTOULL + #endif + #endif + #ifdef HAVE_STRTOULL #define wxCRT_StrtollA strtoll #define wxCRT_StrtoullA strtoull @@ -221,10 +205,9 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #endif /* - Only VC8 and later provide strnlen() and wcsnlen() functions under Windows - and it's also only available starting from Windows CE 6.0 only in CE build. + Only VC8 and later provide strnlen() and wcsnlen() functions under Windows. */ -#if wxCHECK_VISUALC_VERSION(8) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 0x600)) +#if wxCHECK_VISUALC_VERSION(8) #ifndef HAVE_STRNLEN #define HAVE_STRNLEN #endif @@ -243,15 +226,16 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); /* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */ -#if defined(__BORLANDC__) || defined(__WATCOMC__) || \ - defined(__VISAGECPP__) || \ - defined(__EMX__) || defined(__DJGPP__) +#if defined(__BORLANDC__) #define wxCRT_StricmpA stricmp #define wxCRT_StrnicmpA strnicmp -#elif defined(__SYMANTEC__) || (defined(__VISUALC__) && !defined(__WXWINCE__)) +#elif defined(__VISUALC__) || defined(__MINGW32__) + wxDECL_FOR_STRICT_MINGW32(int, _stricmp, (const char*, const char*)) + wxDECL_FOR_STRICT_MINGW32(int, _strnicmp, (const char*, const char*, size_t)) + #define wxCRT_StricmpA _stricmp #define wxCRT_StrnicmpA _strnicmp -#elif defined(__UNIX__) || (defined(__GNUWIN32__) && !defined(__WX_STRICT_ANSI_GCC__)) +#elif defined(__UNIX__) #define wxCRT_StricmpA strcasecmp #define wxCRT_StrnicmpA strncasecmp /* #else -- use wxWidgets implementation */ @@ -443,30 +427,15 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha #define wxCRT_Rename rename #else /* Unicode filenames */ - /* special case: these functions are missing under Win9x with Unicows so we - have to implement them ourselves */ - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) - WXDLLIMPEXP_BASE FILE* wxMSLU__wfopen(const wchar_t *name, const wchar_t *mode); - WXDLLIMPEXP_BASE FILE* wxMSLU__wfreopen(const wchar_t *name, const wchar_t *mode, FILE *stream); - WXDLLIMPEXP_BASE int wxMSLU__wrename(const wchar_t *oldname, const wchar_t *newname); - WXDLLIMPEXP_BASE int wxMSLU__wremove(const wchar_t *name); - #define wxCRT_Fopen wxMSLU__wfopen - #define wxCRT_Freopen wxMSLU__wfreopen - #define wxCRT_Remove wxMSLU__wremove - #define wxCRT_Rename wxMSLU__wrename - #else - /* WinCE CRT doesn't provide these functions so use our own */ - #ifdef __WXWINCE__ - WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src, - const wchar_t *dst); - WXDLLIMPEXP_BASE int wxCRT_Remove(const wchar_t *path); - #else - #define wxCRT_Rename _wrename - #define wxCRT_Remove _wremove - #endif - #define wxCRT_Fopen _wfopen - #define wxCRT_Freopen _wfreopen - #endif + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfopen, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfreopen, (const wchar_t*, const wchar_t*, FILE*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrename, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wremove, (const wchar_t*)) + + #define wxCRT_Rename _wrename + #define wxCRT_Remove _wremove + #define wxCRT_Fopen _wfopen + #define wxCRT_Freopen _wfreopen #endif /* wxMBFILES/!wxMBFILES */ @@ -512,30 +481,18 @@ WXDLLIMPEXP_BASE int wxCRT_FputcW(wchar_t wc, FILE *stream); */ #define wxTmpnam(x) wxTmpnam_is_insecure_use_wxTempFile_instead -/* FIXME-CE: provide our own perror() using ::GetLastError() */ -#ifndef __WXWINCE__ - #define wxCRT_PerrorA perror #ifdef wxHAVE_TCHAR_SUPPORT #define wxCRT_PerrorW _wperror #endif -#endif /* !__WXWINCE__ */ - /* ------------------------------------------------------------------------- stdlib.h ------------------------------------------------------------------------- */ -/* there are no env vars at all under CE, so no _tgetenv neither */ -#ifdef __WXWINCE__ - /* can't define as inline function as this is a C file... */ - #define wxCRT_GetenvA(name) (name, NULL) - #define wxCRT_GetenvW(name) (name, NULL) -#else - #define wxCRT_GetenvA getenv - #ifdef _tgetenv - #define wxCRT_GetenvW _wgetenv - #endif +#define wxCRT_GetenvA getenv +#ifdef _tgetenv + #define wxCRT_GetenvW _wgetenv #endif #ifndef wxCRT_GetenvW @@ -553,7 +510,10 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); #define wxCRT_AtoiA atoi #define wxCRT_AtolA atol -#if defined(wxHAVE_TCHAR_SUPPORT) && !defined(__WX_STRICT_ANSI_GCC__) +#if defined(wxHAVE_TCHAR_SUPPORT) + wxDECL_FOR_STRICT_MINGW32(int, _wtoi, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(long, _wtol, (const wchar_t*)) + #define wxCRT_AtoiW _wtoi #define wxCRT_AtolW _wtol /* _wtof doesn't exist */ @@ -613,23 +573,17 @@ WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, ctype.h ------------------------------------------------------------------------- */ -#ifdef __WATCOMC__ - #define WXWCHAR_T_CAST(c) (wint_t)(c) -#else - #define WXWCHAR_T_CAST(c) c -#endif - -#define wxCRT_IsalnumW(c) iswalnum(WXWCHAR_T_CAST(c)) -#define wxCRT_IsalphaW(c) iswalpha(WXWCHAR_T_CAST(c)) -#define wxCRT_IscntrlW(c) iswcntrl(WXWCHAR_T_CAST(c)) -#define wxCRT_IsdigitW(c) iswdigit(WXWCHAR_T_CAST(c)) -#define wxCRT_IsgraphW(c) iswgraph(WXWCHAR_T_CAST(c)) -#define wxCRT_IslowerW(c) iswlower(WXWCHAR_T_CAST(c)) -#define wxCRT_IsprintW(c) iswprint(WXWCHAR_T_CAST(c)) -#define wxCRT_IspunctW(c) iswpunct(WXWCHAR_T_CAST(c)) -#define wxCRT_IsspaceW(c) iswspace(WXWCHAR_T_CAST(c)) -#define wxCRT_IsupperW(c) iswupper(WXWCHAR_T_CAST(c)) -#define wxCRT_IsxdigitW(c) iswxdigit(WXWCHAR_T_CAST(c)) +#define wxCRT_IsalnumW(c) iswalnum(c) +#define wxCRT_IsalphaW(c) iswalpha(c) +#define wxCRT_IscntrlW(c) iswcntrl(c) +#define wxCRT_IsdigitW(c) iswdigit(c) +#define wxCRT_IsgraphW(c) iswgraph(c) +#define wxCRT_IslowerW(c) iswlower(c) +#define wxCRT_IsprintW(c) iswprint(c) +#define wxCRT_IspunctW(c) iswpunct(c) +#define wxCRT_IsspaceW(c) iswspace(c) +#define wxCRT_IsupperW(c) iswupper(c) +#define wxCRT_IsxdigitW(c) iswxdigit(c) #ifdef __GLIBC__ #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) @@ -643,14 +597,34 @@ WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, #define wxCRT_ToupperW towupper #endif #else /* !__GLIBC__ */ - /* There is a bug in VC6 C RTL: toxxx() functions dosn't do anything + /* There is a bug in MSVC RTL: toxxx() functions dosn't do anything with signed chars < 0, so "fix" it here. */ #define wxCRT_TolowerW(c) towlower((wxUChar)(wxChar)(c)) #define wxCRT_ToupperW(c) towupper((wxUChar)(wxChar)(c)) #endif /* __GLIBC__/!__GLIBC__ */ +/* The Android platform, as of 2014, only support most wide-char function with + the exception of multi-byte encoding/decoding functions & wsprintf/wsscanf + See android-ndk-r9d/docs/STANDALONE-TOOLCHAIN.html (section 7.2) + In fact, mbstowcs/wcstombs are defined and compile, but don't work correctly +*/ +#if defined(__WXQT__) && defined(__ANDROID__) + #define wxNEED_WX_MBSTOWCS + #undef HAVE_WCSRTOMBS + // TODO: use Qt built-in required functionality +#endif +#if defined(wxNEED_WX_MBSTOWCS) && defined(__ANDROID__) + #warning "Custom mb/wchar conv. only works for ASCII, see Android NDK notes" + WXDLLIMPEXP_BASE size_t android_mbstowcs(wchar_t *, const char *, size_t); + WXDLLIMPEXP_BASE size_t android_wcstombs(char *, const wchar_t *, size_t); + #define wxMbstowcs android_mbstowcs + #define wxWcstombs android_wcstombs +#else + #define wxMbstowcs mbstowcs + #define wxWcstombs wcstombs +#endif /* ------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/include/wx/wxcrtvararg.h b/Externals/wxWidgets3/include/wx/wxcrtvararg.h index 08d6981e26..b1af0e656f 100644 --- a/Externals/wxWidgets3/include/wx/wxcrtvararg.h +++ b/Externals/wxWidgets3/include/wx/wxcrtvararg.h @@ -92,10 +92,6 @@ #endif #endif /* __MINGW32__ */ -#if defined(__WATCOMC__) - #define HAVE_VSWPRINTF 1 -#endif - #if wxUSE_PRINTF_POS_PARAMS /* The systems where vsnprintf() supports positional parameters should @@ -120,7 +116,7 @@ The 2003 PSDK includes a slightly earlier version of VC8 than the main release and does not have the printf_p functions. */ - #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 && !defined __WXWINCE__ + #if defined _MSC_FULL_VER && _MSC_FULL_VER >= 140050727 #define wxCRT_VsnprintfA _vsprintf_p #define wxCRT_VsnprintfW _vswprintf_p #endif @@ -145,12 +141,9 @@ #define wxCRT_VsnprintfW _vsnwprintf #elif defined(HAVE_VSWPRINTF) #define wxCRT_VsnprintfW vswprintf - #elif defined(__WATCOMC__) - #define wxCRT_VsnprintfW _vsnwprintf #endif - #if defined(HAVE_VSNPRINTF) \ - || defined(__WATCOMC__) + #if defined(HAVE_VSNPRINTF) #ifdef HAVE_BROKEN_VSNPRINTF_DECL #define wxCRT_VsnprintfA wx_fixed_vsnprintf #else @@ -202,10 +195,10 @@ so on but not all systems have them so use our own implementations in this case. */ -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) +#if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF) #define wxNEED_WPRINTF #endif -#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF) +#if !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF) && defined(HAVE_VSSCANF) #define wxNEED_VSWSCANF #endif @@ -269,14 +262,6 @@ // user-friendly wrappers to CRT functions // ---------------------------------------------------------------------------- -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - #define wxPrintf wxPrintf_Impl - #define wxFprintf wxFprintf_Impl - #define wxSprintf wxSprintf_Impl - #define wxSnprintf wxSnprintf_Impl -#endif - // FIXME-UTF8: remove this #if wxUSE_UNICODE #define wxCRT_PrintfNative wxCRT_PrintfW @@ -393,27 +378,6 @@ wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr); #endif // wxUSE_UNICODE -#ifdef __WATCOMC__ - // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351 - // - // fortunately, OpenWatcom implements __VA_ARGS__, so we can provide macros - // that cast the format argument to wxString: - #undef wxPrintf - #undef wxFprintf - #undef wxSprintf - #undef wxSnprintf - - #define wxPrintf(fmt, ...) \ - wxPrintf_Impl(wxFormatString(fmt), __VA_ARGS__) - #define wxFprintf(f, fmt, ...) \ - wxFprintf_Impl(f, wxFormatString(fmt), __VA_ARGS__) - #define wxSprintf(s, fmt, ...) \ - wxSprintf_Impl(s, wxFormatString(fmt), __VA_ARGS__) - #define wxSnprintf(s, n, fmt, ...) \ - wxSnprintf_Impl(s, n, wxFormatString(fmt), __VA_ARGS__) -#endif // __WATCOMC__ - - // We can't use wxArgNormalizer for variadic arguments to wxScanf() etc. // because they are writable, so instead of providing friendly template // vararg-like functions, we just provide both char* and wchar_t* variants diff --git a/Externals/wxWidgets3/include/wx/wxprec.h b/Externals/wxWidgets3/include/wx/wxprec.h index 2b50dff4b3..e1fc0459cf 100644 --- a/Externals/wxWidgets3/include/wx/wxprec.h +++ b/Externals/wxWidgets3/include/wx/wxprec.h @@ -13,13 +13,7 @@ // check if to use precompiled headers: do it for most Windows compilers unless // explicitly disabled by defining NOPCH -#if defined(__VISUALC__) || \ - defined(__DMC__) || \ - defined(__VISAGECPP__) || \ - defined(__WATCOMC__) || \ - defined(__BORLANDC__) - - +#if defined(__VISUALC__) || defined(__BORLANDC__) // If user did not request NOCPH and we're not building using configure // then assume user wants precompiled headers. #if !defined(NOPCH) && !defined(__WX_SETUP_H__) @@ -27,11 +21,6 @@ #endif #endif -// For some reason, this must be defined for common dialogs to work. -#ifdef __WATCOMC__ - #define INCLUDE_COMMDLG_H 1 -#endif - #ifdef WX_PRECOMP // include "wx/chartype.h" first to ensure that UNICODE macro is correctly set @@ -49,11 +38,6 @@ #include "wx/msw/missing.h" #endif -// include -#ifdef __OS2__ -# include "wx/os2/private.h" -#endif - // include the most common wx headers #include "wx/wx.h" diff --git a/Externals/wxWidgets3/include/wx/wxshlb_cw.h b/Externals/wxWidgets3/include/wx/wxshlb_cw.h deleted file mode 100644 index 4220ee4019..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlb_cw.h +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlb_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cw.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++_prof.mch" - #elif __INTEL__ - #include "wxshlb_x86++_prof.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++_prof.mch" - #else - #include "wxshlb_68k++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC_prof.mch" - #elif __INTEL__ - #include "wxshlb_x86_prof.mch" - #elif __CFM68K__ - #include "wxshlb_cfm_prof.mch" - #else - #include "wxshlb_68k_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++.mch" - #elif __INTEL__ - #include "wxshlb_x86++.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++.mch" - #else - #include "wxshlb_68k++.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC.mch" - #elif __INTEL__ - #include "wxshlb_x86.mch" - #elif __CFM68K__ - #include "wxshlb_cfm.mch" - #else - #include "wxshlb_68k.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlb_cw_d.h b/Externals/wxWidgets3/include/wx/wxshlb_cw_d.h deleted file mode 100644 index 2a0d543521..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlb_cw_d.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlb_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cw_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_PPC++_d.mch" - #elif __INTEL__ - #include "wxshlb_x86++_d.mch" - #elif __CFM68K__ - #include "wxshlb_cfm++_d.mch" - #else - #include "wxshlb_68k++_d.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_PPC_d.mch" - #elif __INTEL__ - #include "wxshlb_x86_d.mch" - #elif __CFM68K__ - #include "wxshlb_cfm_d.mch" - #else - #include "wxshlb_68k_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlb_cwc.h b/Externals/wxWidgets3/include/wx/wxshlb_cwc.h deleted file mode 100644 index 7743207f94..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlb_cwc.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlb_cwc.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cwc.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlb_Carbon++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlb_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __MACH__ - #include "wxshlb_Mach++.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon++.mch" - #endif -#else - #if __MACH__ - #include "wxshlb_Mach.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlb_cwc_d.h b/Externals/wxWidgets3/include/wx/wxshlb_cwc_d.h deleted file mode 100644 index 791cffe2d9..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlb_cwc_d.h +++ /dev/null @@ -1,38 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlb_cwc_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlb_cwc_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlb_Mach++_d.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlb_Mach_d.mch" - #elif __POWERPC__ - #include "wxshlb_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlba_cw.h b/Externals/wxWidgets3/include/wx/wxshlba_cw.h deleted file mode 100644 index 6f6f993600..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlba_cw.h +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlba_cw.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cw.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++_prof.mch" - #elif __INTEL__ - #include "wxshlba_x86++_prof.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++_prof.mch" - #else - #include "wxshlba_68k++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC_prof.mch" - #elif __INTEL__ - #include "wxshlba_x86_prof.mch" - #elif __CFM68K__ - #include "wxshlba_cfm_prof.mch" - #else - #include "wxshlba_68k_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++.mch" - #elif __INTEL__ - #include "wxshlba_x86++.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++.mch" - #else - #include "wxshlba_68k++.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC.mch" - #elif __INTEL__ - #include "wxshlba_x86.mch" - #elif __CFM68K__ - #include "wxshlba_cfm.mch" - #else - #include "wxshlba_68k.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlba_cw_d.h b/Externals/wxWidgets3/include/wx/wxshlba_cw_d.h deleted file mode 100644 index 85594b89a6..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlba_cw_d.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlba_cw_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cw_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_PPC++_d.mch" - #elif __INTEL__ - #include "wxshlba_x86++_d.mch" - #elif __CFM68K__ - #include "wxshlba_cfm++_d.mch" - #else - #include "wxshlba_68k++_d.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_PPC_d.mch" - #elif __INTEL__ - #include "wxshlba_x86_d.mch" - #elif __CFM68K__ - #include "wxshlba_cfm_d.mch" - #else - #include "wxshlba_68k_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlba_cwc.h b/Externals/wxWidgets3/include/wx/wxshlba_cwc.h deleted file mode 100644 index 75f390f0d0..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlba_cwc.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlba_cwc.h -// Purpose: wxWidgets definitions for CodeWarrior builds -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cwc.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#ifdef __cplusplus - #if __POWERPC__ - #include "wxshlba_Carbon++_prof.mch" - #endif -#else - #if __POWERPC__ - #include "wxshlba_Carbon_prof.mch" - #endif -#endif -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlba_Mach++.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon++.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlba_Mach.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon.mch" - #endif -#endif -#endif -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/wxshlba_cwc_d.h b/Externals/wxWidgets3/include/wx/wxshlba_cwc_d.h deleted file mode 100644 index b86c1cc4d8..0000000000 --- a/Externals/wxWidgets3/include/wx/wxshlba_cwc_d.h +++ /dev/null @@ -1,38 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/wxshlba_cwc_d.h -// Purpose: wxWidgets definitions for CodeWarrior builds (Debug) -// Author: Stefan Csomor -// Modified by: -// Created: 12/10/98 -// RCS-ID: $Id: wxshlba_cwc_d.h 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CW__ -#define _WX_CW__ - -#if __MWERKS__ >= 0x2400 -#pragma old_argmatch on -#endif - -#if __option(profile) -#error "profiling is not supported in debug versions" -#else -#ifdef __cplusplus - #ifdef __MACH__ - #include "wxshlba_Mach++_d.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon++_d.mch" - #endif -#else - #ifdef __MACH__ - #include "wxshlba_Mach_d.mch" - #elif __POWERPC__ - #include "wxshlba_Carbon_d.mch" - #endif -#endif -#endif - -#endif - // _WX_CW__ diff --git a/Externals/wxWidgets3/include/wx/x11/app.h b/Externals/wxWidgets3/include/wx/x11/app.h new file mode 100644 index 0000000000..a3062ef14a --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/app.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/app.h +// Purpose: wxApp class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_APP_H_ +#define _WX_X11_APP_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/gdicmn.h" +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// forward declarations +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxApp; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; +class WXDLLIMPEXP_FWD_CORE wxXVisualInfo; + +// ---------------------------------------------------------------------------- +// the wxApp class for wxX11 - see wxAppBase for more details +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxApp : public wxAppBase +{ +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + // ----------------------------------- + + virtual void Exit(); + + virtual void WakeUpIdle(); + + virtual bool OnInitGui(); + + // implementation from now on + // -------------------------- + + // Processes an X event. + virtual bool ProcessXEvent(WXEvent* event); + +public: + // Implementation + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + WXWindow GetTopLevelWidget() const { return m_topLevelWidget; } + WXColormap GetMainColormap(WXDisplay* display); + long GetMaxRequestSize() const { return m_maxRequestSize; } + + // This handler is called when a property change event occurs + virtual bool HandlePropertyChange(WXEvent *event); + + // Values that can be passed on the command line. + // Returns -1, -1 if none specified. + const wxSize& GetInitialSize() const { return m_initialSize; } + bool GetShowIconic() const { return m_showIconic; } + +#if wxUSE_UNICODE + // Global context for Pango layout. Either use X11 + // or use Xft rendering according to GDK_USE_XFT + // environment variable + PangoContext* GetPangoContext(); +#endif + + wxXVisualInfo* GetVisualInfo(WXDisplay* WXUNUSED(display)) + { + // this should be implemented correctly for wxBitmap to work + // with multiple display + return m_visualInfo; + } + +public: + static long sm_lastMessageTime; + bool m_showIconic; + wxSize m_initialSize; + +#if !wxUSE_NANOX + wxXVisualInfo* m_visualInfo; +#endif + +protected: + WXWindow m_topLevelWidget; + WXColormap m_mainColormap; + long m_maxRequestSize; + + wxDECLARE_DYNAMIC_CLASS(wxApp); +}; + +#endif // _WX_X11_APP_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/bitmap.h b/Externals/wxWidgets3/include/wx/x11/bitmap.h new file mode 100644 index 0000000000..c5cc209a3a --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/bitmap.h @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/bitmap.h +// Purpose: wxBitmap class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/palette.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMask; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxImage; + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxMask: public wxObject +{ +public: + wxMask(); + wxMask(const wxMask& mask); + wxMask( const wxBitmap& bitmap, const wxColour& colour ); + wxMask( const wxBitmap& bitmap, int paletteIndex ); + wxMask( const wxBitmap& bitmap ); + virtual ~wxMask(); + + bool Create( const wxBitmap& bitmap, const wxColour& colour ); + bool Create( const wxBitmap& bitmap, int paletteIndex ); + bool Create( const wxBitmap& bitmap ); + + // implementation + WXPixmap GetBitmap() const { return m_bitmap; } + void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; } + + WXDisplay *GetDisplay() const { return m_display; } + void SetDisplay( WXDisplay *display ) { m_display = display; } + +private: + WXPixmap m_bitmap; + WXDisplay *m_display; + wxSize m_size; + +private: + wxDECLARE_DYNAMIC_CLASS(wxMask); +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ +public: + wxBitmap() {} + wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); } + wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); } + + wxBitmap( const char bits[], int width, int height, int depth = 1 ); + wxBitmap( const char* const* bits ); +#ifdef wxNEEDS_CHARPP + // needed for old GCC + wxBitmap(char** data) + { + *this = wxBitmap(const_cast(data)); + } +#endif + wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); + virtual ~wxBitmap(); + + static void InitStandardHandlers(); + + bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH); + bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) + { return Create(sz.GetWidth(), sz.GetHeight(), depth); } + bool Create(int width, int height, const wxDC& WXUNUSED(dc)) + { return Create(width,height); } + + bool Create(const void* data, wxBitmapType type, + int width, int height, int depth = -1); + // create the wxBitmap using a _copy_ of the pixmap + bool Create(WXPixmap pixmap); + + int GetHeight() const; + int GetWidth() const; + int GetDepth() const; + +#if wxUSE_IMAGE + wxBitmap( const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0 ) { (void)CreateFromImage(image, depth); } + wxImage ConvertToImage() const; + bool CreateFromImage(const wxImage& image, int depth = -1); +#endif // wxUSE_IMAGE + + // copies the contents and mask of the given (colour) icon to the bitmap + virtual bool CopyFromIcon(const wxIcon& icon); + + wxMask *GetMask() const; + void SetMask( wxMask *mask ); + + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const; + bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE ); + + wxPalette *GetPalette() const; + wxPalette *GetColourMap() const + { return GetPalette(); } + virtual void SetPalette(const wxPalette& palette); + + // implementation + // -------------- + + void SetHeight( int height ); + void SetWidth( int width ); + void SetDepth( int depth ); + void SetPixmap( WXPixmap pixmap ); + void SetBitmap( WXPixmap bitmap ); + + WXPixmap GetPixmap() const; + WXPixmap GetBitmap() const; + + WXPixmap GetDrawable() const; + + WXDisplay *GetDisplay() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxBitmap); +}; + +#endif // _WX_BITMAP_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/brush.h b/Externals/wxWidgets3/include/wx/x11/brush.h new file mode 100644 index 0000000000..6095b67210 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/brush.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/brush.h +// Purpose: wxBrush class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxBrush; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase +{ +public: + wxBrush() { } + + wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID ); + wxBrush( const wxBitmap &stippleBitmap ); + virtual ~wxBrush(); + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxBrushStyle GetStyle() const; + wxColour GetColour() const; + wxBitmap *GetStipple() const; + + void SetColour( const wxColour& col ); + void SetColour( unsigned char r, unsigned char g, unsigned char b ); + void SetStyle( wxBrushStyle style ); + void SetStipple( const wxBitmap& stipple ); + + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + wxBrush(const wxColour& col, int style); + + wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxBrushStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxBrush); +}; + +#endif // _WX_BRUSH_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/chkconf.h b/Externals/wxWidgets3/include/wx/x11/chkconf.h new file mode 100644 index 0000000000..c552e838fb --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/chkconf.h @@ -0,0 +1,30 @@ +/* + * Name: wx/x11/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_X11_CHKCONF_H_ +#define _WX_X11_CHKCONF_H_ + +/* wxPalette is always needed */ +#if !wxUSE_PALETTE +# error "wxX11 requires wxUSE_PALETTE=1" +#endif + +#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxSocket requires wxSelectDispatcher in wxX11" +# else +# undef wxUSE_SELECT_DISPATCHER +# define wxUSE_SELECT_DISPATCHER 1 +# endif +#endif + +#endif /* _WX_X11_CHKCONF_H_ */ diff --git a/Externals/wxWidgets3/include/wx/x11/clipbrd.h b/Externals/wxWidgets3/include/wx/x11/clipbrd.h new file mode 100644 index 0000000000..4b00655205 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/clipbrd.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/clipbrd.h +// Purpose: Clipboard functionality. +// Author: Robert Roebling +// Created: 17/09/98 +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_CLIPBRD_H_ +#define _WX_X11_CLIPBRD_H_ + +#if wxUSE_CLIPBOARD + +#include "wx/object.h" +#include "wx/list.h" +#include "wx/dataobj.h" +#include "wx/control.h" +#include "wx/module.h" + +// ---------------------------------------------------------------------------- +// wxClipboard +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ +public: + wxClipboard(); + virtual ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // implementation from now on + bool m_open; + bool m_ownsClipboard; + bool m_ownsPrimarySelection; + wxDataObject *m_data; + + WXWindow m_clipboardWidget; /* for getting and offering data */ + WXWindow m_targetsWidget; /* for getting list of supported formats */ + bool m_waiting; /* querying data or formats is asynchronous */ + + bool m_formatSupported; + Atom m_targetRequested; + wxDataObject *m_receivedData; + +private: + wxDECLARE_DYNAMIC_CLASS(wxClipboard); + +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_X11_CLIPBRD_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/colour.h b/Externals/wxWidgets3/include/wx/x11/colour.h new file mode 100644 index 0000000000..568cf07b37 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/colour.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/colour.h +// Purpose: wxColour class +// Author: Julian Smart, Robert Roebling +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxColour; + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxColour : public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + virtual ~wxColour(); + + bool operator==(const wxColour& col) const; + bool operator!=(const wxColour& col) const { return !(*this == col); } + + unsigned char Red() const; + unsigned char Green() const; + unsigned char Blue() const; + + // Implementation part + + void CalcPixel( WXColormap cmap ); + unsigned long GetPixel() const; + WXColor *GetColor() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual void + InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); + + virtual bool FromString(const wxString& str); + +private: + wxDECLARE_DYNAMIC_CLASS(wxColour); +}; + +#endif // _WX_COLOUR_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/cursor.h b/Externals/wxWidgets3/include/wx/x11/cursor.h new file mode 100644 index 0000000000..36c8f0e839 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/cursor.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/cursor.h +// Purpose: wxCursor class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#include "wx/colour.h" + +class WXDLLIMPEXP_FWD_CORE wxImage; + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase +{ +public: + wxCursor(); + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } +#endif +#if wxUSE_IMAGE + wxCursor( const wxImage & image ); +#endif + + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + virtual ~wxCursor(); + + // implementation + + WXCursor GetCursor() const; + +protected: + void InitFromStock(wxStockCursor); + + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + wxDECLARE_DYNAMIC_CLASS(wxCursor); +}; + +#endif // _WX_CURSOR_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dataform.h b/Externals/wxWidgets3/include/wx/x11/dataform.h new file mode 100644 index 0000000000..4dee2cd116 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dataform.h @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Robert Roebling +// Modified by: +// Created: 19.10.99 (extracted from motif/dataobj.h) +// Copyright: (c) 1999 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_DATAFORM_H +#define _WX_X11_DATAFORM_H + +class WXDLLIMPEXP_CORE wxDataFormat +{ +public: + // the clipboard formats under Xt are Atoms + typedef Atom NativeFormat; + + wxDataFormat(); + wxDataFormat( wxDataFormatId type ); + wxDataFormat( const wxString &id ); + wxDataFormat( NativeFormat format ); + + wxDataFormat& operator=(NativeFormat format) + { SetId(format); return *this; } + + // comparison (must have both versions) + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId( NativeFormat format ); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId( const wxString& id ); + + // implementation + wxDataFormatId GetType() const; + +private: + wxDataFormatId m_type; + NativeFormat m_format; + + void PrepareFormats(); + void SetType( wxDataFormatId type ); +}; + + +#endif // _WX_X11_DATAFORM_H diff --git a/Externals/wxWidgets3/include/wx/x11/dataobj.h b/Externals/wxWidgets3/include/wx/x11/dataobj.h new file mode 100644 index 0000000000..ef13ccdd5f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dataobj.h @@ -0,0 +1,28 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dataobj.h +// Purpose: declaration of the wxDataObject class for Motif +// Author: Julian Smart +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_DATAOBJ_H_ +#define _WX_X11_DATAOBJ_H_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxMotif +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); + +#ifdef __DARWIN__ + virtual ~wxDataObject() { } +#endif + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; +}; + +#endif //_WX_X11_DATAOBJ_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/dataobj2.h b/Externals/wxWidgets3/include/wx/x11/dataobj2.h similarity index 52% rename from Externals/wxWidgets3/include/wx/cocoa/dataobj2.h rename to Externals/wxWidgets3/include/wx/x11/dataobj2.h index b824fe933e..8b6cc6da64 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/dataobj2.h +++ b/Externals/wxWidgets3/include/wx/x11/dataobj2.h @@ -1,19 +1,19 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/dataobj2.h +// Name: wx/x11/dataobj2.h // Purpose: declaration of standard wxDataObjectSimple-derived classes -// Author: David Elliott -// Modified by: -// Created: 2003/07/23 -// Copyright: (c) 2003 David Elliott +// Author: Robert Roebling +// Created: 19.10.99 (extracted from gtk/dataobj.h) +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef __WX_COCOA_DATAOBJ2_H__ -#define __WX_COCOA_DATAOBJ2_H__ +#ifndef _WX_X11_DATAOBJ2_H_ +#define _WX_X11_DATAOBJ2_H_ -//========================================================================= +// ---------------------------------------------------------------------------- // wxBitmapDataObject is a specialization of wxDataObject for bitmaps -//========================================================================= +// ---------------------------------------------------------------------------- + class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase { public: @@ -33,6 +33,19 @@ public: virtual size_t GetDataSize() const { return m_pngSize; } virtual bool GetDataHere(void *buf) const; virtual bool SetData(size_t len, const void *buf); + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } protected: void Init() { m_pngData = NULL; m_pngSize = 0; } @@ -43,20 +56,11 @@ protected: void *m_pngData; void DoConvertToPng(); - -private: - // virtual function hiding supression - size_t GetDataSize(const wxDataFormat& format) const - { return(wxDataObjectSimple::GetDataSize(format)); } - bool GetDataHere(const wxDataFormat& format, void* pBuf) const - { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) - { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } }; -//========================================================================= +// ---------------------------------------------------------------------------- // wxFileDataObject is a specialization of wxDataObject for file names -//========================================================================= +// ---------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase { @@ -69,15 +73,19 @@ public: virtual size_t GetDataSize() const; virtual bool GetDataHere(void *buf) const; virtual bool SetData(size_t len, const void *buf); - -private: - // virtual function hiding supression - size_t GetDataSize(const wxDataFormat& format) const - { return(wxDataObjectSimple::GetDataSize(format)); } - bool GetDataHere(const wxDataFormat& format, void* pBuf) const - { return(wxDataObjectSimple::GetDataHere(format, pBuf)); } - bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf) - { return(wxDataObjectSimple::SetData(format, nLen, pBuf)); } + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } }; -#endif //__WX_COCOA_DATAOBJ2_H__ +#endif // _WX_X11_DATAOBJ2_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dc.h b/Externals/wxWidgets3/include/wx/x11/dc.h new file mode 100644 index 0000000000..418e87d3c0 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dc.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dc.h +// Purpose: wxDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/icon.h" +#include "wx/font.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxX11DCImpl : public wxDCImpl +{ +public: + wxX11DCImpl( wxDC *owner ); + virtual ~wxX11DCImpl() { } + + virtual wxSize GetPPI() const; + +protected: + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetSizeMM(int* width, int* height) const; + + // implementation + wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); } + wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); } + wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); } + wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); } + wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); } + wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); } + wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); } + wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); } + +private: + wxDECLARE_CLASS(wxX11DCImpl); +}; + +#endif +// _WX_DC_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dcclient.h b/Externals/wxWidgets3/include/wx/x11/dcclient.h new file mode 100644 index 0000000000..eebc6181d8 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dcclient.h @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcclient.h +// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +#include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/x11/dc.h" +#include "wx/region.h" + +// ----------------------------------------------------------------------------- +// fwd declarations +// ----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +//----------------------------------------------------------------------------- +// wxWindowDCImpl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *win ); + + virtual ~wxWindowDCImpl(); + + virtual bool CanDrawBitmap() const { return true; } + virtual bool CanGetTextExtent() const { return true; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, + wxFloodFillStyle style = wxFLOOD_SURFACE ); + virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); + virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, + bool useMask = false ); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode rop = wxCOPY, bool useMask = false, + wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoSetDeviceClippingRegion(const wxRegion& region); + + virtual void DoDrawLines(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, const wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); + + +public: + virtual void Clear(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + virtual void SetLogicalFunction( wxRasterOperationMode function ); + + virtual void SetTextForeground(const wxColour& colour); + virtual void SetTextBackground(const wxColour& colour); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void DestroyClippingRegion(); + WXWindow GetX11Window() const { return m_x11window; } + + virtual void ComputeScaleAndOrigin(); + + virtual void* GetCairoContext() const wxOVERRIDE; + +protected: + // implementation + // -------------- + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + const wxFont *theFont = NULL) const; + + void Init(); + + WXDisplay *m_display; + WXWindow m_x11window; + WXGC m_penGC; + WXGC m_brushGC; + WXGC m_textGC; + WXGC m_bgGC; + WXColormap m_cmap; + bool m_isMemDC; + bool m_isScreenDC; + wxRegion m_currentClippingRegion; + wxRegion m_paintClippingRegion; + +#if wxUSE_UNICODE + PangoContext *m_context; + PangoFontDescription *m_fontdesc; +#endif + + void SetUpDC(); + void Destroy(); + +private: + wxDECLARE_CLASS(wxWindowDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { } + wxClientDCImpl( wxDC *owner, wxWindow *win ); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_CLASS(wxClientDCImpl); +}; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { } + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + +private: + wxDECLARE_CLASS(wxPaintDCImpl); +}; + +#endif +// _WX_DCCLIENT_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dcmemory.h b/Externals/wxWidgets3/include/wx/x11/dcmemory.h new file mode 100644 index 0000000000..3b08cff085 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dcmemory.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcmemory.h +// Purpose: wxMemoryDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#include "wx/dc.h" +#include "wx/dcmemory.h" +#include "wx/x11/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl +{ +public: + wxMemoryDCImpl( wxDC* owner ); + wxMemoryDCImpl( wxDC* owner, wxBitmap& bitmap); + wxMemoryDCImpl( wxDC* owner, wxDC *dc ); + virtual ~wxMemoryDCImpl(); + + virtual const wxBitmap& GetSelectedBitmap() const; + virtual wxBitmap& GetSelectedBitmap(); + + // implementation + wxBitmap m_selected; + +protected: + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoSelect(const wxBitmap& bitmap); + +private: + void Init(); + +private: + wxDECLARE_CLASS(wxMemoryDCImpl); +}; + +#endif +// _WX_DCMEMORY_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dcprint.h b/Externals/wxWidgets3/include/wx/x11/dcprint.h new file mode 100644 index 0000000000..e28eec0ec2 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dcprint.h @@ -0,0 +1,28 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcprint.h +// Purpose: wxPrinterDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#include "wx/dc.h" + +class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC +{ +public: + wxDECLARE_CLASS(wxPrinterDC); + + // Create a printer DC + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, wxPrintOrientation orientation = wxPORTRAIT); + + virtual ~wxPrinterDC(); +}; + +#endif + // _WX_DCPRINT_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dcscreen.h b/Externals/wxWidgets3/include/wx/x11/dcscreen.h new file mode 100644 index 0000000000..d0bab6a2f9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dcscreen.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dcscreen.h +// Purpose: wxScreenDC class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#include "wx/dcclient.h" +#include "wx/x11/dcclient.h" + +//----------------------------------------------------------------------------- +// wxScreenDC +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxPaintDCImpl +{ +public: + wxScreenDCImpl( wxDC *owner); + virtual ~wxScreenDCImpl(); + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + wxDECLARE_CLASS(wxScreenDCImpl); +}; + + +#endif + // _WX_DCSCREEN_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/dnd.h b/Externals/wxWidgets3/include/wx/x11/dnd.h new file mode 100644 index 0000000000..aae6bd21ee --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/dnd.h @@ -0,0 +1,171 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/dnd.h +// Purpose: declaration of wxDropTarget, wxDropSource classes +// Author: Julian Smart +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_ +#define _WX_DND_H_ + +#include "wx/defs.h" + +#if wxUSE_DRAG_AND_DROP + +#include "wx/object.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; +class WXDLLIMPEXP_FWD_CORE wxPrivateDropTarget; + +class WXDLLIMPEXP_FWD_CORE wxDropSource; + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDropTarget: public wxObject +{ +public: + + wxDropTarget(); + virtual ~wxDropTarget(); + + virtual void OnEnter() { } + virtual void OnLeave() { } + virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0; + + // Override these to indicate what kind of data you support: + + virtual size_t GetFormatCount() const = 0; + virtual wxDataFormat GetFormat(size_t n) const = 0; + + // implementation +}; + +//------------------------------------------------------------------------- +// wxTextDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextDropTarget: public wxDropTarget +{ +public: + + wxTextDropTarget() {} + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropText( long x, long y, const char *psz ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxPrivateDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPrivateDropTarget: public wxDropTarget +{ +public: + + wxPrivateDropTarget(); + + // you have to override OnDrop to get at the data + + // the string ID identifies the format of clipboard or DnD data. a word + // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject + // to the clipboard - the latter with the Id "WXWORD_FORMAT". + + void SetId( const wxString& id ) + { m_id = id; } + + wxString GetId() + { return m_id; } + +private: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; + + wxString m_id; +}; + +// ---------------------------------------------------------------------------- +// A drop target which accepts files (dragged from File Manager or Explorer) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFileDropTarget: public wxDropTarget +{ +public: + + wxFileDropTarget() {} + + virtual bool OnDrop( long x, long y, const void *data, size_t size ); + virtual bool OnDropFiles( long x, long y, + size_t nFiles, const char * const aszFiles[] ); + +protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +enum wxDragResult +{ + wxDragError, // error prevented the d&d operation from completing + wxDragNone, // drag target didn't accept the data + wxDragCopy, // the data was successfully copied + wxDragMove, // the data was successfully moved + wxDragCancel // the operation was cancelled by user (not an error) +}; + +class WXDLLIMPEXP_CORE wxDropSource: public wxObject +{ +public: + + wxDropSource( wxWindow *win ); + wxDropSource( wxDataObject &data, wxWindow *win ); + + virtual ~wxDropSource(void); + + void SetData( wxDataObject &data ); + wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; } + + // implementation +#if 0 + void RegisterWindow(void); + void UnregisterWindow(void); + + wxWindow *m_window; + wxDragResult m_retValue; + wxDataObject *m_data; + + wxCursor m_defaultCursor; + wxCursor m_goaheadCursor; +#endif +}; + +#endif + +// wxUSE_DRAG_AND_DROP + +#endif +//_WX_DND_H_ diff --git a/Externals/wxWidgets3/include/wx/cocoa/font.h b/Externals/wxWidgets3/include/wx/x11/font.h similarity index 52% rename from Externals/wxWidgets3/include/wx/cocoa/font.h rename to Externals/wxWidgets3/include/wx/x11/font.h index c9c245f9e1..bd6100e4c4 100644 --- a/Externals/wxWidgets3/include/wx/cocoa/font.h +++ b/Externals/wxWidgets3/include/wx/x11/font.h @@ -1,9 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/cocoa/font.h +// Name: wx/x11/font.h // Purpose: wxFont class // Author: Julian Smart // Modified by: -// Created: 01/02/97 +// Created: 17/09/98 // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -11,30 +11,13 @@ #ifndef _WX_FONT_H_ #define _WX_FONT_H_ -// ---------------------------------------------------------------------------- -// wxFont -// ---------------------------------------------------------------------------- +class wxXFont; -DECLARE_WXCOCOA_OBJC_CLASS(NSFont); - -// Internal class that bridges us with code like wxSystemSettings -class wxCocoaFontFactory; -// We have c-tors/methods taking pointers of these -class wxFontRefData; - -/*! @discussion - wxCocoa's implementation of wxFont is very incomplete. In particular, - a lot of work needs to be done on wxNativeFontInfo which is currently - using the totally generic implementation. - - See the documentation in src/cocoa/font.mm for more implementatoin details. - */ +// Font class WXDLLIMPEXP_CORE wxFont : public wxFontBase { - friend class wxCocoaFontFactory; public: - /*! @abstract Default construction of invalid font for 2-step construct then Create process. - */ + // ctors and such wxFont() { } wxFont(const wxFontInfo& info) @@ -51,29 +34,15 @@ public: SetPixelSize(info.GetPixelSize()); } - /*! @abstract Platform-independent construction with individual properties - */ -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(int size, - int family, - int style, - int weight, - bool underlined = FALSE, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif wxFont(int size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, - bool underlined = FALSE, + bool underlined = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT) { - (void)Create(size, family, style, weight, underlined, face, encoding); + Create(size, family, style, weight, underlined, face, encoding); } wxFont(const wxSize& pixelSize, @@ -88,29 +57,26 @@ public: SetPixelSize(pixelSize); } - /*! @abstract Construction with opaque wxNativeFontInfo - */ - wxFont(const wxNativeFontInfo& info) - { - (void)Create(info); - } - - /*! @abstract Construction with platform-dependent font descriptor string. - @param fontDesc Usually the result of wxNativeFontInfo::ToUserString() - */ - wxFont(const wxString& fontDesc); - - // NOTE: Copy c-tor and assignment from wxObject is fine - bool Create(int size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, - bool underlined = FALSE, + bool underlined = false, const wxString& face = wxEmptyString, wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - bool Create(const wxNativeFontInfo& info); + wxFont(const wxNativeFontInfo& info); + + wxFont(const wxString &nativeInfoString) + { + Create(nativeInfoString); + } + + bool Create(const wxString& fontname, + wxFontEncoding fontenc = wxFONTENCODING_DEFAULT); + + // DELETEME: no longer seems to be implemented. + // bool Create(const wxNativeFontInfo& fontinfo); virtual ~wxFont(); @@ -119,52 +85,77 @@ public: virtual wxFontStyle GetStyle() const; virtual wxFontWeight GetWeight() const; virtual bool GetUnderlined() const; + virtual bool GetStrikethrough() const wxOVERRIDE; virtual wxString GetFaceName() const; virtual wxFontEncoding GetEncoding() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const; + virtual bool IsFixedWidth() const; + virtual void SetPointSize(int pointSize); virtual void SetFamily(wxFontFamily family); virtual void SetStyle(wxFontStyle style); virtual void SetWeight(wxFontWeight weight); virtual bool SetFaceName(const wxString& faceName); virtual void SetUnderlined(bool underlined); + virtual void SetStrikethrough(bool strikethrough) wxOVERRIDE; virtual void SetEncoding(wxFontEncoding encoding); wxDECLARE_COMMON_FONT_METHODS(); - // implementation only from now on - // ------------------------------- + wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants") + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } - /*! @abstract Defined on some ports (not including this one) in wxGDIObject - @discussion - The intention here I suppose is to allow one to create a wxFont without yet - creating the underlying native object. There's no point not to create the - NSFont immediately in wxCocoa so this is useless. - This method came from the stub code copied in the early days of wxCocoa. - FIXME(1): Remove this in trunk. FIXME(2): Is it really a good idea for this to - be part of the public API for wxGDIObject? - */ - virtual bool RealizeResource(); + // Implementation + +#if wxUSE_PANGO + // 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 SetPangoAttrs(PangoLayout* layout) const; +#else + // Find an existing, or create a new, XFontStruct + // based on this wxFont and the given scale. Append the + // font to list in the private data for future reference. + + // TODO This is a fairly basic implementation, that doesn't + // allow for different facenames, and also doesn't do a mapping + // between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.) + // and the fonts that are available on a particular system. + // Maybe we need to scan the user's machine to build up a profile + // of the fonts and a mapping file. + + // Return font struct, and optionally the Motif font list + wxXFont *GetInternalFont(double scale = 1.0, + WXDisplay* display = NULL) const; + + // Helper function for convenient access of the above. + WXFontStructPtr GetFontStruct(double scale = 1.0, + WXDisplay* display = NULL) const; +#endif protected: - /*! @abstract Internal constructor with ref data - @discussion - Takes ownership of @a refData. That is, it is assumed that refData has either just been - created using new (which initializes its m_refCount to 1) or if you are sharing a ref that - you have called IncRef on it before passing it to this method. - */ - explicit wxFont(wxFontRefData *refData) - { Create(refData); } - bool Create(wxFontRefData *refData); - virtual wxGDIRefData *CreateGDIRefData() const; virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ); virtual wxFontFamily DoGetFamily() const; + void Unshare(); + private: - DECLARE_DYNAMIC_CLASS(wxFont) + wxDECLARE_DYNAMIC_CLASS(wxFont); }; #endif diff --git a/Externals/wxWidgets3/include/wx/x11/glcanvas.h b/Externals/wxWidgets3/include/wx/x11/glcanvas.h new file mode 100644 index 0000000000..a02e0ba4b9 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/glcanvas.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets 2.0 for Motif. +// Uses the GLX extension. +// Author: Julian Smart and Wolfram Gloger +// Modified by: +// Created: 1995, 1999 +// Copyright: (c) Julian Smart, Wolfram Gloger +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/unix/glx11.h" + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11 +{ +public: + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + wxEXPLICIT // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + // implement wxGLCanvasX11 methods + // -------------------------------- + + virtual Window GetXWindow() const; + +protected: + virtual int GetColourIndex(const wxColour& col); + + wxDECLARE_CLASS(wxGLCanvas); +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/joystick.h b/Externals/wxWidgets3/include/wx/x11/joystick.h new file mode 100644 index 0000000000..1b982bd3ac --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/joystick.h @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/joystick.h +// Purpose: wxJoystick class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxJoystick); +public: +/* +* Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; } + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + static int GetNumberJoysticks() ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/minifram.h b/Externals/wxWidgets3/include/wx/x11/minifram.h new file mode 100644 index 0000000000..db88eea5a3 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/minifram.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/minifram.h +// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars. +// If there is no equivalent on your platform, just make it a +// normal frame. +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame { + + wxDECLARE_DYNAMIC_CLASS(wxMiniFrame); + +public: + inline wxMiniFrame() {} + inline wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION, + const wxString& name = wxFrameNameStr) + { + // Use wxFrame constructor in absence of more specific code. + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMiniFrame() {} +protected: +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xatom.h b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xatom.h new file mode 100644 index 0000000000..60fba84c97 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xatom.h @@ -0,0 +1,6 @@ + +/* + * Xlib compatibility + */ + +/* Nothing yet */ diff --git a/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xlib.h b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xlib.h new file mode 100644 index 0000000000..6d19fe4607 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xlib.h @@ -0,0 +1,356 @@ +/* + * Xlib compatibility + */ + +#ifndef _DUMMY_XLIBH_ +#define _DUMMY_XLIBH_ + +/* Move away the typedef in XtoNX.h */ +#define XFontStruct XFontStruct1 +#include +#undef XFontStruct +#undef XCharStruct + +/* Data types */ + +typedef GR_PALETTE* Colormap; +typedef GR_DRAW_ID Drawable ; +typedef int Status; +typedef unsigned long VisualID; +typedef int Bool; +typedef long XID; +typedef GR_SCANCODE KeySym; +typedef GR_EVENT_KEYSTROKE XKeyEvent; +typedef struct { + GR_FONT_INFO info; + GR_FONT_ID fid; +} XFontStruct; +typedef struct { + short lbearing; /* origin to left edge of raster */ + short rbearing; /* origin to right edge of raster */ + short width; /* advance to next char's origin */ + short ascent; /* baseline to top edge of raster */ + short descent; /* baseline to bottom edge of raster */ + unsigned short attributes; /* per char flags (not predefined) */ +} XCharStruct; + +/* Configure window value mask bits */ +#define CWX (1<<0) +#define CWY (1<<1) +#define CWWidth (1<<2) +#define CWHeight (1<<3) +#define CWBorderWidth (1<<4) +#define CWSibling (1<<5) +#define CWStackMode (1<<6) + +/* Values */ + +typedef struct { + int x, y; + int width, height; + int border_width; + Window sibling; + int stack_mode; +} XWindowChanges; + +/* typedef unsigned long Time; */ + +#define Success 0 +#define GrabSuccess Success +#define GrabNotViewable (Success+1) +#define InputOutput 1 +#define InputOnly 2 +#define IsUnmapped 0 +#define IsUnviewable 1 +#define IsViewable 2 +/* Is this right? */ +#define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED +#define GraphicsExpose GR_EVENT_TYPE_EXPOSURE +#define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE +#define ColormapChangeMask 0 +#define FillSolid 0 +#define LineSolid 0 +#define LineOnOffDash 0 +#define CapNotLast 0 +#define CapRound 0 +#define CapProjecting 0 +#define CapButt 0 +#define JoinRound 0 +#define JoinBevel 0 +#define JoinMiter 0 +#define IncludeInferiors 0 +#define ClipByChildren 0 +#define DoRed 0 +#define DoGreen 0 +#define DoBlue 0 +#define NoEventMask GR_EVENT_MASK_NONE +#define RevertToParent 0 +#define CurrentTime 0 +#define GrabModeAsync 0 + +#define GXcopy GR_MODE_COPY +#define GXclear GR_MODE_CLEAR +#ifndef GXxor +#define GXxor GR_MODE_OR +#endif +#define GXinvert GR_MODE_INVERT +#define GXorReverse GR_MODE_ORREVERSE +#define GXandReverse GR_MODE_ANDREVERSE +#define GXand GR_MODE_AND +#define GXor GR_MODE_OR +#define GXandInverted GR_MODE_ANDINVERTED +#define GXnoop GR_MODE_NOOP +#define GXnor GR_MODE_NOR +#define GXequiv GR_MODE_EQUIV +#define GXcopyInverted GR_MODE_COPYINVERTED +#define GXorInverted GR_MODE_ORINVERTED +#define GXnand GR_MODE_NAND +#define GXset GR_MODE_SET + +#define XSynchronize(display,sync) +#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID +#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID +#define XFreePixmap(d, p) GrDestroyWindow(p) +#define XFreeCursor(d, c) GrDestroyCursor(c) +#define XFreeGC(d, gc) GrDestroyGC(gc) +#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c) +#define DefaultVisual(d, s) (NULL) +#define DefaultColormap(d, s) DefaultColormapOfScreen(NULL) +#define DefaultScreenOfDisplay(d) 0 +#define XSetFillStyle(d, gc, s) wxNoop() +#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop() +#define XSetClipMask(d, gc, m) wxNoop() +#define XSetTSOrigin(d, gc, x, y) wxNoop() +#define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE) +#define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC) +#define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y) +#define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p) +#define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height) +#define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y) +#define XSetRegion(d, gc, r) GrSetGCRegion(gc, r) +#define XSetTile(d, gc, p) wxNoop() +#define XSetStipple(d, gc, p) wxNoop() +#define XSetSubwindowMode(d, gc, mode) wxNoop() +#define XFreeColormap(d, cmap) wxNoop() +#define XSetTransientForHint(d, w, p) wxNoop() +#define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2) +#define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2) +#define XEqualRegion(r1, r2) GrEqualRegion(r1, r2) +#define XEmptyRegion(r) GrEmptyRegion(r) +#define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y) +#define XClipBox(r, rect) GrGetRegionBox(r, rect) +#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y) +#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2) +/* TODO: Cannot find equivalent for this. */ +#define XIconifyWindow(d, w, s) 0 +#define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \ + GrNewWindow(p,x,y,w,h,bw,backColor,foreColor) +#define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode) +#define XBell(a, b) GrBell() +#define DisplayWidthMM(d, s) 100 +#define DisplayHeightMM(d, s) 100 + +/* These defines are wrongly defined in XtoNX.h, IMHO, + * since they reference a static global. + * Redefined as functions, below. + */ + +#undef DisplayWidth +#undef DisplayHeight +#undef DefaultDepth + +/* + * Data structure used by color operations + */ +typedef struct { + unsigned long pixel; + unsigned short red, green, blue; + char flags; /* do_red, do_green, do_blue */ + char pad; +} XColor; + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XID resourceid; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error code of failed request */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XErrorEvent; + +/* + * Visual structure; contains information about colormapping possible. + */ +typedef struct { + void *ext_data; /* hook for extension to hang data */ + VisualID visualid; /* visual id of this visual */ +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ class of screen (monochrome, etc.) */ +#else + int class; /* class of screen (monochrome, etc.) */ +#endif + unsigned long red_mask, green_mask, blue_mask; /* mask values */ + int bits_per_rgb; /* log base 2 of distinct color values */ + int map_entries; /* color map entries */ +} Visual; + +/* + * Depth structure; contains information for each possible depth. + */ +typedef struct { + int depth; /* this depth (Z) of the depth */ + int nvisuals; /* number of Visual types at this depth */ + Visual *visuals; /* list of visuals possible at this depth */ +} Depth; + +/* + * Information about the screen. The contents of this structure are + * implementation dependent. A Screen should be treated as opaque + * by application code. + */ + +struct _XDisplay; /* Forward declare before use for C++ */ + +typedef struct { + void *ext_data; /* hook for extension to hang data */ + struct _XDisplay *display;/* back pointer to display structure */ + Window root; /* Root window id. */ + int width, height; /* width and height of screen */ + int mwidth, mheight; /* width and height of in millimeters */ + int ndepths; /* number of depths possible */ + Depth *depths; /* list of allowable depths on the screen */ + int root_depth; /* bits per pixel */ + Visual *root_visual; /* root visual */ + GC default_gc; /* GC for the root root visual */ + Colormap cmap; /* default color map */ + unsigned long white_pixel; + unsigned long black_pixel; /* White and Black pixel values */ + int max_maps, min_maps; /* max and min color maps */ + int backing_store; /* Never, WhenMapped, Always */ + Bool save_unders; + long root_input_mask; /* initial root input mask */ +} Screen; + + +typedef struct { + int x, y; /* location of window */ + int width, height; /* width and height of window */ + int border_width; /* border width of window */ + int depth; /* depth of window */ + Visual *visual; /* the associated visual structure */ + Window root; /* root of screen containing window */ + int _class; /* InputOutput, InputOnly*/ + int bit_gravity; /* one of the bit gravity values */ + int win_gravity; /* one of the window gravity values */ + int backing_store; /* NotUseful, WhenMapped, Always */ + unsigned long backing_planes;/* planes to be preserved if possible */ + unsigned long backing_pixel;/* value to be used when restoring planes */ + Bool save_under; /* boolean, should bits under be saved? */ + Colormap colormap; /* color map to be associated with window */ + Bool map_installed; /* boolean, is color map currently installed*/ + int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ + long all_event_masks; /* set of events all people have interest in*/ + long your_event_mask; /* my event mask */ + long do_not_propagate_mask;/* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Screen *screen; /* back pointer to correct screen */ +} XWindowAttributes; + +typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ + Display* /* display */, + XErrorEvent* /* error_event */ +); + +/* events*/ + +/* What should this be? */ +#if 0 +#ifndef ResizeRequest +#define ResizeRequest ?? +#endif +#endif + +#ifndef MotionNotify +#define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION +#define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION +#endif + +#define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION +#define KeymapStateMask 0 +#define StructureNotifyMask GR_EVENT_MASK_UPDATE + +#ifdef ConfigureNotify +/* XtoNX.h gets it wrong */ +#undef ConfigureNotify +#endif +#define ConfigureNotify GR_EVENT_TYPE_UPDATE + +#ifndef FocusIn +#define FocusIn GR_EVENT_TYPE_FOCUS_IN +#define FocusOut GR_EVENT_TYPE_FOCUS_OUT +#define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT +#endif + +/* Fuunctions */ + +#ifdef __cplusplus +extern "C" { +#endif + +Display *XOpenDisplay(char *name); +Colormap DefaultColormapOfScreen(Screen* /* screen */) ; +int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ; +int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */, + int /* srcX */, int /* srcY */, + unsigned int /* srcWidth */, + unsigned int /* srcHeight */, + int destX, int destY); +int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ; +int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ; +int XGrabPointer(Display* /* display */, Window /* grab_window */, + Bool /* owner_events */, unsigned int /* event_mask */, + int /* pointer_mode */, int /* keyboard_mode */, + Window /* confine_to */, Cursor /* cursor */, Time /* time */) ; +int XUngrabPointer(Display* /* display */, Time /* time */) ; +int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc, + int src_x, int src_y, unsigned int width, unsigned int height, + int dest_x, int dest_y) ; +int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc, + int src_x, int src_y, unsigned int width, unsigned int height, + int dest_x, int dest_y, unsigned long /* plane */) ; + +XErrorHandler XSetErrorHandler (XErrorHandler /* handler */); +Screen *XScreenOfDisplay(Display* /* display */, + int /* screen_number */); +int DisplayWidth(Display* /* display */, int /* screen */); +int DisplayHeight(Display* /* display */, int /* screen */); +int DefaultDepth(Display* /* display */, int /* screen */); +int XAllocColor(Display* /* display */, Colormap /* cmap */, + XColor* color); +int XParseColor(Display* display, Colormap cmap, + const char* cname, XColor* color); +int XDrawLine(Display* display, Window win, GC gc, + int x1, int y1, int x2, int y2); +int XTextExtents( XFontStruct* font, char* s, int len, int* direction, + int* ascent, int* descent2, XCharStruct* overall); +int XPending(Display *d); +XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec); +int XFreeFont(Display* display, XFontStruct* fontStruct); +int XQueryColor(Display* display, Colormap cmap, XColor* color); +Status XGetWindowAttributes(Display* display, Window w, + XWindowAttributes* window_attributes); + +int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes); +int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn); + +void wxNoop(); + +#ifdef __cplusplus +} +#endif + +#define XMaxRequestSize(display) 16384 + +#endif + /* _DUMMY_XLIBH_ */ diff --git a/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xutil.h b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xutil.h new file mode 100644 index 0000000000..adf6bea03e --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/nanox/X11/Xutil.h @@ -0,0 +1,5 @@ +/* + * Xlib compatibility + */ + +/* Nothing yet */ diff --git a/Externals/wxWidgets3/include/wx/x11/palette.h b/Externals/wxWidgets3/include/wx/x11/palette.h new file mode 100644 index 0000000000..9c1ca7f553 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/palette.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/palette.h +// Purpose: wxPalette class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#include "wx/list.h" + +class WXDLLIMPEXP_FWD_CORE wxPalette; + +// Palette for one display +class wxXPalette : public wxObject +{ + wxDECLARE_DYNAMIC_CLASS(wxXPalette); + +public: + wxXPalette(); + + WXDisplay* m_display; + int m_pix_array_n; + unsigned char* m_red; + unsigned char* m_green; + unsigned char* m_blue; + unsigned long* m_pix_array; + WXColormap m_cmap; + bool m_destroyable; +}; + +class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData +{ + friend class WXDLLIMPEXP_FWD_CORE wxPalette; +public: + wxPaletteRefData(); + virtual ~wxPaletteRefData(); + +protected: + wxList m_palettes; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPalette); + +public: + wxPalette(); + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + // X-specific + WXColormap GetXColormap(WXDisplay* display = NULL) const; + bool TransferBitmap(void *data, int depth, int size); + bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp); + unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n); + void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable); + virtual int GetColoursCount() const wxOVERRIDE; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; +}; + +#endif // _WX_PALETTE_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/pen.h b/Externals/wxWidgets3/include/wx/x11/pen.h new file mode 100644 index 0000000000..b71eb45cc7 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/pen.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/pen.h +// Purpose: wxPen class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPen; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxBitmap; + +typedef char wxX11Dash; + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPen: public wxPenBase +{ +public: + wxPen() { } + + wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID ); + + wxPen( const wxBitmap &stipple, int width ); + virtual ~wxPen(); + + bool operator == ( const wxPen& pen ) const; + bool operator != (const wxPen& pen) const { return !(*this == pen); } + + void SetColour( const wxColour &colour ); + void SetColour( unsigned char red, unsigned char green, unsigned char blue ); + void SetCap( wxPenCap capStyle ); + void SetJoin( wxPenJoin joinStyle ); + void SetStyle( wxPenStyle style ); + void SetWidth( int width ); + void SetDashes( int number_of_dashes, const wxDash *dash ); + void SetStipple( const wxBitmap& stipple ); + + wxColour GetColour() const; + wxPenCap GetCap() const; + wxPenJoin GetJoin() const; + wxPenStyle GetStyle() const; + int GetWidth() const; + int GetDashes(wxDash **ptr) const; + int GetDashCount() const; + wxDash* GetDash() const; + wxBitmap* GetStipple() const; + + + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + wxPen(const wxColour& col, int width, int style); + wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants") + void SetStyle(int style) { SetStyle((wxPenStyle)style); } + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + wxDECLARE_DYNAMIC_CLASS(wxPen); +}; + +#endif // _WX_PEN_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/popupwin.h b/Externals/wxWidgets3/include/wx/x11/popupwin.h new file mode 100644 index 0000000000..c1435a5ecb --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/popupwin.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/popupwin.h +// Purpose: +// Author: Robert Roebling +// Created: +// Copyright: (c) 2001 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKPOPUPWINH__ +#define __GTKPOPUPWINH__ + +#include "wx/defs.h" +#include "wx/panel.h" +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxPopUpWindow +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + virtual ~wxPopupWindow() ; + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show( bool show = TRUE ); + +protected: + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxPopupWindow); +}; + +#endif // __GTKPOPUPWINDOWH__ diff --git a/Externals/wxWidgets3/include/wx/x11/print.h b/Externals/wxWidgets3/include/wx/x11/print.h new file mode 100644 index 0000000000..82970f765f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/print.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/print.h +// Purpose: wxPrinter, wxPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINT_H_ +#define _WX_PRINT_H_ + +#include "wx/prntbase.h" + +/* +* Represents the printer: manages printing a wxPrintout object +*/ + +class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase +{ + wxDECLARE_DYNAMIC_CLASS(wxPrinter); + +public: + wxPrinter(wxPrintData *data = NULL); + virtual ~wxPrinter(); + + virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE); + virtual bool PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); +}; + +/* +* wxPrintPreview +* Programmer creates an object of this class to preview a wxPrintout. +*/ + +class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase +{ + wxDECLARE_CLASS(wxPrintPreview); + +public: + wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = NULL, wxPrintData *data = NULL); + virtual ~wxPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); +}; + +#endif + // _WX_PRINT_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/private.h b/Externals/wxWidgets3/include/wx/x11/private.h new file mode 100644 index 0000000000..d1436aec45 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/private.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/private.h +// Purpose: Private declarations for X11 port +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" +#include "wx/hashmap.h" +#include "wx/utils.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message disable nosimpint +#endif +#include "X11/Xlib.h" +#include "X11/Xatom.h" +#include "X11/Xutil.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message enable nosimpint +#endif + +// Include common declarations +#include "wx/x11/privx.h" + +#if wxUSE_PANGO +#include +#endif + +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// Some Unicode <-> UTF8 macros stolen from GTK +// ---------------------------------------------------------------------------- + +#if wxUSE_UNICODE + #define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s) + #define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s) +#else + #define wxGTK_CONV(s) s.c_str() + #define wxGTK_CONV_BACK(s) s +#endif + +// ---------------------------------------------------------------------------- +// we maintain a hash table which contains the mapping from Widget to wxWindow +// corresponding to the window for this widget +// ---------------------------------------------------------------------------- + +WX_DECLARE_HASH_MAP(Window, wxWindow *, wxIntegerHash, wxIntegerEqual, wxWindowHash); + +// these hashes are defined in app.cpp +extern wxWindowHash *wxWidgetHashTable; +extern wxWindowHash *wxClientWidgetHashTable; + +extern void wxDeleteWindowFromTable(Window w); +extern wxWindow *wxGetWindowFromTable(Window w); +extern bool wxAddWindowToTable(Window w, wxWindow *win); + +extern void wxDeleteClientWindowFromTable(Window w); +extern wxWindow *wxGetClientWindowFromTable(Window w); +extern bool wxAddClientWindowToTable(Window w, wxWindow *win); + +// ---------------------------------------------------------------------------- +// TranslateXXXEvent() functions - translate X event to wxWindow one +// ---------------------------------------------------------------------------- +extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent); +extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent, bool isAscii = FALSE); + +extern Window wxGetWindowParent(Window window); + +// Set the window manager decorations according to the +// given wxWidgets style +bool wxSetWMDecorations(Window w, long style); +bool wxMWMIsRunning(Window w); + +#endif +// _WX_PRIVATE_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/privx.h b/Externals/wxWidgets3/include/wx/x11/privx.h new file mode 100644 index 0000000000..c4de8021ea --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/privx.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/privx.h +// Purpose: Private declarations common to X11 and Motif ports +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVX_H_ +#define _WX_PRIVX_H_ + +#include "wx/defs.h" +#include "wx/utils.h" +#include "wx/colour.h" + +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message disable nosimpint +#endif +#include "X11/Xlib.h" +#include "X11/Xatom.h" +#include "X11/Xutil.h" +#if defined( __cplusplus ) && defined( __VMS ) +#pragma message enable nosimpint +#endif + +class WXDLLIMPEXP_FWD_CORE wxMouseEvent; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxRegion; + +// ---------------------------------------------------------------------------- +// key events related functions +// ---------------------------------------------------------------------------- + +WXPixel wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap); +Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap ); + +extern XColor g_itemColors[]; +extern int wxComputeColours (Display *display, const wxColour * back, const wxColour * fore); + +// For convenience +inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); } + +#define wxMAX_RGB 0xff +#define wxMAX_SV 1000 +#define wxSIGN(x) ((x < 0) ? -x : x) +#define wxH_WEIGHT 4 +#define wxS_WEIGHT 1 +#define wxV_WEIGHT 2 + +typedef struct wx_hsv { + int h,s,v; + } wxHSV; + +#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z)) +#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z)) + +void wxHSVToXColor(wxHSV *hsv,XColor *xcolor); +void wxXColorToHSV(wxHSV *hsv,XColor *xcolor); +void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor); +void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor); + +// For debugging +wxString wxGetXEventName(XEvent& event); + +#if wxUSE_NANOX +#define XEventGetWindow(event) event->general.wid +#define XEventGetType(event) event->general.type +#define XConfigureEventGetX(event) ((int) event->update.x) +#define XConfigureEventGetY(event) ((int) event->update.y) +#define XConfigureEventGetWidth(event) ((int) event->update.width) +#define XConfigureEventGetHeight(event) ((int) event->update.height) +#define XExposeEventGetX(event) event->exposure.x +#define XExposeEventGetY(event) event->exposure.y +#define XExposeEventGetWidth(event) event->exposure.width +#define XExposeEventGetHeight(event) event->exposure.height +#define XButtonEventGetTime(event) (wxGetLocalTime()) +#define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L) +#define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M) +#define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R) +#define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L) +#define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M) +#define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R) +#define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT) +#define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL) +#define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT) +#define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META) +#define XButtonEventGetX(event) (event->button.x) +#define XButtonEventGetY(event) (event->button.y) +#define XKeyEventGetTime(event) (wxGetLocalTime()) +#define XKeyEventGetX(event) (event->keystroke.x) +#define XKeyEventGetY(event) (event->keystroke.y) +#define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT) +#define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL) +#define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT) +#define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META) +#define XFontStructGetAscent(f) f->info.baseline + +#else + +#define XEventGetWindow(event) event->xany.window +#define XEventGetType(event) event->xany.type +#define XConfigureEventGetX(event) event->xconfigure.x +#define XConfigureEventGetY(event) event->xconfigure.y +#define XConfigureEventGetWidth(event) event->xconfigure.width +#define XConfigureEventGetHeight(event) event->xconfigure.height +#define XExposeEventGetX(event) event->xexpose.x +#define XExposeEventGetY(event) event->xexpose.y +#define XExposeEventGetWidth(event) event->xexpose.width +#define XExposeEventGetHeight(event) event->xexpose.height +#define XButtonEventGetTime(event) (event->xbutton.time) +#define XButtonEventLChanged(event) (event->xbutton.button == Button1) +#define XButtonEventMChanged(event) (event->xbutton.button == Button2) +#define XButtonEventRChanged(event) (event->xbutton.button == Button3) +#define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask) +#define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask) +#define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask) +#define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask) +#define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask) +#define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask) +#define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask) +#define XButtonEventGetX(event) (event->xbutton.x) +#define XButtonEventGetY(event) (event->xbutton.y) +#define XKeyEventGetTime(event) (event->xkey.time) +#define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask) +#define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask) +#define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask) +#define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask) +#define XKeyEventGetX(event) (event->xkey.x) +#define XKeyEventGetY(event) (event->xkey.y) +#define XFontStructGetAscent(f) f->ascent +#endif + +// ---------------------------------------------------------------------------- +// Misc functions +// ---------------------------------------------------------------------------- + +bool wxDoSetShape( Display* xdisplay, Window xwindow, const wxRegion& region ); + +class WXDLLIMPEXP_CORE wxXVisualInfo +{ +public: + wxXVisualInfo(); + ~wxXVisualInfo(); + void Init( Display* dpy, XVisualInfo* visualInfo ); + + int m_visualType; // TrueColor, DirectColor etc. + int m_visualDepth; + int m_visualColormapSize; + void *m_visualColormap; + int m_visualScreen; + unsigned long m_visualRedMask; + unsigned long m_visualGreenMask; + unsigned long m_visualBlueMask; + int m_visualRedShift; + int m_visualGreenShift; + int m_visualBlueShift; + int m_visualRedPrec; + int m_visualGreenPrec; + int m_visualBluePrec; + + unsigned char *m_colorCube; +}; + +bool wxFillXVisualInfo( wxXVisualInfo* vi, Display* dpy ); + +#endif // _WX_PRIVX_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/region.h b/Externals/wxWidgets3/include/wx/x11/region.h new file mode 100644 index 0000000000..62779bdcec --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/region.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/region.h +// Purpose: wxRegion class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart, Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_ +#define _WX_REGION_H_ + +#include "wx/list.h" + +// ---------------------------------------------------------------------------- +// wxRegion +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase +{ +public: + wxRegion() { } + + wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) + { + InitRect(x, y, w, h); + } + + wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) + { + InitRect(topLeft.x, topLeft.y, + bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); + } + + wxRegion( const wxRect& rect ) + { + InitRect(rect.x, rect.y, rect.width, rect.height); + } + + wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + +public: + WXRegion *GetX11Region() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + // wxRegionBase pure virtuals + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); + + // common part of ctors for a rectangle region + void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegion); +}; + +// ---------------------------------------------------------------------------- +// wxRegionIterator: decomposes a region into rectangles +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + + void Reset() { m_current = 0u; } + void Reset(const wxRegion& region); + + operator bool () const; + bool HaveRects() const; + + void operator ++ (); + void operator ++ (int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + wxRect GetRect() const; + +private: + size_t m_current; + wxRegion m_region; + +private: + wxDECLARE_DYNAMIC_CLASS(wxRegionIterator); +}; + +#endif +// _WX_REGION_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/reparent.h b/Externals/wxWidgets3/include/wx/x11/reparent.h new file mode 100644 index 0000000000..43a1b8d34b --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/reparent.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/reparent.h +// Purpose: Reparenting classes +// Author: Julian Smart +// Modified by: +// Created: 2002-03-09 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REPARENT_H_ +#define _WX_REPARENT_H_ + +#include "wx/window.h" + +/* + * This class helps to reparent a specific window + */ + +class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow; +class WXDLLIMPEXP_CORE wxReparenter: public wxObject +{ +public: + wxReparenter() {} + + // We assume that toReparent has had its X window set + // appropriately. toReparent is typically a wxAdoptedWindow. + bool Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent); + + // Wait for an appropriate window to be created. + // If exactMatch is FALSE, a substring match is OK. + // If windowName is empty, then wait for the next overrideRedirect window. + bool WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent, + const wxString& windowName = wxEmptyString, + bool exactMatch = TRUE); + +protected: + + bool ProcessXEvent(WXEvent* event); + WXWindow FindAClientWindow(WXWindow window, const wxString& name); + + static bool sm_done; + static wxAdoptedWindow* sm_toReparent; + static wxWindow* sm_newParent; + static wxString sm_name; + static bool sm_exactMatch; +}; + +/* + * A window that adopts its handle from the native + * toolkit. It has no parent until reparented. + */ + +class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow +{ + public: + wxAdoptedWindow(); + wxAdoptedWindow(WXWindow window); + virtual ~wxAdoptedWindow(); + + void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; } + WXWindow GetHandle() const { return X11GetMainWindow(); } +}; + +#endif +// _WX_REPARENT_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/textctrl.h b/Externals/wxWidgets3/include/wx/x11/textctrl.h new file mode 100644 index 0000000000..31b4350208 --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/textctrl.h @@ -0,0 +1,384 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/textctrl.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Copyright: (c) 1998 Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __X11TEXTCTRLH__ +#define __X11TEXTCTRLH__ + +// Set to 1 to use wxUniv's implementation, 0 +// to use wxX11's. +#define wxUSE_UNIV_TEXTCTRL 1 + +#if wxUSE_UNIV_TEXTCTRL +#include "wx/univ/textctrl.h" +#else + +#include "wx/scrolwin.h" +#include "wx/arrstr.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +//----------------------------------------------------------------------------- +// helpers +//----------------------------------------------------------------------------- + +enum wxSourceUndo +{ + wxSOURCE_UNDO_LINE, + wxSOURCE_UNDO_ENTER, + wxSOURCE_UNDO_BACK, + wxSOURCE_UNDO_INSERT_LINE, + wxSOURCE_UNDO_DELETE, + wxSOURCE_UNDO_PASTE +}; + +class wxSourceUndoStep: public wxObject +{ +public: + wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtrl *owner ); + + void Undo(); + + wxSourceUndo m_type; + int m_y1; + int m_y2; + int m_cursorX; + int m_cursorY; + wxTextCtrl *m_owner; + wxString m_text; + wxArrayString m_lines; +}; + +class wxSourceLine +{ +public: + wxSourceLine( const wxString &text = wxEmptyString ) + { + m_text = text; + } + + wxString m_text; +}; + +WX_DECLARE_OBJARRAY(wxSourceLine, wxSourceLineArray); + +enum wxSourceLanguage +{ + wxSOURCE_LANG_NONE, + wxSOURCE_LANG_CPP, + wxSOURCE_LANG_PERL, + wxSOURCE_LANG_PYTHON +}; + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper +{ +public: + wxTextCtrl() { Init(); } + wxTextCtrl(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxTextCtrlNameStr); + virtual ~wxTextCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString &value = wxEmptyString, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString &name = wxTextCtrlNameStr); + + // required for scrolling with wxScrollHelper + // ------------------------------------------ + + virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); } + + // implement base class pure virtuals + // ---------------------------------- + + virtual void ChangeValue(const wxString &value); + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // more readable flag testing methods + // ---------------------------------- + + bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; } + bool WrapLines() const { return false; } + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // clears the dirty flag + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + // Undo/redo + virtual void Undo(); + virtual void Redo() {} + + virtual bool CanUndo() const { return (m_undos.GetCount() > 0); } + virtual bool CanRedo() const { return false; } + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + virtual bool Enable( bool enable = true ); + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + bool SetFont(const wxFont& font); + bool SetForegroundColour(const wxColour& colour); + bool SetBackgroundColour(const wxColour& colour); + + void SetModified() { m_modified = true; } + + // textctrl specific scrolling + virtual bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + + // not part of the wxTextCtrl API from now on.. + + void SetLanguage( wxSourceLanguage lang = wxSOURCE_LANG_NONE ); + + void Delete(); + void DeleteLine(); + + void Indent(); + void Unindent(); + + bool HasSelection(); + void ClearSelection(); + + int GetCursorX() { return m_cursorX; } + int GetCursorY() { return m_cursorY; } + bool IsModified() { return m_modified; } + bool OverwriteMode() { return m_overwrite; } + + // implementation from now on... + + int PosToPixel( int line, int pos ); + int PixelToPos( int line, int pixel ); + + void SearchForBrackets(); + + void DoChar( char c ); + void DoBack(); + void DoDelete(); + void DoReturn(); + void DoDClick(); + + wxString GetNextToken( wxString &line, size_t &pos ); + + void DrawLinePart( wxDC &dc, int x, int y, const wxString &toDraw, const wxString &origin, const wxColour &colour); + void DrawLine( wxDC &dc, int x, int y, const wxString &line, int lineNum ); + void OnPaint( wxPaintEvent &event ); + void OnEraseBackground( wxEraseEvent &event ); + void OnMouse( wxMouseEvent &event ); + void OnChar( wxKeyEvent &event ); + void OnSetFocus( wxFocusEvent& event ); + void OnKillFocus( wxFocusEvent& event ); + + void OnInternalIdle(); + void RefreshLine( int n ); + void RefreshDown( int n ); + void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false ); + void MyAdjustScrollbars(); + +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const; + + virtual void DoSetValue(const wxString& value, int flags = 0); + + friend class wxSourceUndoStep; + + wxSourceLineArray m_lines; + + wxFont m_sourceFont; + wxColour m_sourceColour; + wxColour m_commentColour; + wxColour m_stringColour; + + int m_cursorX; + int m_cursorY; + + int m_selStartX,m_selStartY; + int m_selEndX,m_selEndY; + + int m_lineHeight; + int m_charWidth; + + int m_longestLine; + + bool m_overwrite; + bool m_modified; + bool m_editable; + bool m_ignoreInput; + + wxArrayString m_keywords; + wxColour m_keywordColour; + + wxArrayString m_defines; + wxColour m_defineColour; + + wxArrayString m_variables; + wxColour m_variableColour; + + wxSourceLanguage m_lang; + + wxList m_undos; + + bool m_capturing; + + int m_bracketX; + int m_bracketY; + +private: + wxDECLARE_EVENT_TABLE(); + wxDECLARE_DYNAMIC_CLASS(wxTextCtrl); +}; + +//----------------------------------------------------------------------------- +// this is superfluous here but helps to compile +//----------------------------------------------------------------------------- + +// cursor movement and also selection and delete operations +#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg +#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0 +#define wxACTION_TEXT_LAST wxT("last") // go to last pos +#define wxACTION_TEXT_HOME wxT("home") +#define wxACTION_TEXT_END wxT("end") +#define wxACTION_TEXT_LEFT wxT("left") +#define wxACTION_TEXT_RIGHT wxT("right") +#define wxACTION_TEXT_UP wxT("up") +#define wxACTION_TEXT_DOWN wxT("down") +#define wxACTION_TEXT_WORD_LEFT wxT("wordleft") +#define wxACTION_TEXT_WORD_RIGHT wxT("wordright") +#define wxACTION_TEXT_PAGE_UP wxT("pageup") +#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown") + +// clipboard operations +#define wxACTION_TEXT_COPY wxT("copy") +#define wxACTION_TEXT_CUT wxT("cut") +#define wxACTION_TEXT_PASTE wxT("paste") + +// insert text at the cursor position: the text is in strArg of PerformAction +#define wxACTION_TEXT_INSERT wxT("insert") + +// if the action starts with either of these prefixes and the rest of the +// string is one of the movement commands, it means to select/delete text from +// the current cursor position to the new one +#define wxACTION_TEXT_PREFIX_SEL wxT("sel") +#define wxACTION_TEXT_PREFIX_DEL wxT("del") + +// mouse selection +#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel") +#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel") +#define wxACTION_TEXT_SEL_WORD wxT("wordsel") +#define wxACTION_TEXT_SEL_LINE wxT("linesel") + +// undo or redo +#define wxACTION_TEXT_UNDO wxT("undo") +#define wxACTION_TEXT_REDO wxT("redo") + +// ---------------------------------------------------------------------------- +// wxTextCtrl types +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStdTextCtrlInputHandler : public wxStdInputHandler +{ +public: + wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {} + + virtual bool HandleKey(wxInputConsumer *consumer, + const wxKeyEvent& event, + bool pressed) { return false; } + virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; } + virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; } + +protected: + // get the position of the mouse click + static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos) { return 0; } + + // capture data + wxTextCtrl *m_winCapture; +}; + +#endif +// wxUSE_UNIV_TEXTCTRL + +#endif // __X11TEXTCTRLH__ diff --git a/Externals/wxWidgets3/include/wx/x11/toplevel.h b/Externals/wxWidgets3/include/wx/x11/toplevel.h new file mode 100644 index 0000000000..0eec73778b --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/toplevel.h @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/toplevel.h +// Purpose: wxTopLevelWindowX11 is the X11 implementation of wxTLW +// Author: Julian Smart +// Modified by: +// Created: 20.09.01 +// Copyright: (c) 2002 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_X11_TOPLEVEL_H_ +#define _WX_X11_TOPLEVEL_H_ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowX11 +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxTopLevelWindowX11 : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowX11() { Init(); } + + wxTopLevelWindowX11(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxTopLevelWindowX11(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = true); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = true); + virtual bool IsIconized() const; + virtual void SetIcons(const wxIconBundle& icons); + virtual void Restore(); + + virtual bool Show( bool show = true ); + + virtual bool ShowFullScreen( bool show, long style = wxFULLSCREEN_ALL ); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + + // implementation + void SetNeedResizeInIdle( bool set = true ) + { m_needResizeInIdle = set; } + void SetConfigureGeometry( int x, int y, int width, int height ) + { m_x = x; m_y = y; m_width = width; m_height = height; } + + virtual bool SetShape(const wxRegion& region); + + // For implementation purposes - sometimes decorations make the + // client area smaller + virtual wxPoint GetClientAreaOrigin() const; + + virtual void OnInternalIdle(); + +protected: + // common part of all ctors + void Init(); + + // set the icon for the window + void DoSetIcon( const wxIcon& icon ); + + // For implementation of delayed resize events + bool m_needResizeInIdle; + + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoSetClientSize(int width, int height); + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoGetPosition( int *x, int *y ) const; + + // Is the frame currently iconized? + bool m_iconized; + + // Should the frame be maximized when it will be shown? set by Maximize() + // when it is called while the frame is hidden + bool m_maximizeOnShow; + + // Data to save/restore when calling ShowFullScreen + long m_fsStyle; // Passed to ShowFullScreen + wxRect m_fsOldSize; + bool m_fsIsMaximized; + bool m_fsIsShowing; + wxString m_title; + + // Geometry + int m_x,m_y,m_width,m_height; +}; + +// list of all frames and modeless dialogs +//extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; + +#endif // _WX_X11_TOPLEVEL_H_ diff --git a/Externals/wxWidgets3/include/wx/x11/window.h b/Externals/wxWidgets3/include/wx/x11/window.h new file mode 100644 index 0000000000..c0f0add91f --- /dev/null +++ b/Externals/wxWidgets3/include/wx/x11/window.h @@ -0,0 +1,221 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/x11/window.h +// Purpose: wxWindow class +// Author: Julian Smart +// Modified by: +// Created: 17/09/98 +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#include "wx/region.h" + +// ---------------------------------------------------------------------------- +// wxWindow class for Motif - see also wxWindowBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxWindowX11 : public wxWindowBase +{ + friend class WXDLLIMPEXP_FWD_CORE wxDC; + friend class WXDLLIMPEXP_FWD_CORE wxWindowDC; + +public: + wxWindowX11() { Init(); } + + wxWindowX11(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowX11(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + virtual void Raise(); + virtual void Lower(); + + // SetLabel(), which does nothing in wxWindow + virtual void SetLabel(const wxString& label) wxOVERRIDE { m_Label = label; } + virtual wxString GetLabel() const wxOVERRIDE { return m_Label; } + + virtual bool Show( bool show = true ); + virtual bool Enable( bool enable = true ); + + virtual void SetFocus(); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = (const wxRect *) NULL ); + virtual void Update(); + + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + + virtual void ScrollWindow( int dx, int dy, const wxRect* rect = NULL ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + + // Get the unique identifier of a window + virtual WXWindow GetHandle() const { return X11GetMainWindow(); } + + // implementation from now on + // -------------------------- + + // accessors + // --------- + + // Get main X11 window + virtual WXWindow X11GetMainWindow() const; + + // Get X11 window representing the client area + virtual WXWindow GetClientAreaWindow() const; + + void SetLastClick(int button, long timestamp) + { m_lastButton = button; m_lastTS = timestamp; } + + int GetLastClickedButton() const { return m_lastButton; } + long GetLastClickTime() const { return m_lastTS; } + + // Gives window a chance to do something in response to a size message, e.g. + // arrange status bar, toolbar etc. + virtual bool PreResize(); + + // Generates paint events from m_updateRegion + void SendPaintEvents(); + + // Generates paint events from flag + void SendNcPaintEvents(); + + // Generates erase events from m_clearRegion + void SendEraseEvents(); + + // Clip to paint region? + bool GetClipPaintRegion() { return m_clipPaintRegion; } + + // Return clear region + wxRegion &GetClearRegion() { return m_clearRegion; } + + void NeedUpdateNcAreaInIdle( bool update = true ) { m_updateNcArea = update; } + + // Inserting into main window instead of client + // window. This is mostly for a wxWindow's own + // scrollbars. + void SetInsertIntoMain( bool insert = true ) { m_insertIntoMain = insert; } + bool GetInsertIntoMain() { return m_insertIntoMain; } + + // sets the fore/background colour for the given widget + static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour); + static void DoChangeBackgroundColour(WXWindow widget, wxColour& backgroundColour, bool changeArmColour = false); + + // I don't want users to override what's done in idle so everything that + // has to be done in idle time in order for wxX11 to work is done in + // OnInternalIdle + virtual void OnInternalIdle(); + +protected: + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // For double-click detection + long m_lastTS; // last timestamp + int m_lastButton; // last pressed button + +protected: + WXWindow m_mainWindow; + WXWindow m_clientWindow; + bool m_insertIntoMain; + + bool m_winCaptured; + wxRegion m_clearRegion; + bool m_clipPaintRegion; + bool m_updateNcArea; + bool m_needsInputFocus; // Input focus set in OnIdle + + // implement the base class pure virtuals + virtual void DoGetTextExtent(const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *font = NULL) const; + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetSizeHints(int minW, int minH, + int maxW, int maxH, + int incW, int incH); + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + virtual void KillFocus(); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +private: + // common part of all ctors + void Init(); + + wxString m_Label; + + wxDECLARE_DYNAMIC_CLASS(wxWindowX11); + wxDECLARE_NO_COPY_CLASS(wxWindowX11); + wxDECLARE_EVENT_TABLE(); +}; + +// ---------------------------------------------------------------------------- +// A little class to switch off `size optimization' while an instance of the +// object exists: this may be useful to temporarily disable the optimisation +// which consists to do nothing when the new size is equal to the old size - +// although quite useful usually to avoid flicker, sometimes it leads to +// undesired effects. +// +// Usage: create an instance of this class on the stack to disable the size +// optimisation, it will be reenabled as soon as the object goes out from scope. +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxNoOptimize +{ +public: + wxNoOptimize() { ms_count++; } + ~wxNoOptimize() { ms_count--; } + + static bool CanOptimize() { return ms_count == 0; } + +protected: + static int ms_count; +}; + +#endif // _WX_WINDOW_H_ diff --git a/Externals/wxWidgets3/include/wx/xlocale.h b/Externals/wxWidgets3/include/wx/xlocale.h index 6a01ad311a..27493974d0 100644 --- a/Externals/wxWidgets3/include/wx/xlocale.h +++ b/Externals/wxWidgets3/include/wx/xlocale.h @@ -36,7 +36,7 @@ // The platform-specific locale type // If wxXLocale_t is not defined, then only "C" locale support is provided #ifdef wxHAS_XLOCALE_SUPPORT - #if wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__) + #if wxCHECK_VISUALC_VERSION(8) typedef _locale_t wxXLocale_t; #define wxXLOCALE_IDENT(name) _ ## name #elif defined(HAVE_LOCALE_T) @@ -76,8 +76,10 @@ public: // Construct an uninitialized locale wxXLocale() { m_locale = NULL; } +#if wxUSE_INTL // Construct from a symbolic language constant wxXLocale(wxLanguage lang); +#endif // Construct from the given language string wxXLocale(const char *loc) { Init(loc); } @@ -148,8 +150,8 @@ public: } // Default copy ctor, assignment operator and dtor are ok (or would be if - // we didn't use DECLARE_NO_COPY_CLASS() for consistency with the xlocale - // version) + // we didn't use wxDECLARE_NO_COPY_CLASS() for consistency with the + // xlocale version) // Get the global "C" locale object diff --git a/Externals/wxWidgets3/include/wx/xpmhand.h b/Externals/wxWidgets3/include/wx/xpmhand.h index 0952748d80..c7f8d0de20 100644 --- a/Externals/wxWidgets3/include/wx/xpmhand.h +++ b/Externals/wxWidgets3/include/wx/xpmhand.h @@ -11,14 +11,11 @@ #ifndef _WX_XPMHAND_H_BASE_ #define _WX_XPMHAND_H_BASE_ -// Only wxMSW and wxPM currently defines a separate XPM handler, since -// mostly Windows and Presentation Manager apps won't need XPMs. +// Only wxMSW currently defines a separate XPM handler, since +// mostly Windows apps won't need XPMs. #if defined(__WXMSW__) #error xpmhand.h is no longer needed since wxImage now handles XPMs. #endif -#if defined(__WXPM__) -#include "wx/os2/xpmhand.h" -#endif #endif // _WX_XPMHAND_H_BASE_ diff --git a/Externals/wxWidgets3/include/wx/xti.h b/Externals/wxWidgets3/include/wx/xti.h index 75f594f494..f8ddce9bbd 100644 --- a/Externals/wxWidgets3/include/wx/xti.h +++ b/Externals/wxWidgets3/include/wx/xti.h @@ -369,7 +369,7 @@ protected: void Register(); void Unregister(); - DECLARE_NO_COPY_CLASS(wxClassInfo) + wxDECLARE_NO_COPY_CLASS(wxClassInfo); }; WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); diff --git a/Externals/wxWidgets3/include/wx/xti2.h b/Externals/wxWidgets3/include/wx/xti2.h index 16e5f212f1..c7abd2fa3d 100644 --- a/Externals/wxWidgets3/include/wx/xti2.h +++ b/Externals/wxWidgets3/include/wx/xti2.h @@ -123,7 +123,7 @@ wxObject* wxVariantOfPtrToObjectConverter##name ( const wxAny &data ) \ _DEFAULT_CONSTRUCTOR(name) \ _DEFAULT_CONVERTERS(name) \ void wxVariantToObjectConverter##name ( const wxAny &data, wxObjectFunctor* fn ) \ - { name o = wxANY_AS(data, name); (*fn)( &o ); } \ + { name o = data.As(); (*fn)( &o ); } \ \ const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \ wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \ @@ -259,7 +259,7 @@ void wxStringWriteValue( wxString &s, const T &data); template void wxToStringConverter( const wxAny &v, wxString &s ) -{ wxStringWriteValue(s, wxANY_AS(v, T)); } +{ wxStringWriteValue(s, v.As()); } template void wxFromStringConverter( const wxString &s, wxAny &v) diff --git a/Externals/wxWidgets3/include/wx/xtiprop.h b/Externals/wxWidgets3/include/wx/xtiprop.h index 18626f2982..8c18e2a35a 100644 --- a/Externals/wxWidgets3/include/wx/xtiprop.h +++ b/Externals/wxWidgets3/include/wx/xtiprop.h @@ -96,7 +96,6 @@ private: class wxPropertySetter##property : public wxPropertySetter \ { \ public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \ virtual ~wxPropertySetter##property() {} \ \ @@ -107,7 +106,7 @@ public: \ if ( variantValue.GetAs(&tempobj) ) \ obj->setterMethod(tempobj); \ else \ - obj->setterMethod(*wxANY_AS(variantValue, valueType*)); \ + obj->setterMethod(*variantValue.As()); \ } \ }; @@ -115,7 +114,6 @@ public: \ class wxPropertyGetter##property : public wxPropertyGetter \ { \ public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \ virtual ~wxPropertyGetter##property() {} \ \ @@ -130,7 +128,6 @@ public: \ class wxPropertyCollectionAdder##property : public wxPropertyCollectionAdder \ { \ public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \ virtual ~wxPropertyCollectionAdder##property() {} \ \ @@ -141,7 +138,7 @@ public: \ if ( variantValue.GetAs(&tempobj) ) \ obj->addermethod(tempobj); \ else \ - obj->addermethod(*wxANY_AS(variantValue, valueType*)); \ + obj->addermethod(*variantValue.As()); \ } \ }; @@ -149,7 +146,6 @@ public: \ class wxPropertyCollectionGetter##property : public wxPropertyCollectionGetter \ { \ public: \ - wxINFUNC_CLASS_TYPE_FIX(Klass) \ wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \ virtual ~wxPropertyCollectionGetter##property() {} \ \ diff --git a/Externals/wxWidgets3/include/wx/zipstrm.h b/Externals/wxWidgets3/include/wx/zipstrm.h index 9cd7631944..4866535bef 100644 --- a/Externals/wxWidgets3/include/wx/zipstrm.h +++ b/Externals/wxWidgets3/include/wx/zipstrm.h @@ -105,6 +105,7 @@ enum wxZipFlags wxZIP_ENHANCED = 0x0010, wxZIP_PATCH = 0x0020, wxZIP_STRONG_ENC = 0x0040, + wxZIP_LANG_ENC_UTF8 = 0x0800, // filename and comment are UTF8 wxZIP_UNUSED = 0x0F80, wxZIP_RESERVED = 0xF000 }; @@ -142,10 +143,10 @@ public: wxZipEntry& operator=(const wxZipEntry& entry); // Get accessors - wxDateTime GetDateTime() const { return m_DateTime; } - wxFileOffset GetSize() const { return m_Size; } - wxFileOffset GetOffset() const { return m_Offset; } - wxString GetInternalName() const { return m_Name; } + wxDateTime GetDateTime() const wxOVERRIDE { return m_DateTime; } + wxFileOffset GetSize() const wxOVERRIDE { return m_Size; } + wxFileOffset GetOffset() const wxOVERRIDE { return m_Offset; } + wxString GetInternalName() const wxOVERRIDE { return m_Name; } int GetMethod() const { return m_Method; } int GetFlags() const { return m_Flags; } wxUint32 GetCrc() const { return m_Crc; } @@ -153,23 +154,23 @@ public: int GetSystemMadeBy() const { return m_SystemMadeBy; } wxString GetComment() const { return m_Comment; } wxUint32 GetExternalAttributes() const { return m_ExternalAttributes; } - wxPathFormat GetInternalFormat() const { return wxPATH_UNIX; } + wxPathFormat GetInternalFormat() const wxOVERRIDE { return wxPATH_UNIX; } int GetMode() const; const char *GetLocalExtra() const; size_t GetLocalExtraLen() const; const char *GetExtra() const; size_t GetExtraLen() const; - wxString GetName(wxPathFormat format = wxPATH_NATIVE) const; + wxString GetName(wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE; // is accessors - inline bool IsDir() const; + inline bool IsDir() const wxOVERRIDE; inline bool IsText() const; - inline bool IsReadOnly() const; + inline bool IsReadOnly() const wxOVERRIDE; inline bool IsMadeByUnix() const; // set accessors - void SetDateTime(const wxDateTime& dt) { m_DateTime = dt; } - void SetSize(wxFileOffset size) { m_Size = size; } + void SetDateTime(const wxDateTime& dt) wxOVERRIDE { m_DateTime = dt; } + void SetSize(wxFileOffset size) wxOVERRIDE { m_Size = size; } void SetMethod(int method) { m_Method = (wxUint16)method; } void SetComment(const wxString& comment) { m_Comment = comment; } void SetExternalAttributes(wxUint32 attr ) { m_ExternalAttributes = attr; } @@ -179,21 +180,21 @@ public: void SetLocalExtra(const char *extra, size_t len); inline void SetName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE); + wxPathFormat format = wxPATH_NATIVE) wxOVERRIDE; static wxString GetInternalName(const wxString& name, wxPathFormat format = wxPATH_NATIVE, bool *pIsDir = NULL); // set is accessors - void SetIsDir(bool isDir = true); - inline void SetIsReadOnly(bool isReadOnly = true); + void SetIsDir(bool isDir = true) wxOVERRIDE; + inline void SetIsReadOnly(bool isReadOnly = true) wxOVERRIDE; inline void SetIsText(bool isText = true); wxZipEntry *Clone() const { return ZipClone(); } void SetNotifier(wxZipNotifier& notifier); - void UnsetNotifier(); + void UnsetNotifier() wxOVERRIDE; protected: // Internal attributes @@ -207,7 +208,7 @@ protected: int GetInternalAttributes() const { return m_InternalAttributes; } void SetVersionNeeded(int version) { m_VersionNeeded = (wxUint16)version; } - void SetOffset(wxFileOffset offset) { m_Offset = offset; } + void SetOffset(wxFileOffset offset) wxOVERRIDE { m_Offset = offset; } void SetFlags(int flags) { m_Flags = (wxUint16)flags; } void SetVersionMadeBy(int version) { m_VersionMadeBy = (wxUint8)version; } void SetCrc(wxUint32 crc) { m_Crc = crc; } @@ -221,7 +222,7 @@ protected: void Notify(); private: - wxArchiveEntry* DoClone() const { return ZipClone(); } + wxArchiveEntry* DoClone() const wxOVERRIDE { return ZipClone(); } size_t ReadLocal(wxInputStream& stream, wxMBConv& conv); size_t WriteLocal(wxOutputStream& stream, wxMBConv& conv) const; @@ -233,6 +234,8 @@ private: size_t WriteDescriptor(wxOutputStream& stream, wxUint32 crc, wxFileOffset compressedSize, wxFileOffset size); + bool LoadExtraInfo(const char* extraData, wxUint16 extraLen, bool localInfo); + wxUint8 m_SystemMadeBy; // one of enum wxZipSystem wxUint8 m_VersionMadeBy; // major * 10 + minor @@ -261,7 +264,7 @@ private: friend class wxZipInputStream; friend class wxZipOutputStream; - DECLARE_DYNAMIC_CLASS(wxZipEntry) + wxDECLARE_DYNAMIC_CLASS(wxZipEntry); }; @@ -285,17 +288,17 @@ public: bool WXZIPFIX PutNextEntry(const wxString& name, const wxDateTime& dt = wxDateTime::Now(), - wxFileOffset size = wxInvalidOffset); + wxFileOffset size = wxInvalidOffset) wxOVERRIDE; bool WXZIPFIX PutNextDirEntry(const wxString& name, - const wxDateTime& dt = wxDateTime::Now()); + const wxDateTime& dt = wxDateTime::Now()) wxOVERRIDE; bool WXZIPFIX CopyEntry(wxZipEntry *entry, wxZipInputStream& inputStream); bool WXZIPFIX CopyArchiveMetaData(wxZipInputStream& inputStream); - void WXZIPFIX Sync(); - bool WXZIPFIX CloseEntry(); - bool WXZIPFIX Close(); + void WXZIPFIX Sync() wxOVERRIDE; + bool WXZIPFIX CloseEntry() wxOVERRIDE; + bool WXZIPFIX Close() wxOVERRIDE; void SetComment(const wxString& comment) { m_Comment = comment; } @@ -303,8 +306,8 @@ public: void WXZIPFIX SetLevel(int level); protected: - virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_entrySize; } + virtual size_t WXZIPFIX OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_entrySize; } // this protected interface isn't yet finalised struct Buffer { const char *m_data; size_t m_size; }; @@ -319,9 +322,9 @@ protected: private: void Init(int level); - bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry); - bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream); - bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream); + bool WXZIPFIX PutNextEntry(wxArchiveEntry *entry) wxOVERRIDE; + bool WXZIPFIX CopyEntry(wxArchiveEntry *entry, wxArchiveInputStream& stream) wxOVERRIDE; + bool WXZIPFIX CopyArchiveMetaData(wxArchiveInputStream& stream) wxOVERRIDE; bool IsOpened() const { return m_comp || m_pending; } @@ -362,30 +365,21 @@ public: wxZipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvLocal); wxZipInputStream(wxInputStream *stream, wxMBConv& conv = wxConvLocal); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - wxZipInputStream(const wxString& archive, const wxString& file) - : wxArchiveInputStream(OpenFile(archive), wxConvLocal) { Init(file); } -#endif - virtual WXZIPFIX ~wxZipInputStream(); bool OpenEntry(wxZipEntry& entry) { return DoOpen(&entry); } - bool WXZIPFIX CloseEntry(); + bool WXZIPFIX CloseEntry() wxOVERRIDE; wxZipEntry *GetNextEntry(); wxString WXZIPFIX GetComment(); int WXZIPFIX GetTotalEntries(); - virtual wxFileOffset GetLength() const { return m_entry.GetSize(); } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_entry.GetSize(); } protected: - size_t WXZIPFIX OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; } - -#if WXWIN_COMPATIBILITY_2_6 - wxFileOffset WXZIPFIX OnSysSeek(wxFileOffset seek, wxSeekMode mode); -#endif + size_t WXZIPFIX OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_decomp ? m_decomp->TellI() : 0; } // this protected interface isn't yet finalised virtual wxInputStream* WXZIPFIX OpenDecompressor(wxInputStream& stream); @@ -394,13 +388,10 @@ protected: private: void Init(); void Init(const wxString& file); -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - static wxInputStream *OpenFile(const wxString& archive); -#endif - wxArchiveEntry *DoGetNextEntry() { return GetNextEntry(); } + wxArchiveEntry *DoGetNextEntry() wxOVERRIDE { return GetNextEntry(); } - bool WXZIPFIX OpenEntry(wxArchiveEntry& entry); + bool WXZIPFIX OpenEntry(wxArchiveEntry& entry) wxOVERRIDE; wxStreamError ReadLocal(bool readEndRec = false); wxStreamError ReadCentral(); @@ -440,11 +431,6 @@ private: friend bool wxZipOutputStream::CopyArchiveMetaData( wxZipInputStream& inputStream); -#if WXWIN_COMPATIBILITY_2_6 - bool m_allowSeeking; - friend class wxArchiveFSHandler; -#endif - wxDECLARE_NO_COPY_CLASS(wxZipInputStream); }; @@ -488,26 +474,26 @@ public: { return new wxZipOutputStream(stream, -1, GetConv()); } wxString GetInternalName(const wxString& name, - wxPathFormat format = wxPATH_NATIVE) const + wxPathFormat format = wxPATH_NATIVE) const wxOVERRIDE { return wxZipEntry::GetInternalName(name, format); } const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; + = wxSTREAM_PROTOCOL) const wxOVERRIDE; protected: - wxArchiveEntry *DoNewEntry() const + wxArchiveEntry *DoNewEntry() const wxOVERRIDE { return NewEntry(); } - wxArchiveInputStream *DoNewStream(wxInputStream& stream) const + wxArchiveInputStream *DoNewStream(wxInputStream& stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const + wxArchiveOutputStream *DoNewStream(wxOutputStream& stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveInputStream *DoNewStream(wxInputStream *stream) const + wxArchiveInputStream *DoNewStream(wxInputStream *stream) const wxOVERRIDE { return NewStream(stream); } - wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const + wxArchiveOutputStream *DoNewStream(wxOutputStream *stream) const wxOVERRIDE { return NewStream(stream); } private: - DECLARE_DYNAMIC_CLASS(wxZipClassFactory) + wxDECLARE_DYNAMIC_CLASS(wxZipClassFactory); }; diff --git a/Externals/wxWidgets3/include/wx/zstream.h b/Externals/wxWidgets3/include/wx/zstream.h index 193bb79d4e..d7391440a7 100644 --- a/Externals/wxWidgets3/include/wx/zstream.h +++ b/Externals/wxWidgets3/include/wx/zstream.h @@ -39,17 +39,17 @@ class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream { wxZlibInputStream(wxInputStream *stream, int flags = wxZLIB_AUTO); virtual ~wxZlibInputStream(); - char Peek() { return wxInputStream::Peek(); } - wxFileOffset GetLength() const { return wxInputStream::GetLength(); } + char Peek() wxOVERRIDE { return wxInputStream::Peek(); } + wxFileOffset GetLength() const wxOVERRIDE { return wxInputStream::GetLength(); } static bool CanHandleGZip(); - bool SetDictionary(const char *data, const size_t datalen); + bool SetDictionary(const char *data, size_t datalen); bool SetDictionary(const wxMemoryBuffer &buf); protected: - size_t OnSysRead(void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } + size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: void Init(int flags); @@ -69,18 +69,18 @@ class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream { wxZlibOutputStream(wxOutputStream *stream, int level = -1, int flags = wxZLIB_ZLIB); virtual ~wxZlibOutputStream() { Close(); } - void Sync() { DoFlush(false); } - bool Close(); - wxFileOffset GetLength() const { return m_pos; } + void Sync() wxOVERRIDE { DoFlush(false); } + bool Close() wxOVERRIDE; + wxFileOffset GetLength() const wxOVERRIDE { return m_pos; } static bool CanHandleGZip(); - bool SetDictionary(const char *data, const size_t datalen); + bool SetDictionary(const char *data, size_t datalen); bool SetDictionary(const wxMemoryBuffer &buf); protected: - size_t OnSysWrite(const void *buffer, size_t size); - wxFileOffset OnSysTell() const { return m_pos; } + size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } virtual void DoFlush(bool final); @@ -101,20 +101,20 @@ class WXDLLIMPEXP_BASE wxZlibClassFactory: public wxFilterClassFactory public: wxZlibClassFactory(); - wxFilterInputStream *NewStream(wxInputStream& stream) const + wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const + wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } - wxFilterInputStream *NewStream(wxInputStream *stream) const + wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const + wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; + = wxSTREAM_PROTOCOL) const wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxZlibClassFactory) + wxDECLARE_DYNAMIC_CLASS(wxZlibClassFactory); }; class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory @@ -122,20 +122,20 @@ class WXDLLIMPEXP_BASE wxGzipClassFactory: public wxFilterClassFactory public: wxGzipClassFactory(); - wxFilterInputStream *NewStream(wxInputStream& stream) const + wxFilterInputStream *NewStream(wxInputStream& stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream& stream) const + wxFilterOutputStream *NewStream(wxOutputStream& stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } - wxFilterInputStream *NewStream(wxInputStream *stream) const + wxFilterInputStream *NewStream(wxInputStream *stream) const wxOVERRIDE { return new wxZlibInputStream(stream); } - wxFilterOutputStream *NewStream(wxOutputStream *stream) const + wxFilterOutputStream *NewStream(wxOutputStream *stream) const wxOVERRIDE { return new wxZlibOutputStream(stream, -1); } const wxChar * const *GetProtocols(wxStreamProtocolType type - = wxSTREAM_PROTOCOL) const; + = wxSTREAM_PROTOCOL) const wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxGzipClassFactory) + wxDECLARE_DYNAMIC_CLASS(wxGzipClassFactory); }; WXDLLIMPEXP_BASE wxVersionInfo wxGetZlibVersionInfo(); diff --git a/Externals/wxWidgets3/src/aui/auibar.cpp b/Externals/wxWidgets3/src/aui/auibar.cpp index 2bfcbe1b6a..a48cfd66d4 100644 --- a/Externals/wxWidgets3/src/aui/auibar.cpp +++ b/Externals/wxWidgets3/src/aui/auibar.cpp @@ -1,4 +1,3 @@ -// XXX comex: scale support /////////////////////////////////////////////////////////////////////////////// // Name: src/aui/auibar.cpp @@ -51,8 +50,8 @@ wxDEFINE_EVENT( wxEVT_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent ); wxDEFINE_EVENT( wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent ); -IMPLEMENT_CLASS(wxAuiToolBar, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxAuiToolBarEvent, wxEvent) +wxIMPLEMENT_CLASS(wxAuiToolBar, wxControl); +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiToolBarEvent, wxEvent); // missing wxITEM_* items @@ -99,7 +98,7 @@ public: ToolbarCommandCapture() { m_lastId = 0; } int GetCommandId() const { return m_lastId; } - bool ProcessEvent(wxEvent& evt) + bool ProcessEvent(wxEvent& evt) wxOVERRIDE { if (evt.GetEventType() == wxEVT_MENU) { @@ -125,7 +124,7 @@ const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE, DISABLED_TEXT_GREY_HUE, DISABLED_TEXT_GREY_HUE); -wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt() +wxAuiGenericToolBarArt::wxAuiGenericToolBarArt() { m_baseColour = GetBaseColor(); @@ -161,48 +160,48 @@ wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt() m_font = *wxNORMAL_FONT; } -wxAuiDefaultToolBarArt::~wxAuiDefaultToolBarArt() +wxAuiGenericToolBarArt::~wxAuiGenericToolBarArt() { m_font = *wxNORMAL_FONT; } -wxAuiToolBarArt* wxAuiDefaultToolBarArt::Clone() +wxAuiToolBarArt* wxAuiGenericToolBarArt::Clone() { - return static_cast(new wxAuiDefaultToolBarArt); + return static_cast(new wxAuiGenericToolBarArt); } -void wxAuiDefaultToolBarArt::SetFlags(unsigned int flags) +void wxAuiGenericToolBarArt::SetFlags(unsigned int flags) { m_flags = flags; } -void wxAuiDefaultToolBarArt::SetFont(const wxFont& font) +void wxAuiGenericToolBarArt::SetFont(const wxFont& font) { m_font = font; } -void wxAuiDefaultToolBarArt::SetTextOrientation(int orientation) +void wxAuiGenericToolBarArt::SetTextOrientation(int orientation) { m_textOrientation = orientation; } -unsigned int wxAuiDefaultToolBarArt::GetFlags() +unsigned int wxAuiGenericToolBarArt::GetFlags() { return m_flags; } -wxFont wxAuiDefaultToolBarArt::GetFont() +wxFont wxAuiGenericToolBarArt::GetFont() { return m_font; } -int wxAuiDefaultToolBarArt::GetTextOrientation() +int wxAuiGenericToolBarArt::GetTextOrientation() { return m_textOrientation; } -void wxAuiDefaultToolBarArt::DrawBackground( +void wxAuiGenericToolBarArt::DrawBackground( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& _rect) @@ -214,7 +213,7 @@ void wxAuiDefaultToolBarArt::DrawBackground( dc.GradientFillLinear(rect, startColour, endColour, wxSOUTH); } -void wxAuiDefaultToolBarArt::DrawPlainBackground(wxDC& dc, +void wxAuiGenericToolBarArt::DrawPlainBackground(wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& _rect) { @@ -227,7 +226,7 @@ void wxAuiDefaultToolBarArt::DrawPlainBackground(wxDC& dc, rect.GetWidth() + 2, rect.GetHeight() + 1); } -void wxAuiDefaultToolBarArt::DrawLabel( +void wxAuiGenericToolBarArt::DrawLabel( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item, @@ -254,7 +253,7 @@ void wxAuiDefaultToolBarArt::DrawLabel( } -void wxAuiDefaultToolBarArt::DrawButton( +void wxAuiGenericToolBarArt::DrawButton( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item, @@ -280,11 +279,11 @@ void wxAuiDefaultToolBarArt::DrawButton( { bmpX = rect.x + (rect.width/2) - - (item.GetBitmap().GetScaledWidth()/2); + (item.GetBitmap().GetWidth()/2); bmpY = rect.y + ((rect.height-textHeight)/2) - - (item.GetBitmap().GetScaledHeight()/2); + (item.GetBitmap().GetHeight()/2); textX = rect.x + (rect.width/2) - (textWidth/2) + 1; textY = rect.y + rect.height - textHeight - 1; @@ -295,9 +294,9 @@ void wxAuiDefaultToolBarArt::DrawButton( bmpY = rect.y + (rect.height/2) - - (item.GetBitmap().GetScaledHeight()/2); + (item.GetBitmap().GetHeight()/2); - textX = bmpX + 3 + item.GetBitmap().GetScaledWidth(); + textX = bmpX + 3 + item.GetBitmap().GetWidth(); textY = rect.y + (rect.height/2) - (textHeight/2); @@ -355,7 +354,7 @@ void wxAuiDefaultToolBarArt::DrawButton( } -void wxAuiDefaultToolBarArt::DrawDropDownButton( +void wxAuiGenericToolBarArt::DrawDropDownButton( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item, @@ -391,20 +390,20 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( dropBmpX = dropDownRect.x + (dropDownRect.width/2) - - (m_buttonDropDownBmp.GetScaledWidth()/2); + (m_buttonDropDownBmp.GetWidth()/2); dropBmpY = dropDownRect.y + (dropDownRect.height/2) - - (m_buttonDropDownBmp.GetScaledHeight()/2); + (m_buttonDropDownBmp.GetHeight()/2); if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) { bmpX = buttonRect.x + (buttonRect.width/2) - - (item.GetBitmap().GetScaledWidth()/2); + (item.GetBitmap().GetWidth()/2); bmpY = buttonRect.y + ((buttonRect.height-textHeight)/2) - - (item.GetBitmap().GetScaledHeight()/2); + (item.GetBitmap().GetHeight()/2); textX = rect.x + (rect.width/2) - (textWidth/2) + 1; textY = rect.y + rect.height - textHeight - 1; @@ -415,9 +414,9 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( bmpY = rect.y + (rect.height/2) - - (item.GetBitmap().GetScaledHeight()/2); + (item.GetBitmap().GetHeight()/2); - textX = bmpX + 3 + item.GetBitmap().GetScaledWidth(); + textX = bmpX + 3 + item.GetBitmap().GetWidth(); textY = rect.y + (rect.height/2) - (textHeight/2); @@ -481,7 +480,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton( } } -void wxAuiDefaultToolBarArt::DrawControlLabel( +void wxAuiGenericToolBarArt::DrawControlLabel( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item, @@ -523,7 +522,7 @@ void wxAuiDefaultToolBarArt::DrawControlLabel( } } -wxSize wxAuiDefaultToolBarArt::GetLabelSize( +wxSize wxAuiGenericToolBarArt::GetLabelSize( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item) @@ -546,7 +545,7 @@ wxSize wxAuiDefaultToolBarArt::GetLabelSize( return wxSize(width, height); } -wxSize wxAuiDefaultToolBarArt::GetToolSize( +wxSize wxAuiGenericToolBarArt::GetToolSize( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxAuiToolBarItem& item) @@ -554,8 +553,8 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize( if (!item.GetBitmap().IsOk() && !(m_flags & wxAUI_TB_TEXT)) return wxSize(16,16); - int width = item.GetBitmap().GetScaledWidth(); - int height = item.GetBitmap().GetScaledHeight(); + int width = item.GetBitmap().GetWidth(); + int height = item.GetBitmap().GetHeight(); if (m_flags & wxAUI_TB_TEXT) { @@ -595,7 +594,7 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize( return wxSize(width, height); } -void wxAuiDefaultToolBarArt::DrawSeparator( +void wxAuiGenericToolBarArt::DrawSeparator( wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& _rect) @@ -628,7 +627,7 @@ void wxAuiDefaultToolBarArt::DrawSeparator( dc.GradientFillLinear(rect, startColour, endColour, horizontal ? wxSOUTH : wxEAST); } -void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc, +void wxAuiGenericToolBarArt::DrawGripper(wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& rect) { @@ -667,7 +666,7 @@ void wxAuiDefaultToolBarArt::DrawGripper(wxDC& dc, } -void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc, +void wxAuiGenericToolBarArt::DrawOverflowButton(wxDC& dc, wxWindow* /*wnd*/, const wxRect& rect, int state) @@ -695,12 +694,12 @@ void wxAuiDefaultToolBarArt::DrawOverflowButton(wxDC& dc, } } - int x = rect.x+1+(rect.width-m_overflowBmp.GetScaledWidth())/2; - int y = rect.y+1+(rect.height-m_overflowBmp.GetScaledHeight())/2; + 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) +int wxAuiGenericToolBarArt::GetElementSize(int element_id) { switch (element_id) { @@ -711,7 +710,7 @@ int wxAuiDefaultToolBarArt::GetElementSize(int element_id) } } -void wxAuiDefaultToolBarArt::SetElementSize(int element_id, int size) +void wxAuiGenericToolBarArt::SetElementSize(int element_id, int size) { switch (element_id) { @@ -721,7 +720,7 @@ void wxAuiDefaultToolBarArt::SetElementSize(int element_id, int size) } } -int wxAuiDefaultToolBarArt::ShowDropDown(wxWindow* wnd, +int wxAuiGenericToolBarArt::ShowDropDown(wxWindow* wnd, const wxAuiToolBarItemArray& items) { wxMenu menuPopup; @@ -775,7 +774,7 @@ int wxAuiDefaultToolBarArt::ShowDropDown(wxWindow* wnd, -static wxOrientation GetOrientation(long& style) +static wxOrientation GetOrientation(long style) { switch (style & wxAUI_ORIENTATION_MASK) { @@ -785,13 +784,13 @@ static wxOrientation GetOrientation(long& style) return wxVERTICAL; default: wxFAIL_MSG("toolbar cannot be locked in both horizontal and vertical orientations (maybe no lock was intended?)"); - // fall through + wxFALLTHROUGH; case 0: return wxBOTH; } } -BEGIN_EVENT_TABLE(wxAuiToolBar, wxControl) +wxBEGIN_EVENT_TABLE(wxAuiToolBar, wxControl) EVT_SIZE(wxAuiToolBar::OnSize) EVT_IDLE(wxAuiToolBar::OnIdle) EVT_ERASE_BACKGROUND(wxAuiToolBar::OnEraseBackground) @@ -809,7 +808,7 @@ BEGIN_EVENT_TABLE(wxAuiToolBar, wxControl) EVT_LEAVE_WINDOW(wxAuiToolBar::OnLeaveWindow) EVT_MOUSE_CAPTURE_LOST(wxAuiToolBar::OnCaptureLost) EVT_SET_CURSOR(wxAuiToolBar::OnSetCursor) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxAuiToolBar::Init() { @@ -1773,7 +1772,7 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const if (m_orientation == wxVERTICAL) { // take the dropdown size into account - if (m_overflowVisible) + if (m_overflowVisible && m_overflowSizerItem) cli_h -= m_overflowSizerItem->GetSize().y; if (rect.y+rect.height < cli_h) @@ -1782,7 +1781,7 @@ bool wxAuiToolBar::GetToolFitsByIndex(int tool_idx) const else { // take the dropdown size into account - if (m_overflowVisible) + if (m_overflowVisible && m_overflowSizerItem) cli_w -= m_overflowSizerItem->GetSize().x; if (rect.x+rect.width < cli_w) @@ -1861,6 +1860,11 @@ bool wxAuiToolBar::Realize() bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) { + // Remove old sizer before adding any controls in this tool bar, which are + // elements of this sizer, to the new sizer below. + delete m_sizer; + m_sizer = NULL; + // create the new sizer to add toolbar elements to wxBoxSizer* sizer = new wxBoxSizer(horizontal ? wxHORIZONTAL : wxVERTICAL); @@ -2052,7 +2056,6 @@ bool wxAuiToolBar::RealizeHelper(wxClientDC& dc, bool horizontal) outside_sizer->Add(m_bottomPadding, 1); } - delete m_sizer; // remove old sizer m_sizer = outside_sizer; // calculate the rock-bottom minimum size @@ -2463,7 +2466,7 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) } // paint the overflow button - if (dropdown_size > 0 && m_overflowSizerItem) + if (dropdown_size > 0 && m_overflowSizerItem && m_overflowVisible) { wxRect dropDownRect = GetOverflowRect(); m_art->DrawOverflowButton(dc, this, dropDownRect, m_overflowState); @@ -2498,13 +2501,11 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt) } } - if (m_overflowSizerItem) + if (m_overflowSizerItem && m_overflowVisible && m_art) { wxRect overflow_rect = GetOverflowRect(); - if (m_art && - m_overflowVisible && - overflow_rect.Contains(evt.m_x, evt.m_y)) + if (overflow_rect.Contains(evt.m_x, evt.m_y)) { wxAuiToolBarEvent e(wxEVT_AUITOOLBAR_OVERFLOW_CLICK, -1); e.SetEventObject(this); @@ -2672,6 +2673,9 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt) void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxRect cli_rect(wxPoint(0,0), GetClientSize()); if (m_gripperSizerItem) @@ -2708,6 +2712,9 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt) void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxAuiToolBarItem* hitItem; hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); @@ -2738,6 +2745,9 @@ void wxAuiToolBar::OnRightUp(wxMouseEvent& evt) void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxRect cli_rect(wxPoint(0,0), GetClientSize()); if (m_gripperSizerItem) @@ -2777,6 +2787,9 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt) void wxAuiToolBar::OnMiddleUp(wxMouseEvent& evt) { + if (HasCapture()) + return; + wxAuiToolBarItem* hitItem; hitItem = FindToolByPosition(evt.GetX(), evt.GetY()); diff --git a/Externals/wxWidgets3/src/aui/auibook.cpp b/Externals/wxWidgets3/src/aui/auibook.cpp index 2d1787ee0a..ff9064fc55 100644 --- a/Externals/wxWidgets3/src/aui/auibook.cpp +++ b/Externals/wxWidgets3/src/aui/auibook.cpp @@ -55,9 +55,9 @@ wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent); wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent); -IMPLEMENT_CLASS(wxAuiNotebook, wxControl) -IMPLEMENT_CLASS(wxAuiTabCtrl, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxBookCtrlEvent) +wxIMPLEMENT_CLASS(wxAuiNotebook, wxControl); +wxIMPLEMENT_CLASS(wxAuiTabCtrl, wxControl); +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxBookCtrlEvent); // -- wxAuiTabContainer class implementation -- @@ -186,6 +186,7 @@ bool wxAuiTabContainer::AddPage(wxWindow* page, wxAuiNotebookPage page_info; page_info = info; page_info.window = page; + page_info.hover = false; m_pages.Add(page_info); @@ -205,6 +206,7 @@ bool wxAuiTabContainer::InsertPage(wxWindow* page, wxAuiNotebookPage page_info; page_info = info; page_info.window = page; + page_info.hover = false; if (idx >= m_pages.GetCount()) m_pages.Add(page_info); @@ -410,6 +412,8 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) { if (!raw_dc || !raw_dc->IsOk()) return; + if (m_rect.IsEmpty()) + return; wxMemoryDC dc; @@ -429,6 +433,10 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (!dc.IsOk()) return; + // ensure we show as many tabs as possible + while (m_tabOffset > 0 && IsTabVisible(page_count-1, m_tabOffset-1, &dc, wnd)) + --m_tabOffset; + // find out if size of tabs is larger than can be // afforded on screen int total_width = 0; @@ -970,7 +978,7 @@ void wxAuiTabContainer::DoShowHide() -BEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) +wxBEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) EVT_PAINT(wxAuiTabCtrl::OnPaint) EVT_ERASE_BACKGROUND(wxAuiTabCtrl::OnEraseBackground) EVT_SIZE(wxAuiTabCtrl::OnSize) @@ -988,7 +996,7 @@ BEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) EVT_KILL_FOCUS(wxAuiTabCtrl::OnKillFocus) EVT_CHAR(wxAuiTabCtrl::OnChar) EVT_MOUSE_CAPTURE_LOST(wxAuiTabCtrl::OnCaptureLost) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxAuiTabCtrl::wxAuiTabCtrl(wxWindow* parent, @@ -1233,20 +1241,28 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) } } -#if wxUSE_TOOLTIPS wxWindow* wnd = NULL; if (evt.Moving() && TabHitTest(evt.m_x, evt.m_y, &wnd)) { + SetHoverTab(wnd); + +#if wxUSE_TOOLTIPS wxString tooltip(m_pages[GetIdxFromWindow(wnd)].tooltip); // If the text changes, set it else, keep old, to avoid // 'moving tooltip' effect if (GetToolTipText() != tooltip) SetToolTip(tooltip); +#endif // wxUSE_TOOLTIPS } else + { + SetHoverTab(NULL); + +#if wxUSE_TOOLTIPS UnsetToolTip(); #endif // wxUSE_TOOLTIPS + } if (!evt.LeftIsDown() || m_clickPt == wxDefaultPosition) return; @@ -1287,6 +1303,8 @@ void wxAuiTabCtrl::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) Refresh(); Update(); } + + SetHoverTab(NULL); } void wxAuiTabCtrl::OnButton(wxAuiNotebookEvent& event) @@ -1377,6 +1395,13 @@ void wxAuiTabCtrl::OnChar(wxKeyEvent& event) bool bWindowChange = (key == WXK_PAGEUP) || (key == WXK_PAGEDOWN) || bCtrlDown; bool bFromTab = (key == WXK_TAB); + if (bFromTab && !bWindowChange) + { + // Handle ordinary tabs via Navigate. This is needed at least for wxGTK to tab properly. + Navigate(bForward ? wxNavigationKeyEvent::IsForward : wxNavigationKeyEvent::IsBackward); + return; + } + wxAuiNotebook* nb = wxDynamicCast(GetParent(), wxAuiNotebook); if (!nb) { @@ -1495,20 +1520,20 @@ public: protected: void DoSetSize(int x, int y, int width, int height, - int WXUNUSED(sizeFlags = wxSIZE_AUTO)) + int WXUNUSED(sizeFlags = wxSIZE_AUTO)) wxOVERRIDE { m_rect = wxRect(x, y, width, height); DoSizing(); } - void DoGetClientSize(int* x, int* y) const + void DoGetClientSize(int* x, int* y) const wxOVERRIDE { *x = m_rect.width; *y = m_rect.height; } public: - bool Show( bool WXUNUSED(show = true) ) { return false; } + bool Show( bool WXUNUSED(show = true) ) wxOVERRIDE { return false; } void DoSizing() { @@ -1552,19 +1577,22 @@ public: // results in assert failures/GTK+ warnings height = 0; } + int width = m_rect.width - 2 * border_space; + if (width < 0) + width = 0; if (m_tabs->GetFlags() & wxAUI_NB_BOTTOM) { page.window->SetSize(m_rect.x + border_space, m_rect.y + border_space, - m_rect.width - 2 * border_space, + width, height); } else //TODO: if (GetFlags() & wxAUI_NB_TOP) { page.window->SetSize(m_rect.x + border_space, m_rect.y + m_tabCtrlHeight, - m_rect.width - 2 * border_space, + width, height); } // TODO: else if (GetFlags() & wxAUI_NB_LEFT){} @@ -1581,7 +1609,7 @@ public: } protected: - void DoGetSize(int* x, int* y) const + void DoGetSize(int* x, int* y) const wxOVERRIDE { if (x) *x = m_rect.GetWidth(); @@ -1590,7 +1618,7 @@ protected: } public: - void Update() + void Update() wxOVERRIDE { // does nothing } @@ -1610,7 +1638,7 @@ const int wxAuiBaseTabCtrlId = 5380; #define EVT_AUI_RANGE(id1, id2, event, func) \ wx__DECLARE_EVT2(event, id1, id2, wxAuiNotebookEventHandler(func)) -BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) +wxBEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) EVT_SIZE(wxAuiNotebook::OnSize) EVT_CHILD_FOCUS(wxAuiNotebook::OnChildFocusNotebook) EVT_AUI_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, @@ -1647,7 +1675,7 @@ BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) wxEVT_AUINOTEBOOK_BG_DCLICK, wxAuiNotebook::OnTabBgDClick) EVT_NAVIGATION_KEY(wxAuiNotebook::OnNavigationKeyNotebook) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxAuiNotebook::Init() { @@ -1686,7 +1714,7 @@ void wxAuiNotebook::InitNotebook(long style) m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); SetArtProvider(new wxAuiDefaultTabArt); @@ -3236,7 +3264,7 @@ bool wxAuiNotebook::SetFont(const wxFont& font) wxFont normalFont(font); wxFont selectedFont(normalFont); - selectedFont.SetWeight(wxBOLD); + selectedFont.SetWeight(wxFONTWEIGHT_BOLD); SetNormalFont(normalFont); SetSelectedFont(selectedFont); @@ -3440,5 +3468,26 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events) return m_curPage; } +void wxAuiTabCtrl::SetHoverTab(wxWindow* wnd) +{ + bool hoverChanged = false; + + const size_t page_count = m_pages.GetCount(); + for ( size_t i = 0; i < page_count; ++i ) + { + wxAuiNotebookPage& page = m_pages.Item(i); + bool oldHover = page.hover; + page.hover = (page.window == wnd); + if ( oldHover != page.hover ) + hoverChanged = true; + } + + if ( hoverChanged ) + { + Refresh(); + Update(); + } +} + #endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/src/aui/barartmsw.cpp b/Externals/wxWidgets3/src/aui/barartmsw.cpp new file mode 100644 index 0000000000..68700ca832 --- /dev/null +++ b/Externals/wxWidgets3/src/aui/barartmsw.cpp @@ -0,0 +1,506 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/aui/barartmsw.cpp +// Purpose: Implementation of wxAuiMSWToolBarArt +// Author: Tobias Taschner +// Created: 2015-09-22 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/bitmap.h" + #include "wx/dcclient.h" + #include "wx/app.h" + #include "wx/dc.h" +#endif + +#include "wx/aui/auibar.h" +#include "wx/aui/framemanager.h" +#include "wx/msw/uxtheme.h" +#include "wx/msw/private.h" + +#if wxUSE_AUI + +#define RP_GRIPPER 1 +#define RP_GRIPPERVERT 2 +#define RP_BAND 3 +#define RP_CHEVRON 4 +#define RP_CHEVRONVERT 5 +#define RP_BACKGROUND 6 +#define RP_SPLITTER 7 +#define RP_SPLITTERVERT 8 + +#define CHEVS_NORMAL 1 +#define CHEVS_HOT 2 +#define CHEVS_PRESSED 3 + +#define TP_BUTTON 1 +#define TP_DROPDOWNBUTTON 2 +#define TP_SPLITBUTTON 3 +#define TP_SPLITBUTTONDROPDOWN 4 +#define TP_SEPARATOR 5 +#define TP_SEPARATORVERT 6 +#define TP_DROPDOWNBUTTONGLYPH 7 + +#define TS_NORMAL 1 +#define TS_HOT 2 +#define TS_PRESSED 3 +#define TS_DISABLED 4 +#define TS_CHECKED 5 +#define TS_HOTCHECKED 6 +#define TS_NEARHOT 7 +#define TS_OTHERSIDEHOT 8 + + +wxAuiMSWToolBarArt::wxAuiMSWToolBarArt() +{ + wxUxThemeEngine* te = wxUxThemeEngine::GetIfActive(); + if ( te && te->IsAppThemed() ) + { + m_themed = true; + + // Determine sizes from theme + wxWindow* window = static_cast(wxApp::GetInstance())->GetTopWindow(); + wxUxThemeHandle hTheme(window, L"Rebar"); + + SIZE overflowSize; + te->GetThemePartSize(hTheme, NULL, RP_CHEVRON, 0, + NULL, TS_TRUE, &overflowSize); + m_overflowSize = overflowSize.cx; + + SIZE gripperSize; + te->GetThemePartSize(hTheme, NULL, RP_GRIPPER, 0, + NULL, TS_TRUE, &gripperSize); + m_gripperSize = gripperSize.cx; + + wxUxThemeHandle hThemeToolbar(window, L"Toolbar"); + + SIZE seperatorSize; + te->GetThemePartSize(hThemeToolbar, NULL, TP_SEPARATOR, 0, + NULL, TS_TRUE, &seperatorSize); + m_separatorSize = seperatorSize.cx; + + SIZE buttonSize; + te->GetThemePartSize(hThemeToolbar, NULL, TP_BUTTON, 0, + NULL, TS_TRUE, &buttonSize); + m_buttonSize.Set(buttonSize.cx, buttonSize.cy); + } + else + m_themed = false; +} + +wxAuiToolBarArt* wxAuiMSWToolBarArt::Clone() +{ + return new wxAuiMSWToolBarArt; +} + +void wxAuiMSWToolBarArt::DrawBackground( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) +{ + if ( m_themed ) + { + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeHandle hTheme(wnd, L"Rebar"); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + RP_BACKGROUND, + 0, + &r, + NULL); + } + else + wxAuiGenericToolBarArt::DrawBackground(dc, wnd, rect); +} + +void wxAuiMSWToolBarArt::DrawLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) +{ + wxAuiGenericToolBarArt::DrawLabel(dc, wnd, item, rect); +} + +static const unsigned char +DISABLED_TEXT_GREY_HUE = wxColour::AlphaBlend(0, 255, 0.4); +const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE, + DISABLED_TEXT_GREY_HUE, + DISABLED_TEXT_GREY_HUE); + +void wxAuiMSWToolBarArt::DrawButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) +{ + if ( m_themed ) + { + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeHandle hTheme(wnd, L"Toolbar"); + + wxUxThemeEngine* te = wxUxThemeEngine::Get(); + + int btnState; + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + btnState = TS_DISABLED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_PRESSED ) + btnState = TS_PRESSED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_HOVER && + item.GetState() & wxAUI_BUTTON_STATE_CHECKED ) + btnState = TS_HOTCHECKED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_CHECKED ) + btnState = TS_CHECKED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_HOVER ) + btnState = TS_HOT; + else + btnState = TS_NORMAL; + + te->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TP_BUTTON, + btnState, + &r, + NULL); + + int textWidth = 0, textHeight = 0; + + if ( m_flags & wxAUI_TB_TEXT ) + { + dc.SetFont(m_font); + + int tx, ty; + + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); + textWidth = 0; + dc.GetTextExtent(item.GetLabel(), &textWidth, &ty); + } + + int bmpX = 0, bmpY = 0; + int textX = 0, textY = 0; + + if ( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM ) + { + bmpX = rect.x + + (rect.width / 2) - + (item.GetBitmap().GetWidth() / 2); + + bmpY = rect.y + + ((rect.height - textHeight) / 2) - + (item.GetBitmap().GetHeight() / 2); + + textX = rect.x + (rect.width / 2) - (textWidth / 2) + 1; + textY = rect.y + rect.height - textHeight - 1; + } + else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT ) + { + bmpX = rect.x + 3; + + bmpY = rect.y + + (rect.height / 2) - + (item.GetBitmap().GetHeight() / 2); + + textX = bmpX + 3 + item.GetBitmap().GetWidth(); + textY = rect.y + + (rect.height / 2) - + (textHeight / 2); + } + + wxBitmap bmp; + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + bmp = item.GetDisabledBitmap(); + else + bmp = item.GetBitmap(); + + if ( bmp.IsOk() ) + dc.DrawBitmap(bmp, bmpX, bmpY, true); + + // set the item's text color based on if it is disabled + dc.SetTextForeground(*wxBLACK); + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + dc.SetTextForeground(DISABLED_TEXT_COLOR); + + if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) + { + dc.DrawText(item.GetLabel(), textX, textY); + } + } + else + wxAuiGenericToolBarArt::DrawButton(dc, wnd, item, rect); +} + +void wxAuiMSWToolBarArt::DrawDropDownButton( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) +{ + if ( m_themed ) + { + wxUxThemeHandle hTheme(wnd, L"Toolbar"); + wxUxThemeEngine* const te = wxUxThemeEngine::Get(); + + int dropDownWidth = 14; + + int textWidth = 0, textHeight = 0, textX = 0, textY = 0; + int bmpX = 0, bmpY = 0; + + wxRect buttonRect = wxRect(rect.x, + rect.y, + rect.width - dropDownWidth, + rect.height); + wxRect dropDownRect = wxRect(rect.x + rect.width - dropDownWidth - 1, + rect.y, + dropDownWidth + 1, + rect.height); + + if ( m_flags & wxAUI_TB_TEXT ) + { + dc.SetFont(m_font); + + int tx, ty; + if ( m_flags & wxAUI_TB_TEXT ) + { + dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight); + textWidth = 0; + } + + dc.GetTextExtent(item.GetLabel(), &textWidth, &ty); + } + + RECT btnR; + wxCopyRectToRECT(buttonRect, btnR); + RECT dropDownR; + wxCopyRectToRECT(dropDownRect, dropDownR); + + int btnState; + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + btnState = TS_DISABLED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_PRESSED ) + btnState = TS_PRESSED; + else if ( item.GetState() & wxAUI_BUTTON_STATE_HOVER ) + btnState = TS_HOT; + else + btnState = TS_NORMAL; + + te->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TP_SPLITBUTTON, + btnState, + &btnR, + NULL); + + te->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TP_SPLITBUTTONDROPDOWN, + btnState, + &dropDownR, + NULL); + + if ( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM ) + { + bmpX = buttonRect.x + + (buttonRect.width / 2) - + (item.GetBitmap().GetWidth() / 2); + bmpY = buttonRect.y + + ((buttonRect.height - textHeight) / 2) - + (item.GetBitmap().GetHeight() / 2); + + textX = rect.x + (rect.width / 2) - (textWidth / 2) + 1; + textY = rect.y + rect.height - textHeight - 1; + } + else if ( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT ) + { + bmpX = rect.x + 3; + + bmpY = rect.y + + (rect.height / 2) - + (item.GetBitmap().GetHeight() / 2); + + textX = bmpX + 3 + item.GetBitmap().GetWidth(); + textY = rect.y + + (rect.height / 2) - + (textHeight / 2); + } + + wxBitmap bmp; + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + { + bmp = item.GetDisabledBitmap(); + } + else + { + bmp = item.GetBitmap(); + } + + if ( !bmp.IsOk() ) + return; + + dc.DrawBitmap(bmp, bmpX, bmpY, true); + + // set the item's text color based on if it is disabled + dc.SetTextForeground(*wxBLACK); + if ( item.GetState() & wxAUI_BUTTON_STATE_DISABLED ) + dc.SetTextForeground(DISABLED_TEXT_COLOR); + + if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) + { + dc.DrawText(item.GetLabel(), textX, textY); + } + + } + else + wxAuiGenericToolBarArt::DrawDropDownButton(dc, wnd, item, rect); +} + +void wxAuiMSWToolBarArt::DrawControlLabel( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item, + const wxRect& rect) +{ + wxAuiGenericToolBarArt::DrawControlLabel(dc, wnd, item, rect); +} + +void wxAuiMSWToolBarArt::DrawSeparator( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) +{ + if ( m_themed ) + { + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeHandle hTheme(wnd, L"Toolbar"); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + (m_flags & wxAUI_TB_VERTICAL) ? TP_SEPARATORVERT : TP_SEPARATOR, + 0, + &r, + NULL); + } + else + wxAuiGenericToolBarArt::DrawSeparator(dc, wnd, rect); +} + +void wxAuiMSWToolBarArt::DrawGripper( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect) +{ + if ( m_themed ) + { + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeHandle hTheme(wnd, L"Rebar"); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + (m_flags & wxAUI_TB_VERTICAL) ? RP_GRIPPERVERT : RP_GRIPPER, + 0, + &r, + NULL); + } + else + wxAuiGenericToolBarArt::DrawGripper(dc, wnd, rect); +} + +void wxAuiMSWToolBarArt::DrawOverflowButton( + wxDC& dc, + wxWindow* wnd, + const wxRect& rect, + int state) +{ + if ( m_themed ) + { + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeHandle hTheme(wnd, L"Rebar"); + + int chevState; + if ( state & wxAUI_BUTTON_STATE_PRESSED ) + chevState = CHEVS_PRESSED; + else if ( state & wxAUI_BUTTON_STATE_HOVER ) + chevState = CHEVS_HOT; + else + chevState = CHEVS_NORMAL; + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + (m_flags & wxAUI_TB_VERTICAL) ? RP_CHEVRONVERT : RP_CHEVRON, + chevState, + &r, + NULL); + } + else + wxAuiGenericToolBarArt::DrawOverflowButton(dc, wnd, rect, state); +} + +wxSize wxAuiMSWToolBarArt::GetLabelSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) +{ + return wxAuiGenericToolBarArt::GetLabelSize(dc, wnd, item); +} + +wxSize wxAuiMSWToolBarArt::GetToolSize( + wxDC& dc, + wxWindow* wnd, + const wxAuiToolBarItem& item) +{ + if ( m_themed ) + { + if ( !item.GetBitmap().IsOk() && !(m_flags & wxAUI_TB_TEXT) ) + return m_buttonSize; + + wxSize size = wxAuiGenericToolBarArt::GetToolSize(dc, wnd, item); + + size.IncBy(3); // Add some padding for native theme + + return size; + } + else + return wxAuiGenericToolBarArt::GetToolSize(dc, wnd, item); +} + +int wxAuiMSWToolBarArt::GetElementSize(int element) +{ + return wxAuiGenericToolBarArt::GetElementSize(element); +} + +void wxAuiMSWToolBarArt::SetElementSize(int elementId, int size) +{ + wxAuiGenericToolBarArt::SetElementSize(elementId, size); +} + +int wxAuiMSWToolBarArt::ShowDropDown(wxWindow* wnd, + const wxAuiToolBarItemArray& items) +{ + return wxAuiGenericToolBarArt::ShowDropDown(wnd, items); +} + +#endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/src/aui/dockart.cpp b/Externals/wxWidgets3/src/aui/dockart.cpp index df5c65febe..b9a50a8c14 100644 --- a/Externals/wxWidgets3/src/aui/dockart.cpp +++ b/Externals/wxWidgets3/src/aui/dockart.cpp @@ -51,6 +51,7 @@ #endif #ifdef __WXGTK3__ #include "wx/graphics.h" + #include "wx/gtk/private.h" #endif #endif @@ -171,32 +172,27 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt() } 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_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_activeCaptionColour = wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION); + m_activeCaptionGradientColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRADIENTACTIVECAPTION); + m_activeCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT); + m_inactiveCaptionColour = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTION); + m_inactiveCaptionGradientColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRADIENTINACTIVECAPTION); + m_inactiveCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT); m_sashBrush = wxBrush(baseColour); m_backgroundBrush = wxBrush(baseColour); m_gripperBrush = wxBrush(baseColour); - m_borderPen = wxPen(darker2Colour); - m_gripperPen1 = wxPen(darker5Colour); - m_gripperPen2 = wxPen(darker3Colour); + m_borderPen = wxPen(baseColour.ChangeLightness(75)); + m_gripperPen1 = wxPen(baseColour.ChangeLightness(40)); + m_gripperPen2 = wxPen(baseColour.ChangeLightness(60)); m_gripperPen3 = *wxWHITE_PEN; #ifdef __WXMAC__ m_captionFont = *wxSMALL_FONT; #else - m_captionFont = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE); + m_captionFont = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); #endif // default metric values @@ -421,20 +417,27 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, if (!window->m_wxwindow) return; if (!gtk_widget_is_drawable(window->m_wxwindow)) return; +#ifdef __WXGTK3__ + cairo_t* cr = static_cast(dc.GetGraphicsContext()->GetNativeContext()); + // invert orientation for widget (horizontal GtkPaned has a vertical splitter) + wxOrientation orient = orientation == wxVERTICAL ? wxHORIZONTAL : wxVERTICAL; + GtkWidget* widget = wxGTKPrivate::GetSplitterWidget(orient); + GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_save(sc); + + gtk_style_context_add_class(sc, GTK_STYLE_CLASS_PANE_SEPARATOR); + gtk_render_handle(sc, cr, rect.x, rect.y, rect.width, rect.height); + + gtk_style_context_restore(sc); +#else gtk_paint_handle ( gtk_widget_get_style(window->m_wxwindow), -#ifdef __WXGTK3__ - static_cast(dc.GetGraphicsContext()->GetNativeContext()), -#else window->GTKGetDrawingWindow(), -#endif // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, GTK_STATE_NORMAL, GTK_SHADOW_NONE, -#ifndef __WXGTK3__ NULL /* no clipping */, -#endif window->m_wxwindow, "paned", rect.x, @@ -443,6 +446,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, rect.height, (orientation == wxVERTICAL) ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL ); +#endif // !__WXGTK3__ #else wxUnusedVar(window); @@ -674,8 +678,6 @@ void wxAuiDefaultDockArt::DrawPaneButton(wxDC& dc, wxWindow *WXUNUSED(window), wxAuiPaneInfo& pane) { wxBitmap bmp; - if (!(&pane)) - return; switch (button) { default: diff --git a/Externals/wxWidgets3/src/aui/floatpane.cpp b/Externals/wxWidgets3/src/aui/floatpane.cpp index 837c0a0aa5..adebf5f7c7 100644 --- a/Externals/wxWidgets3/src/aui/floatpane.cpp +++ b/Externals/wxWidgets3/src/aui/floatpane.cpp @@ -35,7 +35,7 @@ #include "wx/msw/private.h" #endif -IMPLEMENT_CLASS(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass) +wxIMPLEMENT_CLASS(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass); wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent, wxAuiManager* owner_mgr, @@ -165,6 +165,22 @@ wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const return m_ownerMgr; } +bool wxAuiFloatingFrame::IsTopNavigationDomain(NavigationKind kind) const +{ + switch ( kind ) + { + case Navigation_Tab: + break; + + case Navigation_Accel: + // Floating frames are often used as tool palettes and it's + // convenient for the accelerators defined in the parent frame to + // work in them, so don't block their propagation. + return false; + } + + return wxAuiFloatingFrameBaseClass::IsTopNavigationDomain(kind); +} void wxAuiFloatingFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { @@ -352,14 +368,14 @@ bool wxAuiFloatingFrame::isMouseDown() } -BEGIN_EVENT_TABLE(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass) +wxBEGIN_EVENT_TABLE(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass) EVT_SIZE(wxAuiFloatingFrame::OnSize) EVT_MOVE(wxAuiFloatingFrame::OnMoveEvent) EVT_MOVING(wxAuiFloatingFrame::OnMoveEvent) EVT_CLOSE(wxAuiFloatingFrame::OnClose) EVT_IDLE(wxAuiFloatingFrame::OnIdle) EVT_ACTIVATE(wxAuiFloatingFrame::OnActivate) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/src/aui/framemanager.cpp b/Externals/wxWidgets3/src/aui/framemanager.cpp index 20e654791a..5e24cd48cf 100644 --- a/Externals/wxWidgets3/src/aui/framemanager.cpp +++ b/Externals/wxWidgets3/src/aui/framemanager.cpp @@ -75,8 +75,8 @@ wxDEFINE_EVENT( wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent ); #include "wx/msw/dc.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent) -IMPLEMENT_CLASS(wxAuiManager, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent); +wxIMPLEMENT_CLASS(wxAuiManager, wxEvtHandler); @@ -112,7 +112,7 @@ public: SetTransparent(0); } - virtual bool SetTransparent(wxByte alpha) + virtual bool SetTransparent(wxByte alpha) wxOVERRIDE { if (m_canSetShape) { @@ -203,20 +203,20 @@ private: wxRegion m_region; - DECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame); + wxDECLARE_EVENT_TABLE(); }; -IMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame); -BEGIN_EVENT_TABLE(wxPseudoTransparentFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxPseudoTransparentFrame, wxFrame) EVT_PAINT(wxPseudoTransparentFrame::OnPaint) EVT_SIZE(wxPseudoTransparentFrame::OnSize) #ifdef __WXGTK__ EVT_WINDOW_CREATE(wxPseudoTransparentFrame::OnWindowCreate) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #else @@ -266,14 +266,23 @@ public: g_signal_connect( m_widget, "realize", G_CALLBACK (gtk_pseudo_window_realized_callback), this ); + // gtk_widget_modify_bg() is deprecated in 3.0 but doesn't seem to have + // any obvious replacement as gtk_widget_override_background_color() + // mentioned in the deprecation message it is itself deprecated in + // 3.16, so just continue using it for now. In longer term the best + // would probably be to catch "draw" signal and paint the background + // ourselves. GdkColor col; col.red = 128 * 256; col.green = 192 * 256; col.blue = 255 * 256; + + wxGCC_WARNING_SUPPRESS(deprecated-declarations) gtk_widget_modify_bg( m_widget, GTK_STATE_NORMAL, &col ); + wxGCC_WARNING_RESTORE(deprecated-declarations) } - bool SetTransparent(wxByte WXUNUSED(alpha)) + bool SetTransparent(wxByte WXUNUSED(alpha)) wxOVERRIDE { return true; } @@ -281,7 +290,7 @@ public: protected: virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, - int incW, int incH) + int incW, int incH) wxOVERRIDE { // the real wxFrame method doesn't work for us because we're not really // a top level window so skip it @@ -289,10 +298,10 @@ protected: } private: - DECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame) + wxDECLARE_DYNAMIC_CLASS(wxPseudoTransparentFrame); }; -IMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxPseudoTransparentFrame, wxFrame); #endif // __WXGTK20__ @@ -595,7 +604,7 @@ bool wxAuiPaneInfo::IsValid() const // -- wxAuiManager class implementation -- -BEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler) EVT_AUI_PANE_BUTTON(wxAuiManager::OnPaneButton) EVT_AUI_RENDER(wxAuiManager::OnRender) EVT_PAINT(wxAuiManager::OnPaint) @@ -609,7 +618,7 @@ BEGIN_EVENT_TABLE(wxAuiManager, wxEvtHandler) EVT_MOUSE_CAPTURE_LOST(wxAuiManager::OnCaptureLost) EVT_CHILD_FOCUS(wxAuiManager::OnChildFocus) EVT_AUI_FIND_MANAGER(wxAuiManager::OnFindManager) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) @@ -899,7 +908,7 @@ void wxAuiManager::UpdateHintWindowConfig() // SetManagedWindow() is usually called once when the frame // manager class is being initialized. "frame" specifies -// the frame which should be managed by the frame mananger +// the frame which should be managed by the frame manager void wxAuiManager::SetManagedWindow(wxWindow* wnd) { wxASSERT_MSG(wnd, wxT("specified window must be non-NULL")); @@ -1061,11 +1070,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) pinfo.name.Printf(wxT("%08lx%08x%08x%08lx"), (unsigned long)(wxPtrToUInt(pinfo.window) & 0xffffffff), (unsigned int)time(NULL), -#ifdef __WXWINCE__ - (unsigned int)GetTickCount(), -#else (unsigned int)clock(), -#endif (unsigned long)m_panes.GetCount()); } @@ -1458,7 +1463,7 @@ wxString wxAuiManager::SavePaneInfo(wxAuiPaneInfo& pane) return result; } -// Load a "pane" with the pane infor settings in pane_part +// Load a "pane" with the pane information settings in pane_part void wxAuiManager::LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane) { // replace escaped characters so we can @@ -1899,8 +1904,8 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, } - // add the verticle sizer (caption, pane window) to the - // horizontal sizer (gripper, verticle sizer) + // add the vertical sizer (caption, pane window) to the + // horizontal sizer (gripper, vertical sizer) horz_pane_sizer->Add(vert_pane_sizer, 1, wxEXPAND); // finally, add the pane sizer to the dock sizer @@ -2276,8 +2281,8 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, dock.min_size = dock_min_size; - // if the pane's current size is less than it's - // minimum, increase the dock's size to it's minimum + // if the pane's current size is less than its + // minimum, increase the dock's size to its minimum if (dock.size < dock.min_size) dock.size = dock.min_size; @@ -2587,7 +2592,7 @@ void wxAuiManager::Update() } else { - // frame already exists, make sure it's position + // frame already exists, make sure its position // and size reflect the information in wxAuiPaneInfo if ((p.frame->GetPosition() != p.floating_pos) || (p.frame->GetSize() != p.floating_size)) { @@ -2680,7 +2685,7 @@ void wxAuiManager::Update() /* // N.B. More work needs to be done on frame minimum sizes; - // this is some intresting code that imposes the minimum size, + // this is some interesting code that imposes the minimum size, // but we may want to include a more flexible mechanism or // options for multiple minimum-size modes, e.g. strict or lax wxSize min_size = sizer->GetMinSize(); @@ -2782,7 +2787,7 @@ wxAuiDockUIPart* wxAuiManager::GetPanePart(wxWindow* wnd) // a dock's offset in pixels from the left side of the window // (for horizontal docks) or from the top of the window (for // vertical docks). This value is necessary for calculating -// fixel-pane/toolbar offsets when they are dragged. +// pixel-pane/toolbar offsets when they are dragged. int wxAuiManager::GetDockPixelOffset(wxAuiPaneInfo& test) { @@ -3757,7 +3762,7 @@ void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir) DoDrop(m_docks, m_panes, pane, client_pt, action_offset); } - // if the pane is still floating, update it's floating + // if the pane is still floating, update its floating // position (that we store) if (pane.IsFloating()) { @@ -3854,7 +3859,12 @@ void wxAuiManager::OnRender(wxAuiManagerEvent& evt) 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())) + if (part.sizer_item && + ((!part.sizer_item->IsWindow() && + !part.sizer_item->IsSpacer() && + !part.sizer_item->IsSizer()) || + !part.sizer_item->IsShown() || + part.rect.IsEmpty())) continue; switch (part.type) @@ -4370,7 +4380,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) // check against the pane's minimum size, if specified. please note // that this is not enough to ensure that the minimum size will // not be violated, because the whole frame might later be shrunk, - // causing the size of the pane to violate it's minimum size + // causing the size of the pane to violate its minimum size if (pane.min_size.IsFullySpecified()) { min_size = 0; @@ -4392,7 +4402,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) } - // for some reason, an arithmatic error somewhere is causing + // for some reason, an arithmetic error somewhere is causing // the proportion calculations to always be off by 1 pixel; // for now we will add the 1 pixel on, but we really should // determine what's causing this. @@ -4669,7 +4679,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) pt.y - m_actionOffset.y); } - // this will do the actiual move operation; + // this will do the actual move operation; // in the case that the pane has been floated, // this call will create the floating pane // and do the reparenting @@ -4742,7 +4752,7 @@ void wxAuiManager::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) void wxAuiManager::OnChildFocus(wxChildFocusEvent& event) { - // when a child pane has it's focus set, we should change the + // when a child pane has its focus set, we should change the // pane's active state to reflect this. (this is only true if // active panes are allowed by the owner) if (GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) diff --git a/Externals/wxWidgets3/src/aui/tabart.cpp b/Externals/wxWidgets3/src/aui/tabart.cpp index f736f0b6e5..b064591143 100644 --- a/Externals/wxWidgets3/src/aui/tabart.cpp +++ b/Externals/wxWidgets3/src/aui/tabart.cpp @@ -47,7 +47,7 @@ public: wxAuiCommandCapture() { m_lastId = 0; } int GetCommandId() const { return m_lastId; } - bool ProcessEvent(wxEvent& evt) + bool ProcessEvent(wxEvent& evt) wxOVERRIDE { if (evt.GetEventType() == wxEVT_MENU) { @@ -74,6 +74,11 @@ wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h, wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size); +inline bool IsDarkColour(const wxColour& c) +{ + return (c.Red() + c.Green() + c.Blue()) * c.Alpha() * 2 < 3 * 255 * 255; +} + static void DrawButtons(wxDC& dc, const wxRect& _rect, const wxBitmap& bmp, @@ -156,7 +161,7 @@ wxAuiGenericTabArt::wxAuiGenericTabArt() { m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); m_measuringFont = m_selectedFont; m_fixedTabWidth = 100; @@ -379,7 +384,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3); // FIXME: these ports don't provide wxRegion ctor from array of points -#if !defined(__WXDFB__) && !defined(__WXCOCOA__) +#if !defined(__WXDFB__) // set the clipping region for the tab -- wxRegion clipping_region(WXSIZEOF(clip_points), clip_points); dc.SetClippingRegion(clipping_region); @@ -416,6 +421,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, int drawn_tab_height = border_points[0].y - border_points[1].y; + wxColour text_colour; if (page.active) { // draw active tab @@ -431,6 +437,8 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, dc.SetBrush(*wxWHITE_BRUSH); dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4); + text_colour = *wxBLACK; + // these two points help the rounded corners appear more antialiased dc.SetPen(wxPen(m_activeColour)); dc.DrawPoint(r.x+2, r.y+1); @@ -454,7 +462,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, wxRect r(tab_x, tab_y+1, tab_width, tab_height-3); - // start the gradent up a bit and leave the inside border inset + // start the gradient up a bit and leave the inside border inset // by a pixel for a 3D look. Only the top half of the inactive // tab will have a slight gradient r.x += 3; @@ -464,9 +472,11 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, r.height--; // -- draw top gradient fill for glossy look - wxColor top_color = m_baseColour; - wxColor bottom_color = top_color.ChangeLightness(160); - dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); + wxColor top_color = m_baseColour.ChangeLightness(160); + wxColor bottom_color = m_baseColour; + dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH); + + text_colour = IsDarkColour(bottom_color) ? *wxWHITE : *wxBLACK; r.y += r.height; r.y--; @@ -532,6 +542,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, tab_width - (text_offset-tab_x) - close_button_width); // draw tab text + dc.SetTextForeground(text_colour); dc.DrawText(draw_text, text_offset, drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1); @@ -851,7 +862,7 @@ wxAuiSimpleTabArt::wxAuiSimpleTabArt() { m_normalFont = *wxNORMAL_FONT; m_selectedFont = *wxNORMAL_FONT; - m_selectedFont.SetWeight(wxBOLD); + m_selectedFont.SetWeight(wxFONTWEIGHT_BOLD); m_measuringFont = m_selectedFont; m_flags = 0; @@ -863,6 +874,9 @@ wxAuiSimpleTabArt::wxAuiSimpleTabArt() wxColour normaltabColour = baseColour; wxColour selectedtabColour = *wxWHITE; + m_normalTextColour = IsDarkColour(baseColour) ? *wxWHITE : *wxBLACK; + m_selectedTextColour = *wxBLACK; + m_bkBrush = wxBrush(backgroundColour); m_normalBkBrush = wxBrush(normaltabColour); m_normalBkPen = wxPen(normaltabColour); @@ -1084,6 +1098,7 @@ void wxAuiSimpleTabArt::DrawTab(wxDC& dc, tab_width - (text_offset-tab_x) - close_button_width); // draw tab text + dc.SetTextForeground(page.active ? m_selectedTextColour : m_normalTextColour); dc.DrawText(draw_text, text_offset, (tab_y + tab_height)/2 - (texty/2) + 1); diff --git a/Externals/wxWidgets3/src/aui/tabartmsw.cpp b/Externals/wxWidgets3/src/aui/tabartmsw.cpp new file mode 100644 index 0000000000..17f894a163 --- /dev/null +++ b/Externals/wxWidgets3/src/aui/tabartmsw.cpp @@ -0,0 +1,501 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/tabartmsw.h +// Purpose: wxAuiMSWTabArt declaration +// Author: Tobias Taschner +// Created: 2015-09-26 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/dc.h" +#endif + +#include "wx/aui/tabart.h" +#include "wx/aui/auibook.h" +#include "wx/msw/uxtheme.h" +#include "wx/msw/private.h" +#include "wx/renderer.h" + +#if wxUSE_AUI + +#ifndef CP_DROPDOWNBUTTON + + #define TABP_TABITEM 1 + #define TABP_TABITEMLEFTEDGE 2 + #define TABP_TABITEMRIGHTEDGE 3 + #define TABP_TABITEMBOTHEDGE 4 + #define TABP_TOPTABITEM 5 + #define TABP_TOPTABITEMLEFTEDGE 6 + #define TABP_TOPTABITEMRIGHTEDGE 7 + #define TABP_TOPTABITEMBOTHEDGE 8 + #define TABP_PANE 9 + #define TABP_BODY 10 + #define TABP_AEROWIZARDBODY 11 + + #define TIS_NORMAL 1 + #define TIS_HOT 2 + #define TIS_SELECTED 3 + #define TIS_DISABLED 4 + #define TIS_FOCUSED 5 + + #define TTP_CLOSE 5 + + #define TTCS_NORMAL 1 + #define TTCS_HOT 2 + #define TTCS_PRESSED 3 + + #define SPNP_UPHORZ 3 + #define SPNP_DOWNHORZ 4 + + #define CP_DROPDOWNBUTTON1 1 + + #define WP_CLOSEBUTTON 18 +#endif + +wxAuiMSWTabArt::wxAuiMSWTabArt() +{ + m_closeBtnSize = wxDefaultSize; + m_maxTabHeight = 0; + + wxUxThemeEngine* te = wxUxThemeEngine::GetIfActive(); + if ( te && te->IsAppThemed() ) + { + m_themed = true; + } + else + m_themed = false; +} + +wxAuiMSWTabArt::~wxAuiMSWTabArt() +{ +} + +wxAuiTabArt* wxAuiMSWTabArt::Clone() +{ + return new wxAuiMSWTabArt(*this); +} + +void wxAuiMSWTabArt::SetSizingInfo(const wxSize& tab_ctrl_size, + size_t tab_count) +{ + wxAuiGenericTabArt::SetSizingInfo(tab_ctrl_size, tab_count); +} + + +void wxAuiMSWTabArt::DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect) +{ + if ( !IsThemed() ) + { + wxAuiGenericTabArt::DrawBorder(dc, wnd, rect); + return; + } + + wxRect drawRect(rect); + + drawRect.y += m_maxTabHeight + wnd->FromDIP(1); + drawRect.height -= m_maxTabHeight; + + // Mask border not covered by native theme + wxRect topDrawRect(rect); + topDrawRect.height = drawRect.height; + dc.SetPen(wxPen(wnd->GetBackgroundColour(), GetBorderWidth(wnd))); + dc.DrawRectangle(topDrawRect); + + RECT r; + wxCopyRectToRECT(drawRect, r); + + wxUxThemeHandle hTheme(wnd, L"TAB"); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TABP_PANE, + 0, + &r, + NULL); +} + +void wxAuiMSWTabArt::DrawBackground(wxDC& dc, + wxWindow* wnd, + const wxRect& rect) +{ + if ( !IsThemed() ) + { + wxAuiGenericTabArt::DrawBackground(dc, wnd, rect); + return; + } + + int borderHeight = 2; + + wxRect drawRect = rect; + drawRect.height -= borderHeight; + + // Draw background + dc.SetBrush(wxBrush(wnd->GetBackgroundColour())); + dc.SetPen(*wxTRANSPARENT_PEN); + dc.DrawRectangle(drawRect); + + // Draw top border + drawRect.y = drawRect.height; + drawRect.height = borderHeight + 2; + + drawRect.Inflate(1, 0); + + RECT r; + wxCopyRectToRECT(drawRect, r); + + wxUxThemeHandle hTheme(wnd, L"TAB"); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TABP_PANE, + 0, + &r, + NULL); +} + +void wxAuiMSWTabArt::DrawTab(wxDC& dc, + wxWindow* wnd, + const wxAuiNotebookPage& page, + const wxRect& in_rect, + int close_button_state, + wxRect* out_tab_rect, + wxRect* out_button_rect, + int* x_extent) +{ + if ( !IsThemed() ) + { + wxAuiGenericTabArt::DrawTab(dc, wnd, page, in_rect, close_button_state, out_tab_rect, out_button_rect, x_extent); + return; + } + + if ( !m_closeBtnSize.IsFullySpecified() ) + InitSizes(wnd, dc); + + // figure out the size of the tab + wxSize tabSize = GetTabSize(dc, + wnd, + page.caption, + page.bitmap, + page.active, + close_button_state, + x_extent); + + wxCoord tabHeight = tabSize.y; + wxCoord tabWidth = tabSize.x; + wxCoord tabX = in_rect.x; + wxCoord tabY = 0; + + if (!page.active) + { + tabY += wnd->FromDIP(2); + tabHeight -= wnd->FromDIP(2); + } + else + { + tabX -= wnd->FromDIP(2); + tabWidth += wnd->FromDIP(4); + tabHeight += 2; + } + + int clipWidth = tabWidth; + if ( tabX + clipWidth > in_rect.x + in_rect.width ) + clipWidth = (in_rect.x + in_rect.width) - tabX; + dc.SetClippingRegion(tabX - wnd->FromDIP(2), tabY, clipWidth + wnd->FromDIP(4), tabHeight); + + + // draw tab + wxRect tabRect(tabX, tabY, tabWidth, tabHeight); + + int tabState; + if ( page.active ) + tabState = TIS_SELECTED; + else if ( page.hover ) + tabState = TIS_HOT; + else + tabState = TIS_NORMAL; + + wxUxThemeEngine* te = wxUxThemeEngine::Get(); + + wxUxThemeHandle hTabTheme(wnd, L"Tab"); + RECT tabR; + wxCopyRectToRECT(tabRect, tabR); + te->DrawThemeBackground(hTabTheme, GetHdcOf(dc.GetTempHDC()), TABP_TABITEM, + tabState, + &tabR, NULL); + + wxRect textRect = tabRect; + if ( !page.active ) + textRect.Offset(0, wnd->FromDIP(1)); + if ( close_button_state != wxAUI_BUTTON_STATE_HIDDEN ) + textRect.width -= m_closeBtnSize.x + wnd->FromDIP(3); + + dc.SetFont(wnd->GetFont()); + dc.DrawLabel(page.caption, page.bitmap, textRect, wxALIGN_CENTRE); + + // draw focus rectangle + if ( page.active && (wnd->FindFocus() == wnd) ) + { + wxRect focusRect = tabRect; + focusRect.Deflate(wnd->FromDIP(2)); + + wxRendererNative::Get().DrawFocusRect(wnd, dc, focusRect, 0); + } + + // draw close button + if ( close_button_state != wxAUI_BUTTON_STATE_HIDDEN ) + { + wxUxThemeHandle hToolTipTheme(wnd, L"TOOLTIP"); + + int btnState; + if ( close_button_state == wxAUI_BUTTON_STATE_HOVER ) + btnState = TTCS_HOT; + else if ( close_button_state == wxAUI_BUTTON_STATE_PRESSED ) + btnState = TTCS_PRESSED; + else + btnState = TTCS_NORMAL; + + int offsetY = tabY; + if ( wxGetWinVersion() < wxWinVersion_Vista ) + offsetY++; // WinXP theme needs a little more padding + + wxRect rect(tabX + tabWidth - m_closeBtnSize.x - wnd->FromDIP(4), + offsetY + (tabHeight / 2) - (m_closeBtnSize.y / 2), + m_closeBtnSize.x, + m_closeBtnSize.y); + + RECT btnR; + wxCopyRectToRECT(rect, btnR); + te->DrawThemeBackground(hToolTipTheme, GetHdcOf(dc.GetTempHDC()), TTP_CLOSE, btnState, &btnR, NULL); + + if ( out_button_rect ) + *out_button_rect = rect; + } + + *out_tab_rect = wxRect(tabX, tabY, tabWidth, tabHeight); + + dc.DestroyClippingRegion(); +} + +int wxAuiMSWTabArt::GetIndentSize() +{ + if ( IsThemed() ) + return 3; // This should be 1 but we can't draw into the border from DrawTab + else + return wxAuiGenericTabArt::GetIndentSize(); +} + +int wxAuiMSWTabArt::GetBorderWidth(wxWindow* wnd) +{ + return wxAuiGenericTabArt::GetBorderWidth(wnd); +} + +int wxAuiMSWTabArt::GetAdditionalBorderSpace(wxWindow* wnd) +{ + if ( IsThemed() ) + { + return 4; + } + else + return wxAuiGenericTabArt::GetAdditionalBorderSpace(wnd); +} + +wxSize wxAuiMSWTabArt::GetTabSize(wxDC& dc, + wxWindow* wnd, + const wxString& caption, + const wxBitmap& bitmap, + bool active, + int close_button_state, + int* x_extent) +{ + if ( !IsThemed() ) + return wxAuiGenericTabArt::GetTabSize(dc, wnd, caption, bitmap, active, close_button_state, x_extent); + + if ( !m_closeBtnSize.IsFullySpecified() ) + InitSizes(wnd, dc); + + wxCoord textWidth, textHeight, tmp; + + dc.SetFont(wnd->GetFont()); + dc.GetTextExtent(caption, &textWidth, &tmp); + dc.GetTextExtent("ABCDEFXj", &tmp, &textHeight); + + wxCoord tabWidth = wxMax(m_tabSize.x, textWidth); + wxCoord tabHeight = wxMax(m_tabSize.y, textHeight); + + // if the close button is showing, add space for it + if ( close_button_state != wxAUI_BUTTON_STATE_HIDDEN ) + { + tabWidth += m_closeBtnSize.x; + tabHeight = wxMax(tabHeight, m_closeBtnSize.y); + } + + // if there's a bitmap, add space for it + if ( bitmap.IsOk() ) + { + tabWidth += bitmap.GetWidth() + wnd->FromDIP(3); // bitmap padding + tabHeight = wxMax(tabHeight, bitmap.GetHeight() + wnd->FromDIP(2)); + } + + // add padding + tabWidth += wnd->FromDIP(12); + tabHeight += wnd->FromDIP(3); + + if ( m_flags & wxAUI_NB_TAB_FIXED_WIDTH ) + { + tabWidth = m_fixedTabWidth; + } + else + { + int minTabWidth = wnd->FromDIP(46); + if (tabWidth < minTabWidth) + tabWidth = minTabWidth; + } + + *x_extent = tabWidth; + + if (tabHeight > m_maxTabHeight) + m_maxTabHeight = tabHeight; + + return wxSize(tabWidth, tabHeight); +} + + +void wxAuiMSWTabArt::DrawButton(wxDC& dc, + wxWindow* wnd, + const wxRect& in_rect, + int bitmap_id, + int button_state, + int orientation, + wxRect* out_rect) +{ + if ( !IsThemed() ) + { + wxAuiGenericTabArt::DrawButton(dc, wnd, in_rect, bitmap_id, button_state, orientation, out_rect); + return; + } + + wxUxThemeEngine* te = wxUxThemeEngine::Get(); + + const wchar_t* themeId = NULL; + int part = 0; + + switch (bitmap_id) + { + case wxAUI_BUTTON_CLOSE: + themeId = L"Window"; + part = WP_CLOSEBUTTON; + break; + case wxAUI_BUTTON_LEFT: + themeId = L"Spin"; + part = SPNP_DOWNHORZ; + break; + case wxAUI_BUTTON_RIGHT: + themeId = L"Spin"; + part = SPNP_UPHORZ; + break; + case wxAUI_BUTTON_WINDOWLIST: + themeId = L"Combobox"; + part = CP_DROPDOWNBUTTON1; + break; + } + + wxRect rect = in_rect; + + if ( orientation == wxLEFT ) + { + rect.SetX(in_rect.x); + rect.SetY(((in_rect.y + in_rect.height) / 2) - (m_closeBtnSize.GetHeight() / 2)); + rect.SetWidth(m_closeBtnSize.GetWidth()); + rect.SetHeight(m_closeBtnSize.GetHeight()); + } + else + { + rect = wxRect(in_rect.x + in_rect.width - m_closeBtnSize.GetWidth(), + ((in_rect.y + in_rect.height) / 2) - (m_closeBtnSize.GetHeight() / 2), + m_closeBtnSize.GetWidth(), m_closeBtnSize.GetHeight()); + } + + if ( bitmap_id == wxAUI_BUTTON_LEFT || + bitmap_id == wxAUI_BUTTON_RIGHT ) + { + rect.y = in_rect.y; + rect.height = in_rect.height - 7; + } + + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(wxBrush(m_baseColour)); + dc.DrawRectangle(rect); + + int btnState; + if ( button_state == wxAUI_BUTTON_STATE_DISABLED ) + btnState = TTCS_PRESSED + 1; + else if ( button_state == wxAUI_BUTTON_STATE_HOVER ) + btnState = TTCS_HOT; + else if ( button_state == wxAUI_BUTTON_STATE_PRESSED ) + btnState = TTCS_PRESSED; + else + btnState = TTCS_NORMAL; + + wxUxThemeHandle hTheme(wnd, themeId); + + wxRect btnRect(rect); + btnRect.width -= wnd->FromDIP(1); + + RECT btnR; + wxCopyRectToRECT(btnRect, btnR); + te->DrawThemeBackground(hTheme, GetHdcOf(dc.GetTempHDC()), part, btnState, &btnR, NULL); + + if ( out_rect ) + *out_rect = rect; +} + +int wxAuiMSWTabArt::ShowDropDown(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + int active_idx) +{ + return wxAuiGenericTabArt::ShowDropDown(wnd, pages, active_idx); +} + +int wxAuiMSWTabArt::GetBestTabCtrlSize(wxWindow* wnd, + const wxAuiNotebookPageArray& pages, + const wxSize& requiredBmp_size) +{ + return wxAuiGenericTabArt::GetBestTabCtrlSize(wnd, pages, requiredBmp_size); +} + +void wxAuiMSWTabArt::InitSizes(wxWindow* wnd, wxDC& dc) +{ + wxUxThemeEngine* te = wxUxThemeEngine::Get(); + SIZE uxSize; + + // Borrow close button from tooltip (best fit on various backgrounds) + wxUxThemeHandle hTooltipTheme(wnd, L"Tooltip"); + + te->GetThemePartSize(hTooltipTheme, GetHdcOf(dc.GetTempHDC()), + TTP_CLOSE, 0, NULL, TS_TRUE, &uxSize); + m_closeBtnSize.Set(uxSize.cx, uxSize.cy); + + wxUxThemeHandle hTabTheme(wnd, L"Tab"); + te->GetThemePartSize(hTabTheme, GetHdcOf(dc.GetTempHDC()), + TABP_TABITEM, 0, NULL, TS_TRUE, &uxSize); + m_tabSize.Set(uxSize.cx, uxSize.cy); +} + +bool wxAuiMSWTabArt::IsThemed() const +{ + return + m_themed && + !(m_flags & wxAUI_NB_BOTTOM); // Native theme does not support bottom tabs +} + + +#endif // wxUSE_AUI diff --git a/Externals/wxWidgets3/src/aui/tabmdi.cpp b/Externals/wxWidgets3/src/aui/tabmdi.cpp index 70c1a734e8..4d619c2a3f 100644 --- a/Externals/wxWidgets3/src/aui/tabmdi.cpp +++ b/Externals/wxWidgets3/src/aui/tabmdi.cpp @@ -51,14 +51,14 @@ enum MDI_MENU_ID // wxAuiMDIParentFrame //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame); -BEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame) #if wxUSE_MENUS EVT_MENU (wxID_ANY, wxAuiMDIParentFrame::DoHandleMenu) EVT_UPDATE_UI (wxID_ANY, wxAuiMDIParentFrame::DoHandleUpdateUI) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxAuiMDIParentFrame::wxAuiMDIParentFrame() { @@ -423,13 +423,13 @@ void wxAuiMDIParentFrame::Tile(wxOrientation orient) // wxAuiMDIChildFrame //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame, wxPanel) +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame, wxPanel); -BEGIN_EVENT_TABLE(wxAuiMDIChildFrame, wxPanel) +wxBEGIN_EVENT_TABLE(wxAuiMDIChildFrame, wxPanel) EVT_MENU_HIGHLIGHT_ALL(wxAuiMDIChildFrame::OnMenuHighlight) EVT_ACTIVATE(wxAuiMDIChildFrame::OnActivate) EVT_CLOSE(wxAuiMDIChildFrame::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxAuiMDIChildFrame::wxAuiMDIChildFrame() { @@ -769,13 +769,13 @@ void wxAuiMDIChildFrame::ApplyMDIChildFrameRect() // wxAuiMDIClientWindow //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow, wxAuiNotebook) +wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow, wxAuiNotebook); -BEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook) +wxBEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook) EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiMDIClientWindow::OnPageChanged) EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, wxAuiMDIClientWindow::OnPageClose) EVT_SIZE(wxAuiMDIClientWindow::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxAuiMDIClientWindow::wxAuiMDIClientWindow() { diff --git a/Externals/wxWidgets3/src/common/accelcmn.cpp b/Externals/wxWidgets3/src/common/accelcmn.cpp index 003ecbc514..f5bea8079a 100644 --- a/Externals/wxWidgets3/src/common/accelcmn.cpp +++ b/Externals/wxWidgets3/src/common/accelcmn.cpp @@ -38,79 +38,84 @@ wxAcceleratorTable wxNullAcceleratorTable; // wxAcceleratorEntry implementation // ============================================================================ +wxGCC_WARNING_SUPPRESS(missing-field-initializers) + static const struct wxKeyName { wxKeyCode code; const char *name; + const char *display_name; } wxKeyNames[] = { - { WXK_DELETE, wxTRANSLATE("DEL") }, - { WXK_DELETE, wxTRANSLATE("DELETE") }, - { WXK_BACK, wxTRANSLATE("BACK") }, - { WXK_INSERT, wxTRANSLATE("INS") }, - { WXK_INSERT, wxTRANSLATE("INSERT") }, - { WXK_RETURN, wxTRANSLATE("ENTER") }, - { WXK_RETURN, wxTRANSLATE("RETURN") }, - { WXK_PAGEUP, wxTRANSLATE("PGUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PGDN") }, - { WXK_LEFT, wxTRANSLATE("LEFT") }, - { WXK_RIGHT, wxTRANSLATE("RIGHT") }, - { WXK_UP, wxTRANSLATE("UP") }, - { WXK_DOWN, wxTRANSLATE("DOWN") }, - { WXK_HOME, wxTRANSLATE("HOME") }, - { WXK_END, wxTRANSLATE("END") }, - { WXK_SPACE, wxTRANSLATE("SPACE") }, - { WXK_TAB, wxTRANSLATE("TAB") }, - { WXK_ESCAPE, wxTRANSLATE("ESC") }, - { WXK_ESCAPE, wxTRANSLATE("ESCAPE") }, - { WXK_CANCEL, wxTRANSLATE("CANCEL") }, - { WXK_CLEAR, wxTRANSLATE("CLEAR") }, - { WXK_MENU, wxTRANSLATE("MENU") }, - { WXK_PAUSE, wxTRANSLATE("PAUSE") }, - { WXK_CAPITAL, wxTRANSLATE("CAPITAL") }, - { WXK_SELECT, wxTRANSLATE("SELECT") }, - { WXK_PRINT, wxTRANSLATE("PRINT") }, - { WXK_EXECUTE, wxTRANSLATE("EXECUTE") }, - { WXK_SNAPSHOT, wxTRANSLATE("SNAPSHOT") }, - { WXK_HELP, wxTRANSLATE("HELP") }, - { WXK_ADD, wxTRANSLATE("ADD") }, - { WXK_SEPARATOR, wxTRANSLATE("SEPARATOR") }, - { WXK_SUBTRACT, wxTRANSLATE("SUBTRACT") }, - { WXK_DECIMAL, wxTRANSLATE("DECIMAL") }, - { WXK_DIVIDE, wxTRANSLATE("DIVIDE") }, - { WXK_NUMLOCK, wxTRANSLATE("NUM_LOCK") }, - { WXK_SCROLL, wxTRANSLATE("SCROLL_LOCK") }, - { WXK_PAGEUP, wxTRANSLATE("PAGEUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PAGEDOWN") }, - { WXK_NUMPAD_SPACE, wxTRANSLATE("KP_SPACE") }, - { WXK_NUMPAD_TAB, wxTRANSLATE("KP_TAB") }, - { WXK_NUMPAD_ENTER, wxTRANSLATE("KP_ENTER") }, - { WXK_NUMPAD_HOME, wxTRANSLATE("KP_HOME") }, - { WXK_NUMPAD_LEFT, wxTRANSLATE("KP_LEFT") }, - { WXK_NUMPAD_UP, wxTRANSLATE("KP_UP") }, - { WXK_NUMPAD_RIGHT, wxTRANSLATE("KP_RIGHT") }, - { WXK_NUMPAD_DOWN, wxTRANSLATE("KP_DOWN") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PRIOR") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PAGEUP") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_NEXT") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_PAGEDOWN") }, - { WXK_NUMPAD_END, wxTRANSLATE("KP_END") }, - { WXK_NUMPAD_BEGIN, wxTRANSLATE("KP_BEGIN") }, - { WXK_NUMPAD_INSERT, wxTRANSLATE("KP_INSERT") }, - { WXK_NUMPAD_DELETE, wxTRANSLATE("KP_DELETE") }, - { WXK_NUMPAD_EQUAL, wxTRANSLATE("KP_EQUAL") }, - { WXK_NUMPAD_MULTIPLY, wxTRANSLATE("KP_MULTIPLY") }, - { WXK_NUMPAD_ADD, wxTRANSLATE("KP_ADD") }, - { WXK_NUMPAD_SEPARATOR, wxTRANSLATE("KP_SEPARATOR") }, - { WXK_NUMPAD_SUBTRACT, wxTRANSLATE("KP_SUBTRACT") }, - { WXK_NUMPAD_DECIMAL, wxTRANSLATE("KP_DECIMAL") }, - { WXK_NUMPAD_DIVIDE, wxTRANSLATE("KP_DIVIDE") }, - { WXK_WINDOWS_LEFT, wxTRANSLATE("WINDOWS_LEFT") }, - { WXK_WINDOWS_RIGHT, wxTRANSLATE("WINDOWS_RIGHT") }, - { WXK_WINDOWS_MENU, wxTRANSLATE("WINDOWS_MENU") }, - { WXK_COMMAND, wxTRANSLATE("COMMAND") }, + { WXK_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Delete") }, + { WXK_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Del") }, + { WXK_BACK, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Back"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Backspace") }, + { WXK_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Insert") }, + { WXK_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Ins") }, + { WXK_RETURN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Enter") }, + { WXK_RETURN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Return") }, + { WXK_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PageUp"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Page Up") }, + { WXK_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PageDown"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Page Down") }, + { WXK_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PgUp") }, + { WXK_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PgDn") }, + { WXK_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Left"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Left") }, + { WXK_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Right"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Right") }, + { WXK_UP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Up"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Up") }, + { WXK_DOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Down"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Down") }, + { WXK_HOME, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Home") }, + { WXK_END, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("End") }, + { WXK_SPACE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Space") }, + { WXK_TAB, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Tab") }, + { WXK_ESCAPE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Esc") }, + { WXK_ESCAPE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Escape") }, + { WXK_CANCEL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Cancel") }, + { WXK_CLEAR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Clear") }, + { WXK_MENU, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Menu") }, + { WXK_PAUSE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Pause") }, + { WXK_CAPITAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Capital") }, + { WXK_SELECT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Select") }, + { WXK_PRINT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Print") }, + { WXK_EXECUTE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Execute") }, + { WXK_SNAPSHOT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Snapshot") }, + { WXK_HELP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Help") }, + { WXK_ADD, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Add") }, + { WXK_SEPARATOR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Separator") }, + { WXK_SUBTRACT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Subtract") }, + { WXK_DECIMAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Decimal") }, + { WXK_DIVIDE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Divide") }, + { WXK_NUMLOCK, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num_lock"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Lock") }, + { WXK_SCROLL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Scroll_lock"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Scroll Lock") }, + { WXK_NUMPAD_SPACE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Space"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Space") }, + { WXK_NUMPAD_TAB, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Tab"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Tab") }, + { WXK_NUMPAD_ENTER, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Enter"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Enter") }, + { WXK_NUMPAD_HOME, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Home"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Home") }, + { WXK_NUMPAD_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Left"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num left") }, + { WXK_NUMPAD_UP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Up"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Up") }, + { WXK_NUMPAD_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Right"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Right") }, + { WXK_NUMPAD_DOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Down"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Down") }, + { WXK_NUMPAD_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_PageUp"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Page Up") }, + { WXK_NUMPAD_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_PageDown"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Page Down") }, + { WXK_NUMPAD_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Prior") }, + { WXK_NUMPAD_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Next") }, + { WXK_NUMPAD_END, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_End"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num End") }, + { WXK_NUMPAD_BEGIN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Begin"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Begin") }, + { WXK_NUMPAD_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Insert"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Insert") }, + { WXK_NUMPAD_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Delete"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Delete") }, + { WXK_NUMPAD_EQUAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Equal"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num =") }, + { WXK_NUMPAD_MULTIPLY, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Multiply"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num *") }, + { WXK_NUMPAD_ADD, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Add"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num +") }, + { WXK_NUMPAD_SEPARATOR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Separator"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num ,") }, + { WXK_NUMPAD_SUBTRACT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Subtract"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num -") }, + { WXK_NUMPAD_DECIMAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Decimal"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num .") }, + { WXK_NUMPAD_DIVIDE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Divide"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num /") }, + { WXK_WINDOWS_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Left") }, + { WXK_WINDOWS_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Right") }, + { WXK_WINDOWS_MENU, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Menu") }, + { WXK_COMMAND, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Command") }, }; +wxGCC_WARNING_RESTORE(missing-field-initializers) + // return true if the 2 strings refer to the same accel // // as accels can be either translated or not, check for both possibilities and @@ -322,7 +327,7 @@ wxString wxAcceleratorEntry::AsPossiblyLocalizedString(bool localized) const text += PossiblyLocalize(wxTRANSLATE("Ctrl+"), localized); if ( flags & wxACCEL_SHIFT ) text += PossiblyLocalize(wxTRANSLATE("Shift+"), localized); -#if defined(__WXMAC__) || defined(__WXCOCOA__) +#if defined(__WXMAC__) if ( flags & wxACCEL_RAW_CTRL ) text += PossiblyLocalize(wxTRANSLATE("RawCtrl+"), localized); #endif @@ -346,7 +351,7 @@ wxString wxAcceleratorEntry::AsPossiblyLocalizedString(bool localized) const const wxKeyName& kn = wxKeyNames[n]; if ( code == kn.code ) { - text << PossiblyLocalize(kn.name, localized); + text << PossiblyLocalize(kn.display_name ? kn.display_name : kn.name, localized); break; } } diff --git a/Externals/wxWidgets3/src/common/addremovectrl.cpp b/Externals/wxWidgets3/src/common/addremovectrl.cpp new file mode 100644 index 0000000000..f5595e269e --- /dev/null +++ b/Externals/wxWidgets3/src/common/addremovectrl.cpp @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/addremovectrl.cpp +// Purpose: wxAddRemoveCtrl implementation. +// Author: Vadim Zeitlin +// Created: 2015-01-29 +// Copyright: (c) 2015 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_ADDREMOVECTRL + +#ifndef WX_PRECOMP +#endif // WX_PRECOMP + +#include "wx/addremovectrl.h" + +#include "wx/private/addremovectrl.h" + +// ============================================================================ +// wxAddRemoveCtrl implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// common part +// ---------------------------------------------------------------------------- + +extern +WXDLLIMPEXP_DATA_ADV(const char) wxAddRemoveCtrlNameStr[] = "wxAddRemoveCtrl"; + +bool +wxAddRemoveCtrl::Create(wxWindow* parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + if ( !wxPanel::Create(parent, winid, pos, size, style, name) ) + return false; + + // We don't do anything here, the buttons are created when we're given the + // adaptor to use them with in SetAdaptor(). + return true; +} + +wxAddRemoveCtrl::~wxAddRemoveCtrl() +{ + delete m_impl; +} + +void wxAddRemoveCtrl::SetAdaptor(wxAddRemoveAdaptor* adaptor) +{ + wxCHECK_RET( !m_impl, wxS("should be only called once") ); + + wxCHECK_RET( adaptor, wxS("should have a valid adaptor") ); + + wxWindow* const ctrlItems = adaptor->GetItemsCtrl(); + wxCHECK_RET( ctrlItems, wxS("should have a valid items control") ); + + m_impl = new wxAddRemoveImpl(adaptor, this, ctrlItems); +} + +void +wxAddRemoveCtrl::SetButtonsToolTips(const wxString& addtip, + const wxString& removetip) +{ + wxCHECK_RET( m_impl, wxS("can only be called after SetAdaptor()") ); + + m_impl->SetButtonsToolTips(addtip, removetip); +} + +wxSize wxAddRemoveCtrl::DoGetBestClientSize() const +{ + return m_impl ? m_impl->GetBestClientSize() : wxDefaultSize; +} + +#endif // wxUSE_ADDREMOVECTRL diff --git a/Externals/wxWidgets3/src/common/animatecmn.cpp b/Externals/wxWidgets3/src/common/animatecmn.cpp index c8fb083300..17c2a60b63 100644 --- a/Externals/wxWidgets3/src/common/animatecmn.cpp +++ b/Externals/wxWidgets3/src/common/animatecmn.cpp @@ -34,8 +34,8 @@ const char wxAnimationCtrlNameStr[] = "animationctrl"; // global object wxAnimation wxNullAnimation; -IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl); // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/any.cpp b/Externals/wxWidgets3/src/common/any.cpp index f866c59448..8cb31713b3 100644 --- a/Externals/wxWidgets3/src/common/any.cpp +++ b/Externals/wxWidgets3/src/common/any.cpp @@ -146,7 +146,7 @@ bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) // and others to "longlong". if ( wxANY_CHECK_TYPE(any, signed int) ) { -#ifdef wxLongLong_t +#if defined(wxLongLong_t) && wxUSE_LONGLONG wxLongLong_t ll = 0; if ( any.GetAs(&ll) ) { @@ -190,7 +190,7 @@ bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) // Ok, one last chance: while unlikely, it is possible that the // wxAny actually contains wxVariant. if ( wxANY_CHECK_TYPE(any, wxVariant) ) - *variant = wxANY_AS(any, wxVariant); + *variant = any.As(); return false; } @@ -211,23 +211,23 @@ bool wxConvertAnyToVariant(const wxAny& any, wxVariant* variant) // class wxAnyValueTypeGlobalsManager : public wxModule { - DECLARE_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager) + wxDECLARE_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager); public: wxAnyValueTypeGlobalsManager() : wxModule() { } virtual ~wxAnyValueTypeGlobalsManager() { } - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { wxDELETE(g_wxAnyValueTypeGlobals); } private: }; -IMPLEMENT_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxAnyValueTypeGlobalsManager, wxModule); #endif // wxUSE_VARIANT @@ -264,7 +264,7 @@ bool wxAnyValueTypeImplInt::ConvertValue(const wxAnyValueBuffer& src, wxAnyBaseIntType value = GetValue(src); if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) { -#ifdef wxLongLong_t +#if defined(wxLongLong_t) && wxUSE_LONGLONG wxLongLong ll(value); wxString s = ll.ToString(); #else @@ -302,7 +302,7 @@ bool wxAnyValueTypeImplUint::ConvertValue(const wxAnyValueBuffer& src, wxAnyBaseUintType value = GetValue(src); if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) ) { -#ifdef wxLongLong_t +#if defined(wxLongLong_t) && wxUSE_LONGLONG wxULongLong ull(value); wxString s = ull.ToString(); #else @@ -319,13 +319,7 @@ bool wxAnyValueTypeImplUint::ConvertValue(const wxAnyValueBuffer& src, } else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, double) ) { -#ifndef __VISUALC6__ double value2 = static_cast(value); -#else - // VC6 doesn't implement conversion from unsigned __int64 to double - wxAnyBaseIntType value0 = static_cast(value); - double value2 = static_cast(value0); -#endif wxAnyValueTypeImplDouble::SetValue(value2, dst); } else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, bool) ) @@ -495,13 +489,13 @@ class wxAnyValueTypeImpl : public wxAnyValueType WX_DECLARE_ANY_VALUE_TYPE(wxAnyValueTypeImpl) public: // Dummy implementations - virtual void DeleteValue(wxAnyValueBuffer& buf) const + virtual void DeleteValue(wxAnyValueBuffer& buf) const wxOVERRIDE { wxUnusedVar(buf); } virtual void CopyBuffer(const wxAnyValueBuffer& src, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { wxUnusedVar(src); wxUnusedVar(dst); @@ -509,7 +503,7 @@ public: virtual bool ConvertValue(const wxAnyValueBuffer& src, wxAnyValueType* dstType, - wxAnyValueBuffer& dst) const + wxAnyValueBuffer& dst) const wxOVERRIDE { wxUnusedVar(src); wxUnusedVar(dstType); diff --git a/Externals/wxWidgets3/src/common/appbase.cpp b/Externals/wxWidgets3/src/common/appbase.cpp index 68113d9956..249afa5018 100644 --- a/Externals/wxWidgets3/src/common/appbase.cpp +++ b/Externals/wxWidgets3/src/common/appbase.cpp @@ -45,18 +45,50 @@ #include "wx/sysopt.h" #include "wx/tokenzr.h" #include "wx/thread.h" +#include "wx/stdpaths.h" -#if wxUSE_STL - #if wxUSE_EXCEPTIONS +#if wxUSE_EXCEPTIONS + // Do we have a C++ compiler with enough C++11 support for + // std::exception_ptr and functions working with it? + #if __cplusplus >= 201103L + // Any conforming C++11 compiler should have it, but g++ implementation + // of exception handling depends on the availability of the atomic int + // operations apparently, so all known version of g++ with C++11 support + // (4.7..4.9) fail to provide exception_ptr if the symbol below is not + // set to 2 (meaning "always available"), which is notably the case for + // MinGW-w64 without -march=486 switch, see #16634. + #ifdef __GNUC__ + // This symbol is always defined in the known g++ version, so + // assume that if it isn't defined, things changed for the better + // and optimistically suppose that exception_ptr is available. + #if !defined(__GCC_ATOMIC_INT_LOCK_FREE) \ + || __GCC_ATOMIC_INT_LOCK_FREE > 1 + #define HAS_EXCEPTION_PTR + #endif + #else + #define HAS_EXCEPTION_PTR + #endif + #elif wxCHECK_VISUALC_VERSION(11) + // VC++ supports it since version 10, even though it doesn't define + // __cplusplus to C++11 value, but MSVC 2010 doesn't have a way to test + // whether exception_ptr is valid, so we'd need to use a separate bool + // flag for it if we wanted to make it work. For now just settle for + // only using exception_ptr for VC11 and later. + #define HAS_EXCEPTION_PTR + #endif + + #ifdef HAS_EXCEPTION_PTR + #include // for std::current_exception() + #include // for std::swap() + #endif + + #if wxUSE_STL #include #include #endif - #if wxUSE_INTL - #include - #endif -#endif // wxUSE_STL +#endif // wxUSE_EXCEPTIONS -#if !defined(__WINDOWS__) || defined(__WXMICROWIN__) +#if !defined(__WINDOWS__) #include // for SIGTRAP used by wxTrap() #endif //Win/Unix @@ -173,7 +205,7 @@ wxAppConsoleBase::~wxAppConsoleBase() bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv)) { -#if defined(__WINDOWS__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); #endif @@ -190,6 +222,16 @@ wxString wxAppConsoleBase::GetAppName() const // the application name is, by default, the name of its executable file wxFileName::SplitPath(argv[0], NULL, &name, NULL); } +#if wxUSE_STDPATHS + else // fall back to the executable file name, if we can determine it + { + const wxString pathExe = wxStandardPaths::Get().GetExecutablePath(); + if ( !pathExe.empty() ) + { + wxFileName::SplitPath(pathExe, NULL, &name, NULL); + } + } +#endif // wxUSE_STDPATHS } return name; } @@ -265,6 +307,10 @@ void wxAppConsoleBase::OnLaunched() int wxAppConsoleBase::OnExit() { + // Delete all pending objects first, they might use wxConfig to save their + // state during their destruction. + DeletePendingObjects(); + #if wxUSE_CONFIG // delete the config object if any (don't use Get() here, but Set() // because Get() could create a new config object) @@ -315,9 +361,9 @@ wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() wxAppTraits& wxAppConsoleBase::GetValidTraits() { static wxConsoleAppTraits s_traitsConsole; - wxAppTraits* const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; + wxAppTraits* const traits = (wxTheApp ? wxTheApp->GetTraits() : NULL); - return traits ? *traits : s_traitsConsole; + return *(traits ? traits : &s_traitsConsole); } // ---------------------------------------------------------------------------- @@ -660,13 +706,51 @@ void wxAppConsoleBase::OnUnhandledException() bool wxAppConsoleBase::OnExceptionInMainLoop() { throw; - - // some compilers are too stupid to know that we never return after throw -#if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200) - return false; -#endif } +#ifdef HAS_EXCEPTION_PTR +static std::exception_ptr gs_storedException; + +bool wxAppConsoleBase::StoreCurrentException() +{ + if ( gs_storedException ) + { + // We can't store more than one exception currently: while we could + // support this by just using a vector, it shouldn't be + // actually necessary because we should never have more than one active + // exception anyhow. + return false; + } + + gs_storedException = std::current_exception(); + + return true; +} + +void wxAppConsoleBase::RethrowStoredException() +{ + if ( gs_storedException ) + { + std::exception_ptr storedException; + std::swap(storedException, gs_storedException); + + std::rethrow_exception(storedException); + } +} + +#else // !HAS_EXCEPTION_PTR + +bool wxAppConsoleBase::StoreCurrentException() +{ + return false; +} + +void wxAppConsoleBase::RethrowStoredException() +{ +} + +#endif // HAS_EXCEPTION_PTR/!HAS_EXCEPTION_PTR + #endif // wxUSE_EXCEPTIONS // ---------------------------------------------------------------------------- @@ -928,25 +1012,37 @@ wxString wxAppTraitsBase::GetAssertStackTrace() #endif // !__WINDOWS__ - wxString stackTrace; - class StackDump : public wxStackWalker { public: - StackDump() { } + StackDump() { m_numFrames = 0; } const wxString& GetStackTrace() const { return m_stackTrace; } protected: - virtual void OnStackFrame(const wxStackFrame& frame) + virtual void OnStackFrame(const wxStackFrame& frame) wxOVERRIDE { - m_stackTrace << wxString::Format - ( - wxT("[%02d] "), - wx_truncate_cast(int, frame.GetLevel()) - ); + // don't show more than maxLines or we could get a dialog too tall + // to be shown on screen: 20 should be ok everywhere as even with + // 15 pixel high characters it is still only 300 pixels... + if ( m_numFrames++ > 20 ) + return; + + m_stackTrace << wxString::Format(wxT("[%02u] "), m_numFrames); + + const wxString name = frame.GetName(); + if ( name.StartsWith("wxOnAssert") ) + { + // Ignore all frames until the wxOnAssert() one, they are + // internal to wxWidgets and not interesting for the user + // (but notice that if we never find the wxOnAssert() frame, + // e.g. because we don't have symbol info at all, we would show + // everything which is better than not showing anything). + m_stackTrace.clear(); + m_numFrames = 0; + return; + } - wxString name = frame.GetName(); if ( !name.empty() ) { m_stackTrace << wxString::Format(wxT("%-40s"), name.c_str()); @@ -969,22 +1065,12 @@ wxString wxAppTraitsBase::GetAssertStackTrace() private: wxString m_stackTrace; + unsigned m_numFrames; }; - // don't show more than maxLines or we could get a dialog too tall to be - // shown on screen: 20 should be ok everywhere as even with 15 pixel high - // characters it is still only 300 pixels... - static const int maxLines = 20; - StackDump dump; - dump.Walk(8, maxLines); // 8 is chosen to hide all OnAssert() calls - stackTrace = dump.GetStackTrace(); - - const int count = stackTrace.Freq(wxT('\n')); - for ( int i = 0; i < count - maxLines; i++ ) - stackTrace = stackTrace.BeforeLast(wxT('\n')); - - return stackTrace; + dump.Walk(); + return dump.GetStackTrace(); #else // !wxDEBUG_LEVEL // this function is still present for ABI-compatibility even in debug level // 0 build but is not used there and so can simply do nothing @@ -1028,11 +1114,7 @@ bool wxAssertIsEqual(int x, int y) void wxAbort() { -#ifdef __WXWINCE__ - ExitThread(3); -#else abort(); -#endif } #if wxDEBUG_LEVEL @@ -1042,7 +1124,7 @@ void wxAbort() void wxTrap() { -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) DebugBreak(); #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS Debugger(); @@ -1210,7 +1292,7 @@ static bool DoShowAssertDialog(const wxString& msg) { // under Windows we can show the dialog even in the console mode -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) wxString msgDlg(msg); // this message is intentionally not translated -- it is for developers @@ -1283,8 +1365,6 @@ void ShowAssertDialog(const wxString& file, } #if wxUSE_THREADS - // if we are not in the main thread, output the assert directly and trap - // since dialogs cannot be displayed if ( !wxThread::IsMain() ) { msg += wxString::Format(" [in thread %lx]", wxThread::GetCurrentId()); diff --git a/Externals/wxWidgets3/src/common/appcmn.cpp b/Externals/wxWidgets3/src/common/appcmn.cpp index 821f695bac..fc784f6e7c 100644 --- a/Externals/wxWidgets3/src/common/appcmn.cpp +++ b/Externals/wxWidgets3/src/common/appcmn.cpp @@ -129,7 +129,10 @@ wxAppBase::~wxAppBase() void wxAppBase::CleanUp() { - // clean up all the pending objects + // Clean up any still pending objects. Normally there shouldn't any as we + // already do this in OnExit(), but this could happen if the user code has + // somehow managed to create more of them since then or just forgot to call + // the base class OnExit(). DeletePendingObjects(); // and any remaining TLWs (they remove themselves from wxTopLevelWindows @@ -194,8 +197,12 @@ wxLayoutDirection wxAppBase::GetLayoutDirection() const // GUI-specific command line options handling // ---------------------------------------------------------------------------- +#ifdef __WXUNIVERSAL__ #define OPTION_THEME "theme" +#endif +#if defined(__WXDFB__) #define OPTION_MODE "mode" +#endif void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser) { diff --git a/Externals/wxWidgets3/src/common/archive.cpp b/Externals/wxWidgets3/src/common/archive.cpp index 360f22936c..fc85b55b03 100644 --- a/Externals/wxWidgets3/src/common/archive.cpp +++ b/Externals/wxWidgets3/src/common/archive.cpp @@ -17,8 +17,8 @@ #include "wx/archive.h" -IMPLEMENT_ABSTRACT_CLASS(wxArchiveEntry, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxArchiveClassFactory, wxFilterClassFactoryBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxArchiveEntry, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxArchiveClassFactory, wxFilterClassFactoryBase); ///////////////////////////////////////////////////////////////////////////// diff --git a/Externals/wxWidgets3/src/common/arrstr.cpp b/Externals/wxWidgets3/src/common/arrstr.cpp index f66fcdd4ee..94b64722ec 100644 --- a/Externals/wxWidgets3/src/common/arrstr.cpp +++ b/Externals/wxWidgets3/src/common/arrstr.cpp @@ -20,6 +20,7 @@ #endif #include "wx/arrstr.h" +#include "wx/scopedarray.h" #include "wx/beforestd.h" #include @@ -72,6 +73,7 @@ void wxArrayString::Init(bool autoSort) m_nSize = m_nCount = 0; m_pItems = NULL; + m_compareFunction = NULL; m_autoSort = autoSort; } @@ -106,10 +108,14 @@ void wxArrayString::Copy(const wxArrayString& src) } // grow the array -void wxArrayString::Grow(size_t nIncrement) +wxString *wxArrayString::Grow(size_t nIncrement) { - // only do it if no more place - if ( (m_nSize - m_nCount) < nIncrement ) { + if ( (m_nSize - m_nCount) >= nIncrement ) + { + // We already have enough space. + return NULL; + } + // if ARRAY_DEFAULT_INITIAL_SIZE were set to 0, the initially empty would // be never resized! #if ARRAY_DEFAULT_INITIAL_SIZE == 0 @@ -122,6 +128,9 @@ void wxArrayString::Grow(size_t nIncrement) if (m_nSize < nIncrement) m_nSize = nIncrement; m_pItems = new wxString[m_nSize]; + + // Nothing to free, we hadn't had any memory before. + return NULL; } else { // otherwise when it's called for the first time, nIncrement would be 0 @@ -140,12 +149,12 @@ void wxArrayString::Grow(size_t nIncrement) for ( size_t j = 0; j < m_nCount; j++ ) pNew[j] = m_pItems[j]; - // delete old memory (but do not release the strings!) - delete [] m_pItems; + wxString* const pItemsOld = m_pItems; m_pItems = pNew; + + return pItemsOld; } - } } // deletes all the strings from the list @@ -270,7 +279,7 @@ size_t wxArrayString::Add(const wxString& str, size_t nInsert) while ( lo < hi ) { i = (lo + hi)/2; - res = str.Cmp(m_pItems[i]); + res = m_compareFunction ? m_compareFunction(str, m_pItems[i]) : str.Cmp(m_pItems[i]); if ( res < 0 ) hi = i; else if ( res > 0 ) @@ -288,7 +297,10 @@ size_t wxArrayString::Add(const wxString& str, size_t nInsert) return (size_t)lo; } else { - Grow(nInsert); + // Now that we must postpone freeing the old memory until we don't need it + // any more, i.e. don't reference "str" which could be a reference to one + // of our own strings. + wxScopedArray oldStrings(Grow(nInsert)); for (size_t i = 0; i < nInsert; i++) { @@ -308,7 +320,7 @@ void wxArrayString::Insert(const wxString& str, size_t nIndex, size_t nInsert) wxCHECK_RET( m_nCount <= m_nCount + nInsert, wxT("array size overflow in wxArrayString::Insert") ); - Grow(nInsert); + wxScopedArray oldStrings(Grow(nInsert)); for (int j = m_nCount - nIndex - 1; j >= 0; j--) m_pItems[nIndex + nInsert + j] = m_pItems[nIndex + j]; @@ -327,7 +339,7 @@ wxArrayString::insert(iterator it, const_iterator first, const_iterator last) const int idx = it - begin(); // grow it once - Grow(last - first); + wxScopedArray oldStrings(Grow(last - first)); // reset "it" since it can change inside Grow() it = begin() + idx; diff --git a/Externals/wxWidgets3/src/common/artprov.cpp b/Externals/wxWidgets3/src/common/artprov.cpp index f2551614d4..e7466eee26 100644 --- a/Externals/wxWidgets3/src/common/artprov.cpp +++ b/Externals/wxWidgets3/src/common/artprov.cpp @@ -124,7 +124,7 @@ wxArtProviderCache::ConstructHashID(const wxArtID& id, // wxArtProvider class // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxArtProvider, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxArtProvider, wxObject); wxArtProvidersList *wxArtProvider::sm_providers = NULL; wxArtProviderCache *wxArtProvider::sm_cache = NULL; @@ -212,6 +212,32 @@ wxArtProvider::~wxArtProvider() // wxArtProvider: retrieving bitmaps/icons // ---------------------------------------------------------------------------- +void wxArtProvider::RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded) +{ + wxCHECK_RET( sizeNeeded.IsFullySpecified(), wxS("New size must be given") ); + +#if wxUSE_IMAGE + wxImage img = bmp.ConvertToImage(); + img.Rescale(sizeNeeded.x, sizeNeeded.y); + bmp = wxBitmap(img); +#else // !wxUSE_IMAGE + // Fallback method of scaling the bitmap + wxBitmap newBmp(sizeNeeded, bmp.GetDepth()); +#if defined(__WXMSW__) || defined(__WXOSX__) + // wxBitmap::UseAlpha() is used only on wxMSW and wxOSX. + newBmp.UseAlpha(bmp.HasAlpha()); +#endif // __WXMSW__ || __WXOSX__ + { + wxMemoryDC dc(newBmp); + double scX = (double)sizeNeeded.GetWidth() / bmp.GetWidth(); + double scY = (double)sizeNeeded.GetHeight() / bmp.GetHeight(); + dc.SetUserScale(scX, scY); + dc.DrawBitmap(bmp, 0, 0); + } + bmp = newBmp; +#endif // wxUSE_IMAGE/!wxUSE_IMAGE +} + /*static*/ wxBitmap wxArtProvider::GetBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size) @@ -256,17 +282,13 @@ wxArtProvider::~wxArtProvider() } // if we didn't get the correct size, resize the bitmap -#if wxUSE_IMAGE && (!defined(__WXMSW__) || wxUSE_WXDIB) if ( bmp.IsOk() && sizeNeeded != wxDefaultSize ) { if ( bmp.GetSize() != sizeNeeded ) { - wxImage img = bmp.ConvertToImage(); - img.Rescale(sizeNeeded.x, sizeNeeded.y); - bmp = wxBitmap(img); + RescaleBitmap(bmp, sizeNeeded); } } -#endif // wxUSE_IMAGE sm_cache->PutBitmap(hashId, bmp); } @@ -338,7 +360,7 @@ wxArtID wxArtProvider::GetMessageBoxIconId(int flags) { default: wxFAIL_MSG(wxT("incorrect message box icon flags")); - // fall through + wxFALLTHROUGH; case wxICON_ERROR: return wxART_ERROR; @@ -397,32 +419,6 @@ bool wxArtProvider::HasNativeProvider() // deprecated wxArtProvider methods // ---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_6 - -/* static */ void wxArtProvider::PushProvider(wxArtProvider *provider) -{ - Push(provider); -} - -/* static */ void wxArtProvider::InsertProvider(wxArtProvider *provider) -{ - PushBack(provider); -} - -/* static */ bool wxArtProvider::PopProvider() -{ - return Pop(); -} - -/* static */ bool wxArtProvider::RemoveProvider(wxArtProvider *provider) -{ - // RemoveProvider() used to delete the provider being removed so this is - // not a typo, we must call Delete() and not Remove() here - return Delete(provider); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - #if WXWIN_COMPATIBILITY_2_8 /* static */ void wxArtProvider::Insert(wxArtProvider *provider) { @@ -437,7 +433,7 @@ bool wxArtProvider::HasNativeProvider() class wxArtProviderModule: public wxModule { public: - bool OnInit() + bool OnInit() wxOVERRIDE { // The order here is such that the native provider will be used first // and the standard one last as all these default providers add @@ -451,12 +447,12 @@ public: #endif // wxUSE_ARTPROVIDER_STD return true; } - void OnExit() + void OnExit() wxOVERRIDE { wxArtProvider::CleanUpProviders(); } - DECLARE_DYNAMIC_CLASS(wxArtProviderModule) + wxDECLARE_DYNAMIC_CLASS(wxArtProviderModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxArtProviderModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxArtProviderModule, wxModule); diff --git a/Externals/wxWidgets3/src/common/artstd.cpp b/Externals/wxWidgets3/src/common/artstd.cpp index 471146647b..0f59d8cc5f 100644 --- a/Externals/wxWidgets3/src/common/artstd.cpp +++ b/Externals/wxWidgets3/src/common/artstd.cpp @@ -35,7 +35,7 @@ class wxDefaultArtProvider : public wxArtProvider { protected: virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size); + const wxSize& size) wxOVERRIDE; }; // ---------------------------------------------------------------------------- @@ -126,6 +126,8 @@ protected: #include "../../art/quit.xpm" #include "../../art/find.xpm" #include "../../art/findrepl.xpm" +#include "../../art/fullscreen.xpm" +#include "../../art/edit.xpm" wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) { @@ -189,7 +191,9 @@ wxBitmap wxDefaultArtProvider_CreateBitmap(const wxArtID& id) ART(wxART_QUIT, quit) ART(wxART_FIND, find) ART(wxART_FIND_AND_REPLACE, findrepl) + ART(wxART_FULL_SCREEN, fullscreen) ART(wxART_NEW, new) + ART(wxART_EDIT, edit) return wxNullBitmap; diff --git a/Externals/wxWidgets3/src/common/arttango.cpp b/Externals/wxWidgets3/src/common/arttango.cpp index 156ae8fc06..94db4628da 100644 --- a/Externals/wxWidgets3/src/common/arttango.cpp +++ b/Externals/wxWidgets3/src/common/arttango.cpp @@ -61,6 +61,7 @@ #include "../../art/tango/folder.h" #include "../../art/tango/folder_new.h" #include "../../art/tango/folder_open.h" +#include "../../art/tango/fullscreen.h" #include "../../art/tango/go_down.h" #include "../../art/tango/go_first.h" #include "../../art/tango/go_home.h" @@ -91,7 +92,7 @@ public: protected: virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size); + const wxSize& size) wxOVERRIDE; private: bool m_imageHandledAdded; @@ -198,6 +199,7 @@ wxTangoArtProvider::CreateBitmap(const wxArtID& id, { wxART_FIND, BITMAP_DATA(edit_find) }, { wxART_FIND_AND_REPLACE, BITMAP_DATA(edit_find_replace) }, + { wxART_FULL_SCREEN, BITMAP_DATA(full_screen) }, }; #undef BITMAP_ARRAY_NAME @@ -265,7 +267,7 @@ wxTangoArtProvider::CreateBitmap(const wxArtID& id, { default: wxFAIL_MSG( "Unsupported Tango bitmap size" ); - // fall through + wxFALLTHROUGH; case TangoSize_16: data = entry.data16; diff --git a/Externals/wxWidgets3/src/common/base64.cpp b/Externals/wxWidgets3/src/common/base64.cpp index 5ee3a7a3c7..af50821146 100644 --- a/Externals/wxWidgets3/src/common/base64.cpp +++ b/Externals/wxWidgets3/src/common/base64.cpp @@ -127,7 +127,7 @@ wxBase64Decode(void *dst_, size_t dstLen, case WSP: if ( mode == wxBase64DecodeMode_SkipWS ) continue; - // fall through + wxFALLTHROUGH; case INV: if ( mode == wxBase64DecodeMode_Relaxed ) diff --git a/Externals/wxWidgets3/src/common/bmpbase.cpp b/Externals/wxWidgets3/src/common/bmpbase.cpp index 763b9597f9..b04ffaddb9 100644 --- a/Externals/wxWidgets3/src/common/bmpbase.cpp +++ b/Externals/wxWidgets3/src/common/bmpbase.cpp @@ -81,8 +81,8 @@ wxBitmap wxBitmapHelpers::NewFromPNGData(const void* data, size_t size) #endif // WX_PRECOMP -IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject) -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject); wxList wxBitmapBase::sm_handlers; @@ -163,14 +163,14 @@ void wxBitmapBase::CleanUpHandlers() class wxBitmapBaseModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) + wxDECLARE_DYNAMIC_CLASS(wxBitmapBaseModule); public: wxBitmapBaseModule() {} - bool OnInit() { wxBitmap::InitStandardHandlers(); return true; } - void OnExit() { wxBitmap::CleanUpHandlers(); } + bool OnInit() wxOVERRIDE { wxBitmap::InitStandardHandlers(); return true; } + void OnExit() wxOVERRIDE { wxBitmap::CleanUpHandlers(); } }; -IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule); #endif // wxUSE_BITMAP_BASE @@ -178,7 +178,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule) // wxBitmap common // ---------------------------------------------------------------------------- -#if !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__)) +#if !(defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXQT__)) wxBitmap::wxBitmap(const char* const* bits) { diff --git a/Externals/wxWidgets3/src/common/bmpbtncmn.cpp b/Externals/wxWidgets3/src/common/bmpbtncmn.cpp index 8760c70c09..ff2ea043ce 100644 --- a/Externals/wxWidgets3/src/common/bmpbtncmn.cpp +++ b/Externals/wxWidgets3/src/common/bmpbtncmn.cpp @@ -68,7 +68,7 @@ wxBEGIN_FLAGS( wxBitmapButtonStyle ) wxFLAGS_MEMBER(wxBU_BOTTOM) wxEND_FLAGS( wxBitmapButtonStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton, "wx/bmpbuttn.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton, "wx/bmpbuttn.h"); wxBEGIN_PROPERTIES_TABLE(wxBitmapButton) wxPROPERTY_FLAGS( WindowStyle, wxBitmapButtonStyle, long, \ @@ -103,12 +103,13 @@ GetCloseButtonBitmap(wxWindow *win, const wxColour& colBg, int flags = 0) { - wxBitmap bmp(size); + wxBitmap bmp; + bmp.CreateScaled(size.x, size.y, wxBITMAP_SCREEN_DEPTH, win->GetContentScaleFactor()); wxMemoryDC dc(bmp); dc.SetBackground(colBg); dc.Clear(); wxRendererNative::Get(). - DrawTitleBarBitmap(win, dc, size, wxTITLEBAR_BUTTON_CLOSE, flags); + DrawTitleBarBitmap(win, dc, win->FromDIP(size), wxTITLEBAR_BUTTON_CLOSE, flags); return bmp; } diff --git a/Externals/wxWidgets3/src/common/bookctrl.cpp b/Externals/wxWidgets3/src/common/bookctrl.cpp index 4b321322b4..3926058ab5 100644 --- a/Externals/wxWidgets3/src/common/bookctrl.cpp +++ b/Externals/wxWidgets3/src/common/bookctrl.cpp @@ -37,14 +37,14 @@ // event table // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxBookCtrlBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxBookCtrlBase, wxControl); -BEGIN_EVENT_TABLE(wxBookCtrlBase, wxControl) +wxBEGIN_EVENT_TABLE(wxBookCtrlBase, wxControl) EVT_SIZE(wxBookCtrlBase::OnSize) #if wxUSE_HELP EVT_HELP(wxID_ANY, wxBookCtrlBase::OnHelp) #endif // wxUSE_HELP -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // constructors and destructors @@ -56,11 +56,7 @@ void wxBookCtrlBase::Init() m_bookctrl = NULL; m_fitToCurrentPage = false; -#if defined(__WXWINCE__) - m_internalBorder = 1; -#else m_internalBorder = 5; -#endif m_controlMargin = 0; m_controlSizer = NULL; @@ -166,11 +162,11 @@ wxRect wxBookCtrlBase::GetPageRect() const { default: wxFAIL_MSG( wxT("unexpected alignment") ); - // fall through + wxFALLTHROUGH; case wxBK_TOP: rectPage.y = size.y + GetInternalBorder(); - // fall through + wxFALLTHROUGH; case wxBK_BOTTOM: rectPage.height -= size.y + GetInternalBorder(); @@ -180,7 +176,7 @@ wxRect wxBookCtrlBase::GetPageRect() const case wxBK_LEFT: rectPage.x = size.x + GetInternalBorder(); - // fall through + wxFALLTHROUGH; case wxBK_RIGHT: rectPage.width -= size.x + GetInternalBorder(); @@ -225,7 +221,7 @@ void wxBookCtrlBase::DoSize() { default: wxFAIL_MSG( wxT("unexpected alignment") ); - // fall through + wxFALLTHROUGH; case wxBK_TOP: case wxBK_LEFT: @@ -522,6 +518,6 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags) return oldSel; } -IMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent); #endif // wxUSE_BOOKCTRL diff --git a/Externals/wxWidgets3/src/common/btncmn.cpp b/Externals/wxWidgets3/src/common/btncmn.cpp index cbbfd0f14e..912605ba5c 100644 --- a/Externals/wxWidgets3/src/common/btncmn.cpp +++ b/Externals/wxWidgets3/src/common/btncmn.cpp @@ -71,7 +71,7 @@ wxFLAGS_MEMBER(wxBU_BOTTOM) wxFLAGS_MEMBER(wxBU_EXACTFIT) wxEND_FLAGS( wxButtonStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl, "wx/button.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl, "wx/button.h"); wxBEGIN_PROPERTIES_TABLE(wxButton) wxEVENT_PROPERTY( Click, wxEVT_BUTTON, wxCommandEvent ) diff --git a/Externals/wxWidgets3/src/common/cairo.cpp b/Externals/wxWidgets3/src/common/cairo.cpp index a10ca6499f..7d4984efb2 100644 --- a/Externals/wxWidgets3/src/common/cairo.cpp +++ b/Externals/wxWidgets3/src/common/cairo.cpp @@ -166,6 +166,8 @@ (cairo_t *cr, const cairo_matrix_t *matrix), (cr, matrix) ) \ m( cairo_translate, \ (cairo_t *cr, double tx, double ty), (cr, tx, ty) ) \ + m( cairo_surface_flush, \ + (cairo_surface_t *surface), (surface) ) \ #ifdef __WXMAC__ #define wxCAIRO_PLATFORM_METHODS(m) \ @@ -214,6 +216,10 @@ (cairo_format_t format, int width), (format, width), 0) \ m( int, cairo_version, \ (), (), 0) \ + m( int, cairo_image_surface_get_width, \ + (cairo_surface_t *surface), (surface), 0) \ + m( int, cairo_image_surface_get_height, \ + (cairo_surface_t *surface), (surface), 0) \ m( int, cairo_image_surface_get_stride, \ (cairo_surface_t *surface), (surface), 0) \ m( unsigned char *, cairo_image_surface_get_data, \ @@ -222,17 +228,10 @@ (cairo_surface_t *surface), (surface), CAIRO_FORMAT_INVALID) \ m( cairo_surface_type_t, cairo_surface_get_type, \ (cairo_surface_t *surface), (surface), -1) \ + m( const char *, cairo_version_string, \ + (), () , NULL ) \ 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); @@ -259,8 +258,6 @@ private: wxCairo(); ~wxCairo(); - bool IsOk(); - wxDynamicLibrary m_libCairo; wxDynamicLibrary m_libPangoCairo; @@ -350,7 +347,7 @@ wxCairo::~wxCairo() if ( !ms_lib ) { ms_lib = new wxCairo(); - if ( !ms_lib->IsOk() ) + if ( !ms_lib->m_ok ) { delete ms_lib; ms_lib = NULL; @@ -369,11 +366,6 @@ wxCairo::~wxCairo() } } -bool wxCairo::IsOk() -{ - return m_ok; -} - // ============================================================================ // implementation of the functions themselves // ============================================================================ @@ -383,6 +375,7 @@ bool wxCairoInit() return wxCairo::Initialize(); } +#ifndef __WXGTK__ extern "C" { @@ -399,12 +392,12 @@ extern "C" // 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" +#endif // !__WXGTK__ //---------------------------------------------------------------------------- // wxCairoModule @@ -414,11 +407,11 @@ class wxCairoModule : public wxModule { public: wxCairoModule() { } - virtual bool OnInit(); - virtual void OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxCairoModule) + wxDECLARE_DYNAMIC_CLASS(wxCairoModule); }; bool wxCairoModule::OnInit() @@ -431,6 +424,6 @@ void wxCairoModule::OnExit() wxCairo::CleanUp(); } -IMPLEMENT_DYNAMIC_CLASS(wxCairoModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxCairoModule, wxModule); #endif // wxUSE_CAIRO diff --git a/Externals/wxWidgets3/src/common/calctrlcmn.cpp b/Externals/wxWidgets3/src/common/calctrlcmn.cpp index 2b869127b2..5ab2542251 100644 --- a/Externals/wxWidgets3/src/common/calctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/calctrlcmn.cpp @@ -18,7 +18,7 @@ #if wxUSE_CALENDARCTRL || wxUSE_DATEPICKCTRL || wxUSE_TIMEPICKCTRL #include "wx/dateevt.h" -IMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxDateEvent, wxCommandEvent); wxDEFINE_EVENT(wxEVT_DATE_CHANGED, wxDateEvent); wxDEFINE_EVENT(wxEVT_TIME_CHANGED, wxDateEvent); @@ -72,7 +72,7 @@ wxFLAGS_MEMBER(wxCAL_SHOW_SURROUNDING_WEEKS) wxEND_FLAGS( wxCalendarCtrlStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCalendarCtrl, wxControl, "wx/calctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCalendarCtrl, wxControl, "wx/calctrl.h"); wxBEGIN_PROPERTIES_TABLE(wxCalendarCtrl) wxEVENT_RANGE_PROPERTY( Updated, wxEVT_CALENDAR_SEL_CHANGED, \ @@ -96,7 +96,7 @@ wxCONSTRUCTOR_6( wxCalendarCtrl, wxWindow*, Parent, wxWindowID, Id, \ // ---------------------------------------------------------------------------- // events // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxDateEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxCalendarEvent, wxDateEvent); wxDEFINE_EVENT( wxEVT_CALENDAR_SEL_CHANGED, wxCalendarEvent ); wxDEFINE_EVENT( wxEVT_CALENDAR_PAGE_CHANGED, wxCalendarEvent ); diff --git a/Externals/wxWidgets3/src/common/checkboxcmn.cpp b/Externals/wxWidgets3/src/common/checkboxcmn.cpp index b31d85338d..f081665877 100644 --- a/Externals/wxWidgets3/src/common/checkboxcmn.cpp +++ b/Externals/wxWidgets3/src/common/checkboxcmn.cpp @@ -64,7 +64,7 @@ wxBEGIN_FLAGS( wxCheckBoxStyle ) wxEND_FLAGS( wxCheckBoxStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl, "wx/checkbox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl, "wx/checkbox.h"); wxBEGIN_PROPERTIES_TABLE(wxCheckBox) wxEVENT_PROPERTY( Click, wxEVT_CHECKBOX, wxCommandEvent ) diff --git a/Externals/wxWidgets3/src/common/checklstcmn.cpp b/Externals/wxWidgets3/src/common/checklstcmn.cpp index be56ca3e17..58758ecfa3 100644 --- a/Externals/wxWidgets3/src/common/checklstcmn.cpp +++ b/Externals/wxWidgets3/src/common/checklstcmn.cpp @@ -83,7 +83,7 @@ wxBEGIN_FLAGS( wxCheckListBoxStyle ) wxEND_FLAGS( wxCheckListBoxStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox, "wx/checklst.h"); wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) wxEVENT_PROPERTY( Toggle, wxEVT_CHECKLISTBOX, wxCommandEvent ) diff --git a/Externals/wxWidgets3/src/common/choiccmn.cpp b/Externals/wxWidgets3/src/common/choiccmn.cpp index 6ac940b424..7018527266 100644 --- a/Externals/wxWidgets3/src/common/choiccmn.cpp +++ b/Externals/wxWidgets3/src/common/choiccmn.cpp @@ -66,7 +66,7 @@ wxFLAGS_MEMBER(wxHSCROLL) wxEND_FLAGS( wxChoiceStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h"); wxBEGIN_PROPERTIES_TABLE(wxChoice) wxEVENT_PROPERTY( Select, wxEVT_CHOICE, wxCommandEvent ) diff --git a/Externals/wxWidgets3/src/common/clipcmn.cpp b/Externals/wxWidgets3/src/common/clipcmn.cpp index b108944252..bea674f526 100644 --- a/Externals/wxWidgets3/src/common/clipcmn.cpp +++ b/Externals/wxWidgets3/src/common/clipcmn.cpp @@ -36,7 +36,7 @@ // wxClipboardEvent // --------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxClipboardEvent,wxEvent); wxDEFINE_EVENT( wxEVT_CLIPBOARD_CHANGED, wxClipboardEvent ); @@ -99,13 +99,13 @@ bool wxClipboardBase::IsSupportedAsync( wxEvtHandler *sink ) class wxClipboardModule : public wxModule { public: - bool OnInit() { return true; } - void OnExit() { wxDELETE(gs_clipboard); } + bool OnInit() wxOVERRIDE { return true; } + void OnExit() wxOVERRIDE { wxDELETE(gs_clipboard); } private: - DECLARE_DYNAMIC_CLASS(wxClipboardModule) + wxDECLARE_DYNAMIC_CLASS(wxClipboardModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxClipboardModule, wxModule); #endif // wxUSE_CLIPBOARD diff --git a/Externals/wxWidgets3/src/common/clrpickercmn.cpp b/Externals/wxWidgets3/src/common/clrpickercmn.cpp index 8320178596..6f5f118c93 100644 --- a/Externals/wxWidgets3/src/common/clrpickercmn.cpp +++ b/Externals/wxWidgets3/src/common/clrpickercmn.cpp @@ -39,8 +39,8 @@ const char wxColourPickerWidgetNameStr[] = "colourpickerwidget"; // ============================================================================ wxDEFINE_EVENT(wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent); -IMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrl, wxPickerBase) -IMPLEMENT_DYNAMIC_CLASS(wxColourPickerEvent, wxEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourPickerCtrl, wxPickerBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxColourPickerEvent, wxEvent); // ---------------------------------------------------------------------------- // wxColourPickerCtrl diff --git a/Externals/wxWidgets3/src/common/cmdline.cpp b/Externals/wxWidgets3/src/common/cmdline.cpp index e8892831ac..6d452e19a1 100644 --- a/Externals/wxWidgets3/src/common/cmdline.cpp +++ b/Externals/wxWidgets3/src/common/cmdline.cpp @@ -64,87 +64,26 @@ static wxString GetLongOptionName(wxString::const_iterator p, // private structs // ---------------------------------------------------------------------------- -// an internal representation of an option -struct wxCmdLineOption + +class wxCmdLineArgImpl: public wxCmdLineArg { - wxCmdLineOption(wxCmdLineEntryType k, - const wxString& shrt, - const wxString& lng, - const wxString& desc, - wxCmdLineParamType typ, - int fl) - { - // wxCMD_LINE_USAGE_TEXT uses only description, shortName and longName is empty - if ( k != wxCMD_LINE_USAGE_TEXT ) - { - wxASSERT_MSG - ( - !shrt.empty() || !lng.empty(), - wxT("option should have at least one name") - ); +public: + wxCmdLineArgImpl(wxCmdLineEntryType k, + const wxString& shrt, + const wxString& lng, + wxCmdLineParamType typ); - wxASSERT_MSG - ( - GetShortOptionName(shrt.begin(), shrt.end()).Len() == shrt.Len(), - wxT("Short option contains invalid characters") - ); - - wxASSERT_MSG - ( - GetLongOptionName(lng.begin(), lng.end()).Len() == lng.Len(), - wxT("Long option contains invalid characters") - ); - } - - kind = k; - - shortName = shrt; - longName = lng; - description = desc; - - type = typ; - flags = fl; - - Reset(); - } - - // can't use union easily here, so just store all possible data fields, we - // don't waste much (might still use union later if the number of supported - // types increases, so always use the accessor functions and don't access - // the fields directly!) - - void Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const - { - wxASSERT_MSG( type == typ, wxT("type mismatch in wxCmdLineOption") ); - } - - double GetDoubleVal() const - { Check(wxCMD_LINE_VAL_DOUBLE); return m_doubleVal; } - long GetLongVal() const - { Check(wxCMD_LINE_VAL_NUMBER); return m_longVal; } - const wxString& GetStrVal() const - { Check(wxCMD_LINE_VAL_STRING); return m_strVal; } + wxCmdLineArgImpl& SetDoubleVal(double val); + wxCmdLineArgImpl& SetLongVal(long val); + wxCmdLineArgImpl& SetStrVal(const wxString& val); #if wxUSE_DATETIME - const wxDateTime& GetDateVal() const - { Check(wxCMD_LINE_VAL_DATE); return m_dateVal; } + wxCmdLineArgImpl& SetDateVal(const wxDateTime& val); #endif // wxUSE_DATETIME - void SetDoubleVal(double val) - { Check(wxCMD_LINE_VAL_DOUBLE); m_doubleVal = val; m_hasVal = true; } - void SetLongVal(long val) - { Check(wxCMD_LINE_VAL_NUMBER); m_longVal = val; m_hasVal = true; } - void SetStrVal(const wxString& val) - { Check(wxCMD_LINE_VAL_STRING); m_strVal = val; m_hasVal = true; } -#if wxUSE_DATETIME - void SetDateVal(const wxDateTime& val) - { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; } -#endif // wxUSE_DATETIME - - void SetHasValue() { m_hasVal = true; } bool HasValue() const { return m_hasVal; } + wxCmdLineArgImpl& SetHasValue() { m_hasVal = true; return *this; } - void SetNegated() { m_isNegated = true; } - bool IsNegated() const { return m_isNegated; } + wxCmdLineArgImpl& SetNegated() { m_isNegated = true; return *this; } // Reset to the initial state, called before parsing another command line. void Reset() @@ -156,12 +95,45 @@ struct wxCmdLineOption public: wxCmdLineEntryType kind; wxString shortName, - longName, - description; + longName; wxCmdLineParamType type; - int flags; + + // from wxCmdLineArg + virtual wxCmdLineEntryType GetKind() const wxOVERRIDE { return kind; } + virtual wxString GetShortName() const wxOVERRIDE { + wxASSERT_MSG( kind == wxCMD_LINE_OPTION || kind == wxCMD_LINE_SWITCH, + wxT("kind mismatch in wxCmdLineArg") ); + return shortName; + } + virtual wxString GetLongName() const wxOVERRIDE { + wxASSERT_MSG( kind == wxCMD_LINE_OPTION || kind == wxCMD_LINE_SWITCH, + wxT("kind mismatch in wxCmdLineArg") ); + return longName; + } + virtual wxCmdLineParamType GetType() const wxOVERRIDE { + wxASSERT_MSG( kind == wxCMD_LINE_OPTION, + wxT("kind mismatch in wxCmdLineArg") ); + return type; + } + double GetDoubleVal() const wxOVERRIDE; + long GetLongVal() const wxOVERRIDE; + const wxString& GetStrVal() const wxOVERRIDE; +#if wxUSE_DATETIME + const wxDateTime& GetDateVal() const wxOVERRIDE; +#endif // wxUSE_DATETIME + bool IsNegated() const wxOVERRIDE { + wxASSERT_MSG( kind == wxCMD_LINE_SWITCH, + wxT("kind mismatch in wxCmdLineArg") ); + return m_isNegated; + } private: + // can't use union easily here, so just store all possible data fields, we + // don't waste much (might still use union later if the number of supported + // types increases) + + void Check(wxCmdLineParamType typ) const; + bool m_hasVal; bool m_isNegated; @@ -171,6 +143,27 @@ private: #if wxUSE_DATETIME wxDateTime m_dateVal; #endif // wxUSE_DATETIME + +}; + +// an internal representation of an option +struct wxCmdLineOption: public wxCmdLineArgImpl +{ + wxCmdLineOption(wxCmdLineEntryType k, + const wxString& shrt, + const wxString& lng, + const wxString& desc, + wxCmdLineParamType typ, + int fl) + : wxCmdLineArgImpl(k, shrt, lng, typ) + { + description = desc; + + flags = fl; + } + + wxString description; + int flags; }; struct wxCmdLineParam @@ -191,11 +184,13 @@ struct wxCmdLineParam WX_DECLARE_OBJARRAY(wxCmdLineOption, wxArrayOptions); WX_DECLARE_OBJARRAY(wxCmdLineParam, wxArrayParams); +WX_DECLARE_OBJARRAY(wxCmdLineArgImpl, wxArrayArgs); #include "wx/arrimpl.cpp" WX_DEFINE_OBJARRAY(wxArrayOptions) WX_DEFINE_OBJARRAY(wxArrayParams) +WX_DEFINE_OBJARRAY(wxArrayArgs) // the parser internal state struct wxCmdLineParserData @@ -210,6 +205,7 @@ struct wxCmdLineParserData wxArrayOptions m_options; // all possible options and switches wxArrayParams m_paramDesc; // description of all possible params wxArrayString m_parameters; // all params found + wxArrayArgs m_parsedArguments; // all options and parameters in parsing order // methods wxCmdLineParserData(); @@ -222,12 +218,178 @@ struct wxCmdLineParserData int FindOption(const wxString& name); int FindOptionByLongName(const wxString& name); + + // Find the option by either its short or long name. + // + // Asserts and returns NULL if option with this name is not found. + const wxCmdLineOption* FindOptionByAnyName(const wxString& name); }; // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxCmdLineArg +// ---------------------------------------------------------------------------- + +wxCmdLineArgImpl::wxCmdLineArgImpl(wxCmdLineEntryType k, + const wxString& shrt, + const wxString& lng, + wxCmdLineParamType typ) +{ + // wxCMD_LINE_USAGE_TEXT uses only description, shortName and longName is empty + if ( k != wxCMD_LINE_USAGE_TEXT && k != wxCMD_LINE_PARAM) + { + wxASSERT_MSG + ( + !shrt.empty() || !lng.empty(), + wxT("option should have at least one name") + ); + + wxASSERT_MSG + ( + GetShortOptionName(shrt.begin(), shrt.end()).Len() == shrt.Len(), + wxT("Short option contains invalid characters") + ); + + wxASSERT_MSG + ( + GetLongOptionName(lng.begin(), lng.end()).Len() == lng.Len(), + wxT("Long option contains invalid characters") + ); + } + + kind = k; + + shortName = shrt; + longName = lng; + + type = typ; + + Reset(); +} + +void wxCmdLineArgImpl::Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const +{ + // NB: Type is always wxCMD_LINE_VAL_NONE for booleans, so mismatch between + // switches / options / params is well checked by this test + // The parameters have type == wxCMD_LINE_VAL_STRING and thus can be + // retrieved only by GetStrVal() + wxASSERT_MSG( type == typ, wxT("type mismatch in wxCmdLineArg") ); +} + +double wxCmdLineArgImpl::GetDoubleVal() const +{ + Check(wxCMD_LINE_VAL_DOUBLE); + return m_doubleVal; +} + +long wxCmdLineArgImpl::GetLongVal() const +{ + Check(wxCMD_LINE_VAL_NUMBER); + return m_longVal; +} + +const wxString& wxCmdLineArgImpl::GetStrVal() const +{ + Check(wxCMD_LINE_VAL_STRING); + return m_strVal; +} + +#if wxUSE_DATETIME +const wxDateTime& wxCmdLineArgImpl::GetDateVal() const +{ + Check(wxCMD_LINE_VAL_DATE); + return m_dateVal; +} +#endif // wxUSE_DATETIME + +wxCmdLineArgImpl& wxCmdLineArgImpl::SetDoubleVal(double val) +{ + Check(wxCMD_LINE_VAL_DOUBLE); + m_doubleVal = val; + m_hasVal = true; + return *this; +} + +wxCmdLineArgImpl& wxCmdLineArgImpl::SetLongVal(long val) +{ + Check(wxCMD_LINE_VAL_NUMBER); + m_longVal = val; + m_hasVal = true; + return *this; +} + +wxCmdLineArgImpl& wxCmdLineArgImpl::SetStrVal(const wxString& val) +{ + Check(wxCMD_LINE_VAL_STRING); + m_strVal = val; + m_hasVal = true; + return *this; +} + +#if wxUSE_DATETIME +wxCmdLineArgImpl& wxCmdLineArgImpl::SetDateVal(const wxDateTime& val) +{ + Check(wxCMD_LINE_VAL_DATE); + m_dateVal = val; + m_hasVal = true; + return *this; +} +#endif // wxUSE_DATETIME + +// ---------------------------------------------------------------------------- +// wxCmdLineArgsArrayRef +// ---------------------------------------------------------------------------- + +size_t wxCmdLineArgs::size() const +{ + return m_parser.m_data->m_parsedArguments.GetCount(); +} + +// ---------------------------------------------------------------------------- +// wxCmdLineArgsArrayRef::const_iterator +// ---------------------------------------------------------------------------- + +wxCmdLineArgs::const_iterator::reference + wxCmdLineArgs::const_iterator::operator *() const +{ + return m_parser->m_data->m_parsedArguments[m_index]; +} + +wxCmdLineArgs::const_iterator::pointer + wxCmdLineArgs::const_iterator::operator ->() const +{ + return &**this; +} + +wxCmdLineArgs::const_iterator &wxCmdLineArgs::const_iterator::operator ++ () +{ + ++m_index; + return *this; +} + +wxCmdLineArgs::const_iterator wxCmdLineArgs::const_iterator::operator ++ (int) +{ + wxCmdLineArgs::const_iterator tmp(*this); + ++*this; + return tmp; +} + +wxCmdLineArgs::const_iterator &wxCmdLineArgs::const_iterator::operator -- () +{ + --m_index; + return *this; +} + +wxCmdLineArgs::const_iterator wxCmdLineArgs::const_iterator::operator -- (int) +{ + wxCmdLineArgs::const_iterator tmp(*this); + --*this; + return tmp; +} + // ---------------------------------------------------------------------------- // wxCmdLineParserData // ---------------------------------------------------------------------------- @@ -267,7 +429,8 @@ void wxCmdLineParserData::SetArguments(int argc, char **argv) // temporarily change the locale here. The only drawback is that changing // the locale is thread-unsafe but precisely because we're called so early // it's hopefully safe to assume that no other threads had been created yet. - char * const locOld = SetAllLocaleFacets(""); + char * const locOld = SetAllLocaleFacets(NULL); + SetAllLocaleFacets(""); wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld ); for ( int n = 0; n < argc; n++ ) @@ -351,6 +514,24 @@ int wxCmdLineParserData::FindOptionByLongName(const wxString& name) return wxNOT_FOUND; } +const wxCmdLineOption* +wxCmdLineParserData::FindOptionByAnyName(const wxString& name) +{ + int i = FindOption(name); + if ( i == wxNOT_FOUND ) + { + i = FindOptionByLongName(name); + + if ( i == wxNOT_FOUND ) + { + wxFAIL_MSG( wxS("Unknown option ") + name ); + return NULL; + } + } + + return &m_options[(size_t)i]; +} + // ---------------------------------------------------------------------------- // construction and destruction // ---------------------------------------------------------------------------- @@ -446,7 +627,7 @@ void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc) default: wxFAIL_MSG( wxT("unknown command line entry type") ); - // still fall through + wxFALLTHROUGH; case wxCMD_LINE_NONE: return; @@ -529,77 +710,59 @@ void wxCmdLineParser::AddUsageText(const wxString& text) bool wxCmdLineParser::Found(const wxString& name) const { - return FoundSwitch(name) != wxCMD_SWITCH_NOT_FOUND; + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); + + return opt && opt->HasValue(); } wxCmdLineSwitchState wxCmdLineParser::FoundSwitch(const wxString& name) const { - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); - wxCHECK_MSG( i != wxNOT_FOUND, wxCMD_SWITCH_NOT_FOUND, wxT("unknown switch") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) + if ( !opt || !opt->HasValue() ) return wxCMD_SWITCH_NOT_FOUND; - return opt.IsNegated() ? wxCMD_SWITCH_OFF : wxCMD_SWITCH_ON; + return opt->IsNegated() ? wxCMD_SWITCH_OFF : wxCMD_SWITCH_ON; } bool wxCmdLineParser::Found(const wxString& name, wxString *value) const { - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) + if ( !opt || !opt->HasValue() ) return false; wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); - *value = opt.GetStrVal(); + *value = opt->GetStrVal(); return true; } bool wxCmdLineParser::Found(const wxString& name, long *value) const { - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) + if ( !opt || !opt->HasValue() ) return false; wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); - *value = opt.GetLongVal(); + *value = opt->GetLongVal(); return true; } bool wxCmdLineParser::Found(const wxString& name, double *value) const { - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) + if ( !opt || !opt->HasValue() ) return false; wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); - *value = opt.GetDoubleVal(); + *value = opt->GetDoubleVal(); return true; } @@ -607,19 +770,14 @@ bool wxCmdLineParser::Found(const wxString& name, double *value) const #if wxUSE_DATETIME bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const { - int i = m_data->FindOption(name); - if ( i == wxNOT_FOUND ) - i = m_data->FindOptionByLongName(name); + const wxCmdLineOption* const opt = m_data->FindOptionByAnyName(name); - wxCHECK_MSG( i != wxNOT_FOUND, false, wxT("unknown option") ); - - wxCmdLineOption& opt = m_data->m_options[(size_t)i]; - if ( !opt.HasValue() ) + if ( !opt || !opt->HasValue() ) return false; wxCHECK_MSG( value, false, wxT("NULL pointer in wxCmdLineOption::Found") ); - *value = opt.GetDateVal(); + *value = opt->GetDateVal(); return true; } @@ -644,6 +802,8 @@ void wxCmdLineParser::Reset() { m_data->m_options[i].Reset(); } + + m_data->m_parsedArguments.Empty(); } @@ -666,6 +826,7 @@ int wxCmdLineParser::Parse(bool showUsage) Reset(); // parse everything + m_data->m_parameters.clear(); wxString arg; size_t count = m_data->m_arguments.size(); for ( size_t n = 1; ok && (n < count); n++ ) // 0 is program name @@ -682,9 +843,13 @@ int wxCmdLineParser::Parse(bool showUsage) continue; } #ifdef __WXOSX__ - if ( arg == wxT("-ApplePersistenceIgnoreState") ) + if ( arg == wxS("-ApplePersistenceIgnoreState") || + arg == wxS("-AppleTextDirection") || + arg == wxS("-AppleLocale") || + arg == wxS("-AppleLanguages") ) { maybeOption = false; + n++; continue; } @@ -930,7 +1095,7 @@ int wxCmdLineParser::Parse(bool showUsage) { default: wxFAIL_MSG( wxT("unknown option type") ); - // still fall through + wxFALLTHROUGH; case wxCMD_LINE_VAL_STRING: opt.SetStrVal(value); @@ -995,6 +1160,9 @@ int wxCmdLineParser::Parse(bool showUsage) } } } + + if (ok) + m_data->m_parsedArguments.push_back (opt); } else // not an option, must be a parameter { @@ -1005,6 +1173,9 @@ int wxCmdLineParser::Parse(bool showUsage) // TODO check the param type m_data->m_parameters.push_back(arg); + m_data->m_parsedArguments.push_back ( + wxCmdLineArgImpl(wxCMD_LINE_PARAM, wxString(), wxString(), + wxCMD_LINE_VAL_STRING).SetStrVal(arg)); if ( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE) ) { @@ -1305,7 +1476,7 @@ static wxString GetTypeName(wxCmdLineParamType type) { default: wxFAIL_MSG( wxT("unknown option type") ); - // still fall through + wxFALLTHROUGH; case wxCMD_LINE_VAL_STRING: s = _("str"); diff --git a/Externals/wxWidgets3/src/common/cmdproc.cpp b/Externals/wxWidgets3/src/common/cmdproc.cpp index 55107a9d91..09fb2c8478 100644 --- a/Externals/wxWidgets3/src/common/cmdproc.cpp +++ b/Externals/wxWidgets3/src/common/cmdproc.cpp @@ -36,8 +36,8 @@ // implementation // ============================================================================ -IMPLEMENT_CLASS(wxCommand, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject) +wxIMPLEMENT_CLASS(wxCommand, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject); // ---------------------------------------------------------------------------- // wxCommand @@ -333,6 +333,9 @@ bool wxCommandProcessor::IsDirty() const { // We have never been saved, so we are dirty if and only if we have any // commands at all. + // + // NB: The ugly "!!" test is needed to avoid warnings both from MSVC in + // non-STL build and g++ in STL build. return !!m_currentCommand; } diff --git a/Externals/wxWidgets3/src/common/cmndata.cpp b/Externals/wxWidgets3/src/common/cmndata.cpp index 18b2ef927f..f4eff7fb2a 100644 --- a/Externals/wxWidgets3/src/common/cmndata.cpp +++ b/Externals/wxWidgets3/src/common/cmndata.cpp @@ -44,9 +44,9 @@ #include "wx/paper.h" -IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxPrintDialogData, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxPageSetupDialogData, wxObject); // ============================================================================ // implementation diff --git a/Externals/wxWidgets3/src/common/colourcmn.cpp b/Externals/wxWidgets3/src/common/colourcmn.cpp index 12b5f2007c..fb193c3898 100644 --- a/Externals/wxWidgets3/src/common/colourcmn.cpp +++ b/Externals/wxWidgets3/src/common/colourcmn.cpp @@ -75,9 +75,9 @@ wxEMPTY_HANDLERS_TABLE(wxColour) #else #if wxCOLOUR_IS_GDIOBJECT -wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxGDIObject); #else -wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject); #endif #endif @@ -340,21 +340,6 @@ wxColour wxColourBase::ChangeLightness(int ialpha) const return wxColour(r,g,b); } -#if WXWIN_COMPATIBILITY_2_6 - -// static -wxColour wxColourBase::CreateByName(const wxString& name) -{ - return wxColour(name); -} - -void wxColourBase::InitFromName(const wxString& col) -{ - Set(col); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - // wxColour <-> wxString utilities, used by wxConfig wxString wxToString(const wxColourBase& col) { diff --git a/Externals/wxWidgets3/src/common/colourdata.cpp b/Externals/wxWidgets3/src/common/colourdata.cpp index 3569c50514..3ad774195f 100644 --- a/Externals/wxWidgets3/src/common/colourdata.cpp +++ b/Externals/wxWidgets3/src/common/colourdata.cpp @@ -20,11 +20,12 @@ // wxColourData // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject); wxColourData::wxColourData() { m_chooseFull = false; + m_chooseAlpha = false; m_dataColour.Set(0,0,0); // m_custColours are wxNullColours initially } @@ -61,6 +62,7 @@ wxColourData& wxColourData::operator=(const wxColourData& data) m_dataColour = data.m_dataColour; m_chooseFull = data.m_chooseFull; + m_chooseAlpha = data.m_chooseAlpha; return *this; } @@ -85,6 +87,9 @@ wxString wxColourData::ToString() const str += clr.GetAsString(wxC2S_HTML_SYNTAX); } + str.Append(wxCOL_DATA_SEP); + str.Append(m_chooseAlpha ? '1' : '0'); + return str; } @@ -102,6 +107,14 @@ bool wxColourData::FromString(const wxString& str) else success = m_custColours[i].Set(token); } + + if ( success ) + { + token = tokenizer.GetNextToken(); + m_chooseAlpha = token == wxS("1"); + success = m_chooseAlpha || token == wxS("0"); + } + return success; } diff --git a/Externals/wxWidgets3/src/common/combocmn.cpp b/Externals/wxWidgets3/src/common/combocmn.cpp index 82d1657960..d451d68c47 100644 --- a/Externals/wxWidgets3/src/common/combocmn.cpp +++ b/Externals/wxWidgets3/src/common/combocmn.cpp @@ -72,7 +72,7 @@ wxFLAGS_MEMBER(wxCB_DROPDOWN) wxEND_FLAGS( wxComboBoxStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl, "wx/combobox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl, "wx/combobox.h"); wxBEGIN_PROPERTIES_TABLE(wxComboBox) wxEVENT_PROPERTY( Select, wxEVT_COMBOBOX, wxCommandEvent ) @@ -153,7 +153,6 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ // seemed to eliminate the position change). #include "wx/dialog.h" -#define wxCC_GENERIC_TLW_IS_DIALOG #define wxComboCtrlGenericTLW wxDialog #if defined(__WXGTK20__) @@ -194,7 +193,6 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #else #include "wx/dialog.h" -#define wxCC_GENERIC_TLW_IS_DIALOG #define wxComboCtrlGenericTLW wxDialog #define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) @@ -207,10 +205,10 @@ wxCONSTRUCTOR_5( wxComboBox, wxWindow*, Parent, wxWindowID, Id, \ #endif -// Popupwin is really only supported on wxMSW (not WINCE) and wxGTK, regardless +// Popupwin is really only supported on wxMSW and wxGTK, regardless // what the wxUSE_POPUPWIN says. // FIXME: Why isn't wxUSE_POPUPWIN reliable any longer? (it was in wxW2.6.2) -#if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) || defined(__WXWINCE__) +#if (!defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMAC__)) #undef wxUSE_POPUPWIN #define wxUSE_POPUPWIN 0 #endif @@ -355,10 +353,10 @@ protected: wxComboCtrlBase* m_combo; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxComboFrameEventHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxComboFrameEventHandler, wxEvtHandler) EVT_IDLE(wxComboFrameEventHandler::OnIdle) EVT_LEFT_DOWN(wxComboFrameEventHandler::OnMouseEvent) EVT_RIGHT_DOWN(wxComboFrameEventHandler::OnMouseEvent) @@ -368,7 +366,7 @@ BEGIN_EVENT_TABLE(wxComboFrameEventHandler, wxEvtHandler) EVT_MENU_OPEN(wxComboFrameEventHandler::OnMenuEvent) EVT_ACTIVATE(wxComboFrameEventHandler::OnActivate) EVT_CLOSE(wxComboFrameEventHandler::OnClose) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxComboFrameEventHandler::wxComboFrameEventHandler( wxComboCtrlBase* combo ) : wxEvtHandler() @@ -473,10 +471,10 @@ public: } #if USES_WXPOPUPTRANSIENTWINDOW - virtual bool Show( bool show ); - virtual bool ProcessLeftDown(wxMouseEvent& event); + virtual bool Show( bool show ) wxOVERRIDE; + virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE; protected: - virtual void OnDismiss(); + virtual void OnDismiss() wxOVERRIDE; #endif private: @@ -522,7 +520,7 @@ void wxComboPopupWindow::OnDismiss() { wxComboCtrlBase* combo = (wxComboCtrlBase*) GetParent(); wxASSERT_MSG( wxDynamicCast(combo, wxComboCtrlBase), - wxT("parent might not be wxComboCtrl, but check IMPLEMENT_DYNAMIC_CLASS(2) macro for correctness") ); + wxT("parent might not be wxComboCtrl, but check wxIMPLEMENT_DYNAMIC_CLASS2() macro for correctness") ); combo->OnPopupDismiss(true); } @@ -553,11 +551,11 @@ public: private: wxComboCtrlBase* m_combo; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler) EVT_KEY_DOWN(wxComboPopupWindowEvtHandler::OnKeyEvent) EVT_KEY_UP(wxComboPopupWindowEvtHandler::OnKeyEvent) EVT_CHAR(wxComboPopupWindowEvtHandler::OnKeyEvent) @@ -565,7 +563,7 @@ BEGIN_EVENT_TABLE(wxComboPopupWindowEvtHandler, wxEvtHandler) EVT_ACTIVATE(wxComboPopupWindowEvtHandler::OnActivate) #endif EVT_SIZE(wxComboPopupWindowEvtHandler::OnSizeEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxComboPopupWindowEvtHandler::OnSizeEvent( wxSizeEvent& WXUNUSED(event) ) @@ -729,17 +727,17 @@ protected: wxComboCtrlBase* m_combo; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxComboBoxExtraInputHandler, wxEvtHandler) EVT_KEY_DOWN(wxComboBoxExtraInputHandler::OnKey) EVT_KEY_UP(wxComboBoxExtraInputHandler::OnKey) EVT_CHAR(wxComboBoxExtraInputHandler::OnKey) EVT_SET_FOCUS(wxComboBoxExtraInputHandler::OnFocus) EVT_KILL_FOCUS(wxComboBoxExtraInputHandler::OnFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) @@ -823,13 +821,13 @@ protected: bool m_blockEventsToPopup; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxComboPopupEvtHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxComboPopupEvtHandler, wxEvtHandler) EVT_MOUSE_EVENTS(wxComboPopupEvtHandler::OnMouseEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxComboPopupEvtHandler::OnMouseEvent( wxMouseEvent& event ) @@ -946,7 +944,7 @@ public: wxComboCtrlTextCtrl() : wxTextCtrl() { } virtual ~wxComboCtrlTextCtrl() { } - virtual wxWindow *GetMainWindowOfCompositeControl() + virtual wxWindow *GetMainWindowOfCompositeControl() wxOVERRIDE { wxComboCtrl* combo = (wxComboCtrl*) GetParent(); @@ -962,7 +960,7 @@ public: // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) +wxBEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) EVT_SIZE(wxComboCtrlBase::OnSizeEvent) EVT_SET_FOCUS(wxComboCtrlBase::OnFocusEvent) EVT_KILL_FOCUS(wxComboCtrlBase::OnFocusEvent) @@ -971,10 +969,10 @@ BEGIN_EVENT_TABLE(wxComboCtrlBase, wxControl) EVT_KEY_DOWN(wxComboCtrlBase::OnKeyEvent) EVT_CHAR(wxComboCtrlBase::OnCharEvent) EVT_SYS_COLOUR_CHANGED(wxComboCtrlBase::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl); void wxComboCtrlBase::Init() { @@ -1102,9 +1100,12 @@ wxComboCtrlBase::CreateTextCtrl(int style) m_text->Connect(id, wxEVT_TEXT, wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), NULL, this); - m_text->Connect(id, wxEVT_TEXT_ENTER, - wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), - NULL, this); + if ( style & wxTE_PROCESS_ENTER ) + { + m_text->Connect(id, wxEVT_TEXT_ENTER, + wxCommandEventHandler(wxComboCtrlBase::OnTextCtrlEvent), + NULL, this); + } m_text->SetHint(m_hintText); } @@ -1225,7 +1226,7 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) // Make very small buttons square, as it makes // them accommodate arrow image better and still // looks decent. - if ( height > 18 ) + if ( height > FromDIP(18) ) butWidth = (height*butWidth)/bestHeight; else butWidth = butHeight; @@ -1281,9 +1282,9 @@ void wxComboCtrlBase::CalculateAreas( int btnWidth ) m_btnArea.width = butAreaWid; m_btnArea.height = sz.y - ((btnBorder+FOCUS_RING)*2); - m_tcArea.x = ( m_btnSide==wxRIGHT ? 0 : butAreaWid ) + customBorder + FOCUS_RING; + m_tcArea.x = ( m_btnSide==wxRIGHT ? 0 : butAreaWid ) + customBorder; m_tcArea.y = customBorder + FOCUS_RING; - m_tcArea.width = sz.x - butAreaWid - (customBorder*2) - (FOCUS_RING*2); + m_tcArea.width = sz.x - butAreaWid - (customBorder*2) - FOCUS_RING; m_tcArea.height = sz.y - ((customBorder+FOCUS_RING)*2); /* @@ -1354,9 +1355,11 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust else { // If it has border, have textctrl fill the entire text field. + int w = m_tcArea.width - m_widthCustomPaint; + if (w < 0) w = 0; m_text->SetSize( m_tcArea.x + m_widthCustomPaint, m_tcArea.y, - m_tcArea.width - m_widthCustomPaint, + w, m_tcArea.height ); } } @@ -1391,7 +1394,10 @@ wxSize wxComboCtrlBase::DoGetSizeFromTextSize(int xlen, int ylen) const else { wxComboBox* cb = new wxComboBox; +#ifndef __WXGTK3__ + // GTK3 returns zero for the preferred size of a hidden widget cb->Hide(); +#endif cb->Create(const_cast(this), wxID_ANY); if ( m_font.IsOk() ) cb->SetFont(m_font); @@ -1915,7 +1921,7 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event, bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, int WXUNUSED(flags) ) { - wxLongLong t = ::wxGetLocalTimeMillis(); + wxMilliClock_t t = ::wxGetLocalTimeMillis(); int evtType = event.GetEventType(); #if USES_WXPOPUPWINDOW || USES_GENERICTLW @@ -2070,19 +2076,16 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event) void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) { - // On Mac, setting focus here leads to infinite recursion and eventually - // a crash due to the SetFocus call producing another event. - // Handle Mac in OnIdleEvent using m_resetFocus. + // On Mac, setting focus here led to infinite recursion so + // m_resetFocus is used as a guard if ( event.GetEventType() == wxEVT_SET_FOCUS ) { - if ( GetTextCtrl() && !GetTextCtrl()->HasFocus() ) + if ( !m_resetFocus && GetTextCtrl() && !GetTextCtrl()->HasFocus() ) { -#ifdef __WXMAC__ m_resetFocus = true; -#else GetTextCtrl()->SetFocus(); -#endif + m_resetFocus = false; } } @@ -2438,10 +2441,28 @@ void wxComboCtrlBase::ShowPopup() } } + +#ifdef __WXMAC__ +bool wxComboCtrlBase::AnimateShow( const wxRect& rect, int WXUNUSED(flags) ) +{ + // Overridden AnimateShow() will call Raise() and ShowWithEffect() so do + // here to avoid duplication. Raise and Show are needed for some contained + // control's scrollbars, selection highlights, hit-test accuracy and popup + // close via left mousedown when the mouse is not over the parent app. + if ( GetPopupWindow() ) + { + GetPopupWindow()->SetSize(rect); + GetPopupWindow()->Raise(); + GetPopupWindow()->Show(); + } + return true; +} +#else bool wxComboCtrlBase::AnimateShow( const wxRect& WXUNUSED(rect), int WXUNUSED(flags) ) { return true; } +#endif void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) ) { @@ -2466,11 +2487,16 @@ void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) ) m_popupWinState = Visible; // If popup window was a generic top-level window, or the - // wxPopupWindow implemenation on this platform is classified as + // wxPopupWindow implementation on this platform is classified as // perfect, then we should be able to safely set focus to the popup // control. + // In x11 backend, popup window neither generic top-level nor + // perfect native window. So shouldn't be set focus to the popup control + // same in the OnPopupDismiss function. +#if !defined(__WXX11__) if ( IsPopupWinTypePerfect(m_popupWinType) ) m_popup->SetFocus(); +#endif } else if ( IsPopupWindowState(Hidden) ) { @@ -2535,7 +2561,9 @@ void wxComboCtrlBase::OnPopupDismiss(bool generateEvent) // refresh control (necessary even if m_text) Refresh(); +#if !defined(__WXX11__) SetFocus(); +#endif if ( generateEvent ) { diff --git a/Externals/wxWidgets3/src/common/config.cpp b/Externals/wxWidgets3/src/common/config.cpp index 852dd13f17..c4382ef656 100644 --- a/Externals/wxWidgets3/src/common/config.cpp +++ b/Externals/wxWidgets3/src/common/config.cpp @@ -72,7 +72,7 @@ wxConfigBase *wxAppTraitsBase::CreateConfig() // ---------------------------------------------------------------------------- // wxConfigBase // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxConfigBase, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxConfigBase, wxObject); // Not all args will always be used by derived classes, but including them all // in each class ensures compatibility. @@ -436,9 +436,6 @@ wxString wxExpandEnvVars(const wxString& str) wxString strVarName(str.c_str() + n + 1, m - n - 1); -#ifdef __WXWINCE__ - const bool expanded = false; -#else // NB: use wxGetEnv instead of wxGetenv as otherwise variables // set through wxSetEnv may not be read correctly! bool expanded = false; @@ -449,7 +446,6 @@ wxString wxExpandEnvVars(const wxString& str) expanded = true; } else -#endif { // variable doesn't exist => don't change anything #ifdef __WINDOWS__ @@ -494,7 +490,7 @@ wxString wxExpandEnvVars(const wxString& str) break; } - //else: fall through + wxFALLTHROUGH; default: strResult += str[n]; diff --git a/Externals/wxWidgets3/src/common/containr.cpp b/Externals/wxWidgets3/src/common/containr.cpp index 50bbd6aefa..c663417043 100644 --- a/Externals/wxWidgets3/src/common/containr.cpp +++ b/Externals/wxWidgets3/src/common/containr.cpp @@ -505,7 +505,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // 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() ) + if ( focusedParent->IsTopNavigationDomain(wxWindow::Navigation_Tab) ) break; event.SetCurrentFocus( focusedParent ); diff --git a/Externals/wxWidgets3/src/common/cshelp.cpp b/Externals/wxWidgets3/src/common/cshelp.cpp index 26484e26a2..67e7860947 100644 --- a/Externals/wxWidgets3/src/common/cshelp.cpp +++ b/Externals/wxWidgets3/src/common/cshelp.cpp @@ -52,7 +52,7 @@ public: m_contextHelp = contextHelp; } - virtual bool ProcessEvent(wxEvent& event); + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; //// Data wxContextHelp* m_contextHelp; @@ -73,7 +73,7 @@ public: */ -IMPLEMENT_DYNAMIC_CLASS(wxContextHelp, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxContextHelp, wxObject); wxContextHelp::wxContextHelp(wxWindow* win, bool beginHelp) { @@ -250,8 +250,6 @@ bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) * to put the application into context help mode. */ -#ifndef __WXPM__ - static const char * csquery_xpm[] = { "12 11 2 1", " c None", @@ -268,29 +266,22 @@ static const char * csquery_xpm[] = { " .. ", " "}; -#endif -IMPLEMENT_CLASS(wxContextHelpButton, wxBitmapButton) +wxIMPLEMENT_CLASS(wxContextHelpButton, wxBitmapButton); -BEGIN_EVENT_TABLE(wxContextHelpButton, wxBitmapButton) +wxBEGIN_EVENT_TABLE(wxContextHelpButton, wxBitmapButton) EVT_BUTTON(wxID_CONTEXT_HELP, wxContextHelpButton::OnContextHelp) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -wxContextHelpButton::wxContextHelpButton(wxWindow* parent, +bool wxContextHelpButton::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) -#if defined(__WXPM__) - : wxBitmapButton(parent, id, wxBitmap(wxCSQUERY_BITMAP - ,wxBITMAP_TYPE_BMP_RESOURCE - ), - pos, size, style) -#else - : wxBitmapButton(parent, id, wxBitmap(csquery_xpm), - pos, size, style) -#endif { + return wxBitmapButton::Create(parent, id, + wxBitmap(csquery_xpm), + pos, size, style); } void wxContextHelpButton::OnContextHelp(wxCommandEvent& WXUNUSED(event)) @@ -481,14 +472,14 @@ wxString wxContextId(int id) class wxHelpProviderModule : public wxModule { public: - bool OnInit(); - void OnExit(); + bool OnInit() wxOVERRIDE; + void OnExit() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxHelpProviderModule) + wxDECLARE_DYNAMIC_CLASS(wxHelpProviderModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxHelpProviderModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxHelpProviderModule, wxModule); bool wxHelpProviderModule::OnInit() { diff --git a/Externals/wxWidgets3/src/common/ctrlcmn.cpp b/Externals/wxWidgets3/src/common/ctrlcmn.cpp index dbfbc9f700..84c13bc238 100644 --- a/Externals/wxWidgets3/src/common/ctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/ctrlcmn.cpp @@ -520,6 +520,9 @@ wxString wxControlBase::Ellipsize(const wxString& label, const wxDC& dc, wxEllipsizeMode mode, int maxFinalWidth, int flags) { + if (mode == wxELLIPSIZE_NONE) + return label; + wxString ret; // these cannot be cached between different Ellipsize() calls as they can diff --git a/Externals/wxWidgets3/src/common/ctrlsub.cpp b/Externals/wxWidgets3/src/common/ctrlsub.cpp index 7bf15a9295..afba9ce85b 100644 --- a/Externals/wxWidgets3/src/common/ctrlsub.cpp +++ b/Externals/wxWidgets3/src/common/ctrlsub.cpp @@ -30,7 +30,7 @@ #include "wx/arrstr.h" #endif -IMPLEMENT_ABSTRACT_CLASS(wxControlWithItems, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxControlWithItems, wxControl); // ============================================================================ // wxItemContainerImmutable implementation @@ -255,7 +255,7 @@ void wxItemContainer::AssignNewItemClientData(unsigned int pos, default: wxFAIL_MSG( wxT("unknown client data type") ); - // fall through + wxFALLTHROUGH; case wxClientData_None: // nothing to do diff --git a/Externals/wxWidgets3/src/common/datavcmn.cpp b/Externals/wxWidgets3/src/common/datavcmn.cpp index fd7412117a..6775d5fc53 100644 --- a/Externals/wxWidgets3/src/common/datavcmn.cpp +++ b/Externals/wxWidgets3/src/common/datavcmn.cpp @@ -29,6 +29,7 @@ #include "wx/spinctrl.h" #include "wx/choice.h" #include "wx/imaglist.h" +#include "wx/renderer.h" const char wxDataViewCtrlNameStr[] = "dataviewCtrl"; @@ -48,7 +49,6 @@ public: m_finished = false; } - void AcceptChangesAndFinish(); void SetFocusOnIdle( bool focus = true ) { m_focusOnIdle = focus; } protected: @@ -64,7 +64,7 @@ private: bool m_focusOnIdle; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; } // anonymous namespace @@ -344,6 +344,7 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem else if (d1 > d2) return 1; } +#if wxUSE_DATETIME else if (value1.GetType() == wxT("datetime")) { wxDateTime dt1 = value1.GetDateTime(); @@ -353,6 +354,7 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem if (dt2.IsEarlierThan(dt1)) return 1; } +#endif // wxUSE_DATETIME else if (value1.GetType() == wxT("bool")) { bool b1 = value1.GetBool(); @@ -636,7 +638,7 @@ unsigned int wxDataViewVirtualListModel::GetChildren( const wxDataViewItem &WXUN // wxDataViewIconText //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDataViewIconText,wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewIconText,wxObject); IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) @@ -644,7 +646,7 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) // wxDataViewRendererBase // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewRendererBase, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewRendererBase, wxObject); wxDataViewRendererBase::wxDataViewRendererBase( const wxString &varianttype, wxDataViewCellMode WXUNUSED(mode), @@ -679,11 +681,8 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la if( !start_event.IsAllowed() ) return false; - m_item = item; // remember for later - unsigned int col = GetOwner()->GetModelColumn(); - wxVariant value; - dv_ctrl->GetModel()->GetValue( value, item, col ); + const wxVariant& value = CheckedGetValue(dv_ctrl->GetModel(), item, col); m_editorCtrl = CreateEditorCtrl( dv_ctrl->GetMainWindow(), labelRect, value ); @@ -702,15 +701,23 @@ bool wxDataViewRendererBase::StartEditing( const wxDataViewItem &item, wxRect la m_editorCtrl->SetFocus(); #endif - // Now we should send Editing Started event + return true; +} + +void wxDataViewRendererBase::NotifyEditingStarted(const wxDataViewItem& item) +{ + // Remember the item being edited for use in FinishEditing() later. + m_item = item; + + wxDataViewColumn* const column = GetOwner(); + wxDataViewCtrl* const dv_ctrl = column->GetOwner(); + wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, dv_ctrl->GetId() ); - event.SetDataViewColumn( GetOwner() ); + event.SetDataViewColumn( column ); event.SetModel( dv_ctrl->GetModel() ); event.SetItem( item ); event.SetEventObject( dv_ctrl ); dv_ctrl->GetEventHandler()->ProcessEvent( event ); - - return true; } void wxDataViewRendererBase::DestroyEditControl() @@ -744,8 +751,10 @@ bool wxDataViewRendererBase::FinishEditing() if (!m_editorCtrl) return true; + // Try to get the value, normally we should succeed but if we fail, don't + // return immediately, we still need to destroy the edit control. wxVariant value; - GetValueFromEditorCtrl( m_editorCtrl, value ); + const bool gotValue = GetValueFromEditorCtrl(m_editorCtrl, value); wxDataViewCtrl* dv_ctrl = GetOwner()->GetOwner(); @@ -753,6 +762,9 @@ bool wxDataViewRendererBase::FinishEditing() dv_ctrl->GetMainWindow()->SetFocus(); + if ( !gotValue ) + return false; + bool isValid = Validate(value); unsigned int col = GetOwner()->GetModelColumn(); @@ -767,28 +779,85 @@ bool wxDataViewRendererBase::FinishEditing() event.SetEventObject( dv_ctrl ); dv_ctrl->GetEventHandler()->ProcessEvent( event ); + bool accepted = false; if ( isValid && event.IsAllowed() ) { dv_ctrl->GetModel()->ChangeValue(value, m_item, col); - return true; + accepted = true; } - return false; + m_item = wxDataViewItem(); + + return accepted; } -void wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model, - const wxDataViewItem& item, - unsigned column) +wxVariant +wxDataViewRendererBase::CheckedGetValue(const wxDataViewModel* model, + const wxDataViewItem& item, + unsigned column) const { wxVariant value; model->GetValue(value, item, column); + + // We always allow the cell to be null, regardless of the renderer type. + if ( !value.IsNull() ) + { + if ( value.GetType() != GetVariantType() ) + { + // If you're seeing this message, this indicates that either your + // renderer is using the wrong type, or your model returns values + // of the wrong type. + wxLogDebug("Wrong type returned from the model for column %u: " + "%s required but actual type is %s", + column, + GetVariantType(), + value.GetType()); + + // Don't return data of mismatching type, this could be unexpected. + value.MakeNull(); + } + } + + return value; +} + +bool +wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model, + const wxDataViewItem& item, + unsigned column) +{ + // Now check if we have a value and remember it for rendering it later. + // Notice that we do it even if it's null, as the cell should be empty then + // and not show the last used value. + const wxVariant& value = CheckedGetValue(model, item, column); SetValue(value); - wxDataViewItemAttr attr; - model->GetAttr(item, column, attr); - SetAttr(attr); + if ( !value.IsNull() ) + { + // Also set up the attributes for this item if it's not empty. + wxDataViewItemAttr attr; + model->GetAttr(item, column, attr); + SetAttr(attr); + } - SetEnabled(model->IsEnabled(item, column)); + // Finally determine the enabled/disabled state and apply it, even to the + // empty cells. + bool enabled = true; + switch ( GetMode() ) + { + case wxDATAVIEW_CELL_INERT: + enabled = false; + break; + + case wxDATAVIEW_CELL_ACTIVATABLE: + case wxDATAVIEW_CELL_EDITABLE: + enabled = model->IsEnabled(item, column); + break; + } + + SetEnabled(enabled); + + return true; } @@ -921,41 +990,50 @@ wxDataViewCustomRendererBase::RenderText(const wxString& text, int xoffset, wxRect rect, wxDC *dc, - int WXUNUSED(state)) + int state) { wxRect rectText = rect; rectText.x += xoffset; rectText.width -= xoffset; - // check if we want to ellipsize the text if it doesn't fit - wxString ellipsizedText; - if ( GetEllipsizeMode() != wxELLIPSIZE_NONE ) - { - ellipsizedText = wxControl::Ellipsize - ( - text, - *dc, - GetEllipsizeMode(), - rectText.width, - wxELLIPSIZE_FLAGS_NONE - ); - } + int flags = 0; + if ( state & wxDATAVIEW_CELL_SELECTED ) + flags |= wxCONTROL_SELECTED | wxCONTROL_FOCUSED; + if ( !GetOwner()->GetOwner()->IsEnabled() ) + flags |= wxCONTROL_DISABLED; - // get the alignment to use - dc->DrawLabel(ellipsizedText.empty() ? text : ellipsizedText, - rectText, GetEffectiveAlignment()); + wxRendererNative::Get().DrawItemText( + GetOwner()->GetOwner(), + *dc, + text, + rectText, + GetEffectiveAlignment(), + flags, + GetEllipsizeMode()); +} + +void wxDataViewCustomRendererBase::SetEnabled(bool enabled) +{ + // The native base renderer needs to know about the enabled state as well + // but in the generic case the base class method is pure, so we can't just + // call it unconditionally. +#ifndef wxHAS_GENERIC_DATAVIEWCTRL + wxDataViewRenderer::SetEnabled(enabled); +#endif // !wxHAS_GENERIC_DATAVIEWCTRL + + m_enabled = enabled; } //----------------------------------------------------------------------------- // wxDataViewEditorCtrlEvtHandler //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxDataViewEditorCtrlEvtHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxDataViewEditorCtrlEvtHandler, wxEvtHandler) EVT_CHAR (wxDataViewEditorCtrlEvtHandler::OnChar) EVT_KILL_FOCUS (wxDataViewEditorCtrlEvtHandler::OnKillFocus) EVT_IDLE (wxDataViewEditorCtrlEvtHandler::OnIdle) EVT_TEXT_ENTER (-1, wxDataViewEditorCtrlEvtHandler::OnTextEnter) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxDataViewEditorCtrlEvtHandler::OnIdle( wxIdleEvent &event ) { @@ -979,17 +1057,20 @@ void wxDataViewEditorCtrlEvtHandler::OnChar( wxKeyEvent &event ) { switch ( event.m_keyCode ) { - case WXK_RETURN: - m_finished = true; - m_owner->FinishEditing(); - break; - case WXK_ESCAPE: - { m_finished = true; m_owner->CancelEditing(); break; - } + + case WXK_RETURN: + if ( !event.HasAnyModifiers() ) + { + m_finished = true; + m_owner->FinishEditing(); + break; + } + wxFALLTHROUGH; // Ctrl/Alt/Shift-Enter is not handled specially + default: event.Skip(); } @@ -1028,7 +1109,7 @@ wxDataViewColumnBase::~wxDataViewColumnBase() // wxDataViewCtrlBase // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewCtrlBase, wxControl); wxDataViewCtrlBase::wxDataViewCtrlBase() { @@ -1123,269 +1204,329 @@ wxDataViewItem wxDataViewCtrlBase::GetSelection() const return selections[0]; } +namespace +{ + +// Helper to account for inconsistent signature of wxDataViewProgressRenderer +// ctor: it takes an extra "label" argument as first parameter, unlike all the +// other renderers. +template +struct RendererFactory +{ + static Renderer* + New(wxDataViewCellMode mode, int align) + { + return new Renderer(Renderer::GetDefaultType(), mode, align); + } +}; + +template <> +struct RendererFactory +{ + static wxDataViewProgressRenderer* + New(wxDataViewCellMode mode, int align) + { + return new wxDataViewProgressRenderer( + wxString(), + wxDataViewProgressRenderer::GetDefaultType(), + mode, + align + ); + } +}; + +template +wxDataViewColumn* +CreateColumnWithRenderer(const LabelType& label, + unsigned model_column, + wxDataViewCellMode mode, + int width, + wxAlignment align, + int flags) +{ + // For compatibility reason, handle wxALIGN_NOT as wxDVR_DEFAULT_ALIGNMENT + // when creating the renderer here because a lot of existing code, + // including our own dataview sample, uses wxALIGN_NOT just because it's + // the default value of the alignment argument in AppendXXXColumn() + // methods, but this doesn't mean that it actually wants to top-align the + // column text. + // + // This does make it impossible to create top-aligned text using these + // functions, but it can always be done by creating the renderer with the + // desired alignment explicitly and should be so rarely needed in practice + // (without speaking that vertical alignment is completely unsupported in + // native OS X version), that it's preferable to do the right thing by + // default here rather than account for it. + return new wxDataViewColumn( + label, + RendererFactory::New( + mode, + align & wxALIGN_BOTTOM + ? align + : align | wxALIGN_CENTRE_VERTICAL + ), + model_column, + width, + align, + flags + ); +} + +// Common implementation of all {Append,Prepend}XXXColumn() below. +template +wxDataViewColumn* +AppendColumnWithRenderer(wxDataViewCtrlBase* dvc, + const LabelType& label, + unsigned model_column, + wxDataViewCellMode mode, + int width, + wxAlignment align, + int flags) +{ + wxDataViewColumn* const + col = CreateColumnWithRenderer( + label, model_column, mode, width, align, flags + ); + + dvc->AppendColumn(col); + return col; +} + +template +wxDataViewColumn* +PrependColumnWithRenderer(wxDataViewCtrlBase* dvc, + const LabelType& label, + unsigned model_column, + wxDataViewCellMode mode, + int width, + wxAlignment align, + int flags) +{ + wxDataViewColumn* const + col = CreateColumnWithRenderer( + label, model_column, mode, width, align, flags + ); + + dvc->PrependColumn(col); + return col; +} + +} // anonymous namespace + wxDataViewColumn * wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewTextRenderer( wxT("string"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendIconTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendToggleColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewToggleRenderer( wxT("bool"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendProgressColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendDateColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewDateRenderer( wxT("datetime"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendBitmapColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendTextColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewTextRenderer( wxT("string"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendIconTextColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendToggleColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewToggleRenderer( wxT("bool"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendProgressColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendDateColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewDateRenderer( wxT("datetime"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::AppendBitmapColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), - model_column, width, align, flags ); - AppendColumn( ret ); - return ret; + return AppendColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewTextRenderer( wxT("string"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependIconTextColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependToggleColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewToggleRenderer( wxT("bool"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependProgressColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependDateColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewDateRenderer( wxT("datetime"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependBitmapColumn( const wxString &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependTextColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewTextRenderer( wxT("string"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependIconTextColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependToggleColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewToggleRenderer( wxT("bool"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependProgressColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependDateColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewDateRenderer( wxT("datetime"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } wxDataViewColumn * wxDataViewCtrlBase::PrependBitmapColumn( const wxBitmap &label, unsigned int model_column, wxDataViewCellMode mode, int width, wxAlignment align, int flags ) { - wxDataViewColumn *ret = new wxDataViewColumn( label, - new wxDataViewBitmapRenderer( wxT("wxBitmap"), mode ), - model_column, width, align, flags ); - PrependColumn( ret ); - return ret; + return PrependColumnWithRenderer( + this, label, model_column, mode, width, align, flags + ); } bool @@ -1418,7 +1559,7 @@ void wxDataViewCtrlBase::StartEditor(const wxDataViewItem& item, unsigned int co // wxDataViewEvent // --------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDataViewEvent,wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewEvent,wxNotifyEvent); wxDEFINE_EVENT( wxEVT_DATAVIEW_SELECTION_CHANGED, wxDataViewEvent ); @@ -1446,6 +1587,7 @@ wxDEFINE_EVENT( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, wxDataViewEvent ); wxDEFINE_EVENT( wxEVT_DATAVIEW_ITEM_DROP, wxDataViewEvent ); +#if wxUSE_SPINCTRL // ------------------------------------- // wxDataViewSpinRenderer @@ -1461,16 +1603,12 @@ wxDataViewSpinRenderer::wxDataViewSpinRenderer( int min, int max, wxDataViewCell wxWindow* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value ) { long l = value; - wxSize size = labelRect.GetSize(); -#ifdef __WXMAC__ - size = wxSize( wxMax(70,labelRect.width ), -1 ); -#endif wxString str; str.Printf( wxT("%d"), (int) l ); wxSpinCtrl *sc = new wxSpinCtrl( parent, wxID_ANY, str, - labelRect.GetTopLeft(), size, wxSP_ARROW_KEYS|wxTE_PROCESS_ENTER, m_min, m_max, l ); + labelRect.GetTopLeft(), labelRect.GetSize(), wxSP_ARROW_KEYS|wxTE_PROCESS_ENTER, m_min, m_max, l ); #ifdef __WXMAC__ - size = sc->GetSize(); + const wxSize size = sc->GetSize(); wxPoint pt = sc->GetPosition(); sc->SetSize( pt.x - 4, pt.y - 4, size.x, size.y ); #endif @@ -1519,11 +1657,13 @@ bool wxDataViewSpinRenderer::GetValue( wxVariant &value ) const return true; } +#endif // wxUSE_SPINCTRL + // ------------------------------------- // wxDataViewChoiceRenderer // ------------------------------------- -#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXOSX_CARBON__) +#if defined(wxHAS_GENERIC_DATAVIEWCTRL) wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices, wxDataViewCellMode mode, int alignment ) : wxDataViewCustomRenderer(wxT("string"), mode, alignment ) @@ -1829,11 +1969,11 @@ bool wxDataViewListStore::SetValueByRow( const wxVariant &value, unsigned int ro // wxDataViewListCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDataViewListCtrl,wxDataViewCtrl) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewListCtrl,wxDataViewCtrl); -BEGIN_EVENT_TABLE(wxDataViewListCtrl,wxDataViewCtrl) +wxBEGIN_EVENT_TABLE(wxDataViewListCtrl,wxDataViewCtrl) EVT_SIZE( wxDataViewListCtrl::OnSize ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxDataViewListCtrl::wxDataViewListCtrl() { @@ -1885,17 +2025,17 @@ bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *colum bool wxDataViewListCtrl::PrependColumn( wxDataViewColumn *col ) { - return PrependColumn( col, "string" ); + return PrependColumn( col, col->GetRenderer()->GetVariantType() ); } bool wxDataViewListCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col ) { - return InsertColumn( pos, col, "string" ); + return InsertColumn( pos, col, col->GetRenderer()->GetVariantType() ); } bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *col ) { - return AppendColumn( col, "string" ); + return AppendColumn( col, col->GetRenderer()->GetVariantType() ); } bool wxDataViewListCtrl::ClearColumns() @@ -1927,9 +2067,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendToggleColumn( const wxString &label, new wxDataViewToggleRenderer( wxT("bool"), mode ), GetStore()->GetColumnCount()-1, width, align, flags ); - wxDataViewCtrl::AppendColumn( ret ); - - return ret; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; } wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &label, @@ -1941,9 +2079,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendProgressColumn( const wxString &labe new wxDataViewProgressRenderer( wxEmptyString, wxT("long"), mode ), GetStore()->GetColumnCount()-1, width, align, flags ); - wxDataViewCtrl::AppendColumn( ret ); - - return ret; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; } wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &label, @@ -1955,9 +2091,7 @@ wxDataViewColumn *wxDataViewListCtrl::AppendIconTextColumn( const wxString &labe new wxDataViewIconTextRenderer( wxT("wxDataViewIconText"), mode ), GetStore()->GetColumnCount()-1, width, align, flags ); - wxDataViewCtrl::AppendColumn( ret ); - - return ret; + return wxDataViewCtrl::AppendColumn( ret ) ? ret : NULL; } void wxDataViewListCtrl::OnSize( wxSizeEvent &event ) @@ -2361,13 +2495,13 @@ wxDataViewTreeStoreContainerNode *wxDataViewTreeStore::FindContainerNode( const // wxDataViewTreeCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDataViewTreeCtrl,wxDataViewCtrl) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewTreeCtrl,wxDataViewCtrl); -BEGIN_EVENT_TABLE(wxDataViewTreeCtrl,wxDataViewCtrl) +wxBEGIN_EVENT_TABLE(wxDataViewTreeCtrl,wxDataViewCtrl) EVT_DATAVIEW_ITEM_EXPANDED(-1, wxDataViewTreeCtrl::OnExpanded) EVT_DATAVIEW_ITEM_COLLAPSED(-1, wxDataViewTreeCtrl::OnCollapsed) EVT_SIZE( wxDataViewTreeCtrl::OnSize ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxDataViewTreeCtrl::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator ) diff --git a/Externals/wxWidgets3/src/common/datetime.cpp b/Externals/wxWidgets3/src/common/datetime.cpp index 669d0a3269..ae6b9a384b 100644 --- a/Externals/wxWidgets3/src/common/datetime.cpp +++ b/Externals/wxWidgets3/src/common/datetime.cpp @@ -81,9 +81,7 @@ #ifdef __WINDOWS__ #include - #ifndef __WXWINCE__ - #include - #endif + #include #endif #include "wx/datetime.h" @@ -123,24 +121,24 @@ wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter , wxFromStringCon class wxDateTimeHolidaysModule : public wxModule { public: - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { wxDateTimeHolidayAuthority::AddAuthority(new wxDateTimeWorkDays); return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { wxDateTimeHolidayAuthority::ClearAllAuthorities(); wxDateTimeHolidayAuthority::ms_authorities.clear(); } private: - DECLARE_DYNAMIC_CLASS(wxDateTimeHolidaysModule) + wxDECLARE_DYNAMIC_CLASS(wxDateTimeHolidaysModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDateTimeHolidaysModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDateTimeHolidaysModule, wxModule); // ---------------------------------------------------------------------------- // constants @@ -800,7 +798,6 @@ void wxDateTime::GetAmPmStrings(wxString *am, wxString *pm) wxDateTime::Country wxDateTime::GetCountry() { // TODO use LOCALE_ICOUNTRY setting under Win32 -#ifndef __WXWINCE__ if ( ms_country == Country_Unknown ) { // try to guess from the time zone name @@ -835,9 +832,6 @@ wxDateTime::Country wxDateTime::GetCountry() ms_country = USA; } } -#else // __WXWINCE__ - ms_country = USA; -#endif // !__WXWINCE__/__WXWINCE__ return ms_country; } @@ -1408,7 +1402,7 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const else { time += (time_t)tz.GetOffset(); -#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning +#if defined(__VMS__) // time is unsigned so avoid warning int time2 = (int) time; if ( time2 >= 0 ) #else @@ -1703,46 +1697,6 @@ wxDateTime::SetToWeekOfYear(int year, wxDateTime_t numWeek, WeekDay wd) return dt; } -#if WXWIN_COMPATIBILITY_2_6 -// use a separate function to avoid warnings about using deprecated -// SetToTheWeek in GetWeek below -static wxDateTime -SetToTheWeek(int year, - wxDateTime::wxDateTime_t numWeek, - wxDateTime::WeekDay weekday, - wxDateTime::WeekFlags flags) -{ - // Jan 4 always lies in the 1st week of the year - wxDateTime dt(4, wxDateTime::Jan, year); - dt.SetToWeekDayInSameWeek(weekday, flags); - dt += wxDateSpan::Weeks(numWeek - 1); - - return dt; -} - -bool wxDateTime::SetToTheWeek(wxDateTime_t numWeek, - WeekDay weekday, - WeekFlags flags) -{ - int year = GetYear(); - *this = ::SetToTheWeek(year, numWeek, weekday, flags); - if ( GetYear() != year ) - { - // oops... numWeek was too big - return false; - } - - return true; -} - -wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, - WeekDay weekday, - WeekFlags flags) const -{ - return ::SetToTheWeek(GetYear(), numWeek, weekday, flags); -} -#endif // WXWIN_COMPATIBILITY_2_6 - wxDateTime& wxDateTime::SetToLastMonthDay(Month month, int year) { @@ -1986,6 +1940,28 @@ wxDateTime::GetWeekOfYear(wxDateTime::WeekFlags flags, const TimeZone& tz) const return (wxDateTime::wxDateTime_t)week; } +int wxDateTime::GetWeekBasedYear(const TimeZone& tz) const +{ + const wxDateTime::Tm tm = GetTm(tz); + + int year = tm.year; + + // The week-based year can only be different from the normal year for few + // days in the beginning and the end of the year. + if ( tm.yday > 361 ) + { + if ( GetWeekOfYear(Monday_First, tz) == 1 ) + year++; + } + else if ( tm.yday < 5 ) + { + if ( GetWeekOfYear(Monday_First, tz) == 53 ) + year--; + } + + return year; +} + wxDateTime::wxDateTime_t wxDateTime::GetWeekOfMonth(wxDateTime::WeekFlags flags, const TimeZone& tz) const { @@ -2084,9 +2060,15 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) { 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 - if ( !noDST && (IsDST() == 1) ) + // We are converting from the local time, but local time zone does not + // include the DST offset (as it varies depending on the date), so we have + // to handle DST manually, unless a special flag inhibiting this was + // specified. + // + // Notice that we also shouldn't add the DST offset if we're already in the + // local time zone, as indicated by offset of 0, converting from local time + // to local time zone shouldn't change it, whether DST is in effect or not. + if ( !noDST && secDiff && (IsDST() == 1) ) { // FIXME we assume that the DST is always shifted by 1 hour secDiff -= 3600; @@ -2099,9 +2081,8 @@ wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) { 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 - if ( !noDST && (IsDST() == 1) ) + // See comment in MakeTimezone() above, the logic here is exactly the same. + if ( !noDST && secDiff && (IsDST() == 1) ) { // FIXME we assume that the DST is always shifted by 1 hour secDiff -= 3600; diff --git a/Externals/wxWidgets3/src/common/datetimefmt.cpp b/Externals/wxWidgets3/src/common/datetimefmt.cpp index 4855025050..0d2bb3498b 100644 --- a/Externals/wxWidgets3/src/common/datetimefmt.cpp +++ b/Externals/wxWidgets3/src/common/datetimefmt.cpp @@ -50,9 +50,7 @@ #ifdef __WINDOWS__ #include - #ifndef __WXWINCE__ - #include - #endif + #include #endif #include "wx/datetime.h" @@ -282,10 +280,7 @@ wxDateTime ParseFormatAt(wxString::const_iterator& p, const wxString::const_iterator& end, const wxString& fmt, - // FIXME-VC6: using wxString() instead of wxEmptyString in the - // line below results in error C2062: type 'class - // wxString (__cdecl *)(void)' unexpected - const wxString& fmtAlt = wxEmptyString) + const wxString& fmtAlt = wxString()) { const wxString str(p, end); wxString::const_iterator endParse; @@ -319,22 +314,46 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const wxString format = formatp; #ifdef __WXOSX__ - format.Replace("%c",wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT)); - format.Replace("%x",wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT)); - format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT)); + if ( format.Contains("%c") ) + format.Replace("%c", wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT)); + if ( format.Contains("%x") ) + format.Replace("%x", wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT)); + if ( format.Contains("%X") ) + 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 specifiers (notice that "%z" is - // special because it is de facto standard under Unix but is not supported - // under Windows) + // strftime() #ifdef wxHAS_STRFTIME time_t time = GetTicks(); - if ( (time != (time_t)-1) && !wxStrstr(format, wxT("%l")) + bool canUseStrftime = time != (time_t)-1; + + // We also can't use strftime() if we use non standard specifier: either + // our own extension "%l" or one of "%g", "%G", "%V", "%z" which are POSIX + // but not supported under Windows. + for ( wxString::const_iterator p = format.begin(); + canUseStrftime && p != format.end(); + ++p ) + { + if ( *p != '%' ) + continue; + + // set the default format + switch ( (*++p).GetValue() ) + { + case 'l': #ifdef __WINDOWS__ - && !wxStrstr(format, wxT("%z")) -#endif - ) + case 'g': + case 'G': + case 'V': + case 'z': +#endif // __WINDOWS__ + canUseStrftime = false; + break; + } + } + + if ( canUseStrftime ) { // use strftime() struct tm tmstruct; @@ -351,7 +370,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const { time += (int)tz.GetOffset(); -#if defined(__VMS__) || defined(__WATCOMC__) // time is unsigned so avoid warning +#if defined(__VMS__) // time is unsigned so avoid warning int time2 = (int) time; if ( time2 >= 0 ) #else @@ -408,6 +427,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const switch ( (*++p).GetValue() ) { case wxT('Y'): // year has 4 digits + case wxT('G'): // (and ISO week year too) case wxT('z'): // time zone as well fmt = wxT("%04d"); break; @@ -579,6 +599,14 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const res += wxString::Format(fmt, tm.mday); break; + case wxT('g'): // 2-digit week-based year + res += wxString::Format(fmt, GetWeekBasedYear() % 100); + break; + + case wxT('G'): // week-based year with century + res += wxString::Format(fmt, GetWeekBasedYear()); + break; + case wxT('H'): // hour in 24h format (00-23) res += wxString::Format(fmt, tm.hour); break; @@ -624,6 +652,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const res += wxString::Format(fmt, GetWeekOfYear(Sunday_First, tz)); break; + case wxT('V'): // ISO week number case wxT('W'): // week number in the year (Monday 1st week day) res += wxString::Format(fmt, GetWeekOfYear(Monday_First, tz)); break; @@ -712,7 +741,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const // no, it wasn't the width wxFAIL_MSG(wxT("unknown format specifier")); - // fall through and just copy it nevertheless + wxFALLTHROUGH; case wxT('%'): // a percent sign res += *p; @@ -938,7 +967,14 @@ wxDateTime::ParseRfc822Date(const wxString& date, wxString::const_iterator *end) // the spec was correct, construct the date from the values we found Set(day, mon, year, hour, min, sec); - MakeFromTimezone(TimeZone::Make(offset*SEC_PER_MIN)); + + // As always, dealing with the time zone is the most interesting part: we + // can't just use MakeFromTimeZone() here because it wouldn't handle the + // DST correctly because the TZ specified in the string is DST-invariant + // and so we have to manually shift to the UTC first and then convert to + // the local TZ. + *this -= wxTimeSpan::Minutes(offset); + MakeFromUTC(); if ( end ) *end = p; @@ -1495,7 +1531,7 @@ wxDateTime::ParseFormat(const wxString& date, case 0: // the end of string wxFAIL_MSG(wxT("unexpected format end")); - // fall through + wxFALLTHROUGH; default: // not a known format spec return false; @@ -2098,8 +2134,7 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end) const wxString timeString = wxGetTranslation(stdTimes[n].name); if ( timeString.CmpNoCase(wxString(time, timeString.length())) == 0 ) { - // casts required by DigitalMars - Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0)); + Set(stdTimes[n].hour, 0, 0); if ( end ) *end = time.begin() + timeString.length(); @@ -2262,7 +2297,7 @@ wxString wxTimeSpan::Format(const wxString& format) const { default: wxFAIL_MSG( wxT("invalid format character") ); - // fall through + wxFALLTHROUGH; case wxT('%'): str += ch; diff --git a/Externals/wxWidgets3/src/common/dcbase.cpp b/Externals/wxWidgets3/src/common/dcbase.cpp index 0823b27e22..63337d7ced 100644 --- a/Externals/wxWidgets3/src/common/dcbase.cpp +++ b/Externals/wxWidgets3/src/common/dcbase.cpp @@ -63,18 +63,6 @@ #include "wx/osx/dcscreen.h" #endif -#ifdef __WXPM__ - #include "wx/os2/dcclient.h" - #include "wx/os2/dcmemory.h" - #include "wx/os2/dcscreen.h" -#endif - -#ifdef __WXCOCOA__ - #include "wx/cocoa/dcclient.h" - #include "wx/cocoa/dcmemory.h" - #include "wx/cocoa/dcscreen.h" -#endif - #ifdef __WXMOTIF__ #include "wx/motif/dcclient.h" #include "wx/motif/dcmemory.h" @@ -93,6 +81,11 @@ #include "wx/dfb/dcscreen.h" #endif +#ifdef __WXQT__ + #include "wx/qt/dcclient.h" + #include "wx/qt/dcmemory.h" + #include "wx/qt/dcscreen.h" +#endif //---------------------------------------------------------------------------- // wxDCFactory //---------------------------------------------------------------------------- @@ -117,14 +110,14 @@ wxDCFactory *wxDCFactory::Get() class wxDCFactoryCleanupModule : public wxModule { public: - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDCFactory::Set(NULL); } + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxDCFactory::Set(NULL); } private: - DECLARE_DYNAMIC_CLASS(wxDCFactoryCleanupModule) + wxDECLARE_DYNAMIC_CLASS(wxDCFactoryCleanupModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule); //----------------------------------------------------------------------------- // wxNativeDCFactory @@ -193,7 +186,7 @@ wxDCImpl *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintD // wxWindowDC //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxWindowDC, wxDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDC, wxDC); wxWindowDC::wxWindowDC(wxWindow *win) : wxDC(wxDCFactory::Get()->CreateWindowDC(this, win)) @@ -204,7 +197,7 @@ wxWindowDC::wxWindowDC(wxWindow *win) // wxClientDC //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxClientDC, wxWindowDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxClientDC, wxWindowDC); wxClientDC::wxClientDC(wxWindow *win) : wxWindowDC(wxDCFactory::Get()->CreateClientDC(this, win)) @@ -215,7 +208,7 @@ wxClientDC::wxClientDC(wxWindow *win) // wxMemoryDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC); wxMemoryDC::wxMemoryDC() : wxDC(wxDCFactory::Get()->CreateMemoryDC(this)) @@ -269,7 +262,7 @@ wxBitmap& wxMemoryDC::GetSelectedBitmap() // wxPaintDC //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPaintDC, wxClientDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxPaintDC, wxClientDC); wxPaintDC::wxPaintDC(wxWindow *win) : wxClientDC(wxDCFactory::Get()->CreatePaintDC(this, win)) @@ -280,7 +273,7 @@ wxPaintDC::wxPaintDC(wxWindow *win) // wxScreenDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC); wxScreenDC::wxScreenDC() : wxDC(wxDCFactory::Get()->CreateScreenDC(this)) @@ -293,7 +286,7 @@ wxScreenDC::wxScreenDC() #if wxUSE_PRINTING_ARCHITECTURE -IMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC); wxPrinterDC::wxPrinterDC() : wxDC(wxDCFactory::Get()->CreatePrinterDC(this, wxPrintData())) @@ -321,7 +314,7 @@ int wxPrinterDC::GetResolution() const // wxDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject); wxDCImpl::wxDCImpl( wxDC *owner ) : m_window(NULL) @@ -704,8 +697,8 @@ static wxPointList wx_spline_point_list; void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4) { - register double xmid, ymid; - double x1, y1, x2, y2, x3, y3, x4, y4; + double xmid, ymid; + double x1, y1, x2, y2, x3, y3, x4, y4; wx_clear_stack(); wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4); @@ -1058,7 +1051,7 @@ void wxDCImpl::DoGetFontMetrics(int *height, // wxDC //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject); void wxDC::CopyAttributes(const wxDC& dc) { @@ -1340,280 +1333,6 @@ Peter Lenhard p.lenhard@t-online.de */ -#ifdef __WXWINCE__ -void wxDCImpl::DoDrawEllipticArcRot( wxCoord x, wxCoord y, - wxCoord w, wxCoord h, - double sa, double ea, double angle ) -{ - wxPointList list; - - CalculateEllipticPoints( &list, x, y, w, h, sa, ea ); - Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) ); - - // Add center (for polygon/pie) - list.Append( new wxPoint( x+w/2, y+h/2 ) ); - - // copy list into array and delete list elements - int n = list.GetCount(); - wxPoint *points = new wxPoint[n]; - int i = 0; - wxPointList::compatibility_iterator node; - for ( node = list.GetFirst(); node; node = node->GetNext(), i++ ) - { - wxPoint *point = node->GetData(); - points[i].x = point->x; - points[i].y = point->y; - delete point; - } - - // first draw the pie without pen, if necessary - if( GetBrush() != *wxTRANSPARENT_BRUSH ) - { - wxPen tempPen( GetPen() ); - SetPen( *wxTRANSPARENT_PEN ); - DoDrawPolygon( n, points, 0, 0 ); - SetPen( tempPen ); - } - - // then draw the arc without brush, if necessary - if( GetPen() != *wxTRANSPARENT_PEN ) - { - // without center - DoDrawLines( n-1, points, 0, 0 ); - } - - delete [] points; - -} // DrawEllipticArcRot - -void wxDCImpl::Rotate( wxPointList* points, double angle, wxPoint center ) -{ - if( angle != 0.0 ) - { - double pi(M_PI); - double dSinA = -sin(angle*2.0*pi/360.0); - double dCosA = cos(angle*2.0*pi/360.0); - wxPointList::compatibility_iterator node; - for ( node = points->GetFirst(); node; node = node->GetNext() ) - { - wxPoint* point = node->GetData(); - - // transform coordinates, if necessary - if( center.x ) point->x -= center.x; - if( center.y ) point->y -= center.y; - - // calculate rotation, rounding simply by implicit cast to integer - int xTemp = point->x * dCosA - point->y * dSinA; - point->y = point->x * dSinA + point->y * dCosA; - point->x = xTemp; - - // back transform coordinates, if necessary - if( center.x ) point->x += center.x; - if( center.y ) point->y += center.y; - } - } -} - -void wxDCImpl::CalculateEllipticPoints( wxPointList* points, - wxCoord xStart, wxCoord yStart, - wxCoord w, wxCoord h, - double sa, double ea ) -{ - double pi = M_PI; - double sar = 0; - double ear = 0; - int xsa = 0; - int ysa = 0; - int xea = 0; - int yea = 0; - int sq = 0; - int eq = 0; - bool bUseAngles = false; - if( w<0 ) w = -w; - if( h<0 ) h = -h; - // half-axes - wxCoord a = w/2; - wxCoord b = h/2; - // decrement 1 pixel if ellipse is smaller than 2*a, 2*b - int decrX = 0; - if( 2*a == w ) decrX = 1; - int decrY = 0; - if( 2*b == h ) decrY = 1; - // center - wxCoord xCenter = xStart + a; - wxCoord yCenter = yStart + b; - // calculate data for start and end, if necessary - if( sa != ea ) - { - bUseAngles = true; - // normalisation of angles - while( sa<0 ) sa += 360; - while( ea<0 ) ea += 360; - while( sa>=360 ) sa -= 360; - while( ea>=360 ) ea -= 360; - // calculate quadrant numbers - if( sa > 270 ) sq = 3; - else if( sa > 180 ) sq = 2; - else if( sa > 90 ) sq = 1; - if( ea > 270 ) eq = 3; - else if( ea > 180 ) eq = 2; - else if( ea > 90 ) eq = 1; - sar = sa * pi / 180.0; - ear = ea * pi / 180.0; - // correct angle circle -> ellipse - sar = atan( -a/(double)b * tan( sar ) ); - if ( sq == 1 || sq == 2 ) sar += pi; - ear = atan( -a/(double)b * tan( ear ) ); - if ( eq == 1 || eq == 2 ) ear += pi; - // coordinates of points - xsa = xCenter + a * cos( sar ); - if( sq == 0 || sq == 3 ) xsa -= decrX; - ysa = yCenter + b * sin( sar ); - if( sq == 2 || sq == 3 ) ysa -= decrY; - xea = xCenter + a * cos( ear ); - if( eq == 0 || eq == 3 ) xea -= decrX; - yea = yCenter + b * sin( ear ); - if( eq == 2 || eq == 3 ) yea -= decrY; - } // if iUseAngles - // calculate c1 = b^2, c2 = b^2/a^2 with a = w/2, b = h/2 - double c1 = b * b; - double c2 = 2.0 / w; - c2 *= c2; - c2 *= c1; - wxCoord x = 0; - wxCoord y = b; - long x2 = 1; - long y2 = y*y; - long y2_old = 0; - long y_old = 0; - // Lists for quadrant 1 to 4 - wxPointList pointsarray[4]; - // Calculate points for first quadrant and set in all quadrants - for( x = 0; x <= a; ++x ) - { - x2 = x2+x+x-1; - y2_old = y2; - y_old = y; - bool bNewPoint = false; - while( y2 > c1 - c2 * x2 && y > 0 ) - { - bNewPoint = true; - y2 = y2-y-y+1; - --y; - } - // old y now too big: set point with old y, old x - if( bNewPoint && x>1) - { - int x1 = x - 1; - // remove points on the same line - pointsarray[0].Insert( new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); - pointsarray[1].Append( new wxPoint( xCenter - x1, yCenter - y_old ) ); - pointsarray[2].Insert( new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); - pointsarray[3].Append( new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); - } // set point - } // calculate point - - // Starting and/or ending points for the quadrants, first quadrant gets both. - pointsarray[0].Insert( new wxPoint( xCenter + a - decrX, yCenter ) ); - pointsarray[0].Append( new wxPoint( xCenter, yCenter - b ) ); - pointsarray[1].Append( new wxPoint( xCenter - a, yCenter ) ); - pointsarray[2].Append( new wxPoint( xCenter, yCenter + b - decrY ) ); - pointsarray[3].Append( new wxPoint( xCenter + a - decrX, yCenter ) ); - - // copy quadrants in original list - if( bUseAngles ) - { - // Copy the right part of the points in the lists - // and delete the wxPoints, because they do not leave this method. - points->Append( new wxPoint( xsa, ysa ) ); - int q = sq; - bool bStarted = false; - bool bReady = false; - bool bForceTurn = ( sq == eq && sa > ea ); - while( !bReady ) - { - wxPointList::compatibility_iterator node; - for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) - { - // once: go to starting point in start quadrant - if( !bStarted && - ( - node->GetData()->x < xsa+1 && q <= 1 - || - node->GetData()->x > xsa-1 && q >= 2 - ) - ) - { - bStarted = true; - } - - // copy point, if not at ending point - if( bStarted ) - { - if( q != eq || bForceTurn - || - ( (wxPoint*) node->GetData() )->x > xea+1 && q <= 1 - || - ( (wxPoint*) node->GetData() )->x < xea-1 && q >= 2 - ) - { - // copy point - wxPoint* pPoint = new wxPoint( *(node->GetData()) ); - points->Append( pPoint ); - } - else if( q == eq && !bForceTurn || node->GetData()->x == xea) - { - bReady = true; - } - } - } // for node - ++q; - if( q > 3 ) q = 0; - bForceTurn = false; - bStarted = true; - } // while not bReady - points->Append( new wxPoint( xea, yea ) ); - - // delete points - for( q = 0; q < 4; ++q ) - { - wxPointList::compatibility_iterator node; - for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - delete p; - } - } - } - else - { - wxPointList::compatibility_iterator node; - // copy whole ellipse, wxPoints will be deleted outside - for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - points->Append( p ); - } - for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - points->Append( p ); - } - } // not iUseAngles -} // CalculateEllipticPoints - -#endif // __WXWINCE__ - float wxDCImpl::GetFontPointSizeAdjustment(float dpi) { // wxMSW has long-standing bug where wxFont point size is interpreted as diff --git a/Externals/wxWidgets3/src/common/dcbufcmn.cpp b/Externals/wxWidgets3/src/common/dcbufcmn.cpp index 3bc2e275ed..f946a814d9 100644 --- a/Externals/wxWidgets3/src/common/dcbufcmn.cpp +++ b/Externals/wxWidgets3/src/common/dcbufcmn.cpp @@ -33,8 +33,8 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC,wxMemoryDC) -IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC,wxBufferedDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxBufferedDC, wxMemoryDC); +wxIMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC, wxBufferedDC); // ---------------------------------------------------------------------------- // wxSharedDCBufferManager: helper class maintaining backing store bitmap @@ -45,28 +45,21 @@ class wxSharedDCBufferManager : public wxModule public: wxSharedDCBufferManager() { } - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDELETE(ms_buffer); } + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxDELETE(ms_buffer); } - static wxBitmap* GetBuffer(int w, int h) + static wxBitmap* GetBuffer(wxDC* dc, int w, int h) { if ( ms_usingSharedBuffer ) - return new wxBitmap(w, h); + return DoCreateBuffer(dc, w, h); if ( !ms_buffer || - w > ms_buffer->GetWidth() || - h > ms_buffer->GetHeight() ) + w > ms_buffer->GetScaledWidth() || + h > ms_buffer->GetScaledHeight() ) { delete ms_buffer; - // we must always return a valid bitmap but creating a bitmap of - // size 0 would fail, so create a 1*1 bitmap in this case - if ( !w ) - w = 1; - if ( !h ) - h = 1; - - ms_buffer = new wxBitmap(w, h); + ms_buffer = DoCreateBuffer(dc, w, h); } ms_usingSharedBuffer = true; @@ -87,16 +80,28 @@ public: } private: + static wxBitmap* DoCreateBuffer(wxDC* dc, int w, int h) + { + const double scale = dc ? dc->GetContentScaleFactor() : 1.0; + wxBitmap* const buffer = new wxBitmap; + + // we must always return a valid bitmap but creating a bitmap of + // size 0 would fail, so create a 1*1 bitmap in this case + buffer->CreateScaled(wxMax(w, 1), wxMax(h, 1), -1, scale); + + return buffer; + } + static wxBitmap *ms_buffer; static bool ms_usingSharedBuffer; - DECLARE_DYNAMIC_CLASS(wxSharedDCBufferManager) + wxDECLARE_DYNAMIC_CLASS(wxSharedDCBufferManager); }; wxBitmap* wxSharedDCBufferManager::ms_buffer = NULL; bool wxSharedDCBufferManager::ms_usingSharedBuffer = false; -IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule); // ============================================================================ // wxBufferedDC @@ -111,7 +116,7 @@ void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) if ( w == -1 || h == -1 ) m_dc->GetSize(&w, &h); - m_buffer = wxSharedDCBufferManager::GetBuffer(w, h); + m_buffer = wxSharedDCBufferManager::GetBuffer(m_dc, w, h); m_style |= wxBUFFER_USES_SHARED_BUFFER; m_area.Set(w,h); } diff --git a/Externals/wxWidgets3/src/common/dcgraph.cpp b/Externals/wxWidgets3/src/common/dcgraph.cpp index a44ac2cb91..eb2ce4f059 100644 --- a/Externals/wxWidgets3/src/common/dcgraph.cpp +++ b/Externals/wxWidgets3/src/common/dcgraph.cpp @@ -23,6 +23,8 @@ #include "wx/icon.h" #include "wx/dcclient.h" #include "wx/dcmemory.h" + #include "wx/math.h" + #include "wx/geometry.h" #endif //----------------------------------------------------------------------------- @@ -35,11 +37,6 @@ static const double RAD2DEG = 180.0 / M_PI; // Local functions //----------------------------------------------------------------------------- -static inline double DegToRad(double deg) -{ - return (deg * M_PI) / 180.0; -} - static wxCompositionMode TranslateRasterOp(wxRasterOperationMode function) { switch ( function ) @@ -82,7 +79,7 @@ static wxCompositionMode TranslateRasterOp(wxRasterOperationMode function) // wxDC bridge class //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC); wxGCDC::wxGCDC(const wxWindowDC& dc) : wxDC( new wxGCDCImpl( this, dc ) ) @@ -123,21 +120,7 @@ wxGCDC::~wxGCDC() { } -wxGraphicsContext* wxGCDC::GetGraphicsContext() const -{ - if (!m_pimpl) return NULL; - wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl; - return gc_impl->GetGraphicsContext(); -} - -void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) -{ - if (!m_pimpl) return; - wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl; - gc_impl->SetGraphicsContext( ctx ); -} - -IMPLEMENT_ABSTRACT_CLASS(wxGCDCImpl, wxDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxGCDCImpl, wxDCImpl); wxGCDCImpl::wxGCDCImpl( wxDC *owner ) : wxDCImpl( owner ) @@ -231,9 +214,9 @@ void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, if ( bmp.GetDepth() == 1 ) { m_graphicContext->SetPen(*wxTRANSPARENT_PEN); - m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) ); + m_graphicContext->SetBrush(m_textBackgroundColour); m_graphicContext->DrawRectangle( x, y, w, h ); - m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) ); + m_graphicContext->SetBrush(m_textForegroundColour); m_graphicContext->DrawBitmap( bmp, x, y, w, h ); m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush)); m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen)); @@ -248,6 +231,9 @@ void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, m_graphicContext->DrawBitmap( bmpCopy, x, y, w, h ); } + + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); } void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) @@ -259,23 +245,29 @@ void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) wxCoord h = icon.GetHeight(); m_graphicContext->DrawIcon( icon , x, y, w, h ); + + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); } -bool wxGCDCImpl::StartDoc( const wxString& WXUNUSED(message) ) +bool wxGCDCImpl::StartDoc( const wxString& message ) { - return true; + return m_graphicContext->StartDoc(message); } void wxGCDCImpl::EndDoc() { + m_graphicContext->EndDoc(); } void wxGCDCImpl::StartPage() { + m_graphicContext->StartPage(); } void wxGCDCImpl::EndPage() { + m_graphicContext->EndPage(); } void wxGCDCImpl::Flush() @@ -514,7 +506,7 @@ void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y ) m_graphicContext->StrokeLine(x,0,x,h); CalcBoundingBox(0, 0); - CalcBoundingBox(0+w, 0+h); + CalcBoundingBox(w, h); } void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, @@ -550,17 +542,22 @@ void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, -atan2(double(y2 - yc), double(x2 - xc)) * RAD2DEG; } - bool fill = m_brush.GetStyle() != wxTRANSPARENT; + bool fill = m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT; wxGraphicsPath path = m_graphicContext->CreatePath(); if ( fill && ((x1!=x2)||(y1!=y2)) ) path.MoveToPoint( xc, yc ); // since these angles (ea,sa) are measured counter-clockwise, we invert them to // get clockwise angles - path.AddArc( xc, yc , rad , DegToRad(-sa) , DegToRad(-ea), false ); + path.AddArc( xc, yc , rad, wxDegToRad(-sa), wxDegToRad(-ea), false ); if ( fill && ((x1!=x2)||(y1!=y2)) ) path.AddLineToPoint( xc, yc ); m_graphicContext->DrawPath(path); + + wxRect2DDouble box = path.GetBox(); + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); } void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, @@ -571,32 +568,49 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, if ( !m_logicalFunctionSupported ) return; - m_graphicContext->PushState(); - m_graphicContext->Translate(x+w/2.0,y+h/2.0); + wxCoord dx = x + w / 2.0; + wxCoord dy = y + h / 2.0; wxDouble factor = ((wxDouble) w) / h; - m_graphicContext->Scale( factor , 1.0); + m_graphicContext->PushState(); + m_graphicContext->Translate(dx, dy); + m_graphicContext->Scale(factor, 1.0); + wxGraphicsPath path = m_graphicContext->CreatePath(); + // If end angle equals start angle we want draw a full ellipse. + if (ea == sa) + { + ea += 360.0; + } // since these angles (ea,sa) are measured counter-clockwise, we invert them to // get clockwise angles - if ( m_brush.GetStyle() != wxTRANSPARENT ) + if ( m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT ) { - wxGraphicsPath path = m_graphicContext->CreatePath(); path.MoveToPoint( 0, 0 ); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); + path.AddArc( 0, 0, h/2.0, wxDegToRad(-sa), wxDegToRad(-ea), false ); path.AddLineToPoint( 0, 0 ); m_graphicContext->FillPath( path ); path = m_graphicContext->CreatePath(); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); + path.AddArc( 0, 0, h/2.0, wxDegToRad(-sa), wxDegToRad(-ea), false ); m_graphicContext->StrokePath( path ); } else { - wxGraphicsPath path = m_graphicContext->CreatePath(); - path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); + path.AddArc( 0, 0, h/2.0, wxDegToRad(-sa), wxDegToRad(-ea), false ); m_graphicContext->DrawPath( path ); } + wxRect2DDouble box = path.GetBox(); + // apply the transformation to the box + box.m_x *= factor; + box.m_width *= factor; + box.m_x += dx; + box.m_y += dy; + + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); + m_graphicContext->PopState(); } @@ -611,19 +625,34 @@ void wxGCDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") ); + wxASSERT_MSG( n > 0, wxT("wxGCDC(cg)::DoDrawLines - number of points too small") ); if ( !m_logicalFunctionSupported ) return; + int minX = points[0].x; + int minY = points[0].y; + int maxX = minX; + int maxY = minY; + wxPoint2DDouble* pointsD = new wxPoint2DDouble[n]; for( int i = 0; i < n; ++i) { - pointsD[i].m_x = points[i].x + xoffset; - pointsD[i].m_y = points[i].y + yoffset; + wxPoint p = points[i]; + pointsD[i].m_x = p.x + xoffset; + pointsD[i].m_y = p.y + yoffset; + + if (p.x < minX) minX = p.x; + else if (p.x > maxX) maxX = p.x; + if (p.y < minY) minY = p.y; + else if (p.y > maxY) maxY = p.y; } m_graphicContext->StrokeLines( n , pointsD); delete[] pointsD; + + CalcBoundingBox(minX + xoffset, minY + yoffset); + CalcBoundingBox(maxX + xoffset, maxY + yoffset); } #if wxUSE_SPLINES @@ -682,6 +711,11 @@ void wxGCDCImpl::DoDrawSpline(const wxPointList *points) path.AddLineToPoint( x2 , y2 ); m_graphicContext->StrokePath( path ); + + wxRect2DDouble box = path.GetBox(); + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); } #endif // wxUSE_SPLINES @@ -691,7 +725,9 @@ void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[], { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") ); - if ( n <= 0 || (m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT ) ) + if ( n <= 0 || + (m_brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT && + m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) ) return; if ( !m_logicalFunctionSupported ) return; @@ -700,17 +736,31 @@ void wxGCDCImpl::DoDrawPolygon( int n, const wxPoint points[], if (points[n-1] != points[0]) closeIt = true; + int minX = points[0].x; + int minY = points[0].y; + int maxX = minX; + int maxY = minY; + wxPoint2DDouble* pointsD = new wxPoint2DDouble[n+(closeIt?1:0)]; for( int i = 0; i < n; ++i) { - pointsD[i].m_x = points[i].x + xoffset; - pointsD[i].m_y = points[i].y + yoffset; + wxPoint p = points[i]; + pointsD[i].m_x = p.x + xoffset; + pointsD[i].m_y = p.y + yoffset; + + if (p.x < minX) minX = p.x; + else if (p.x > maxX) maxX = p.x; + if (p.y < minY) minY = p.y; + else if (p.y > maxY) maxY = p.y; } if ( closeIt ) pointsD[n] = pointsD[0]; m_graphicContext->DrawLines( n+(closeIt?1:0) , pointsD, fillStyle); delete[] pointsD; + + CalcBoundingBox(minX + xoffset, minY + yoffset); + CalcBoundingBox(maxX + xoffset, maxY + yoffset); } void wxGCDCImpl::DoDrawPolyPolygon(int n, @@ -740,6 +790,11 @@ void wxGCDCImpl::DoDrawPolyPolygon(int n, path.AddLineToPoint( start.x+ xoffset, start.y+ yoffset); } m_graphicContext->DrawPath( path , fillStyle); + + wxRect2DDouble box = path.GetBox(); + CalcBoundingBox(wxRound(box.m_x), wxRound(box.m_y)); + CalcBoundingBox(wxRound(box.m_x + box.m_width), + wxRound(box.m_y + box.m_height)); } void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) @@ -753,10 +808,12 @@ void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) if (w == 0 || h == 0) return; - if ( m_graphicContext->ShouldOffset() ) + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); + + if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 + // outline is one pixel larger than what raster-based wxDC implementations draw w -= 1; h -= 1; } @@ -779,10 +836,12 @@ void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, if (w == 0 || h == 0) return; - if ( m_graphicContext->ShouldOffset() ) + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); + + if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 + // outline is one pixel larger than what raster-based wxDC implementations draw w -= 1; h -= 1; } @@ -796,13 +855,9 @@ void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) if ( !m_logicalFunctionSupported ) return; - if ( m_graphicContext->ShouldOffset() ) - { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 - w -= 1; - h -= 1; - } + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); + m_graphicContext->DrawEllipse(x,y,w,h); } @@ -905,23 +960,68 @@ bool wxGCDCImpl::DoStretchBlit( // reset composition m_graphicContext->SetCompositionMode(formerMode); + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + return retval; } -void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y, +void wxGCDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") ); - if ( str.empty() ) + if ( text.empty() ) return; if ( !m_logicalFunctionSupported ) return; - if ( m_backgroundMode == wxTRANSPARENT ) - m_graphicContext->DrawText( str, x ,y , DegToRad(angle )); - else - m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); + // we test that we have some font because otherwise we should still use the + // "else" part below to avoid that DrawRotatedText(angle = 180) and + // DrawRotatedText(angle = 0) use different fonts (we can't use the default + // font for drawing rotated fonts unfortunately) + if ( (angle == 0.0) && m_font.IsOk() ) + { + DoDrawText(text, x, y); + + // Bounding box already updated by DoDrawText(), no need to do it again. + return; + } + + // Get extent of whole text. + wxCoord w, h, heightLine; + GetOwner()->GetMultiLineTextExtent(text, &w, &h, &heightLine); + + // Compute the shift for the origin of the next line. + const double rad = wxDegToRad(angle); + const double dx = heightLine * sin(rad); + const double dy = heightLine * cos(rad); + + // Draw all text line by line + const wxArrayString lines = wxSplit(text, '\n', '\0'); + for ( size_t lineNum = 0; lineNum < lines.size(); lineNum++ ) + { + // Calculate origin for each line to avoid accumulation of + // rounding errors. + if ( m_backgroundMode == wxTRANSPARENT ) + m_graphicContext->DrawText( lines[lineNum], x + wxRound(lineNum*dx), y + wxRound(lineNum*dy), wxDegToRad(angle )); + else + m_graphicContext->DrawText( lines[lineNum], x + wxRound(lineNum*dx), y + wxRound(lineNum*dy), wxDegToRad(angle ), m_graphicContext->CreateBrush(m_textBackgroundColour) ); + } + + // call the bounding box by adding all four vertices of the rectangle + // containing the text to it (simpler and probably not slower than + // determining which of them is really topmost/leftmost/...) + + // "upper left" and "upper right" + CalcBoundingBox(x, y); + CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + + // "bottom left" and "bottom right" + x += (wxCoord)(h*sin(rad)); + y += (wxCoord)(h*cos(rad)); + CalcBoundingBox(x, y); + CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); } void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) @@ -949,7 +1049,12 @@ void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y) if ( m_backgroundMode == wxTRANSPARENT ) m_graphicContext->DrawText( str, x ,y); else - m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) ); + m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush(m_textBackgroundColour) ); + + wxCoord w, h; + GetOwner()->GetTextExtent(str, &w, &h); + CalcBoundingBox(x, y); + CalcBoundingBox(x + w, y + h); } bool wxGCDCImpl::CanGetTextExtent() const @@ -1008,7 +1113,7 @@ bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& width wxCoord wxGCDCImpl::GetCharWidth(void) const { - wxCoord width; + wxCoord width = 0; DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL ); return width; @@ -1016,7 +1121,7 @@ wxCoord wxGCDCImpl::GetCharWidth(void) const wxCoord wxGCDCImpl::GetCharHeight(void) const { - wxCoord height; + wxCoord height = 0; DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL ); return height; @@ -1093,6 +1198,9 @@ void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect, m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); m_graphicContext->SetPen(m_pen); m_graphicContext->SetBrush(m_brush); + + CalcBoundingBox(rect.x, rect.y); + CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); } void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, @@ -1122,6 +1230,9 @@ void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect, m_graphicContext->DrawRectangle(rect.x,rect.y,rect.width,rect.height); m_graphicContext->SetPen(m_pen); m_graphicContext->SetBrush(m_brush); + + CalcBoundingBox(rect.x, rect.y); + CalcBoundingBox(rect.x + rect.width, rect.y + rect.height); } void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y, diff --git a/Externals/wxWidgets3/src/common/dcsvg.cpp b/Externals/wxWidgets3/src/common/dcsvg.cpp index 5c55a0b935..5f09c623c0 100644 --- a/Externals/wxWidgets3/src/common/dcsvg.cpp +++ b/Externals/wxWidgets3/src/common/dcsvg.cpp @@ -21,11 +21,14 @@ #include "wx/dcscreen.h" #include "wx/icon.h" #include "wx/image.h" + #include "wx/math.h" #endif +#include "wx/base64.h" #include "wx/dcsvg.h" #include "wx/wfstream.h" #include "wx/filename.h" +#include "wx/mstream.h" #include "wx/private/markupparser.h" @@ -36,8 +39,6 @@ namespace { -inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } - // 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 @@ -53,7 +54,7 @@ wxString Col2SVG(wxColour c, float *opacity) { if ( c.Alpha() != wxALPHA_OPAQUE ) { - *opacity = c.Alpha()/255.; + *opacity = c.Alpha() / 255.0f; // Remove the alpha before using GetAsString(wxC2S_HTML_SYNTAX) as it // doesn't support colours with alpha channel. @@ -109,11 +110,110 @@ wxString wxBrushString(wxColour c, int style = wxBRUSHSTYLE_SOLID) } // anonymous namespace +// ---------------------------------------------------------------------------- +// wxSVGBitmapEmbedHandler +// ---------------------------------------------------------------------------- + +bool +wxSVGBitmapEmbedHandler::ProcessBitmap(const wxBitmap& bmp, + wxCoord x, wxCoord y, + wxOutputStream& stream) const +{ + static int sub_images = 0; + + if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) + wxImage::AddHandler(new wxPNGHandler); + + // write the bitmap as a PNG to a memory stream and Base64 encode + wxMemoryOutputStream mem; + bmp.ConvertToImage().SaveFile(mem, wxBITMAP_TYPE_PNG); + wxString data = wxBase64Encode(mem.GetOutputStreamBuffer()->GetBufferStart(), + mem.GetSize()); + + // write image meta information + wxString s; + s += wxString::Format(" "; // last line + } + + // write to the SVG file + const wxCharBuffer buf = s.utf8_str(); + stream.Write(buf, strlen((const char *)buf)); + + return stream.IsOk(); +} + +// ---------------------------------------------------------- +// wxSVGBitmapFileHandler +// ---------------------------------------------------------- + +bool +wxSVGBitmapFileHandler::ProcessBitmap(const wxBitmap& bmp, + wxCoord x, wxCoord y, + wxOutputStream& stream) const +{ + static int sub_images = 0; + + if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) + wxImage::AddHandler(new wxPNGHandler); + + // find a suitable file name + wxString sPNG; + do + { + sPNG = wxString::Format("image%d.png", sub_images++); + } + while (wxFile::Exists(sPNG)); + + if ( !bmp.SaveFile(sPNG, wxBITMAP_TYPE_PNG) ) + return false; + + // reference the bitmap from the SVG doc using only filename & ext + sPNG = sPNG.AfterLast(wxFileName::GetPathSeparator()); + + // reference the bitmap from the SVG doc + wxString s; + s += wxString::Format(" \n\n", sPNG); + + // write to the SVG file + const wxCharBuffer buf = s.utf8_str(); + stream.Write(buf, strlen((const char *)buf)); + + return stream.IsOk(); +} + +// ---------------------------------------------------------- +// wxSVGFileDC (specialisations) +// ---------------------------------------------------------- + +void wxSVGFileDC::SetBitmapHandler(wxSVGBitmapHandler* handler) +{ + ((wxSVGFileDCImpl*)GetImpl())->SetBitmapHandler(handler); +} + // ---------------------------------------------------------- // wxSVGFileDCImpl // ---------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDC); wxSVGFileDCImpl::wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename, int width, int height, double dpi ) : @@ -150,6 +250,7 @@ void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, dou ////////////////////code here + m_bmp_handler = NULL; m_outfile = new wxFileOutputStream(filename); m_OK = m_outfile->IsOk(); if (m_OK) @@ -250,7 +351,7 @@ void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor wxCoord w, h, desc; DoGetTextExtent(sText, &w, &h, &desc); - double rad = DegToRad(angle); + double rad = wxDegToRad(angle); // wxT("upper left") and wxT("upper right") CalcBoundingBox(x, y); @@ -284,11 +385,53 @@ void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor 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 += wxT("font-weight:") + fontweights[m_font.GetWeight() - wxNORMAL] + wxT("; "); + wxString fontweight; + switch ( m_font.GetWeight() ) + { + case wxFONTWEIGHT_MAX: + wxFAIL_MSG( wxS("invalid font weight value") ); + wxFALLTHROUGH; - wxString fontstyles [5] = { wxT("normal"), wxT("style error"), wxT("style error"), wxT("italic"), wxT("oblique") }; - s += wxT("font-style:") + fontstyles[m_font.GetStyle() - wxNORMAL] + wxT("; "); + case wxFONTWEIGHT_NORMAL: + fontweight = wxS("normal"); + break; + + case wxFONTWEIGHT_LIGHT: + fontweight = wxS("lighter"); + break; + + case wxFONTWEIGHT_BOLD: + fontweight = wxS("bold"); + break; + } + + wxASSERT_MSG( !fontweight.empty(), wxS("unknown font weight value") ); + + s += wxT("font-weight:") + fontweight + wxT("; "); + + wxString fontstyle; + switch ( m_font.GetStyle() ) + { + case wxFONTSTYLE_MAX: + wxFAIL_MSG( wxS("invalid font style value") ); + wxFALLTHROUGH; + + case wxFONTSTYLE_NORMAL: + fontstyle = wxS("normal"); + break; + + case wxFONTSTYLE_ITALIC: + fontstyle = wxS("italic"); + break; + + case wxFONTSTYLE_SLANT: + fontstyle = wxS("oblique"); + break; + } + + wxASSERT_MSG( !fontstyle.empty(), wxS("unknown font style value") ); + + s += wxT("font-style:") + fontstyle + wxT("; "); sTmp.Printf (wxT("font-size:%dpt; "), m_font.GetPointSize() ); s += sTmp; @@ -446,10 +589,10 @@ void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h, double yc = y + ry; double xs, ys, xe, ye; - xs = xc + rx * cos (DegToRad(sa)); - xe = xc + rx * cos (DegToRad(ea)); - ys = yc - ry * sin (DegToRad(sa)); - ye = yc - ry * sin (DegToRad(ea)); + xs = xc + rx * cos (wxDegToRad(sa)); + xe = xc + rx * cos (wxDegToRad(ea)); + ys = yc - ry * sin (wxDegToRad(sa)); + ye = yc - ry * sin (wxDegToRad(ea)); ///now same as circle arc... @@ -570,6 +713,11 @@ void wxSVGFileDCImpl::SetBackgroundMode( int mode ) m_backgroundMode = mode; } +void wxSVGFileDCImpl::SetBitmapHandler(wxSVGBitmapHandler* handler) +{ + delete m_bmp_handler; + m_bmp_handler = handler; +} void wxSVGFileDCImpl::SetBrush(const wxBrush& brush) { @@ -686,42 +834,11 @@ void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoor { NewGraphicsIfNeeded(); - wxString sTmp, s, sPNG; - if ( wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL ) - wxImage::AddHandler(new wxPNGHandler); + // If we don't have any bitmap handler yet, use the default one. + if ( !m_bmp_handler ) + m_bmp_handler = new wxSVGBitmapFileHandler(); -// create suitable file name - sTmp.Printf ( wxT("_image%d.png"), m_sub_images); - sPNG = m_filename.BeforeLast(wxT('.')) + sTmp; - while (wxFile::Exists(sPNG) ) - { - m_sub_images ++; - sTmp.Printf ( wxT("_image%d.png"), m_sub_images); - sPNG = m_filename.BeforeLast(wxT('.')) + sTmp; - } - -//create copy of bitmap (wxGTK doesn't like saving a constant bitmap) - wxBitmap myBitmap = bmp; -//save it - bool bPNG_OK = myBitmap.SaveFile(sPNG,wxBITMAP_TYPE_PNG); - -// reference the bitmap from the SVG doc -// only use filename & ext - sPNG = sPNG.AfterLast(wxFileName::GetPathSeparator()); - -// reference the bitmap from the SVG doc - int w = myBitmap.GetWidth(); - int h = myBitmap.GetHeight(); - sTmp.Printf ( wxT(" \n"), sPNG.c_str() ); - s += sTmp + wxT("Image from wxSVG ") + wxT("\n"); - - if (m_OK && bPNG_OK) - { - write(s); - } - m_OK = m_outfile->IsOk() && bPNG_OK; + m_bmp_handler->ProcessBitmap(bmp, x, y, *m_outfile); } void wxSVGFileDCImpl::write(const wxString &s) diff --git a/Externals/wxWidgets3/src/common/debugrpt.cpp b/Externals/wxWidgets3/src/common/debugrpt.cpp index 7f3c5fba07..4200249ccc 100644 --- a/Externals/wxWidgets3/src/common/debugrpt.cpp +++ b/Externals/wxWidgets3/src/common/debugrpt.cpp @@ -77,7 +77,7 @@ public: bool IsOk() const { return m_isOk; } protected: - virtual void OnStackFrame(const wxStackFrame& frame); + virtual void OnStackFrame(const wxStackFrame& frame) wxOVERRIDE; wxXmlNode *m_nodeStack; bool m_isOk; @@ -234,12 +234,7 @@ wxDebugReport::~wxDebugReport() if ( !m_dir.empty() ) { - // Temp fix: what should this be? eVC++ doesn't like wxRmDir -#ifdef __WXWINCE__ - if ( wxRmdir(m_dir.fn_str()) != 0 ) -#else if ( wxRmDir(m_dir.fn_str()) != 0 ) -#endif { wxLogSysError(_("Failed to clean up debug report directory \"%s\""), m_dir.c_str()); diff --git a/Externals/wxWidgets3/src/common/descrip.mms b/Externals/wxWidgets3/src/common/descrip.mms index 18ffe12cb3..122ef1ccb6 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 : 19 September 2013 * +# Date : 25 February 2016 * # * #***************************************************************************** .first @@ -47,7 +47,7 @@ LEX=flex .suffixes : .cpp .cpp.obj : - cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp + cxx /object=$(MMS$TARGET_NAME).obj $(CXX_DEFINE) $(MMS$TARGET_NAME).cpp .c.obj : cc $(CFLAGS)$(CC_DEFINE) $(MMS$TARGET_NAME).c @@ -225,7 +225,8 @@ OBJECTS3=listctrlcmn.obj,socketiohandler.obj,fdiodispatcher.obj,\ spinbtncmn.obj,scrolbarcmn.obj,colourdata.obj,fontdata.obj,\ valnum.obj,numformatter.obj,markupparser.obj,\ affinematrix2d.obj,richtooltipcmn.obj,persist.obj,time.obj,\ - textmeasurecmn.obj,modalhook.obj,threadinfo.obj + textmeasurecmn.obj,modalhook.obj,threadinfo.obj,\ + addremovectrl.obj,notifmsgcmn.obj OBJECTS_MOTIF=radiocmn.obj,combocmn.obj @@ -552,7 +553,7 @@ hash.obj : hash.cpp hashmap.obj : hashmap.cpp helpbase.obj : helpbase.cpp http.obj : http.cpp - cxx$(CXXFLAGS)$(CXX_DEFINE)/warn=disable=(UNSCOMZER)/obj=http.obj \ + cxx$(CXX_DEFINE)/warn=disable=(UNSCOMZER)/obj=http.obj \ http.cpp hyperlnkcmn.obj : hyperlnkcmn.cpp iconbndl.obj : iconbndl.cpp @@ -590,7 +591,7 @@ platinfo.obj : platinfo.cpp popupcmn.obj : popupcmn.cpp prntbase.obj : prntbase.cpp process.obj : process.cpp - cxx $(CXXFLAGS)$(CXX_DEFINE)/warn=disable=(UNSCOMZER) process.cpp + cxx /object=process.obj$(CXX_DEFINE)/warn=disable=(UNSCOMZER) process.cpp protocol.obj : protocol.cpp quantize.obj : quantize.cpp radiocmn.obj : radiocmn.cpp @@ -667,7 +668,7 @@ srchcmn.obj : srchcmn.cpp textentrycmn.obj : textentrycmn.cpp filectrlcmn.obj : filectrlcmn.cpp cairo.obj : cairo.cpp - cxx$(CXXFLAGS)$(CXX_DEFINE)/obj=cairo.obj cairo.cpp + cxx$(CXX_DEFINE)/obj=cairo.obj cairo.cpp overlaycmn.obj : overlaycmn.cpp windowid.obj : windowid.cpp calctrlcmn.obj : calctrlcmn.cpp @@ -719,3 +720,5 @@ time.obj : time.cpp textmeasurecmn.obj : textmeasurecmn.cpp modalhook.obj : modalhook.cpp threadinfo.obj : threadinfo.cpp +addremovectrl.obj : addremovectrl.cpp +notifmsgcmn.obj : notifmsgcmn.cpp diff --git a/Externals/wxWidgets3/src/common/dircmn.cpp b/Externals/wxWidgets3/src/common/dircmn.cpp index 11856868f8..45b95cb18f 100644 --- a/Externals/wxWidgets3/src/common/dircmn.cpp +++ b/Externals/wxWidgets3/src/common/dircmn.cpp @@ -61,7 +61,7 @@ bool wxDir::HasFiles(const wxString& spec) const } // we have a (much) faster version for Unix -#if (defined(__CYGWIN__) && defined(__WINDOWS__)) || !defined(__UNIX_LIKE__) || defined(__EMX__) || defined(__WINE__) +#if (defined(__CYGWIN__) && defined(__WINDOWS__)) || !defined(__UNIX_LIKE__) || defined(__WINE__) bool wxDir::HasSubDirs(const wxString& spec) const { @@ -126,7 +126,7 @@ size_t wxDir::Traverse(wxDirTraverser& sink, { default: wxFAIL_MSG(wxT("unexpected OnDir() return value") ); - // fall through + wxFALLTHROUGH; case wxDIR_STOP: cont = false; @@ -154,11 +154,11 @@ size_t wxDir::Traverse(wxDirTraverser& sink, { default: wxFAIL_MSG(wxT("unexpected OnOpenError() return value") ); - // fall through + wxFALLTHROUGH; case wxDIR_STOP: cont = false; - // fall through + wxFALLTHROUGH; case wxDIR_IGNORE: tryagain = false; @@ -222,13 +222,13 @@ class wxDirTraverserSimple : public wxDirTraverser public: wxDirTraverserSimple(wxArrayString& files) : m_files(files) { } - virtual wxDirTraverseResult OnFile(const wxString& filename) + virtual wxDirTraverseResult OnFile(const wxString& filename) wxOVERRIDE { m_files.push_back(filename); return wxDIR_CONTINUE; } - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) + virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) wxOVERRIDE { return wxDIR_CONTINUE; } @@ -269,13 +269,13 @@ class wxDirTraverserFindFirst : public wxDirTraverser public: wxDirTraverserFindFirst() { } - virtual wxDirTraverseResult OnFile(const wxString& filename) + virtual wxDirTraverseResult OnFile(const wxString& filename) wxOVERRIDE { m_file = filename; return wxDIR_STOP; } - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) + virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) wxOVERRIDE { return wxDIR_CONTINUE; } @@ -320,7 +320,7 @@ class wxDirTraverserSumSize : public wxDirTraverser public: wxDirTraverserSumSize() { } - virtual wxDirTraverseResult OnFile(const wxString& filename) + virtual wxDirTraverseResult OnFile(const wxString& filename) wxOVERRIDE { // wxFileName::GetSize won't use this class again as // we're passing it a file and not a directory; @@ -342,7 +342,7 @@ public: return wxDIR_CONTINUE; } - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) + virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) wxOVERRIDE { return wxDIR_CONTINUE; } diff --git a/Externals/wxWidgets3/src/common/dirctrlcmn.cpp b/Externals/wxWidgets3/src/common/dirctrlcmn.cpp index 617875f1f7..34215a83ad 100644 --- a/Externals/wxWidgets3/src/common/dirctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/dirctrlcmn.cpp @@ -62,7 +62,7 @@ wxBEGIN_FLAGS( wxGenericDirCtrlStyle ) wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS) wxEND_FLAGS( wxGenericDirCtrlStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl, "wx/dirctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericDirCtrl, wxControl, "wx/dirctrl.h"); wxBEGIN_PROPERTIES_TABLE(wxGenericDirCtrl) wxHIDE_PROPERTY( Children ) diff --git a/Externals/wxWidgets3/src/common/dlgcmn.cpp b/Externals/wxWidgets3/src/common/dlgcmn.cpp index 3f73371484..5067471b11 100644 --- a/Externals/wxWidgets3/src/common/dlgcmn.cpp +++ b/Externals/wxWidgets3/src/common/dlgcmn.cpp @@ -78,23 +78,16 @@ wxFLAGS_MEMBER(wxTAB_TRAVERSAL) wxFLAGS_MEMBER(wxCLIP_CHILDREN) // dialog styles -wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY) wxFLAGS_MEMBER(wxSTAY_ON_TOP) wxFLAGS_MEMBER(wxCAPTION) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxTHICK_FRAME) -#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxSYSTEM_MENU) wxFLAGS_MEMBER(wxRESIZE_BORDER) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxRESIZE_BOX) -#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxCLOSE_BOX) wxFLAGS_MEMBER(wxMAXIMIZE_BOX) wxFLAGS_MEMBER(wxMINIMIZE_BOX) wxEND_FLAGS( wxDialogStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow, "wx/dialog.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow, "wx/dialog.h"); wxBEGIN_PROPERTIES_TABLE(wxDialog) wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString(), \ @@ -114,13 +107,13 @@ wxCONSTRUCTOR_6( wxDialog, wxWindow*, Parent, wxWindowID, Id, \ // wxDialogBase // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow) +wxBEGIN_EVENT_TABLE(wxDialogBase, wxTopLevelWindow) EVT_BUTTON(wxID_ANY, wxDialogBase::OnButton) EVT_CLOSE(wxDialogBase::OnCloseWindow) EVT_CHAR_HOOK(wxDialogBase::OnCharHook) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxDialogLayoutAdapter* wxDialogBase::sm_layoutAdapter = NULL; bool wxDialogBase::sm_layoutAdaptation = false; @@ -166,9 +159,7 @@ wxWindow *wxDialogBase::CheckIfCanBeUsedAsParent(wxWindow *parent) const return NULL; } - // FIXME-VC6: this compiler requires an explicit const cast or it fails - // with error C2446 - if ( const_cast(parent) == this ) + if ( parent == this ) { // not sure if this can really happen but it doesn't hurt to guard // against this clearly invalid situation @@ -197,7 +188,7 @@ wxDialogBase::GetParentForModalDialog(wxWindow *parent, long style) const wxGetTopLevelParent(wxGetActiveWindow())); // and finally the application main window - if ( !parent ) + if ( !parent && wxTheApp ) parent = CheckIfCanBeUsedAsParent(wxTheApp->GetTopWindow()); return parent; @@ -231,47 +222,15 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, wxSizer *wxDialogBase::CreateButtonSizer(long flags) { -#ifdef __SMARTPHONE__ - wxDialog* dialog = (wxDialog*) this; - if ( flags & wxOK ) - dialog->SetLeftMenu(wxID_OK); - - if ( flags & wxCANCEL ) - dialog->SetRightMenu(wxID_CANCEL); - - if ( flags & wxYES ) - dialog->SetLeftMenu(wxID_YES); - - if ( flags & wxNO ) - dialog->SetRightMenu(wxID_NO); - - return NULL; -#else // !__SMARTPHONE__ - #if wxUSE_BUTTON -#ifdef __POCKETPC__ - // PocketPC guidelines recommend for Ok/Cancel dialogs to use OK button - // located inside caption bar and implement Cancel functionality through - // Undo outside dialog. As native behaviour this will be default here but - // can be replaced with real wxButtons by setting the option below to 1 - if ( (flags & ~(wxCANCEL|wxNO_DEFAULT)) != wxOK || - wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) ) -#endif // __POCKETPC__ - { - return CreateStdDialogButtonSizer(flags); - } -#ifdef __POCKETPC__ - return NULL; -#endif // __POCKETPC__ + return CreateStdDialogButtonSizer(flags); #else // !wxUSE_BUTTON wxUnusedVar(flags); return NULL; #endif // wxUSE_BUTTON/!wxUSE_BUTTON - -#endif // __SMARTPHONE__/!__SMARTPHONE__ } wxSizer *wxDialogBase::CreateSeparatedSizer(wxSizer *sizer) @@ -376,6 +335,8 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) SetAffirmativeId(wxID_OK); else if (flags & wxYES) SetAffirmativeId(wxID_YES); + else if (flags & wxCLOSE) + SetAffirmativeId(wxID_CLOSE); sizer->Realize(); @@ -448,7 +409,7 @@ bool wxDialogBase::SendCloseButtonClickEvent() if ( EmulateButtonClickIfPresent(wxID_CANCEL) ) return true; idCancel = GetAffirmativeId(); - // fall through + wxFALLTHROUGH; default: // translate Esc to button press for the button with given id @@ -513,7 +474,7 @@ void wxDialogBase::OnButton(wxCommandEvent& event) wxDEFINE_EVENT( wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxWindowModalDialogEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxWindowModalDialogEvent, wxCommandEvent); void wxDialogBase::ShowWindowModal () { @@ -567,7 +528,13 @@ void wxDialogBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) closing.Append(this); - if ( !SendCloseButtonClickEvent() ) + // When a previously hidden (necessarily modeless) dialog is being closed, + // we must not perform the usual validation and data transfer steps as they + // had been already done when it was hidden and doing it again now would be + // unexpected and could result in e.g. the dialog asking for confirmation + // before discarding the changes being shown again, which doesn't make + // sense as the dialog is not being closed in response to any user action. + if ( !IsShown() || !SendCloseButtonClickEvent() ) { // If the handler didn't close the dialog (e.g. because there is no // button with matching id) we still want to close it when the user @@ -632,9 +599,9 @@ wxDialogLayoutAdapter* wxDialogBase::SetLayoutAdapter(wxDialogLayoutAdapter* ada * Standard adapter */ -IMPLEMENT_CLASS(wxDialogLayoutAdapter, wxObject) +wxIMPLEMENT_CLASS(wxDialogLayoutAdapter, wxObject); -IMPLEMENT_CLASS(wxStandardDialogLayoutAdapter, wxDialogLayoutAdapter) +wxIMPLEMENT_CLASS(wxStandardDialogLayoutAdapter, wxDialogLayoutAdapter); // Allow for caption size on wxWidgets < 2.9 #if defined(__WXGTK__) && !wxCHECK_VERSION(2,9,0) @@ -673,7 +640,7 @@ bool wxStandardDialogLayoutAdapter::DoLayoutAdaptation(wxDialog* dialog) wxScrolledWindow* scrolledWindow = wxDynamicCast(page, wxScrolledWindow); if (scrolledWindow) windows.Append(scrolledWindow); - else if (!scrolledWindow && page->GetSizer()) + else if (page->GetSizer()) { // Create a scrolled window and reparent scrolledWindow = CreateScrolledWindow(page); @@ -1004,11 +971,11 @@ bool wxStandardDialogLayoutAdapter::DoFitWithScrolling(wxDialog* dialog, wxWindo class wxDialogLayoutAdapterModule: public wxModule { - DECLARE_DYNAMIC_CLASS(wxDialogLayoutAdapterModule) + wxDECLARE_DYNAMIC_CLASS(wxDialogLayoutAdapterModule); public: wxDialogLayoutAdapterModule() {} - virtual void OnExit() { delete wxDialogBase::SetLayoutAdapter(NULL); } - virtual bool OnInit() { wxDialogBase::SetLayoutAdapter(new wxStandardDialogLayoutAdapter); return true; } + virtual void OnExit() wxOVERRIDE { delete wxDialogBase::SetLayoutAdapter(NULL); } + virtual bool OnInit() wxOVERRIDE { wxDialogBase::SetLayoutAdapter(new wxStandardDialogLayoutAdapter); return true; } }; -IMPLEMENT_DYNAMIC_CLASS(wxDialogLayoutAdapterModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDialogLayoutAdapterModule, wxModule); diff --git a/Externals/wxWidgets3/src/common/dobjcmn.cpp b/Externals/wxWidgets3/src/common/dobjcmn.cpp index 5e4d43dcc0..10ba0a267a 100644 --- a/Externals/wxWidgets3/src/common/dobjcmn.cpp +++ b/Externals/wxWidgets3/src/common/dobjcmn.cpp @@ -284,12 +284,12 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const } bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), const void *buf) + size_t len, const void *buf) { if ( buf == NULL ) return false; - wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf ); + wxWCharBuffer buffer = GetConv(format).cMB2WC((const char*)buf, len, NULL); SetText( buffer ); diff --git a/Externals/wxWidgets3/src/common/docmdi.cpp b/Externals/wxWidgets3/src/common/docmdi.cpp index ffdf7e6247..97d7bafff6 100644 --- a/Externals/wxWidgets3/src/common/docmdi.cpp +++ b/Externals/wxWidgets3/src/common/docmdi.cpp @@ -19,8 +19,8 @@ #include "wx/docmdi.h" -IMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame) -IMPLEMENT_CLASS(wxDocMDIChildFrame, wxMDIChildFrame) +wxIMPLEMENT_CLASS(wxDocMDIParentFrame, wxMDIParentFrame); +wxIMPLEMENT_CLASS(wxDocMDIChildFrame, wxMDIChildFrame); #endif // wxUSE_DOC_VIEW_ARCHITECTURE diff --git a/Externals/wxWidgets3/src/common/docview.cpp b/Externals/wxWidgets3/src/common/docview.cpp index b646d9efe2..bf5002e68f 100644 --- a/Externals/wxWidgets3/src/common/docview.cpp +++ b/Externals/wxWidgets3/src/common/docview.cpp @@ -79,15 +79,15 @@ // wxWidgets macros // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler) -IMPLEMENT_CLASS(wxDocChildFrame, wxFrame) -IMPLEMENT_CLASS(wxDocParentFrame, wxFrame) +wxIMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler); +wxIMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler); +wxIMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler); +wxIMPLEMENT_CLASS(wxDocChildFrame, wxFrame); +wxIMPLEMENT_CLASS(wxDocParentFrame, wxFrame); #if wxUSE_PRINTING_ARCHITECTURE - IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout) +wxIMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout); #endif // ============================================================================ @@ -276,7 +276,13 @@ wxDocManager *wxDocument::GetDocumentManager() const if ( m_documentParent ) return m_documentParent->GetDocumentManager(); - return m_documentTemplate ? m_documentTemplate->GetDocumentManager() : NULL; + if ( m_documentTemplate ) + return m_documentTemplate->GetDocumentManager(); + + // Fall back on the global manager if the document doesn't have a template, + // code elsewhere, notably in DeleteAllViews(), relies on the document + // always being managed by some manager. + return wxDocManager::GetDocumentManager(); } bool wxDocument::OnNewDocument() @@ -401,10 +407,6 @@ bool wxDocument::OnSaveDocument(const wxString& file) Modify(false); SetFilename(file); SetDocumentSaved(true); -#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON - wxFileName fn(file) ; - fn.MacSetDefaultTypeAndCreator() ; -#endif return true; } @@ -532,7 +534,8 @@ bool wxDocument::OnSaveModified() GetUserReadableName() ), wxTheApp->GetAppDisplayName(), - wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE + wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE, + GetDocumentWindow() ) ) { case wxNO: @@ -857,11 +860,6 @@ wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags) bool wxDocTemplate::InitDocument(wxDocument* doc, const wxString& path, long flags) { - // Normally, if wxDocument::OnCreate() fails, it happens because the view - // initialization fails and then the document is destroyed due to the - // destruction of its last view. But take into account the (currently - // unrealized, AFAICS) possibility of other failures as well and ensure - // that the document is always destroyed if it can't be initialized. wxTRY { doc->SetFilename(path); @@ -869,7 +867,19 @@ wxDocTemplate::InitDocument(wxDocument* doc, const wxString& path, long flags) GetDocumentManager()->AddDocument(doc); doc->SetCommandProcessor(doc->OnCreateCommandProcessor()); - return doc->OnCreate(path, flags); + if ( doc->OnCreate(path, flags) ) + return true; + + // The document may be already destroyed, this happens if its view + // creation fails as then the view being created is destroyed + // triggering the destruction of the document as this first view is + // also the last one. However if OnCreate() fails for any reason other + // than view creation failure, the document is still alive and we need + // to clean it up ourselves to avoid having a zombie document. + if ( GetDocumentManager()->GetDocuments().Member(doc) ) + doc->DeleteAllViews(); + + return false; } wxCATCH_ALL( if ( GetDocumentManager()->GetDocuments().Member(doc) ) @@ -929,7 +939,7 @@ wxView *wxDocTemplate::DoCreateView() // wxDocManager // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) EVT_MENU(wxID_OPEN, wxDocManager::OnFileOpen) EVT_MENU(wxID_CLOSE, wxDocManager::OnFileClose) EVT_MENU(wxID_CLOSE_ALL, wxDocManager::OnFileCloseAll) @@ -965,7 +975,7 @@ BEGIN_EVENT_TABLE(wxDocManager, wxEvtHandler) // NB: we keep "Print setup" menu item always enabled as it can be used // even without an active document #endif // wxUSE_PRINTING_ARCHITECTURE -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxDocManager* wxDocManager::sm_docManager = NULL; @@ -994,13 +1004,17 @@ bool wxDocManager::CloseDocument(wxDocument* doc, bool force) if ( !doc->Close() && !force ) return false; + // To really force the document to close, we must ensure that it isn't + // modified, otherwise it would ask the user about whether it should be + // destroyed (again, it had been already done by Close() above) and might + // not destroy it at all, while we must do it here. + doc->Modify(false); + // Implicitly deletes the document when // the last view is deleted doc->DeleteAllViews(); - // Check we're really deleted - if (m_docs.Member(doc)) - delete doc; + wxASSERT(!m_docs.Member(doc)); return true; } @@ -1140,17 +1154,21 @@ void wxDocManager::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) void wxDocManager::OnMRUFile(wxCommandEvent& event) { - // Check if the id is in the range assigned to MRU list entries. - const int id = event.GetId(); - if ( id >= wxID_FILE1 && - id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + if ( m_fileHistory ) { - DoOpenMRUFile(id - wxID_FILE1); - } - else - { - event.Skip(); + // Check if the id is in the range assigned to MRU list entries. + const int id = event.GetId(); + if ( id >= wxID_FILE1 && + id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + { + DoOpenMRUFile(id - wxID_FILE1); + + // Don't skip the event below. + return; + } } + + event.Skip(); } void wxDocManager::DoOpenMRUFile(unsigned n) @@ -1810,7 +1828,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, int noTemplates, bool sort) { wxArrayString strings; - wxScopedArray data(new wxDocTemplate *[noTemplates]); + wxScopedArray data(noTemplates); int i; int n = 0; @@ -1888,7 +1906,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, int noTemplates, bool sort) { wxArrayString strings; - wxScopedArray data(new wxDocTemplate *[noTemplates]); + wxScopedArray data(noTemplates); int i; int n = 0; diff --git a/Externals/wxWidgets3/src/common/dpycmn.cpp b/Externals/wxWidgets3/src/common/dpycmn.cpp index 1556d5784c..ecc744d4aa 100644 --- a/Externals/wxWidgets3/src/common/dpycmn.cpp +++ b/Externals/wxWidgets3/src/common/dpycmn.cpp @@ -59,28 +59,28 @@ class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl public: wxDisplayImplSingle() : wxDisplayImpl(0) { } - virtual wxRect GetGeometry() const + virtual wxRect GetGeometry() const wxOVERRIDE { wxRect r; wxDisplaySize(&r.width, &r.height); return r; } - virtual wxRect GetClientArea() const { return wxGetClientDisplayRect(); } + virtual wxRect GetClientArea() const wxOVERRIDE { return wxGetClientDisplayRect(); } - virtual wxString GetName() const { return wxString(); } + virtual wxString GetName() const wxOVERRIDE { return wxString(); } #if wxUSE_DISPLAY // no video modes support for us, provide just the stubs - virtual wxArrayVideoModes GetModes(const wxVideoMode& WXUNUSED(mode)) const + virtual wxArrayVideoModes GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE { return wxArrayVideoModes(); } - virtual wxVideoMode GetCurrentMode() const { return wxVideoMode(); } + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE { return wxVideoMode(); } - virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) { return false; } + virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE { return false; } #endif // wxUSE_DISPLAY @@ -94,16 +94,16 @@ public: class wxDisplayModule : public wxModule { public: - virtual bool OnInit() { return true; } - virtual void OnExit() + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxDELETE(gs_factory); } - DECLARE_DYNAMIC_CLASS(wxDisplayModule) + wxDECLARE_DYNAMIC_CLASS(wxDisplayModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule); // ============================================================================ // wxDisplay implementation diff --git a/Externals/wxWidgets3/src/common/dummy.cpp b/Externals/wxWidgets3/src/common/dummy.cpp index 98044d0f4d..0743f76a78 100644 --- a/Externals/wxWidgets3/src/common/dummy.cpp +++ b/Externals/wxWidgets3/src/common/dummy.cpp @@ -26,7 +26,3 @@ #ifdef __WINDOWS__ #include "wx/msw/msvcrt.h" #endif - -#ifdef __VISAGECPP__ - char wxDummyChar = 0; -#endif diff --git a/Externals/wxWidgets3/src/common/dynlib.cpp b/Externals/wxWidgets3/src/common/dynlib.cpp index 9683402770..b174aa9560 100644 --- a/Externals/wxWidgets3/src/common/dynlib.cpp +++ b/Externals/wxWidgets3/src/common/dynlib.cpp @@ -54,7 +54,7 @@ WX_DEFINE_USER_EXPORTED_OBJARRAY(wxDynamicLibraryDetailsArray) // --------------------------------------------------------------------------- // for MSW/Unix it is defined in platform-specific file -#if !(defined(__WINDOWS__) || defined(__UNIX__)) || defined(__EMX__) +#if !(defined(__WINDOWS__) || defined(__UNIX__)) wxDllType wxDynamicLibrary::GetProgramHandle() { @@ -82,15 +82,7 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) } } - // different ways to load a shared library - // - // FIXME: should go to the platform-specific files! -#if defined(__WXPM__) || defined(__EMX__) - char err[256] = ""; - DosLoadModule(err, sizeof(err), libname.c_str(), &m_handle); -#else // this should be the only remaining branch eventually m_handle = RawLoad(libname, flags); -#endif if ( m_handle == 0 && !(flags & wxDL_QUIET) ) { @@ -104,36 +96,12 @@ bool wxDynamicLibrary::Load(const wxString& libnameOrig, int flags) return IsLoaded(); } -// 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(__WINDOWS__) && !defined(__UNIX__)) || defined(__EMX__) - -/* static */ -void wxDynamicLibrary::Unload(wxDllType handle) -{ -#if defined(__OS2__) || defined(__EMX__) - DosFreeModule( handle ); -#else - #error "runtime shared lib support not implemented" -#endif -} - -#endif // !(__WINDOWS__ || __UNIX__) - void *wxDynamicLibrary::DoGetSymbol(const wxString &name, bool *success) const { wxCHECK_MSG( IsLoaded(), NULL, wxT("Can't load symbol from unloaded library") ); - void *symbol = 0; - - wxUnusedVar(symbol); -#if defined(__WXPM__) || defined(__EMX__) - DosQueryProcAddr( m_handle, 1L, name.c_str(), (PFN*)symbol ); -#else - symbol = RawGetSymbol(m_handle, name); -#endif + void *symbol = RawGetSymbol(m_handle, name); if ( success ) *success = symbol != NULL; @@ -165,7 +133,7 @@ void *wxDynamicLibrary::GetSymbol(const wxString& name, bool *success) const wxString wxDynamicLibrary::GetDllExt(wxDynamicLibraryCategory cat) { wxUnusedVar(cat); -#if defined(__WINDOWS__) || defined(__WXPM__) || defined(__EMX__) +#if defined(__WINDOWS__) return ".dll"; #elif defined(__HPUX__) return ".sl"; @@ -192,7 +160,7 @@ wxDynamicLibrary::CanonicalizeName(const wxString& name, wxString nameCanonic; // under Unix the library names usually start with "lib" prefix, add it -#if defined(__UNIX__) && !defined(__EMX__) +#if defined(__UNIX__) switch ( cat ) { case wxDL_LIBRARY: @@ -230,7 +198,7 @@ wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name, suffix = wxString(wxT("_")) + suffix; #define WXSTRINGIZE(x) #x -#if defined(__UNIX__) && !defined(__EMX__) +#if defined(__UNIX__) #if (wxMINOR_VERSION % 2) == 0 #define wxDLLVER(x,y,z) "-" WXSTRINGIZE(x) "." WXSTRINGIZE(y) #else @@ -255,8 +223,6 @@ wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name, suffix << wxT("_gcc"); #elif defined(__VISUALC__) suffix << wxT("_vc"); - #elif defined(__WATCOMC__) - suffix << wxT("_wat"); #elif defined(__BORLANDC__) suffix << wxT("_bcc"); #endif diff --git a/Externals/wxWidgets3/src/common/dynload.cpp b/Externals/wxWidgets3/src/common/dynload.cpp index 0b184d0e5b..8aff4fed50 100644 --- a/Externals/wxWidgets3/src/common/dynload.cpp +++ b/Externals/wxWidgets3/src/common/dynload.cpp @@ -51,24 +51,24 @@ public: wxPluginLibraryModule() { } // TODO: create ms_classes on demand, why always preallocate it? - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { wxPluginLibrary::ms_classes = new wxDLImports; wxPluginManager::CreateManifest(); return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { wxDELETE(wxPluginLibrary::ms_classes); wxPluginManager::ClearManifest(); } private: - DECLARE_DYNAMIC_CLASS(wxPluginLibraryModule ) + wxDECLARE_DYNAMIC_CLASS(wxPluginLibraryModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxPluginLibraryModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxPluginLibraryModule, wxModule); wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) diff --git a/Externals/wxWidgets3/src/common/effects.cpp b/Externals/wxWidgets3/src/common/effects.cpp index 55a40be7ec..7b3f3b8cb5 100644 --- a/Externals/wxWidgets3/src/common/effects.cpp +++ b/Externals/wxWidgets3/src/common/effects.cpp @@ -30,7 +30,7 @@ * wxEffectsImpl: various 3D effects */ -IMPLEMENT_CLASS(wxEffectsImpl, wxObject) +wxIMPLEMENT_CLASS(wxEffectsImpl, wxObject); // Assume system colours wxEffectsImpl::wxEffectsImpl() diff --git a/Externals/wxWidgets3/src/common/emptydmy.cpp b/Externals/wxWidgets3/src/common/emptydmy.cpp deleted file mode 100644 index 4c2b115372..0000000000 --- a/Externals/wxWidgets3/src/common/emptydmy.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// This file exists so that it can be compiled into an object so the linker -// will have something to chew on so that builds don't break when a platform -// lacks any objects in a particular multilib. diff --git a/Externals/wxWidgets3/src/common/encconv.cpp b/Externals/wxWidgets3/src/common/encconv.cpp index e666b9f245..b9094288ed 100644 --- a/Externals/wxWidgets3/src/common/encconv.cpp +++ b/Externals/wxWidgets3/src/common/encconv.cpp @@ -33,10 +33,6 @@ bool gMacEncodingsInited[wxFONTENCODING_MACMAX-wxFONTENCODING_MACMIN+1] ; #endif -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" // for bsearch() -#endif - static const wxUint16* GetEncTable(wxFontEncoding enc) { #ifdef __WXMAC__ @@ -351,7 +347,7 @@ wxString wxEncodingConverter::Convert(const wxString& input) const #define STOP wxFONTENCODING_SYSTEM -#define NUM_OF_PLATFORMS 4 /*must conform to enum wxPLATFORM_XXXX !!!*/ +#define NUM_OF_PLATFORMS 3 /*must conform to enum wxPLATFORM_XXXX !!!*/ #define ENC_PER_PLATFORM 3 // max no. of encodings for one language used on one platform. // Using maximum of everything at the current moment to not make the @@ -366,7 +362,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_1, wxFONTENCODING_ISO8859_15, STOP}, /* windows */ {wxFONTENCODING_CP1252, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACROMAN, STOP} }, @@ -374,7 +369,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_2, STOP}, /* windows */ {wxFONTENCODING_CP1250, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACCENTRALEUR, STOP} }, @@ -382,7 +376,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_13, wxFONTENCODING_ISO8859_4, STOP}, /* windows */ {wxFONTENCODING_CP1257, STOP}, - /* os2 */ {STOP}, /* mac */ {STOP} }, @@ -390,7 +383,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_8, STOP}, /* windows */ {wxFONTENCODING_CP1255, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACHEBREW, STOP} }, @@ -398,7 +390,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_7, STOP}, /* windows */ {wxFONTENCODING_CP1253, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACGREEK, STOP} }, @@ -406,7 +397,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_6, STOP}, /* windows */ {wxFONTENCODING_CP1256, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACARABIC, STOP} }, @@ -414,7 +404,6 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_ISO8859_9, STOP}, /* windows */ {wxFONTENCODING_CP1254, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACTURKISH, STOP} }, @@ -422,11 +411,10 @@ static const wxFontEncoding { /* unix */ {wxFONTENCODING_KOI8, wxFONTENCODING_KOI8_U, wxFONTENCODING_ISO8859_5, STOP}, /* windows */ {wxFONTENCODING_CP1251, STOP}, - /* os2 */ {STOP}, /* mac */ {wxFONTENCODING_MACCYRILLIC, STOP} }, - {{STOP},{STOP},{STOP},{STOP}} /* Terminator */ + {{STOP},{STOP},{STOP}} /* Terminator */ /* no, _not_ Arnold! */ }; @@ -446,15 +434,25 @@ wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding e { #if defined(__WINDOWS__) platform = wxPLATFORM_WINDOWS; -#elif defined(__WXGTK__) || defined(__WXMOTIF__) - platform = wxPLATFORM_UNIX; -#elif defined(__WXPM__) - platform = wxPLATFORM_OS2; #elif defined(__WXMAC__) platform = wxPLATFORM_MAC; +#else + platform = wxPLATFORM_UNIX; #endif } + switch ( platform ) + { + case wxPLATFORM_UNIX: + case wxPLATFORM_WINDOWS: + case wxPLATFORM_MAC: + break; + + default: + wxFAIL_MSG(wxS("Invalid platform specified")); + return wxFontEncodingArray(); + } + int i, clas, e ; const wxFontEncoding *f; wxFontEncodingArray arr; diff --git a/Externals/wxWidgets3/src/common/event.cpp b/Externals/wxWidgets3/src/common/event.cpp index 914995e2fa..3c3627b111 100644 --- a/Externals/wxWidgets3/src/common/event.cpp +++ b/Externals/wxWidgets3/src/common/event.cpp @@ -37,6 +37,7 @@ #if wxUSE_GUI #include "wx/window.h" + #include "wx/combobox.h" #include "wx/control.h" #include "wx/dc.h" #include "wx/spinbutt.h" @@ -59,49 +60,49 @@ // ---------------------------------------------------------------------------- #if wxUSE_BASE - IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) - IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) - IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxEvent) + wxIMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject); + wxIMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject); + wxIMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxThreadEvent, wxEvent); #endif // wxUSE_BASE #if wxUSE_GUI - IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxDisplayChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent, wxEvent) - IMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent, wxCommandEvent) + wxIMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxScrollWinEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxNcPaintEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxIconizeEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayChangedEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxQueryNewPaletteEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent, wxEvent); + wxIMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent, wxCommandEvent); #endif // wxUSE_GUI #if wxUSE_BASE @@ -135,10 +136,10 @@ public: virtual bool OnInit() { return true; } virtual void OnExit() { wxEventHashTable::ClearAll(); } - DECLARE_DYNAMIC_CLASS(wxEventTableEntryModule) + wxDECLARE_DYNAMIC_CLASS(wxEventTableEntryModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxEventTableEntryModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxEventTableEntryModule, wxModule); #endif // wxUSE_MEMORY_TRACING @@ -178,8 +179,6 @@ wxDEFINE_EVENT( wxEVT_VLBOX, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_COMBOBOX, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_RCLICKED, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_ENTER, wxCommandEvent ); -wxDEFINE_EVENT( wxEVT_SPINCTRL, wxCommandEvent ); -wxDEFINE_EVENT( wxEVT_SPINCTRLDOUBLE, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_DROPDOWN, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent); wxDEFINE_EVENT( wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent); @@ -207,6 +206,7 @@ wxDEFINE_EVENT( wxEVT_AUX1_DCLICK, wxMouseEvent ); wxDEFINE_EVENT( wxEVT_AUX2_DOWN, wxMouseEvent ); wxDEFINE_EVENT( wxEVT_AUX2_UP, wxMouseEvent ); wxDEFINE_EVENT( wxEVT_AUX2_DCLICK, wxMouseEvent ); +wxDEFINE_EVENT( wxEVT_MAGNIFY, wxMouseEvent ); // Character input event type wxDEFINE_EVENT( wxEVT_CHAR, wxKeyEvent ); @@ -422,33 +422,29 @@ wxEvent& wxEvent::operator=(const wxEvent& src) // wxCommandEvent // ---------------------------------------------------------------------------- -wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) - : wxEvent(theId, commandType) -{ - m_clientData = NULL; - m_clientObject = NULL; - m_isCommandEvent = true; - - // the command events are propagated upwards by default - m_propagationLevel = wxEVENT_PROPAGATE_MAX; -} - wxString wxCommandEvent::GetString() const { - if (m_eventType != wxEVT_TEXT || !m_eventObject) - { - return m_cmdString; - } - else + // This is part of the hack retrieving the event string from the control + // itself only when/if it's really needed to avoid copying potentially huge + // strings coming from multiline text controls. For consistency we also do + // it for combo boxes, even though there are no real performance advantages + // in doing this for them. + if (m_eventType == wxEVT_TEXT && m_eventObject) { #if wxUSE_TEXTCTRL wxTextCtrl *txt = wxDynamicCast(m_eventObject, wxTextCtrl); if ( txt ) return txt->GetValue(); - else #endif // wxUSE_TEXTCTRL - return m_cmdString; + +#if wxUSE_COMBOBOX + wxComboBox* combo = wxDynamicCast(m_eventObject, wxComboBox); + if ( combo ) + return combo->GetValue(); +#endif // wxUSE_COMBOBOX } + + return m_cmdString; } // ---------------------------------------------------------------------------- @@ -568,6 +564,7 @@ wxMouseEvent::wxMouseEvent(wxEventType commandType) m_wheelDelta = 0; m_linesPerAction = 0; m_columnsPerAction = 0; + m_magnification = 0.0f; } void wxMouseEvent::Assign(const wxMouseEvent& event) @@ -592,6 +589,8 @@ void wxMouseEvent::Assign(const wxMouseEvent& event) m_linesPerAction = event.m_linesPerAction; m_columnsPerAction = event.m_columnsPerAction; m_wheelAxis = event.m_wheelAxis; + + m_magnification = event.m_magnification; } // return true if was a button dclick event @@ -601,7 +600,7 @@ bool wxMouseEvent::ButtonDClick(int but) const { default: wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick")); - // fall through + wxFALLTHROUGH; case wxMOUSE_BTN_ANY: return (LeftDClick() || MiddleDClick() || RightDClick() || @@ -631,7 +630,7 @@ bool wxMouseEvent::ButtonDown(int but) const { default: wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown")); - // fall through + wxFALLTHROUGH; case wxMOUSE_BTN_ANY: return (LeftDown() || MiddleDown() || RightDown() || @@ -661,7 +660,7 @@ bool wxMouseEvent::ButtonUp(int but) const { default: wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp")); - // fall through + wxFALLTHROUGH; case wxMOUSE_BTN_ANY: return (LeftUp() || MiddleUp() || RightUp() || @@ -691,7 +690,7 @@ bool wxMouseEvent::Button(int but) const { default: wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button")); - // fall through + wxFALLTHROUGH; case wxMOUSE_BTN_ANY: return ButtonUp(wxMOUSE_BTN_ANY) || @@ -1123,13 +1122,11 @@ wxEvtHandler::~wxEvtHandler() if (m_dynamicEvents) { - for ( wxList::iterator it = m_dynamicEvents->begin(), - end = m_dynamicEvents->end(); - it != end; - ++it ) + size_t cookie; + for ( wxDynamicEventTableEntry* entry = GetFirstDynamicEntry(cookie); + entry; + entry = GetNextDynamicEntry(cookie) ) { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)*it; - // Remove ourselves from sink destructor notifications // (this has usually been done, in wxTrackable destructor) wxEvtHandler *eventSink = entry->m_fn->GetEvtHandler(); @@ -1607,34 +1604,67 @@ bool wxEvtHandler::SafelyProcessEvent(wxEvent& event) } catch ( ... ) { - // notice that we do it in 2 steps to avoid warnings about possibly - // uninitialized loop variable from some versions of g++ which are not - // smart enough to figure out that GetActive() doesn't throw and so - // that loop will always be initialized - wxEventLoopBase *loop = NULL; + wxEventLoopBase * const loop = wxEventLoopBase::GetActive(); try { - loop = wxEventLoopBase::GetActive(); - if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() ) { if ( loop ) loop->Exit(); } //else: continue running current event loop - - return false; } catch ( ... ) { // OnExceptionInMainLoop() threw, possibly rethrowing the same - // exception again: very good, but we still need Exit() to - // be called - if ( loop ) + // exception again. We have to deal with it here because we can't + // allow the exception to escape from the handling code, this will + // result in a crash at best (e.g. when using wxGTK as C++ + // exceptions can't propagate through the C GTK+ code and corrupt + // the stack) and in something even more weird at worst (like + // exceptions completely disappearing into the void under some + // 64 bit versions of Windows). + if ( loop && !loop->IsYielding() ) loop->Exit(); - throw; + + // Give the application one last possibility to store the exception + // for rethrowing it later, when we get back to our code. + bool stored = false; + try + { + if ( wxTheApp ) + stored = wxTheApp->StoreCurrentException(); + } + catch ( ... ) + { + // StoreCurrentException() really shouldn't throw, but if it + // did, take it as an indication that it didn't store it. + } + + // If it didn't take it, just abort, at least like this we behave + // consistently everywhere. + if ( !stored ) + { + try + { + if ( wxTheApp ) + wxTheApp->OnUnhandledException(); + } + catch ( ... ) + { + // And OnUnhandledException() absolutely shouldn't throw, + // but we still must account for the possibility that it + // did. At least show some information about the exception + // in this case. + wxTheApp->wxAppConsoleBase::OnUnhandledException(); + } + + wxAbort(); + } } } + + return false; #endif // wxUSE_EXCEPTIONS } @@ -1663,11 +1693,20 @@ void wxEvtHandler::DoBind(int id, wxDynamicEventTableEntry *entry = new wxDynamicEventTableEntry(eventType, id, lastId, func, userData); - if (!m_dynamicEvents) - m_dynamicEvents = new wxList; + // Check if the derived class allows binding such event handlers. + if ( !OnDynamicBind(*entry) ) + { + delete entry; + return; + } - // Insert at the front of the list so most recent additions are found first - m_dynamicEvents->Insert( (wxObject*) entry ); + if (!m_dynamicEvents) + m_dynamicEvents = new DynamicEvents; + + // We prefer to push back the entry here and then iterate over the vector + // in reverse direction in GetNextDynamicEntry() as it's more efficient + // than inserting the element at the front. + m_dynamicEvents->push_back(entry); // Make sure we get to know when a sink is destroyed wxEvtHandler *eventSink = func->GetEvtHandler(); @@ -1691,11 +1730,11 @@ wxEvtHandler::DoUnbind(int id, if (!m_dynamicEvents) return false; - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(); - while (node) + size_t cookie; + for ( wxDynamicEventTableEntry* entry = GetFirstDynamicEntry(cookie); + entry; + entry = GetNextDynamicEntry(cookie) ) { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); - if ((entry->m_id == id) && ((entry->m_lastId == lastId) || (lastId == wxID_ANY)) && ((entry->m_eventType == eventType) || (eventType == wxEVT_NULL)) && @@ -1712,28 +1751,77 @@ wxEvtHandler::DoUnbind(int id, } delete entry->m_callbackUserData; - m_dynamicEvents->Erase( node ); + + // We can't delete the entry from the vector if we're currently + // iterating over it. As we don't know whether we're or not, just + // null it for now and we will really erase it when we do finish + // iterating over it the next time. + // + // Notice that we rely on "cookie" being just the index into the + // vector, which is not guaranteed by our API, but here we can use + // this implementation detail. + (*m_dynamicEvents)[cookie] = NULL; + delete entry; return true; } - node = node->GetNext(); } return false; } +wxDynamicEventTableEntry* +wxEvtHandler::GetFirstDynamicEntry(size_t& cookie) const +{ + if ( !m_dynamicEvents ) + return NULL; + + // The handlers are in LIFO order, so we must start at the end. + cookie = m_dynamicEvents->size(); + return GetNextDynamicEntry(cookie); +} + +wxDynamicEventTableEntry* +wxEvtHandler::GetNextDynamicEntry(size_t& cookie) const +{ + // On entry here cookie is one greater than the index of the entry to + // return, so if it is 0, it means that there are no more entries. + while ( cookie ) + { + // Otherwise return the element at the previous index, skipping any + // null elements which indicate removed entries. + wxDynamicEventTableEntry* const entry = m_dynamicEvents->at(--cookie); + if ( entry ) + return entry; + } + + return NULL; +} + bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) { wxCHECK_MSG( m_dynamicEvents, false, wxT("caller should check that we have dynamic events") ); - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(); - while (node) - { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); + DynamicEvents& dynamicEvents = *m_dynamicEvents; - // get next node before (maybe) calling the event handler as it could - // call Disconnect() invalidating the current node - node = node->GetNext(); + bool needToPruneDeleted = false; + + // We can't use Get{First,Next}DynamicEntry() here as they hide the deleted + // but not yet pruned entries from the caller, but here we do want to know + // about them, so iterate directly. Remember to do it in the reverse order + // to honour the order of handlers connection. + for ( size_t n = dynamicEvents.size(); n; n-- ) + { + wxDynamicEventTableEntry* const entry = dynamicEvents[n - 1]; + + if ( !entry ) + { + // This entry must have been unbound at some time in the past, so + // skip it now and really remove it from the vector below, once we + // finish iterating. + needToPruneDeleted = true; + continue; + } if ( event.GetEventType() == entry->m_eventType ) { @@ -1741,10 +1829,38 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) if ( !handler ) handler = this; if ( ProcessEventIfMatchesId(*entry, handler, event) ) + { + // It's important to skip pruning of the unbound event entries + // below because this object itself could have been deleted by + // the event handler making m_dynamicEvents a dangling pointer + // which can't be accessed any longer in the code below. + // + // In practice, it hopefully shouldn't be a problem to wait + // until we get an event that we don't handle before pruning + // because this should happen soon enough and even if it + // doesn't the worst possible outcome is slightly increased + // memory consumption while not skipping pruning can result in + // hard to reproduce (because they require the disconnection + // and deletion happen at the same time which is not always the + // case) crashes. return true; + } } } + if ( needToPruneDeleted ) + { + size_t nNew = 0; + for ( size_t n = 0; n != dynamicEvents.size(); n++ ) + { + if ( dynamicEvents[n] ) + dynamicEvents[nNew++] = dynamicEvents[n]; + } + + wxASSERT( nNew != dynamicEvents.size() ); + dynamicEvents.resize(nNew); + } + return false; } @@ -1812,19 +1928,20 @@ void wxEvtHandler::OnSinkDestroyed( wxEvtHandler *sink ) wxASSERT(m_dynamicEvents); // remove all connections with this sink - wxList::compatibility_iterator node = m_dynamicEvents->GetFirst(), node_nxt; - while (node) + size_t cookie; + for ( wxDynamicEventTableEntry* entry = GetFirstDynamicEntry(cookie); + entry; + entry = GetNextDynamicEntry(cookie) ) { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); - node_nxt = node->GetNext(); - if ( entry->m_fn->GetEvtHandler() == sink ) { delete entry->m_callbackUserData; - m_dynamicEvents->Erase( node ); delete entry; + + // Just as in DoUnbind(), we use our knowledge of + // GetNextDynamicEntry() implementation here. + (*m_dynamicEvents)[cookie] = NULL; } - node = node_nxt; } } @@ -1886,7 +2003,7 @@ bool wxEventBlocker::ProcessEvent(wxEvent& event) return true; // yes, it should: mark this event as processed } - return false; + return wxEvtHandler::ProcessEvent(event);; } #endif // wxUSE_GUI diff --git a/Externals/wxWidgets3/src/common/evtloopcmn.cpp b/Externals/wxWidgets3/src/common/evtloopcmn.cpp index f7b5138cc2..e8123f3caa 100644 --- a/Externals/wxWidgets3/src/common/evtloopcmn.cpp +++ b/Externals/wxWidgets3/src/common/evtloopcmn.cpp @@ -24,7 +24,6 @@ #include "wx/scopeguard.h" #include "wx/apptrait.h" #include "wx/private/eventloopsourcesmanager.h" - // ---------------------------------------------------------------------------- // wxEventLoopBase // ---------------------------------------------------------------------------- @@ -35,8 +34,7 @@ wxEventLoopBase::wxEventLoopBase() { m_isInsideRun = false; m_shouldExit = false; - - m_isInsideYield = false; + m_yieldLevel = 0; m_eventsToProcessInsideYield = wxEVT_CATEGORY_ALL; } @@ -84,7 +82,6 @@ void wxEventLoopBase::Exit(int rc) ScheduleExit(rc); } - void wxEventLoopBase::OnExit() { if (wxTheApp) @@ -103,19 +100,79 @@ bool wxEventLoopBase::ProcessIdle() bool wxEventLoopBase::Yield(bool onlyIfNeeded) { - if ( m_isInsideYield ) - { - if ( !onlyIfNeeded ) - { - wxFAIL_MSG( wxT("wxYield called recursively" ) ); - } - + if ( onlyIfNeeded && IsYielding() ) return false; - } return YieldFor(wxEVT_CATEGORY_ALL); } +bool wxEventLoopBase::YieldFor(long eventsToProcess) +{ +#if wxUSE_THREADS + if ( !wxThread::IsMain() ) + { + // Don't ever dispatch events from non-main threads. + return false; + } +#endif // wxUSE_THREADS + + // set the flag and don't forget to reset it before returning + const int yieldLevelOld = m_yieldLevel; + const long eventsToProcessOld = m_eventsToProcessInsideYield; + + m_yieldLevel++; + wxON_BLOCK_EXIT_SET(m_yieldLevel, yieldLevelOld); + + m_eventsToProcessInsideYield = eventsToProcess; + wxON_BLOCK_EXIT_SET(m_eventsToProcessInsideYield, eventsToProcessOld); + +#if wxUSE_LOG + // disable log flushing from here because a call to wxYield() shouldn't + // normally result in message boxes popping up &c + wxLog::Suspend(); + + // ensure the logs will be flashed again when we exit + wxON_BLOCK_EXIT0(wxLog::Resume); +#endif + + DoYieldFor(eventsToProcess); + +#if wxUSE_EXCEPTIONS + // If any handlers called from inside DoYieldFor() threw exceptions, they + // may have been stored for later rethrow as it's unsafe to let them escape + // from inside DoYieldFor() itself, as it calls native functions through + // which the exceptions can't propagate. But now that we're back to our own + // code, we may rethrow them. + if ( wxTheApp ) + wxTheApp->RethrowStoredException(); +#endif // wxUSE_EXCEPTIONS + + return true; +} + +void wxEventLoopBase::DoYieldFor(long eventsToProcess) +{ + // Normally yielding dispatches not only the pending native events, but + // also the events pending in wxWidgets itself and idle events. + // + // Notice however that we must not do it if we're asked to process only the + // events of specific kind, as pending events could be of any kind at all + // (ideal would be to have a filtering version of ProcessPendingEvents() + // too but we don't have this right now) and idle events are typically + // unexpected when yielding for the specific event kinds only. + if ( eventsToProcess == wxEVT_CATEGORY_ALL ) + { + if ( wxTheApp ) + wxTheApp->ProcessPendingEvents(); + + // We call it just once, even if it returns true, because we don't want + // to get stuck inside wxYield() forever if the application does some + // constant background processing in its idle handler, we do need to + // get back to the main loop soon. + ProcessIdle(); + } +} + #if wxUSE_EVENTLOOP_SOURCE wxEventLoopSource* @@ -136,7 +193,6 @@ wxEventLoopBase::AddSourceForFD(int fd, } #endif // wxUSE_EVENTLOOP_SOURCE - // wxEventLoopManual is unused in the other ports #if defined(__WINDOWS__) || defined(__WXDFB__) || ( ( defined(__UNIX__) && !defined(__WXOSX__) ) && wxUSE_BASE) @@ -169,11 +225,21 @@ bool wxEventLoopManual::ProcessEvents() return false; } - return Dispatch(); + const bool res = Dispatch(); + +#if wxUSE_EXCEPTIONS + // Rethrow any exceptions which could have been produced by the handlers + // ran by Dispatch(). + if ( wxTheApp ) + wxTheApp->RethrowStoredException(); +#endif // wxUSE_EXCEPTIONS + + return res; } int wxEventLoopManual::DoRun() { + // we must ensure that OnExit() is called even if an exception is thrown // from inside ProcessEvents() but we must call it from Exit() in normal // situations because it is supposed to be called synchronously, @@ -198,6 +264,7 @@ int wxEventLoopManual::DoRun() ; if ( m_shouldExit ) + break; // a message came or no more idle processing to do, dispatch @@ -236,7 +303,6 @@ int wxEventLoopManual::DoRun() if ( !hasMoreEvents ) break; } - #if wxUSE_EXCEPTIONS // exit the outer loop as well break; diff --git a/Externals/wxWidgets3/src/common/execcmn.cpp b/Externals/wxWidgets3/src/common/execcmn.cpp deleted file mode 100644 index 6504e491e2..0000000000 --- a/Externals/wxWidgets3/src/common/execcmn.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/common/execcmn.cpp -// Purpose: defines wxStreamTempInputBuffer which is used by Unix and MSW -// implementations of wxExecute; this file is only used by the -// library and never by the user code -// Author: Vadim Zeitlin -// Modified by: -// Created: 20.08.02 -// RCS-ID: $Id: execcmn.cpp 67254 2011-03-20 00:14:35Z DS $ -// Copyright: (c) 2002 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXEXEC_CPP_ -#define _WX_WXEXEC_CPP_ - -// this file should never be compiled directly, just included by other code -#ifndef _WX_USED_BY_WXEXECUTE_ - #error "You should never directly build this file!" -#endif - -// ---------------------------------------------------------------------------- -// wxStreamTempInputBuffer -// ---------------------------------------------------------------------------- - -/* - wxStreamTempInputBuffer is a hack which we need to solve the problem of - executing a child process synchronously with IO redirecting: when we do - this, the child writes to a pipe we open to it but when the pipe buffer - (which has finite capacity, e.g. commonly just 4Kb) becomes full we have to - read data from it because the child blocks in its write() until then and if - it blocks we are never going to return from wxExecute() so we dead lock. - - So here is the fix: we now read the output as soon as it appears into a temp - buffer (wxStreamTempInputBuffer object) and later just stuff it back into - the stream when the process terminates. See supporting code in wxExecute() - itself as well. - - Note that this is horribly inefficient for large amounts of output (count - the number of times we copy the data around) and so a better API is badly - needed! However it's not easy to devise a way to do this keeping backwards - compatibility with the existing wxExecute(wxEXEC_SYNC)... -*/ - -class wxStreamTempInputBuffer -{ -public: - wxStreamTempInputBuffer(); - - // call to associate a stream with this buffer, otherwise nothing happens - // at all - void Init(wxPipeInputStream *stream); - - // check for input on our stream and cache it in our buffer if any - // - // return true if anything was done - bool Update(); - - ~wxStreamTempInputBuffer(); - -private: - // the stream we're buffering, if NULL we don't do anything at all - wxPipeInputStream *m_stream; - - // the buffer of size m_size (NULL if m_size == 0) - void *m_buffer; - - // the size of the buffer - size_t m_size; - - wxDECLARE_NO_COPY_CLASS(wxStreamTempInputBuffer); -}; - -inline wxStreamTempInputBuffer::wxStreamTempInputBuffer() -{ - m_stream = NULL; - m_buffer = NULL; - m_size = 0; -} - -inline void wxStreamTempInputBuffer::Init(wxPipeInputStream *stream) -{ - m_stream = stream; -} - -inline -bool wxStreamTempInputBuffer::Update() -{ - if ( !m_stream || !m_stream->CanRead() ) - return false; - - // realloc in blocks of 4Kb: this is the default (and minimal) buffer - // size of the Unix pipes so it should be the optimal step - // - // NB: don't use "static int" in this inline function, some compilers - // (e.g. IBM xlC) don't like it - enum { incSize = 4096 }; - - void *buf = realloc(m_buffer, m_size + incSize); - if ( !buf ) - { - // don't read any more, we don't have enough memory to do it - m_stream = NULL; - } - else // got memory for the buffer - { - m_buffer = buf; - m_stream->Read((char *)m_buffer + m_size, incSize); - m_size += m_stream->LastRead(); - } - - return true; -} - -inline -wxStreamTempInputBuffer::~wxStreamTempInputBuffer() -{ - if ( m_buffer ) - { - m_stream->Ungetch(m_buffer, m_size); - free(m_buffer); - } -} - -#endif // _WX_WXEXEC_CPP_ - diff --git a/Externals/wxWidgets3/src/common/extended.c b/Externals/wxWidgets3/src/common/extended.c index 0f0a328ee2..0968051ac0 100644 --- a/Externals/wxWidgets3/src/common/extended.c +++ b/Externals/wxWidgets3/src/common/extended.c @@ -6,13 +6,6 @@ ** Created: 11/24/04 *****************************************************************************/ - -#if defined(_WIN32_WCE) - /* eVC cause warnings in its own headers: stdlib.h and winnt.h */ - #pragma warning (disable:4115) - #pragma warning (disable:4214) -#endif - #include #include #include @@ -20,11 +13,6 @@ #include #include "wx/defs.h" -#if defined(_WIN32_WCE) - #pragma warning (default:4115) - #pragma warning (default:4214) -#endif - #if wxUSE_APPLE_IEEE #include "wx/math.h" diff --git a/Externals/wxWidgets3/src/common/fddlgcmn.cpp b/Externals/wxWidgets3/src/common/fddlgcmn.cpp index fb97796a0b..8392753ddd 100644 --- a/Externals/wxWidgets3/src/common/fddlgcmn.cpp +++ b/Externals/wxWidgets3/src/common/fddlgcmn.cpp @@ -34,7 +34,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxFindDialogEvent, wxCommandEvent); wxDEFINE_EVENT( wxEVT_FIND, wxFindDialogEvent ); wxDEFINE_EVENT( wxEVT_FIND_NEXT, wxFindDialogEvent ); diff --git a/Externals/wxWidgets3/src/common/fdiodispatcher.cpp b/Externals/wxWidgets3/src/common/fdiodispatcher.cpp index 60938757ed..6f0be00973 100644 --- a/Externals/wxWidgets3/src/common/fdiodispatcher.cpp +++ b/Externals/wxWidgets3/src/common/fdiodispatcher.cpp @@ -135,11 +135,11 @@ bool wxMappedFDIODispatcher::UnregisterFD(int fd) class wxFDIODispatcherModule : public wxModule { public: - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDELETE(gs_dispatcher); } + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxDELETE(gs_dispatcher); } private: - DECLARE_DYNAMIC_CLASS(wxFDIODispatcherModule) + wxDECLARE_DYNAMIC_CLASS(wxFDIODispatcherModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxFDIODispatcherModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFDIODispatcherModule, wxModule); diff --git a/Externals/wxWidgets3/src/common/ffile.cpp b/Externals/wxWidgets3/src/common/ffile.cpp index 0f479565d2..1f729c2cc2 100644 --- a/Externals/wxWidgets3/src/common/ffile.cpp +++ b/Externals/wxWidgets3/src/common/ffile.cpp @@ -31,10 +31,6 @@ #include "wx/crt.h" #endif -#ifdef __WINDOWS__ -#include "wx/msw/mslu.h" -#endif - #include "wx/ffile.h" // ============================================================================ @@ -125,6 +121,9 @@ bool wxFFile::ReadAll(wxString *str, const wxMBConv& conv) size_t wxFFile::Read(void *pBuf, size_t nCount) { + if ( !nCount ) + return 0; + wxCHECK_MSG( pBuf, 0, wxT("invalid parameter") ); wxCHECK_MSG( IsOpened(), 0, wxT("can't read from closed file") ); @@ -139,6 +138,9 @@ size_t wxFFile::Read(void *pBuf, size_t nCount) size_t wxFFile::Write(const void *pBuf, size_t nCount) { + if ( !nCount ) + return 0; + wxCHECK_MSG( pBuf, 0, wxT("invalid parameter") ); wxCHECK_MSG( IsOpened(), 0, wxT("can't write to closed file") ); @@ -153,12 +155,28 @@ size_t wxFFile::Write(const void *pBuf, size_t nCount) bool wxFFile::Write(const wxString& s, const wxMBConv& conv) { - const wxWX2MBbuf buf = s.mb_str(conv); - if ( !buf ) - return false; + // Writing nothing always succeeds -- and simplifies the check for + // conversion failure below. + if ( s.empty() ) + return true; - const size_t size = strlen(buf); // FIXME: use buf.length() when available - return Write(buf, size) == size; + const wxWX2MBbuf buf = s.mb_str(conv); + +#if wxUSE_UNICODE + const size_t size = buf.length(); + + if ( !size ) + { + // This means that the conversion failed as the original string wasn't + // empty (we explicitly checked for this above) and in this case we + // must fail too to indicate that we can't save the data. + return false; + } +#else + const size_t size = s.length(); +#endif + + return Write(buf, size) == size; } bool wxFFile::Flush() @@ -189,7 +207,7 @@ bool wxFFile::Seek(wxFileOffset ofs, wxSeekMode mode) { default: wxFAIL_MSG(wxT("unknown seek mode")); - // still fall through + wxFALLTHROUGH; case wxFromStart: origin = SEEK_SET; diff --git a/Externals/wxWidgets3/src/common/file.cpp b/Externals/wxWidgets3/src/common/file.cpp index b2a5aca736..c346a30333 100644 --- a/Externals/wxWidgets3/src/common/file.cpp +++ b/Externals/wxWidgets3/src/common/file.cpp @@ -23,7 +23,7 @@ #if wxUSE_FILE // standard -#if defined(__WINDOWS__) && !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) #define WIN32_LEAN_AND_MEAN #define NOSERVICE @@ -46,10 +46,6 @@ #define NOCRYPT #define NOMCX -#elif defined(__WINDOWS__) && defined(__WXWINCE__) - #include "wx/msw/missing.h" -#elif (defined(__OS2__)) - #include #elif (defined(__UNIX__) || defined(__GNUWIN32__)) #include #include @@ -57,16 +53,6 @@ #ifdef __GNUWIN32__ #include "wx/msw/wrapwin.h" #endif -#elif defined(__DOS__) - #if defined(__WATCOMC__) - #include - #elif defined(__DJGPP__) - #include - #include - #include - #else - #error "Please specify the header with file functions declarations." - #endif #elif (defined(__WXSTUBS__)) // Have to ifdef this for different environments #include @@ -85,9 +71,7 @@ #include // SEEK_xxx constants -#ifndef __WXWINCE__ - #include -#endif +#include // Windows compilers don't have these constants #ifndef W_OK @@ -118,18 +102,6 @@ #define O_BINARY (0) #endif //__UNIX__ -#ifdef __WINDOWS__ - #include "wx/msw/mslu.h" -#endif - -#ifdef __WXWINCE__ - #include "wx/msw/private.h" -#endif - -#ifndef MAX_PATH - #define MAX_PATH 512 -#endif - // ============================================================================ // implementation of wxFile // ============================================================================ @@ -151,7 +123,7 @@ bool wxFile::Access(const wxString& name, OpenMode mode) { default: wxFAIL_MSG(wxT("bad wxFile::Access mode parameter.")); - // fall through + wxFALLTHROUGH; case read: how = R_OK; @@ -187,13 +159,7 @@ bool wxFile::CheckForError(wxFileOffset rc) const if ( rc != -1 ) return false; - const_cast(this)->m_lasterror = -#ifndef __WXWINCE__ - errno -#else - ::GetLastError() -#endif - ; + const_cast(this)->m_lasterror = errno; return true; } @@ -236,6 +202,7 @@ bool wxFile::Open(const wxString& fileName, OpenMode mode, int accessMode) } //else: fall through as write_append is the same as write if the // file doesn't exist + wxFALLTHROUGH; case write: flags |= O_WRONLY | O_CREAT | O_TRUNC; @@ -325,6 +292,9 @@ bool wxFile::ReadAll(wxString *str, const wxMBConv& conv) // read ssize_t wxFile::Read(void *pBuf, size_t nCount) { + if ( !nCount ) + return 0; + wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); ssize_t iRc = wxRead(m_fd, pBuf, nCount); @@ -341,6 +311,9 @@ ssize_t wxFile::Read(void *pBuf, size_t nCount) // write size_t wxFile::Write(const void *pBuf, size_t nCount) { + if ( !nCount ) + return 0; + wxCHECK( (pBuf != NULL) && IsOpened(), 0 ); ssize_t iRc = wxWrite(m_fd, pBuf, nCount); @@ -356,17 +329,28 @@ size_t wxFile::Write(const void *pBuf, size_t nCount) bool wxFile::Write(const wxString& s, const wxMBConv& conv) { - const wxWX2MBbuf buf = s.mb_str(conv); - if ( !buf ) - return false; + // Writing nothing always succeeds -- and simplifies the check for + // conversion failure below. + if ( s.empty() ) + return true; + + const wxWX2MBbuf buf = s.mb_str(conv); #if wxUSE_UNICODE - const size_t size = buf.length(); + const size_t size = buf.length(); + + if ( !size ) + { + // This means that the conversion failed as the original string wasn't + // empty (we explicitly checked for this above) and in this case we + // must fail too to indicate that we can't save the data. + return false; + } #else - const size_t size = s.length(); + const size_t size = s.length(); #endif - return Write(buf, size) == size; + return Write(buf, size) == size; } // flush @@ -404,7 +388,7 @@ wxFileOffset wxFile::Seek(wxFileOffset ofs, wxSeekMode mode) switch ( mode ) { default: wxFAIL_MSG(wxT("unknown seek origin")); - + wxFALLTHROUGH; case wxFromStart: origin = SEEK_SET; break; @@ -491,7 +475,7 @@ bool wxFile::Eof() const wxFileOffset iRc; -#if defined(__DOS__) || defined(__UNIX__) || defined(__GNUWIN32__) +#if defined(__UNIX__) || defined(__GNUWIN32__) // @@ this doesn't work, of course, on unseekable file descriptors wxFileOffset ofsCur = Tell(), ofsMax = Length(); @@ -572,9 +556,7 @@ bool wxTempFile::Open(const wxString& strName) if ( chmod( (const char*) m_strTemp.fn_str(), mode) == -1 ) { -#ifndef __OS2__ wxLogSysError(_("Failed to set temporary file permissions")); -#endif } #endif // Unix diff --git a/Externals/wxWidgets3/src/common/fileconf.cpp b/Externals/wxWidgets3/src/common/fileconf.cpp index e626c3c0cc..ed884fd5c0 100644 --- a/Externals/wxWidgets3/src/common/fileconf.cpp +++ b/Externals/wxWidgets3/src/common/fileconf.cpp @@ -48,10 +48,6 @@ #if defined(__WINDOWS__) #include "wx/msw/private.h" #endif //windows.h -#if defined(__WXPM__) - #define INCL_DOS - #include -#endif #include #include @@ -60,10 +56,6 @@ // constants // ---------------------------------------------------------------------------- -#ifndef MAX_PATH - #define MAX_PATH 512 -#endif - #define FILECONF_TRACE_MASK wxT("fileconf") // ---------------------------------------------------------------------------- @@ -324,7 +316,7 @@ wxFileName wxFileConfig::GetLocalFile(const wxString& szFile, int style) // ---------------------------------------------------------------------------- // ctor // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFileConfig, wxConfigBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxFileConfig, wxConfigBase); void wxFileConfig::Init() { @@ -1041,10 +1033,6 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) ResetDirty(); -#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON - m_fnLocalFile.MacSetTypeAndCreator('TEXT', 'ttxt'); -#endif // __WXMAC__ - return true; } @@ -2060,7 +2048,7 @@ static wxString FilterOutValue(const wxString& str) c = wxT('"'); break; } - //else: fall through + wxFALLTHROUGH; default: strResult += str[n]; diff --git a/Externals/wxWidgets3/src/common/filectrlcmn.cpp b/Externals/wxWidgets3/src/common/filectrlcmn.cpp index f4c8fd27aa..144d0f2ec4 100644 --- a/Externals/wxWidgets3/src/common/filectrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/filectrlcmn.cpp @@ -29,7 +29,7 @@ wxDEFINE_EVENT( wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent ); wxDEFINE_EVENT( wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent ); wxDEFINE_EVENT( wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent ); -IMPLEMENT_DYNAMIC_CLASS( wxFileCtrlEvent, wxCommandEvent ) +wxIMPLEMENT_DYNAMIC_CLASS( wxFileCtrlEvent, wxCommandEvent ); // some helper functions @@ -63,7 +63,7 @@ void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd) wnd->GetEventHandler()->ProcessEvent( event ); } -void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename ) +void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString& filename ) { wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, wnd, wnd->GetId() ); event.SetDirectory( fileCtrl->GetDirectory() ); diff --git a/Externals/wxWidgets3/src/common/filefn.cpp b/Externals/wxWidgets3/src/common/filefn.cpp index 4b87feb7db..a5fc4e6265 100644 --- a/Externals/wxWidgets3/src/common/filefn.cpp +++ b/Externals/wxWidgets3/src/common/filefn.cpp @@ -37,6 +37,7 @@ #include "wx/filename.h" #include "wx/dir.h" +#include "wx/scopedptr.h" #include "wx/tokenzr.h" // there are just too many of those... @@ -48,11 +49,7 @@ #include #include #include -#if !wxONLY_WATCOM_EARLIER_THAN(1,4) - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif -#endif +#include #if defined(__WXMAC__) #include "wx/osx/private.h" // includes mac headers @@ -61,7 +58,6 @@ #ifdef __WINDOWS__ #include "wx/msw/private.h" #include "wx/msw/missing.h" - #include "wx/msw/mslu.h" // sys/cygwin.h is needed for cygwin_conv_to_full_win32_path() // and for cygwin_conv_path() @@ -90,6 +86,8 @@ #define HAVE_WGETCWD #endif +wxDECL_FOR_STRICT_MINGW32(int, _fileno, (FILE*)) + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -106,14 +104,6 @@ static wxChar wxFileFunctionsBuffer[4*_MAXPATHLEN]; #endif -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -// -// VisualAge C++ V4.0 cannot have any external linkage const decs -// in headers included by more than one primary source -// -const int wxInvalidOffset = -1; -#endif - // ============================================================================ // implementation // ============================================================================ @@ -192,17 +182,14 @@ void wxPathList::Add(const wxArrayString &arr) } // Add paths e.g. from the PATH environment variable -void wxPathList::AddEnvList (const wxString& WXUNUSED_IN_WINCE(envVariable)) +void wxPathList::AddEnvList (const wxString& envVariable) { - // No environment variables on WinCE -#ifndef __WXWINCE__ - // The space has been removed from the tokenizers, otherwise a // path such as "C:\Program Files" would be split into 2 paths: // "C:\Program" and "Files"; this is true for both Windows and Unix. static const wxChar PATH_TOKS[] = -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) wxT(";"); // Don't separate with colon in DOS (used for drive) #else wxT(":;"); @@ -215,7 +202,6 @@ void wxPathList::AddEnvList (const wxString& WXUNUSED_IN_WINCE(envVariable)) wxArrayString arr = wxStringTokenize(val, PATH_TOKS); WX_APPEND_ARRAY(*this, arr); } -#endif // !__WXWINCE__ } // Given a full filename (with path), ensure that that file can @@ -226,13 +212,6 @@ bool wxPathList::EnsureFileAccessible (const wxString& path) return Add(wxPathOnly(path)); } -#if WXWIN_COMPATIBILITY_2_6 -bool wxPathList::Member (const wxString& path) const -{ - return Index(path) != wxNOT_FOUND; -} -#endif - wxString wxPathList::FindValidPath (const wxString& file) const { // normalize the given string as it could be a path + a filename @@ -322,7 +301,7 @@ wxIsAbsolutePath (const wxString& filename) if ((filename[0] == wxT('[') && filename[1] != wxT('.'))) return true; #endif -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) // MSDOS like if (filename[0] == wxT('\\') || (wxIsalpha (filename[0]) && filename[1] == wxT(':'))) return true; @@ -398,7 +377,7 @@ static CharType *wxDoRealPath (CharType *path) path[0] = SEP; path[1] = wxT('\0'); } -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) /* Check that path[2] is NULL! */ else if (path[1] == wxT(':') && !path[2]) { @@ -487,7 +466,7 @@ wxChar *wxCopyAbsolutePath(const wxString& filename) template static CharType *wxDoExpandPath(CharType *buf, const wxString& name) { - register CharType *d, *s, *nm; + CharType *d, *s, *nm; CharType lnm[_MAXPATHLEN]; int q; @@ -528,23 +507,6 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) #endif /* Expand inline environment variables */ -#ifdef __VISAGECPP__ - while (*d) - { - *d++ = *s; - if(*s == wxT('\\')) - { - *(d - 1) = *++s; - if (*d) - { - s++; - continue; - } - else - break; - } - else -#else while ((*d++ = *s) != 0) { # ifndef __WINDOWS__ if (*s == wxT('\\')) { @@ -555,18 +517,15 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) break; } else # endif -#endif - // No env variables on WinCE -#ifndef __WXWINCE__ #ifdef __WINDOWS__ if (*s++ == wxT('$') && (*s == wxT('{') || *s == wxT(')'))) #else if (*s++ == wxT('$')) #endif { - register CharType *start = d; - register int braces = (*s == wxT('{') || *s == wxT('(')); - register CharType *value; + CharType *start = d; + int braces = (*s == wxT('{') || *s == wxT('(')); + CharType *value; while ((*d++ = *s) != 0) if (braces ? (*s == wxT('}') || *s == wxT(')')) : !(wxIsalnum(*s) || *s == wxT('_')) ) break; @@ -585,8 +544,6 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) s++; } } -#endif - // __WXWINCE__ } /* Expand ~ and ~user */ @@ -605,7 +562,7 @@ static CharType *wxDoExpandPath(CharType *buf, const wxString& name) } } else { /* ~user/filename */ - register CharType *nnm; + CharType *nnm; for (s = nm; *s && *s != SEP; s++) { // Empty @@ -668,7 +625,7 @@ wchar_t *wxExpandPath(wchar_t *buf, const wxString& name) */ wxChar * wxContractPath (const wxString& filename, - const wxString& WXUNUSED_IN_WINCE(envname), + const wxString& envname, const wxString& user) { static wxChar dest[_MAXPATHLEN]; @@ -683,7 +640,6 @@ wxContractPath (const wxString& filename, // Handle environment wxString val; -#ifndef __WXWINCE__ wxChar *tcp; if (!envname.empty() && !(val = wxGetenv (envname)).empty() && (tcp = wxStrstr (dest, val)) != NULL) @@ -695,7 +651,6 @@ wxContractPath (const wxString& filename, wxStrcat (tcp, wxT("}")); wxStrcat (tcp, wxFileFunctionsBuffer); } -#endif // Handle User's home (ignore root homes!) val = wxGetUserHome (user); @@ -769,7 +724,7 @@ wxPathOnly (wxChar *path) i --; } -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) { @@ -821,7 +776,7 @@ wxString wxPathOnly (const wxString& path) i --; } -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == wxT(':')) { @@ -939,14 +894,14 @@ void wxDos2UnixFilename(wchar_t *s) { wxDoDos2UnixFilename(s); } template static void -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) wxDoUnix2DosFilename(T *s) #else wxDoUnix2DosFilename(T *WXUNUSED(s) ) #endif { // Yes, I really mean this to happen under DOS only! JACS -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) if (s) while (*s) { @@ -1001,7 +956,7 @@ wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& fil } // helper of generic implementation of wxCopyFile() -#if !(defined(__WIN32__) || defined(__OS2__)) && wxUSE_FILE +#if !defined(__WIN32__) && wxUSE_FILE static bool wxDoCopyFile(wxFile& fileIn, @@ -1048,7 +1003,7 @@ wxDoCopyFile(wxFile& fileIn, bool wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) { -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) // CopyFile() copies file attributes and modification time too, so use it // instead of our code if available // @@ -1060,9 +1015,6 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) return false; } -#elif defined(__OS2__) - if ( ::DosCopy(file1.c_str(), file2.c_str(), overwrite ? DCPY_EXISTING : 0) != 0 ) - return false; #elif wxUSE_FILE // !Win32 wxStructStat fbuf; @@ -1092,7 +1044,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) wxDoCopyFile(fileIn, fbuf, file2, overwrite); -#if defined(__WXMAC__) || defined(__WXCOCOA__) +#if defined(__WXMAC__) // copy the resource fork of the file too if it's present wxString pathRsrcOut; wxFile fileRsrcIn; @@ -1132,18 +1084,14 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) if ( !wxDoCopyFile(fileRsrcIn, fbuf, pathRsrcOut, overwrite) ) return false; } -#endif // wxMac || wxCocoa +#endif // wxMac -#if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__) - // no chmod in VA. Should be some permission API for HPFS386 partitions - // however if ( chmod(file2.fn_str(), fbuf.st_mode) != 0 ) { wxLogSysError(_("Impossible to set permissions for the file '%s'"), file2.c_str()); return false; } -#endif // OS/2 || Mac #else // !Win32 && ! wxUSE_FILE @@ -1172,11 +1120,9 @@ wxRenameFile(const wxString& file1, const wxString& file2, bool overwrite) return false; } -#if !defined(__WXWINCE__) // Normal system call if ( wxRename (file1, file2) == 0 ) return true; -#endif // Try to copy if (wxCopyFile(file1, file2, overwrite)) { @@ -1192,8 +1138,6 @@ bool wxRemoveFile(const wxString& file) { #if defined(__VISUALC__) \ || defined(__BORLANDC__) \ - || defined(__WATCOMC__) \ - || defined(__DMC__) \ || defined(__GNUWIN32__) int res = wxRemove(file); #elif defined(__WXMAC__) @@ -1215,9 +1159,9 @@ bool wxMkdir(const wxString& dir, int perm) // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler -#elif (!(defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__))) || \ +#elif (!defined(__WINDOWS__)) || \ (defined(__GNUWIN32__) && !defined(__MINGW32__)) || \ - defined(__WINE__) || defined(__WXMICROWIN__) + defined(__WINE__) const wxChar *dirname = dir.c_str(); #if defined(MSVCRT) wxUnusedVar(perm); @@ -1225,26 +1169,9 @@ bool wxMkdir(const wxString& dir, int perm) #else if ( mkdir(wxFNCONV(dirname), perm) != 0 ) #endif -#elif defined(__OS2__) +#else // !MSW and !OS/2 VAC++ wxUnusedVar(perm); - if (::DosCreateDir(dir.c_str(), NULL) != 0) // enhance for EAB's?? -#elif defined(__DOS__) - const wxChar *dirname = dir.c_str(); - #if defined(__WATCOMC__) - (void)perm; - if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) - #elif defined(__DJGPP__) - if ( mkdir(wxFNCONV(dirname), perm) != 0 ) - #else - #error "Unsupported DOS compiler!" - #endif -#else // !MSW, !DOS and !OS/2 VAC++ - wxUnusedVar(perm); - #ifdef __WXWINCE__ - if ( CreateDirectory(dir.fn_str(), NULL) == 0 ) - #else if ( wxMkDir(dir.fn_str()) != 0 ) - #endif #endif // !MSW/MSW { wxLogSysError(_("Directory '%s' couldn't be created"), dir); @@ -1259,13 +1186,7 @@ bool wxRmdir(const wxString& dir, int WXUNUSED(flags)) #if defined(__VMS__) return false; //to be changed since rmdir exists in VMS7.x #else - #if defined(__OS2__) - if ( ::DosDeleteDir(dir.c_str()) != 0 ) - #elif defined(__WXWINCE__) - if ( RemoveDirectory(dir.fn_str()) == 0 ) - #else if ( wxRmDir(dir.fn_str()) != 0 ) - #endif { wxLogSysError(_("Directory '%s' couldn't be deleted"), dir); return false; @@ -1316,7 +1237,7 @@ bool wxGetTempFileName(const wxString& prefix, wxString& buf) // Get first file name matching given wild card. -static wxDir *gs_dir = NULL; +static wxScopedPtr gs_dir; static wxString gs_dirPath; wxString wxFindFirstFile(const wxString& spec, int flags) @@ -1327,8 +1248,7 @@ wxString wxFindFirstFile(const wxString& spec, int flags) if ( !wxEndsWithPathSeparator(gs_dirPath ) ) gs_dirPath << wxFILE_SEP_PATH; - delete gs_dir; // can be NULL, this is ok - gs_dir = new wxDir(gs_dirPath); + gs_dir.reset(new wxDir(gs_dirPath)); if ( !gs_dir->IsOpened() ) { @@ -1347,10 +1267,7 @@ wxString wxFindFirstFile(const wxString& spec, int flags) wxString result; gs_dir->GetFirst(&result, wxFileNameFromPath(spec), dirFlags); if ( result.empty() ) - { - wxDELETE(gs_dir); return result; - } return gs_dirPath + result; } @@ -1361,10 +1278,7 @@ wxString wxFindNextFile() wxString result; if ( !gs_dir->GetNext(&result) || result.empty() ) - { - wxDELETE(gs_dir); return result; - } return gs_dirPath + result; } @@ -1379,11 +1293,6 @@ wxString wxFindNextFile() wxChar *wxDoGetCwd(wxChar *buf, int sz) { -#if defined(__WXWINCE__) - // TODO - if(buf && sz>0) buf[0] = wxT('\0'); - return buf; -#else if ( !buf ) { buf = new wxChar[sz + 1]; @@ -1398,16 +1307,12 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) #else // wxUSE_UNICODE bool needsANSI = true; - #if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU + #if !defined(HAVE_WGETCWD) char cbuf[_MAXPATHLEN]; #endif #ifdef HAVE_WGETCWD - #if wxUSE_UNICODE_MSLU - if ( wxGetOsVersion() != wxOS_WINDOWS_9X ) - #else char *cbuf = NULL; // never really used because needsANSI will always be false - #endif { ok = _wgetcwd(buf, sz) != NULL; needsANSI = false; @@ -1419,25 +1324,7 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) { #if defined(_MSC_VER) || defined(__MINGW32__) ok = _getcwd(cbuf, sz) != NULL; - #elif defined(__OS2__) - APIRET rc; - ULONG ulDriveNum = 0; - ULONG ulDriveMap = 0; - rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); - ok = rc == 0; - if (ok) - { - sz -= 3; - rc = ::DosQueryCurrentDir( 0 // current drive - ,(PBYTE)cbuf + 3 - ,(PULONG)&sz - ); - cbuf[0] = char('A' + (ulDriveNum - 1)); - cbuf[1] = ':'; - cbuf[2] = '\\'; - ok = rc == 0; - } - #else // !Win32/VC++ !Mac !OS2 + #else // !Win32/VC++ !Mac ok = getcwd(cbuf, sz) != NULL; #endif // platform @@ -1459,16 +1346,6 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) } else // ok, but we might need to massage the path into the right format { -#ifdef __DJGPP__ - // VS: DJGPP is a strange mix of DOS and UNIX API and returns paths - // with / deliminers. We don't like that. - for (wxChar *ch = buf; *ch; ch++) - { - if (*ch == wxT('/')) - *ch = wxT('\\'); - } -#endif // __DJGPP__ - // MBN: we hope that in the case the user is compiling a GTK+/Motif app, // he needs Unix as opposed to Win32 pathnames #if defined( __CYGWIN__ ) && defined( __WINDOWS__ ) @@ -1498,17 +1375,8 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz) #undef cbuf #endif -#endif - // __WXWINCE__ } -#if WXWIN_COMPATIBILITY_2_6 -wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) -{ - return wxDoGetCwd(buf,sz); -} -#endif // WXWIN_COMPATIBILITY_2_6 - wxString wxGetCwd() { wxString str; @@ -1519,49 +1387,10 @@ wxString wxGetCwd() bool wxSetWorkingDirectory(const wxString& d) { bool success = false; -#if defined(__OS2__) - if (d[1] == ':') - { - ::DosSetDefaultDisk(wxToupper(d[0]) - wxT('A') + 1); - // do not call DosSetCurrentDir when just changing drive, - // since it requires e.g. "d:." instead of "d:"! - if (d.length() == 2) - return true; - } - success = (::DosSetCurrentDir(d.c_str()) == 0); -#elif defined(__UNIX__) || defined(__WXMAC__) || defined(__DOS__) - success = (chdir(wxFNSTRINGCAST d.fn_str()) == 0); +#if defined(__UNIX__) || defined(__WXMAC__) + success = (chdir(d.fn_str()) == 0); #elif defined(__WINDOWS__) - -#ifdef __WIN32__ -#ifdef __WXWINCE__ - // No equivalent in WinCE - wxUnusedVar(d); -#else success = (SetCurrentDirectory(d.t_str()) != 0); -#endif -#else - // Must change drive, too. - bool isDriveSpec = ((strlen(d) > 1) && (d[1] == ':')); - if (isDriveSpec) - { - wxChar firstChar = d[0]; - - // To upper case - if (firstChar > 90) - firstChar = firstChar - 32; - - // To a drive number - unsigned int driveNo = firstChar - 64; - if (driveNo > 0) - { - unsigned int noDrives; - _dos_setdrive(driveNo, &noDrives); - } - } - success = (chdir(WXSTRINGCAST d) == 0); -#endif - #endif if ( !success ) { @@ -1574,9 +1403,7 @@ bool wxSetWorkingDirectory(const wxString& d) // On non-Windows platform, probably just return the empty string. wxString wxGetOSDirectory() { -#ifdef __WXWINCE__ - return wxString(wxT("\\Windows")); -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) wxChar buf[MAX_PATH]; if ( !GetWindowsDirectory(buf, MAX_PATH) ) { @@ -1584,8 +1411,6 @@ wxString wxGetOSDirectory() } return wxString(buf); -#elif defined(__WXMAC__) && wxOSX_USE_CARBON - return wxMacFindFolderNoSeparator(kOnSystemDisk, 'macs', false); #else return wxEmptyString; #endif @@ -1764,7 +1589,7 @@ int WXDLLIMPEXP_BASE wxParseCommonDialogsFilter(const wxString& filterStr, return filters.GetCount(); } -#if defined(__WINDOWS__) && !(defined(__UNIX__) || defined(__OS2__)) +#if defined(__WINDOWS__) && !defined(__UNIX__) static bool wxCheckWin32Permission(const wxString& path, DWORD access) { // quoting the MSDN: "To obtain a handle to a directory, call the @@ -1777,15 +1602,6 @@ static bool wxCheckWin32Permission(const wxString& path, DWORD access) return false; } - if ( wxGetOsVersion() == wxOS_WINDOWS_9X ) - { - // FAT directories always allow all access, even if they have the - // readonly flag set, and FAT files can only be read-only - return (dwAttr & FILE_ATTRIBUTE_DIRECTORY) || - (access != GENERIC_WRITE || - !(dwAttr & FILE_ATTRIBUTE_READONLY)); - } - HANDLE h = ::CreateFile ( path.t_str(), @@ -1807,7 +1623,7 @@ static bool wxCheckWin32Permission(const wxString& path, DWORD access) bool wxIsWritable(const wxString &path) { -#if defined( __UNIX__ ) || defined(__OS2__) +#if defined( __UNIX__ ) // access() will take in count also symbolic links return wxAccess(path.c_str(), W_OK) == 0; #elif defined( __WINDOWS__ ) @@ -1821,7 +1637,7 @@ bool wxIsWritable(const wxString &path) bool wxIsReadable(const wxString &path) { -#if defined( __UNIX__ ) || defined(__OS2__) +#if defined( __UNIX__ ) // access() will take in count also symbolic links return wxAccess(path.c_str(), R_OK) == 0; #elif defined( __WINDOWS__ ) @@ -1835,7 +1651,7 @@ bool wxIsReadable(const wxString &path) bool wxIsExecutable(const wxString &path) { -#if defined( __UNIX__ ) || defined(__OS2__) +#if defined( __UNIX__ ) // access() will take in count also symbolic links return wxAccess(path.c_str(), X_OK) == 0; #elif defined( __WINDOWS__ ) @@ -1867,7 +1683,7 @@ bool wxIsExecutable(const wxString &path) // wxFileKind wxGetFileKind(int fd) { -#if defined __WINDOWS__ && !defined __WXWINCE__ && defined wxGetOSFHandle +#if defined __WINDOWS__ && defined wxGetOSFHandle switch (::GetFileType(wxGetOSFHandle(fd)) & ~FILE_TYPE_REMOTE) { case FILE_TYPE_CHAR: @@ -1908,12 +1724,10 @@ wxFileKind wxGetFileKind(int fd) wxFileKind wxGetFileKind(FILE *fp) { - // Note: The watcom rtl dll doesn't have fileno (the static lib does). - // Should be fixed in version 1.4. -#if defined(wxFILEKIND_STUB) || wxONLY_WATCOM_EARLIER_THAN(1,4) +#if defined(wxFILEKIND_STUB) (void)fp; return wxFILE_KIND_DISK; -#elif defined(__WINDOWS__) && !defined(__CYGWIN__) && !defined(__WATCOMC__) && !defined(__WINE__) +#elif defined(__WINDOWS__) && !defined(__CYGWIN__) && !defined(__WINE__) return fp ? wxGetFileKind(_fileno(fp)) : wxFILE_KIND_UNKNOWN; #else return fp ? wxGetFileKind(fileno(fp)) : wxFILE_KIND_UNKNOWN; diff --git a/Externals/wxWidgets3/src/common/filehistorycmn.cpp b/Externals/wxWidgets3/src/common/filehistorycmn.cpp index c27ed12c0f..4654188081 100644 --- a/Externals/wxWidgets3/src/common/filehistorycmn.cpp +++ b/Externals/wxWidgets3/src/common/filehistorycmn.cpp @@ -59,7 +59,7 @@ wxString GetMRUEntryLabel(int n, const wxString& path) // File history (a.k.a. MRU, most recently used, files list) // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject); wxFileHistoryBase::wxFileHistoryBase(size_t maxFiles, wxWindowID idBase) { @@ -137,11 +137,11 @@ void wxFileHistoryBase::AddFileToHistory(const wxString& file) const wxFileName fnOld(m_fileHistory[i]); wxString pathInMenu; - if ( fnOld.GetPath() == fnNew.GetPath() ) + if ( (fnOld.GetPath() == fnNew.GetPath()) && fnOld.HasName() ) { pathInMenu = fnOld.GetFullName(); } - else // file in different directory + else // file in different directory or it's not a file but a directory { // absolute path; could also set relative path pathInMenu = m_fileHistory[i]; @@ -215,6 +215,8 @@ void wxFileHistoryBase::RemoveMenu(wxMenu *menu) #if wxUSE_CONFIG void wxFileHistoryBase::Load(const wxConfigBase& config) { + RemoveExistingHistory(); + m_fileHistory.Clear(); wxString buf; @@ -275,4 +277,31 @@ void wxFileHistoryBase::AddFilesToMenu(wxMenu* menu) } } +void wxFileHistoryBase::RemoveExistingHistory() +{ + size_t count = m_fileHistory.GetCount(); + if ( !count ) + return; + + for ( wxList::compatibility_iterator node = m_fileMenus.GetFirst(); + node; + node = node->GetNext() ) + { + wxMenu * const menu = static_cast(node->GetData()); + + // Notice that we remove count+1 items from the menu as we also remove + // the separator preceding them. + for ( size_t n = 0; n <= count; n++ ) + { + const wxMenuItemList::compatibility_iterator + nodeLast = menu->GetMenuItems().GetLast(); + if ( nodeLast ) + { + wxMenuItem * const lastMenuItem = nodeLast->GetData(); + menu->Delete(lastMenuItem); + } + } + } +} + #endif // wxUSE_FILE_HISTORY diff --git a/Externals/wxWidgets3/src/common/filename.cpp b/Externals/wxWidgets3/src/common/filename.cpp index 6acde7603c..edcacc3b1d 100644 --- a/Externals/wxWidgets3/src/common/filename.cpp +++ b/Externals/wxWidgets3/src/common/filename.cpp @@ -102,6 +102,8 @@ #include "wx/msw/private.h" #include // for CLSID_ShellLink #include "wx/msw/missing.h" + #include "wx/msw/ole/oleutils.h" + #include "wx/msw/private/comptr.h" #endif #if defined(__WXMAC__) @@ -116,27 +118,6 @@ #include #endif -#ifdef __DJGPP__ -#include -#endif - -#ifdef __WATCOMC__ -#include -#include -#include -#endif - -#ifdef __VISAGECPP__ -#ifndef MAX_PATH -#define MAX_PATH 256 -#endif -#endif - -#ifdef __EMX__ -#include -#define MAX_PATH _MAX_PATH -#endif - #ifndef S_ISREG #define S_ISREG(mode) ((mode) & S_IFREG) #endif @@ -157,7 +138,7 @@ namespace // small helper class which opens and closes the file - we use it just to get // a file handle for the given file name to pass it to some Win32 API function -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) class wxFileHandle { @@ -229,7 +210,7 @@ private: // private functions // ---------------------------------------------------------------------------- -#if wxUSE_DATETIME && defined(__WIN32__) && !defined(__WXMICROWIN__) +#if wxUSE_DATETIME && defined(__WIN32__) // Convert between wxDateTime and FILETIME which is a 64-bit value representing // the number of 100-nanosecond intervals since January 1, 1601 UTC. @@ -324,7 +305,7 @@ static bool IsUNCPath(const wxString& path, wxPathFormat format) // the appropriate file with an extra twist that it also works when there is no // wxFileName object at all, as is the case in static methods. -#if defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__OS2__) || (defined(__DOS__) && defined(__WATCOMC__)) +#if defined(__UNIX_LIKE__) || defined(__WXMAC__) #define wxHAVE_LSTAT #endif @@ -495,7 +476,7 @@ void wxFileName::SetPath( const wxString& pathOrig, wxPathFormat format ) default: wxFAIL_MSG( wxT("Unknown path format") ); - // !! Fall through !! + wxFALLTHROUGH; case wxPATH_UNIX: m_relative = leadingChar != wxT('/'); @@ -631,7 +612,7 @@ wxFileName wxFileName::DirName(const wxString& dir, wxPathFormat format) namespace { -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) void RemoveTrailingSeparatorsFromPath(wxString& strPath) { @@ -653,7 +634,7 @@ void RemoveTrailingSeparatorsFromPath(wxString& strPath) } } -#endif // __WINDOWS__ || __OS2__ +#endif // __WINDOWS_ bool wxFileSystemObjectExists(const wxString& path, int flags) @@ -666,7 +647,7 @@ wxFileSystemObjectExists(const wxString& path, int flags) wxString strPath(path); -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) if ( acceptDir ) { // Ensure that the path doesn't have any trailing separators when @@ -687,34 +668,6 @@ wxFileSystemObjectExists(const wxString& path, int flags) // 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 & wxFILE_EXISTS_ANY; - - // Any other error (usually ERROR_PATH_NOT_FOUND), means there is nothing - // there. - return false; #else // Non-MSW, non-OS/2 wxStructStat st; if ( !StatAny(st, strPath, flags) ) @@ -963,17 +916,7 @@ static wxString wxCreateTempImpl( dir = wxFileName::GetTempDir(); } -#if defined(__WXWINCE__) - path = dir + wxT("\\") + name; - int i = 1; - while (wxFileName::FileExists(path)) - { - path = dir + wxT("\\") + name ; - path << i; - i ++; - } - -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) if (!::GetTempFileName(dir.t_str(), name.t_str(), 0, wxStringBuffer(path, MAX_PATH + 1))) { @@ -1053,11 +996,9 @@ static wxString wxCreateTempImpl( { path = wxConvFile.cMB2WX( (const char*) buf ); } -#else // !HAVE_MKTEMP (includes __DOS__) +#else // !HAVE_MKTEMP // generate the unique file name ourselves - #if !defined(__DOS__) path << (unsigned int)getpid(); - #endif wxString pathTry; @@ -1281,18 +1222,15 @@ wxString wxFileName::GetTempDir() // if no environment variables are set, use the system default if ( dir.empty() ) { -#if defined(__WXWINCE__) - dir = CheckIfDirExists(wxT("\\temp")); -#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) if ( !::GetTempPath(MAX_PATH, wxStringBuffer(dir, MAX_PATH + 1)) ) { wxLogLastError(wxT("GetTempPath")); } -#elif defined(__WXMAC__) && wxOSX_USE_CARBON - dir = wxMacFindFolderNoSeparator(short(kOnSystemDisk), kTemporaryFolderType, kCreateFolder); #endif // systems with native way } - else // we got directory from an environment variable + + if ( !dir.empty() ) { // remove any trailing path separators, we don't want to ever return // them from this function for consistency @@ -1309,7 +1247,7 @@ wxString wxFileName::GetTempDir() } // fall back to hard coded value - if ( dir.empty() ) + else { #ifdef __UNIX_LIKE__ dir = CheckIfDirExists("/tmp"); @@ -1387,10 +1325,7 @@ bool wxFileName::Rmdir(const wxString& dir, int flags) fileop.wFunc = FO_DELETE; fileop.pFrom = path.t_str(); fileop.fFlags = FOF_SILENT | FOF_NOCONFIRMATION; - #ifndef __WXWINCE__ - // FOF_NOERRORUI is not defined in WinCE fileop.fFlags |= FOF_NOERRORUI; - #endif int ret = SHFileOperation(&fileop); if ( ret != 0 ) @@ -1593,7 +1528,7 @@ bool wxFileName::Normalize(int flags, m_dirs.Add(dir); } -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE +#if defined(__WIN32__) && wxUSE_OLE if ( (flags & wxPATH_NORM_SHORTCUT) ) { wxString filename; @@ -1631,7 +1566,6 @@ bool wxFileName::Normalize(int flags, return true; } -#ifndef __WXWINCE__ bool wxFileName::ReplaceEnvVariable(const wxString& envname, const wxString& replacementFmtString, wxPathFormat format) @@ -1655,7 +1589,6 @@ bool wxFileName::ReplaceEnvVariable(const wxString& envname, return true; } -#endif bool wxFileName::ReplaceHomeDir(wxPathFormat format) { @@ -1678,18 +1611,7 @@ bool wxFileName::ReplaceHomeDir(wxPathFormat format) // get the shortcut target // ---------------------------------------------------------------------------- -// WinCE (3) doesn't have CLSID_ShellLink, IID_IShellLink definitions. -// The .lnk file is a plain text file so it should be easy to -// make it work. Hint from Google Groups: -// "If you open up a lnk file, you'll see a -// number, followed by a pound sign (#), followed by more text. The -// number is the number of characters that follows the pound sign. The -// characters after the pound sign are the command line (which _can_ -// include arguments) to be executed. Any path (e.g. \windows\program -// files\myapp.exe) that includes spaces needs to be enclosed in -// quotation marks." - -#if defined(__WIN32__) && !defined(__WXWINCE__) && wxUSE_OLE +#if defined(__WIN32__) && wxUSE_OLE bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxString& targetFilename, @@ -1699,20 +1621,23 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, wxFileName::SplitPath(shortcutPath, & path, & file, & ext); HRESULT hres; - IShellLink* psl; + wxCOMPtr psl; bool success = false; // Assume it's not a shortcut if it doesn't end with lnk if (ext.CmpNoCase(wxT("lnk"))!=0) return false; + // Ensure OLE is initialized. + wxOleInitializer oleInit; + // create a ShellLink object hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*) &psl); if (SUCCEEDED(hres)) { - IPersistFile* ppf; + wxCOMPtr ppf; hres = psl->QueryInterface( IID_IPersistFile, (LPVOID *) &ppf); if (SUCCEEDED(hres)) { @@ -1722,8 +1647,6 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, MAX_PATH); hres = ppf->Load(wsz, 0); - ppf->Release(); - if (SUCCEEDED(hres)) { wxChar buf[2048]; @@ -1744,13 +1667,11 @@ bool wxFileName::GetShortcutTarget(const wxString& shortcutPath, } } } - - psl->Release(); } return success; } -#endif // __WIN32__ && !__WXWINCE__ +#endif // __WIN32__ // ---------------------------------------------------------------------------- @@ -1793,8 +1714,13 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) // get cwd only once - small time saving wxString cwd = wxGetCwd(); - Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); - fnBase.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); + + // Normalize the paths but avoid changing the case or turning a shortcut + // into a file that it points to. + const int normFlags = wxPATH_NORM_ALL & + ~(wxPATH_NORM_CASE | wxPATH_NORM_SHORTCUT); + Normalize(normFlags, cwd, format); + fnBase.Normalize(normFlags, cwd, format); bool withCase = IsCaseSensitive(format); @@ -1823,15 +1749,27 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) m_dirs.Insert(wxT(".."), 0u); } - if ( format == wxPATH_UNIX || format == wxPATH_DOS ) + switch ( GetFormat(format) ) { - // a directory made relative with respect to itself is '.' under Unix - // and DOS, by definition (but we don't have to insert "./" for the - // files) - if ( m_dirs.IsEmpty() && IsDir() ) - { - m_dirs.Add(wxT('.')); - } + case wxPATH_NATIVE: + case wxPATH_MAX: + wxFAIL_MSG( wxS("unreachable") ); + wxFALLTHROUGH; + + case wxPATH_UNIX: + case wxPATH_DOS: + // a directory made relative with respect to itself is '.' under + // Unix and DOS, by definition (but we don't have to insert "./" + // for the files) + if ( m_dirs.IsEmpty() && IsDir() ) + { + m_dirs.Add(wxT('.')); + } + break; + + case wxPATH_MAC: + case wxPATH_VMS: + break; } m_relative = true; @@ -1890,7 +1828,7 @@ wxString wxFileName::GetForbiddenChars(wxPathFormat format) { default : wxFAIL_MSG( wxT("Unknown path format") ); - // !! Fall through !! + wxFALLTHROUGH; case wxPATH_UNIX: break; @@ -1913,11 +1851,8 @@ wxString wxFileName::GetForbiddenChars(wxPathFormat format) } /* static */ -wxString wxFileName::GetVolumeSeparator(wxPathFormat WXUNUSED_IN_WINCE(format)) +wxString wxFileName::GetVolumeSeparator(wxPathFormat format) { -#ifdef __WXWINCE__ - return wxEmptyString; -#else wxString sepVol; if ( (GetFormat(format) == wxPATH_DOS) || @@ -1928,7 +1863,6 @@ wxString wxFileName::GetVolumeSeparator(wxPathFormat WXUNUSED_IN_WINCE(format)) //else: leave empty return sepVol; -#endif } /* static */ @@ -1945,7 +1879,7 @@ wxString wxFileName::GetPathSeparators(wxPathFormat format) default: wxFAIL_MSG( wxT("Unknown wxPATH_XXX style") ); - // fall through + wxFALLTHROUGH; case wxPATH_UNIX: seps = wxFILE_SEP_PATH_UNIX; @@ -2094,7 +2028,7 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const default: wxFAIL_MSG( wxT("Unknown path format") ); - // fall through + wxFALLTHROUGH; case wxPATH_UNIX: if ( !m_relative ) @@ -2143,7 +2077,7 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const default: wxFAIL_MSG( wxT("Unexpected path format") ); - // still fall through + wxFALLTHROUGH; case wxPATH_DOS: case wxPATH_UNIX: @@ -2188,7 +2122,7 @@ wxString wxFileName::GetShortPath() const { wxString path(GetFullPath()); -#if defined(__WINDOWS__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) && defined(__WIN32__) DWORD sz = ::GetShortPathName(path.t_str(), NULL, 0); if ( sz != 0 ) { @@ -2214,62 +2148,23 @@ wxString wxFileName::GetLongPath() const wxString pathOut, path = GetFullPath(); -#if defined(__WIN32__) && !defined(__WXWINCE__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) -#if wxUSE_DYNLIB_CLASS - typedef DWORD (WINAPI *GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD); - - // this is MT-safe as in the worst case we're going to resolve the function - // twice -- but as the result is the same in both threads, it's ok - static GET_LONG_PATH_NAME s_pfnGetLongPathName = NULL; - if ( !s_pfnGetLongPathName ) + DWORD dwSize = ::GetLongPathName(path.t_str(), NULL, 0); + if ( dwSize > 0 ) { - static bool s_triedToLoad = false; - - if ( !s_triedToLoad ) + if ( ::GetLongPathName + ( + path.t_str(), + wxStringBuffer(pathOut, dwSize), + dwSize + ) != 0 ) { - s_triedToLoad = true; - - wxDynamicLibrary dllKernel(wxT("kernel32")); - - const wxChar* GetLongPathName = wxT("GetLongPathName") -#if wxUSE_UNICODE - wxT("W"); -#else // ANSI - wxT("A"); -#endif // Unicode/ANSI - - if ( dllKernel.HasSymbol(GetLongPathName) ) - { - s_pfnGetLongPathName = (GET_LONG_PATH_NAME) - dllKernel.GetSymbol(GetLongPathName); - } - - // note that kernel32.dll can be unloaded, it stays in memory - // anyhow as all Win32 programs link to it and so it's safe to call - // GetLongPathName() even after unloading it + return pathOut; } } - if ( s_pfnGetLongPathName ) - { - DWORD dwSize = (*s_pfnGetLongPathName)(path.t_str(), NULL, 0); - if ( dwSize > 0 ) - { - if ( (*s_pfnGetLongPathName) - ( - path.t_str(), - wxStringBuffer(pathOut, dwSize), - dwSize - ) != 0 ) - { - return pathOut; - } - } - } -#endif // wxUSE_DYNLIB_CLASS - - // The OS didn't support GetLongPathName, or some other error. + // Some other error occured. // We need to call FindFirstFile on each component in turn. WIN32_FIND_DATA findFileData; @@ -2338,7 +2233,7 @@ wxPathFormat wxFileName::GetFormat( wxPathFormat format ) { if (format == wxPATH_NATIVE) { -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__) +#if defined(__WINDOWS__) format = wxPATH_DOS; #elif defined(__VMS) format = wxPATH_VMS; @@ -2586,7 +2481,7 @@ bool wxFileName::SetPermissions(int permissions) { // Don't do anything for a symlink but first make sure it is one. if ( m_dontFollowLinks && - Exists(wxFILE_EXISTS_SYMLINK|wxFILE_EXISTS_NO_FOLLOW) ) + Exists(GetFullPath(), wxFILE_EXISTS_SYMLINK|wxFILE_EXISTS_NO_FOLLOW) ) { // Looks like changing permissions for a symlinc is only supported // on BSD where lchmod is present and correctly implemented. @@ -2633,13 +2528,6 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, int flags; if ( IsDir() ) { - if ( wxGetOsVersion() == wxOS_WINDOWS_9X ) - { - wxLogError(_("Setting directory access times is not supported " - "under this OS version")); - return false; - } - path = GetPath(); flags = FILE_FLAG_BACKUP_SEMANTICS; } @@ -2660,7 +2548,7 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, return true; } } -#elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__)) +#elif defined(__UNIX_LIKE__) wxUnusedVar(dtCreate); if ( !dtAccess && !dtMod ) @@ -2887,142 +2775,3 @@ wxString wxFileName::GetHumanReadableSize(const wxString& failmsg, #endif // wxUSE_LONGLONG -// ---------------------------------------------------------------------------- -// Mac-specific functions -// ---------------------------------------------------------------------------- - -#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON - -namespace -{ - -class MacDefaultExtensionRecord -{ -public: - MacDefaultExtensionRecord() - { - m_type = - m_creator = 0 ; - } - - // default copy ctor, assignment operator and dtor are ok - - MacDefaultExtensionRecord(const wxString& ext, OSType type, OSType creator) - : m_ext(ext) - { - m_type = type; - m_creator = creator; - } - - wxString m_ext; - OSType m_type; - OSType m_creator; -}; - -WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray); - -bool gMacDefaultExtensionsInited = false; - -#include "wx/arrimpl.cpp" - -WX_DEFINE_EXPORTED_OBJARRAY(MacDefaultExtensionArray); - -MacDefaultExtensionArray gMacDefaultExtensions; - -// load the default extensions -const MacDefaultExtensionRecord gDefaults[] = -{ - MacDefaultExtensionRecord( "txt", 'TEXT', 'ttxt' ), - MacDefaultExtensionRecord( "tif", 'TIFF', '****' ), - MacDefaultExtensionRecord( "jpg", 'JPEG', '****' ), -}; - -void MacEnsureDefaultExtensionsLoaded() -{ - if ( !gMacDefaultExtensionsInited ) - { - // we could load the pc exchange prefs here too - for ( size_t i = 0 ; i < WXSIZEOF( gDefaults ) ; ++i ) - { - gMacDefaultExtensions.Add( gDefaults[i] ) ; - } - gMacDefaultExtensionsInited = true; - } -} - -} // anonymous namespace - -bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) -{ - FSRef fsRef ; - FSCatalogInfo catInfo; - FileInfo *finfo ; - - if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) - { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - finfo->fileType = type ; - finfo->fileCreator = creator ; - FSSetCatalogInfo( &fsRef, kFSCatInfoFinderInfo, &catInfo ) ; - return true ; - } - } - return false ; -} - -bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) const -{ - FSRef fsRef ; - FSCatalogInfo catInfo; - FileInfo *finfo ; - - if ( wxMacPathToFSRef( GetFullPath() , &fsRef ) == noErr ) - { - if ( FSGetCatalogInfo (&fsRef, kFSCatInfoFinderInfo, &catInfo, NULL, NULL, NULL) == noErr ) - { - finfo = (FileInfo*)&catInfo.finderInfo; - *type = finfo->fileType ; - *creator = finfo->fileCreator ; - return true ; - } - } - return false ; -} - -bool wxFileName::MacSetDefaultTypeAndCreator() -{ - wxUint32 type , creator ; - if ( wxFileName::MacFindDefaultTypeAndCreator(GetExt() , &type , - &creator ) ) - { - return MacSetTypeAndCreator( type , creator ) ; - } - return false; -} - -bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) -{ - MacEnsureDefaultExtensionsLoaded() ; - wxString extl = ext.Lower() ; - for( int i = gMacDefaultExtensions.Count() - 1 ; i >= 0 ; --i ) - { - if ( gMacDefaultExtensions.Item(i).m_ext == extl ) - { - *type = gMacDefaultExtensions.Item(i).m_type ; - *creator = gMacDefaultExtensions.Item(i).m_creator ; - return true ; - } - } - return false ; -} - -void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) -{ - MacEnsureDefaultExtensionsLoaded(); - MacDefaultExtensionRecord rec(ext.Lower(), type, creator); - gMacDefaultExtensions.Add( rec ); -} - -#endif // defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON diff --git a/Externals/wxWidgets3/src/common/filepickercmn.cpp b/Externals/wxWidgets3/src/common/filepickercmn.cpp index a58b4adfec..ad3be2a644 100644 --- a/Externals/wxWidgets3/src/common/filepickercmn.cpp +++ b/Externals/wxWidgets3/src/common/filepickercmn.cpp @@ -45,7 +45,7 @@ const char wxDirPickerWidgetLabel[] = wxTRANSLATE("Browse"); wxDEFINE_EVENT( wxEVT_FILEPICKER_CHANGED, wxFileDirPickerEvent ); wxDEFINE_EVENT( wxEVT_DIRPICKER_CHANGED, wxFileDirPickerEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxFileDirPickerEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileDirPickerEvent, wxCommandEvent); // ---------------------------------------------------------------------------- // wxFileDirPickerCtrlBase @@ -175,7 +175,7 @@ void wxFileDirPickerCtrlBase::OnFileDirChange(wxFileDirPickerEvent &ev) #if wxUSE_FILEPICKERCTRL -IMPLEMENT_DYNAMIC_CLASS(wxFilePickerCtrl, wxPickerBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxFilePickerCtrl, wxPickerBase); bool wxFilePickerCtrl::Create(wxWindow *parent, wxWindowID id, @@ -214,7 +214,7 @@ wxString wxFilePickerCtrl::GetTextCtrlValue() const // ---------------------------------------------------------------------------- #if wxUSE_DIRPICKERCTRL -IMPLEMENT_DYNAMIC_CLASS(wxDirPickerCtrl, wxPickerBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxDirPickerCtrl, wxPickerBase); bool wxDirPickerCtrl::Create(wxWindow *parent, wxWindowID id, diff --git a/Externals/wxWidgets3/src/common/filesys.cpp b/Externals/wxWidgets3/src/common/filesys.cpp index 06edca28a2..1a04946aea 100644 --- a/Externals/wxWidgets3/src/common/filesys.cpp +++ b/Externals/wxWidgets3/src/common/filesys.cpp @@ -29,6 +29,7 @@ #include "wx/tokenzr.h" #include "wx/uri.h" #include "wx/private/fileback.h" +#include "wx/utils.h" // ---------------------------------------------------------------------------- // wxFSFile @@ -49,7 +50,7 @@ const wxString& wxFSFile::GetMimeType() const // wxFileSystemHandler // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject); /* static */ @@ -181,18 +182,53 @@ wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) /* static */ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) { - int i, l = location.length(); - int l2 = l + 1; - - for (i = l-1; - (i >= 0) && - ((location[i] != wxT(':')) || (i == 1) || (location[i-2] == wxT(':'))); - i--) + int i, len = location.length(); + for (i = len-1; i >= 0; i--) { - if (location[i] == wxT('#')) l2 = i + 1; + if (location[i] == wxT('#')) + len = i; + if (location[i] != wxT(':')) + continue; + + // C: on Windows + if (i == 1) + continue; + if (i >= 2 && wxIsalpha(location[i-1]) && location[i-2] == wxT('/')) + continue; + + // Could be the protocol + break; } if (i == 0) return wxEmptyString; - else return location.Mid(i + 1, l2 - i - 2); + + const static wxString protocol(wxT("file:")); + if (i < (int)protocol.length() - 1 || location.compare(0, i + 1, protocol)) + return location.Mid(i + 1, len - i - 1); + + int s = ++i; // Start position + // Check if there are three '/'s after "file:" + int end = wxMin(len, s + 3); + while (i < end && location[i] == wxT('/')) + i++; + if (i == s + 2) // Host is specified, e.g. "file://host/path" + return location.Mid(s, len - s); + if (i > s) + { + // Remove the last '/' if it is preceding "C:/...". + // Otherwise, keep it. + if (i + 1 >= len || location[i + 1] != wxT(':')) + i--; + else if (i + 4 < len) + { + // Check if ':' was encoded + const static wxString colonLower(wxT("%3a")); + const static wxString colonUpper(wxT("%3A")); + wxString sub =location.Mid(i + 1, 3); + if (sub == colonLower || sub == colonUpper) + i--; + } + } + return location.Mid(i, len - i); } /* static */ @@ -293,8 +329,8 @@ wxString wxLocalFSHandler::FindNext() // wxFileSystem //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFileSystem, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxFSFile, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileSystem, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxFSFile, wxObject); wxList wxFileSystem::m_Handlers; @@ -664,21 +700,11 @@ static wxString EscapeFileNameCharsInURL(const char *in) { const unsigned char c = *p; - // notice that all colons *must* be encoded in the paths used by - // wxFileSystem even though this makes URLs produced by this method - // unusable with IE under Windows as it requires "file:///c:/foo.bar" - // and doesn't accept "file:///c%3a/foo.bar" -- but then we never made - // any guarantees about general suitability of the strings returned by - // this method, they must work with wxFileSystem only and not encoding - // the colon breaks handling of - // "http://wherever/whatever.zip#zip:filename.ext" URLs so we really - // can't do this without heavy changes to the parsing code here, in - // particular in GetRightLocation() - - if ( c == '/' || c == '-' || c == '.' || c == '_' || c == '~' || - (c >= '0' && c <= '9') || + // https://tools.ietf.org/html/rfc1738#section-5 + if ( (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') ) + (c >= 'A' && c <= 'Z') || + strchr("/:$-_.+!*'(),", c) ) // Plus '/' and ':' { s << c; } @@ -702,15 +728,11 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename) // unc notation, wxMSW if ( url.Find(wxT("\\\\")) == 0 ) { - url = wxT("//") + url.Mid(2); + url = url.Mid(2); } else { url = wxT("/") + url; -#ifdef __WXMAC__ - url = wxT("/") + url; -#endif - } #endif @@ -718,7 +740,7 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename) // Do wxURI- and common practice-compatible escaping: encode the string // into UTF-8, then escape anything non-ASCII: - return wxT("file:") + EscapeFileNameCharsInURL(url.utf8_str()); + return wxT("file://") + EscapeFileNameCharsInURL(url.utf8_str()); } @@ -726,7 +748,7 @@ wxString wxFileSystem::FileNameToURL(const wxFileName& filename) class wxFileSystemModule : public wxModule { - DECLARE_DYNAMIC_CLASS(wxFileSystemModule) + wxDECLARE_DYNAMIC_CLASS(wxFileSystemModule); public: wxFileSystemModule() : @@ -735,13 +757,13 @@ class wxFileSystemModule : public wxModule { } - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { m_handler = new wxLocalFSHandler; wxFileSystem::AddHandler(m_handler); return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { delete wxFileSystem::RemoveHandler(m_handler); @@ -753,7 +775,7 @@ class wxFileSystemModule : public wxModule }; -IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule); //// wxFSInputStream diff --git a/Externals/wxWidgets3/src/common/fldlgcmn.cpp b/Externals/wxWidgets3/src/common/fldlgcmn.cpp index 0b02b78409..5bbe74356a 100644 --- a/Externals/wxWidgets3/src/common/fldlgcmn.cpp +++ b/Externals/wxWidgets3/src/common/fldlgcmn.cpp @@ -30,7 +30,7 @@ extern WXDLLEXPORT_DATA(const char) wxFileDialogNameStr[] = "filedlg"; extern WXDLLEXPORT_DATA(const char) wxFileSelectorPromptStr[] = "Select a file"; extern WXDLLEXPORT_DATA(const char) wxFileSelectorDefaultWildcardStr[] = -#if defined(__WXMSW__) || defined(__OS2__) +#if defined(__WXMSW__) "*.*" #else // Unix/Mac "*" @@ -41,7 +41,7 @@ extern WXDLLEXPORT_DATA(const char) wxFileSelectorDefaultWildcardStr[] = // wxFileDialogBase //---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog); void wxFileDialogBase::Init() { @@ -132,19 +132,6 @@ bool wxFileDialogBase::Create(wxWindow *parent, return true; } -#if WXWIN_COMPATIBILITY_2_6 -long wxFileDialogBase::GetStyle() const -{ - return GetWindowStyle(); -} - -void wxFileDialogBase::SetStyle(long style) -{ - SetWindowStyle(style); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - wxString wxFileDialogBase::AppendExtension(const wxString &filePath, const wxString &extensionList) { @@ -213,7 +200,12 @@ void wxFileDialogBase::SetPath(const wxString& path) wxString ext; wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) + { + SetFilterIndexFromExt(ext); + m_fileName << wxT('.') << ext; + } + m_path = path; } @@ -229,6 +221,30 @@ void wxFileDialogBase::SetFilename(const wxString& name) m_path = wxFileName(m_dir, m_fileName).GetFullPath(); } +void wxFileDialogBase::SetFilterIndexFromExt(const wxString& ext) +{ + // if filter is of form "All files (*)|*|..." set correct filter index + if ( !ext.empty() && m_wildCard.find(wxT('|')) != wxString::npos ) + { + int filterIndex = -1; + + wxArrayString descriptions, filters; + // don't care about errors, handled already by wxFileDialog + (void)wxParseCommonDialogsFilter(m_wildCard, descriptions, filters); + for (size_t n=0; n= 0) + SetFilterIndex(filterIndex); + } +} + //---------------------------------------------------------------------------- // wxFileDialog convenience functions //---------------------------------------------------------------------------- @@ -263,26 +279,7 @@ wxString wxFileSelector(const wxString& title, defaultFileName, filter2, flags, wxPoint(x, y)); - // if filter is of form "All files (*)|*|..." set correct filter index - if ( !defaultExtension.empty() && filter2.find(wxT('|')) != wxString::npos ) - { - int filterIndex = 0; - - wxArrayString descriptions, filters; - // don't care about errors, handled already by wxFileDialog - (void)wxParseCommonDialogsFilter(filter2, descriptions, filters); - for (size_t n=0; n 0) - fileDialog.SetFilterIndex(filterIndex); - } + fileDialog.SetFilterIndexFromExt(defaultExtension); wxString filename; if ( fileDialog.ShowModal() == wxID_OK ) @@ -395,17 +392,4 @@ WXDLLEXPORT wxString wxSaveFileSelector(const wxString& what, // wxDirDialogBase //---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_6 -long wxDirDialogBase::GetStyle() const -{ - return GetWindowStyle(); -} - -void wxDirDialogBase::SetStyle(long style) -{ - SetWindowStyle(style); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - #endif // wxUSE_FILEDLG diff --git a/Externals/wxWidgets3/src/common/fmapbase.cpp b/Externals/wxWidgets3/src/common/fmapbase.cpp index 698996c1b1..9bef0110dc 100644 --- a/Externals/wxWidgets3/src/common/fmapbase.cpp +++ b/Externals/wxWidgets3/src/common/fmapbase.cpp @@ -362,7 +362,7 @@ class wxFontMapperModule : public wxModule public: wxFontMapperModule() : wxModule() { } - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { // a dummy wxFontMapperBase object could have been created during the // program startup before wxApp was created, we have to delete it to @@ -376,15 +376,15 @@ public: return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { wxFontMapperBase::Reset(); } - DECLARE_DYNAMIC_CLASS(wxFontMapperModule) + wxDECLARE_DYNAMIC_CLASS(wxFontMapperModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontMapperModule, wxModule); // ============================================================================ diff --git a/Externals/wxWidgets3/src/common/fontcmn.cpp b/Externals/wxWidgets3/src/common/fontcmn.cpp index 715e2c05f6..da8e05d239 100644 --- a/Externals/wxWidgets3/src/common/fontcmn.cpp +++ b/Externals/wxWidgets3/src/common/fontcmn.cpp @@ -97,7 +97,7 @@ wxENUM_MEMBER( wxFONTWEIGHT_LIGHT ) wxENUM_MEMBER( wxFONTWEIGHT_BOLD ) wxEND_ENUM( wxFontWeight ) -wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject, "wx/font.h") +wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject, "wx/font.h"); //WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl) @@ -389,7 +389,8 @@ bool wxFontBase::operator==(const wxFont& font) const // in wxGTK1 GetPixelSize() calls GetInternalFont() which uses // operator==() resulting in infinite recursion so we can't use it // in that port -#if !defined(__WXGTK__) || defined(__WXGTK20__) + // in wxQT, GetPixelSize is too slow to be used here +#if (!defined(__WXGTK__) || defined(__WXGTK20__)) && !defined(__WXQT__) GetPixelSize() == font.GetPixelSize() && #endif GetFamily() == font.GetFamily() && @@ -510,6 +511,16 @@ wxFont wxFont::Bold() const return font; } +wxFont wxFont::GetBaseFont() const +{ + wxFont font(*this); + font.SetStyle(wxFONTSTYLE_NORMAL); + font.SetWeight(wxFONTWEIGHT_NORMAL ); + font.SetUnderlined(false); + font.SetStrikethrough(false); + return font; +} + wxFont& wxFont::MakeItalic() { SetStyle(wxFONTSTYLE_ITALIC); @@ -776,7 +787,7 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding_) // format there anyhow (but there is a well-defined standard for X11 fonts used // by wxGTK and wxMotif) -#if defined(wxNO_NATIVE_FONTINFO) || defined(__WXMSW__) || defined (__WXPM__) || defined(__WXOSX__) +#if defined(wxNO_NATIVE_FONTINFO) || defined(__WXMSW__) || defined(__WXOSX__) wxString wxNativeFontInfo::ToUserString() const { @@ -791,14 +802,14 @@ wxString wxNativeFontInfo::ToUserString() const if ( GetStrikethrough() ) { - desc << _("strikethrough"); + desc << _(" strikethrough"); } switch ( GetWeight() ) { default: wxFAIL_MSG( wxT("unknown font weight") ); - // fall through + wxFALLTHROUGH; case wxFONTWEIGHT_NORMAL: break; @@ -816,7 +827,7 @@ wxString wxNativeFontInfo::ToUserString() const { default: wxFAIL_MSG( wxT("unknown font style") ); - // fall through + wxFALLTHROUGH; case wxFONTSTYLE_NORMAL: break; @@ -970,6 +981,11 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) { SetStrikethrough(true); } + else if ( token == wxT("underlinedstrikethrough") ) + { + SetUnderlined(true); + SetStrikethrough(true); + } else if ( token == wxT("light") || token == _("light") ) { SetWeight(wxFONTWEIGHT_LIGHT); @@ -1096,7 +1112,7 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) return true; } -#endif // generic or wxMSW or wxOS2 +#endif // generic or wxMSW // wxFont <-> wxString utilities, used by wxConfig diff --git a/Externals/wxWidgets3/src/common/fontdata.cpp b/Externals/wxWidgets3/src/common/fontdata.cpp index deef52ce2a..6417eb8bb8 100644 --- a/Externals/wxWidgets3/src/common/fontdata.cpp +++ b/Externals/wxWidgets3/src/common/fontdata.cpp @@ -15,7 +15,7 @@ #include "wx/fontdata.h" -IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject); wxFontData::wxFontData() { diff --git a/Externals/wxWidgets3/src/common/fontenumcmn.cpp b/Externals/wxWidgets3/src/common/fontenumcmn.cpp index 1185a864ab..423f8dbb64 100644 --- a/Externals/wxWidgets3/src/common/fontenumcmn.cpp +++ b/Externals/wxWidgets3/src/common/fontenumcmn.cpp @@ -33,13 +33,13 @@ // A simple wxFontEnumerator which doesn't perform any filtering and // just returns all facenames and encodings found in the system -class WXDLLEXPORT wxSimpleFontEnumerator : public wxFontEnumerator +class wxSimpleFontEnumerator : public wxFontEnumerator { public: wxSimpleFontEnumerator() { } // called by EnumerateFacenames - virtual bool OnFacename(const wxString& facename) + virtual bool OnFacename(const wxString& facename) wxOVERRIDE { m_arrFacenames.Add(facename); return true; @@ -47,7 +47,7 @@ public: // called by EnumerateEncodings virtual bool OnFontEncoding(const wxString& WXUNUSED(facename), - const wxString& encoding) + const wxString& encoding) wxOVERRIDE { m_arrEncodings.Add(encoding); return true; diff --git a/Externals/wxWidgets3/src/common/fontmgrcmn.cpp b/Externals/wxWidgets3/src/common/fontmgrcmn.cpp index 9dd64f859a..1559d0ad7d 100644 --- a/Externals/wxWidgets3/src/common/fontmgrcmn.cpp +++ b/Externals/wxWidgets3/src/common/fontmgrcmn.cpp @@ -118,13 +118,14 @@ wxFontBundleBase::GetFaceForFont(const wxFontMgrFontRefData& font) const int type = FaceType_Regular; - if ( font.GetWeight() == wxBOLD ) + if ( font.GetWeight() == wxFONTWEIGHT_BOLD ) type |= FaceType_Bold; - // FIXME -- this should read "if ( font->GetStyle() == wxITALIC )", + // FIXME -- this should read "if ( font->GetStyle() == wxFONTSTYLE_ITALIC )", // 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 ( font.GetStyle() == wxFONTSTYLE_ITALIC + || font.GetStyle() == wxFONTSTYLE_SLANT ) { if ( HasFace((FaceType)(type | FaceType_Italic)) ) type |= FaceType_Italic; diff --git a/Externals/wxWidgets3/src/common/fontpickercmn.cpp b/Externals/wxWidgets3/src/common/fontpickercmn.cpp index 83e6a36e17..3e7e1f849c 100644 --- a/Externals/wxWidgets3/src/common/fontpickercmn.cpp +++ b/Externals/wxWidgets3/src/common/fontpickercmn.cpp @@ -42,15 +42,13 @@ const char wxFontPickerCtrlNameStr[] = "fontpicker"; const char wxFontPickerWidgetNameStr[] = "fontpickerwidget"; wxDEFINE_EVENT(wxEVT_FONTPICKER_CHANGED, wxFontPickerEvent); -IMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrl, wxPickerBase) -IMPLEMENT_DYNAMIC_CLASS(wxFontPickerEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontPickerCtrl, wxPickerBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxFontPickerEvent, wxCommandEvent); // ---------------------------------------------------------------------------- // wxFontPickerCtrl // ---------------------------------------------------------------------------- -#define M_PICKER ((wxFontPickerWidget*)m_picker) - bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id, const wxFont &initial, const wxPoint &pos, const wxSize &size, @@ -116,7 +114,7 @@ wxFont wxFontPickerCtrl::String2Font(const wxString &s) void wxFontPickerCtrl::SetSelectedFont(const wxFont &f) { - M_PICKER->SetSelectedFont(f); + GetPickerWidget()->SetSelectedFont(f); UpdateTextCtrlFromPicker(); } @@ -132,9 +130,9 @@ void wxFontPickerCtrl::UpdatePickerFromTextCtrl() if (!f.IsOk()) return; // invalid user input - if (M_PICKER->GetSelectedFont() != f) + if (GetPickerWidget()->GetSelectedFont() != f) { - M_PICKER->SetSelectedFont(f); + GetPickerWidget()->SetSelectedFont(f); // fire an event wxFontPickerEvent event(this, GetId(), f); @@ -149,7 +147,7 @@ void wxFontPickerCtrl::UpdateTextCtrlFromPicker() // Take care to use ChangeValue() here and not SetValue() to avoid // infinite recursion. - m_text->ChangeValue(Font2String(M_PICKER->GetSelectedFont())); + m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont())); } diff --git a/Externals/wxWidgets3/src/common/framecmn.cpp b/Externals/wxWidgets3/src/common/framecmn.cpp index bf310d7f9d..d4ad7d58dd 100644 --- a/Externals/wxWidgets3/src/common/framecmn.cpp +++ b/Externals/wxWidgets3/src/common/framecmn.cpp @@ -43,12 +43,12 @@ extern WXDLLEXPORT_DATA(const char) wxStatusLineNameStr[] = "status_line"; #if wxUSE_MENUS #if wxUSE_STATUSBAR -BEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow) +wxBEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow) EVT_MENU_OPEN(wxFrameBase::OnMenuOpen) EVT_MENU_CLOSE(wxFrameBase::OnMenuClose) EVT_MENU_HIGHLIGHT_ALL(wxFrameBase::OnMenuHighlight) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #endif // wxUSE_STATUSBAR /* static */ @@ -109,14 +109,8 @@ wxFLAGS_MEMBER(wxHSCROLL) // frame styles wxFLAGS_MEMBER(wxSTAY_ON_TOP) wxFLAGS_MEMBER(wxCAPTION) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxTHICK_FRAME) -#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxSYSTEM_MENU) wxFLAGS_MEMBER(wxRESIZE_BORDER) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxRESIZE_BOX) -#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxCLOSE_BOX) wxFLAGS_MEMBER(wxMAXIMIZE_BOX) wxFLAGS_MEMBER(wxMINIMIZE_BOX) @@ -127,7 +121,7 @@ wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT) wxFLAGS_MEMBER(wxFRAME_SHAPED) wxEND_FLAGS( wxFrameStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow, "wx/frame.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow, "wx/frame.h"); wxBEGIN_PROPERTIES_TABLE(wxFrame) wxEVENT_PROPERTY( Menu, wxEVT_MENU, wxCommandEvent) @@ -171,7 +165,9 @@ wxFrameBase::wxFrameBase() wxFrameBase::~wxFrameBase() { - // this destructor is required for Darwin + SendDestroyEvent(); + + DeleteAllBars(); } wxFrame *wxFrameBase::New(wxWindow *parent, @@ -332,6 +328,8 @@ void wxFrameBase::UpdateWindowUI(long flags) void wxFrameBase::OnMenuHighlight(wxMenuEvent& event) { + event.Skip(); + #if wxUSE_STATUSBAR (void)ShowMenuHelp(event.GetMenuId()); #endif // wxUSE_STATUSBAR @@ -339,6 +337,8 @@ void wxFrameBase::OnMenuHighlight(wxMenuEvent& event) void wxFrameBase::OnMenuOpen(wxMenuEvent& event) { + event.Skip(); + if ( !ShouldUpdateMenuFromIdle() ) { // as we didn't update the menus from idle time, do it now @@ -346,8 +346,10 @@ void wxFrameBase::OnMenuOpen(wxMenuEvent& event) } } -void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event)) +void wxFrameBase::OnMenuClose(wxMenuEvent& event) { + event.Skip(); + DoGiveHelp(wxEmptyString, false); } @@ -573,15 +575,9 @@ wxToolBar* wxFrameBase::OnCreateToolBar(long style, wxWindowID id, const wxString& name) { -#if defined(__WXWINCE__) && defined(__POCKETPC__) - return new wxToolMenuBar(this, id, - wxDefaultPosition, wxDefaultSize, - style, name); -#else return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name); -#endif } void wxFrameBase::SetToolBar(wxToolBar *toolbar) @@ -635,8 +631,7 @@ void wxFrameBase::DoMenuUpdates(wxMenu* menu) { if (menu) { - wxEvtHandler* source = GetEventHandler(); - menu->UpdateUI(source); + menu->UpdateUI(); } else { diff --git a/Externals/wxWidgets3/src/common/fs_arc.cpp b/Externals/wxWidgets3/src/common/fs_arc.cpp index ef1df75f2b..14f3134b5f 100644 --- a/Externals/wxWidgets3/src/common/fs_arc.cpp +++ b/Externals/wxWidgets3/src/common/fs_arc.cpp @@ -21,12 +21,7 @@ #include "wx/log.h" #endif -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_ZIPSTREAM - #include "wx/zipstrm.h" -#else - #include "wx/archive.h" -#endif - +#include "wx/archive.h" #include "wx/private/fileback.h" //--------------------------------------------------------------------------- @@ -310,7 +305,7 @@ wxArchiveFSCacheData *wxArchiveFSCache::Get(const wxString& name) // wxArchiveFSHandler //---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxArchiveFSHandler, wxFileSystemHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxArchiveFSHandler, wxFileSystemHandler); wxArchiveFSHandler::wxArchiveFSHandler() : wxFileSystemHandler() @@ -403,11 +398,6 @@ wxFSFile* wxArchiveFSHandler::OpenFile( return NULL; } -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_ZIPSTREAM - if (wxDynamicCast(factory, wxZipClassFactory)) - ((wxZipInputStream*)s)->m_allowSeeking = true; -#endif // WXWIN_COMPATIBILITY_2_6 - return new wxFSFile(s, key + right, wxEmptyString, diff --git a/Externals/wxWidgets3/src/common/fs_inet.cpp b/Externals/wxWidgets3/src/common/fs_inet.cpp index 6a9a479301..6f3ff4fc56 100644 --- a/Externals/wxWidgets3/src/common/fs_inet.cpp +++ b/Externals/wxWidgets3/src/common/fs_inet.cpp @@ -135,7 +135,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), class wxFileSystemInternetModule : public wxModule { - DECLARE_DYNAMIC_CLASS(wxFileSystemInternetModule) + wxDECLARE_DYNAMIC_CLASS(wxFileSystemInternetModule); public: wxFileSystemInternetModule() : @@ -144,14 +144,14 @@ class wxFileSystemInternetModule : public wxModule { } - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { m_handler = new wxInternetFSHandler; wxFileSystem::AddHandler(m_handler); return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { delete wxFileSystem::RemoveHandler(m_handler); } @@ -160,6 +160,6 @@ class wxFileSystemInternetModule : public wxModule wxFileSystemHandler* m_handler; }; -IMPLEMENT_DYNAMIC_CLASS(wxFileSystemInternetModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileSystemInternetModule, wxModule); #endif // wxUSE_FILESYSTEM && wxUSE_FS_INET diff --git a/Externals/wxWidgets3/src/common/fswatchercmn.cpp b/Externals/wxWidgets3/src/common/fswatchercmn.cpp index 66fb869e9c..133aaa5a2d 100644 --- a/Externals/wxWidgets3/src/common/fswatchercmn.cpp +++ b/Externals/wxWidgets3/src/common/fswatchercmn.cpp @@ -61,7 +61,7 @@ static wxString GetFSWEventChangeTypeName(int type) // wxFileSystemWatcherEvent implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxFileSystemWatcherEvent, wxEvent); +wxIMPLEMENT_DYNAMIC_CLASS(wxFileSystemWatcherEvent, wxEvent); wxString wxFileSystemWatcherEvent::ToString() const { @@ -143,10 +143,13 @@ wxFileSystemWatcherBase::AddAny(const wxFileName& path, } else { - wxFSWatchInfo& watch = it->second; - int count = watch.IncRef(); + wxFSWatchInfo& watch2 = it->second; + const int count = watch2.IncRef(); + wxLogTrace(wxTRACE_FSWATCHER, "'%s' is now watched %d times", canonical, count); + + wxUnusedVar(count); // could be unused if debug tracing is disabled } return true; } @@ -192,14 +195,14 @@ bool wxFileSystemWatcherBase::AddTree(const wxFileName& path, int events, { } - virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename)) + virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename)) wxOVERRIDE { // There is no need to watch individual files as we watch the // parent directory which will notify us about any changes in them. return wxDIR_CONTINUE; } - virtual wxDirTraverseResult OnDir(const wxString& dirname) + virtual wxDirTraverseResult OnDir(const wxString& dirname) wxOVERRIDE { if ( m_watcher->AddAny(wxFileName::DirName(dirname), m_events, wxFSWPath_Tree, m_filespec) ) @@ -248,14 +251,14 @@ bool wxFileSystemWatcherBase::RemoveTree(const wxFileName& path) { } - virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename)) + virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename)) wxOVERRIDE { // We never watch the individual files when watching the tree, so // nothing to do here. return wxDIR_CONTINUE; } - virtual wxDirTraverseResult OnDir(const wxString& dirname) + virtual wxDirTraverseResult OnDir(const wxString& dirname) wxOVERRIDE { m_watcher->Remove(wxFileName::DirName(dirname)); return wxDIR_CONTINUE; @@ -305,9 +308,9 @@ bool wxFileSystemWatcherBase::RemoveTree(const wxFileName& path) bool wxFileSystemWatcherBase::RemoveAll() { - m_service->RemoveAll(); + const bool ret = m_service->RemoveAll(); m_watches.clear(); - return true; + return ret; } int wxFileSystemWatcherBase::GetWatchedPathsCount() const diff --git a/Externals/wxWidgets3/src/common/ftp.cpp b/Externals/wxWidgets3/src/common/ftp.cpp index c205cd7592..e253956890 100644 --- a/Externals/wxWidgets3/src/common/ftp.cpp +++ b/Externals/wxWidgets3/src/common/ftp.cpp @@ -60,7 +60,7 @@ static const size_t LEN_CODE = 3; // macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol) +wxIMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol); IMPLEMENT_PROTOCOL(wxFTP, wxT("ftp"), wxT("ftp"), true) // ============================================================================ @@ -79,8 +79,6 @@ wxFTP::wxFTP() m_username = wxT("anonymous"); m_password << wxGetUserId() << wxT('@') << wxGetFullHostName(); - SetNotify(0); - SetFlags(wxSOCKET_NOWAIT); m_bPassive = true; m_bEncounteredError = false; } @@ -239,7 +237,7 @@ char wxFTP::SendCommand(const wxString& command) wxString tmp_str = command + wxT("\r\n"); const wxWX2MBbuf tmp_buf = tmp_str.mb_str(); - if ( Write(wxMBSTRINGCAST tmp_buf, strlen(tmp_buf)).Error()) + if ( Write(static_cast(tmp_buf), strlen(tmp_buf)).Error()) { m_lastError = wxPROTO_NETERR; return 0; @@ -388,7 +386,7 @@ bool wxFTP::SetTransferMode(TransferMode transferMode) { default: wxFAIL_MSG(wxT("unknown FTP transfer mode")); - // fall through + wxFALLTHROUGH; case BINARY: mode = wxT('I'); @@ -468,7 +466,7 @@ wxString wxFTP::Pwd() } else { - for ( ++p; (bool)*p; ++p ) // FIXME-DMARS + for ( ++p; *p; ++p ) { if ( *p == wxT('"') ) { @@ -769,7 +767,11 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) wxString tmp_str = wxT("RETR ") + wxURI::Unescape(path); if ( !CheckCommand(tmp_str, '1') ) + { + delete sock; + return NULL; + } sock = AcceptIfActive(sock); if ( !sock ) @@ -778,8 +780,6 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) return NULL; } - sock->SetFlags(wxSOCKET_WAITALL); - m_streaming = true; wxInputFTPStream *in_stream = new wxInputFTPStream(this, sock); @@ -800,7 +800,11 @@ wxOutputStream *wxFTP::GetOutputStream(const wxString& path) wxString tmp_str = wxT("STOR ") + path; if ( !CheckCommand(tmp_str, '1') ) + { + delete sock; + return NULL; + } sock = AcceptIfActive(sock); diff --git a/Externals/wxWidgets3/src/common/gaugecmn.cpp b/Externals/wxWidgets3/src/common/gaugecmn.cpp index 9997495013..e08f48e4e4 100644 --- a/Externals/wxWidgets3/src/common/gaugecmn.cpp +++ b/Externals/wxWidgets3/src/common/gaugecmn.cpp @@ -29,6 +29,7 @@ #if wxUSE_GAUGE #include "wx/gauge.h" +#include "wx/appprogress.h" const char wxGaugeNameStr[] = "gauge"; @@ -39,6 +40,7 @@ const char wxGaugeNameStr[] = "gauge"; wxGaugeBase::~wxGaugeBase() { // this destructor is required for Darwin + delete m_appProgressIndicator; } // ---------------------------------------------------------------------------- @@ -76,23 +78,17 @@ wxFLAGS_MEMBER(wxHSCROLL) wxFLAGS_MEMBER(wxGA_HORIZONTAL) wxFLAGS_MEMBER(wxGA_VERTICAL) -#if WXWIN_COMPATIBILITY_2_6 -wxFLAGS_MEMBER(wxGA_PROGRESSBAR) -#endif // WXWIN_COMPATIBILITY_2_6 wxFLAGS_MEMBER(wxGA_SMOOTH) +wxFLAGS_MEMBER(wxGA_PROGRESS) wxEND_FLAGS( wxGaugeStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge, wxControl, "wx/gauge.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge, wxControl, "wx/gauge.h"); wxBEGIN_PROPERTIES_TABLE(wxGauge) wxPROPERTY( Value, int, SetValue, GetValue, 0, 0 /*flags*/, \ wxT("Helpstring"), wxT("group")) wxPROPERTY( Range, int, SetRange, GetRange, 0, 0 /*flags*/, \ wxT("Helpstring"), wxT("group")) -wxPROPERTY( ShadowWidth, int, SetShadowWidth, GetShadowWidth, \ - 0, 0 /*flags*/, wxT("Helpstring"), wxT("group")) -wxPROPERTY( BezelFace, int, SetBezelFace, GetBezelFace, \ - 0, 0 /*flags*/, wxT("Helpstring"), wxT("group")) wxPROPERTY_FLAGS( WindowStyle, wxGaugeStyle, long, SetWindowStyleFlag, \ GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \ @@ -108,6 +104,20 @@ wxCONSTRUCTOR_6( wxGauge, wxWindow*, Parent, wxWindowID, Id, int, Range, \ // wxGauge creation // ---------------------------------------------------------------------------- +void wxGaugeBase::InitProgressIndicatorIfNeeded() +{ + m_appProgressIndicator = NULL; + if ( HasFlag(wxGA_PROGRESS) ) + { + wxWindow* topParent = wxGetTopLevelParent(this); + if ( topParent != NULL ) + { + m_appProgressIndicator = + new wxAppProgressIndicator(topParent, GetRange()); + } + } +} + bool wxGaugeBase::Create(wxWindow *parent, wxWindowID id, int range, @@ -128,10 +138,13 @@ bool wxGaugeBase::Create(wxWindow *parent, SetRange(range); SetValue(0); + #if wxGAUGE_EMULATE_INDETERMINATE_MODE m_nDirection = wxRIGHT; #endif + InitProgressIndicatorIfNeeded(); + return true; } @@ -142,6 +155,9 @@ bool wxGaugeBase::Create(wxWindow *parent, void wxGaugeBase::SetRange(int range) { m_rangeMax = range; + + if ( m_appProgressIndicator ) + m_appProgressIndicator->SetRange(m_rangeMax); } int wxGaugeBase::GetRange() const @@ -152,6 +168,15 @@ int wxGaugeBase::GetRange() const void wxGaugeBase::SetValue(int pos) { m_gaugePos = pos; + + if ( m_appProgressIndicator ) + { + m_appProgressIndicator->SetValue(pos); + if ( pos == 0 ) + { + m_appProgressIndicator->Reset(); + } + } } int wxGaugeBase::GetValue() const @@ -190,29 +215,9 @@ void wxGaugeBase::Pulse() } } #endif -} -// ---------------------------------------------------------------------------- -// wxGauge appearance params -// ---------------------------------------------------------------------------- - -void wxGaugeBase::SetShadowWidth(int WXUNUSED(w)) -{ -} - -int wxGaugeBase::GetShadowWidth() const -{ - return 0; -} - - -void wxGaugeBase::SetBezelFace(int WXUNUSED(w)) -{ -} - -int wxGaugeBase::GetBezelFace() const -{ - return 0; + if ( m_appProgressIndicator ) + m_appProgressIndicator->Pulse(); } #endif // wxUSE_GAUGE diff --git a/Externals/wxWidgets3/src/common/gbsizer.cpp b/Externals/wxWidgets3/src/common/gbsizer.cpp index 88a6394175..3b291872a4 100644 --- a/Externals/wxWidgets3/src/common/gbsizer.cpp +++ b/Externals/wxWidgets3/src/common/gbsizer.cpp @@ -21,8 +21,8 @@ //--------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGBSizerItem, wxSizerItem) -IMPLEMENT_CLASS(wxGridBagSizer, wxFlexGridSizer) +wxIMPLEMENT_DYNAMIC_CLASS(wxGBSizerItem, wxSizerItem); +wxIMPLEMENT_CLASS(wxGridBagSizer, wxFlexGridSizer); const wxGBSpan wxDefaultSpan; diff --git a/Externals/wxWidgets3/src/common/gdicmn.cpp b/Externals/wxWidgets3/src/common/gdicmn.cpp index 4938977b10..96a5417167 100644 --- a/Externals/wxWidgets3/src/common/gdicmn.cpp +++ b/Externals/wxWidgets3/src/common/gdicmn.cpp @@ -34,7 +34,7 @@ #endif -IMPLEMENT_ABSTRACT_CLASS(wxGDIObject, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxGDIObject, wxObject); WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; @@ -278,10 +278,6 @@ wxColourDatabase::~wxColourDatabase () delete m_map; } - -#ifdef __WXPM__ - delete [] m_palTable; -#endif } // Colour database stuff @@ -382,16 +378,6 @@ void wxColourDatabase::Initialize() const wxColourDesc& cc = wxColourTable[n]; (*m_map)[cc.name] = new wxColour(cc.r, cc.g, cc.b); } - -#ifdef __WXPM__ - m_palTable = new long[n]; - for ( n = 0; n < WXSIZEOF(wxColourTable); n++ ) - { - const wxColourDesc& cc = wxColourTable[n]; - m_palTable[n] = OS2RGB(cc.r,cc.g,cc.b); - } - m_nSize = n; -#endif } // ---------------------------------------------------------------------------- @@ -470,41 +456,6 @@ wxString wxColourDatabase::FindName(const wxColour& colour) const return wxEmptyString; } -// ---------------------------------------------------------------------------- -// deprecated wxColourDatabase methods -// ---------------------------------------------------------------------------- - -#if WXWIN_COMPATIBILITY_2_6 -wxColour *wxColourDatabase::FindColour(const wxString& name) -{ - // This function is deprecated, use Find() instead. - // Formerly this function sometimes would return a deletable pointer and - // sometimes a non-deletable one (when returning a colour from the database). - // Trying to delete the latter anyway results in problems, so probably - // nobody ever freed the pointers. Currently it always returns a new - // instance, which means there will be memory leaks. - wxLogDebug(wxT("wxColourDataBase::FindColour():") - wxT(" Please use wxColourDataBase::Find() instead")); - - // using a static variable here is not the most elegant solution but unless - // we want to make wxStringToColourHashMap public (i.e. move it to the - // header) so that we could have a member function returning - // wxStringToColourHashMap::iterator, there is really no good way to do it - // otherwise - // - // and knowing that this function is going to disappear in the next release - // anyhow I don't want to waste time on this - - static wxColour s_col; - - s_col = Find(name); - if ( !s_col.IsOk() ) - return NULL; - - return new wxColour(s_col); -} -#endif // WXWIN_COMPATIBILITY_2_6 - // ============================================================================ // stock objects // ============================================================================ @@ -648,7 +599,8 @@ const wxFont* wxStockGDI::GetFont(Item item) switch (item) { case FONT_ITALIC: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxROMAN, wxITALIC, wxNORMAL); + font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), + wxFONTFAMILY_ROMAN, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL); break; case FONT_NORMAL: font = new wxFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); @@ -666,10 +618,11 @@ const wxFont* wxStockGDI::GetFont(Item item) #else - 2, #endif - wxSWISS, wxNORMAL, wxNORMAL); + wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); break; case FONT_SWISS: - font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), wxSWISS, wxNORMAL, wxNORMAL); + font = new wxFont(GetFont(FONT_NORMAL)->GetPointSize(), + wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); break; default: wxFAIL; @@ -840,20 +793,18 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, font->GetWeight () == weight && font->GetUnderlined () == underline ) { - bool same = font->GetFamily() == family; - // empty facename matches anything at all: this is bad because // depending on which fonts are already created, we might get back // a different font if we create it with empty facename, but it is // still better than never matching anything in the cache at all // in this case - if ( same && !facename.empty() ) - { - const wxString& fontFace = font->GetFaceName(); + bool same; + const wxString fontFaceName(font->GetFaceName()); - // empty facename matches everything - same = !fontFace || fontFace == facename; - } + if (facename.empty() || fontFaceName.empty()) + same = font->GetFamily() == family; + else + same = fontFaceName == facename; if ( same && (encoding != wxFONTENCODING_DEFAULT) ) { @@ -880,15 +831,6 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, return font; } -#if WXWIN_COMPATIBILITY_2_6 -void wxBrushList::AddBrush(wxBrush*) { } -void wxBrushList::RemoveBrush(wxBrush*) { } -void wxFontList::AddFont(wxFont*) { } -void wxFontList::RemoveFont(wxFont*) { } -void wxPenList::AddPen(wxPen*) { } -void wxPenList::RemovePen(wxPen*) { } -#endif - wxSize wxGetDisplaySize() { int x, y; diff --git a/Externals/wxWidgets3/src/common/gifdecod.cpp b/Externals/wxWidgets3/src/common/gifdecod.cpp index b478b31622..bea6addc38 100644 --- a/Externals/wxWidgets3/src/common/gifdecod.cpp +++ b/Externals/wxWidgets3/src/common/gifdecod.cpp @@ -25,6 +25,7 @@ #include #include #include "wx/gifdecod.h" +#include "wx/scopedarray.h" #include "wx/scopedptr.h" #include "wx/scopeguard.h" @@ -317,26 +318,18 @@ wxGIFErrorCode wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) { static const int allocSize = 4096 + 1; - int *ab_prefix = new int[allocSize]; // alphabet (prefixes) - if (ab_prefix == NULL) - { - return wxGIF_MEMERR; - } - int *ab_tail = new int[allocSize]; // alphabet (tails) - if (ab_tail == NULL) - { - delete[] ab_prefix; + wxScopedArray ab_prefix(allocSize); // alphabet (prefixes) + if ( !ab_prefix ) return wxGIF_MEMERR; - } - int *stack = new int[allocSize]; // decompression stack - if (stack == NULL) - { - delete[] ab_prefix; - delete[] ab_tail; + wxScopedArray ab_tail(allocSize); // alphabet (tails) + if ( !ab_tail ) + return wxGIF_MEMERR; + + wxScopedArray stack(allocSize); // decompression stack + if ( !stack ) return wxGIF_MEMERR; - } int ab_clr; // clear code int ab_fin; // end of info code @@ -406,21 +399,11 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) // GIF files, the allocSize of 4096+1 is enough. This // will only happen with badly formed GIFs. if (pos >= allocSize) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; return wxGIF_INVFORMAT; - } } if (pos >= allocSize) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; return wxGIF_INVFORMAT; - } stack[pos] = code; // push last code into the stack abcabca = code; // save for special case @@ -433,12 +416,7 @@ wxGIFDecoder::dgif(wxInputStream& stream, GIFImage *img, int interl, int bits) // to reset it. This checks whether we really got it, otherwise // the GIF is damaged. if (ab_free > ab_max) - { - delete[] ab_prefix; - delete[] ab_tail; - delete[] stack; return wxGIF_INVFORMAT; - } // This assert seems unnecessary since the condition above // eliminates the only case in which it went false. But I really @@ -578,10 +556,6 @@ as an End of Information itself) } while (code != ab_fin); - delete [] ab_prefix ; - delete [] ab_tail ; - delete [] stack ; - return wxGIF_OK; } diff --git a/Externals/wxWidgets3/src/common/glcmn.cpp b/Externals/wxWidgets3/src/common/glcmn.cpp index acaa9e2983..1db976b914 100644 --- a/Externals/wxWidgets3/src/common/glcmn.cpp +++ b/Externals/wxWidgets3/src/common/glcmn.cpp @@ -17,7 +17,6 @@ // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#define GL_GLEXT_PROTOTYPES #ifdef __BORLANDC__ #pragma hdrstop @@ -35,12 +34,40 @@ #include "wx/build.h" WX_CHECK_BUILD_OPTIONS("wxGL") -IMPLEMENT_CLASS(wxGLApp, wxApp) +wxIMPLEMENT_CLASS(wxGLApp, wxApp); // ============================================================================ // implementation // ============================================================================ +void wxGLAttribsBase::AddAttribBits(int searchVal, int combineVal) +{ + // Search for searchVal + wxVector::iterator it = m_GLValues.begin(); + while ( it != m_GLValues.end() && *it != searchVal ) + it++; + // Have we searchVal? + if ( it != m_GLValues.end() ) + { + if ( ++it == m_GLValues.end() ) + { + m_GLValues.push_back(combineVal); + } + else + { + *it |= combineVal; + } + } + else + { + // Add the identifier and the bits + m_GLValues.push_back(searchVal); + m_GLValues.push_back(combineVal); + } +} + +// ============================================================================ + wxGLCanvasBase::wxGLCanvasBase() { #if WXWIN_COMPATIBILITY_2_8 @@ -57,7 +84,7 @@ bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const // although on MSW it works even if the window is still hidden, it doesn't // work in other ports (notably X11-based ones) and documentation mentions // that SetCurrent() can only be called for a shown window, so check for it - wxASSERT_MSG( IsShownOnScreen(), wxT("can't make hidden GL canvas current") ); + wxASSERT_MSG( IsShown(), wxT("can't make hidden GL canvas current") ); return context.SetCurrent(*static_cast(this)); @@ -148,6 +175,207 @@ bool wxGLCanvasBase::IsExtensionInList(const char *list, const char *extension) return false; } +/* static */ +bool wxGLCanvasBase::ParseAttribList(const int *attribList, + wxGLAttributes& dispAttrs, + wxGLContextAttrs* ctxAttrs) +{ + // Some attributes are usually needed + dispAttrs.PlatformDefaults(); + if ( ctxAttrs ) + ctxAttrs->PlatformDefaults(); + + if ( !attribList ) + { + // Set default attributes + dispAttrs.Defaults(); + dispAttrs.EndList(); + if ( ctxAttrs ) + ctxAttrs->EndList(); + return true; + } + + int src = 0; + int minColo[4] = {0, 0, 0, 0}; + int minAcum[4] = {0, 0, 0, 0}; + int num = 0; + while ( attribList[src] ) + { + // Check a non zero-terminated list. This may help a bit with malformed lists. + if ( ++num > 200 ) + { + wxFAIL_MSG("The attributes list is not zero-terminated"); + } + + switch ( attribList[src++] ) + { + // Pixel format attributes + + case WX_GL_RGBA: + dispAttrs.RGBA(); + break; + + case WX_GL_BUFFER_SIZE: + dispAttrs.BufferSize(attribList[src++]); + break; + + case WX_GL_LEVEL: + dispAttrs.Level(attribList[src++]); + break; + + case WX_GL_DOUBLEBUFFER: + dispAttrs.DoubleBuffer(); + break; + + case WX_GL_STEREO: + dispAttrs.Stereo(); + break; + + case WX_GL_AUX_BUFFERS: + dispAttrs.AuxBuffers(attribList[src++]); + break; + + case WX_GL_MIN_RED: + minColo[0] = attribList[src++]; + break; + + case WX_GL_MIN_GREEN: + minColo[1] = attribList[src++]; + break; + + case WX_GL_MIN_BLUE: + minColo[2] = attribList[src++]; + break; + + case WX_GL_MIN_ALPHA: + minColo[3] = attribList[src++]; + break; + + case WX_GL_DEPTH_SIZE: + dispAttrs.Depth(attribList[src++]); + break; + + case WX_GL_STENCIL_SIZE: + dispAttrs.Stencil(attribList[src++]); + break; + + case WX_GL_MIN_ACCUM_RED: + minAcum[0] = attribList[src++]; + break; + + case WX_GL_MIN_ACCUM_GREEN: + minAcum[1] = attribList[src++]; + break; + + case WX_GL_MIN_ACCUM_BLUE: + minAcum[2] = attribList[src++]; + break; + + case WX_GL_MIN_ACCUM_ALPHA: + minAcum[3] = attribList[src++]; + break; + + case WX_GL_SAMPLE_BUFFERS: + dispAttrs.SampleBuffers(attribList[src++]); + break; + + case WX_GL_SAMPLES: + dispAttrs.Samplers(attribList[src++]); + break; + + case WX_GL_FRAMEBUFFER_SRGB: + dispAttrs.FrameBuffersRGB(); + break; + + // Context attributes + + case WX_GL_CORE_PROFILE: + if ( ctxAttrs ) + ctxAttrs->CoreProfile(); + break; + + case WX_GL_MAJOR_VERSION: + if ( ctxAttrs ) + ctxAttrs->MajorVersion(attribList[src]); + src++; + break; + + case WX_GL_MINOR_VERSION: + if ( ctxAttrs ) + ctxAttrs->MinorVersion(attribList[src]); + src++; + break; + + case wx_GL_COMPAT_PROFILE: + if ( ctxAttrs ) + ctxAttrs->CompatibilityProfile(); + break; + + case WX_GL_FORWARD_COMPAT: + if ( ctxAttrs ) + ctxAttrs->ForwardCompatible(); + break; + + case WX_GL_ES2: + if ( ctxAttrs ) + ctxAttrs->ES2(); + break; + + case WX_GL_DEBUG: + if ( ctxAttrs ) + ctxAttrs->DebugCtx(); + break; + + case WX_GL_ROBUST_ACCESS: + if ( ctxAttrs ) + ctxAttrs->Robust(); + break; + + case WX_GL_NO_RESET_NOTIFY: + if ( ctxAttrs ) + ctxAttrs->NoResetNotify(); + break; + + case WX_GL_LOSE_ON_RESET: + if ( ctxAttrs ) + ctxAttrs->LoseOnReset(); + break; + + case WX_GL_RESET_ISOLATION: + if ( ctxAttrs ) + ctxAttrs->ResetIsolation(); + break; + + case WX_GL_RELEASE_FLUSH: + if ( ctxAttrs ) + ctxAttrs->ReleaseFlush(1); + break; + + case WX_GL_RELEASE_NONE: + if ( ctxAttrs ) + ctxAttrs->ReleaseFlush(0); + break; + + default: + wxFAIL_MSG("Unexpected value in attributes list"); + return false; + } + } + + // Set color and accumulation + if ( minColo[0] || minColo[1] || minColo[2] || minColo[3] ) + dispAttrs.MinRGBA(minColo[0], minColo[1], minColo[2], minColo[3]); + if ( minAcum[0] || minAcum[1] || minAcum[2] || minAcum[3] ) + dispAttrs.MinAcumRGBA(minAcum[0], minAcum[1], minAcum[2], minAcum[3]); + + // The attributes lists must be zero-terminated + dispAttrs.EndList(); + if ( ctxAttrs ) + ctxAttrs->EndList(); + + return true; +} + // ============================================================================ // compatibility layer for OpenGL 3 and OpenGL ES // ============================================================================ diff --git a/Externals/wxWidgets3/src/common/graphcmn.cpp b/Externals/wxWidgets3/src/common/graphcmn.cpp index e917406a88..a9db8b48d9 100644 --- a/Externals/wxWidgets3/src/common/graphcmn.cpp +++ b/Externals/wxWidgets3/src/common/graphcmn.cpp @@ -23,28 +23,20 @@ #include "wx/icon.h" #include "wx/bitmap.h" #include "wx/dcmemory.h" + #include "wx/math.h" #include "wx/region.h" #include "wx/log.h" #endif #include "wx/private/graphics.h" -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double DegToRad(double deg) -{ - return (deg * M_PI) / 180.0; -} - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // wxGraphicsObject //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsObject, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsObject, wxObject); wxGraphicsObjectRefData::wxGraphicsObjectRefData( wxGraphicsRenderer* renderer ) { @@ -108,10 +100,10 @@ wxObjectRefData* wxGraphicsObject::CloneRefData(const wxObjectRefData* data) con // pens etc. //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPen, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBrush, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsFont, wxGraphicsObject) -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsBitmap, wxGraphicsObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsPen, wxGraphicsObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsBrush, wxGraphicsObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsFont, wxGraphicsObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsBitmap, wxGraphicsObject); WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; @@ -122,7 +114,7 @@ WXDLLIMPEXP_DATA_CORE(wxGraphicsBitmap) wxNullGraphicsBitmap; // matrix //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsMatrix, wxGraphicsObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsMatrix, wxGraphicsObject); WXDLLIMPEXP_DATA_CORE(wxGraphicsMatrix) wxNullGraphicsMatrix; // concatenates the matrix @@ -213,7 +205,7 @@ void * wxGraphicsMatrix::GetNativeMatrix() const // path //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGraphicsPath, wxGraphicsObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxGraphicsPath, wxGraphicsObject); WXDLLIMPEXP_DATA_CORE(wxGraphicsPath) wxNullGraphicsPath; // convenience functions, for using wxPoint2DDouble etc @@ -470,7 +462,7 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, alpha = 360 + alpha; // TODO obtuse angles - alpha = DegToRad(alpha); + alpha = wxDegToRad(alpha); wxDouble dist = r / sin(alpha/2) * cos(alpha/2); // calculate tangential points @@ -484,7 +476,7 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble a2 = v2.GetVectorAngle()-90; AddLineToPoint(t1.m_x,t1.m_y); - AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true); + AddArc(c.m_x,c.m_y,r,wxDegToRad(a1),wxDegToRad(a2),true); AddLineToPoint(p2.m_x,p2.m_y); } @@ -532,13 +524,14 @@ void * wxGraphicsBitmap::GetNativeBitmap() const // wxGraphicsContext Convenience Methods //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxGraphicsContext, wxObject); wxGraphicsContext::wxGraphicsContext(wxGraphicsRenderer* renderer) : wxGraphicsObject(renderer), m_antialias(wxANTIALIAS_DEFAULT), m_composition(wxCOMPOSITION_OVER), + m_interpolation(wxINTERPOLATION_DEFAULT), m_enableOffset(false) { } @@ -929,6 +922,6 @@ wxGraphicsContext* wxGraphicsContext::Create() // wxGraphicsRenderer //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxGraphicsRenderer, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxGraphicsRenderer, wxObject); #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Externals/wxWidgets3/src/common/gridcmn.cpp b/Externals/wxWidgets3/src/common/gridcmn.cpp index 0b88fd8ca2..3431bfc93f 100644 --- a/Externals/wxWidgets3/src/common/gridcmn.cpp +++ b/Externals/wxWidgets3/src/common/gridcmn.cpp @@ -67,7 +67,7 @@ wxBEGIN_FLAGS( wxGridStyle ) wxFLAGS_MEMBER(wxHSCROLL) wxEND_FLAGS( wxGridStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGrid, wxScrolledWindow, "wx/grid.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGrid, wxScrolledWindow, "wx/grid.h"); wxBEGIN_PROPERTIES_TABLE(wxGrid) wxHIDE_PROPERTY( Children ) diff --git a/Externals/wxWidgets3/src/common/headerctrlcmn.cpp b/Externals/wxWidgets3/src/common/headerctrlcmn.cpp index 2dfbcc6bc7..54bb90119e 100644 --- a/Externals/wxWidgets3/src/common/headerctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/headerctrlcmn.cpp @@ -75,12 +75,12 @@ public: extern WXDLLIMPEXP_DATA_CORE(const char) wxHeaderCtrlNameStr[] = "wxHeaderCtrl"; -BEGIN_EVENT_TABLE(wxHeaderCtrlBase, wxControl) +wxBEGIN_EVENT_TABLE(wxHeaderCtrlBase, wxControl) EVT_HEADER_SEPARATOR_DCLICK(wxID_ANY, wxHeaderCtrlBase::OnSeparatorDClick) #if wxUSE_MENUS EVT_HEADER_RIGHT_CLICK(wxID_ANY, wxHeaderCtrlBase::OnRClick) #endif // wxUSE_MENUS -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxHeaderCtrlBase::ScrollWindow(int dx, int WXUNUSED_UNLESS_DEBUG(dy), @@ -218,15 +218,10 @@ unsigned int wxHeaderCtrlBase::GetColumnPos(unsigned int idx) const wxCHECK_MSG( idx < count, wxNO_COLUMN, "invalid index" ); const wxArrayInt order = GetColumnsOrder(); - for ( unsigned n = 0; n < count; n++ ) - { - if ( (unsigned)order[n] == idx ) - return n; - } + int pos = order.Index(idx); + wxCHECK_MSG( pos != wxNOT_FOUND, wxNO_COLUMN, "column unexpectedly not displayed at all" ); - wxFAIL_MSG( "column unexpectedly not displayed at all" ); - - return wxNO_COLUMN; + return (unsigned int)pos; } /* static */ @@ -234,31 +229,14 @@ void wxHeaderCtrlBase::MoveColumnInOrderArray(wxArrayInt& order, unsigned int idx, unsigned int pos) { - const unsigned count = order.size(); + int posOld = order.Index(idx); + wxASSERT_MSG( posOld != wxNOT_FOUND, "invalid index" ); - wxArrayInt orderNew; - orderNew.reserve(count); - for ( unsigned n = 0; ; n++ ) + if ( pos != (unsigned int)posOld ) { - // NB: order of checks is important for this to work when the new - // column position is the same as the old one - - // insert the column at its new position - if ( orderNew.size() == pos ) - orderNew.push_back(idx); - - if ( n == count ) - break; - - // delete the column from its old position - const unsigned idxOld = order[n]; - if ( idxOld == idx ) - continue; - - orderNew.push_back(idxOld); + order.RemoveAt(posOld); + order.Insert(idx, pos); } - - order.swap(orderNew); } void @@ -492,7 +470,7 @@ wxHeaderCtrlSimple::UpdateColumnWidthToFit(unsigned int idx, int widthTitle) // wxHeaderCtrlEvent implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxHeaderCtrlEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxHeaderCtrlEvent, wxNotifyEvent); wxDEFINE_EVENT( wxEVT_HEADER_CLICK, wxHeaderCtrlEvent); wxDEFINE_EVENT( wxEVT_HEADER_RIGHT_CLICK, wxHeaderCtrlEvent); diff --git a/Externals/wxWidgets3/src/common/helpbase.cpp b/Externals/wxWidgets3/src/common/helpbase.cpp index 91b0e674d6..fe64f7a694 100644 --- a/Externals/wxWidgets3/src/common/helpbase.cpp +++ b/Externals/wxWidgets3/src/common/helpbase.cpp @@ -22,6 +22,6 @@ #include "wx/helpbase.h" -IMPLEMENT_CLASS(wxHelpControllerBase, wxObject) +wxIMPLEMENT_CLASS(wxHelpControllerBase, wxObject); #endif // wxUSE_HELP diff --git a/Externals/wxWidgets3/src/common/http.cpp b/Externals/wxWidgets3/src/common/http.cpp index 0ecde88c77..a4621c0731 100644 --- a/Externals/wxWidgets3/src/common/http.cpp +++ b/Externals/wxWidgets3/src/common/http.cpp @@ -22,7 +22,6 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #include "wx/app.h" #endif #include "wx/tokenzr.h" @@ -38,7 +37,7 @@ // wxHTTP // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol) +wxIMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol); IMPLEMENT_PROTOCOL(wxHTTP, wxT("http"), wxT("80"), true) wxHTTP::wxHTTP() @@ -48,8 +47,6 @@ wxHTTP::wxHTTP() m_read = false; m_proxy_mode = false; m_http_response = 0; - - SetNotify(wxSOCKET_LOST_FLAG); } wxHTTP::~wxHTTP() @@ -363,23 +360,13 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) // If there is no User-Agent defined, define it. if ( GetHeader(wxT("User-Agent")).empty() ) - SetHeader(wxT("User-Agent"), wxT("wxWidgets 2.x")); + SetHeader(wxT("User-Agent"), wxVERSION_STRING); // Send authentication information if (!m_username.empty() || !m_password.empty()) { SetHeader(wxT("Authorization"), GenerateAuthString(m_username, m_password)); } - SaveState(); - - // we may use non blocking sockets only if we can dispatch events from them - int flags = wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE - : wxSOCKET_BLOCK; - // and we must use wxSOCKET_WAITALL to ensure that all data is sent - flags |= wxSOCKET_WAITALL; - SetFlags(flags); - Notify(false); - wxString buf; buf.Printf(wxT("%s %s HTTP/1.0\r\n"), method, path); const wxWX2MBbuf pathbuf = buf.mb_str(); @@ -395,10 +382,8 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) wxString tmp_str; m_lastError = ReadLine(this, tmp_str); - if (m_lastError != wxPROTO_NOERR) { - RestoreState(); + if (m_lastError != wxPROTO_NOERR) return false; - } if (!tmp_str.Contains(wxT("HTTP/"))) { // TODO: support HTTP v0.9 which can have no header. @@ -441,7 +426,7 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) m_lastError = wxPROTO_NOERR; ret_value = ParseHeaders(); - RestoreState(); + return ret_value; } @@ -468,11 +453,11 @@ public: m_read_bytes = 0; } - size_t GetSize() const { return m_httpsize; } + size_t GetSize() const wxOVERRIDE { return m_httpsize; } virtual ~wxHTTPStream(void) { m_http->Abort(); } protected: - size_t OnSysRead(void *buffer, size_t bufsize); + size_t OnSysRead(void *buffer, size_t bufsize) wxOVERRIDE; wxDECLARE_NO_COPY_CLASS(wxHTTPStream); }; @@ -540,9 +525,6 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) inp_stream->m_read_bytes = 0; - Notify(false); - SetFlags(wxSOCKET_BLOCK | wxSOCKET_WAITALL); - // no error; reset m_lastError m_lastError = wxPROTO_NOERR; return inp_stream; diff --git a/Externals/wxWidgets3/src/common/hyperlnkcmn.cpp b/Externals/wxWidgets3/src/common/hyperlnkcmn.cpp index 8cac751b03..aacbec2149 100644 --- a/Externals/wxWidgets3/src/common/hyperlnkcmn.cpp +++ b/Externals/wxWidgets3/src/common/hyperlnkcmn.cpp @@ -76,9 +76,9 @@ wxFLAGS_MEMBER(wxHL_ALIGN_RIGHT) wxFLAGS_MEMBER(wxHL_ALIGN_CENTRE) wxEND_FLAGS( wxHyperlinkStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI( wxHyperlinkCtrl, wxControl, "wx/hyperlink.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI( wxHyperlinkCtrl, wxControl, "wx/hyperlink.h"); -IMPLEMENT_DYNAMIC_CLASS(wxHyperlinkEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxHyperlinkEvent, wxCommandEvent); wxDEFINE_EVENT( wxEVT_HYPERLINK, wxHyperlinkEvent ); wxBEGIN_PROPERTIES_TABLE(wxHyperlinkCtrl) diff --git a/Externals/wxWidgets3/src/common/iconbndl.cpp b/Externals/wxWidgets3/src/common/iconbndl.cpp index f6e0ea5ea5..c4563120fb 100644 --- a/Externals/wxWidgets3/src/common/iconbndl.cpp +++ b/Externals/wxWidgets3/src/common/iconbndl.cpp @@ -30,7 +30,7 @@ #include "wx/arrimpl.cpp" WX_DEFINE_OBJARRAY(wxIconArray) -IMPLEMENT_DYNAMIC_CLASS(wxIconBundle, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxIconBundle, wxGDIObject); #define M_ICONBUNDLEDATA static_cast(m_refData) @@ -53,7 +53,7 @@ public: // default assignment operator and dtor are ok - virtual bool IsOk() const { return !m_icons.empty(); } + virtual bool IsOk() const wxOVERRIDE { return !m_icons.empty(); } wxIconArray m_icons; }; @@ -273,14 +273,7 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const } } -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - if (!iconBest.IsOk()) - return wxNullIcon; - - return wxIcon(iconBest.GetHICON(), size); -#else return iconBest; -#endif } wxIcon wxIconBundle::GetIconOfExactSize(const wxSize& size) const diff --git a/Externals/wxWidgets3/src/common/imagbmp.cpp b/Externals/wxWidgets3/src/common/imagbmp.cpp index c3fcfb275e..4696f85eec 100644 --- a/Externals/wxWidgets3/src/common/imagbmp.cpp +++ b/Externals/wxWidgets3/src/common/imagbmp.cpp @@ -33,6 +33,8 @@ #include "wx/wfstream.h" #include "wx/quantize.h" #include "wx/scopeguard.h" +#include "wx/scopedarray.h" +#include "wx/scopedptr.h" #include "wx/anidecod.h" // For memcpy @@ -52,7 +54,7 @@ static bool CanReadICOOrCUR(wxInputStream *stream, wxUint16 resourceType); // wxBMPHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler); #if wxUSE_STREAMS @@ -99,9 +101,13 @@ bool wxBMPHandler::SaveDib(wxImage *image, return false; } - // get the format of the BMP file to save, else use 24bpp + // For icons, save alpha channel if available. + const bool saveAlpha = !IsBmp && image->HasAlpha(); + + // get the format of the BMP file to save, + // else (and always if alpha channel is present) use 24bpp unsigned format = wxBMP_24BPP; - if ( image->HasOption(wxIMAGE_OPTION_BMP_FORMAT) ) + if ( image->HasOption(wxIMAGE_OPTION_BMP_FORMAT) && !saveAlpha ) format = image->GetOptionInt(wxIMAGE_OPTION_BMP_FORMAT); wxUint16 bpp; // # of bits per pixel @@ -137,10 +143,10 @@ bool wxBMPHandler::SaveDib(wxImage *image, bpp = 8; palette_size = 256; } - else // you get 24bpp + else // you get 24bpp or 32bpp with alpha { format = wxBMP_24BPP; - bpp = 24; + bpp = saveAlpha ? 32 : 24; palette_size = 0; } @@ -198,18 +204,18 @@ bool wxBMPHandler::SaveDib(wxImage *image, { default: wxFAIL_MSG( wxT("unexpected image resolution units") ); - // fall through + wxFALLTHROUGH; case wxIMAGE_RESOLUTION_NONE: hres = vres = 72; - // fall through to convert it to correct units + wxFALLTHROUGH;// fall through to convert it to correct units case wxIMAGE_RESOLUTION_INCHES: // convert resolution in inches to resolution in centimeters hres = (int)(10*mm2inches*hres); vres = (int)(10*mm2inches*vres); - // fall through to convert it to resolution in meters + wxFALLTHROUGH;// fall through to convert it to resolution in meters case wxIMAGE_RESOLUTION_CM: // convert resolution in centimeters to resolution in meters @@ -265,9 +271,11 @@ bool wxBMPHandler::SaveDib(wxImage *image, } } - wxPalette *palette = NULL; // entries for quantized images - wxUint8 *rgbquad = NULL; // for the RGBQUAD bytes for the colormap - wxImage *q_image = NULL; // destination for quantized image +#if wxUSE_PALETTE + wxScopedPtr palette; // entries for quantized images +#endif // wxUSE_PALETTE + wxScopedArray rgbquad; // for the RGBQUAD bytes for the colormap + wxScopedPtr q_image; // destination for quantized image // if <24bpp use quantization to reduce colors for *some* of the formats if ( (format == wxBMP_1BPP) || (format == wxBMP_4BPP) || @@ -276,24 +284,32 @@ bool wxBMPHandler::SaveDib(wxImage *image, // make a new palette and quantize the image if (format != wxBMP_8BPP_PALETTE) { - q_image = new wxImage(); + q_image.reset(new wxImage()); // I get a delete error using Quantize when desired colors > 236 int quantize = ((palette_size > 236) ? 236 : palette_size); // fill the destination too, it gives much nicer 4bpp images - wxQuantize::Quantize( *image, *q_image, &palette, quantize, 0, +#if wxUSE_PALETTE + wxPalette* paletteTmp; + wxQuantize::Quantize( *image, *q_image, &paletteTmp, quantize, 0, wxQUANTIZE_FILL_DESTINATION_IMAGE ); + palette.reset(paletteTmp); +#else // !wxUSE_PALETTE + wxQuantize::Quantize( *image, *q_image, NULL, quantize, 0, + wxQUANTIZE_FILL_DESTINATION_IMAGE ); +#endif // wxUSE_PALETTE/!wxUSE_PALETTE } else { #if wxUSE_PALETTE - palette = new wxPalette(image->GetPalette()); + palette.reset(new wxPalette(image->GetPalette())); #endif // wxUSE_PALETTE } int i; unsigned char r, g, b; - rgbquad = new wxUint8 [palette_size*4]; + wxScopedArray rgbquadTmp(palette_size*4); + rgbquad.swap(rgbquadTmp); for (i = 0; i < palette_size; i++) { @@ -312,7 +328,8 @@ bool wxBMPHandler::SaveDib(wxImage *image, else if ( (format == wxBMP_8BPP_GREY) || (format == wxBMP_8BPP_RED) || (format == wxBMP_1BPP_BW) ) { - rgbquad = new wxUint8 [palette_size*4]; + wxScopedArray rgbquadTmp(palette_size*4); + rgbquad.swap(rgbquadTmp); for ( int i = 0; i < palette_size; i++ ) { @@ -331,31 +348,28 @@ bool wxBMPHandler::SaveDib(wxImage *image, { if ( !IsMask ) { - if ( !stream.WriteAll(rgbquad, palette_size*4) ) + if ( !stream.WriteAll(rgbquad.get(), palette_size*4) ) { if (verbose) { wxLogError(_("BMP: Couldn't write RGB color map.")); } - delete[] rgbquad; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; return false; } - } - delete []rgbquad; + } } // pointer to the image data, use quantized if available - wxUint8 *data = (wxUint8*) image->GetData(); - if (q_image) if (q_image->IsOk()) data = (wxUint8*) q_image->GetData(); + const unsigned char* const data = q_image && q_image->IsOk() + ? q_image->GetData() + : image->GetData(); + const unsigned char* const alpha = saveAlpha ? image->GetAlpha() : NULL; - wxUint8 *buffer = new wxUint8[row_width]; - memset(buffer, 0, row_width); + wxScopedArray buffer(row_width); + memset(buffer.get(), 0, row_width); int y; unsigned x; long int pixel; + const int dstPixLen = saveAlpha ? 4 : 3; for (y = image->GetHeight() -1; y >= 0; y--) { @@ -365,9 +379,11 @@ bool wxBMPHandler::SaveDib(wxImage *image, { pixel = 3*(y*width + x); - buffer[3*x ] = data[pixel+2]; - buffer[3*x + 1] = data[pixel+1]; - buffer[3*x + 2] = data[pixel]; + buffer[dstPixLen*x ] = data[pixel+2]; + buffer[dstPixLen*x + 1] = data[pixel+1]; + buffer[dstPixLen*x + 2] = data[pixel]; + if ( saveAlpha ) + buffer[dstPixLen*x + 3] = alpha[y*width + x]; } } else if ((format == wxBMP_8BPP) || // 1 byte per pixel in color @@ -466,25 +482,15 @@ bool wxBMPHandler::SaveDib(wxImage *image, } } - if ( !stream.WriteAll(buffer, row_width) ) + if ( !stream.WriteAll(buffer.get(), row_width) ) { if (verbose) { wxLogError(_("BMP: Couldn't write data.")); } - delete[] buffer; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; return false; } } - delete[] buffer; -#if wxUSE_PALETTE - delete palette; -#endif // wxUSE_PALETTE - delete q_image; return true; } @@ -500,7 +506,8 @@ struct BMPPalette bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, int bpp, int ncolors, int comp, wxFileOffset bmpOffset, wxInputStream& stream, - bool verbose, bool IsBmp, bool hasPalette) + bool verbose, bool IsBmp, bool hasPalette, + int colEntrySize) { wxInt32 aDword, rmask = 0, gmask = 0, bmask = 0, amask = 0; int rshift = 0, gshift = 0, bshift = 0, ashift = 0; @@ -578,14 +585,15 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, // Reading the palette, if it exists: if ( bpp < 16 && ncolors != 0 ) { - unsigned char* r = new unsigned char[ncolors]; - unsigned char* g = new unsigned char[ncolors]; - unsigned char* b = new unsigned char[ncolors]; + wxScopedArray + r(ncolors), + g(ncolors), + b(ncolors); for (int j = 0; j < ncolors; j++) { if (hasPalette) { - if ( !stream.ReadAll(bbuf, 4) ) + if ( !stream.ReadAll(bbuf, colEntrySize) ) return false; cmap[j].b = bbuf[0]; @@ -607,12 +615,8 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, #if wxUSE_PALETTE // Set the palette for the wxImage - image->SetPalette(wxPalette(ncolors, r, g, b)); + image->SetPalette(wxPalette(ncolors, r.get(), g.get(), b.get())); #endif // wxUSE_PALETTE - - delete[] r; - delete[] g; - delete[] b; } else if ( bpp == 16 || bpp == 32 ) { @@ -934,7 +938,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, unsigned char temp; if ( !stream.ReadAll(&aWord, 2) ) return false; - aWord = wxUINT16_SWAP_ON_BE(aWord); + wxUINT16_SWAP_ON_BE_IN_PLACE(aWord); linepos += 2; /* Use the masks and calculated amount of shift to retrieve the color data out of the word. Then @@ -954,7 +958,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, if ( !stream.ReadAll(&aDword, 4) ) return false; - aDword = wxINT32_SWAP_ON_BE(aDword); + wxINT32_SWAP_ON_BE_IN_PLACE(aDword); linepos += 4; temp = (unsigned char)((aDword & rmask) >> rshift); ptr[poffset] = temp; @@ -1001,28 +1005,57 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, wxInt32 dbuf[4]; wxInt8 bbuf[4]; + // offset to bitmap data + wxFileOffset offset; + // DIB header size (used to distinguish different versions of DIB header) + wxInt32 hdrSize; if ( IsBmp ) { // read the header off the .BMP format file if ( !stream.ReadAll(bbuf, 2) || !stream.ReadAll(dbuf, 16) ) return false; + + #if 0 // unused + wxInt32 size = wxINT32_SWAP_ON_BE(dbuf[0]); + #endif + offset = wxINT32_SWAP_ON_BE(dbuf[2]); + hdrSize = wxINT32_SWAP_ON_BE(dbuf[3]); } else { if ( !stream.ReadAll(dbuf, 4) ) return false; + + offset = wxInvalidOffset; // not used in loading ICO/CUR DIBs + hdrSize = wxINT32_SWAP_ON_BE(dbuf[0]); } - #if 0 // unused - wxInt32 size = wxINT32_SWAP_ON_BE(dbuf[0]); - #endif - wxFileOffset offset = wxINT32_SWAP_ON_BE(dbuf[2]); - if ( !stream.ReadAll(dbuf, 4 * 2) ) - return false; + // Bitmap files come in old v1 format using BITMAPCOREHEADER or a newer + // format (typically BITMAPV5HEADER, in use since Windows 98, but we don't + // really support any features specific to later formats such as gamma + // correction or ICC profiles, so it doesn't matter much to us). + const bool usesV1 = hdrSize == 12; - int width = wxINT32_SWAP_ON_BE((int)dbuf[0]); - int height = wxINT32_SWAP_ON_BE((int)dbuf[1]); + int width; + int height; + if ( usesV1 ) + { + wxInt16 buf[2]; + if ( !stream.ReadAll(buf, sizeof(buf)) ) + return false; + + width = wxINT16_SWAP_ON_BE((short)buf[0]); + height = wxINT16_SWAP_ON_BE((short)buf[1]); + } + else // We have at least BITMAPINFOHEADER + { + if ( !stream.ReadAll(dbuf, 4 * 2) ) + return false; + + width = wxINT32_SWAP_ON_BE((int)dbuf[0]); + height = wxINT32_SWAP_ON_BE((int)dbuf[1]); + } if ( !IsBmp)height = height / 2; // for icons divide by 2 if ( width > 32767 ) @@ -1062,24 +1095,67 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, return false; } - if ( !stream.ReadAll(dbuf, 4 * 4) ) - return false; - - int comp = wxINT32_SWAP_ON_BE((int)dbuf[0]); - if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && - comp != BI_BITFIELDS ) + class Resolution { - if (verbose) + public: + Resolution() { - wxLogError( _("DIB Header: Unknown encoding in file.") ); + m_valid = false; + + // Still initialize them as some compilers are smart enough to + // give "use of possibly uninitialized variable" for them (but not + // smart enough to see that this is not really the case). + m_x = + m_y = 0; } - return false; + + void Init(int x, int y) + { + m_x = x; + m_y = y; + m_valid = true; + } + + bool IsValid() const { return m_valid; } + + int GetX() const { return m_x; } + int GetY() const { return m_y; } + + private: + int m_x, m_y; + bool m_valid; + } res; + int comp; + int ncolors; + + if ( usesV1 ) + { + // The only possible format is BI_RGB and colours count is not used. + comp = BI_RGB; + ncolors = 0; } + else // We have at least BITMAPINFOHEADER + { + if ( !stream.ReadAll(dbuf, 4 * 4) ) + return false; - if ( !stream.ReadAll(dbuf, 4 * 2) ) - return false; + comp = wxINT32_SWAP_ON_BE((int)dbuf[0]); + if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && + comp != BI_BITFIELDS ) + { + if (verbose) + { + wxLogError( _("DIB Header: Unknown encoding in file.") ); + } + return false; + } - int ncolors = wxINT32_SWAP_ON_BE( (int)dbuf[0] ); + if ( !stream.ReadAll(dbuf, 4 * 2) ) + return false; + + ncolors = wxINT32_SWAP_ON_BE( (int)dbuf[0] ); + res.Init(dbuf[2]/100, dbuf[3]/100); + } if (ncolors == 0) ncolors = 1 << bpp; /* some more sanity checks */ @@ -1096,7 +1172,8 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, //read DIB; this is the BMP image or the XOR part of an icon image if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream, - verbose, IsBmp, true) ) + verbose, IsBmp, true, + usesV1 ? 3 : 4) ) { if (verbose) { @@ -1124,9 +1201,12 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, } // the resolution in the bitmap header is in meters, convert to centimeters - image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, wxIMAGE_RESOLUTION_CM); - image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, dbuf[2]/100); - image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, dbuf[3]/100); + if ( res.IsValid() ) + { + image->SetOption(wxIMAGE_OPTION_RESOLUTIONUNIT, wxIMAGE_RESOLUTION_CM); + image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, res.GetX()); + image->SetOption(wxIMAGE_OPTION_RESOLUTIONY, res.GetY()); + } return true; } @@ -1157,7 +1237,7 @@ bool wxBMPHandler::DoCanRead(wxInputStream& stream) // wxICOHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxICOHandler, wxBMPHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxICOHandler, wxBMPHandler); #if wxUSE_STREAMS @@ -1190,8 +1270,8 @@ bool wxICOHandler::SaveFile(wxImage *image, bool verbose) { - //sanity check; icon must be less than 127 pixels high and 255 wide - if ( image->GetHeight () > 127 ) + // sanity check; icon must be no larger than 256x256 + if ( image->GetHeight () > 256 ) { if ( verbose ) { @@ -1199,7 +1279,7 @@ bool wxICOHandler::SaveFile(wxImage *image, } return false; } - if ( image->GetWidth () > 255 ) + if ( image->GetWidth () > 256 ) { if ( verbose ) { @@ -1276,8 +1356,40 @@ bool wxICOHandler::SaveFile(wxImage *image, mask.SetRGB(i, j, 0, 0, 0 ); } // Set the formats for image and mask - // (Windows never saves with more than 8 colors): - image->SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_8BPP); + + // The format depends on the number of the colours used, so count them, + // but stop at 257 because we have to use 24 bpp anyhow if we have that + // many of them. + const int colours = image->CountColours(257); + int bppFormat; + int bpp; + if ( image->HasAlpha() ) + { + // Icons with alpha channel are always stored in ARGB format. + bppFormat = wxBMP_24BPP; + bpp = 32; + } + else if ( colours > 256 ) + { + bppFormat = wxBMP_24BPP; + bpp = 24; + } + else if ( colours > 16 ) + { + bppFormat = wxBMP_8BPP; + bpp = 8; + } + else if ( colours > 2 ) + { + bppFormat = wxBMP_4BPP; + bpp = 4; + } + else + { + bppFormat = wxBMP_1BPP; + bpp = 1; + } + image->SetOption(wxIMAGE_OPTION_BMP_FORMAT, bppFormat); // monochome bitmap: mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW); @@ -1286,25 +1398,48 @@ bool wxICOHandler::SaveFile(wxImage *image, //calculate size and offset of image and mask wxCountingOutputStream cStream; - bool bResult = SaveDib(image, cStream, verbose, IsBmp, IsMask); - if ( !bResult ) + bool bResult; +#if wxUSE_LIBPNG + // Typically, icons larger then 128x128 are saved as PNG images. + bool saveAsPNG = false; + if ( image->GetHeight() > 128 || image->GetWidth() > 128 ) { - if ( verbose ) + wxPNGHandler handlerPNG; + bResult = handlerPNG.SaveFile(image, cStream, verbose); + if ( !bResult ) { - wxLogError(_("ICO: Error writing the image file!")); + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; } - return false; - } - IsMask = true; - bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask); - if ( !bResult ) + saveAsPNG = true; + } + if ( !saveAsPNG ) +#endif // wxUSE_LIBPNG { - if ( verbose ) + bResult = SaveDib(image, cStream, verbose, IsBmp, IsMask); + if ( !bResult ) { - wxLogError(_("ICO: Error writing the image file!")); + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; + } + IsMask = true; + + bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask); + if ( !bResult ) + { + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; } - return false; } wxUint32 Size = cStream.GetSize(); @@ -1323,12 +1458,15 @@ bool wxICOHandler::SaveFile(wxImage *image, offset = offset + sizeof(ICONDIRENTRY); + // Notice that the casts work correctly for width/height of 256 as it's + // represented by 0 in ICO file format -- and larger values are not + // allowed at all. icondirentry.bWidth = (wxUint8)image->GetWidth(); - icondirentry.bHeight = (wxUint8)(2 * image->GetHeight()); + icondirentry.bHeight = (wxUint8)image->GetHeight(); icondirentry.bColorCount = 0; icondirentry.bReserved = 0; icondirentry.wPlanes = wxUINT16_SWAP_ON_BE(1); - icondirentry.wBitCount = wxUINT16_SWAP_ON_BE(wxBMP_8BPP); + icondirentry.wBitCount = wxUINT16_SWAP_ON_BE(bpp); if ( type == 2 /*CUR*/) { int hx = image->HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) ? @@ -1366,26 +1504,44 @@ bool wxICOHandler::SaveFile(wxImage *image, } // actually save it: - IsMask = false; - bResult = SaveDib(image, stream, verbose, IsBmp, IsMask); - if ( !bResult ) +#if wxUSE_LIBPNG + if ( saveAsPNG ) { - if ( verbose ) + wxPNGHandler handlerPNG; + bResult = handlerPNG.SaveFile(image, stream, verbose); + if ( !bResult ) { - wxLogError(_("ICO: Error writing the image file!")); + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; } - return false; } - IsMask = true; - - bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask); - if ( !bResult ) + else +#endif // wxUSE_LIBPNG { - if ( verbose ) + IsMask = false; + bResult = SaveDib(image, stream, verbose, IsBmp, IsMask); + if ( !bResult ) { - wxLogError(_("ICO: Error writing the image file!")); + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; + } + IsMask = true; + + bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask); + if ( !bResult ) + { + if ( verbose ) + { + wxLogError(_("ICO: Error writing the image file!")); + } + return false; } - return false; } } // end of for loop @@ -1405,10 +1561,9 @@ bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, } bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, - bool WXUNUSED(verbose), int index) + bool verbose, int index) { bool bResult wxDUMMY_INITIALIZE(false); - bool IsBmp = false; ICONDIR IconDir; @@ -1421,8 +1576,8 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, wxUint16 nType = wxUINT16_SWAP_ON_BE(IconDir.idType); // loop round the icons and choose the best one: - ICONDIRENTRY *pIconDirEntry = new ICONDIRENTRY[nIcons]; - ICONDIRENTRY *pCurrentEntry = pIconDirEntry; + wxScopedArray pIconDirEntry(nIcons); + ICONDIRENTRY *pCurrentEntry = pIconDirEntry.get(); int wMax = 0; int colmax = 0; int iSel = wxNOT_FOUND; @@ -1437,8 +1592,13 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, alreadySeeked += stream.LastRead(); + // ICO file format uses only a single byte for width and if it is 0, it + // means that the width is actually 256 pixels. + const wxUint16 + widthReal = pCurrentEntry->bWidth ? pCurrentEntry->bWidth : 256; + // bHeight and bColorCount are wxUint8 - if ( pCurrentEntry->bWidth >= wMax ) + if ( widthReal >= wMax ) { // see if we have more colors, ==0 indicates > 8bpp: if ( pCurrentEntry->bColorCount == 0 ) @@ -1446,7 +1606,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, if ( pCurrentEntry->bColorCount >= colmax ) { iSel = i; - wMax = pCurrentEntry->bWidth; + wMax = widthReal; colmax = pCurrentEntry->bColorCount; } } @@ -1469,7 +1629,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, else { // seek to selected icon: - pCurrentEntry = pIconDirEntry + iSel; + pCurrentEntry = pIconDirEntry.get() + iSel; // NOTE: seeking a positive amount in wxFromCurrent mode allows us to // load even non-seekable streams (see wxInputStream::SeekI docs)! @@ -1477,7 +1637,52 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, if (offset != 0 && stream.SeekI(offset, wxFromCurrent) == wxInvalidOffset) return false; - bResult = LoadDib(image, stream, true, IsBmp); +#if wxUSE_LIBPNG + // We can't fall back to loading an icon in the usual BMP format after + // trying to load it as PNG if we have an unseekable stream, so to + // avoid breaking the existing code which does successfully load icons + // from such streams, we only try to load them as PNGs if we can unwind + // back later. + // + // Ideal would be to modify LoadDib() to accept the first 8 bytes not + // coming from the stream but from the signature buffer below, as then + // we'd be able to load PNG icons from any kind of streams. + bool isPNG; + if ( stream.IsSeekable() ) + { + // Check for the PNG signature first to avoid wasting time on + // trying to load typical ICO files which are not PNGs at all. + static const unsigned char signaturePNG[] = + { + 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A + }; + static const int signatureLen = WXSIZEOF(signaturePNG); + + unsigned char signature[signatureLen]; + if ( !stream.ReadAll(signature, signatureLen) ) + return false; + + isPNG = memcmp(signature, signaturePNG, signatureLen) == 0; + + // Rewind to the beginning of the image in any case. + if ( stream.SeekI(-signatureLen, wxFromCurrent) == wxInvalidOffset ) + return false; + } + else // Not seekable stream + { + isPNG = false; + } + + if ( isPNG ) + { + wxPNGHandler handlerPNG; + bResult = handlerPNG.LoadFile(image, stream, verbose); + } + else +#endif // wxUSE_LIBPNG + { + bResult = LoadDib(image, stream, verbose, false /* not BMP */); + } bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI); if ( bResult && bIsCursorType && nType == 2 ) { @@ -1487,8 +1692,6 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, } } - delete [] pIconDirEntry; - return bResult; } @@ -1522,7 +1725,7 @@ bool wxICOHandler::DoCanRead(wxInputStream& stream) // wxCURHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCURHandler, wxICOHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxCURHandler, wxICOHandler); #if wxUSE_STREAMS @@ -1537,7 +1740,7 @@ bool wxCURHandler::DoCanRead(wxInputStream& stream) // wxANIHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler); #if wxUSE_STREAMS diff --git a/Externals/wxWidgets3/src/common/image.cpp b/Externals/wxWidgets3/src/common/image.cpp index 40b0ab0325..f28abb2e66 100644 --- a/Externals/wxWidgets3/src/common/image.cpp +++ b/Externals/wxWidgets3/src/common/image.cpp @@ -87,6 +87,10 @@ public: // same as m_static but for m_alpha bool m_staticAlpha; + // global and per-object flags determining LoadFile() behaviour + int m_loadFlags; + static int sm_defaultLoadFlags; + #if wxUSE_PALETTE wxPalette m_palette; #endif // wxUSE_PALETTE @@ -97,6 +101,9 @@ public: wxDECLARE_NO_COPY_CLASS(wxImageRefData); }; +// For compatibility, if nothing else, loading is verbose by default. +int wxImageRefData::sm_defaultLoadFlags = wxImage::Load_Verbose; + wxImageRefData::wxImageRefData() { m_width = 0; @@ -113,6 +120,8 @@ wxImageRefData::wxImageRefData() m_ok = false; m_static = m_staticAlpha = false; + + m_loadFlags = sm_defaultLoadFlags; } wxImageRefData::~wxImageRefData() @@ -130,7 +139,7 @@ wxImageRefData::~wxImageRefData() #define M_IMGDATA static_cast(m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxImage, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxImage, wxObject); bool wxImage::Create(const char* const* xpmData) { @@ -769,9 +778,9 @@ wxImage wxImage::ResampleBilinear(int width, int height) const // result lines - dst_data[0] = static_cast(r1 * dy1 + r2 * dy); - dst_data[1] = static_cast(g1 * dy1 + g2 * dy); - dst_data[2] = static_cast(b1 * dy1 + b2 * dy); + dst_data[0] = static_cast(r1 * dy1 + r2 * dy + .5); + dst_data[1] = static_cast(g1 * dy1 + g2 * dy + .5); + dst_data[2] = static_cast(b1 * dy1 + b2 * dy + .5); dst_data += 3; if ( src_alpha ) @@ -2040,6 +2049,8 @@ void wxImage::ClearAlpha() { wxCHECK_RET( HasAlpha(), wxT("image already doesn't have an alpha channel") ); + AllocExclusive(); + if ( !M_IMGDATA->m_staticAlpha ) free( M_IMGDATA->m_alpha ); @@ -2339,6 +2350,30 @@ bool wxImage::HasOption(const wxString& name) const // image I/O // ---------------------------------------------------------------------------- +/* static */ +void wxImage::SetDefaultLoadFlags(int flags) +{ + wxImageRefData::sm_defaultLoadFlags = flags; +} + +/* static */ +int wxImage::GetDefaultLoadFlags() +{ + return wxImageRefData::sm_defaultLoadFlags; +} + +void wxImage::SetLoadFlags(int flags) +{ + AllocExclusive(); + + M_IMGDATA->m_loadFlags = flags; +} + +int wxImage::GetLoadFlags() const +{ + return M_IMGDATA ? M_IMGDATA->m_loadFlags : wxImageRefData::sm_defaultLoadFlags; +} + // Under Windows we can load wxImage not only from files but also from // resources. #if defined(__WINDOWS__) && wxUSE_WXDIB && wxUSE_IMAGE @@ -2375,15 +2410,17 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type) } else { - ICONINFO info; - if ( !::GetIconInfo(hIcon, &info) ) - { - wxLogLastError(wxT("GetIconInfo")); + AutoIconInfo info; + if ( !info.GetFrom(hIcon) ) return wxImage(); - } hBitmap.Init(info.hbmColor); hMask.Init(info.hbmMask); + + // Reset the fields to prevent them from being destroyed, we took + // ownership of them. + info.hbmColor = + info.hbmMask = 0; } } else if ( type == wxBITMAP_TYPE_CUR_RESOURCE ) @@ -2625,7 +2662,8 @@ bool wxImage::DoLoad(wxImageHandler& handler, wxInputStream& stream, int index) if ( stream.IsSeekable() ) posOld = stream.TellI(); - if ( !handler.LoadFile(this, stream, true/*verbose*/, index) ) + if ( !handler.LoadFile(this, stream, + (M_IMGDATA->m_loadFlags & Load_Verbose) != 0, index) ) { if ( posOld != wxInvalidOffset ) stream.SeekI(posOld); @@ -3105,7 +3143,7 @@ void wxImage::RotateHue(double angle) // wxImageHandler //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxImageHandler,wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxImageHandler, wxObject); #if wxUSE_STREAMS int wxImageHandler::GetImageCount( wxInputStream& stream ) @@ -3214,8 +3252,8 @@ wxImageHistogram::FindFirstUnusedColour(unsigned char *r, unsigned char *g, unsigned char *b, unsigned char r2, - unsigned char b2, - unsigned char g2) const + unsigned char g2, + unsigned char b2) const { unsigned long key = MakeKey(r2, g2, b2); @@ -3257,8 +3295,8 @@ wxImage::FindFirstUnusedColour(unsigned char *r, unsigned char *g, unsigned char *b, unsigned char r2, - unsigned char b2, - unsigned char g2) const + unsigned char g2, + unsigned char b2) const { wxImageHistogram histogram; @@ -3646,14 +3684,14 @@ wxImage wxImage::Rotate(double angle, class wxImageModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxImageModule) + wxDECLARE_DYNAMIC_CLASS(wxImageModule); public: wxImageModule() {} - bool OnInit() { wxImage::InitStandardHandlers(); return true; } - void OnExit() { wxImage::CleanUpHandlers(); } + bool OnInit() wxOVERRIDE { wxImage::InitStandardHandlers(); return true; } + void OnExit() wxOVERRIDE { wxImage::CleanUpHandlers(); } }; -IMPLEMENT_DYNAMIC_CLASS(wxImageModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxImageModule, wxModule); #endif // wxUSE_IMAGE diff --git a/Externals/wxWidgets3/src/common/imaggif.cpp b/Externals/wxWidgets3/src/common/imaggif.cpp index 9c0f8bea3a..c75775fb15 100644 --- a/Externals/wxWidgets3/src/common/imaggif.cpp +++ b/Externals/wxWidgets3/src/common/imaggif.cpp @@ -26,6 +26,7 @@ #include "wx/gifdecod.h" #include "wx/stream.h" #include "wx/anidecod.h" // wxImageArray +#include "wx/scopedarray.h" #define GIF89_HDR "GIF89a" #define NETSCAPE_LOOP "NETSCAPE2.0" @@ -68,7 +69,7 @@ struct GifHashTableType wxUint32 HTable[HT_SIZE]; }; -IMPLEMENT_DYNAMIC_CLASS(wxGIFHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxGIFHandler,wxImageHandler); //---------------------------------------------------------------------------- // Forward declarations @@ -116,53 +117,31 @@ static bool wxGIFHandler_BufferedOutput(wxOutputStream *, wxUint8 *buf, int c); bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index) { - wxGIFDecoder *decod; - wxGIFErrorCode error; - bool ok = true; - -// image->Destroy(); - decod = new wxGIFDecoder(); - error = decod->LoadGIF(stream); - - if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED)) + wxGIFDecoder decod; + switch ( decod.LoadGIF(stream) ) { - if (verbose) - { - switch (error) - { - case wxGIF_INVFORMAT: - wxLogError(_("GIF: error in GIF image format.")); - break; - case wxGIF_MEMERR: - wxLogError(_("GIF: not enough memory.")); - break; - default: - wxLogError(_("GIF: unknown error!!!")); - break; - } - } - delete decod; - return false; + case wxGIF_OK: + break; + + case wxGIF_INVFORMAT: + if ( verbose ) + wxLogError(_("GIF: error in GIF image format.")); + return false; + + case wxGIF_MEMERR: + if ( verbose ) + wxLogError(_("GIF: not enough memory.")); + return false; + + case wxGIF_TRUNCATED: + if ( verbose ) + wxLogError(_("GIF: data stream seems to be truncated.")); + + // go on; image data is OK + break; } - if ((error == wxGIF_TRUNCATED) && verbose) - { - wxLogError(_("GIF: data stream seems to be truncated.")); - // go on; image data is OK - } - - if (ok) - { - ok = decod->ConvertToImage(index != -1 ? (size_t)index : 0, image); - } - else - { - wxLogError(_("GIF: Invalid gif index.")); - } - - delete decod; - - return ok; + return decod.ConvertToImage(index != -1 ? (size_t)index : 0, image); } bool wxGIFHandler::SaveFile(wxImage *image, @@ -218,6 +197,8 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream, int width = image.GetWidth(); int height = image.GetHeight(); + wxCHECK_MSG( width && height, false, wxS("can't save 0-sized file") ); + int width_even = width + ((width % 2) ? 1 : 0); if (first) @@ -265,7 +246,7 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream, } const wxUint8 *src = image.GetData(); - wxUint8 *eightBitData = new wxUint8[width]; + wxScopedArray eightBitData(width); SetupCompress(stream, 8); @@ -285,15 +266,13 @@ bool wxGIFHandler::DoSaveFile(const wxImage& image, wxOutputStream *stream, src+=3; } - ok = CompressLine(stream, eightBitData, width); + ok = CompressLine(stream, eightBitData.get(), width); if (!ok) { break; } } - delete [] eightBitData; - wxDELETE(m_hashTable); return ok; @@ -721,13 +700,14 @@ bool wxGIFHandler_WriteControl(wxOutputStream *stream, int maskIndex, int delayMilliSecs) { wxUint8 buf[8]; + const wxUint16 delay = delayMilliSecs / 10; buf[0] = GIF_MARKER_EXT; // extension marker buf[1] = GIF_MARKER_EXT_GRAPHICS_CONTROL; buf[2] = 4; // length of block buf[3] = (maskIndex != wxNOT_FOUND) ? 1 : 0; // has transparency - buf[4] = delayMilliSecs / 10; // delay time - buf[5] = 0; + buf[4] = delay & 0xff; // delay time + buf[5] = (delay >> 8) & 0xff; // delay time second byte buf[6] = (maskIndex != wxNOT_FOUND) ? (wxUint8) maskIndex : 0; buf[7] = 0; return wxGIFHandler_Write(stream, buf, sizeof(buf)); diff --git a/Externals/wxWidgets3/src/common/imagiff.cpp b/Externals/wxWidgets3/src/common/imagiff.cpp index 196fe89938..0b5558d5bd 100644 --- a/Externals/wxWidgets3/src/common/imagiff.cpp +++ b/Externals/wxWidgets3/src/common/imagiff.cpp @@ -241,7 +241,6 @@ bool wxIFFDecoder::CanRead() // Permission for use in wxWidgets has been gratefully given. typedef unsigned char byte; -#define IFFDEBUG 0 /************************************************************************* void decomprle(source, destination, source length, buffer size) @@ -719,7 +718,7 @@ int wxIFFDecoder::ReadIFF() // wxIFFHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxIFFHandler, wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxIFFHandler, wxImageHandler); #if wxUSE_STREAMS diff --git a/Externals/wxWidgets3/src/common/imagjpeg.cpp b/Externals/wxWidgets3/src/common/imagjpeg.cpp index 3fe43f7821..e215a7a76a 100644 --- a/Externals/wxWidgets3/src/common/imagjpeg.cpp +++ b/Externals/wxWidgets3/src/common/imagjpeg.cpp @@ -79,7 +79,7 @@ typedef boolean wxjpeg_boolean; // wxJPEGHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxJPEGHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxJPEGHandler,wxImageHandler); #if wxUSE_STREAMS @@ -148,11 +148,26 @@ CPP_METHODDEF(void) wx_term_source ( j_decompress_ptr cinfo ) // JPEG error manager: +#ifdef __VISUALC__ + // We don't care about the size of this struct, but we still get an + // annoying warning C4324 here: + // + // 'wx_error_mgr' : structure was padded due to __declspec(align()) + // + // and suppressing it seems to be the only way to avoid it. + #pragma warning(push) + #pragma warning(disable: 4324) +#endif + struct wx_error_mgr : public jpeg_error_mgr { jmp_buf setjmp_buffer; /* for return to caller */ }; +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + /* * Here's the routine that will replace the standard error_exit method: */ @@ -206,9 +221,9 @@ void wx_jpeg_io_src( j_decompress_ptr cinfo, wxInputStream& infile ) static inline void wx_cmyk_to_rgb(unsigned char* rgb, const unsigned char* cmyk) { - register int k = 255 - cmyk[3]; - register int k2 = cmyk[3]; - register int c; + int k = 255 - cmyk[3]; + int k2 = cmyk[3]; + int c; c = k + k2 * (255 - cmyk[0]) / 255; rgb[0] = (unsigned char)((c > 255) ? 0 : (255 - c)); diff --git a/Externals/wxWidgets3/src/common/imagpcx.cpp b/Externals/wxWidgets3/src/common/imagpcx.cpp index 2d4d18c1b2..15bb97daf4 100644 --- a/Externals/wxWidgets3/src/common/imagpcx.cpp +++ b/Externals/wxWidgets3/src/common/imagpcx.cpp @@ -33,7 +33,7 @@ // wxPCXHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxPCXHandler,wxImageHandler); #if wxUSE_STREAMS diff --git a/Externals/wxWidgets3/src/common/imagpng.cpp b/Externals/wxWidgets3/src/common/imagpng.cpp index 5a27ca92f7..11b63b58fa 100644 --- a/Externals/wxWidgets3/src/common/imagpng.cpp +++ b/Externals/wxWidgets3/src/common/imagpng.cpp @@ -38,40 +38,13 @@ // For memcpy #include -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// image cannot have any transparent pixels at all, have only 100% opaque -// and/or 100% transparent pixels in which case a simple mask is enough to -// store this information in wxImage or have a real alpha channel in which case -// we need to have it in wxImage as well -enum Transparency -{ - Transparency_None, - Transparency_Mask, - Transparency_Alpha -}; - // ---------------------------------------------------------------------------- // local functions // ---------------------------------------------------------------------------- -// return the kind of transparency needed for this image assuming that it does -// have transparent pixels, i.e. either Transparency_Alpha or Transparency_Mask -static Transparency -CheckTransparency(unsigned char **lines, - png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h, - size_t numColBytes); - // init the alpha channel for the image and fill it with 1s up to (x, y) static unsigned char *InitAlpha(wxImage *image, png_uint_32 x, png_uint_32 y); -// find a free colour for the mask in the PNG data array -static void -FindMaskColour(unsigned char **lines, png_uint_32 width, png_uint_32 height, - unsigned char& rMask, unsigned char& gMask, unsigned char& bMask); - // is the pixel with this value of alpha a fully opaque one? static inline bool IsOpaque(unsigned char a) @@ -79,32 +52,17 @@ bool IsOpaque(unsigned char a) return a == 0xff; } -// is the pixel with this value of alpha a fully transparent one? -static inline -bool IsTransparent(unsigned char a) -{ - return !a; -} - // ============================================================================ // wxPNGHandler implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler); #if wxUSE_STREAMS #ifndef PNGLINKAGEMODE #ifdef PNGAPI #define PNGLINKAGEMODE PNGAPI - #elif defined(__WATCOMC__) - // we need an explicit cdecl for Watcom, at least according to - // - // http://sf.net/tracker/index.php?func=detail&aid=651492&group_id=9863&atid=109863 - // - // more testing is needed for this however, please remove this comment - // if you can confirm that my fix works with Watcom 11 - #define PNGLINKAGEMODE cdecl #else #define PNGLINKAGEMODE LINKAGEMODE #endif @@ -187,52 +145,6 @@ PNGLINKAGEMODE wx_PNG_error(png_structp png_ptr, png_const_charp message) // LoadFile() helpers // ---------------------------------------------------------------------------- -// determine the kind of transparency we need for this image: if the only alpha -// values it has are 0 (transparent) and 0xff (opaque) then we can simply -// create a mask for it, we should be ok with a simple mask but otherwise we -// need a full blown alpha channel in wxImage -// -// parameters: -// lines raw PNG data -// x, y starting position -// w, h size of the image -// numColBytes number of colour bytes (1 for grey scale, 3 for RGB) -// (NB: alpha always follows the colour bytes) -Transparency -CheckTransparency(unsigned char **lines, - png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h, - size_t numColBytes) -{ - // suppose that a mask will suffice and check all the remaining alpha - // values to see if it does - for ( ; y < h; y++ ) - { - // each pixel is numColBytes+1 bytes, offset into the current line by - // the current x position - unsigned const char *ptr = lines[y] + (x * (numColBytes + 1)); - - for ( png_uint_32 x2 = x; x2 < w; x2++ ) - { - // skip the grey or colour byte(s) - ptr += numColBytes; - - unsigned char a2 = *ptr++; - - if ( !IsTransparent(a2) && !IsOpaque(a2) ) - { - // not fully opaque nor fully transparent, hence need alpha - return Transparency_Alpha; - } - } - - // during the next loop iteration check all the pixels in the row - x = 0; - } - - // mask will be enough - return Transparency_Mask; -} - unsigned char *InitAlpha(wxImage *image, png_uint_32 x, png_uint_32 y) { // create alpha channel @@ -251,49 +163,6 @@ unsigned char *InitAlpha(wxImage *image, png_uint_32 x, png_uint_32 y) return alpha; } -void -FindMaskColour(unsigned char **lines, png_uint_32 width, png_uint_32 height, - unsigned char& rMask, unsigned char& gMask, unsigned char& bMask) -{ - // choosing the colour for the mask is more - // difficult: we need to iterate over the entire - // image for this in order to choose an unused - // colour (this is not very efficient but what else - // can we do?) - wxImageHistogram h; - unsigned nentries = 0; - unsigned char r2, g2, b2; - for ( png_uint_32 y2 = 0; y2 < height; y2++ ) - { - const unsigned char *p = lines[y2]; - for ( png_uint_32 x2 = 0; x2 < width; x2++ ) - { - r2 = *p++; - g2 = *p++; - b2 = *p++; - ++p; // jump over alpha - - wxImageHistogramEntry& - entry = h[wxImageHistogram:: MakeKey(r2, g2, b2)]; - - if ( entry.value++ == 0 ) - entry.index = nentries++; - } - } - - if ( !h.FindFirstUnusedColour(&rMask, &gMask, &bMask) ) - { - wxLogWarning(_("Too many colours in PNG, the image may be slightly blurred.")); - - // use a fixed mask colour and we'll fudge - // the real pixels with this colour (see - // below) - rMask = 0xfe; - gMask = 0; - bMask = 0xff; - } -} - // ---------------------------------------------------------------------------- // reading PNGs // ---------------------------------------------------------------------------- @@ -316,17 +185,9 @@ void CopyDataFromPNG(wxImage *image, png_uint_32 height, int color_type) { - Transparency transparency = Transparency_None; - - // only non NULL if transparency == Transparency_Alpha + // allocated on demand if we have any non-opaque pixels unsigned char *alpha = NULL; - // RGB of the mask colour if transparency == Transparency_Mask - // (but init them anyhow to avoid compiler warnings) - unsigned char rMask = 0, - gMask = 0, - bMask = 0; - unsigned char *ptrDst = image->GetData(); if ( !(color_type & PNG_COLOR_MASK_COLOR) ) { @@ -340,66 +201,16 @@ void CopyDataFromPNG(wxImage *image, unsigned char a = *ptrSrc++; // the first time we encounter a transparent pixel we must - // decide about what to do about them - if ( !IsOpaque(a) && transparency == Transparency_None ) - { - // we'll need at least the mask for this image and - // maybe even full alpha channel info: the former is - // only enough if we have alpha values of 0 and 0xff - // only, otherwisewe need the latter - transparency = CheckTransparency - ( - lines, - x, y, - width, height, - 1 - ); + // allocate alpha channel for the image + if ( !IsOpaque(a) && !alpha ) + alpha = InitAlpha(image, x, y); - if ( transparency == Transparency_Mask ) - { - // let's choose this colour for the mask: this is - // not a problem here as all the other pixels are - // grey, i.e. R == G == B which is not the case for - // this one so no confusion is possible - rMask = 0xff; - gMask = 0; - bMask = 0xff; - } - else // transparency == Transparency_Alpha - { - alpha = InitAlpha(image, x, y); - } - } + if ( alpha ) + *alpha++ = a; - switch ( transparency ) - { - case Transparency_Mask: - if ( IsTransparent(a) ) - { - *ptrDst++ = rMask; - *ptrDst++ = gMask; - *ptrDst++ = bMask; - break; - } - // else: !transparent - - // must be opaque then as otherwise we shouldn't be - // using the mask at all - wxASSERT_MSG( IsOpaque(a), wxT("logic error") ); - - // fall through - - case Transparency_Alpha: - if ( alpha ) - *alpha++ = a; - // fall through - - case Transparency_None: - *ptrDst++ = g; - *ptrDst++ = g; - *ptrDst++ = g; - break; - } + *ptrDst++ = g; + *ptrDst++ = g; + *ptrDst++ = g; } } } @@ -415,78 +226,19 @@ void CopyDataFromPNG(wxImage *image, unsigned char b = *ptrSrc++; unsigned char a = *ptrSrc++; - // the logic here is the same as for the grey case except - // where noted - if ( !IsOpaque(a) && transparency == Transparency_None ) - { - transparency = CheckTransparency - ( - lines, - x, y, - width, height, - 3 - ); + // the logic here is the same as for the grey case + if ( !IsOpaque(a) && !alpha ) + alpha = InitAlpha(image, x, y); - if ( transparency == Transparency_Mask ) - { - FindMaskColour(lines, width, height, - rMask, gMask, bMask); - } - else // transparency == Transparency_Alpha - { - alpha = InitAlpha(image, x, y); - } + if ( alpha ) + *alpha++ = a; - } - - switch ( transparency ) - { - case Transparency_Mask: - if ( IsTransparent(a) ) - { - *ptrDst++ = rMask; - *ptrDst++ = gMask; - *ptrDst++ = bMask; - break; - } - else // !transparent - { - // must be opaque then as otherwise we shouldn't be - // using the mask at all - wxASSERT_MSG( IsOpaque(a), wxT("logic error") ); - - // if we couldn't find a unique colour for the - // mask, we can have real pixels with the same - // value as the mask and it's better to slightly - // change their colour than to make them - // transparent - if ( r == rMask && g == gMask && b == bMask ) - { - r++; - } - } - - // fall through - - case Transparency_Alpha: - if ( alpha ) - *alpha++ = a; - // fall through - - case Transparency_None: - *ptrDst++ = r; - *ptrDst++ = g; - *ptrDst++ = b; - break; - } + *ptrDst++ = r; + *ptrDst++ = g; + *ptrDst++ = b; } } } - - if ( transparency == Transparency_Mask ) - { - image->SetMaskColour(rMask, gMask, bMask); - } } // temporarily disable the warning C4611 (interaction between '_setjmp' and @@ -612,7 +364,7 @@ wxPNGHandler::LoadFile(wxImage *image, { default: wxLogWarning(_("Unknown PNG resolution unit %d"), unitType); - // fall through + wxFALLTHROUGH; case PNG_RESOLUTION_UNKNOWN: image->SetOption(wxIMAGE_OPTION_RESOLUTIONX, resX); @@ -1004,7 +756,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos { default: wxFAIL_MSG( wxT("unknown wxPNG_TYPE_XXX") ); - // fall through + wxFALLTHROUGH; case wxPNG_TYPE_COLOUR: *pData++ = clr.red; diff --git a/Externals/wxWidgets3/src/common/imagpnm.cpp b/Externals/wxWidgets3/src/common/imagpnm.cpp index d853912087..b244dc2aaf 100644 --- a/Externals/wxWidgets3/src/common/imagpnm.cpp +++ b/Externals/wxWidgets3/src/common/imagpnm.cpp @@ -28,7 +28,7 @@ // wxBMPHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxPNMHandler,wxImageHandler); #if wxUSE_STREAMS diff --git a/Externals/wxWidgets3/src/common/imagtga.cpp b/Externals/wxWidgets3/src/common/imagtga.cpp index ec0362192e..dc14db549d 100644 --- a/Externals/wxWidgets3/src/common/imagtga.cpp +++ b/Externals/wxWidgets3/src/common/imagtga.cpp @@ -73,7 +73,7 @@ enum // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxTGAHandler, wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTGAHandler, wxImageHandler); #if wxUSE_STREAMS @@ -105,12 +105,12 @@ static int DecodeRLE(unsigned char* imageData, unsigned long imageSize, short pixelSize, wxInputStream& stream) { - unsigned long index = 0; + unsigned long outputLength = 0; unsigned char current; unsigned int length; unsigned char buf[4]; - while (index < imageSize) + while (outputLength < imageSize) { int ch = stream.GetC(); if ( ch == wxEOF ) @@ -128,9 +128,9 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize, length = current; - index += current * pixelSize; + outputLength += current * pixelSize; - if (index >= imageSize) + if (outputLength > imageSize) { return wxTGA_IOERR; } @@ -153,9 +153,9 @@ int DecodeRLE(unsigned char* imageData, unsigned long imageSize, length = current * pixelSize; - index += length; + outputLength += length; - if (index >= imageSize) + if (outputLength > imageSize) { return wxTGA_IOERR; } diff --git a/Externals/wxWidgets3/src/common/imagtiff.cpp b/Externals/wxWidgets3/src/common/imagtiff.cpp index 628c645084..ed8cb22fd4 100644 --- a/Externals/wxWidgets3/src/common/imagtiff.cpp +++ b/Externals/wxWidgets3/src/common/imagtiff.cpp @@ -37,9 +37,6 @@ extern "C" { -#ifdef __DMC__ - #include "tif_config.h" -#endif #include "tiff.h" #include "tiffio.h" } @@ -98,7 +95,7 @@ TIFFwxErrorHandler(const char* module, const char *fmt, va_list ap) // wxTIFFHandler //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler); wxTIFFHandler::wxTIFFHandler() { @@ -531,7 +528,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos default: wxLogWarning(_("Unknown TIFF resolution unit %d ignored"), tiffRes); - // fall through + wxFALLTHROUGH; case RESUNIT_NONE: resUnit = wxIMAGE_RESOLUTION_NONE; @@ -628,7 +625,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo { default: wxFAIL_MSG( wxT("unknown image resolution units") ); - // fall through + wxFALLTHROUGH; case wxIMAGE_RESOLUTION_NONE: tiffRes = RESUNIT_NONE; diff --git a/Externals/wxWidgets3/src/common/imagxpm.cpp b/Externals/wxWidgets3/src/common/imagxpm.cpp index d8b5bb2c69..7379c6064d 100644 --- a/Externals/wxWidgets3/src/common/imagxpm.cpp +++ b/Externals/wxWidgets3/src/common/imagxpm.cpp @@ -81,7 +81,7 @@ license is as follows: #include "wx/xpmdecod.h" #include "wx/filename.h" -IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler); //----------------------------------------------------------------------------- // wxXPMHandler diff --git a/Externals/wxWidgets3/src/common/init.cpp b/Externals/wxWidgets3/src/common/init.cpp index e00daeb701..7e47e6007b 100644 --- a/Externals/wxWidgets3/src/common/init.cpp +++ b/Externals/wxWidgets3/src/common/init.cpp @@ -68,7 +68,7 @@ class wxDummyConsoleApp : public wxAppConsole public: wxDummyConsoleApp() { } - virtual int OnRun() { wxFAIL_MSG( wxT("unreachable code") ); return 0; } + virtual int OnRun() wxOVERRIDE { wxFAIL_MSG( wxT("unreachable code") ); return 0; } virtual bool DoYield(bool, long) { return true; } wxDECLARE_NO_COPY_CLASS(wxDummyConsoleApp); @@ -137,8 +137,8 @@ static struct InitData nInitCount = 0; #if wxUSE_UNICODE - argc = 0; - // argv = NULL; -- not even really needed + argc = argcOrig = 0; + // argv = argvOrig = NULL; -- not even really needed #endif // wxUSE_UNICODE } @@ -157,6 +157,12 @@ static struct InitData // for example), we remember the converted argv here because we'll have to // free it when doing cleanup to avoid memory leaks wchar_t **argv; + + // we also need to keep two copies, one passed to other functions, and one + // unmodified original; somebody may modify the former, so we need to have + // the latter to be able to free everything correctly + int argcOrig; + wchar_t **argvOrig; #endif // wxUSE_UNICODE wxDECLARE_NO_COPY_CLASS(InitData); @@ -174,7 +180,9 @@ static struct InitData static void ConvertArgsToUnicode(int argc, char **argv) { + gs_initData.argvOrig = new wchar_t *[argc + 1]; gs_initData.argv = new wchar_t *[argc + 1]; + int wargc = 0; for ( int i = 0; i < argc; i++ ) { @@ -190,25 +198,28 @@ static void ConvertArgsToUnicode(int argc, char **argv) } else // converted ok { - gs_initData.argv[wargc++] = wxStrdup(buf); + gs_initData.argvOrig[wargc] = gs_initData.argv[wargc] = wxStrdup(buf); + wargc++; } } - gs_initData.argc = wargc; - gs_initData.argv[wargc] = NULL; + gs_initData.argcOrig = gs_initData.argc = wargc; + gs_initData.argvOrig[wargc] =gs_initData.argv[wargc] = NULL; } static void FreeConvertedArgs() { - if ( gs_initData.argv ) + if ( gs_initData.argvOrig ) { - for ( int i = 0; i < gs_initData.argc; i++ ) + for ( int i = 0; i < gs_initData.argcOrig; i++ ) { - free(gs_initData.argv[i]); + free(gs_initData.argvOrig[i]); + // gs_initData.argv[i] normally points to the same data } + wxDELETEA(gs_initData.argvOrig); wxDELETEA(gs_initData.argv); - gs_initData.argc = 0; + gs_initData.argcOrig = gs_initData.argc = 0; } } @@ -297,8 +308,8 @@ bool wxEntryStart(int& argc, wxChar **argv) wxAppPtr app(wxTheApp); if ( !app.get() ) { - // if not, he might have used IMPLEMENT_APP() to give us a function to - // create it + // if not, he might have used wxIMPLEMENT_APP() to give us a + // function to create it wxAppInitializerFunction fnCreate = wxApp::GetInitializerFunction(); if ( fnCreate ) @@ -310,8 +321,8 @@ bool wxEntryStart(int& argc, wxChar **argv) if ( !app.get() ) { - // either IMPLEMENT_APP() was not used at all or it failed -- in any - // case we still need something + // either wxIMPLEMENT_APP() was not used at all or it failed -- in + // any case we still need something app.Set(new wxDummyConsoleApp); } @@ -472,9 +483,6 @@ int wxEntryReal(int& argc, wxChar **argv) wxTRY { -#if 0 // defined(__WXOSX__) && wxOSX_USE_COCOA_OR_IPHONE - // everything done in OnRun using native callbacks -#else // app initialization if ( !wxTheApp->CallOnInit() ) { @@ -490,7 +498,7 @@ int wxEntryReal(int& argc, wxChar **argv) } callOnExit; WX_SUPPRESS_UNUSED_WARN(callOnExit); -#endif + // app execution return wxTheApp->OnRun(); } @@ -515,10 +523,11 @@ int wxEntry(int& argc, char **argv) bool wxInitialize() { - return wxInitialize(0, (wxChar**)NULL); + int argc = 0; + return wxInitialize(argc, (wxChar**)NULL); } -bool wxInitialize(int argc, wxChar **argv) +bool wxInitialize(int& argc, wxChar **argv) { wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); @@ -532,7 +541,7 @@ bool wxInitialize(int argc, wxChar **argv) } #if wxUSE_UNICODE -bool wxInitialize(int argc, char **argv) +bool wxInitialize(int& argc, char **argv) { wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit); diff --git a/Externals/wxWidgets3/src/common/intl.cpp b/Externals/wxWidgets3/src/common/intl.cpp index f8b011a917..17501e421f 100644 --- a/Externals/wxWidgets3/src/common/intl.cpp +++ b/Externals/wxWidgets3/src/common/intl.cpp @@ -24,12 +24,6 @@ #pragma hdrstop #endif -#ifdef __EMX__ -// The following define is needed by Innotek's libc to -// make the definition of struct localeconv available. -#define __INTERNAL_DEFS -#endif - #if wxUSE_INTL #ifndef WX_PRECOMP @@ -43,9 +37,7 @@ #include "wx/module.h" #endif // WX_PRECOMP -#ifndef __WXWINCE__ - #include -#endif +#include // standard headers #include @@ -55,6 +47,7 @@ #endif #ifdef __WIN32__ + #include "wx/dynlib.h" #include "wx/msw/private.h" #endif @@ -183,7 +176,7 @@ wxString wxLanguageInfo::GetLocaleName() const // ---------------------------------------------------------------------------- #include "wx/arrimpl.cpp" -WX_DECLARE_EXPORTED_OBJARRAY(wxLanguageInfo, wxLanguageInfoArray); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxLanguageInfo, wxLanguageInfoArray, WXDLLIMPEXP_BASE); WX_DEFINE_OBJARRAY(wxLanguageInfoArray) wxLanguageInfoArray *wxLocale::ms_languagesDB = NULL; @@ -387,9 +380,7 @@ bool wxLocale::Init(int language, int flags) wxString locale; // Set the locale: -#if defined(__OS2__) - const char *retloc = wxSetlocale(LC_ALL , wxEmptyString); -#elif defined(__UNIX__) && !defined(__WXMAC__) +#if defined(__UNIX__) && !defined(__WXMAC__) if (language != wxLANGUAGE_DEFAULT) locale = info->CanonicalName; @@ -473,14 +464,22 @@ bool wxLocale::Init(int language, int flags) } else // language supported by Windows { - // Windows CE doesn't have SetThreadLocale() and there doesn't seem - // to be any equivalent -#ifndef __WXWINCE__ const wxUint32 lcid = info->GetLCID(); // change locale used by Windows functions ::SetThreadLocale(lcid); -#endif + + // SetThreadUILanguage() is available on XP, but with unclear + // behavior, so avoid calling it there. + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + { + wxLoadedDLL dllKernel32(wxS("kernel32.dll")); + typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID); + SetThreadUILanguage_t pfnSetThreadUILanguage = NULL; + wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32); + if (pfnSetThreadUILanguage) + pfnSetThreadUILanguage(LANGIDFROMLCID(lcid)); + } // and also call setlocale() to change locale used by the CRT locale = info->GetLocaleName(); @@ -541,6 +540,11 @@ bool wxLocale::Init(int language, int flags) { wxLogWarning(_("Cannot set locale to language \"%s\"."), name.c_str()); + // As we failed to change locale, there is no need to restore the + // previous one: it's still valid. + free(const_cast(m_pszOldLocale)); + m_pszOldLocale = NULL; + // continue nevertheless and try to load at least the translations for // this language } @@ -787,7 +791,7 @@ wxString wxLocale::GetSystemEncodingName() { wxString encname; -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) // FIXME: what is the error return value for GetACP()? UINT codepage = ::GetACP(); encname.Printf(wxS("windows-%u"), codepage); @@ -844,7 +848,7 @@ wxString wxLocale::GetSystemEncodingName() /* static */ wxFontEncoding wxLocale::GetSystemEncoding() { -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) UINT codepage = ::GetACP(); // wxWidgets only knows about CP1250-1257, 874, 932, 936, 949, 950 @@ -1035,8 +1039,11 @@ wxLocale::~wxLocale() // restore old locale pointer wxSetLocale(m_pOldLocale); - wxSetlocale(LC_ALL, m_pszOldLocale); - free(const_cast(m_pszOldLocale)); + if ( m_pszOldLocale ) + { + wxSetlocale(LC_ALL, m_pszOldLocale); + free(const_cast(m_pszOldLocale)); + } } @@ -1143,6 +1150,22 @@ wxString wxLocale::GetHeaderValue(const wxString& header, namespace { +bool IsAtTwoSingleQuotes(const wxString& fmt, wxString::const_iterator p) +{ + if ( p != fmt.end() && *p == '\'') + { + ++p; + if ( p != fmt.end() && *p == '\'') + { + return true; + } + } + + return false; +} + +} // anonymous namespace + // This function translates from Unicode date formats described at // // http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns @@ -1150,7 +1173,10 @@ namespace // to strftime()-like syntax. This translation is not lossless but we try to do // our best. -static wxString TranslateFromUnicodeFormat(const wxString& fmt) +// The function is only exported because it is used in the unit test, it is not +// part of the public API. +WXDLLIMPEXP_BASE +wxString wxTranslateFromUnicodeFormat(const wxString& fmt) { wxString fmtWX; fmtWX.reserve(fmt.length()); @@ -1251,6 +1277,8 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) fmtWX += "%A"; break; case 5: // EEEEE + case 6: // EEEEEE + // no "narrow form" in strftime(), use abbrev. fmtWX += "%a"; break; @@ -1276,6 +1304,11 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) fmtWX += "%B"; break; + case 5: + // no "narrow form" in strftime(), use abbrev. + fmtWX += "%b"; + break; + default: wxFAIL_MSG( "too many 'M's" ); } @@ -1386,20 +1419,63 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) if ( p == fmt.end() ) break; - // not a special character so must be just a separator, treat as is - if ( *p == wxT('%') ) + /* + Handle single quotes: + "Two single quotes represents [sic] a literal single quote, either + inside or outside single quotes. Text within single quotes is not + interpreted in any way (except for two adjacent single quotes)." + */ + + if ( IsAtTwoSingleQuotes(fmt, p) ) { - // this one needs to be escaped - fmtWX += wxT('%'); + fmtWX += '\''; + ++p; // the 2nd single quote is skipped by the for loop's increment + continue; } - fmtWX += *p; + bool isEndQuote = false; + if ( *p == '\'' ) + { + ++p; + while ( p != fmt.end() ) + { + if ( IsAtTwoSingleQuotes(fmt, p) ) + { + fmtWX += '\''; + p += 2; + continue; + } + + if ( *p == '\'' ) + { + isEndQuote = true; + break; + } + + fmtWX += *p; + ++p; + } + } + + if ( p == fmt.end() ) + break; + + if ( !isEndQuote ) + { + // not a special character so must be just a separator, treat as is + if ( *p == wxT('%') ) + { + // this one needs to be escaped + fmtWX += wxT('%'); + } + + fmtWX += *p; + } } return fmtWX; } -} // anonymous namespace #endif // __WINDOWS__ || __WXOSX__ @@ -1428,6 +1504,88 @@ LCTYPE GetLCTYPEFormatFromLocalInfo(wxLocaleInfo index) return 0; } +wxString +GetInfoFromLCID(LCID lcid, + wxLocaleInfo index, + wxLocaleCategory cat = wxLOCALE_CAT_DEFAULT) +{ + wxString str; + + wxChar buf[256]; + buf[0] = wxT('\0'); + + switch ( index ) + { + case wxLOCALE_THOUSANDS_SEP: + if ( ::GetLocaleInfo(lcid, LOCALE_STHOUSAND, buf, WXSIZEOF(buf)) ) + str = buf; + break; + + case wxLOCALE_DECIMAL_POINT: + if ( ::GetLocaleInfo(lcid, + cat == wxLOCALE_CAT_MONEY + ? LOCALE_SMONDECIMALSEP + : 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: + case wxLOCALE_LONG_DATE_FMT: + case wxLOCALE_TIME_FMT: + if ( ::GetLocaleInfo(lcid, GetLCTYPEFormatFromLocalInfo(index), + buf, WXSIZEOF(buf)) ) + { + return wxTranslateFromUnicodeFormat(buf); + } + break; + + case wxLOCALE_DATE_TIME_FMT: + // there doesn't seem to be any specific setting for this, so just + // combine date and time ones + // + // we use the short date because this is what "%c" uses by default + // ("%#c" uses long date but we have no way to specify the + // alternate representation here) + { + const wxString + datefmt = GetInfoFromLCID(lcid, wxLOCALE_SHORT_DATE_FMT); + if ( datefmt.empty() ) + break; + + const wxString + timefmt = GetInfoFromLCID(lcid, wxLOCALE_TIME_FMT); + if ( timefmt.empty() ) + break; + + str << datefmt << ' ' << timefmt; + } + break; + + default: + wxFAIL_MSG( "unknown wxLocaleInfo" ); + } + + return str; +} + } // anonymous namespace /* static */ @@ -1479,81 +1637,13 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) } } - const wxUint32 lcid = info->GetLCID(); + return GetInfoFromLCID(info->GetLCID(), index, cat); +} - wxString str; - - wxChar buf[256]; - buf[0] = wxT('\0'); - - switch ( index ) - { - case wxLOCALE_THOUSANDS_SEP: - if ( ::GetLocaleInfo(lcid, LOCALE_STHOUSAND, buf, WXSIZEOF(buf)) ) - str = buf; - break; - - case wxLOCALE_DECIMAL_POINT: - if ( ::GetLocaleInfo(lcid, - cat == wxLOCALE_CAT_MONEY - ? LOCALE_SMONDECIMALSEP - : 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: - case wxLOCALE_LONG_DATE_FMT: - case wxLOCALE_TIME_FMT: - if ( ::GetLocaleInfo(lcid, GetLCTYPEFormatFromLocalInfo(index), - buf, WXSIZEOF(buf)) ) - { - return TranslateFromUnicodeFormat(buf); - } - break; - - case wxLOCALE_DATE_TIME_FMT: - // there doesn't seem to be any specific setting for this, so just - // combine date and time ones - // - // we use the short date because this is what "%c" uses by default - // ("%#c" uses long date but we have no way to specify the - // alternate representation here) - { - const wxString datefmt = GetInfo(wxLOCALE_SHORT_DATE_FMT); - if ( datefmt.empty() ) - break; - - const wxString timefmt = GetInfo(wxLOCALE_TIME_FMT); - if ( timefmt.empty() ) - break; - - str << datefmt << ' ' << timefmt; - } - break; - - default: - wxFAIL_MSG( "unknown wxLocaleInfo" ); - } - - return str; +/* static */ +wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat) +{ + return GetInfoFromLCID(::GetThreadLocale(), index, cat); } #elif defined(__WXOSX__) @@ -1617,7 +1707,7 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) wxCFRef dateFormatter( CFDateFormatterCreate (NULL, userLocaleRef, dateStyle, timeStyle)); wxCFStringRef cfs = wxCFRetain( CFDateFormatterGetFormat(dateFormatter )); - wxString format = TranslateFromUnicodeFormat(cfs.AsString()); + wxString format = wxTranslateFromUnicodeFormat(cfs.AsString()); // we always want full years format.Replace("%y","%Y"); return format; @@ -1721,6 +1811,8 @@ wxString GetDateFormatFromLangInfo(wxLocaleInfo index) /* static */ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) { +// TODO: as of 2014 Android doesn't has complete locale support (use java api) +#if !(defined(__WXQT__) && defined(__ANDROID__)) lconv * const lc = localeconv(); if ( !lc ) return wxString(); @@ -1762,12 +1854,22 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) default: wxFAIL_MSG( "unknown wxLocaleInfo value" ); } - +#endif return wxString(); } #endif // platform +#ifndef __WINDOWS__ + +/* static */ +wxString wxLocale::GetOSInfo(wxLocaleInfo index, wxLocaleCategory cat) +{ + return GetInfo(index, cat); +} + +#endif // !__WINDOWS__ + // ---------------------------------------------------------------------------- // global functions and variables // ---------------------------------------------------------------------------- @@ -1798,21 +1900,21 @@ wxLocale *wxSetLocale(wxLocale *pLocale) class wxLocaleModule: public wxModule { - DECLARE_DYNAMIC_CLASS(wxLocaleModule) + wxDECLARE_DYNAMIC_CLASS(wxLocaleModule); public: wxLocaleModule() {} - bool OnInit() + bool OnInit() wxOVERRIDE { return true; } - void OnExit() + void OnExit() wxOVERRIDE { wxLocale::DestroyLanguagesDB(); } }; -IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule); #endif // wxUSE_INTL diff --git a/Externals/wxWidgets3/src/common/languageinfo.cpp b/Externals/wxWidgets3/src/common/languageinfo.cpp index 87685c5eb5..9929b0f656 100644 --- a/Externals/wxWidgets3/src/common/languageinfo.cpp +++ b/Externals/wxWidgets3/src/common/languageinfo.cpp @@ -40,7 +40,7 @@ // This table is generated by misc/languages/genlang.py // When making changes, please put them into misc/languages/langtabl.txt -#if !defined(__WIN32__) || defined(__WXMICROWIN__) +#if !defined(__WIN32__) #define SETWINLANG(info,lang,sublang) @@ -118,6 +118,9 @@ #ifndef LANG_FRENCH #define LANG_FRENCH (0) #endif +#ifndef LANG_FRISIAN +#define LANG_FRISIAN (0) +#endif #ifndef LANG_GEORGIAN #define LANG_GEORGIAN (0) #endif @@ -151,6 +154,9 @@ #ifndef LANG_JAPANESE #define LANG_JAPANESE (0) #endif +#ifndef LANG_KABYLE +#define LANG_KABYLE (0) +#endif #ifndef LANG_KANNADA #define LANG_KANNADA (0) #endif @@ -592,7 +598,6 @@ void wxLocale::InitLanguagesDB() LNG(wxLANGUAGE_BRETON, "br" , 0 , 0 , wxLayout_LeftToRight, "Breton") LNG(wxLANGUAGE_BULGARIAN, "bg_BG", LANG_BULGARIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Bulgarian") LNG(wxLANGUAGE_BURMESE, "my" , 0 , 0 , wxLayout_LeftToRight, "Burmese") - LNG(wxLANGUAGE_CAMBODIAN, "km" , 0 , 0 , wxLayout_LeftToRight, "Cambodian") LNG(wxLANGUAGE_CATALAN, "ca_ES", LANG_CATALAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Catalan") LNG(wxLANGUAGE_CHINESE, "zh_TW", LANG_CHINESE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Chinese") LNG(wxLANGUAGE_CHINESE_SIMPLIFIED, "zh_CN", LANG_CHINESE , SUBLANG_CHINESE_SIMPLIFIED , wxLayout_LeftToRight, "Chinese (Simplified)") @@ -635,7 +640,7 @@ void wxLocale::InitLanguagesDB() LNG(wxLANGUAGE_FRENCH_LUXEMBOURG, "fr_LU", LANG_FRENCH , SUBLANG_FRENCH_LUXEMBOURG , wxLayout_LeftToRight, "French (Luxembourg)") LNG(wxLANGUAGE_FRENCH_MONACO, "fr_MC", LANG_FRENCH , SUBLANG_FRENCH_MONACO , wxLayout_LeftToRight, "French (Monaco)") LNG(wxLANGUAGE_FRENCH_SWISS, "fr_CH", LANG_FRENCH , SUBLANG_FRENCH_SWISS , wxLayout_LeftToRight, "French (Swiss)") - LNG(wxLANGUAGE_FRISIAN, "fy" , 0 , 0 , wxLayout_LeftToRight, "Frisian") + LNG(wxLANGUAGE_FRISIAN, "fy" , LANG_FRISIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Frisian") LNG(wxLANGUAGE_GALICIAN, "gl_ES", 0 , 0 , wxLayout_LeftToRight, "Galician") LNG(wxLANGUAGE_GEORGIAN, "ka_GE", LANG_GEORGIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Georgian") LNG(wxLANGUAGE_GERMAN, "de_DE", LANG_GERMAN , SUBLANG_GERMAN , wxLayout_LeftToRight, "German") @@ -663,11 +668,13 @@ void wxLocale::InitLanguagesDB() 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, "jv" , 0 , 0 , wxLayout_LeftToRight, "Javanese") + LNG(wxLANGUAGE_KABYLE, "kab" , LANG_KABYLE , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kabyle") 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)") LNG(wxLANGUAGE_KAZAKH, "kk" , LANG_KAZAK , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Kazakh") LNG(wxLANGUAGE_KERNEWEK, "kw_GB", 0 , 0 , wxLayout_LeftToRight, "Kernewek") + LNG(wxLANGUAGE_KHMER, "km" , 0 , 0 , wxLayout_LeftToRight, "Khmer") LNG(wxLANGUAGE_KINYARWANDA, "rw" , 0 , 0 , wxLayout_LeftToRight, "Kinyarwanda") LNG(wxLANGUAGE_KIRGHIZ, "ky" , 0 , 0 , wxLayout_LeftToRight, "Kirghiz") LNG(wxLANGUAGE_KIRUNDI, "rn" , 0 , 0 , wxLayout_LeftToRight, "Kirundi") diff --git a/Externals/wxWidgets3/src/common/layout.cpp b/Externals/wxWidgets3/src/common/layout.cpp index 9d23b46116..1e4f0e01d2 100644 --- a/Externals/wxWidgets3/src/common/layout.cpp +++ b/Externals/wxWidgets3/src/common/layout.cpp @@ -36,8 +36,8 @@ #endif -IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject); inline void wxGetAsIs(wxWindowBase* win, int* w, int* h) diff --git a/Externals/wxWidgets3/src/common/lboxcmn.cpp b/Externals/wxWidgets3/src/common/lboxcmn.cpp index 2afe3f1b7b..80e169ba16 100644 --- a/Externals/wxWidgets3/src/common/lboxcmn.cpp +++ b/Externals/wxWidgets3/src/common/lboxcmn.cpp @@ -31,6 +31,16 @@ #include "wx/dynarray.h" #include "wx/arrstr.h" #include "wx/log.h" + #include "wx/dcclient.h" +#endif + +// the spacing between the lines (in report mode) +static const int LINE_SPACING = 0; + +#ifdef __WXGTK__ +static const int EXTRA_HEIGHT = 6; +#else +static const int EXTRA_HEIGHT = 4; #endif extern WXDLLEXPORT_DATA(const char) wxListBoxNameStr[] = "listBox"; @@ -86,7 +96,7 @@ wxFLAGS_MEMBER(wxLB_NEEDED_SB) wxFLAGS_MEMBER(wxLB_SORT) wxEND_FLAGS( wxListBoxStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl, "wx/listbox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl, "wx/listbox.h"); wxBEGIN_PROPERTIES_TABLE(wxListBox) wxEVENT_PROPERTY( Select, wxEVT_LISTBOX, wxCommandEvent ) @@ -340,4 +350,23 @@ void wxListBoxBase::EnsureVisible(int WXUNUSED(n)) // call SetFirstItem() but this is probably even more stupid) } +wxCoord wxListBoxBase::GetLineHeight() const +{ + wxListBoxBase *self = wxConstCast(this, wxListBoxBase); + + wxClientDC dc( self ); + dc.SetFont( GetFont() ); + + wxCoord y; + dc.GetTextExtent(wxT("H"), NULL, &y); + + y += EXTRA_HEIGHT; + + return y + LINE_SPACING; +} + +int wxListBoxBase::GetCountPerPage() const +{ + return GetClientSize().y / GetLineHeight(); +} #endif // wxUSE_LISTBOX diff --git a/Externals/wxWidgets3/src/common/list.cpp b/Externals/wxWidgets3/src/common/list.cpp index 6eadb1533a..efaf12a195 100644 --- a/Externals/wxWidgets3/src/common/list.cpp +++ b/Externals/wxWidgets3/src/common/list.cpp @@ -511,9 +511,6 @@ void wxListBase::Sort(const wxSortCompareFunction compfunc) // sort the array qsort((void *)objArray,num,sizeof(wxObject *), -#ifdef __WXWINCE__ - (int (__cdecl *)(const void *,const void *)) -#endif compfunc); // put the sorted pointers back into the list @@ -695,15 +692,9 @@ bool wxStringList::Member(const wxChar *s) const return false; } -#ifdef __WXWINCE__ -extern "C" -{ -static int __cdecl -#else extern "C" { static int LINKAGEMODE -#endif wx_comparestrings(const void *arg1, const void *arg2) { diff --git a/Externals/wxWidgets3/src/common/listctrlcmn.cpp b/Externals/wxWidgets3/src/common/listctrlcmn.cpp index e6101be4c3..25f29b8042 100644 --- a/Externals/wxWidgets3/src/common/listctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/listctrlcmn.cpp @@ -52,6 +52,8 @@ wxDEFINE_EVENT( wxEVT_LIST_ITEM_RIGHT_CLICK, wxListEvent ); wxDEFINE_EVENT( wxEVT_LIST_ITEM_MIDDLE_CLICK, wxListEvent ); wxDEFINE_EVENT( wxEVT_LIST_ITEM_ACTIVATED, wxListEvent ); wxDEFINE_EVENT( wxEVT_LIST_ITEM_FOCUSED, wxListEvent ); +wxDEFINE_EVENT( wxEVT_LIST_ITEM_CHECKED, wxListEvent ); +wxDEFINE_EVENT( wxEVT_LIST_ITEM_UNCHECKED, wxListEvent ); wxDEFINE_EVENT( wxEVT_LIST_CACHE_HINT, wxListEvent ); // ----------------------------------------------------------------------------- @@ -103,10 +105,10 @@ wxFLAGS_MEMBER(wxLC_SORT_DESCENDING) wxFLAGS_MEMBER(wxLC_VIRTUAL) wxEND_FLAGS( wxListCtrlStyle ) -#if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__)) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxGenericListCtrl, "wx/listctrl.h") +#if ((!defined(__WXMSW__) && !defined(__WXQT__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__)) +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxGenericListCtrl, "wx/listctrl.h"); #else -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl, "wx/listctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl, "wx/listctrl.h"); #endif wxBEGIN_PROPERTIES_TABLE(wxListCtrl) @@ -127,9 +129,9 @@ wxCONSTRUCTOR_5( wxListCtrl, wxWindow*, Parent, wxWindowID, Id, \ (see NotebookPageInfo) */ -IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl) -IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl); +wxIMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent); // ---------------------------------------------------------------------------- // wxListCtrlBase implementation diff --git a/Externals/wxWidgets3/src/common/log.cpp b/Externals/wxWidgets3/src/common/log.cpp index 3180f46743..94a6aede7b 100644 --- a/Externals/wxWidgets3/src/common/log.cpp +++ b/Externals/wxWidgets3/src/common/log.cpp @@ -46,17 +46,11 @@ #include "wx/vector.h" // other standard headers -#ifndef __WXWINCE__ #include -#endif #include -#ifndef __WXWINCE__ #include -#else -#include "wx/msw/wince/time.h" -#endif #if defined(__WINDOWS__) #include "wx/msw/private.h" // includes windows.h @@ -170,7 +164,7 @@ public: wxLogOutputBest() { } protected: - virtual void DoLogText(const wxString& msg) + virtual void DoLogText(const wxString& msg) wxOVERRIDE { wxMessageOutputBest().Output(msg); } @@ -278,13 +272,13 @@ unsigned wxLog::LogLastRepeatIfNeeded() // 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.", + msg.Printf(wxPLURAL("The previous message repeated %u time.", + "The previous message repeated %u times.", gs_prevLog.numRepeated), gs_prevLog.numRepeated); } #else - msg.Printf(wxS("The previous message was repeated %lu time(s)."), + msg.Printf(wxS("The previous message was repeated %u time(s)."), gs_prevLog.numRepeated); #endif gs_prevLog.numRepeated = 0; @@ -306,12 +300,12 @@ wxLog::~wxLog() #if wxUSE_INTL wxPLURAL ( - "Last repeated message (\"%s\", %lu time) wasn't output", - "Last repeated message (\"%s\", %lu times) wasn't output", + "Last repeated message (\"%s\", %u time) wasn't output", + "Last repeated message (\"%s\", %u times) wasn't output", gs_prevLog.numRepeated ), #else - wxS("Last repeated message (\"%s\", %lu time(s)) wasn't output"), + wxS("Last repeated message (\"%s\", %u time(s)) wasn't output"), #endif gs_prevLog.msg, gs_prevLog.numRepeated @@ -1054,7 +1048,7 @@ static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz) // get error code from syste unsigned long wxSysErrorCode() { -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) return ::GetLastError(); #else //Unix return errno; @@ -1067,7 +1061,7 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) if ( nErrCode == 0 ) nErrCode = wxSysErrorCode(); -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) static wxChar s_szBuf[1024]; // get error message from system @@ -1092,7 +1086,6 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) // copy it to our buffer and free memory // Crashes on SmartPhone (FIXME) -#if !defined(__SMARTPHONE__) /* of WinCE */ if( lpMsgBuf != 0 ) { wxStrlcpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf)); @@ -1109,7 +1102,6 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode) } } else -#endif // !__SMARTPHONE__ { s_szBuf[0] = wxS('\0'); } diff --git a/Externals/wxWidgets3/src/common/longlong.cpp b/Externals/wxWidgets3/src/common/longlong.cpp index e57392b788..ac6d23e229 100644 --- a/Externals/wxWidgets3/src/common/longlong.cpp +++ b/Externals/wxWidgets3/src/common/longlong.cpp @@ -132,22 +132,6 @@ 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/markupparser.cpp b/Externals/wxWidgets3/src/common/markupparser.cpp index 5dbbf840cf..2b26a04c6a 100644 --- a/Externals/wxWidgets3/src/common/markupparser.cpp +++ b/Externals/wxWidgets3/src/common/markupparser.cpp @@ -386,7 +386,7 @@ bool wxMarkupParser::Parse(const wxString& text) if ( n < WXSIZEOF(xmlEntities) ) break; - //else: fall through, '&' is not special + wxFALLTHROUGH;//else: fall through, '&' is not special } default: @@ -442,31 +442,31 @@ wxString wxMarkupParser::Strip(const wxString& text) const wxString& GetText() const { return m_text; } - virtual void OnText(const wxString& text) { m_text += text; } + virtual void OnText(const wxString& text) wxOVERRIDE { m_text += text; } - virtual void OnBoldStart() { } - virtual void OnBoldEnd() { } + virtual void OnBoldStart() wxOVERRIDE { } + virtual void OnBoldEnd() wxOVERRIDE { } - virtual void OnItalicStart() { } - virtual void OnItalicEnd() { } + virtual void OnItalicStart() wxOVERRIDE { } + virtual void OnItalicEnd() wxOVERRIDE { } - virtual void OnUnderlinedStart() { } - virtual void OnUnderlinedEnd() { } + virtual void OnUnderlinedStart() wxOVERRIDE { } + virtual void OnUnderlinedEnd() wxOVERRIDE { } - virtual void OnStrikethroughStart() { } - virtual void OnStrikethroughEnd() { } + virtual void OnStrikethroughStart() wxOVERRIDE { } + virtual void OnStrikethroughEnd() wxOVERRIDE { } - virtual void OnBigStart() { } - virtual void OnBigEnd() { } + virtual void OnBigStart() wxOVERRIDE { } + virtual void OnBigEnd() wxOVERRIDE { } - virtual void OnSmallStart() { } - virtual void OnSmallEnd() { } + virtual void OnSmallStart() wxOVERRIDE { } + virtual void OnSmallEnd() wxOVERRIDE { } - virtual void OnTeletypeStart() { } - virtual void OnTeletypeEnd() { } + virtual void OnTeletypeStart() wxOVERRIDE { } + virtual void OnTeletypeEnd() wxOVERRIDE { } - virtual void OnSpanStart(const wxMarkupSpanAttributes& WXUNUSED(a)) { } - virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(a)) { } + virtual void OnSpanStart(const wxMarkupSpanAttributes& WXUNUSED(a)) wxOVERRIDE { } + virtual void OnSpanEnd(const wxMarkupSpanAttributes& WXUNUSED(a)) wxOVERRIDE { } private: wxString m_text; diff --git a/Externals/wxWidgets3/src/common/mediactrlcmn.cpp b/Externals/wxWidgets3/src/common/mediactrlcmn.cpp index d8f0b2c747..32b488f69a 100644 --- a/Externals/wxWidgets3/src/common/mediactrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/mediactrlcmn.cpp @@ -43,12 +43,12 @@ // RTTI and Event implementations //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -IMPLEMENT_CLASS(wxMediaCtrl, wxControl) +wxIMPLEMENT_CLASS(wxMediaCtrl, wxControl); wxDEFINE_EVENT( wxEVT_MEDIA_STATECHANGED, wxMediaEvent ); wxDEFINE_EVENT( wxEVT_MEDIA_PLAY, wxMediaEvent ); wxDEFINE_EVENT( wxEVT_MEDIA_PAUSE, wxMediaEvent ); -IMPLEMENT_CLASS(wxMediaBackend, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent) +wxIMPLEMENT_CLASS(wxMediaBackend, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent); wxDEFINE_EVENT( wxEVT_MEDIA_FINISHED, wxMediaEvent ); wxDEFINE_EVENT( wxEVT_MEDIA_LOADED, wxMediaEvent ); wxDEFINE_EVENT( wxEVT_MEDIA_STOP, wxMediaEvent ); @@ -462,19 +462,6 @@ void wxMediaCtrl::DoMoveWindow(int x, int y, int w, int h) m_imp->Move(x, y, w, h); } -//--------------------------------------------------------------------------- -// wxMediaCtrl::MacVisibilityChanged -//--------------------------------------------------------------------------- -#ifdef __WXOSX_CARBON__ -void wxMediaCtrl::MacVisibilityChanged() -{ - wxControl::MacVisibilityChanged(); - - if(m_imp) - m_imp->MacVisibilityChanged(); -} -#endif - //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // wxMediaBackendCommonBase diff --git a/Externals/wxWidgets3/src/common/memory.cpp b/Externals/wxWidgets3/src/common/memory.cpp index 6dc5d026d2..f31d76136f 100644 --- a/Externals/wxWidgets3/src/common/memory.cpp +++ b/Externals/wxWidgets3/src/common/memory.cpp @@ -37,7 +37,7 @@ #include "wx/ioswrap.h" -#if !defined(__WATCOMC__) && !(defined(__VMS__) && ( __VMS_VER < 70000000 ) ) +#if !(defined(__VMS__) && ( __VMS_VER < 70000000 ) ) #include #endif @@ -490,7 +490,7 @@ char * wxDebugContext::CallerMemPos (const char * buf) } -char * wxDebugContext::EndMarkerPos (const char * buf, const size_t size) +char * wxDebugContext::EndMarkerPos (const char * buf, size_t size) { return CallerMemPos (buf) + PaddedSize (size); } @@ -517,13 +517,13 @@ char * wxDebugContext::StartPos (const char * caller) // Note: this function is now obsolete (along with CalcAlignment) // because the calculations are done statically, for greater speed. */ -size_t wxDebugContext::GetPadding (const size_t size) +size_t wxDebugContext::GetPadding (size_t size) { size_t pad = size % CalcAlignment (); return (pad) ? sizeof(wxMarkerType) - pad : 0; } -size_t wxDebugContext::PaddedSize (const size_t size) +size_t wxDebugContext::PaddedSize (size_t size) { // Added by Terry Farnham to replace // slow GetPadding call. @@ -541,7 +541,7 @@ size_t wxDebugContext::PaddedSize (const size_t size) in order to satisfy a caller request. This includes space for the struct plus markers and the caller's memory as well. */ -size_t wxDebugContext::TotSize (const size_t reqSize) +size_t wxDebugContext::TotSize (size_t reqSize) { return (PaddedSize (sizeof (wxMemStruct)) + PaddedSize (reqSize) + 2 * sizeof(wxMarkerType)); @@ -932,10 +932,6 @@ void * wxDebugAlloc(size_t size, wxChar * fileName, int lineNum, bool isObject, // If not in debugging allocation mode, do the normal thing // so we don't leave any trace of ourselves in the node list. -#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) -// VA 3.0 still has trouble in here - return (void *)malloc(size); -#endif if (!wxDebugContext::GetDebugMode()) { return (void *)malloc(size); @@ -992,10 +988,6 @@ void wxDebugFree(void * buf, bool WXUNUSED(isVect) ) if (!buf) return; -#if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) -// VA 3.0 still has trouble in here - free((char *)buf); -#endif // If not in debugging allocation mode, do the normal thing // so we don't leave any trace of ourselves in the node list. if (!wxDebugContext::GetDebugMode()) diff --git a/Externals/wxWidgets3/src/common/menucmn.cpp b/Externals/wxWidgets3/src/common/menucmn.cpp index bce29b6c54..2808af69d6 100644 --- a/Externals/wxWidgets3/src/common/menucmn.cpp +++ b/Externals/wxWidgets3/src/common/menucmn.cpp @@ -56,7 +56,7 @@ wxBEGIN_FLAGS( wxMenuStyle ) wxFLAGS_MEMBER(wxMENU_TEAROFF) wxEND_FLAGS( wxMenuStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler, "wx/menu.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler, "wx/menu.h"); wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ; #if wxUSE_EXTENDED_RTTI @@ -108,7 +108,7 @@ wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuBar, wxWindow, "wx/menu.h", \ #if wxUSE_EXTENDED_RTTI WX_DEFINE_LIST( wxMenuInfoHelperList ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfoHelper, wxObject, "wx/menu.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfoHelper, wxObject, "wx/menu.h"); wxBEGIN_PROPERTIES_TABLE(wxMenuInfoHelper) wxREADONLY_PROPERTY( Menu, wxMenu*, GetMenu, wxEMPTY_PARAMETER_VALUE, \ @@ -324,12 +324,10 @@ void wxMenuItemBase::SetHelp(const wxString& str) } } -#ifndef __WXPM__ wxString wxMenuItemBase::GetLabelText(const wxString& text) { return wxStripMenuCodes(text); } -#endif #if WXWIN_COMPATIBILITY_2_8 wxString wxMenuItemBase::GetLabelFromText(const wxString& text) @@ -595,9 +593,6 @@ wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const // wxMenu helpers used by derived classes // ---------------------------------------------------------------------------- -// Update a menu and all submenus recursively. source is the object that has -// the update event handlers defined for it. If NULL, the menu or associated -// window will be used. void wxMenuBase::UpdateUI(wxEvtHandler* source) { wxWindow * const win = GetWindow(); @@ -643,32 +638,49 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source) bool wxMenuBase::SendEvent(int itemid, int checked) { wxCommandEvent event(wxEVT_MENU, itemid); - event.SetEventObject(this); event.SetInt(checked); - wxWindow* const win = GetWindow(); - wxMenuBar* const mb = GetMenuBar(); + return DoProcessEvent(this, event, GetWindow()); +} - // Try the menu's event handler first - wxEvtHandler *handler = GetEventHandler(); - if ( handler ) +/* static */ +bool wxMenuBase::DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win) +{ + event.SetEventObject(menu); + + if ( menu ) { - // Indicate to the event processing code that we're going to pass this - // event to another handler if it's not processed here to prevent it - // from passing the event to wxTheApp: this will be done below if we do - // have the associated window. - if ( win || mb ) - event.SetWillBeProcessedAgain(); + wxMenuBar* const mb = menu->GetMenuBar(); - if ( handler->SafelyProcessEvent(event) ) - return true; + // Try the menu's event handler first + wxEvtHandler *handler = menu->GetEventHandler(); + if ( handler ) + { + // Indicate to the event processing code that we're going to pass + // this event to another handler if it's not processed here to + // prevent it from passing the event to wxTheApp: this will be done + // below if we do have the associated window. + if ( win || mb ) + event.SetWillBeProcessedAgain(); + + if ( handler->SafelyProcessEvent(event) ) + return true; + } + + // If this menu is part of the menu bar, try the event there. this + if ( mb ) + { + if ( mb->HandleWindowEvent(event) ) + return true; + + // If this already propagated it upwards to the window containing + // the menu bar, we don't have to handle it in this window again + // below. + if ( event.ShouldPropagate() ) + return false; + } } - // If this menu is part of the menu bar, process the event there: this will - // also propagate it upwards to the window containing the menu bar. - if ( mb ) - return mb->HandleWindowEvent(event); - // Try the window the menu was popped up from. if ( win ) return win->HandleWindowEvent(event); @@ -677,6 +689,24 @@ bool wxMenuBase::SendEvent(int itemid, int checked) return false; } +/* static */ +bool +wxMenuBase::ProcessMenuEvent(wxMenu* menu, wxMenuEvent& event, wxWindow* win) +{ + // Try to process the event in the usual places first. + if ( DoProcessEvent(menu, event, win) ) + return true; + + // But the menu events should also reach the TLW parent if they were not + // processed before so, as it's not a command event and hence doesn't + // bubble up by default, send it there explicitly if not done yet. + wxWindow* const tlw = wxGetTopLevelParent(win); + if ( tlw != win && tlw->HandleWindowEvent(event) ) + return true; + + return false; +} + // ---------------------------------------------------------------------------- // wxMenu attaching/detaching to/from menu bar // ---------------------------------------------------------------------------- @@ -1062,7 +1092,7 @@ void wxMenuBarBase::UpdateMenus() { menu = GetMenu( n ); if (menu != NULL) - menu->UpdateUI( NULL ); + menu->UpdateUI(); } } diff --git a/Externals/wxWidgets3/src/common/mimecmn.cpp b/Externals/wxWidgets3/src/common/mimecmn.cpp index ceb86221e3..ae86108b92 100644 --- a/Externals/wxWidgets3/src/common/mimecmn.cpp +++ b/Externals/wxWidgets3/src/common/mimecmn.cpp @@ -49,11 +49,6 @@ #include "wx/msw/mimetype.h" #elif ( defined(__DARWIN__) ) #include "wx/osx/mimetype.h" -#elif defined(__WXPM__) || defined (__EMX__) - #include "wx/os2/mimetype.h" - #undef __UNIX__ -#elif defined(__DOS__) - #include "wx/msdos/mimetype.h" #else // Unix #include "wx/unix/mimetype.h" #endif @@ -433,6 +428,13 @@ wxFileType::GetPrintCommand(wxString *printCmd, return m_impl->GetPrintCommand(printCmd, params); } +wxString +wxFileType::GetExpandedCommand(const wxString& verb, + const wxFileType::MessageParameters& params) const +{ + return m_impl->GetExpandedCommand(verb, params); +} + size_t wxFileType::GetAllCommands(wxArrayString *verbs, wxArrayString *commands, @@ -741,8 +743,8 @@ class wxMimeTypeCmnModule: public wxModule public: wxMimeTypeCmnModule() : wxModule() { } - virtual bool OnInit() { return true; } - virtual void OnExit() + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxMimeTypesManagerFactory::Set(NULL); @@ -753,9 +755,9 @@ public: } } - DECLARE_DYNAMIC_CLASS(wxMimeTypeCmnModule) + wxDECLARE_DYNAMIC_CLASS(wxMimeTypeCmnModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxMimeTypeCmnModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxMimeTypeCmnModule, wxModule); #endif // wxUSE_MIMETYPE diff --git a/Externals/wxWidgets3/src/common/mousemanager.cpp b/Externals/wxWidgets3/src/common/mousemanager.cpp index b000c1b468..e6a14b290e 100644 --- a/Externals/wxWidgets3/src/common/mousemanager.cpp +++ b/Externals/wxWidgets3/src/common/mousemanager.cpp @@ -33,12 +33,12 @@ // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxMouseEventsManager, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxMouseEventsManager, wxEvtHandler) EVT_MOUSE_CAPTURE_LOST(wxMouseEventsManager::OnCaptureLost) EVT_LEFT_DOWN(wxMouseEventsManager::OnLeftDown) EVT_LEFT_UP(wxMouseEventsManager::OnLeftUp) EVT_MOTION(wxMouseEventsManager::OnMove) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxMouseEventsManager implementation diff --git a/Externals/wxWidgets3/src/common/msgout.cpp b/Externals/wxWidgets3/src/common/msgout.cpp index bf98eb4898..9003413e57 100644 --- a/Externals/wxWidgets3/src/common/msgout.cpp +++ b/Externals/wxWidgets3/src/common/msgout.cpp @@ -148,13 +148,8 @@ wxString wxMessageOutputStderr::AppendLineFeedIfNeeded(const wxString& str) void wxMessageOutputStderr::Output(const wxString& str) { const wxString strWithLF = AppendLineFeedIfNeeded(str); - const wxWX2MBbuf buf = strWithLF.mb_str(); - - if ( buf ) - fprintf(m_fp, "%s", (const char*) buf); - else // print at least something - fprintf(m_fp, "%s", (const char*) strWithLF.ToAscii()); + fprintf(m_fp, "%s", (const char*) strWithLF.mb_str(wxConvWhateverWorks)); fflush(m_fp); } @@ -164,7 +159,7 @@ void wxMessageOutputStderr::Output(const wxString& str) void wxMessageOutputDebug::Output(const wxString& str) { -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) wxString out(AppendLineFeedIfNeeded(str)); out.Replace(wxT("\t"), wxT(" ")); out.Replace(wxT("\n"), wxT("\r\n")); diff --git a/Externals/wxWidgets3/src/common/mstream.cpp b/Externals/wxWidgets3/src/common/mstream.cpp index 5e5c6495ce..f6332c1fa3 100644 --- a/Externals/wxWidgets3/src/common/mstream.cpp +++ b/Externals/wxWidgets3/src/common/mstream.cpp @@ -41,7 +41,7 @@ // wxMemoryInputStream // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxMemoryInputStream, wxInputStream) +wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryInputStream, wxInputStream); wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len) { @@ -152,7 +152,7 @@ wxFileOffset wxMemoryInputStream::OnSysTell() const // wxMemoryOutputStream // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxOutputStream) +wxIMPLEMENT_DYNAMIC_CLASS(wxMemoryOutputStream, wxOutputStream); wxMemoryOutputStream::wxMemoryOutputStream(void *data, size_t len) { diff --git a/Externals/wxWidgets3/src/common/nbkbase.cpp b/Externals/wxWidgets3/src/common/nbkbase.cpp index 3ee7af5f60..42de7672f3 100644 --- a/Externals/wxWidgets3/src/common/nbkbase.cpp +++ b/Externals/wxWidgets3/src/common/nbkbase.cpp @@ -87,7 +87,7 @@ wxEND_FLAGS( wxNotebookStyle ) WX_DEFINE_LIST( wxNotebookPageInfoList ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject, "wx/notebook.h" ) +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject, "wx/notebook.h"); wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo *, wxNotebookPageInfoList ); @@ -137,7 +137,7 @@ const wxNotebookPageInfoList& wxNotebookBase::GetPageInfos() const #endif -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxBookCtrlBase, "wx/notebook.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxBookCtrlBase, "wx/notebook.h"); wxBEGIN_PROPERTIES_TABLE(wxNotebook) wxEVENT_PROPERTY( PageChanging, wxEVT_NOTEBOOK_PAGE_CHANGING, wxNotebookEvent ) wxEVENT_PROPERTY( PageChanged, wxEVT_NOTEBOOK_PAGE_CHANGED, wxNotebookEvent ) diff --git a/Externals/wxWidgets3/src/common/notifmsgcmn.cpp b/Externals/wxWidgets3/src/common/notifmsgcmn.cpp new file mode 100644 index 0000000000..326c66981a --- /dev/null +++ b/Externals/wxWidgets3/src/common/notifmsgcmn.cpp @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/notifmsgcmn.cpp +// Purpose: wxNotificationMessageBase implementation +// Author: Tobias Taschner +// Created: 2015-08-04 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_NOTIFICATION_MESSAGE + +#include "wx/notifmsg.h" + +#include "wx/private/notifmsg.h" + +#ifndef wxHAS_NATIVE_NOTIFICATION_MESSAGE +#include "wx/generic/private/notifmsg.h" +#endif + +wxDEFINE_EVENT( wxEVT_NOTIFICATION_MESSAGE_CLICK, wxCommandEvent ); +wxDEFINE_EVENT( wxEVT_NOTIFICATION_MESSAGE_DISMISSED, wxCommandEvent ); +wxDEFINE_EVENT( wxEVT_NOTIFICATION_MESSAGE_ACTION, wxCommandEvent ); + +// ---------------------------------------------------------------------------- +// wxNotificationMessageBase +// ---------------------------------------------------------------------------- + +wxNotificationMessageBase::~wxNotificationMessageBase() +{ + m_impl->Detach(); +} + +bool wxNotificationMessageBase::Show(int timeout) +{ + return m_impl->Show(timeout); +} + +bool wxNotificationMessageBase::Close() +{ + return m_impl->Close(); +} + +void wxNotificationMessageBase::SetTitle(const wxString& title) +{ + m_impl->SetTitle(title); +} + +void wxNotificationMessageBase::SetMessage(const wxString& message) +{ + m_impl->SetMessage(message); +} + +void wxNotificationMessageBase::SetParent(wxWindow *parent) +{ + m_impl->SetParent(parent); +} + +void wxNotificationMessageBase::SetFlags(int flags) +{ + wxASSERT_MSG(flags == wxICON_INFORMATION || + flags == wxICON_WARNING || flags == wxICON_ERROR || + flags == 0, + "Invalid icon flags specified"); + + m_impl->SetFlags(flags); +} + +void wxNotificationMessageBase::SetIcon(const wxIcon& icon) +{ + m_impl->SetIcon(icon); +} + +bool wxNotificationMessageBase::AddAction(wxWindowID actionid, const wxString &label) +{ + return m_impl->AddAction(actionid, label); +} + +// +// wxNotificationMessage +// + +#ifndef wxHAS_NATIVE_NOTIFICATION_MESSAGE + +void wxNotificationMessage::Init() +{ + m_impl = new wxGenericNotificationMessageImpl(this); +} + +#endif + +#endif // wxUSE_NOTIFICATION_MESSAGE diff --git a/Externals/wxWidgets3/src/common/numformatter.cpp b/Externals/wxWidgets3/src/common/numformatter.cpp index 12de60e842..2428ef34b5 100644 --- a/Externals/wxWidgets3/src/common/numformatter.cpp +++ b/Externals/wxWidgets3/src/common/numformatter.cpp @@ -223,6 +223,10 @@ wxString wxNumberFormatter::ToString(double val, int precision, int style) void wxNumberFormatter::AddThousandsSeparators(wxString& s) { + // Thousands separators for numbers in scientific format are not relevant. + if ( s.find_first_of("eE") != wxString::npos ) + return; + wxChar thousandsSep; if ( !GetThousandsSeparatorIfUsed(&thousandsSep) ) return; @@ -254,9 +258,14 @@ void wxNumberFormatter::AddThousandsSeparators(wxString& s) void wxNumberFormatter::RemoveTrailingZeroes(wxString& s) { + // If number is in scientific format, trailing zeroes belong to the exponent and cannot be removed. + if ( s.find_first_of("eE") != wxString::npos ) + return; + const size_t posDecSep = s.find(GetDecimalSeparator()); - wxCHECK_RET( posDecSep != wxString::npos, - wxString::Format("No decimal separator in \"%s\"", s) ); + // No decimal point => removing trailing zeroes irrelevant for integer number. + if ( posDecSep == wxString::npos ) + return; wxCHECK_RET( posDecSep, "Can't start with decimal separator" ); // Find the last character to keep. @@ -267,6 +276,9 @@ void wxNumberFormatter::RemoveTrailingZeroes(wxString& s) posLastNonZero--; s.erase(posLastNonZero + 1); + // Remove sign from orphaned zero. + if ( s.compare("-0") == 0 ) + s = "0"; } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/object.cpp b/Externals/wxWidgets3/src/common/object.cpp index b113797473..52ff0adb76 100644 --- a/Externals/wxWidgets3/src/common/object.cpp +++ b/Externals/wxWidgets3/src/common/object.cpp @@ -25,26 +25,17 @@ #include -#if wxUSE_DEBUG_CONTEXT - #if defined(__VISAGECPP__) - #define DEBUG_PRINTF(NAME) { static int raz=0; \ - printf( #NAME " %i\n",raz); fflush(stdout); raz++; } - #else - #define DEBUG_PRINTF(NAME) - #endif -#endif // wxUSE_DEBUG_CONTEXT - // we must disable optimizations for VC.NET because otherwise its too eager // linker discards wxClassInfo objects in release build thus breaking many, // many things -#if defined __VISUALC__ && __VISUALC__ >= 1300 +#if defined __VISUALC__ #pragma optimize("", off) #endif #if wxUSE_EXTENDED_RTTI const wxClassInfo* wxObject::ms_classParents[] = { NULL } ; wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data ) -{ return wxANY_AS(data, wxObject*); } +{ return data.As(); } wxAny wxObjectToVariantConverterwxObject ( wxObject *data ) { return wxAny( dynamic_cast (data) ) ; } @@ -66,7 +57,7 @@ wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), 0, 0, #endif // restore optimizations -#if defined __VISUALC__ && __VISUALC__ >= 1300 +#if defined __VISUALC__ #pragma optimize("", on) #endif @@ -74,7 +65,7 @@ wxClassInfo* wxClassInfo::sm_first = NULL; wxHashTable* wxClassInfo::sm_classTable = NULL; // when using XTI, this method is already implemented inline inside -// DECLARE_DYNAMIC_CLASS but otherwise we intentionally make this function +// wxDECLARE_DYNAMIC_CLASS but otherwise we intentionally make this function // non-inline because this allows us to have a non-inline virtual function in // all wx classes and this solves linking problems for HP-UX native toolchain // and possibly others (we could make dtor non-inline as well but it's more @@ -237,7 +228,7 @@ void wxClassInfo::Register() classTable = sm_classTable; } - // Using IMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you + // Using wxIMPLEMENT_DYNAMIC_CLASS() macro twice (which may happen if you // link any object module twice mistakenly, or link twice against wx shared // library) will break this function because it will enter an infinite loop // and eventually die with "out of memory" - as this is quite hard to @@ -245,7 +236,7 @@ void wxClassInfo::Register() wxASSERT_MSG( classTable->Get(m_className) == NULL, wxString::Format ( - wxT("Class \"%s\" already in RTTI table - have you used IMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"), + wxT("Class \"%s\" already in RTTI table - have you used wxIMPLEMENT_DYNAMIC_CLASS() multiple times or linked some object file twice)?"), m_className ) ); @@ -288,10 +279,6 @@ void wxClassInfo::Unregister() wxObject *wxCreateDynamicObject(const wxString& name) { -#if wxUSE_DEBUG_CONTEXT - DEBUG_PRINTF(wxObject *wxCreateDynamicObject) -#endif - if ( wxClassInfo::sm_classTable ) { wxClassInfo *info = (wxClassInfo *)wxClassInfo::sm_classTable->Get(name); @@ -362,10 +349,6 @@ void wxRefCounter::DecRef() void wxObject::Ref(const wxObject& clone) { -#if wxUSE_DEBUG_CONTEXT - DEBUG_PRINTF(wxObject::Ref) -#endif - // nothing to be done if (m_refData == clone.m_refData) return; diff --git a/Externals/wxWidgets3/src/common/overlaycmn.cpp b/Externals/wxWidgets3/src/common/overlaycmn.cpp index 74b20c8d22..4ea0de9a7a 100644 --- a/Externals/wxWidgets3/src/common/overlaycmn.cpp +++ b/Externals/wxWidgets3/src/common/overlaycmn.cpp @@ -94,10 +94,13 @@ wxDCOverlay::wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width wxDCOverlay::wxDCOverlay(wxOverlay &overlay, wxDC *dc) : m_overlay(overlay) { - int width; - int height; - dc->GetSize(&width,&height); - Init(dc, 0, 0, width, height); + const wxRect device(wxPoint(0, 0), dc->GetSize()); + + Init(dc, + dc->DeviceToLogicalX(device.GetLeft()), + dc->DeviceToLogicalY(device.GetTop()), + dc->DeviceToLogicalX(device.GetRight()), + dc->DeviceToLogicalY(device.GetBottom())); } wxDCOverlay::~wxDCOverlay() diff --git a/Externals/wxWidgets3/src/common/panelcmn.cpp b/Externals/wxWidgets3/src/common/panelcmn.cpp index c12e1950a3..44205a696d 100644 --- a/Externals/wxWidgets3/src/common/panelcmn.cpp +++ b/Externals/wxWidgets3/src/common/panelcmn.cpp @@ -67,7 +67,7 @@ wxBEGIN_FLAGS( wxPanelStyle ) wxFLAGS_MEMBER(wxHSCROLL) wxEND_FLAGS( wxPanelStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow, "wx/panel.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow, "wx/panel.h"); wxBEGIN_PROPERTIES_TABLE(wxPanel) wxPROPERTY_FLAGS( WindowStyle, wxPanelStyle, long, \ @@ -104,11 +104,6 @@ bool wxPanelBase::Create(wxWindow *parent, wxWindowID id, // so that non-solid background renders correctly under GTK+: SetThemeEnabled(true); -#if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__)) - // Required to get solid control backgrounds under WinCE - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); -#endif - return true; } diff --git a/Externals/wxWidgets3/src/common/paper.cpp b/Externals/wxWidgets3/src/common/paper.cpp index 12df669e35..e1f8b20957 100644 --- a/Externals/wxWidgets3/src/common/paper.cpp +++ b/Externals/wxWidgets3/src/common/paper.cpp @@ -39,8 +39,8 @@ #endif // End __WXMSW__ -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) -// IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) +wxIMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject); +// wxIMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList); /* * Paper size database for all platforms @@ -135,7 +135,7 @@ void wxPrintPaperDatabase::CreateDatabase() WXADDPAPER(wxPAPER_FANFOLD_STD_GERMAN, DMPAPER_FANFOLD_STD_GERMAN, wxTRANSLATE("German Std Fanfold, 8 1/2 x 12 in"), 2159, 3048); WXADDPAPER(wxPAPER_FANFOLD_LGL_GERMAN, DMPAPER_FANFOLD_LGL_GERMAN, wxTRANSLATE("German Legal Fanfold, 8 1/2 x 13 in"), 2159, 3302); - WXADDPAPER(wxPAPER_ISO_B4, DMPAPER_ISO_B4, wxTRANSLATE("B4 (ISO) 250 x 353 mm"), 2500, 2530); + WXADDPAPER(wxPAPER_ISO_B4, DMPAPER_ISO_B4, wxTRANSLATE("B4 (ISO) 250 x 353 mm"), 2500, 3530); WXADDPAPER(wxPAPER_JAPANESE_POSTCARD, DMPAPER_JAPANESE_POSTCARD, wxTRANSLATE("Japanese Postcard 100 x 148 mm"), 1000, 1480); WXADDPAPER(wxPAPER_9X11, DMPAPER_9X11, wxTRANSLATE("9 x 11 in"), 2286, 2794); WXADDPAPER(wxPAPER_10X11, DMPAPER_10X11, wxTRANSLATE("10 x 11 in"), 2540, 2794); @@ -350,14 +350,14 @@ wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const class WXDLLEXPORT wxPrintPaperModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxPrintPaperModule) + wxDECLARE_DYNAMIC_CLASS(wxPrintPaperModule); public: wxPrintPaperModule() {} - bool OnInit(); - void OnExit(); + bool OnInit() wxOVERRIDE; + void OnExit() wxOVERRIDE; }; -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxPrintPaperModule, wxModule); /* * Initialization/cleanup module diff --git a/Externals/wxWidgets3/src/common/pickerbase.cpp b/Externals/wxWidgets3/src/common/pickerbase.cpp index b68d7b1c90..a435a0598a 100644 --- a/Externals/wxWidgets3/src/common/pickerbase.cpp +++ b/Externals/wxWidgets3/src/common/pickerbase.cpp @@ -40,7 +40,7 @@ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxPickerBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPickerBase, wxControl); // ---------------------------------------------------------------------------- // wxPickerBase diff --git a/Externals/wxWidgets3/src/common/platinfo.cpp b/Externals/wxWidgets3/src/common/platinfo.cpp index ee943915c6..f9d9b93aef 100644 --- a/Externals/wxWidgets3/src/common/platinfo.cpp +++ b/Externals/wxWidgets3/src/common/platinfo.cpp @@ -66,6 +66,7 @@ static const wxChar* const wxOperatingSystemIdNames[] = wxT("DOS"), wxT("OS/2"), + }; static const wxChar* const wxPortIdNames[] = @@ -80,6 +81,7 @@ static const wxChar* const wxPortIdNames[] = wxT("wxMac"), wxT("wxCocoa"), wxT("wxWinCE"), + wxT("wxQT") }; static const wxChar* const wxArchitectureNames[] = @@ -133,14 +135,18 @@ wxPlatformInfo::wxPlatformInfo(wxPortId pid, int tkMajor, int tkMinor, wxEndianness endian, bool usingUniversal) { + m_initializedForCurrentPlatform = false; + m_tkVersionMajor = tkMajor; m_tkVersionMinor = tkMinor; + m_tkVersionMicro = -1; m_port = pid; m_usingUniversal = usingUniversal; m_os = id; m_osVersionMajor = osMajor; m_osVersionMinor = osMinor; + m_osVersionMicro = -1; m_endian = endian; m_arch = arch; @@ -150,8 +156,10 @@ bool wxPlatformInfo::operator==(const wxPlatformInfo &t) const { return m_tkVersionMajor == t.m_tkVersionMajor && m_tkVersionMinor == t.m_tkVersionMinor && + m_tkVersionMicro == t.m_tkVersionMicro && m_osVersionMajor == t.m_osVersionMajor && m_osVersionMinor == t.m_osVersionMinor && + m_osVersionMicro == t.m_osVersionMicro && m_os == t.m_os && m_osDesc == t.m_osDesc && m_ldi == t.m_ldi && @@ -164,6 +172,8 @@ bool wxPlatformInfo::operator==(const wxPlatformInfo &t) const void wxPlatformInfo::InitForCurrentPlatform() { + m_initializedForCurrentPlatform = true; + // autodetect all informations const wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; if ( !traits ) @@ -173,16 +183,18 @@ void wxPlatformInfo::InitForCurrentPlatform() m_port = wxPORT_UNKNOWN; m_usingUniversal = false; m_tkVersionMajor = - m_tkVersionMinor = 0; + m_tkVersionMinor = + m_tkVersionMicro = 0; } else { - m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor); + m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor, + &m_tkVersionMicro); m_usingUniversal = traits->IsUsingUniversalWidgets(); m_desktopEnv = traits->GetDesktopEnvironment(); } - m_os = wxGetOsVersion(&m_osVersionMajor, &m_osVersionMinor); + m_os = wxGetOsVersion(&m_osVersionMajor, &m_osVersionMinor, &m_osVersionMicro); m_osDesc = wxGetOsDescription(); m_endian = wxIsPlatformLittleEndian() ? wxENDIAN_LITTLE : wxENDIAN_BIG; m_arch = wxIsPlatform64Bit() ? wxARCH_64 : wxARCH_32; @@ -292,6 +304,21 @@ wxString wxPlatformInfo::GetEndiannessName(wxEndianness end) return wxEndiannessNames[end]; } +bool wxPlatformInfo::CheckOSVersion(int major, int minor, int micro) const +{ + // If this instance of wxPlatformInfo has been initialized by InitForCurrentPlatform() + // this check gets forwarded to the wxCheckOsVersion which might do more than a simple + // number check if supported by the platform + if (m_initializedForCurrentPlatform) + return wxCheckOsVersion(major, minor, micro); + else + return DoCheckVersion(GetOSMajorVersion(), + GetOSMinorVersion(), + GetOSMicroVersion(), + major, + minor, + micro); +} // ---------------------------------------------------------------------------- // wxPlatformInfo - string -> enum conversions diff --git a/Externals/wxWidgets3/src/common/popupcmn.cpp b/Externals/wxWidgets3/src/common/popupcmn.cpp index 49ef9c8857..395397c924 100644 --- a/Externals/wxWidgets3/src/common/popupcmn.cpp +++ b/Externals/wxWidgets3/src/common/popupcmn.cpp @@ -54,11 +54,11 @@ #include "wx/x11/private.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) -IMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow); +wxIMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow); #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) - IMPLEMENT_DYNAMIC_CLASS(wxPopupComboWindow, wxPopupTransientWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxPopupComboWindow, wxPopupTransientWindow); #endif // ---------------------------------------------------------------------------- @@ -80,7 +80,7 @@ protected: private: wxPopupTransientWindow *m_popup; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxPopupWindowHandler); }; @@ -96,7 +96,7 @@ protected: private: wxPopupTransientWindow *m_popup; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxPopupFocusHandler); }; @@ -104,21 +104,21 @@ private: // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxPopupWindowHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxPopupWindowHandler, wxEvtHandler) EVT_LEFT_DOWN(wxPopupWindowHandler::OnLeftDown) EVT_MOUSE_CAPTURE_LOST(wxPopupWindowHandler::OnCaptureLost) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) EVT_KILL_FOCUS(wxPopupFocusHandler::OnKillFocus) EVT_CHAR(wxPopupFocusHandler::OnChar) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxPopupTransientWindow, wxPopupWindow) +wxBEGIN_EVENT_TABLE(wxPopupTransientWindow, wxPopupWindow) #if defined(__WXMSW__) || (defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON) EVT_IDLE(wxPopupTransientWindow::OnIdle) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -375,7 +375,7 @@ bool wxPopupTransientWindow::Show( bool show ) GdkDeviceManager* manager = gdk_display_get_device_manager(display); GdkDevice* device = gdk_device_manager_get_client_pointer(manager); gdk_device_grab(device, window, - GDK_OWNERSHIP_NONE, false, mask, NULL, unsigned(GDK_CURRENT_TIME)); + GDK_OWNERSHIP_NONE, true, mask, NULL, unsigned(GDK_CURRENT_TIME)); #else gdk_pointer_grab( window, true, mask, @@ -495,9 +495,9 @@ void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) // wxPopupComboWindow // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxPopupComboWindow, wxPopupTransientWindow) +wxBEGIN_EVENT_TABLE(wxPopupComboWindow, wxPopupTransientWindow) EVT_KEY_DOWN(wxPopupComboWindow::OnKeyDown) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxPopupComboWindow::wxPopupComboWindow(wxComboCtrl *parent) : wxPopupTransientWindow(parent) @@ -608,7 +608,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event) default: // forgot to update the switch after adding a new hit test code? wxFAIL_MSG( wxT("unexpected HitTest() return value") ); - // fall through + wxFALLTHROUGH; case wxHT_WINDOW_CORNER: // don't actually know if this one is good for anything, but let it diff --git a/Externals/wxWidgets3/src/common/powercmn.cpp b/Externals/wxWidgets3/src/common/powercmn.cpp index 40a31aadd7..a546a4d00a 100644 --- a/Externals/wxWidgets3/src/common/powercmn.cpp +++ b/Externals/wxWidgets3/src/common/powercmn.cpp @@ -38,9 +38,25 @@ wxDEFINE_EVENT( wxEVT_POWER_SUSPEND_CANCEL, wxPowerEvent ); wxDEFINE_EVENT( wxEVT_POWER_RESUME, wxPowerEvent ); - IMPLEMENT_DYNAMIC_CLASS(wxPowerEvent, wxEvent) + wxIMPLEMENT_DYNAMIC_CLASS(wxPowerEvent, wxEvent); #endif +// Provide stubs for systems without power resource management functions +#if !defined(__WINDOWS__) && !defined(__APPLE__) + +bool +wxPowerResource::Acquire(wxPowerResourceKind WXUNUSED(kind), + const wxString& WXUNUSED(reason)) +{ + return false; +} + +void wxPowerResource::Release(wxPowerResourceKind WXUNUSED(kind)) +{ +} + +#endif // !(__WINDOWS__ || __APPLE__) + // provide stubs for the systems not implementing these functions #if !defined(__WINDOWS__) diff --git a/Externals/wxWidgets3/src/common/preferencescmn.cpp b/Externals/wxWidgets3/src/common/preferencescmn.cpp index 9649494332..cf9c5153ee 100644 --- a/Externals/wxWidgets3/src/common/preferencescmn.cpp +++ b/Externals/wxWidgets3/src/common/preferencescmn.cpp @@ -33,14 +33,17 @@ wxString wxStockPreferencesPage::GetName() const { + wxString name; switch ( m_kind ) { case Kind_General: - return _("General"); + name = _("General"); + break; case Kind_Advanced: - return _("Advanced"); + name = _("Advanced"); + break; } - return wxString(); // silence compiler warning + return name; } wxPreferencesEditor::wxPreferencesEditor(const wxString& title) diff --git a/Externals/wxWidgets3/src/common/prntbase.cpp b/Externals/wxWidgets3/src/common/prntbase.cpp index ed0d4712f0..2ca6b4726d 100644 --- a/Externals/wxWidgets3/src/common/prntbase.cpp +++ b/Externals/wxWidgets3/src/common/prntbase.cpp @@ -58,9 +58,9 @@ #include "wx/osx/printdlg.h" #include "wx/osx/private/print.h" #include "wx/osx/dcprint.h" -#elif defined(__WXPM__) -#include "wx/os2/dcprint.h" -#include "wx/generic/prntdlgg.h" +#elif defined(__WXQT__) +#include "wx/qt/dcprint.h" +#include "wx/qt/printdlg.h" #else #include "wx/generic/prntdlgg.h" #include "wx/dcps.h" @@ -72,6 +72,11 @@ #endif #endif // __WXMSW__ +// The value traditionally used as the default max page number and meaning +// "infinitely many". It should probably be documented and exposed, but for now +// at least use it here instead of hardcoding the number. +static const int DEFAULT_MAX_PAGES = 32000; + //---------------------------------------------------------------------------- // wxPrintFactory //---------------------------------------------------------------------------- @@ -104,8 +109,8 @@ wxPrinterBase *wxNativePrintFactory::CreatePrinter( wxPrintDialogData *data ) return new wxWindowsPrinter( data ); #elif defined(__WXMAC__) return new wxMacPrinter( data ); -#elif defined(__WXPM__) - return new wxOS2Printer( data ); +#elif defined(__WXQT__) + return new wxQtPrinter( data ); #else return new wxPostScriptPrinter( data ); #endif @@ -118,8 +123,8 @@ wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *previe return new wxWindowsPrintPreview( preview, printout, data ); #elif defined(__WXMAC__) return new wxMacPrintPreview( preview, printout, data ); -#elif defined(__WXPM__) - return new wxOS2PrintPreview( preview, printout, data ); +#elif defined(__WXQT__) + return new wxQtPrintPreview( preview, printout, data ); #else return new wxPostScriptPrintPreview( preview, printout, data ); #endif @@ -132,8 +137,8 @@ wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *previe return new wxWindowsPrintPreview( preview, printout, data ); #elif defined(__WXMAC__) return new wxMacPrintPreview( preview, printout, data ); -#elif defined(__WXPM__) - return new wxOS2PrintPreview( preview, printout, data ); +#elif defined(__WXQT__) + return new wxQtPrintPreview( preview, printout, data ); #else return new wxPostScriptPrintPreview( preview, printout, data ); #endif @@ -146,6 +151,8 @@ wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent, return new wxWindowsPrintDialog( parent, data ); #elif defined(__WXMAC__) return new wxMacPrintDialog( parent, data ); +#elif defined(__WXQT__) + return new wxQtPrintDialog( parent, data ); #else return new wxGenericPrintDialog( parent, data ); #endif @@ -158,6 +165,8 @@ wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent, return new wxWindowsPrintDialog( parent, data ); #elif defined(__WXMAC__) return new wxMacPrintDialog( parent, data ); +#elif defined(__WXQT__) + return new wxQtPrintDialog( parent, data ); #else return new wxGenericPrintDialog( parent, data ); #endif @@ -170,6 +179,8 @@ wxPageSetupDialogBase *wxNativePrintFactory::CreatePageSetupDialog( wxWindow *pa return new wxWindowsPageSetupDialog( parent, data ); #elif defined(__WXMAC__) return new wxMacPageSetupDialog( parent, data ); +#elif defined(__WXQT__) + return new wxQtPageSetupDialog( parent, data ); #else return new wxGenericPageSetupDialog( parent, data ); #endif @@ -202,6 +213,10 @@ wxDialog *wxNativePrintFactory::CreatePrintSetupDialog( wxWindow *parent, wxUnusedVar(parent); wxUnusedVar(data); return NULL; +#elif defined(__WXQT__) + wxUnusedVar(parent); + wxUnusedVar(data); + return NULL; #else // Only here do we need to provide the print setup // dialog ourselves, the other platforms either have @@ -263,6 +278,8 @@ wxPrintNativeDataBase *wxNativePrintFactory::CreatePrintNativeData() return new wxWindowsPrintNativeData; #elif defined(__WXMAC__) return wxOSXCreatePrintData(); +#elif defined(__WXQT__) + return new wxQtPrintNativeData; #else return new wxPostScriptPrintNativeData; #endif @@ -272,7 +289,7 @@ wxPrintNativeDataBase *wxNativePrintFactory::CreatePrintNativeData() // wxPrintNativeDataBase //---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPrintNativeDataBase, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxPrintNativeDataBase, wxObject); wxPrintNativeDataBase::wxPrintNativeDataBase() { @@ -287,20 +304,20 @@ class wxPrintFactoryModule: public wxModule { public: wxPrintFactoryModule() {} - bool OnInit() { return true; } - void OnExit() { wxPrintFactory::SetPrintFactory( NULL ); } + bool OnInit() wxOVERRIDE { return true; } + void OnExit() wxOVERRIDE { wxPrintFactory::SetPrintFactory( NULL ); } private: - DECLARE_DYNAMIC_CLASS(wxPrintFactoryModule) + wxDECLARE_DYNAMIC_CLASS(wxPrintFactoryModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxPrintFactoryModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxPrintFactoryModule, wxModule); //---------------------------------------------------------------------------- // wxPrinterBase //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPrinterBase, wxObject) +wxIMPLEMENT_CLASS(wxPrinterBase, wxObject); wxPrinterBase::wxPrinterBase(wxPrintDialogData *data) { @@ -339,7 +356,7 @@ wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const // wxPrinter //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPrinter, wxPrinterBase) +wxIMPLEMENT_CLASS(wxPrinter, wxPrinterBase); wxPrinter::wxPrinter(wxPrintDialogData *data) { @@ -398,7 +415,7 @@ wxPrintDialogData& wxPrinter::GetPrintDialogData() const // wxPrintDialogBase: the dialog for printing. // --------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase, wxDialog) +wxIMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase, wxDialog); wxPrintDialogBase::wxPrintDialogBase(wxWindow *parent, wxWindowID id, @@ -415,7 +432,7 @@ wxPrintDialogBase::wxPrintDialogBase(wxWindow *parent, // wxPrintDialog: the dialog for printing // --------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPrintDialog, wxObject) +wxIMPLEMENT_CLASS(wxPrintDialog, wxObject); wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintDialogData* data) { @@ -456,7 +473,7 @@ wxDC *wxPrintDialog::GetPrintDC() // wxPageSetupDialogBase: the page setup dialog // --------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPageSetupDialogBase, wxDialog) +wxIMPLEMENT_ABSTRACT_CLASS(wxPageSetupDialogBase, wxDialog); wxPageSetupDialogBase::wxPageSetupDialogBase(wxWindow *parent, wxWindowID id, @@ -473,7 +490,7 @@ wxPageSetupDialogBase::wxPageSetupDialogBase(wxWindow *parent, // wxPageSetupDialog: the page setup dialog // --------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPageSetupDialog, wxObject) +wxIMPLEMENT_CLASS(wxPageSetupDialog, wxObject); wxPageSetupDialog::wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data ) { @@ -505,9 +522,9 @@ wxPageSetupDialogData& wxPageSetupDialog::GetPageSetupData() // wxPrintAbortDialog //---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxPrintAbortDialog::wxPrintAbortDialog(wxWindow *parent, const wxString& documentTitle, @@ -541,7 +558,17 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages, int currentCopy, int totalCopies) { wxString text; - text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + if ( totalPages == DEFAULT_MAX_PAGES ) + { + // This means that the user has not supplied a total number of pages so it + // is better not to show this value. + text.Printf(_("Printing page %d"), currentPage); + } + else + { + // We have a valid total number of pages so we show it. + text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + } if ( totalCopies > 1 ) text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies); m_progress->SetLabel(text); @@ -550,7 +577,6 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages, void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) { wxCHECK_RET( wxPrinterBase::sm_abortWindow != NULL, "OnCancel called twice" ); - wxPrinterBase::sm_abortIt = true; wxPrinterBase::sm_abortWindow->Destroy(); wxPrinterBase::sm_abortWindow = NULL; @@ -560,7 +586,7 @@ void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) // wxPrintout //---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject); wxPrintout::wxPrintout(const wxString& title) { @@ -607,7 +633,7 @@ bool wxPrintout::HasPage(int page) void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage) { *minPage = 1; - *maxPage = 32000; + *maxPage = DEFAULT_MAX_PAGES; *fromPage = 1; *toPage = 1; } @@ -844,9 +870,9 @@ void wxPrintout::OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff) // wxPreviewCanvas //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) +wxIMPLEMENT_CLASS(wxPreviewCanvas, wxWindow); -BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) +wxBEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) EVT_PAINT(wxPreviewCanvas::OnPaint) EVT_CHAR(wxPreviewCanvas::OnChar) EVT_IDLE(wxPreviewCanvas::OnIdle) @@ -854,7 +880,7 @@ BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) #if wxUSE_MOUSEWHEEL EVT_MOUSEWHEEL(wxPreviewCanvas::OnMouseWheel) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // VZ: the current code doesn't refresh properly without // wxFULL_REPAINT_ON_RESIZE, this must be fixed as otherwise we have @@ -864,6 +890,10 @@ wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, const wxString& name): wxScrolledWindow(parent, wxID_ANY, pos, size, style | wxFULL_REPAINT_ON_RESIZE, name) { + // As we rely on getting idle events, do this to ensure that we do receive + // them even when using wxIDLE_PROCESS_SPECIFIED global idle mode. + SetExtraStyle(wxWS_EX_PROCESS_IDLE); + m_printPreview = preview; #ifdef __WXMAC__ // The app workspace colour is always white, but we should have @@ -1210,9 +1240,9 @@ private: // wxPreviewControlBar //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow) +wxIMPLEMENT_CLASS(wxPreviewControlBar, wxWindow); -BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel) +wxBEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel) EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose) EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrintButton) EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPreviousButton) @@ -1232,7 +1262,7 @@ BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel) EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoomChoice) EVT_PAINT(wxPreviewControlBar::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxPreviewControlBar::wxPreviewControlBar(wxPrintPreviewBase *preview, long buttons, wxWindow *parent, const wxPoint& pos, const wxSize& size, @@ -1617,12 +1647,12 @@ int wxPreviewControlBar::GetZoomControl() * Preview frame */ -IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) +wxIMPLEMENT_CLASS(wxPreviewFrame, wxFrame); -BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame) EVT_CHAR_HOOK(wxPreviewFrame::OnChar) EVT_CLOSE(wxPreviewFrame::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxPreviewFrame::OnChar(wxKeyEvent &event) { @@ -1703,13 +1733,13 @@ void wxPreviewFrame::InitializeWithModality(wxPreviewFrameModalityKind kind) m_printPreview->SetCanvas(m_previewCanvas); m_printPreview->SetFrame(this); - wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* const sizer = new wxBoxSizer( wxVERTICAL ); - item0->Add( m_controlBar, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); - item0->Add( m_previewCanvas, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); + sizer->Add( m_controlBar, wxSizerFlags().Expand().Border() ); + sizer->Add( m_previewCanvas, wxSizerFlags(1).Expand().Border() ); SetAutoLayout( true ); - SetSizer( item0 ); + SetSizer( sizer ); m_modalityKind = kind; switch ( m_modalityKind ) @@ -1764,7 +1794,7 @@ void wxPreviewFrame::CreateControlBar() * Print preview */ -IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) +wxIMPLEMENT_CLASS(wxPrintPreviewBase, wxObject); wxPrintPreviewBase::wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting, @@ -2115,7 +2145,7 @@ void wxPrintPreviewBase::SetOk(bool ok) // wxPrintPreview //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPrintPreview, wxPrintPreviewBase) +wxIMPLEMENT_CLASS(wxPrintPreview, wxPrintPreviewBase); wxPrintPreview::wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, diff --git a/Externals/wxWidgets3/src/common/process.cpp b/Externals/wxWidgets3/src/common/process.cpp index 6dd44d891b..dfe1ad3c02 100644 --- a/Externals/wxWidgets3/src/common/process.cpp +++ b/Externals/wxWidgets3/src/common/process.cpp @@ -31,8 +31,8 @@ wxDEFINE_EVENT( wxEVT_END_PROCESS, wxProcessEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler) -IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler); +wxIMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent); // ============================================================================ // wxProcess implementation @@ -169,13 +169,25 @@ bool wxProcess::Exists(int pid) case wxKILL_ERROR: case wxKILL_BAD_SIGNAL: wxFAIL_MSG( wxT("unexpected wxProcess::Kill() return code") ); - // fall through + wxFALLTHROUGH; case wxKILL_NO_PROCESS: return false; } } +bool wxProcess::Activate() const +{ +#ifdef __WINDOWS__ + // This function is defined in src/msw/utils.cpp. + extern bool wxMSWActivatePID(long pid); + + return wxMSWActivatePID(m_pid); +#else + return false; +#endif +} + void wxProcess::SetPriority(unsigned priority) { wxCHECK_RET( priority <= wxPRIORITY_MAX, diff --git a/Externals/wxWidgets3/src/common/protocol.cpp b/Externals/wxWidgets3/src/common/protocol.cpp index 74662adb8a..f6250252c3 100644 --- a/Externals/wxWidgets3/src/common/protocol.cpp +++ b/Externals/wxWidgets3/src/common/protocol.cpp @@ -21,6 +21,7 @@ #include "wx/protocol/log.h" #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/module.h" #endif @@ -33,7 +34,7 @@ // wxProtoInfo // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxProtoInfo, wxObject) +wxIMPLEMENT_CLASS(wxProtoInfo, wxObject); wxProtoInfo::wxProtoInfo(const wxChar *name, const wxChar *serv, const bool need_host1, wxClassInfo *info) @@ -56,14 +57,17 @@ wxProtoInfo::wxProtoInfo(const wxChar *name, const wxChar *serv, // ---------------------------------------------------------------------------- #if wxUSE_SOCKETS -IMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxSocketClient) +wxIMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxSocketClient); #else -IMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxObject); #endif wxProtocol::wxProtocol() #if wxUSE_SOCKETS - : wxSocketClient() + // Only use non blocking sockets if we can dispatch events. + : wxSocketClient((wxIsMainThread() && wxApp::IsMainLoopRunning() + ? wxSOCKET_NONE + : wxSOCKET_BLOCK) | wxSOCKET_WAITALL) #endif { m_lastError = wxPROTO_NOERR; diff --git a/Externals/wxWidgets3/src/common/quantize.cpp b/Externals/wxWidgets3/src/common/quantize.cpp index 618f4e26b6..4fa2988ca4 100644 --- a/Externals/wxWidgets3/src/common/quantize.cpp +++ b/Externals/wxWidgets3/src/common/quantize.cpp @@ -52,16 +52,9 @@ #include #include -#if defined(__OS2__) -#define RGB_RED_OS2 0 -#define RGB_GREEN_OS2 1 -#define RGB_BLUE_OS2 2 -#else #define RGB_RED 0 #define RGB_GREEN 1 #define RGB_BLUE 2 -#endif -#define RGB_PIXELSIZE 3 #define MAXJSAMPLE 255 #define CENTERJSAMPLE 128 @@ -70,12 +63,6 @@ #define RIGHT_SHIFT(x,shft) ((x) >> (shft)) -typedef unsigned short UINT16; -typedef signed short INT16; -#if !(defined(__WATCOMC__) && (defined(__WXMSW__) || defined(__WXMOTIF__))) -typedef signed int INT32; -#endif - typedef unsigned char JSAMPLE; typedef JSAMPLE *JSAMPROW; typedef JSAMPROW *JSAMPARRAY; @@ -90,7 +77,7 @@ typedef struct { JSAMPLE *sample_range_limit, *srl_orig; } j_decompress; -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) +#if defined(__WINDOWS__) #define JMETHOD(type,methodname,arglist) type (__cdecl methodname) arglist #else #define JMETHOD(type,methodname,arglist) type (methodname) arglist @@ -166,26 +153,6 @@ struct jpeg_color_quantizer { * you'll probably want to tweak the histogram sizes too. */ -#if defined(__OS2__) - -#if RGB_RED_OS2 == 0 -#define C0_SCALE R_SCALE -#endif -#if RGB_BLUE_OS2 == 0 -#define C0_SCALE B_SCALE -#endif -#if RGB_GREEN_OS2 == 1 -#define C1_SCALE G_SCALE -#endif -#if RGB_RED_OS2 == 2 -#define C2_SCALE R_SCALE -#endif -#if RGB_BLUE_OS2 == 2 -#define C2_SCALE B_SCALE -#endif - -#else - #if RGB_RED == 0 #define C0_SCALE R_SCALE #endif @@ -202,8 +169,6 @@ struct jpeg_color_quantizer { #define C2_SCALE B_SCALE #endif -#endif - /* * First we have the histogram data structure and routines for creating it. * @@ -250,7 +215,7 @@ struct jpeg_color_quantizer { #define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS) -typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */ +typedef wxUint16 histcell; /* histogram cell; prefer an unsigned type */ typedef histcell * histptr; /* for pointers to histogram cells */ @@ -284,11 +249,11 @@ typedef hist2d * hist3d; /* type for top-level pointer */ */ #if BITS_IN_JSAMPLE == 8 -typedef INT16 FSERROR; /* 16 bits should be enough */ +typedef wxInt16 FSERROR; /* 16 bits should be enough */ typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else -typedef INT32 FSERROR; /* may need more than 16 bits */ -typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ +typedef wxInt32 FSERROR; /* may need more than 16 bits */ +typedef wxInt32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */ @@ -337,9 +302,9 @@ prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY WXUNUSED(output_buf), int num_rows) { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; - register JSAMPROW ptr; - register histptr histp; - register hist3d histogram = cquantize->histogram; + JSAMPROW ptr; + histptr histp; + hist3d histogram = cquantize->histogram; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; @@ -377,7 +342,7 @@ typedef struct { int c1min, c1max; int c2min, c2max; /* The volume (actually 2-norm) of the box */ - INT32 volume; + wxInt32 volume; /* The number of nonzero histogram cells within this box */ long colorcount; } box; @@ -390,9 +355,9 @@ find_biggest_color_pop (boxptr boxlist, int numboxes) /* Find the splittable box with the largest color population */ /* Returns NULL if no splittable boxes remain */ { - register boxptr boxp; - register int i; - register long maxc = 0; + boxptr boxp; + int i; + long maxc = 0; boxptr which = NULL; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { @@ -410,9 +375,9 @@ find_biggest_volume (boxptr boxlist, int numboxes) /* Find the splittable box with the largest (scaled) volume */ /* Returns NULL if no splittable boxes remain */ { - register boxptr boxp; - register int i; - register INT32 maxv = 0; + boxptr boxp; + int i; + wxInt32 maxv = 0; boxptr which = NULL; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { @@ -435,7 +400,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) histptr histp; int c0,c1,c2; int c0min,c0max,c1min,c1max,c2min,c2max; - INT32 dist0,dist1,dist2; + wxInt32 dist0,dist1,dist2; long ccount; c0min = boxp->c0min; c0max = boxp->c0max; @@ -543,7 +508,7 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, { int n,lb; int c0,c1,c2,cmax; - register boxptr b1,b2; + boxptr b1,b2; while (numboxes < desired_colors) { /* Select box to split. @@ -570,20 +535,6 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, /* We want to break any ties in favor of green, then red, blue last. * This code does the right thing for R,G,B or B,G,R color orders only. */ -#if defined(__VISAGECPP__) - -#if RGB_RED_OS2 == 0 - cmax = c1; n = 1; - if (c0 > cmax) { cmax = c0; n = 0; } - if (c2 > cmax) { n = 2; } -#else - cmax = c1; n = 1; - if (c2 > cmax) { cmax = c2; n = 2; } - if (c0 > cmax) { n = 0; } -#endif - -#else - #if RGB_RED == 0 cmax = c1; n = 1; if (c0 > cmax) { cmax = c0; n = 0; } @@ -594,7 +545,6 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, if (c0 > cmax) { n = 0; } #endif -#endif /* Choose split point along selected axis, and update box bounds. * Current algorithm: split at halfway point. * (Since the box has been shrunk to minimum volume, @@ -790,8 +740,8 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int maxc0, maxc1, maxc2; int centerc0, centerc1, centerc2; int i, x, ncolors; - INT32 minmaxdist, min_dist, max_dist, tdist; - INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ + wxInt32 minmaxdist, min_dist, max_dist, tdist; + wxInt32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ /* Compute true coordinates of update box's upper corner and center. * Actually we compute the coordinates of the center of the upper-corner @@ -915,15 +865,15 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, { int ic0, ic1, ic2; int i, icolor; - register INT32 * bptr; /* pointer into bestdist[] array */ + wxInt32 * bptr; /* pointer into bestdist[] array */ JSAMPLE * cptr; /* pointer into bestcolor[] array */ - INT32 dist0, dist1; /* initial distance values */ - register INT32 dist2; /* current distance in inner loop */ - INT32 xx0, xx1; /* distance increments */ - register INT32 xx2; - INT32 inc0, inc1, inc2; /* initial values for increments */ + wxInt32 dist0, dist1; /* initial distance values */ + wxInt32 dist2; /* current distance in inner loop */ + wxInt32 xx0, xx1; /* distance increments */ + wxInt32 xx2; + wxInt32 inc0, inc1, inc2; /* initial values for increments */ /* This array holds the distance to the nearest-so-far color for each cell */ - INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; + wxInt32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; /* Initialize best-distance for each cell of the update box */ bptr = bestdist; @@ -993,8 +943,8 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) hist3d histogram = cquantize->histogram; int minc0, minc1, minc2; /* lower left corner of update box */ int ic0, ic1, ic2; - register JSAMPLE * cptr; /* pointer into bestcolor[] array */ - register histptr cachep; /* pointer into main cache array */ + JSAMPLE * cptr; /* pointer into bestcolor[] array */ + histptr cachep; /* pointer into main cache array */ /* This array lists the candidate colormap indexes. */ JSAMPLE colorlist[MAXNUMCOLORS]; int numcolors; /* number of candidate colors */ @@ -1050,9 +1000,9 @@ pass2_no_dither (j_decompress_ptr cinfo, { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - register JSAMPROW inptr, outptr; - register histptr cachep; - register int c0, c1, c2; + JSAMPROW inptr, outptr; + histptr cachep; + int c0, c1, c2; int row; JDIMENSION col; JDIMENSION width = cinfo->output_width; @@ -1084,10 +1034,10 @@ pass2_fs_dither (j_decompress_ptr cinfo, { my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; hist3d histogram = cquantize->histogram; - register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ + LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ - register FSERRPTR errorptr; /* => fserrors[] at column before current */ + FSERRPTR errorptr; /* => fserrors[] at column before current */ JSAMPROW inptr; /* => current input pixel */ JSAMPROW outptr; /* => current output pixel */ histptr cachep; @@ -1162,7 +1112,7 @@ pass2_fs_dither (j_decompress_ptr cinfo, if (*cachep == 0) fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); /* Now emit the colormap index for this cell */ - { register int pixcode = *cachep - 1; + { int pixcode = *cachep - 1; *outptr = (JSAMPLE) pixcode; /* Compute representation error for this pixel */ cur0 -= GETJSAMPLE(colormap0[pixcode]); @@ -1173,7 +1123,7 @@ pass2_fs_dither (j_decompress_ptr cinfo, * Add these into the running sums, and simultaneously shift the * next-line error sums left by 1 column. */ - { register LOCFSERROR bnexterr, delta; + { LOCFSERROR bnexterr, delta; bnexterr = cur0; /* Process component 0 */ delta = cur0 * 2; @@ -1315,7 +1265,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan) (3 * sizeof(FSERROR))); /* Allocate Floyd-Steinberg workspace if we didn't already. */ if (cquantize->fserrors == NULL) - cquantize->fserrors = (INT16*) malloc(arraysize); + cquantize->fserrors = (wxInt16*) malloc(arraysize); /* Initialize the propagated errors to zero. */ memset((void *) cquantize->fserrors, 0, arraysize); /* Make the error-limit table if we didn't already. */ @@ -1447,7 +1397,7 @@ prepare_range_limit_table (j_decompress_ptr cinfo) * wxQuantize */ -IMPLEMENT_DYNAMIC_CLASS(wxQuantize, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxQuantize, wxObject); void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, unsigned char **out_rows, unsigned char *palette, int desiredNoColours) diff --git a/Externals/wxWidgets3/src/common/radiobtncmn.cpp b/Externals/wxWidgets3/src/common/radiobtncmn.cpp index 5fe82fe1c7..dc2bd09240 100644 --- a/Externals/wxWidgets3/src/common/radiobtncmn.cpp +++ b/Externals/wxWidgets3/src/common/radiobtncmn.cpp @@ -71,7 +71,7 @@ wxBEGIN_FLAGS( wxRadioButtonStyle ) wxFLAGS_MEMBER(wxRB_GROUP) wxEND_FLAGS( wxRadioButtonStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl, "wx/radiobut.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl, "wx/radiobut.h"); wxBEGIN_PROPERTIES_TABLE(wxRadioButton) wxEVENT_PROPERTY( Click, wxEVT_RADIOBUTTON, wxCommandEvent ) diff --git a/Externals/wxWidgets3/src/common/radiocmn.cpp b/Externals/wxWidgets3/src/common/radiocmn.cpp index 5d69bf5952..b25ac61036 100644 --- a/Externals/wxWidgets3/src/common/radiocmn.cpp +++ b/Externals/wxWidgets3/src/common/radiocmn.cpp @@ -86,7 +86,7 @@ wxFLAGS_MEMBER(wxRA_VERTICAL) wxEND_FLAGS( wxRadioBoxStyle ) -IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl,"wx/radiobox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl, "wx/radiobox.h"); wxBEGIN_PROPERTIES_TABLE(wxRadioBox) wxEVENT_PROPERTY( Select , wxEVT_RADIOBOX , wxCommandEvent ) @@ -349,7 +349,7 @@ wxString wxRadioBoxBase::DoGetHelpTextAtPoint(const wxWindow *derived, default: wxFAIL_MSG( "unknown help even origin" ); - // fall through + wxFALLTHROUGH; case wxHelpEvent::Origin_Unknown: // this value is used when we're called from GetHelpText() for the diff --git a/Externals/wxWidgets3/src/common/rearrangectrl.cpp b/Externals/wxWidgets3/src/common/rearrangectrl.cpp index a6865f9036..98cddb55fc 100644 --- a/Externals/wxWidgets3/src/common/rearrangectrl.cpp +++ b/Externals/wxWidgets3/src/common/rearrangectrl.cpp @@ -39,9 +39,9 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxRearrangeListNameStr[] = "wxRearrangeList"; -BEGIN_EVENT_TABLE(wxRearrangeList, wxCheckListBox) +wxBEGIN_EVENT_TABLE(wxRearrangeList, wxCheckListBox) EVT_CHECKLISTBOX(wxID_ANY, wxRearrangeList::OnCheck) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxRearrangeList::Create(wxWindow *parent, wxWindowID id, @@ -78,7 +78,11 @@ bool wxRearrangeList::Create(wxWindow *parent, for ( n = 0; n < count; n++ ) { if ( order[n] >= 0 ) - Check(n); + { + // Be careful to call the base class version here and not our own + // which would also update m_order itself. + wxCheckListBox::Check(n); + } } m_order = order; @@ -137,8 +141,8 @@ void wxRearrangeList::Swap(int pos1, int pos2) // then the checked state const bool checkedTmp = IsChecked(pos1); - Check(pos1, IsChecked(pos2)); - Check(pos2, checkedTmp); + wxCheckListBox::Check(pos1, IsChecked(pos2)); + wxCheckListBox::Check(pos2, checkedTmp); // and finally the client data, if necessary switch ( GetClientDataType() ) @@ -165,28 +169,36 @@ void wxRearrangeList::Swap(int pos1, int pos2) } } +void wxRearrangeList::Check(unsigned int item, bool check) +{ + if ( check == IsChecked(item) ) + return; + + wxCheckListBox::Check(item, check); + + m_order[item] = ~m_order[item]; +} + void wxRearrangeList::OnCheck(wxCommandEvent& event) { // update the internal state to match the new item state const int n = event.GetInt(); - m_order[n] = ~m_order[n]; - - wxASSERT_MSG( (m_order[n] >= 0) == IsChecked(n), - "discrepancy between internal state and GUI" ); + if ( (m_order[n] >= 0) != IsChecked(n) ) + m_order[n] = ~m_order[n]; } // ============================================================================ // wxRearrangeCtrl implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxRearrangeCtrl, wxPanel) +wxBEGIN_EVENT_TABLE(wxRearrangeCtrl, wxPanel) EVT_UPDATE_UI(wxID_UP, wxRearrangeCtrl::OnUpdateButtonUI) EVT_UPDATE_UI(wxID_DOWN, wxRearrangeCtrl::OnUpdateButtonUI) EVT_BUTTON(wxID_UP, wxRearrangeCtrl::OnButton) EVT_BUTTON(wxID_DOWN, wxRearrangeCtrl::OnButton) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxRearrangeCtrl::Init() { diff --git a/Externals/wxWidgets3/src/common/regex.cpp b/Externals/wxWidgets3/src/common/regex.cpp index a93ca08bf5..17f7cfccc3 100644 --- a/Externals/wxWidgets3/src/common/regex.cpp +++ b/Externals/wxWidgets3/src/common/regex.cpp @@ -35,11 +35,8 @@ #include "wx/crt.h" #endif //WX_PRECOMP -// FreeBSD, Watcom and DMars require this, CW doesn't have nor need it. -// Others also don't seem to need it. If you have an error related to -// (not) including please report details to -// wx-dev@lists.wxwindows.org -#if defined(__UNIX__) || defined(__WATCOMC__) || defined(__DIGITALMARS__) +// At least FreeBSD requires this. +#if defined(__UNIX__) # include #endif @@ -433,7 +430,7 @@ bool wxRegExImpl::Matches(const wxRegChar *str, // an error occurred wxLogError(_("Failed to find match for regular expression: %s"), GetErrorMsg(rc, !str).c_str()); - // fall through + wxFALLTHROUGH; case REG_NOMATCH: // no match diff --git a/Externals/wxWidgets3/src/common/sckaddr.cpp b/Externals/wxWidgets3/src/common/sckaddr.cpp index da66df3cdf..0388132fb8 100644 --- a/Externals/wxWidgets3/src/common/sckaddr.cpp +++ b/Externals/wxWidgets3/src/common/sckaddr.cpp @@ -46,7 +46,7 @@ #include -#if defined(__UNIX__) && !defined(__WXMSW__) +#if defined(__UNIX__) && !defined(__WINDOWS__) #include #include #endif // __UNIX__ @@ -59,14 +59,14 @@ // wxRTTI macros // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxSockAddress, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxIPaddress, wxSockAddress) -IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxIPaddress) +wxIMPLEMENT_ABSTRACT_CLASS(wxSockAddress, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxIPaddress, wxSockAddress); +wxIMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxIPaddress); #if wxUSE_IPV6 -IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxIPaddress) +wxIMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxIPaddress); #endif #if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__) -IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) +wxIMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress); #endif // ============================================================================ @@ -113,6 +113,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) // gethostbyname_r() and that it uses the similar conventions to it (see // comment in configure) #define HAVE_GETHOSTBYADDR HAVE_GETHOSTBYNAME + +#ifdef __ANDROID__ + #ifndef HAVE_GETHOSTBYNAME + #define HAVE_GETHOSTBYNAME + #endif +#else // these functions are missing on android (see netdb.h) #ifdef HAVE_FUNC_GETHOSTBYNAME_R_3 #define HAVE_FUNC_GETHOSTBYADDR_R_3 #endif @@ -122,7 +128,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) #ifdef HAVE_FUNC_GETHOSTBYNAME_R_6 #define HAVE_FUNC_GETHOSTBYADDR_R_6 #endif - +#endif // the _r functions need the extra buffer parameter but unfortunately its type // differs between different systems and for the systems which use opaque // structs for it (at least AIX and OpenBSD) it must be zero-filled before @@ -136,7 +142,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) } }; #else - typedef char wxGethostBuf[1024]; + typedef char wxGethostBuf[4096]; #endif #ifdef HAVE_FUNC_GETSERVBYNAME_R_4 @@ -148,7 +154,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) } }; #else - typedef char wxGetservBuf[1024]; + typedef char wxGetservBuf[4096]; #endif #if defined(wxHAS_MT_SAFE_GETBY_FUNCS) || !wxUSE_THREADS @@ -418,10 +424,6 @@ servent *wxGetservbyname_r(const char *port, // wxSockAddressImpl implementation // ============================================================================ -// FIXME-VC6: helper macros to call Alloc/Get() hiding the ugly dummy argument -#define ALLOC(T) Alloc(static_cast(NULL)) -#define GET(T) Get(static_cast(NULL)) - // ---------------------------------------------------------------------------- // INET or INET6 address family // ---------------------------------------------------------------------------- @@ -434,14 +436,14 @@ wxString wxSockAddressImpl::GetHostName() const #if wxUSE_IPV6 if ( m_family == FAMILY_INET6 ) { - sockaddr_in6 * const addr6 = GET(sockaddr_in6); + sockaddr_in6 * const addr6 = Get(); addrbuf = &addr6->sin6_addr; addrbuflen = sizeof(addr6->sin6_addr); } else #endif // wxUSE_IPV6 { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return wxString(); @@ -504,13 +506,13 @@ void wxSockAddressImpl::CreateINET() wxASSERT_MSG( Is(FAMILY_UNSPEC), "recreating address as different type?" ); m_family = FAMILY_INET; - sockaddr_in * const addr = ALLOC(sockaddr_in); + sockaddr_in * const addr = Alloc(); addr->sin_family = FAMILY_INET; } bool wxSockAddressImpl::SetHostName4(const wxString& name) { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return false; @@ -541,7 +543,7 @@ bool wxSockAddressImpl::SetHostName4(const wxString& name) bool wxSockAddressImpl::GetHostAddress(wxUint32 *address) const { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return false; @@ -552,7 +554,7 @@ bool wxSockAddressImpl::GetHostAddress(wxUint32 *address) const bool wxSockAddressImpl::SetHostAddress(wxUint32 address) { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return false; @@ -563,7 +565,7 @@ bool wxSockAddressImpl::SetHostAddress(wxUint32 address) wxUint16 wxSockAddressImpl::GetPort4() const { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return 0; @@ -572,7 +574,7 @@ wxUint16 wxSockAddressImpl::GetPort4() const bool wxSockAddressImpl::SetPort4(wxUint16 port) { - sockaddr_in * const addr = GET(sockaddr_in); + sockaddr_in * const addr = Get(); if ( !addr ) return false; @@ -592,13 +594,13 @@ void wxSockAddressImpl::CreateINET6() wxASSERT_MSG( Is(FAMILY_UNSPEC), "recreating address as different type?" ); m_family = FAMILY_INET6; - sockaddr_in6 * const addr = ALLOC(sockaddr_in6); + sockaddr_in6 * const addr = Alloc(); addr->sin6_family = FAMILY_INET6; } bool wxSockAddressImpl::SetHostName6(const wxString& hostname) { - sockaddr_in6 * const addr = GET(sockaddr_in6); + sockaddr_in6 * const addr = Get(); if ( !addr ) return false; @@ -626,7 +628,7 @@ bool wxSockAddressImpl::SetHostName6(const wxString& hostname) bool wxSockAddressImpl::GetHostAddress(in6_addr *address) const { - sockaddr_in6 * const addr = GET(sockaddr_in6); + sockaddr_in6 * const addr = Get(); if ( !addr ) return false; @@ -637,7 +639,7 @@ bool wxSockAddressImpl::GetHostAddress(in6_addr *address) const bool wxSockAddressImpl::SetHostAddress(const in6_addr& address) { - sockaddr_in6 * const addr = GET(sockaddr_in6); + sockaddr_in6 * const addr = Get(); if ( !addr ) return false; @@ -648,7 +650,7 @@ bool wxSockAddressImpl::SetHostAddress(const in6_addr& address) wxUint16 wxSockAddressImpl::GetPort6() const { - sockaddr_in6 * const addr = GET(sockaddr_in6); + sockaddr_in6 * const addr = Get(); if ( !addr ) return 0; @@ -657,7 +659,7 @@ wxUint16 wxSockAddressImpl::GetPort6() const bool wxSockAddressImpl::SetPort6(wxUint16 port) { - sockaddr_in6 * const addr = GET(sockaddr_in6); + sockaddr_in6 * const addr = Get(); if ( !addr ) return false; @@ -690,14 +692,14 @@ void wxSockAddressImpl::CreateUnix() wxASSERT_MSG( Is(FAMILY_UNSPEC), "recreating address as different type?" ); m_family = FAMILY_UNIX; - sockaddr_un * const addr = ALLOC(sockaddr_un); + sockaddr_un * const addr = Alloc(); addr->sun_family = FAMILY_UNIX; addr->sun_path[0] = '\0'; } bool wxSockAddressImpl::SetPath(const wxString& path) { - sockaddr_un * const addr = GET(sockaddr_un); + sockaddr_un * const addr = Get(); if ( !addr ) return false; @@ -712,7 +714,7 @@ bool wxSockAddressImpl::SetPath(const wxString& path) wxString wxSockAddressImpl::GetPath() const { - sockaddr_un * const addr = GET(sockaddr_un); + sockaddr_un * const addr = Get(); if ( !addr ) return wxString(); @@ -721,9 +723,6 @@ wxString wxSockAddressImpl::GetPath() const #endif // wxHAS_UNIX_DOMAIN_SOCKETS -#undef GET -#undef ALLOC - // ---------------------------------------------------------------------------- // wxSockAddress // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/sckfile.cpp b/Externals/wxWidgets3/src/common/sckfile.cpp index 4b7b6cee1c..75971e4ba2 100644 --- a/Externals/wxWidgets3/src/common/sckfile.cpp +++ b/Externals/wxWidgets3/src/common/sckfile.cpp @@ -29,7 +29,7 @@ // wxFileProto // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol); IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false) wxFileProto::wxFileProto() diff --git a/Externals/wxWidgets3/src/common/sckipc.cpp b/Externals/wxWidgets3/src/common/sckipc.cpp index ea1de8eb8e..14da6e7439 100644 --- a/Externals/wxWidgets3/src/common/sckipc.cpp +++ b/Externals/wxWidgets3/src/common/sckipc.cpp @@ -126,7 +126,7 @@ public: private: void HandleDisconnect(wxTCPConnection *connection); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTCPEventHandler); }; @@ -155,17 +155,17 @@ public: } // as ms_handler is initialized on demand, don't do anything in OnInit() - virtual bool OnInit() { return true; } - virtual void OnExit() { wxDELETE(ms_handler); } + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxDELETE(ms_handler); } private: static wxTCPEventHandler *ms_handler; - DECLARE_DYNAMIC_CLASS(wxTCPEventHandlerModule) + wxDECLARE_DYNAMIC_CLASS(wxTCPEventHandlerModule); wxDECLARE_NO_COPY_CLASS(wxTCPEventHandlerModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxTCPEventHandlerModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTCPEventHandlerModule, wxModule); wxTCPEventHandler *wxTCPEventHandlerModule::ms_handler = NULL; @@ -349,9 +349,9 @@ private: // implementation // ========================================================================== -IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase) -IMPLEMENT_CLASS(wxTCPConnection, wxConnectionBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase); +wxIMPLEMENT_CLASS(wxTCPConnection, wxConnectionBase); // -------------------------------------------------------------------------- // wxTCPClient @@ -683,10 +683,10 @@ bool wxTCPConnection::DoAdvise(const wxString& item, // wxTCPEventHandler (private class) // -------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTCPEventHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxTCPEventHandler, wxEvtHandler) EVT_SOCKET(_CLIENT_ONREQUEST_ID, wxTCPEventHandler::Client_OnRequest) EVT_SOCKET(_SERVER_ONREQUEST_ID, wxTCPEventHandler::Server_OnRequest) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxTCPEventHandler::HandleDisconnect(wxTCPConnection *connection) { diff --git a/Externals/wxWidgets3/src/common/scrolbarcmn.cpp b/Externals/wxWidgets3/src/common/scrolbarcmn.cpp index 65db8fb2de..2646be8076 100644 --- a/Externals/wxWidgets3/src/common/scrolbarcmn.cpp +++ b/Externals/wxWidgets3/src/common/scrolbarcmn.cpp @@ -63,7 +63,7 @@ wxBEGIN_FLAGS( wxScrollBarStyle ) wxFLAGS_MEMBER(wxSB_VERTICAL) wxEND_FLAGS( wxScrollBarStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxScrollBar, wxControl, "wx/scrolbar.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxScrollBar, wxControl, "wx/scrolbar.h"); wxBEGIN_PROPERTIES_TABLE(wxScrollBar) wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, \ diff --git a/Externals/wxWidgets3/src/common/selectdispatcher.cpp b/Externals/wxWidgets3/src/common/selectdispatcher.cpp index db763eca32..13639392e3 100644 --- a/Externals/wxWidgets3/src/common/selectdispatcher.cpp +++ b/Externals/wxWidgets3/src/common/selectdispatcher.cpp @@ -133,6 +133,8 @@ bool wxSelectSets::Handle(int fd, wxFDIOHandler& handler) const bool wxSelectDispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags) { + wxCRIT_SECT_LOCKER(lock, m_cs); + if ( !wxMappedFDIODispatcher::RegisterFD(fd, handler, flags) ) return false; @@ -149,6 +151,8 @@ bool wxSelectDispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags) bool wxSelectDispatcher::ModifyFD(int fd, wxFDIOHandler *handler, int flags) { + wxCRIT_SECT_LOCKER(lock, m_cs); + if ( !wxMappedFDIODispatcher::ModifyFD(fd, handler, flags) ) return false; @@ -161,6 +165,8 @@ bool wxSelectDispatcher::ModifyFD(int fd, wxFDIOHandler *handler, int flags) bool wxSelectDispatcher::UnregisterFD(int fd) { + wxCRIT_SECT_LOCKER(lock, m_cs); + m_sets.ClearFD(fd); if ( !wxMappedFDIODispatcher::UnregisterFD(fd) ) diff --git a/Externals/wxWidgets3/src/common/sizer.cpp b/Externals/wxWidgets3/src/common/sizer.cpp index 31bed2c619..9ed3bd1c43 100644 --- a/Externals/wxWidgets3/src/common/sizer.cpp +++ b/Externals/wxWidgets3/src/common/sizer.cpp @@ -37,16 +37,16 @@ //--------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxSizerItem, wxObject) -IMPLEMENT_CLASS(wxSizer, wxObject) -IMPLEMENT_CLASS(wxGridSizer, wxSizer) -IMPLEMENT_CLASS(wxFlexGridSizer, wxGridSizer) -IMPLEMENT_CLASS(wxBoxSizer, wxSizer) +wxIMPLEMENT_CLASS(wxSizerItem, wxObject); +wxIMPLEMENT_CLASS(wxSizer, wxObject); +wxIMPLEMENT_CLASS(wxGridSizer, wxSizer); +wxIMPLEMENT_CLASS(wxFlexGridSizer, wxGridSizer); +wxIMPLEMENT_CLASS(wxBoxSizer, wxSizer); #if wxUSE_STATBOX -IMPLEMENT_CLASS(wxStaticBoxSizer, wxBoxSizer) +wxIMPLEMENT_CLASS(wxStaticBoxSizer, wxBoxSizer); #endif #if wxUSE_BUTTON -IMPLEMENT_CLASS(wxStdDialogButtonSizer, wxBoxSizer) +wxIMPLEMENT_CLASS(wxStdDialogButtonSizer, wxBoxSizer); #endif WX_DEFINE_EXPORTED_LIST( wxSizerItemList ) @@ -84,11 +84,41 @@ WX_DEFINE_EXPORTED_LIST( wxSizerItemList ) minsize */ +// ---------------------------------------------------------------------------- +// wxSizerFlags +// ---------------------------------------------------------------------------- + +#ifdef wxNEEDS_BORDER_IN_PX + +int wxSizerFlags::ms_defaultBorderInPx = 0; + +/* static */ +int wxSizerFlags::DoGetDefaultBorderInPx() +{ + // Hard code 5px as it's the minimal border size between two controls, see + // the table at the bottom of + // https://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx + // + // Of course, ideal would be to use the appropriate sizes for the borders + // between related and unrelated controls, as explained at the above URL, + // but we don't have a way to specify this in our API currently. + // + // We also have to use the DPI for the primary monitor here as we don't + // have any associated window, so this is wrong on systems using multiple + // monitors with different resolutions too -- but, again, without changes + // in the API, there is nothing we can do about this. + return wxWindow::FromDIP(5, NULL); +} + +#endif // wxNEEDS_BORDER_IN_PX + // ---------------------------------------------------------------------------- // wxSizerItem // ---------------------------------------------------------------------------- // check for flags conflicts +#if wxDEBUG_LEVEL + static const int SIZER_FLAGS_MASK = wxADD_FLAG(wxCENTRE, wxADD_FLAG(wxHORIZONTAL, @@ -110,7 +140,19 @@ static const int SIZER_FLAGS_MASK = wxADD_FLAG(wxSHAPED, 0)))))))))))))))))); -#define ASSERT_VALID_SIZER_FLAGS(f) wxASSERT_VALID_FLAGS(f, SIZER_FLAGS_MASK) +#endif // wxDEBUG_LEVEL + +#define ASSERT_INCOMPATIBLE_NOT_USED_IMPL(f, f1, n1, f2, n2) \ + wxASSERT_MSG(((f) & (f1 | f2)) != (f1 | f2), \ + n1 " and " n2 " can't be used together") + +#define ASSERT_INCOMPATIBLE_NOT_USED(f, f1, f2) \ + ASSERT_INCOMPATIBLE_NOT_USED_IMPL(f, f1, #f1, f2, #f2) + +#define ASSERT_VALID_SIZER_FLAGS(f) \ + wxASSERT_VALID_FLAGS(f, SIZER_FLAGS_MASK); \ + ASSERT_INCOMPATIBLE_NOT_USED(f, wxALIGN_CENTRE_HORIZONTAL, wxALIGN_RIGHT); \ + ASSERT_INCOMPATIBLE_NOT_USED(f, wxALIGN_CENTRE_VERTICAL, wxALIGN_BOTTOM) void wxSizerItem::Init(const wxSizerFlags& flags) @@ -377,7 +419,7 @@ bool wxSizerItem::InformFirstDirection(int direction, int size, int availableOth { if( !wxIsNullDouble(m_ratio) ) { - wxCHECK_MSG( (m_proportion==0), false, wxT("Shaped item, non-zero proportion in wxSizerItem::InformFirstDirection()") ); + wxCHECK_MSG( m_proportion==0, false, wxT("Shaped item, non-zero proportion in wxSizerItem::InformFirstDirection()") ); if( direction==wxHORIZONTAL && !wxIsNullDouble(m_ratio) ) { // Clip size so that we don't take too much @@ -617,19 +659,6 @@ bool wxSizerItem::IsShown() const return false; } -#if WXWIN_COMPATIBILITY_2_6 -void wxSizerItem::SetOption( int option ) -{ - SetProportion( option ); -} - -int wxSizerItem::GetOption() const -{ - return GetProportion(); -} -#endif // WXWIN_COMPATIBILITY_2_6 - - //--------------------------------------------------------------------------- // wxSizer //--------------------------------------------------------------------------- @@ -675,13 +704,6 @@ void wxSizer::SetContainingWindow(wxWindow *win) } } -#if WXWIN_COMPATIBILITY_2_6 -bool wxSizer::Remove( wxWindow *window ) -{ - return Detach( window ); -} -#endif // WXWIN_COMPATIBILITY_2_6 - bool wxSizer::Remove( wxSizer *sizer ) { wxASSERT_MSG( sizer, wxT("Removing NULL sizer") ); @@ -1412,6 +1434,18 @@ wxSizerItem *wxGridSizer::DoInsert(size_t index, wxSizerItem *item) } } + const int flags = item->GetFlag(); + if ( flags & wxEXPAND ) + { + // Check that expansion will happen in at least one of the directions. + wxASSERT_MSG + ( + !(flags & (wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL)) || + !(flags & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL)), + wxS("wxEXPAND flag will be overridden by alignment flags") + ); + } + return wxSizer::DoInsert(index, item); } @@ -1523,11 +1557,13 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) wxSize sz( item->GetMinSizeWithBorder() ); int flag = item->GetFlag(); - if ((flag & wxEXPAND) || (flag & wxSHAPED)) + // wxSHAPED maintains aspect ratio and so always applies to both + // directions. + if ( flag & wxSHAPED ) { - sz = wxSize(w, h); + sz = wxSize(w, h); } - else + else // Otherwise we handle each direction individually. { if (flag & wxALIGN_CENTER_HORIZONTAL) { @@ -1537,6 +1573,10 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) { pt.x = x + (w - sz.x); } + else if (flag & wxEXPAND) + { + sz.x = w; + } if (flag & wxALIGN_CENTER_VERTICAL) { @@ -1546,6 +1586,10 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h ) { pt.y = y + (h - sz.y); } + else if ( flag & wxEXPAND ) + { + sz.y = h; + } } item->SetDimension(pt, sz); @@ -2015,6 +2059,67 @@ void wxFlexGridSizer::RemoveGrowableRow( size_t idx ) // wxBoxSizer //--------------------------------------------------------------------------- +wxSizerItem *wxBoxSizer::DoInsert(size_t index, wxSizerItem *item) +{ + const int flags = item->GetFlag(); + if ( IsVertical() ) + { + wxASSERT_MSG + ( + !(flags & wxALIGN_BOTTOM), + wxS("Vertical alignment flags are ignored in vertical sizers") + ); + + // We need to accept wxALIGN_CENTRE_VERTICAL when it is combined with + // wxALIGN_CENTRE_HORIZONTAL because this is known as wxALIGN_CENTRE + // and we accept it historically in wxSizer API. + if ( !(flags & wxALIGN_CENTRE_HORIZONTAL) ) + { + wxASSERT_MSG + ( + !(flags & wxALIGN_CENTRE_VERTICAL), + wxS("Vertical alignment flags are ignored in vertical sizers") + ); + } + + if ( flags & wxEXPAND ) + { + wxASSERT_MSG + ( + !(flags & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL)), + wxS("Horizontal alignment flags are ignored with wxEXPAND") + ); + } + } + else // horizontal + { + wxASSERT_MSG + ( + !(flags & wxALIGN_RIGHT), + wxS("Horizontal alignment flags are ignored in horizontal sizers") + ); + + if ( !(flags & wxALIGN_CENTRE_VERTICAL) ) + { + wxASSERT_MSG + ( + !(flags & wxALIGN_CENTRE_HORIZONTAL), + wxS("Horizontal alignment flags are ignored in horizontal sizers") + ); + } + + if ( flags & wxEXPAND ) + { + wxASSERT_MSG( + !(flags & (wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL)), + wxS("Vertical alignment flags are ignored with wxEXPAND") + ); + } + } + + return wxSizer::DoInsert(index, item); +} + wxSizerItem *wxBoxSizer::AddSpacer(int size) { return IsVertical() ? Add(0, size) : Add(size, 0); @@ -2074,7 +2179,7 @@ void wxBoxSizer::RecalcSizes() // the amount of free space which we should redistribute among the // stretchable items (i.e. those with non zero proportion) - int delta = totalMajorSize - GetSizeInMajorDir(m_minSize); + int delta = totalMajorSize - GetSizeInMajorDir(m_calculatedMinSize); // declare loop variables used below: wxSizerItemList::const_iterator i; // iterator in m_children list @@ -2106,9 +2211,6 @@ void wxBoxSizer::RecalcSizes() minMajorSize += GetSizeInMajorDir(item->GetMinSizeWithBorder()); } - // update our min size have changed - SizeInMajorDir(m_minSize) = minMajorSize; - // space and sum of proportions for the remaining items, both may change // below @@ -2396,7 +2498,7 @@ void wxBoxSizer::RecalcSizes() wxSize wxBoxSizer::CalcMin() { m_totalProportion = 0; - m_minSize = wxSize(0, 0); + m_calculatedMinSize = wxSize(0, 0); // The minimal size for the sizer should be big enough to allocate its // element at least its minimal size but also, and this is the non trivial @@ -2427,19 +2529,19 @@ wxSize wxBoxSizer::CalcMin() else // fixed size item { // Just account for its size directly - SizeInMajorDir(m_minSize) += GetSizeInMajorDir(sizeMinThis); + SizeInMajorDir(m_calculatedMinSize) += GetSizeInMajorDir(sizeMinThis); } // In the transversal direction we just need to find the maximum. - if ( GetSizeInMinorDir(sizeMinThis) > GetSizeInMinorDir(m_minSize) ) - SizeInMinorDir(m_minSize) = GetSizeInMinorDir(sizeMinThis); + if ( GetSizeInMinorDir(sizeMinThis) > GetSizeInMinorDir(m_calculatedMinSize) ) + SizeInMinorDir(m_calculatedMinSize) = GetSizeInMinorDir(sizeMinThis); } // Using the max ratio ensures that the min size is big enough for all // items to have their min size and satisfy the proportions among them. - SizeInMajorDir(m_minSize) += (int)(maxMinSizeToProp*m_totalProportion); + SizeInMajorDir(m_calculatedMinSize) += (int)(maxMinSizeToProp*m_totalProportion); - return m_minSize; + return m_calculatedMinSize; } //--------------------------------------------------------------------------- @@ -2469,7 +2571,31 @@ wxStaticBoxSizer::wxStaticBoxSizer(int orient, wxWindow *win, const wxString& s) wxStaticBoxSizer::~wxStaticBoxSizer() { - delete m_staticBox; + // As an exception to the general rule that sizers own other sizers that + // they contain but not the windows managed by them, this sizer does own + // the static box associated with it (which is not very logical but + // convenient in practice and, most importantly, can't be changed any more + // because of compatibility). However we definitely should not destroy the + // children of this static box when we're being destroyed, as this would be + // unexpected and break the existing code which worked with the windows + // created as siblings of the static box instead of its children in the + // previous wxWidgets versions, so ensure they are left alive. + + if ( m_staticBox ) + { + // Notice that we must make a copy of the list as it will be changed by + // Reparent() calls in the loop. + const wxWindowList children = m_staticBox->GetChildren(); + wxWindow* const parent = m_staticBox->GetParent(); + for ( wxWindowList::const_iterator i = children.begin(); + i != children.end(); + ++i ) + { + (*i)->Reparent(parent); + } + + delete m_staticBox; + } } void wxStaticBoxSizer::RecalcSizes() @@ -2580,18 +2706,11 @@ bool wxStaticBoxSizer::Detach( wxWindow *window ) wxStdDialogButtonSizer::wxStdDialogButtonSizer() : wxBoxSizer(wxHORIZONTAL) { - // Vertical buttons with lots of space on either side - // looks rubbish on WinCE, so let's not do this for now. - // If we are going to use vertical buttons, we should - // put the sizer to the right of other controls in the dialog, - // and that's beyond the scope of this sizer. -#ifndef __WXWINCE__ bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); // If we have a PDA screen, put yes/no button over // all other buttons, otherwise on the left side. if (is_pda) m_orient = wxVERTICAL; -#endif m_buttonAffirmative = NULL; m_buttonApply = NULL; diff --git a/Externals/wxWidgets3/src/common/slidercmn.cpp b/Externals/wxWidgets3/src/common/slidercmn.cpp index 8da1506d72..d5ce262db3 100644 --- a/Externals/wxWidgets3/src/common/slidercmn.cpp +++ b/Externals/wxWidgets3/src/common/slidercmn.cpp @@ -76,7 +76,7 @@ wxBEGIN_FLAGS( wxSliderStyle ) wxFLAGS_MEMBER(wxSL_INVERSE) wxEND_FLAGS( wxSliderStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl, "wx/slider.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl, "wx/slider.h"); wxBEGIN_PROPERTIES_TABLE(wxSlider) wxEVENT_RANGE_PROPERTY( Scroll, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxScrollEvent ) diff --git a/Externals/wxWidgets3/src/common/socket.cpp b/Externals/wxWidgets3/src/common/socket.cpp index bcb331fcc3..24214b1859 100644 --- a/Externals/wxWidgets3/src/common/socket.cpp +++ b/Externals/wxWidgets3/src/common/socket.cpp @@ -34,10 +34,12 @@ #include "wx/utils.h" #include "wx/timer.h" #include "wx/module.h" + #include "wx/filefn.h" #endif #include "wx/apptrait.h" #include "wx/sckaddr.h" +#include "wx/scopeguard.h" #include "wx/stopwatch.h" #include "wx/thread.h" #include "wx/evtloop.h" @@ -120,11 +122,11 @@ wxDEFINE_EVENT(wxEVT_SOCKET, wxSocketEvent); // wxWin macros // -------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxSocketBase, wxObject) -IMPLEMENT_CLASS(wxSocketServer, wxSocketBase) -IMPLEMENT_CLASS(wxSocketClient, wxSocketBase) -IMPLEMENT_CLASS(wxDatagramSocket, wxSocketBase) -IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent) +wxIMPLEMENT_CLASS(wxSocketBase, wxObject); +wxIMPLEMENT_CLASS(wxSocketServer, wxSocketBase); +wxIMPLEMENT_CLASS(wxSocketClient, wxSocketBase); +wxIMPLEMENT_CLASS(wxDatagramSocket, wxSocketBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent); // ---------------------------------------------------------------------------- // private functions @@ -527,6 +529,8 @@ wxSocketImpl *wxSocketImpl::Accept(wxSocketBase& wxsocket) WX_SOCKLEN_T fromlen = sizeof(from); const wxSOCKET_T fd = accept(m_fd, &from.addr, &fromlen); + wxScopeGuard closeSocket = wxMakeGuard(wxClose, fd); + // accepting is similar to reading in the sense that it resets "ready for // read" flag on the socket ReenableEvents(wxSOCKET_INPUT_FLAG); @@ -542,6 +546,8 @@ wxSocketImpl *wxSocketImpl::Accept(wxSocketBase& wxsocket) if ( !sock ) return NULL; + // Ownership of the socket now passes to wxSocketImpl object. + closeSocket.Dismiss(); sock->m_fd = fd; sock->m_peer = wxSockAddressImpl(from.addr, fromlen); @@ -2125,24 +2131,24 @@ wxDatagramSocket& wxDatagramSocket::SendTo( const wxSockAddress& addr, class wxSocketModule : public wxModule { public: - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { // wxSocketBase will call Initialize() itself only if sockets are // really used, don't do it from here return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { if ( wxSocketBase::IsInitialized() ) wxSocketBase::Shutdown(); } private: - DECLARE_DYNAMIC_CLASS(wxSocketModule) + wxDECLARE_DYNAMIC_CLASS(wxSocketModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule); #if defined(wxUSE_SELECT_DISPATCHER) && wxUSE_SELECT_DISPATCHER // NOTE: we need to force linking against socketiohandler.cpp otherwise in diff --git a/Externals/wxWidgets3/src/common/spinbtncmn.cpp b/Externals/wxWidgets3/src/common/spinbtncmn.cpp index 9f2de77485..050b85db40 100644 --- a/Externals/wxWidgets3/src/common/spinbtncmn.cpp +++ b/Externals/wxWidgets3/src/common/spinbtncmn.cpp @@ -70,7 +70,7 @@ wxBEGIN_FLAGS( wxSpinButtonStyle ) wxFLAGS_MEMBER(wxSP_WRAP) wxEND_FLAGS( wxSpinButtonStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinButton, wxControl, "wx/spinbutt.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinButton, wxControl, "wx/spinbutt.h"); wxBEGIN_PROPERTIES_TABLE(wxSpinButton) wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent ) @@ -92,7 +92,7 @@ wxEMPTY_HANDLERS_TABLE(wxSpinButton) wxCONSTRUCTOR_5( wxSpinButton, wxWindow*, Parent, wxWindowID, Id, \ wxPoint, Position, wxSize, Size, long, WindowStyle ) -IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent); #endif // wxUSE_SPINBTN diff --git a/Externals/wxWidgets3/src/common/spinctrlcmn.cpp b/Externals/wxWidgets3/src/common/spinctrlcmn.cpp index 4a0596b663..87b9f64776 100644 --- a/Externals/wxWidgets3/src/common/spinctrlcmn.cpp +++ b/Externals/wxWidgets3/src/common/spinctrlcmn.cpp @@ -69,7 +69,7 @@ wxFLAGS_MEMBER(wxSP_ARROW_KEYS) wxFLAGS_MEMBER(wxSP_WRAP) wxEND_FLAGS( wxSpinCtrlStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h"); wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl) wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent ) diff --git a/Externals/wxWidgets3/src/common/statbar.cpp b/Externals/wxWidgets3/src/common/statbar.cpp index 4746f7bd94..20ad5fe020 100644 --- a/Externals/wxWidgets3/src/common/statbar.cpp +++ b/Externals/wxWidgets3/src/common/statbar.cpp @@ -106,7 +106,7 @@ bool wxStatusBarPane::PopText() // wxStatusBarBase implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow); #include "wx/arrimpl.cpp" // This is a magic incantation which must be done! WX_DEFINE_EXPORTED_OBJARRAY(wxStatusBarPaneArray) diff --git a/Externals/wxWidgets3/src/common/statbmpcmn.cpp b/Externals/wxWidgets3/src/common/statbmpcmn.cpp index 5768c6c515..0b424c083a 100644 --- a/Externals/wxWidgets3/src/common/statbmpcmn.cpp +++ b/Externals/wxWidgets3/src/common/statbmpcmn.cpp @@ -64,7 +64,7 @@ wxBEGIN_FLAGS( wxStaticBitmapStyle ) wxEND_FLAGS( wxStaticBitmapStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBitmap, wxControl, "wx/statbmp.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBitmap, wxControl, "wx/statbmp.h"); wxBEGIN_PROPERTIES_TABLE(wxStaticBitmap) wxPROPERTY_FLAGS( WindowStyle, wxStaticBitmapStyle, long, \ diff --git a/Externals/wxWidgets3/src/common/statboxcmn.cpp b/Externals/wxWidgets3/src/common/statboxcmn.cpp index 5f0f05cbeb..3539c3c356 100644 --- a/Externals/wxWidgets3/src/common/statboxcmn.cpp +++ b/Externals/wxWidgets3/src/common/statboxcmn.cpp @@ -70,7 +70,7 @@ wxBEGIN_FLAGS( wxStaticBoxStyle ) wxFLAGS_MEMBER(wxHSCROLL) wxEND_FLAGS( wxStaticBoxStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl, "wx/statbox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl, "wx/statbox.h"); wxBEGIN_PROPERTIES_TABLE(wxStaticBox) wxPROPERTY( Label, wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/, \ diff --git a/Externals/wxWidgets3/src/common/statlinecmn.cpp b/Externals/wxWidgets3/src/common/statlinecmn.cpp index ce311dfccf..e4bda36055 100644 --- a/Externals/wxWidgets3/src/common/statlinecmn.cpp +++ b/Externals/wxWidgets3/src/common/statlinecmn.cpp @@ -65,7 +65,7 @@ wxBEGIN_FLAGS( wxStaticLineStyle ) wxFLAGS_MEMBER(wxLI_VERTICAL) wxEND_FLAGS( wxStaticLineStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticLine, wxControl, "wx/statline.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticLine, wxControl, "wx/statline.h"); wxBEGIN_PROPERTIES_TABLE(wxStaticLine) wxPROPERTY_FLAGS( WindowStyle, wxStaticLineStyle, long, SetWindowStyleFlag, \ diff --git a/Externals/wxWidgets3/src/common/stattextcmn.cpp b/Externals/wxWidgets3/src/common/stattextcmn.cpp index ba7d7f602a..f2960c928b 100644 --- a/Externals/wxWidgets3/src/common/stattextcmn.cpp +++ b/Externals/wxWidgets3/src/common/stattextcmn.cpp @@ -81,7 +81,7 @@ wxFLAGS_MEMBER(wxALIGN_RIGHT) wxFLAGS_MEMBER(wxALIGN_CENTRE) wxEND_FLAGS( wxStaticTextStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl, "wx/stattext.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl, "wx/stattext.h"); wxBEGIN_PROPERTIES_TABLE(wxStaticText) wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/, \ @@ -169,12 +169,12 @@ public: } protected: - virtual void OnOutputLine(const wxString& line) + virtual void OnOutputLine(const wxString& line) wxOVERRIDE { m_text += line; } - virtual void OnNewLine() + virtual void OnNewLine() wxOVERRIDE { m_text += wxT('\n'); } @@ -194,6 +194,17 @@ void wxStaticTextBase::Wrap(int width) wrapper.WrapLabel(this, width); } +void wxStaticTextBase::AutoResizeIfNecessary() +{ + // adjust the size of the window to fit to the label unless autoresizing is + // disabled + if ( !HasFlag(wxST_NO_AUTORESIZE) ) + { + DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, + wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + } +} + // ---------------------------------------------------------------------------- // wxStaticTextBase - generic implementation for wxST_ELLIPSIZE_* support // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/stdpbase.cpp b/Externals/wxWidgets3/src/common/stdpbase.cpp index 41e27e7724..143c4f117c 100644 --- a/Externals/wxWidgets3/src/common/stdpbase.cpp +++ b/Externals/wxWidgets3/src/common/stdpbase.cpp @@ -114,11 +114,6 @@ wxString wxStandardPathsBase::GetUserLocalDataDir() const return GetUserDataDir(); } -wxString wxStandardPathsBase::GetDocumentsDir() const -{ - return wxFileName::GetHomeDir(); -} - wxString wxStandardPathsBase::GetAppDocumentsDir() const { const wxString docsDir = GetDocumentsDir(); @@ -133,6 +128,11 @@ wxString wxStandardPathsBase::GetTempDir() const return wxFileName::GetTempDir(); } +wxString wxStandardPathsBase::GetUserDir(Dir WXUNUSED(userDir)) const +{ + return wxFileName::GetHomeDir(); +} + /* static */ wxString wxStandardPathsBase::AppendPathComponent(const wxString& dir, diff --git a/Externals/wxWidgets3/src/common/stdstream.cpp b/Externals/wxWidgets3/src/common/stdstream.cpp index f7a0cecf9e..b0472dbe20 100644 --- a/Externals/wxWidgets3/src/common/stdstream.cpp +++ b/Externals/wxWidgets3/src/common/stdstream.cpp @@ -252,29 +252,6 @@ wxStdOutputStreamBuffer::overflow(int c) // wxStdInputStream and wxStdOutputStream // ========================================================================== -// FIXME-VC6: it is impossible to call basic_ios::init() with this -// compiler, it complains about invalid call to non-static member -// function so use a suspicious (as it uses a pointer to not yet -// constructed streambuf) but working workaround -// -// It also doesn't like using istream in the ctor initializer list -// and we must spell it out as basic_istream. -#ifdef __VISUALC6__ - -wxStdInputStream::wxStdInputStream(wxInputStream& stream) - : std::basic_istream >(&m_streamBuffer), - m_streamBuffer(stream) -{ -} - -wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) - : std::basic_ostream >(&m_streamBuffer), - m_streamBuffer(stream) -{ -} - -#else // !VC6 - wxStdInputStream::wxStdInputStream(wxInputStream& stream) : std::istream(NULL), m_streamBuffer(stream) { @@ -287,6 +264,4 @@ wxStdOutputStream::wxStdOutputStream(wxOutputStream& stream) : std::ios::init(&m_streamBuffer); } -#endif // VC6/!VC6 - #endif // wxUSE_STREAMS && wxUSE_STD_IOSTREAM diff --git a/Externals/wxWidgets3/src/common/stopwatch.cpp b/Externals/wxWidgets3/src/common/stopwatch.cpp index 21c522f5d9..7c3c284058 100644 --- a/Externals/wxWidgets3/src/common/stopwatch.cpp +++ b/Externals/wxWidgets3/src/common/stopwatch.cpp @@ -59,20 +59,26 @@ struct PerfCounter init = false; } - bool CanBeUsed() const - { - return freq.QuadPart != 0; - } - wxCRIT_SECT_DECLARE_MEMBER(cs); LARGE_INTEGER freq; bool init; -} gs_perfCounter; +}; + +// Return the global perf counter state. +// +// This is wrapped in a function to avoid initialization order problems, +// otherwise simply creating a global wxStopWatch variable could crash because +// it would be using a (possibly) still uninitialized critical section. +PerfCounter& GetPerfCounterState() +{ + static PerfCounter s_perfCounter; + + return s_perfCounter; +} #endif // __WINDOWS__ const int MILLISECONDS_PER_SECOND = 1000; -const int MICROSECONDS_PER_MILLISECOND = 1000; const int MICROSECONDS_PER_SECOND = 1000*1000; } // anonymous namespace @@ -80,23 +86,13 @@ const int MICROSECONDS_PER_SECOND = 1000*1000; void wxStopWatch::DoStart() { #ifdef __WINDOWS__ - if ( !gs_perfCounter.init ) + PerfCounter& perfCounter = GetPerfCounterState(); + if ( !perfCounter.init ) { - wxCRIT_SECT_LOCKER(lock, gs_perfCounter.cs); - ::QueryPerformanceFrequency(&gs_perfCounter.freq); + wxCRIT_SECT_LOCKER(lock, perfCounter.cs); + ::QueryPerformanceFrequency(&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; + perfCounter.init = true; } #endif // __WINDOWS__ @@ -108,11 +104,8 @@ 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 + return GetPerfCounterState().freq.QuadPart; +#elif defined(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. @@ -120,7 +113,7 @@ wxLongLong wxStopWatch::GetClockFreq() const #else // !HAVE_GETTIMEOFDAY // Currently milliseconds are used everywhere else. return MILLISECONDS_PER_SECOND; -#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY +#endif // __WINDOWS__/HAVE_GETTIMEOFDAY/else } void wxStopWatch::Start(long t0) @@ -137,19 +130,14 @@ void wxStopWatch::Start(long t0) wxLongLong wxStopWatch::GetCurrentClockValue() const { #ifdef __WINDOWS__ - if ( gs_perfCounter.CanBeUsed() ) - { - LARGE_INTEGER counter; - ::QueryPerformanceCounter(&counter); - return counter.QuadPart; - } -#endif // __WINDOWS__ - -#ifdef HAVE_GETTIMEOFDAY + LARGE_INTEGER counter; + ::QueryPerformanceCounter(&counter); + return counter.QuadPart; +#elif defined(HAVE_GETTIMEOFDAY) return wxGetUTCTimeUSec(); #else // !HAVE_GETTIMEOFDAY return wxGetUTCTimeMillis(); -#endif // HAVE_GETTIMEOFDAY/!HAVE_GETTIMEOFDAY +#endif // __WINDOWS__/HAVE_GETTIMEOFDAY/else } wxLongLong wxStopWatch::TimeInMicro() const diff --git a/Externals/wxWidgets3/src/common/strconv.cpp b/Externals/wxWidgets3/src/common/strconv.cpp index a433128011..480d16251a 100644 --- a/Externals/wxWidgets3/src/common/strconv.cpp +++ b/Externals/wxWidgets3/src/common/strconv.cpp @@ -27,15 +27,13 @@ #include "wx/strconv.h" -#ifndef __WXWINCE__ #include -#endif #include #include #include -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if defined(__WIN32__) #include "wx/msw/private.h" #include "wx/msw/missing.h" #define wxHAVE_WIN32_MB2WC @@ -124,18 +122,12 @@ static size_t decode_utf16(const wxUint16* input, wxUint32& output) } } -#ifdef WC_UTF16 - typedef wchar_t wxDecodeSurrogate_t; -#else // !WC_UTF16 - typedef wxUint16 wxDecodeSurrogate_t; -#endif // WC_UTF16/!WC_UTF16 - // returns the next UTF-32 character from the wchar_t buffer and advances the // pointer to the character after this one // // if an invalid character is found, *pSrc is set to NULL, the caller must // check for this -static wxUint32 wxDecodeSurrogate(const wxDecodeSurrogate_t **pSrc) +static wxUint32 wxDecodeSurrogate(const wxChar16 **pSrc) { wxUint32 out; const size_t @@ -232,12 +224,6 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, if ( !srcEnd ) dstWritten++; - if ( !lenChunk ) - { - // nothing left in the input string, conversion succeeded - break; - } - if ( dst ) { if ( dstWritten > dstLen ) @@ -496,7 +482,12 @@ wxMBConv::cWC2MB(const wchar_t *inBuff, size_t inLen, size_t *outLen) const // the input is not wxCharBuffer buf(dstLen + nulLen - 1); memset(buf.data() + dstLen, 0, nulLen); - if ( FromWChar(buf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED ) + + // Notice that return value of the call to FromWChar() here may be + // different from the one above as it could have overestimated the + // space needed, while what we get here is the exact length. + dstLen = FromWChar(buf.data(), dstLen, inBuff, inLen); + if ( dstLen != wxCONV_FAILED ) { if ( outLen ) { @@ -1057,16 +1048,8 @@ wxMBConvStrictUTF8::ToWChar(wchar_t *dst, size_t dstLen, // length: static const unsigned char leadValueMask[] = { 0x7F, 0x1F, 0x0F, 0x07 }; - // mask and value of lead byte's most significant bits, by length: - static const unsigned char leadMarkerMask[] = { 0x80, 0xE0, 0xF0, 0xF8 }; - static const unsigned char leadMarkerVal[] = { 0x00, 0xC0, 0xE0, 0xF0 }; - len--; // it's more convenient to work with 0-based length here - // extract the lead byte's value bits: - if ( (c & leadMarkerMask[len]) != leadMarkerVal[len] ) - break; - code = c & leadValueMask[len]; // all remaining bytes, if any, are handled in the same way @@ -1138,13 +1121,30 @@ wxMBConvStrictUTF8::FromWChar(char *dst, size_t dstLen, wxUint32 code; #ifdef WC_UTF16 - // cast is ok for WC_UTF16 - if ( decode_utf16((const wxUint16 *)wp, code) == 2 ) + // Be careful here: decode_utf16() may need to read the next wchar_t + // but we might not have any left, so pass it a temporary buffer which + // always has 2 wide characters and take care to set its second element + // to 0, which is invalid as a second half of a surrogate, to ensure + // that we return an error when trying to convert a buffer ending with + // half of a surrogate. + wxUint16 tmp[2]; + tmp[0] = wp[0]; + tmp[1] = srcLen != 0 ? wp[1] : 0; + switch ( decode_utf16(tmp, code) ) { - // skip the next char too as we decoded a surrogate - wp++; - if ( srcLen != wxNO_LEN ) - srcLen--; + case 1: + // Nothing special to do, just a character from BMP. + break; + + case 2: + // skip the next char too as we decoded a surrogate + wp++; + if ( srcLen != wxNO_LEN ) + srcLen--; + break; + + case wxCONV_FAILED: + return wxCONV_FAILED; } #else // wchar_t is UTF-32 code = *wp & 0x7fffffff; @@ -1272,6 +1272,14 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, wxUint32 res = cc & (0x3f >> cnt); while (cnt--) { + if (!isNulTerminated && !srcLen) + { + // invalid UTF-8 sequence ending before the end of code + // point. + invalid = true; + break; + } + cc = *psz; if ((cc & 0xC0) != 0x80) { @@ -1281,6 +1289,8 @@ size_t wxMBConvUTF8::ToWChar(wchar_t *buf, size_t n, } psz++; + if (!isNulTerminated) + srcLen--; res = (res << 6) | (cc & 0x3f); } @@ -1403,7 +1413,12 @@ size_t wxMBConvUTF8::FromWChar(char *buf, size_t n, #ifdef WC_UTF16 // cast is ok for WC_UTF16 size_t pa = decode_utf16((const wxUint16 *)psz, cc); + + // we could have consumed two input code units if we decoded a + // surrogate, so adjust the input pointer and, if necessary, the length psz += (pa == wxCONV_FAILED) ? 1 : pa; + if ( pa == 2 && !isNulTerminated ) + srcLen--; #else cc = (*psz++) & 0x7fffffff; #endif @@ -1628,14 +1643,6 @@ wxMBConvUTF16straight::ToWChar(wchar_t *dst, size_t dstLen, return wxCONV_FAILED; const size_t inLen = srcLen / BYTES_PER_CHAR; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string even if the real size could be smaller if the buffer contains - // any surrogates - return inLen; - } - size_t outLen = 0; const wxUint16 *inBuff = reinterpret_cast(src); for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; ) @@ -1644,10 +1651,15 @@ wxMBConvUTF16straight::ToWChar(wchar_t *dst, size_t dstLen, if ( !inBuff ) return wxCONV_FAILED; - if ( ++outLen > dstLen ) - return wxCONV_FAILED; + outLen++; - *dst++ = ch; + if ( dst ) + { + if ( outLen > dstLen ) + return wxCONV_FAILED; + + *dst++ = ch; + } } @@ -1701,14 +1713,6 @@ wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, return wxCONV_FAILED; const size_t inLen = srcLen / BYTES_PER_CHAR; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string even if the real size could be smaller if the buffer contains - // any surrogates - return inLen; - } - size_t outLen = 0; const wxUint16 *inBuff = reinterpret_cast(src); for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; ) @@ -1717,8 +1721,18 @@ wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, wxUint16 tmp[2]; tmp[0] = wxUINT16_SWAP_ALWAYS(*inBuff); - inBuff++; - tmp[1] = wxUINT16_SWAP_ALWAYS(*inBuff); + if ( ++inBuff < inEnd ) + { + // Normal case, we have a next character to decode. + tmp[1] = wxUINT16_SWAP_ALWAYS(*inBuff); + } + else // End of input. + { + // Setting the second character to 0 ensures we correctly return + // wxCONV_FAILED if the first one is the first half of a surrogate + // as the second half can't be 0 in this case. + tmp[1] = 0; + } const size_t numChars = decode_utf16(tmp, ch); if ( numChars == wxCONV_FAILED ) @@ -1727,10 +1741,15 @@ wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, if ( numChars == 2 ) inBuff++; - if ( ++outLen > dstLen ) - return wxCONV_FAILED; + outLen++; - *dst++ = ch; + if ( dst ) + { + if ( outLen > dstLen ) + return wxCONV_FAILED; + + *dst++ = ch; + } } @@ -1862,18 +1881,6 @@ wxMBConvUTF32straight::FromWChar(char *dst, size_t dstLen, if ( srcLen == wxNO_LEN ) srcLen = wxWcslen(src) + 1; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string instead of the exact amount which could be less if there are - // any surrogates in the input - // - // we consider that surrogates are rare enough to make it worthwhile to - // avoid running the loop below at the cost of slightly extra memory - // consumption - return srcLen * BYTES_PER_CHAR; - } - wxUint32 *outBuff = reinterpret_cast(dst); size_t outLen = 0; for ( const wchar_t * const srcEnd = src + srcLen; src < srcEnd; ) @@ -1884,10 +1891,13 @@ wxMBConvUTF32straight::FromWChar(char *dst, size_t dstLen, outLen += BYTES_PER_CHAR; - if ( outLen > dstLen ) - return wxCONV_FAILED; + if ( outBuff ) + { + if ( outLen > dstLen ) + return wxCONV_FAILED; - *outBuff++ = ch; + *outBuff++ = ch; + } } return outLen; @@ -1940,18 +1950,6 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen, if ( srcLen == wxNO_LEN ) srcLen = wxWcslen(src) + 1; - if ( !dst ) - { - // optimization: return maximal space which could be needed for this - // string instead of the exact amount which could be less if there are - // any surrogates in the input - // - // we consider that surrogates are rare enough to make it worthwhile to - // avoid running the loop below at the cost of slightly extra memory - // consumption - return srcLen*BYTES_PER_CHAR; - } - wxUint32 *outBuff = reinterpret_cast(dst); size_t outLen = 0; for ( const wchar_t * const srcEnd = src + srcLen; src < srcEnd; ) @@ -1962,10 +1960,13 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen, outLen += BYTES_PER_CHAR; - if ( outLen > dstLen ) - return wxCONV_FAILED; + if ( outBuff ) + { + if ( outLen > dstLen ) + return wxCONV_FAILED; - *outBuff++ = wxUINT32_SWAP_ALWAYS(ch); + *outBuff++ = wxUINT32_SWAP_ALWAYS(ch); + } } return outLen; @@ -2122,16 +2123,16 @@ public: // implement base class virtual methods virtual size_t ToWChar(wchar_t *dst, size_t dstLen, - const char *src, size_t srcLen = wxNO_LEN) const; + const char *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; virtual size_t FromWChar(char *dst, size_t dstLen, - const wchar_t *src, size_t srcLen = wxNO_LEN) const; - virtual size_t GetMBNulLen() const; + const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE; + virtual size_t GetMBNulLen() const wxOVERRIDE; #if wxUSE_UNICODE_UTF8 - virtual bool IsUTF8() const; + virtual bool IsUTF8() const wxOVERRIDE; #endif - virtual wxMBConv *Clone() const + virtual wxMBConv *Clone() const wxOVERRIDE { wxMBConv_iconv *p = new wxMBConv_iconv(m_name); p->m_minMBCharWidth = m_minMBCharWidth; @@ -2576,11 +2577,9 @@ public: // wouldn't work if reading an incomplete MB char didn't result in an // error // - // Moreover, MB_ERR_INVALID_CHARS is only supported on Win 2K SP4 or - // Win XP or newer and it is not supported for UTF-[78] so we always - // use our own conversions in this case. See - // http://blogs.msdn.com/michkap/archive/2005/04/19/409566.aspx - // http://msdn.microsoft.com/library/en-us/intl/unicode_17si.asp + // Moreover, MB_ERR_INVALID_CHARS is not supported for UTF-8 under XP + // and for UTF-7 under any Windows version, so we always use our own + // conversions in this case. if ( m_CodePage == CP_UTF8 ) { return wxMBConvUTF8().MB2WC(buf, psz, n); @@ -2591,52 +2590,17 @@ public: return wxMBConvUTF7().MB2WC(buf, psz, n); } - int flags = 0; - if ( (m_CodePage < 50000 && m_CodePage != CP_SYMBOL) && - IsAtLeastWin2kSP4() ) - { - flags = MB_ERR_INVALID_CHARS; - } - const size_t len = ::MultiByteToWideChar ( m_CodePage, // code page - flags, // flags: fall on error + MB_ERR_INVALID_CHARS, // flags: fall on error psz, // input string -1, // its length (NUL-terminated) buf, // output string buf ? n : 0 // size of output buffer ); if ( !len ) - { - // function totally failed return wxCONV_FAILED; - } - - // if we were really converting and didn't use MB_ERR_INVALID_CHARS, - // check if we succeeded, by doing a double trip: - if ( !flags && buf ) - { - const size_t mbLen = strlen(psz); - wxCharBuffer mbBuf(mbLen); - if ( ::WideCharToMultiByte - ( - m_CodePage, - 0, - buf, - -1, - mbBuf.data(), - mbLen + 1, // size in bytes, not length - NULL, - NULL - ) == 0 || - strcmp(mbBuf, psz) != 0 ) - { - // we didn't obtain the same thing we started from, hence - // the conversion was lossy and we consider that it failed - return wxCONV_FAILED; - } - } // note that it returns count of written chars for buf != NULL and size // of the needed buffer for buf == NULL so in either case the length of @@ -2647,28 +2611,20 @@ public: virtual size_t WC2MB(char *buf, const wchar_t *pwz, size_t n) const { /* - we have a problem here: by default, WideCharToMultiByte() may - replace characters unrepresentable in the target code page with bad - quality approximations such as turning "1/2" symbol (U+00BD) into - "1" for the code pages which don't have it and we, obviously, want - to avoid this at any price + We need to WC_NO_BEST_FIT_CHARS to prevent WideCharToMultiByte() + from replacing characters unrepresentable in the target code page + with bad quality approximations such as turning "1/2" symbol + (U+00BD) into "1" for the code pages which don't have the fraction + symbol. - the trouble is that this function does it _silently_, i.e. it won't - even tell us whether it did or not... Win98/2000 and higher provide - WC_NO_BEST_FIT_CHARS but it doesn't work for the older systems and - we have to resort to a round trip, i.e. check that converting back - results in the same string -- this is, of course, expensive but - otherwise we simply can't be sure to not garble the data. + Unfortunately this flag can't be used with CJK encodings nor + UTF-7/8 and so if the code page is one of those, we need to resort + to a round trip to verify that no replacements have been done. */ - - // determine if we can rely on WC_NO_BEST_FIT_CHARS: according to MSDN - // it doesn't work with CJK encodings (which we test for rather roughly - // here...) nor with UTF-7/8 nor, of course, with Windows versions not - // supporting it BOOL usedDef wxDUMMY_INITIALIZE(false); BOOL *pUsedDef; int flags; - if ( CanUseNoBestFit() && m_CodePage < 50000 ) + if ( m_CodePage < 50000 ) { // it's our lucky day flags = WC_NO_BEST_FIT_CHARS; @@ -2781,63 +2737,6 @@ public: bool IsOk() const { return m_CodePage != -1; } private: - static bool CanUseNoBestFit() - { - static int s_isWin98Or2k = -1; - - if ( s_isWin98Or2k == -1 ) - { - int verMaj, verMin; - switch ( wxGetOsVersion(&verMaj, &verMin) ) - { - case wxOS_WINDOWS_9X: - s_isWin98Or2k = verMaj >= 4 && verMin >= 10; - break; - - case wxOS_WINDOWS_NT: - s_isWin98Or2k = verMaj >= 5; - break; - - default: - // unknown: be conservative by default - s_isWin98Or2k = 0; - break; - } - - wxASSERT_MSG( s_isWin98Or2k != -1, wxT("should be set above") ); - } - - return s_isWin98Or2k == 1; - } - - static bool IsAtLeastWin2kSP4() - { -#ifdef __WXWINCE__ - return false; -#else - static int s_isAtLeastWin2kSP4 = -1; - - if ( s_isAtLeastWin2kSP4 == -1 ) - { - OSVERSIONINFOEX ver; - - memset(&ver, 0, sizeof(ver)); - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx((OSVERSIONINFO*)&ver); - - s_isAtLeastWin2kSP4 = - ((ver.dwMajorVersion > 5) || // Vista+ - (ver.dwMajorVersion == 5 && ver.dwMinorVersion > 0) || // XP/2003 - (ver.dwMajorVersion == 5 && ver.dwMinorVersion == 0 && - ver.wServicePackMajor >= 4)) // 2000 SP4+ - ? 1 : 0; - } - - return s_isAtLeastWin2kSP4 == 1; -#endif - } - - // the code page we're working with long m_CodePage; @@ -2887,7 +2786,7 @@ public: Init(); } - size_t MB2WC(wchar_t *buf, const char *psz, size_t WXUNUSED(n)) const + size_t MB2WC(wchar_t *buf, const char *psz, size_t WXUNUSED(n)) const wxOVERRIDE { size_t inbuf = strlen(psz); if (buf) @@ -2898,7 +2797,7 @@ public: return inbuf; } - size_t WC2MB(char *buf, const wchar_t *psz, size_t WXUNUSED(n)) const + size_t WC2MB(char *buf, const wchar_t *psz, size_t WXUNUSED(n)) const wxOVERRIDE { const size_t inbuf = wxWcslen(psz); if (buf) @@ -2910,7 +2809,7 @@ public: return inbuf; } - virtual size_t GetMBNulLen() const + virtual size_t GetMBNulLen() const wxOVERRIDE { switch ( m_enc ) { @@ -2927,7 +2826,7 @@ public: } } - virtual wxMBConv *Clone() const { return new wxMBConv_wxwin(m_enc); } + virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConv_wxwin(m_enc); } bool IsOk() const { return m_ok; } @@ -3363,36 +3262,40 @@ bool wxCSConv::IsUTF8() const #endif -#if wxUSE_UNICODE +// ============================================================================ +// wxWhateverWorksConv +// ============================================================================ -wxWCharBuffer wxSafeConvertMB2WX(const char *s) +size_t +wxWhateverWorksConv::ToWChar(wchar_t *dst, size_t dstLen, + const char *src, size_t srcLen) const { - if ( !s ) - return wxWCharBuffer(); + size_t rc = wxConvUTF8.ToWChar(dst, dstLen, src, srcLen); + if ( rc != wxCONV_FAILED ) + return rc; - wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s)); - if ( !wbuf ) - wbuf = wxMBConvUTF8().cMB2WX(s); - if ( !wbuf ) - wbuf = wxConvISO8859_1.cMB2WX(s); + rc = wxConvLibc.ToWChar(dst, dstLen, src, srcLen); + if ( rc != wxCONV_FAILED ) + return rc; - return wbuf; + rc = wxConvISO8859_1.ToWChar(dst, dstLen, src, srcLen); + + return rc; } -wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) +size_t +wxWhateverWorksConv::FromWChar(char *dst, size_t dstLen, + const wchar_t *src, size_t srcLen) const { - if ( !ws ) - return wxCharBuffer(); + size_t rc = wxConvLibc.FromWChar(dst, dstLen, src, srcLen); + if ( rc != wxCONV_FAILED ) + return rc; - wxCharBuffer buf(wxConvLibc.cWX2MB(ws)); - if ( !buf ) - buf = wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL).cWX2MB(ws); + rc = wxConvUTF8.FromWChar(dst, dstLen, src, srcLen); - return buf; + return rc; } -#endif // wxUSE_UNICODE - // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -3407,6 +3310,7 @@ wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) #undef wxConvLibc #undef wxConvUTF8 #undef wxConvUTF7 +#undef wxConvWhateverWorks #undef wxConvLocal #undef wxConvISO8859_1 @@ -3446,6 +3350,7 @@ wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) // empty statement (and hope that no compilers warns about this) WX_DEFINE_GLOBAL_CONV(wxMBConvStrictUTF8, wxConvUTF8, ;); WX_DEFINE_GLOBAL_CONV(wxMBConvUTF7, wxConvUTF7, ;); +WX_DEFINE_GLOBAL_CONV(wxWhateverWorksConv, wxConvWhateverWorks, ;); WX_DEFINE_GLOBAL_CONV(wxCSConv, wxConvLocal, (wxFONTENCODING_SYSTEM)); WX_DEFINE_GLOBAL_CONV(wxCSConv, wxConvISO8859_1, (wxFONTENCODING_ISO8859_1)); @@ -3464,5 +3369,5 @@ WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName = #ifdef __DARWIN__ &wxConvMacUTF8DObj; #else // !__DARWIN__ - wxGet_wxConvLibcPtr(); + wxGet_wxConvWhateverWorksPtr(); #endif // __DARWIN__/!__DARWIN__ diff --git a/Externals/wxWidgets3/src/common/stream.cpp b/Externals/wxWidgets3/src/common/stream.cpp index fd50f8beac..97ba7588e7 100644 --- a/Externals/wxWidgets3/src/common/stream.cpp +++ b/Externals/wxWidgets3/src/common/stream.cpp @@ -390,7 +390,7 @@ char wxStreamBuffer::GetChar() size_t wxStreamBuffer::Read(void *buffer, size_t size) { - wxASSERT_MSG( buffer, wxT("Warning: Null pointer is about to be used") ); + wxCHECK_MSG( buffer, 0, wxT("NULL data pointer") ); /* Clear buffer first */ memset(buffer, 0x00, size); @@ -471,7 +471,7 @@ size_t wxStreamBuffer::Read(wxStreamBuffer *dbuf) size_t wxStreamBuffer::Write(const void *buffer, size_t size) { - wxASSERT_MSG( buffer, wxT("Warning: Null pointer is about to be send") ); + wxCHECK_MSG( buffer, 0, wxT("NULL data pointer") ); if (m_stream) { @@ -676,7 +676,7 @@ wxFileOffset wxStreamBuffer::Tell() const // wxStreamBase // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxStreamBase, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxStreamBase, wxObject); wxStreamBase::wxStreamBase() { @@ -714,7 +714,7 @@ wxFileOffset wxStreamBase::OnSysTell() const // wxInputStream // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxStreamBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxInputStream, wxStreamBase); wxInputStream::wxInputStream() { @@ -771,7 +771,7 @@ char *wxInputStream::AllocSpaceWBack(size_t needed_size) size_t wxInputStream::GetWBack(void *buf, size_t size) { - wxASSERT_MSG( buf, wxT("Warning: Null pointer is about to be used") ); + wxCHECK_MSG( buf, 0, wxT("NULL data pointer") ); /* Clear buffer first */ memset(buf, 0x00, size); @@ -807,7 +807,7 @@ size_t wxInputStream::GetWBack(void *buf, size_t size) size_t wxInputStream::Ungetch(const void *buf, size_t bufsize) { - wxASSERT_MSG( buf, wxT("Warning: Null pointer is about to be used in Ungetch()") ); + wxCHECK_MSG( buf, 0, wxT("NULL data pointer") ); if ( m_lasterror != wxSTREAM_NO_ERROR && m_lasterror != wxSTREAM_EOF ) { @@ -841,7 +841,7 @@ int wxInputStream::GetC() wxInputStream& wxInputStream::Read(void *buf, size_t size) { - wxASSERT_MSG( buf, wxT("Warning: Null pointer is about to be read") ); + wxCHECK_MSG( buf, *this, wxT("NULL data pointer") ); char *p = (char *)buf; m_lastcount = 0; @@ -1037,7 +1037,7 @@ wxFileOffset wxInputStream::TellI() const // wxOutputStream // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxStreamBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxOutputStream, wxStreamBase); wxOutputStream::wxOutputStream() { @@ -1121,7 +1121,7 @@ void wxOutputStream::Sync() // wxCountingOutputStream // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCountingOutputStream, wxOutputStream) +wxIMPLEMENT_DYNAMIC_CLASS(wxCountingOutputStream, wxOutputStream); wxCountingOutputStream::wxCountingOutputStream () { @@ -1186,7 +1186,7 @@ wxFileOffset wxCountingOutputStream::OnSysTell() const // wxFilterInputStream // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFilterInputStream, wxInputStream) +wxIMPLEMENT_ABSTRACT_CLASS(wxFilterInputStream, wxInputStream); wxFilterInputStream::wxFilterInputStream() : m_parent_i_stream(NULL), @@ -1216,7 +1216,7 @@ wxFilterInputStream::~wxFilterInputStream() // wxFilterOutputStream // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFilterOutputStream, wxOutputStream) +wxIMPLEMENT_ABSTRACT_CLASS(wxFilterOutputStream, wxOutputStream); wxFilterOutputStream::wxFilterOutputStream() : m_parent_o_stream(NULL), @@ -1254,7 +1254,7 @@ wxFilterOutputStream::~wxFilterOutputStream() // wxFilterClassFactoryBase // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactoryBase, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactoryBase, wxObject); wxString wxFilterClassFactoryBase::PopExtension(const wxString& location) const { @@ -1290,7 +1290,7 @@ bool wxFilterClassFactoryBase::CanHandle(const wxString& protocol, // wxFilterClassFactory // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxFilterClassFactoryBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxFilterClassFactoryBase); wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL; @@ -1488,8 +1488,11 @@ wxFileOffset wxBufferedOutputStream::TellO() const void wxBufferedOutputStream::Sync() { - m_o_streambuf->FlushBuffer(); - m_parent_o_stream->Sync(); + if (m_o_streambuf) + { + m_o_streambuf->FlushBuffer(); + m_parent_o_stream->Sync(); + } } size_t wxBufferedOutputStream::OnSysWrite(const void *buffer, size_t bufsize) diff --git a/Externals/wxWidgets3/src/common/string.cpp b/Externals/wxWidgets3/src/common/string.cpp index a2f18a8b49..feb6d8e501 100644 --- a/Externals/wxWidgets3/src/common/string.cpp +++ b/Externals/wxWidgets3/src/common/string.cpp @@ -29,9 +29,7 @@ #include -#ifndef __WXWINCE__ - #include -#endif +#include #include #include @@ -48,18 +46,16 @@ #include #endif +#ifndef HAVE_STD_STRING_COMPARE // string handling functions used by wxString: #if wxUSE_UNICODE_UTF8 - #define wxStringMemcpy memcpy #define wxStringMemcmp memcmp - #define wxStringMemchr memchr #define wxStringStrlen strlen #else - #define wxStringMemcpy wxTmemcpy #define wxStringMemcmp wxTmemcmp - #define wxStringMemchr wxTmemchr #define wxStringStrlen wxStrlen #endif +#endif // define a function declared in wx/buffer.h here as we don't have buffer.cpp // and don't want to add it just because of this simple function @@ -195,13 +191,7 @@ static wxStrCacheStatsDumper s_showCacheStats; wxSTD ostream& operator<<(wxSTD ostream& os, const wxCStrData& str) { #if wxUSE_UNICODE && !wxUSE_UNICODE_UTF8 - const wxScopedCharBuffer buf(str.AsCharBuf()); - if ( !buf ) - os.clear(wxSTD ios_base::failbit); - else - os << buf.data(); - - return os; + return os << wxConvWhateverWorks.cWX2MB(str); #else return os << str.AsInternal(); #endif @@ -1185,7 +1175,7 @@ wxString wxString::FromAscii(const char *ascii, size_t len) wxASSERT_MSG( c < 0x80, wxT("Non-ASCII value passed to FromAscii().") ); - *dest++ = (wchar_t)c; + *dest++ = static_cast(c); } } @@ -1209,7 +1199,7 @@ wxString wxString::FromAscii(char ascii) return wxString(wxUniChar((wchar_t)c)); } -const wxScopedCharBuffer wxString::ToAscii() const +const wxScopedCharBuffer wxString::ToAscii(char replaceWith) const { // this will allocate enough space for the terminating NUL too wxCharBuffer buffer(length()); @@ -1219,7 +1209,7 @@ const wxScopedCharBuffer wxString::ToAscii() const { wxUniChar c(*i); // FIXME-UTF8: unify substituted char ('_') with wxUniChar ('?') - *dest++ = c.IsAscii() ? (char)c : '_'; + *dest++ = c.IsAscii() ? (char)c : replaceWith; // the output string can't have embedded NULs anyhow, so we can safely // stop at first of them even if we do have any @@ -1244,17 +1234,17 @@ wxString wxString::Mid(size_t nFirst, size_t nCount) const } // out-of-bounds requests return sensible things - if ( nFirst + nCount > nLen ) - { - nCount = nLen - nFirst; - } - if ( nFirst > nLen ) { // AllocCopy() will return empty string return wxEmptyString; } + if ( nCount > nLen - nFirst ) + { + nCount = nLen - nFirst; + } + wxString dest(*this, nFirst, nCount); if ( dest.length() != nCount ) { @@ -1673,15 +1663,9 @@ int wxString::Find(wxUniChar ch, bool bFromEnd) const // it out. Note that number extraction works correctly on UTF-8 strings, so // we can use wxStringCharType and wx_str() for maximum efficiency. -#ifndef __WXWINCE__ - #define DO_IF_NOT_WINCE(x) x -#else - #define DO_IF_NOT_WINCE(x) -#endif - #define WX_STRING_TO_X_TYPE_START \ wxCHECK_MSG( pVal, false, wxT("NULL output pointer") ); \ - DO_IF_NOT_WINCE( errno = 0; ) \ + errno = 0; \ const wxStringCharType *start = wx_str(); \ wxStringCharType *end; @@ -1689,7 +1673,7 @@ int wxString::Find(wxUniChar ch, bool bFromEnd) const // nothing could be parsed but we do modify it and return false then if we did // parse something successfully but not the entire string #define WX_STRING_TO_X_TYPE_END \ - if ( end == start DO_IF_NOT_WINCE(|| errno == ERANGE) ) \ + if ( end == start || errno == ERANGE ) \ return false; \ *pVal = val; \ return !*end; @@ -1797,6 +1781,8 @@ bool wxString::ToCULong(unsigned long *pVal, int base) const // point which is different in different locales. bool wxString::ToCDouble(double *pVal) const { + // See the explanations in FromCDouble() below for the reasons for all this. + // Create a copy of this string using the decimal point instead of whatever // separator the current locale uses. #if wxUSE_INTL @@ -1854,20 +1840,19 @@ wxString wxString::FromCDouble(double val, int precision) { wxCHECK_MSG( precision >= -1, wxString(), "Invalid negative precision" ); -#if wxUSE_STD_IOSTREAM && wxUSE_STD_STRING - // We assume that we can use the ostream and not wstream for numbers. - wxSTD ostringstream os; - if ( precision != -1 ) - { - os.precision(precision); - os.setf(std::ios::fixed, std::ios::floatfield); - } + // Unfortunately there is no good way to get the number directly in the C + // locale. Some platforms provide special functions to do this (e.g. + // _sprintf_l() in MSVS or sprintf_l() in BSD systems), but some systems we + // still support don't have them and it doesn't seem worth it to have two + // different ways to do the same thing. Also, in principle, using the + // standard C++ streams should allow us to do it, but some implementations + // of them are horribly broken and actually change the global C locale, + // thus randomly affecting the results produced in other threads, when + // imbue() stream method is called (for the record, the latest libstdc++ + // version included in OS X does it and so seem to do the versions + // currently included in Android NDK and both FreeBSD and OpenBSD), so we + // can't do this neither and are reduced to this hack. - os << val; - return os.str(); -#else // !wxUSE_STD_IOSTREAM - // Can't use iostream locale support, fall back to the manual method - // instead. wxString s = FromDouble(val, precision); #if wxUSE_INTL wxString sep = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, @@ -1881,7 +1866,6 @@ wxString wxString::FromCDouble(double val, int precision) s.Replace(sep, "."); return s; -#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM } // --------------------------------------------------------------------------- @@ -2060,10 +2044,8 @@ static int DoStringPrintfV(wxString& str, va_list argptrcopy; wxVaCopy(argptrcopy, argptr); -#ifndef __WXWINCE__ // Set errno to 0 to make it determinate if wxVsnprintf fails to set it. errno = 0; -#endif int len = wxVsnprintf(buf, size, format, argptrcopy); va_end(argptrcopy); @@ -2093,13 +2075,11 @@ static int DoStringPrintfV(wxString& str, // assume it only returns error if there is not enough space, but // as we don't know how much we need, double the current size of // the buffer -#ifndef __WXWINCE__ if( (errno == EILSEQ) || (errno == EINVAL) ) // If errno was set to one of the two well-known hard errors // then fail immediately to avoid an infinite loop. return -1; else -#endif // __WXWINCE__ // still not enough, as we don't know how much we need, double the // current size of the buffer size *= 2; @@ -2203,7 +2183,7 @@ bool wxString::Matches(const wxString& mask) const // (however note that we don't quote '[' and ']' to allow // using them for Unix shell like matching) pattern += wxT('\\'); - // fall through + wxFALLTHROUGH; default: pattern += *pszMask; diff --git a/Externals/wxWidgets3/src/common/stringimpl.cpp b/Externals/wxWidgets3/src/common/stringimpl.cpp index 3dad9eb3c0..22ad32324e 100644 --- a/Externals/wxWidgets3/src/common/stringimpl.cpp +++ b/Externals/wxWidgets3/src/common/stringimpl.cpp @@ -34,31 +34,11 @@ #include -#ifndef __WXWINCE__ - #include -#endif +#include #include #include -// allocating extra space for each string consumes more memory but speeds up -// the concatenation operations (nLen is the current string's length) -// NB: EXTRA_ALLOC must be >= 0! -#define EXTRA_ALLOC (19 - nLen % 16) - - -// string handling functions used by wxString: -#if wxUSE_UNICODE_UTF8 - #define wxStringMemcpy memcpy - #define wxStringMemcmp memcmp - #define wxStringMemchr memchr -#else - #define wxStringMemcpy wxTmemcpy - #define wxStringMemcmp wxTmemcmp - #define wxStringMemchr wxTmemchr -#endif - - // --------------------------------------------------------------------------- // static class variables definition // --------------------------------------------------------------------------- @@ -82,6 +62,22 @@ const wxChar WXDLLIMPEXP_BASE *wxEmptyString = wxT(""); #else +// allocating extra space for each string consumes more memory but speeds up +// the concatenation operations (nLen is the current string's length) +// NB: EXTRA_ALLOC must be >= 0! +#define EXTRA_ALLOC (19 - nLen % 16) + +// string handling functions used by wxString: +#if wxUSE_UNICODE_UTF8 + #define wxStringMemcpy memcpy + #define wxStringMemcmp memcmp + #define wxStringMemchr memchr +#else + #define wxStringMemcpy wxTmemcpy + #define wxStringMemcmp wxTmemcmp + #define wxStringMemchr wxTmemchr +#endif + // for an empty string, GetStringData() will return this address: this // structure has the same layout as wxStringData and it's data() method will // return the empty string (dummy pointer) diff --git a/Externals/wxWidgets3/src/common/stringops.cpp b/Externals/wxWidgets3/src/common/stringops.cpp index 1592706872..36ff4045a4 100644 --- a/Externals/wxWidgets3/src/common/stringops.cpp +++ b/Externals/wxWidgets3/src/common/stringops.cpp @@ -94,7 +94,7 @@ bool wxStringOperationsUtf8::IsValidUtf8String(const char *str, size_t len) const unsigned char *c = (const unsigned char*)str; const unsigned char * const end = (len == wxStringImpl::npos) ? NULL : c + len; - for ( ; c != end && *c; ++c ) + for ( ; end != NULL ? c != end : *c; ++c ) { unsigned char b = *c; diff --git a/Externals/wxWidgets3/src/common/strvararg.cpp b/Externals/wxWidgets3/src/common/strvararg.cpp index 9112bbf8f9..d4550dbfd1 100644 --- a/Externals/wxWidgets3/src/common/strvararg.cpp +++ b/Externals/wxWidgets3/src/common/strvararg.cpp @@ -198,6 +198,17 @@ public: switch ( *format ) { +#ifdef __VISUALC__ + case 'z': + // Used for size_t printing (e.g. %zu) and is in C99, + // but is not portable, MSVC uses 'I' with the same + // meaning. + ChangeFmtChar('I'); + format++; + size = Size_Default; + break; +#endif // __VISUALC__ + case 'h': size = Size_Short; format++; @@ -211,7 +222,7 @@ public: format++; break; } - //else: fall through + wxFALLTHROUGH; default: size = Size_Default; @@ -341,6 +352,18 @@ private: *(m_fmtLast++) = ch; } + // change a character + void ChangeFmtChar(CharType ch) + { + if ( m_fmtOrig ) + { + // so far we haven't translated anything yet + CopyAllBefore(); + } + + *m_fmtLast = ch; + } + void CopyAllBefore() { wxASSERT_MSG( m_fmtOrig && m_fmt.data() == NULL, "logic error" ); @@ -387,7 +410,13 @@ private: size_t m_nCopied; }; -#if defined(__WINDOWS__) && !defined(__CYGWIN__) +// Distinguish between the traditional Windows (and MSVC) behaviour and Cygwin +// (which is always Unix-like) and MinGW which can use either depending on the +// "ANSI stdio" option value (which is normally set to either 0 or 1, but test +// for it in a way which works even if it's not defined at all, just in case). +#if defined(__WINDOWS__) && \ + !defined(__CYGWIN__) && \ + (!defined(__MINGW32__) || (__USE_MINGW_ANSI_STDIO +0 == 0)) // on Windows, we should use %s and %c regardless of the build: class wxPrintfFormatConverterWchar : public wxFormatConverterBase @@ -418,7 +447,7 @@ class wxPrintfFormatConverterWchar : public wxFormatConverterBase { virtual void HandleString(CharType WXUNUSED(conv), SizeModifier WXUNUSED(size), - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { outConv = 's'; outSize = Size_Long; @@ -426,7 +455,7 @@ class wxPrintfFormatConverterWchar : public wxFormatConverterBase virtual void HandleChar(CharType WXUNUSED(conv), SizeModifier WXUNUSED(size), - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { outConv = 'c'; outSize = Size_Long; @@ -441,7 +470,7 @@ class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase { virtual void HandleString(CharType WXUNUSED(conv), SizeModifier WXUNUSED(size), - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { outConv = 's'; outSize = Size_Default; @@ -449,7 +478,7 @@ class wxPrintfFormatConverterUtf8 : public wxFormatConverterBase virtual void HandleChar(CharType WXUNUSED(conv), SizeModifier WXUNUSED(size), - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { // chars are represented using wchar_t in both builds, so this is // the same as above @@ -499,14 +528,14 @@ class wxPrintfFormatConverterANSI : public wxFormatConverterBase class wxScanfFormatConverterWchar : public wxFormatConverterBase { virtual void HandleString(CharType conv, SizeModifier size, - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { outConv = 's'; outSize = GetOutSize(conv == 'S', size); } virtual void HandleChar(CharType conv, SizeModifier size, - CharType& outConv, SizeModifier& outSize) + CharType& outConv, SizeModifier& outSize) wxOVERRIDE { outConv = 'c'; outSize = GetOutSize(conv == 'C', size); @@ -654,8 +683,17 @@ wxFormatString::ArgumentType DoGetArgumentType(const CharType *format, wxPrintfConvSpecParser parser(format); - wxCHECK_MSG( n <= parser.nargs, wxFormatString::Arg_Unknown, - "more arguments than format string specifiers?" ); + if ( n > parser.nargs ) + { + // The n-th argument doesn't appear in the format string and is unused. + // This can happen e.g. if a translation of the format string is used + // and the translation language tends to avoid numbers in singular forms. + // The translator would then typically replace "%d" with "One" (e.g. in + // Hebrew). Passing too many vararg arguments does not harm, so its + // better to be more permissive here and allow legitimate uses in favour + // of catching harmless errors. + return wxFormatString::Arg_Unused; + } wxCHECK_MSG( parser.pspec[n-1] != NULL, wxFormatString::Arg_Unknown, "requested argument not found - invalid format string?" ); diff --git a/Externals/wxWidgets3/src/common/tarstrm.cpp b/Externals/wxWidgets3/src/common/tarstrm.cpp index 87074cc278..944835e927 100644 --- a/Externals/wxWidgets3/src/common/tarstrm.cpp +++ b/Externals/wxWidgets3/src/common/tarstrm.cpp @@ -85,8 +85,8 @@ static const char *USTAR_VERSION = "00"; static const char *GNU_MAGIC = "ustar "; static const char *GNU_VERION = " "; -IMPLEMENT_DYNAMIC_CLASS(wxTarEntry, wxArchiveEntry) -IMPLEMENT_DYNAMIC_CLASS(wxTarClassFactory, wxArchiveClassFactory) +wxIMPLEMENT_DYNAMIC_CLASS(wxTarEntry, wxArchiveEntry); +wxIMPLEMENT_DYNAMIC_CLASS(wxTarClassFactory, wxArchiveClassFactory); ///////////////////////////////////////////////////////////////////////////// @@ -902,7 +902,7 @@ wxTarNumber wxTarInputStream::GetHeaderNumber(int id) const if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) { wxTarNumber n = 0; wxString::const_iterator p = value.begin(); - while (*p == ' ' && p != value.end()) + while (p != value.end() && *p == ' ') p++; while (isdigit(*p)) n = n * 10 + (*p++ - '0'); @@ -1121,7 +1121,7 @@ bool wxTarOutputStream::PutNextEntry(wxTarEntry *entry) if (m_tarstart != wxInvalidOffset) m_datapos = m_tarstart + m_tarsize; - // types that are not allowd any data + // types that are not allowed any data const char nodata[] = { wxTAR_LNKTYPE, wxTAR_SYMTYPE, wxTAR_CHRTYPE, wxTAR_BLKTYPE, wxTAR_DIRTYPE, wxTAR_FIFOTYPE, 0 diff --git a/Externals/wxWidgets3/src/common/taskbarcmn.cpp b/Externals/wxWidgets3/src/common/taskbarcmn.cpp index 54133a57df..5a8a7728d4 100644 --- a/Externals/wxWidgets3/src/common/taskbarcmn.cpp +++ b/Externals/wxWidgets3/src/common/taskbarcmn.cpp @@ -41,9 +41,9 @@ wxDEFINE_EVENT( wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEvent ); wxDEFINE_EVENT( wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEvent ); -BEGIN_EVENT_TABLE(wxTaskBarIconBase, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxTaskBarIconBase, wxEvtHandler) EVT_TASKBAR_CLICK(wxTaskBarIconBase::OnRightButtonDown) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxTaskBarIconBase::OnRightButtonDown(wxTaskBarIconEvent& WXUNUSED(event)) { diff --git a/Externals/wxWidgets3/src/common/tbarbase.cpp b/Externals/wxWidgets3/src/common/tbarbase.cpp index e36d96eccf..a5b9192dac 100644 --- a/Externals/wxWidgets3/src/common/tbarbase.cpp +++ b/Externals/wxWidgets3/src/common/tbarbase.cpp @@ -43,8 +43,8 @@ extern WXDLLEXPORT_DATA(const char) wxToolBarNameStr[] = "toolbar"; // wxWidgets macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxToolBarBase, wxControl) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxToolBarBase, wxControl) +wxEND_EVENT_TABLE() #include "wx/listimpl.cpp" @@ -58,7 +58,7 @@ WX_DEFINE_LIST(wxToolBarToolsList) // wxToolBarToolBase // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxToolBarToolBase, wxObject); wxToolBarToolBase::~wxToolBarToolBase() { @@ -437,6 +437,12 @@ void wxToolBarBase::ClearTools() void wxToolBarBase::AdjustToolBitmapSize() { + if ( HasFlag(wxTB_NOICONS) ) + { + SetToolBitmapSize(wxSize(0, 0)); + return; + } + const wxSize sizeOrig(m_defaultWidth, m_defaultHeight); wxSize sizeActual(sizeOrig); @@ -447,7 +453,7 @@ void wxToolBarBase::AdjustToolBitmapSize() { const wxBitmap& bmp = (*i)->GetNormalBitmap(); if ( bmp.IsOk() ) - sizeActual.IncTo(bmp.GetSize()); + sizeActual.IncTo(bmp.GetScaledSize()); } if ( sizeActual != sizeOrig ) diff --git a/Externals/wxWidgets3/src/common/textbuf.cpp b/Externals/wxWidgets3/src/common/textbuf.cpp index 406043e58e..2ce760d737 100644 --- a/Externals/wxWidgets3/src/common/textbuf.cpp +++ b/Externals/wxWidgets3/src/common/textbuf.cpp @@ -36,12 +36,10 @@ // default type is the native one const wxTextFileType wxTextBuffer::typeDefault = -#if defined(__WINDOWS__) || defined(__DOS__) +#if defined(__WINDOWS__) wxTextFileType_Dos; #elif defined(__UNIX__) wxTextFileType_Unix; -#elif defined(__OS2__) - wxTextFileType_Os2; #else wxTextFileType_None; #error "wxTextBuffer: unsupported platform." @@ -52,7 +50,7 @@ const wxChar *wxTextBuffer::GetEOL(wxTextFileType type) switch ( type ) { default: wxFAIL_MSG(wxT("bad buffer type in wxTextBuffer::GetEOL.")); - // fall through nevertheless - we must return something... + wxFALLTHROUGH; // fall through nevertheless - we must return something... case wxTextFileType_None: return wxEmptyString; case wxTextFileType_Unix: return wxT("\n"); @@ -244,7 +242,6 @@ wxTextFileType wxTextBuffer::GuessType() const ? wxTextFileType_##t1 \ : wxTextFileType_##t2 -#if !defined(__WATCOMC__) || wxCHECK_WATCOM_VERSION(1,4) if ( nDos > nUnix ) return GREATER_OF(Dos, Mac); else if ( nDos < nUnix ) @@ -253,7 +250,6 @@ wxTextFileType wxTextBuffer::GuessType() const // nDos == nUnix return nMac > nDos ? wxTextFileType_Mac : typeDefault; } -#endif // __WATCOMC__ #undef GREATER_OF } diff --git a/Externals/wxWidgets3/src/common/textcmn.cpp b/Externals/wxWidgets3/src/common/textcmn.cpp index 4cba1dec5b..2774635bbe 100644 --- a/Externals/wxWidgets3/src/common/textcmn.cpp +++ b/Externals/wxWidgets3/src/common/textcmn.cpp @@ -99,7 +99,7 @@ wxFLAGS_MEMBER(wxTE_CHARWRAP) wxFLAGS_MEMBER(wxTE_WORDWRAP) wxEND_FLAGS( wxTextCtrlStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxTextCtrl, wxControl, "wx/textctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxTextCtrl, wxControl, "wx/textctrl.h"); wxBEGIN_PROPERTIES_TABLE(wxTextCtrl) wxEVENT_PROPERTY( TextUpdated, wxEVT_TEXT, wxCommandEvent ) @@ -122,14 +122,14 @@ wxCONSTRUCTOR_6( wxTextCtrl, wxWindow*, Parent, wxWindowID, Id, \ long, WindowStyle) -IMPLEMENT_DYNAMIC_CLASS(wxTextUrlEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxTextUrlEvent, wxCommandEvent); wxDEFINE_EVENT( wxEVT_TEXT, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TEXT_ENTER, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TEXT_URL, wxTextUrlEvent ); wxDEFINE_EVENT( wxEVT_TEXT_MAXLEN, wxCommandEvent ); -IMPLEMENT_ABSTRACT_CLASS(wxTextCtrlBase, wxControl) +wxIMPLEMENT_ABSTRACT_CLASS(wxTextCtrlBase, wxControl); // ============================================================================ // wxTextAttr implementation @@ -392,6 +392,12 @@ bool wxTextAttr::EqPartial(const wxTextAttr& attr, bool weakTest) const if ((HasPageBreak() != attr.HasPageBreak())) return false; + if ((GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE) != (attr.GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE)) + return false; + + if ((GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER) != (attr.GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER)) + return false; + if (HasTextEffects() && attr.HasTextEffects()) { if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), GetTextEffectFlags())) @@ -705,6 +711,18 @@ bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith) destStyle.SetPageBreak(); } + if (style.GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE) + { + if (!(compareWith && (compareWith->GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE))) + destStyle.SetFlags(destStyle.GetFlags()|wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE); + } + + if (style.GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER) + { + if (!(compareWith && (compareWith->GetFlags() & wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER))) + destStyle.SetFlags(destStyle.GetFlags()|wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER); + } + if (style.HasTextEffects()) { if (!(compareWith && compareWith->HasTextEffects() && compareWith->GetTextEffects() == style.GetTextEffects())) @@ -1160,14 +1178,6 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) // Other miscellaneous stuff // ---------------------------------------------------------------------------- -bool wxTextCtrlBase::SetHint(const wxString& hint) -{ - wxCHECK_MSG( IsSingleLine(), false, - wxS("Hints can only be set for single line text controls") ); - - return wxTextEntry::SetHint(hint); -} - // do the window-specific processing after processing the update event void wxTextCtrlBase::DoUpdateWindowUI(wxUpdateUIEvent& event) { @@ -1184,6 +1194,21 @@ void wxTextCtrlBase::DoUpdateWindowUI(wxUpdateUIEvent& event) } } +bool wxTextCtrlBase::OnDynamicBind(wxDynamicEventTableEntry& entry) +{ + if ( entry.m_eventType == wxEVT_TEXT_ENTER ) + { + wxCHECK_MSG + ( + HasFlag(wxTE_PROCESS_ENTER), + false, + wxS("Must have wxTE_PROCESS_ENTER for wxEVT_TEXT_ENTER to work") + ); + } + + return wxControl::OnDynamicBind(entry); +} + // ---------------------------------------------------------------------------- // hit testing // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/textentrycmn.cpp b/Externals/wxWidgets3/src/common/textentrycmn.cpp index b1480e322e..298eb408a4 100644 --- a/Externals/wxWidgets3/src/common/textentrycmn.cpp +++ b/Externals/wxWidgets3/src/common/textentrycmn.cpp @@ -37,7 +37,7 @@ // wxTextEntryHintData // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxTextEntryHintData wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS +class WXDLLIMPEXP_CORE wxTextEntryHintData { public: wxTextEntryHintData(wxTextEntryBase *entry, wxWindow *win) @@ -45,13 +45,9 @@ public: m_win(win), m_text(m_entry->GetValue()) { - wxBIND_OR_CONNECT_HACK(win, wxEVT_SET_FOCUS, wxFocusEventHandler, - wxTextEntryHintData::OnSetFocus, this); - wxBIND_OR_CONNECT_HACK(win, wxEVT_KILL_FOCUS, wxFocusEventHandler, - wxTextEntryHintData::OnKillFocus, this); - wxBIND_OR_CONNECT_HACK(win, wxEVT_TEXT, - wxCommandEventHandler, - wxTextEntryHintData::OnTextChanged, this); + win->Bind(wxEVT_SET_FOCUS, &wxTextEntryHintData::OnSetFocus, this); + win->Bind(wxEVT_KILL_FOCUS, &wxTextEntryHintData::OnKillFocus, this); + win->Bind(wxEVT_TEXT, &wxTextEntryHintData::OnTextChanged, this); } // default dtor is ok @@ -314,6 +310,66 @@ bool wxTextEntryBase::CanPaste() const return false; } +// ---------------------------------------------------------------------------- +// input restrictions +// ---------------------------------------------------------------------------- + +#ifndef wxHAS_NATIVE_TEXT_FORCEUPPER + +namespace +{ + +// Poor man's lambda: helper for binding ConvertToUpperCase() to the event +struct ForceUpperFunctor +{ + explicit ForceUpperFunctor(wxTextEntryBase* entry) + : m_entry(entry) + { + } + + void operator()(wxCommandEvent& event) + { + event.Skip(); + m_entry->ConvertToUpperCase(); + } + + wxTextEntryBase* const m_entry; +}; + +} // anonymous namespace + +#endif // !wxHAS_NATIVE_TEXT_FORCEUPPER + +void wxTextEntryBase::ConvertToUpperCase() +{ + const wxString& valueOld = GetValue(); + const wxString& valueNew = valueOld.Upper(); + + if ( valueNew != valueOld ) + { + long from, to; + GetSelection(&from, &to); + ChangeValue(valueNew); + SetSelection(from, to); + } +} + +void wxTextEntryBase::ForceUpper() +{ + // Do nothing if this method is never called because a native override is + // provided: this is just a tiny size-saving optimization, nothing else. +#ifndef wxHAS_NATIVE_TEXT_FORCEUPPER + wxWindow* const win = GetEditableWindow(); + wxCHECK_RET( win, wxS("can't be called before creating the window") ); + + // Convert the current control contents to upper case + ConvertToUpperCase(); + + // And ensure that any text entered in the future is converted too + win->Bind(wxEVT_TEXT, ForceUpperFunctor(this)); +#endif // !wxHAS_NATIVE_TEXT_FORCEUPPER +} + // ---------------------------------------------------------------------------- // hints support // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/common/textfile.cpp b/Externals/wxWidgets3/src/common/textfile.cpp index ddf88c9e46..0b15083a7f 100644 --- a/Externals/wxWidgets3/src/common/textfile.cpp +++ b/Externals/wxWidgets3/src/common/textfile.cpp @@ -56,26 +56,29 @@ bool wxTextFile::OnExists() const } -bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode OpenMode) +bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode openMode) { - wxFile::OpenMode FileOpenMode; + wxFile::OpenMode fileOpenMode = wxFile::read_write; - switch ( OpenMode ) + switch ( openMode ) { - default: - wxFAIL_MSG( wxT("unknown open mode in wxTextFile::Open") ); - // fall through - - case ReadAccess : - FileOpenMode = wxFile::read; + case ReadAccess: + fileOpenMode = wxFile::read; break; - case WriteAccess : - FileOpenMode = wxFile::write; + case WriteAccess: + fileOpenMode = wxFile::write; break; } - return m_file.Open(strBufferName.c_str(), FileOpenMode); + if ( fileOpenMode == wxFile::read_write ) + { + // This must mean it hasn't been initialized in the switch above. + wxFAIL_MSG( wxT("unknown open mode in wxTextFile::Open") ); + return false; + } + + return m_file.Open(strBufferName, fileOpenMode); } @@ -208,93 +211,46 @@ bool wxTextFile::OnRead(const wxMBConv& conv) // now break the buffer in lines - // was the last processed character a CR? - bool lastWasCR = false; - // the beginning of the current line, changes inside the loop wxString::const_iterator lineStart = str.begin(); const wxString::const_iterator end = str.end(); for ( wxString::const_iterator p = lineStart; p != end; p++ ) { const wxChar ch = *p; - switch ( ch ) + if ( ch == '\r' || ch == '\n' ) { - case '\n': - // could be a DOS or Unix EOL - if ( lastWasCR ) - { - if ( p - 1 >= lineStart ) - { - AddLine(wxString(lineStart, p - 1), wxTextFileType_Dos); - } - else - { - // there were two line endings, so add an empty line: - AddLine(wxEmptyString, wxTextFileType_Dos); - } - } - else // bare '\n', Unix style - { - AddLine(wxString(lineStart, p), wxTextFileType_Unix); - } + // Determine the kind of line ending this is. + wxTextFileType lineType = wxTextFileType_None; + if ( ch == '\r' ) + { + wxString::const_iterator next = p + 1; + if ( next != end && *next == '\n' ) + lineType = wxTextFileType_Dos; + else + lineType = wxTextFileType_Mac; + } + else // ch == '\n' + { + lineType = wxTextFileType_Unix; + } - lineStart = p + 1; - lastWasCR = false; - break; + AddLine(wxString(lineStart, p), lineType); - case '\r': - if ( lastWasCR ) - { - // Mac empty line - AddLine(wxEmptyString, wxTextFileType_Mac); - lineStart = p + 1; - } - //else: we don't know what this is yet -- could be a Mac EOL or - // start of DOS EOL so wait for next char + // DOS EOL is the only one consisting of two chars, not one. + if ( lineType == wxTextFileType_Dos ) + p++; - lastWasCR = true; - break; - - default: - if ( lastWasCR ) - { - // Mac line termination - if ( p - 1 >= lineStart ) - { - AddLine(wxString(lineStart, p - 1), wxTextFileType_Mac); - } - else - { - // there were two line endings, so add an empty line: - AddLine(wxEmptyString, wxTextFileType_Mac); - } - lineStart = p; - } - lastWasCR = false; + lineStart = p + 1; } } // anything in the last line? if ( lineStart != end ) { - // add the last line, notice that it may have been terminated with CR - // as we don't end the line immediately when we see a CR, as it could - // be followed by a LF. + // Add the last line; notice that it is certainly not terminated with a + // newline, otherwise it would be handled above. wxString lastLine(lineStart, end); - wxTextFileType lastType; - if ( lastWasCR ) - { - // last line had Mac EOL, exclude it from the string - lastLine.RemoveLast(); - lastType = wxTextFileType_Mac; - } - else - { - // last line wasn't terminated at all - lastType = wxTextFileType_None; - } - - AddLine(lastLine, lastType); + AddLine(lastLine, wxTextFileType_None); } return true; @@ -314,7 +270,7 @@ bool wxTextFile::OnWrite(wxTextFileType typeNew, const wxMBConv& conv) wxTempFile fileTmp(fn.GetFullPath()); if ( !fileTmp.IsOpened() ) { - wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName.c_str()); + wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName); return false; } diff --git a/Externals/wxWidgets3/src/common/threadinfo.cpp b/Externals/wxWidgets3/src/common/threadinfo.cpp index be07847b70..e77682db17 100644 --- a/Externals/wxWidgets3/src/common/threadinfo.cpp +++ b/Externals/wxWidgets3/src/common/threadinfo.cpp @@ -48,26 +48,33 @@ inline wxAllThreadInfos& GetAllThreadInfos() } // Pointer to the current thread's instance -wxTLS_TYPE(wxThreadSpecificInfo*) g_thisThreadInfo; +inline wxTLS_TYPE_REF(wxThreadSpecificInfo*) GetThisThreadInfo() +{ + static wxTLS_TYPE(wxThreadSpecificInfo*) s_thisThreadInfo; + + return s_thisThreadInfo; +} + +#define wxTHIS_THREAD_INFO wxTLS_VALUE(GetThisThreadInfo()) } // anonymous namespace wxThreadSpecificInfo& wxThreadSpecificInfo::Get() { - if ( !wxTLS_VALUE(g_thisThreadInfo) ) + if ( !wxTHIS_THREAD_INFO ) { - wxTLS_VALUE(g_thisThreadInfo) = new wxThreadSpecificInfo; + wxTHIS_THREAD_INFO = new wxThreadSpecificInfo; wxCriticalSectionLocker lock(GetAllThreadInfosCS()); GetAllThreadInfos().push_back( - wxSharedPtr(wxTLS_VALUE(g_thisThreadInfo))); + wxSharedPtr(wxTHIS_THREAD_INFO)); } - return *wxTLS_VALUE(g_thisThreadInfo); + return *wxTHIS_THREAD_INFO; } void wxThreadSpecificInfo::ThreadCleanUp() { - if ( !wxTLS_VALUE(g_thisThreadInfo) ) + if ( !wxTHIS_THREAD_INFO ) return; // nothing to do, not used by this thread at all // find this thread's instance in GetAllThreadInfos() and destroy it @@ -76,10 +83,10 @@ void wxThreadSpecificInfo::ThreadCleanUp() i != GetAllThreadInfos().end(); ++i ) { - if ( i->get() == wxTLS_VALUE(g_thisThreadInfo) ) + if ( i->get() == wxTHIS_THREAD_INFO ) { GetAllThreadInfos().erase(i); - wxTLS_VALUE(g_thisThreadInfo) = NULL; + wxTHIS_THREAD_INFO = NULL; break; } } diff --git a/Externals/wxWidgets3/src/common/time.cpp b/Externals/wxWidgets3/src/common/time.cpp index 011b601490..b9ccf39b43 100644 --- a/Externals/wxWidgets3/src/common/time.cpp +++ b/Externals/wxWidgets3/src/common/time.cpp @@ -22,6 +22,23 @@ #pragma hdrstop #endif +// This is a horrible hack which only works because we don't currently include +// from wx/wxprec.h. It is needed because we need timezone-related +// stuff from MinGW time.h, but it is not compiled in strict ANSI mode and it +// is too complicated to be dealt with using wxDECL_FOR_STRICT_MINGW32(). So we +// just include the header after undefining __STRICT_ANSI__ to get all the +// declarations we need -- and then define it back to avoid inconsistencies in +// all our other headers. +// +// Note that the same hack is used for "environ" in utilscmn.cpp, so if the +// code here is modified because this hack becomes unnecessary or a better +// solution is found, the code there should be updated as well. +#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + #undef __STRICT_ANSI__ + #include + #define __STRICT_ANSI__ +#endif + #include "wx/time.h" #ifndef WX_PRECOMP @@ -40,22 +57,10 @@ #endif #endif -#if defined(__VISAGECPP__) && !defined(HAVE_FTIME) - #define HAVE_FTIME -# if __IBMCPP__ >= 400 - # define ftime(x) _ftime(x) -# endif -#endif - -#ifndef __WXWINCE__ #include -#else -#include "wx/msw/private.h" -#include "wx/msw/wince/time.h" -#endif -#if !defined(__WXMAC__) && !defined(__WXWINCE__) +#if !defined(__WXMAC__) #include // for time_t #endif @@ -66,7 +71,7 @@ #include #endif -#if defined(__DJGPP__) || defined(__WINE__) +#if defined(__WINE__) #include #include #endif @@ -84,23 +89,6 @@ const int MICROSECONDS_PER_SECOND = 1000*1000; // 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 @@ -152,8 +140,6 @@ struct tm *wxGmtime_r(const time_t* ticks, struct tm* 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() @@ -186,7 +172,7 @@ int wxGetTimeZone() gmtoffset += 3600; } return (int)gmtoffset; -#elif defined(__DJGPP__) || defined(__WINE__) +#elif defined(__WINE__) struct timeb tb; ftime(&tb); return tb.timezone*60; @@ -211,7 +197,7 @@ int wxGetTimeZone() #if defined(WX_TIMEZONE) // If WX_TIMEZONE was defined by configure, use it. return WX_TIMEZONE; - #elif defined(__BORLANDC__) || defined(__MINGW32__) || defined(__VISAGECPP__) + #elif defined(__BORLANDC__) || defined(__MINGW32__) return _timezone; #else // unknown platform -- assume it has timezone return timezone; @@ -331,7 +317,7 @@ wxLongLong wxGetUTCTimeMillis() // do NOT just shut off these warnings, drop me a line instead at // - #if defined(__VISUALC__) || defined (__WATCOMC__) + #if defined(__VISUALC__) #pragma message("wxStopWatch will be up to second resolution!") #elif defined(__BORLANDC__) #pragma message "wxStopWatch will be up to second resolution!" diff --git a/Externals/wxWidgets3/src/common/timercmn.cpp b/Externals/wxWidgets3/src/common/timercmn.cpp index f117f9aaf0..79104c1acb 100644 --- a/Externals/wxWidgets3/src/common/timercmn.cpp +++ b/Externals/wxWidgets3/src/common/timercmn.cpp @@ -38,7 +38,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimerEvent, wxEvent); wxDEFINE_EVENT(wxEVT_TIMER, wxTimerEvent); diff --git a/Externals/wxWidgets3/src/common/tokenzr.cpp b/Externals/wxWidgets3/src/common/tokenzr.cpp index 9d7926919b..d3333994cd 100644 --- a/Externals/wxWidgets3/src/common/tokenzr.cpp +++ b/Externals/wxWidgets3/src/common/tokenzr.cpp @@ -84,6 +84,22 @@ wxStringTokenizer::wxStringTokenizer(const wxString& str, SetString(str, delims, mode); } +wxStringTokenizer::wxStringTokenizer(const wxStringTokenizer& src) + : wxObject() +{ + DoCopyFrom(src); +} + +wxStringTokenizer& wxStringTokenizer::operator=(const wxStringTokenizer& src) +{ + if (this != &src) + { + DoCopyFrom(src); + } + + return *this; +} + void wxStringTokenizer::SetString(const wxString& str, const wxString& delims, wxStringTokenizerMode mode) @@ -136,6 +152,18 @@ void wxStringTokenizer::Reinit(const wxString& str) m_hasMoreTokens = MoreTokens_Unknown; } +void wxStringTokenizer::DoCopyFrom(const wxStringTokenizer& src) +{ + m_string = src.m_string; + m_stringEnd = m_string.end(); + m_pos = m_string.begin() + (src.m_pos - src.m_string.begin()); + m_delims = src.m_delims; + m_delimsLen = src.m_delimsLen; + m_mode = src.m_mode; + m_lastDelim = src.m_lastDelim; + m_hasMoreTokens = src.m_hasMoreTokens; +} + // ---------------------------------------------------------------------------- // access to the tokens // ---------------------------------------------------------------------------- @@ -190,7 +218,7 @@ bool wxStringTokenizer::DoHasMoreTokens() const case wxTOKEN_INVALID: case wxTOKEN_DEFAULT: wxFAIL_MSG( wxT("unexpected tokenizer mode") ); - // fall through + wxFALLTHROUGH; case wxTOKEN_STRTOK: // never return empty delimiters diff --git a/Externals/wxWidgets3/src/common/toplvcmn.cpp b/Externals/wxWidgets3/src/common/toplvcmn.cpp index 03504cc0fe..58581f6d8a 100644 --- a/Externals/wxWidgets3/src/common/toplvcmn.cpp +++ b/Externals/wxWidgets3/src/common/toplvcmn.cpp @@ -35,16 +35,16 @@ // event table // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow) +wxBEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow) EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow) EVT_SIZE(wxTopLevelWindowBase::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxTopLevelWindow, wxWindow) +wxIMPLEMENT_ABSTRACT_CLASS(wxTopLevelWindow, wxWindow); // ---------------------------------------------------------------------------- // construction/destruction @@ -101,6 +101,16 @@ wxTopLevelWindowBase::~wxTopLevelWindowBase() bool wxTopLevelWindowBase::Destroy() { + // We can't delay the destruction if our parent is being already destroyed + // as we will be deleted anyhow during its destruction and the pointer + // stored in wxPendingDelete would become invalid, so just delete ourselves + // immediately in this case. + if ( wxWindow* parent = GetParent() ) + { + if ( parent->IsBeingDeleted() ) + return wxNonOwnedWindow::Destroy(); + } + // delayed destruction: the frame will be deleted during the next idle // loop iteration if ( !wxPendingDelete.Member(this) ) @@ -138,6 +148,14 @@ bool wxTopLevelWindowBase::IsLastBeforeExit() const if ( !wxTheApp || !wxTheApp->GetExitOnFrameDelete() ) return false; + // second, never terminate the application after closing a child TLW + // because this would close its parent unexpectedly -- notice that this + // check is not redundant with the loop below, as the parent might return + // false from its ShouldPreventAppExit() -- except if the child is being + // deleted as part of the parent destruction + if ( GetParent() && !GetParent()->IsBeingDeleted() ) + return false; + wxWindowList::const_iterator i; const wxWindowList::const_iterator end = wxTopLevelWindows.end(); @@ -325,11 +343,7 @@ void wxTopLevelWindowBase::DoClientToScreen(int *x, int *y) const bool wxTopLevelWindowBase::IsAlwaysMaximized() const { -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - return true; -#else return false; -#endif } // ---------------------------------------------------------------------------- @@ -356,6 +370,22 @@ void wxTopLevelWindowBase::SetIcon(const wxIcon& icon) // event handlers // ---------------------------------------------------------------------------- +bool wxTopLevelWindowBase::IsTopNavigationDomain(NavigationKind kind) const +{ + // This switch only exists to generate a compiler warning and force us to + // revisit this code if any new kinds of navigation are added in the + // future, but for now we block of them by default (some derived classes + // relax this however). + switch ( kind ) + { + case Navigation_Tab: + case Navigation_Accel: + break; + } + + return true; +} + // default resizing behaviour - if only ONE subwindow, resize to fill the // whole client area void wxTopLevelWindowBase::DoLayout() diff --git a/Externals/wxWidgets3/src/common/translation.cpp b/Externals/wxWidgets3/src/common/translation.cpp index 455fb315d0..bc0717fa73 100644 --- a/Externals/wxWidgets3/src/common/translation.cpp +++ b/Externals/wxWidgets3/src/common/translation.cpp @@ -46,6 +46,7 @@ #include "wx/filename.h" #include "wx/tokenzr.h" #include "wx/fontmap.h" +#include "wx/scopedptr.h" #include "wx/stdpaths.h" #include "wx/private/threadinfo.h" @@ -95,6 +96,8 @@ wxStringToStringHashMap gs_msgIdCharset; // Platform specific helpers // ---------------------------------------------------------------------------- +#if wxUSE_LOG_TRACE + void LogTraceArray(const char *prefix, const wxArrayString& arr) { wxLogTrace(TRACE_I18N, "%s: [%s]", prefix, wxJoin(arr, ',')); @@ -107,6 +110,13 @@ void LogTraceLargeArray(const wxString& prefix, const wxArrayString& arr) wxLogTrace(TRACE_I18N, " %s", *i); } +#else // !wxUSE_LOG_TRACE + +#define LogTraceArray(prefix, arr) +#define LogTraceLargeArray(prefix, arr) + +#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE + // Use locale-based detection as a fallback wxString GetPreferredUILanguageFallback(const wxArrayString& WXUNUSED(available)) { @@ -138,7 +148,7 @@ wxString GetPreferredUILanguage(const wxArrayString& available) NULL, &bufferSize) ) { - wxScopedArray langs(new WCHAR[bufferSize]); + wxScopedArray langs(bufferSize); if ( (*s_pfnGetUserPreferredUILanguages)(MUI_LANGUAGE_NAME, &numLangs, langs.get(), @@ -180,6 +190,8 @@ wxString GetPreferredUILanguage(const wxArrayString& available) #elif defined(__WXOSX__) +#if wxUSE_LOG_TRACE + void LogTraceArray(const char *prefix, CFArrayRef arr) { wxString s; @@ -193,6 +205,8 @@ void LogTraceArray(const char *prefix, CFArrayRef arr) wxLogTrace(TRACE_I18N, "%s: [%s]", prefix, s); } +#endif // wxUSE_LOG_TRACE + wxString GetPreferredUILanguage(const wxArrayString& available) { wxStringToStringHashMap availableNormalized; @@ -1188,7 +1202,8 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash, // conversion to use to convert catalog strings to the GUI encoding wxMBConv *inputConv = NULL; - wxMBConv *inputConvPtr = NULL; // same as inputConv but safely deleteable + + wxScopedPtr inputConvPtr; // just to delete inputConv if needed if ( !m_charset.empty() ) { @@ -1198,8 +1213,11 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash, if ( encCat != wxLocale::GetSystemEncoding() ) #endif { - inputConvPtr = inputConv = new wxCSConv(m_charset); + + // As we allocated it ourselves, we need to delete it, so ensure + // this happens. + inputConvPtr.reset(inputConv); } } else // no need or not possible to convert the encoding @@ -1217,9 +1235,9 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash, // conversion to apply to msgid strings before looking them up: we only // need it if the msgids are neither in 7 bit ASCII nor in the same // encoding as the catalog - wxCSConv *sourceConv = msgIdCharset.empty() || (msgIdCharset == m_charset) - ? NULL - : new wxCSConv(msgIdCharset); + wxScopedPtr sourceConv; + if ( !msgIdCharset.empty() && (msgIdCharset != m_charset) ) + sourceConv.reset(new wxCSConv(msgIdCharset)); #endif // !wxUSE_UNICODE for (size_t32 i = 0; i < m_numStrings; i++) @@ -1275,11 +1293,6 @@ bool wxMsgCatalogFile::FillHash(wxStringToStringHashMap& hash, } } -#if !wxUSE_UNICODE - delete sourceConv; -#endif - delete inputConvPtr; - return true; } @@ -1560,8 +1573,10 @@ bool wxTranslations::LoadCatalog(const wxString& domain, const wxString& lang, c { // add it to the head of the list so that in GetString it will // be searched before the catalogs added earlier + cat->m_pNext = m_pMsgCat; m_pMsgCat = cat; + m_catalogMap[domain] = cat; return true; } @@ -1722,18 +1737,12 @@ wxString wxTranslations::GetHeaderValue(const wxString& header, } -// find catalog by name in a linked list, return NULL if !found +// find catalog by name wxMsgCatalog *wxTranslations::FindCatalog(const wxString& domain) const { - // linear search in the linked list - wxMsgCatalog *pMsgCat; - for ( pMsgCat = m_pMsgCat; pMsgCat != NULL; pMsgCat = pMsgCat->m_pNext ) - { - if ( pMsgCat->GetDomain() == domain ) - return pMsgCat; - } + const wxMsgCatalogMap::const_iterator found = m_catalogMap.find(domain); - return NULL; + return found == m_catalogMap.end() ? NULL : found->second; } // ---------------------------------------------------------------------------- @@ -2028,16 +2037,16 @@ wxArrayString wxResourceTranslationsLoader::GetAvailableTranslations(const wxStr class wxTranslationsModule: public wxModule { - DECLARE_DYNAMIC_CLASS(wxTranslationsModule) - public: + wxDECLARE_DYNAMIC_CLASS(wxTranslationsModule); +public: wxTranslationsModule() {} - bool OnInit() + bool OnInit() wxOVERRIDE { return true; } - void OnExit() + void OnExit() wxOVERRIDE { if ( gs_translationsOwned ) delete gs_translations; @@ -2046,6 +2055,6 @@ class wxTranslationsModule: public wxModule } }; -IMPLEMENT_DYNAMIC_CLASS(wxTranslationsModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTranslationsModule, wxModule); #endif // wxUSE_INTL diff --git a/Externals/wxWidgets3/src/common/treebase.cpp b/Externals/wxWidgets3/src/common/treebase.cpp index 7283ea3981..b2cfd7960a 100644 --- a/Externals/wxWidgets3/src/common/treebase.cpp +++ b/Externals/wxWidgets3/src/common/treebase.cpp @@ -107,7 +107,7 @@ wxFLAGS_MEMBER(wxTR_EXTENDED) wxFLAGS_MEMBER(wxTR_DEFAULT_STYLE) wxEND_FLAGS( wxTreeCtrlStyle ) -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxTreeCtrl, wxControl, "wx/treectrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxTreeCtrl, wxControl, "wx/treectrl.h"); wxBEGIN_PROPERTIES_TABLE(wxTreeCtrl) wxEVENT_PROPERTY( TextUpdated, wxEVT_TEXT, wxCommandEvent ) @@ -128,7 +128,7 @@ wxCONSTRUCTOR_5( wxTreeCtrl, wxWindow*, Parent, wxWindowID, Id, \ // Tree event // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxTreeEvent, wxNotifyEvent); wxTreeEvent::wxTreeEvent(wxEventType commandType, wxTreeCtrlBase *tree, @@ -359,7 +359,7 @@ void wxTreeCtrlBase::OnCharHook(wxKeyEvent& event) { case WXK_ESCAPE: discardChanges = true; - // fall through + wxFALLTHROUGH; case WXK_RETURN: EndEditLabel(GetFocusedItem(), discardChanges); diff --git a/Externals/wxWidgets3/src/common/txtstrm.cpp b/Externals/wxWidgets3/src/common/txtstrm.cpp index 9e3fa8a793..8c48cd6c77 100644 --- a/Externals/wxWidgets3/src/common/txtstrm.cpp +++ b/Externals/wxWidgets3/src/common/txtstrm.cpp @@ -36,6 +36,10 @@ wxTextInputStream::wxTextInputStream(wxInputStream &s, : m_input(s), m_separators(sep), m_conv(conv.Clone()) { memset((void*)m_lastBytes, 0, 10); + +#if SIZEOF_WCHAR_T == 2 + m_lastWChar = 0; +#endif // SIZEOF_WCHAR_T == 2 } #else wxTextInputStream::wxTextInputStream(wxInputStream &s, const wxString &sep) @@ -64,6 +68,17 @@ void wxTextInputStream::UngetLast() wxChar wxTextInputStream::NextChar() { #if wxUSE_UNICODE +#if SIZEOF_WCHAR_T == 2 + // Return the already raed character remaining from the last call to this + // function, if any. + if ( m_lastWChar ) + { + const wxChar wc = m_lastWChar; + m_lastWChar = 0; + return wc; + } +#endif // !SWIG_ONLY_SCRIPT_API + wxChar wbuf[2]; memset((void*)m_lastBytes, 0, 10); for(size_t inlen = 0; inlen < 9; inlen++) @@ -91,10 +106,23 @@ wxChar wxTextInputStream::NextChar() // if we couldn't decode a single character during the last // loop iteration we shouldn't be able to decode 2 or more of // them with an extra single byte, something fishy is going on + // (except if we use UTF-16, see below) wxFAIL_MSG("unexpected decoding result"); - // fall through nevertheless and return at least something + return wxEOT; + +#if SIZEOF_WCHAR_T == 2 + case 2: + // When wchar_t uses UTF-16, we could have decoded a single + // Unicode code point as 2 wchar_t characters and there is + // nothing else to do here but to return the first one now and + // remember the second one for the next call, as there is no + // way to fit both of them into a single wxChar in this case. + m_lastWChar = wbuf[1]; +#endif // !SWIG_ONLY_SCRIPT_API + wxFALLTHROUGH; case 1: + // we finally decoded a character return wbuf[0]; } @@ -146,6 +174,21 @@ bool wxTextInputStream::EatEOL(const wxChar &c) return false; } +wxUint64 wxTextInputStream::Read64(int base) +{ + wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") ); + if(!m_input) return 0; + + wxString word = ReadWord(); + if(word.empty()) + return 0; + + wxUint64 res; + if(!word.ToULongLong(&res, base)) + return 0; + return res; +} + wxUint32 wxTextInputStream::Read32(int base) { wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") ); @@ -167,6 +210,21 @@ wxUint8 wxTextInputStream::Read8(int base) return (wxUint8)Read32(base); } +wxInt64 wxTextInputStream::Read64S(int base) +{ + wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") ); + if(!m_input) return 0; + + wxString word = ReadWord(); + if(word.empty()) + return 0; + + wxInt64 res; + if(!word.ToLongLong(&res, base)) + return 0; + return res; +} + wxInt32 wxTextInputStream::Read32S(int base) { wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") ); @@ -197,15 +255,6 @@ double wxTextInputStream::ReadDouble() return wxStrtod(word.c_str(), 0); } -#if WXWIN_COMPATIBILITY_2_6 - -wxString wxTextInputStream::ReadString() -{ - return ReadLine(); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - wxString wxTextInputStream::ReadLine() { wxString line; @@ -286,13 +335,19 @@ wxTextInputStream& wxTextInputStream::operator>>(wchar_t& wc) wxTextInputStream& wxTextInputStream::operator>>(wxInt16& i) { - i = (wxInt16)Read16(); + i = Read16S(); return *this; } wxTextInputStream& wxTextInputStream::operator>>(wxInt32& i) { - i = (wxInt32)Read32(); + i = Read32S(); + return *this; +} + +wxTextInputStream& wxTextInputStream::operator>>(wxInt64& i) +{ + i = Read64S(); return *this; } @@ -308,6 +363,12 @@ wxTextInputStream& wxTextInputStream::operator>>(wxUint32& i) return *this; } +wxTextInputStream& wxTextInputStream::operator>>(wxUint64& i) +{ + i = Read64(); + return *this; +} + wxTextInputStream& wxTextInputStream::operator>>(double& i) { i = ReadDouble(); @@ -335,12 +396,16 @@ wxTextOutputStream::wxTextOutputStream(wxOutputStream& s, wxEOL mode) m_mode = mode; if (m_mode == wxEOL_NATIVE) { -#if defined(__WINDOWS__) || defined(__WXPM__) +#if defined(__WINDOWS__) m_mode = wxEOL_DOS; #else m_mode = wxEOL_UNIX; #endif } + +#if wxUSE_UNICODE && SIZEOF_WCHAR_T == 2 + m_lastWChar = 0; +#endif // SIZEOF_WCHAR_T == 2 } wxTextOutputStream::~wxTextOutputStream() @@ -355,7 +420,7 @@ void wxTextOutputStream::SetMode(wxEOL mode) m_mode = mode; if (m_mode == wxEOL_NATIVE) { -#if defined(__WINDOWS__) || defined(__WXPM__) +#if defined(__WINDOWS__) m_mode = wxEOL_DOS; #else m_mode = wxEOL_UNIX; @@ -363,6 +428,11 @@ void wxTextOutputStream::SetMode(wxEOL mode) } } +void wxTextOutputStream::Write64(wxUint64 i) +{ + WriteString(wxString::Format("%" wxLongLongFmtSpec "u", i)); +} + void wxTextOutputStream::Write32(wxUint32 i) { wxString str; @@ -419,7 +489,7 @@ void wxTextOutputStream::WriteString(const wxString& string) default: wxFAIL_MSG( wxT("unknown EOL mode in wxTextOutputStream") ); - // fall through + wxFALLTHROUGH; case wxEOL_UNIX: // don't treat '\n' specially @@ -442,7 +512,66 @@ void wxTextOutputStream::WriteString(const wxString& string) wxTextOutputStream& wxTextOutputStream::PutChar(wxChar c) { #if wxUSE_UNICODE +#if SIZEOF_WCHAR_T == 2 + wxCharBuffer buffer; + size_t len; + if ( m_lastWChar ) + { + wxChar buf[2]; + buf[0] = m_lastWChar; + buf[1] = c; + buffer = m_conv->cWC2MB(buf, WXSIZEOF(buf), &len); + m_lastWChar = 0; + } + else + { + buffer = m_conv->cWC2MB(&c, 1, &len); + } + + if ( !len ) + { + // Conversion failed, possibly because we have the first half of a + // surrogate character, so just store it and write it out when the + // second half is written to the stream too later. + // + // Notice that if we already had had a valid m_lastWChar, it is simply + // discarded here which is very bad, but there is no way to signal an + // error from here and this is not worse than the old code behaviour. + m_lastWChar = c; + } + else + { + for ( size_t n = 0; n < len; n++ ) + { + const char c2 = buffer[n]; + if ( c2 == '\n' ) + { + switch ( m_mode ) + { + case wxEOL_DOS: + m_output.Write("\r\n", 2); + continue; + + case wxEOL_MAC: + m_output.Write("\r", 1); + continue; + + default: + wxFAIL_MSG( wxT("unknown EOL mode in wxTextOutputStream") ); + wxFALLTHROUGH; + + case wxEOL_UNIX: + // don't treat '\n' specially + ; + } + } + + m_output.Write(&c2, 1); + } + } +#else // SIZEOF_WCHAR_T == 4 WriteString( wxString(&c, *m_conv, 1) ); +#endif // SIZEOF_WCHAR_T == 2 or 4 #else WriteString( wxString(&c, wxConvLocal, 1) ); #endif @@ -479,7 +608,7 @@ wxTextOutputStream& wxTextOutputStream::operator<<(char c) wxTextOutputStream& wxTextOutputStream::operator<<(wchar_t wc) { - WriteString( wxString(&wc, *m_conv, 1) ); + PutChar(wc); return *this; } @@ -488,49 +617,55 @@ wxTextOutputStream& wxTextOutputStream::operator<<(wchar_t wc) wxTextOutputStream& wxTextOutputStream::operator<<(wxInt16 c) { - wxString str; - str.Printf(wxT("%d"), (signed int)c); - WriteString(str); + Write(c); return *this; } wxTextOutputStream& wxTextOutputStream::operator<<(wxInt32 c) { - wxString str; - str.Printf(wxT("%ld"), (signed long)c); - WriteString(str); + Write(c); + + return *this; +} + +wxTextOutputStream& wxTextOutputStream::operator<<(wxInt64 c) +{ + Write(c); return *this; } wxTextOutputStream& wxTextOutputStream::operator<<(wxUint16 c) { - wxString str; - str.Printf(wxT("%u"), (unsigned int)c); - WriteString(str); + Write(c); return *this; } wxTextOutputStream& wxTextOutputStream::operator<<(wxUint32 c) { - wxString str; - str.Printf(wxT("%lu"), (unsigned long)c); - WriteString(str); + Write(c); + + return *this; +} + +wxTextOutputStream& wxTextOutputStream::operator<<(wxUint64 c) +{ + Write(c); return *this; } wxTextOutputStream &wxTextOutputStream::operator<<(double f) { - WriteDouble(f); + Write(f); return *this; } wxTextOutputStream& wxTextOutputStream::operator<<(float f) { - WriteDouble((double)f); + Write(f); return *this; } diff --git a/Externals/wxWidgets3/src/common/uiactioncmn.cpp b/Externals/wxWidgets3/src/common/uiactioncmn.cpp index 32a8d2f2d4..a74a0d10ec 100644 --- a/Externals/wxWidgets3/src/common/uiactioncmn.cpp +++ b/Externals/wxWidgets3/src/common/uiactioncmn.cpp @@ -16,6 +16,15 @@ #include "wx/uiaction.h" +#include "wx/ctrlsub.h" + +#ifdef wxNO_RTTI + #include "wx/choice.h" + #include "wx/combobox.h" + #include "wx/listbox.h" +#endif // wxNO_RTTI + + bool wxUIActionSimulator::MouseClick(int button) { MouseDown(button); @@ -52,8 +61,6 @@ bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2, bool wxUIActionSimulator::Key(int keycode, int modifiers, bool isDown) { - wxASSERT_MSG( (modifiers & wxMOD_ALTGR) != wxMOD_ALTGR, - "wxMOD_ALTGR is not implemented" ); wxASSERT_MSG( !(modifiers & wxMOD_META ), "wxMOD_META is not implemented" ); wxASSERT_MSG( !(modifiers & wxMOD_WIN ), @@ -82,67 +89,122 @@ 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); return true; } +// Helper function checking if a key must be entered with Shift pressed. If it +// must, returns true and modifies the key to contain the unshifted version. +// +// This currently works only for the standard US keyboard layout which is +// definitely not ideal, but better than nothing... +static bool MapUnshifted(char& ch) +{ + const char* const unshifted = + "`1234567890-=\\" + "[]" + ";'" + ",./" + ; + + const char* const shifted = + "~!@#$%^&*()_+|" + "{}" + ":\"" + "<>?" + ; + + wxCOMPILE_TIME_ASSERT( sizeof(unshifted) == sizeof(shifted), + ShiftedUnshiftedKeysMismatch ); + + const char* const p = strchr(shifted, ch); + if ( !p ) + return false; + + ch = *(unshifted + (p - shifted)); + + return true; +} + bool wxUIActionSimulator::Text(const char *s) { while ( *s != '\0' ) { - const char ch = *s++; - if ( !Char(ch, isupper(ch) ? wxMOD_SHIFT : 0) ) + char ch = *s++; + + // Map the keys that must be entered with Shift modifier to their + // unshifted counterparts. + int modifiers = 0; + if ( isupper(ch) || MapUnshifted(ch) ) + modifiers |= wxMOD_SHIFT; + + if ( !Char(ch, modifiers) ) return false; } return true; } +bool wxUIActionSimulator::Select(const wxString& text) +{ + wxWindow* const focus = wxWindow::FindFocus(); + if ( !focus ) + return false; + + // We can only select something in controls inheriting from + // wxItemContainer, so check that we have it. +#ifdef wxNO_RTTI + wxItemContainer* container = NULL; + + if ( wxComboBox* combo = wxDynamicCast(focus, wxComboBox) ) + container = combo; + else if ( wxChoice* choice = wxDynamicCast(focus, wxChoice) ) + container = choice; + else if ( wxListBox* listbox = wxDynamicCast(focus, wxListBox) ) + container = listbox; +#else // !wxNO_RTTI + wxItemContainer* const container = dynamic_cast(focus); +#endif // wxNO_RTTI/!wxNO_RTTI + + if ( !container ) + return false; + + // We prefer to exactly emulate what a (keyboard) user would do, so prefer + // to emulate selecting the first item of the control if possible (this + // works with wxChoice, wxListBox and wxComboBox with wxCB_READONLY style + // under MSW). + if ( container->GetSelection() != 0 ) + { + Char(WXK_HOME); + wxYield(); + + // But if this didn't work, set the selection programmatically. + if ( container->GetSelection() != 0 ) + container->SetSelection(0); + } + + // And then go down in the control until we reach the item we want. + for ( ;; ) + { + if ( container->GetStringSelection() == text ) + return true; + + // We could test if the selection becomes equal to its maximal value + // (i.e. GetCount() - 1), but if, for some reason, pressing WXK_DOWN + // doesn't move it, this would still result in an infinite loop, so + // check that the selection changed for additional safety. + const int current = container->GetSelection(); + + Char(WXK_DOWN); + wxYield(); + + if ( container->GetSelection() == current ) + break; + } + + return false; +} + #endif // wxUSE_UIACTIONSIMULATOR diff --git a/Externals/wxWidgets3/src/common/uri.cpp b/Externals/wxWidgets3/src/common/uri.cpp index d6279eed2b..ff01b850f5 100644 --- a/Externals/wxWidgets3/src/common/uri.cpp +++ b/Externals/wxWidgets3/src/common/uri.cpp @@ -34,7 +34,7 @@ // definitions // --------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxURI, wxObject) +wxIMPLEMENT_CLASS(wxURI, wxObject); // =========================================================================== // wxURI implementation @@ -90,9 +90,9 @@ void wxURI::Clear() /* static */ int wxURI::CharToHex(char c) { - if ((c >= 'A') && (c <= 'Z')) + if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; - if ((c >= 'a') && (c <= 'z')) + if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; if ((c >= '0') && (c <= '9')) return c - '0'; @@ -100,38 +100,32 @@ int wxURI::CharToHex(char c) return -1; } -int wxURI::DecodeEscape(wxString::const_iterator& i) -{ - int hi = CharToHex(*++i); - if ( hi == -1 ) - return -1; - - int lo = CharToHex(*++i); - if ( lo == -1 ) - return -1; - - return (hi << 4) | lo; -} - /* static */ wxString wxURI::Unescape(const wxString& uri) { + // URIs can contain escaped 8-bit characters that have to be decoded using + // UTF-8 (see RFC 3986), however in our (probably broken...) case we can + // also end up with not escaped Unicode characters in the URI string which + // can't be decoded as UTF-8. So what we do here is to encode all Unicode + // characters as UTF-8 only to decode them back below. This is obviously + // inefficient but there doesn't seem to be anything else to do, other than + // not allowing to mix Unicode characters with escapes in the first place, + // but this seems to be done in a lot of places, unfortunately. + const wxScopedCharBuffer& uriU8(uri.utf8_str()); + const size_t len = uriU8.length(); + // the unescaped version can't be longer than the original one - wxCharBuffer buf(uri.length()); + wxCharBuffer buf(uriU8.length()); char *p = buf.data(); - for ( wxString::const_iterator i = uri.begin(); i != uri.end(); ++i, ++p ) + const char* const end = uriU8.data() + len; + for ( const char* s = uriU8.data(); s != end; ++s, ++p ) { - char c = *i; - if ( c == '%' ) + char c = *s; + if ( c == '%' && s < end - 2 && IsHex(s[1]) && IsHex(s[2]) ) { - int n = wxURI::DecodeEscape(i); - if ( n == -1 ) - return wxString(); - - wxASSERT_MSG( n >= 0 && n <= 0xff, "unexpected character value" ); - - c = static_cast(n); + c = (CharToHex(s[1]) << 4) | CharToHex(s[2]); + s += 2; } *p = c; @@ -139,17 +133,7 @@ wxString wxURI::Unescape(const wxString& uri) *p = '\0'; - // by default assume that the URI is in UTF-8, this is the most common - // practice - wxString s = wxString::FromUTF8(buf); - if ( s.empty() ) - { - // if it isn't, use latin-1 as a fallback -- at least this always - // succeeds - s = wxCSConv(wxFONTENCODING_ISO8859_1).cMB2WC(buf); - } - - return s; + return wxString::FromUTF8(buf); } void wxURI::AppendNextEscaped(wxString& s, const char *& p) @@ -313,6 +297,17 @@ bool wxURI::IsReference() const return !HasScheme() || !HasServer(); } +// --------------------------------------------------------------------------- +// IsRelative +// +// FIXME: may need refinement +// --------------------------------------------------------------------------- + +bool wxURI::IsRelative() const +{ + return !HasScheme() && !HasServer(); +} + // --------------------------------------------------------------------------- // Parse // diff --git a/Externals/wxWidgets3/src/common/url.cpp b/Externals/wxWidgets3/src/common/url.cpp index 8d6eb49aa2..9bea231c5b 100644 --- a/Externals/wxWidgets3/src/common/url.cpp +++ b/Externals/wxWidgets3/src/common/url.cpp @@ -29,7 +29,7 @@ #include #include -IMPLEMENT_CLASS(wxURL, wxURI) +wxIMPLEMENT_CLASS(wxURL, wxURI); // Protocols list wxProtoInfo *wxURL::ms_protocols = NULL; @@ -318,7 +318,7 @@ wxInputStream *wxURL::GetInputStream() addr.Service(m_port); - if (!m_protocol->Connect(addr, true)) // Watcom needs the 2nd arg for some reason + if (!m_protocol->Connect(addr)) { m_error = wxURL_CONNERR; return NULL; @@ -388,7 +388,7 @@ void wxURL::SetDefaultProxy(const wxString& url_proxy) ms_proxyDefault->Close(); else ms_proxyDefault = new wxHTTP(); - ms_proxyDefault->Connect(addr, true); // Watcom needs the 2nd arg for some reason + ms_proxyDefault->Connect(addr); } } @@ -427,7 +427,7 @@ void wxURL::SetProxy(const wxString& url_proxy) if (m_proxy && m_proxy != ms_proxyDefault) delete m_proxy; m_proxy = new wxHTTP(); - m_proxy->Connect(addr, true); // Watcom needs the 2nd arg for some reason + m_proxy->Connect(addr); CleanData(); // Reparse url. @@ -450,14 +450,14 @@ class wxURLModule : public wxModule public: wxURLModule(); - virtual bool OnInit(); - virtual void OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxURLModule) + wxDECLARE_DYNAMIC_CLASS(wxURLModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxURLModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxURLModule, wxModule); wxURLModule::wxURLModule() { diff --git a/Externals/wxWidgets3/src/common/utilscmn.cpp b/Externals/wxWidgets3/src/common/utilscmn.cpp index 0d30b0249b..fbf933fa94 100644 --- a/Externals/wxWidgets3/src/common/utilscmn.cpp +++ b/Externals/wxWidgets3/src/common/utilscmn.cpp @@ -23,6 +23,14 @@ #pragma hdrstop #endif +// See comment about this hack in time.cpp: here we do it for environ external +// variable which can't be easily declared when using MinGW in strict ANSI mode. +#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + #undef __STRICT_ANSI__ + #include + #define __STRICT_ANSI__ +#endif + #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/string.h" @@ -52,51 +60,41 @@ #include "wx/mimetype.h" #include "wx/config.h" #include "wx/versioninfo.h" - -#if defined(__WXWINCE__) && wxUSE_DATETIME - #include "wx/datetime.h" -#endif +#include "wx/math.h" #include #include #include #include - -#if !wxONLY_WATCOM_EARLIER_THAN(1,4) - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif -#endif +#include #if wxUSE_GUI + #include "wx/filesys.h" #include "wx/notebook.h" #include "wx/statusbr.h" + #include "wx/private/launchbrowser.h" #endif // wxUSE_GUI -#ifndef __WXWINCE__ - #include -#else - #include "wx/msw/wince/time.h" -#endif +#include #ifdef __WXMAC__ #include "wx/osx/private.h" #endif -#if !defined(__WXWINCE__) - #include - #include -#endif +#include +#include #if defined(__WINDOWS__) #include "wx/msw/private.h" - #include "wx/filesys.h" #endif #if wxUSE_GUI && defined(__WXGTK__) #include // for GTK_XXX_VERSION constants #endif +#if wxUSE_GUI && defined(__WXQT__) + #include // for QT_VERSION_STR constants +#endif #if wxUSE_BASE // ============================================================================ @@ -149,19 +147,10 @@ wxString wxDecToHex(int dec) // Return the current date/time wxString wxNow() { -#ifdef __WXWINCE__ -#if wxUSE_DATETIME - wxDateTime now = wxDateTime::Now(); - return now.Format(); -#else - return wxEmptyString; -#endif -#else time_t now = time(NULL); char *date = ctime(&now); date[24] = '\0'; return wxString::FromAscii(date); -#endif } #if WXWIN_COMPATIBILITY_2_8 @@ -351,25 +340,6 @@ bool wxPlatform::Is(int platform) if (platform == wxOS_WINDOWS) return true; #endif -#ifdef __WXWINCE__ - if (platform == wxOS_WINDOWS_CE) - return true; -#endif - -#if 0 - -// FIXME: wxWinPocketPC and wxWinSmartPhone are unknown symbols - -#if defined(__WXWINCE__) && defined(__POCKETPC__) - if (platform == wxWinPocketPC) - return true; -#endif -#if defined(__WXWINCE__) && defined(__SMARTPHONE__) - if (platform == wxWinSmartPhone) - return true; -#endif - -#endif #ifdef __WXGTK__ if (platform == wxPORT_GTK) @@ -387,16 +357,8 @@ bool wxPlatform::Is(int platform) if (platform == wxOS_UNIX) return true; #endif -#ifdef __OS2__ - if (platform == wxOS_OS2) - return true; -#endif -#ifdef __WXPM__ - if (platform == wxPORT_PM) - return true; -#endif -#ifdef __WXCOCOA__ - if (platform == wxPORT_MAC) +#ifdef __WXQT__ + if (platform == wxPORT_QT) return true; #endif @@ -774,8 +736,8 @@ Thanks, #define SWAP(a, b, size) \ do \ { \ - register size_t __size = (size); \ - register char *__a = (a), *__b = (b); \ + size_t __size = (size); \ + char *__a = (a), *__b = (b); \ do \ { \ char __tmp = *__a; \ @@ -828,7 +790,7 @@ typedef struct void wxQsort(void* pbase, size_t total_elems, size_t size, wxSortCallback cmp, const void* user_data) { - register char *base_ptr = (char *) pbase; + char *base_ptr = (char *) pbase; const size_t max_thresh = MAX_THRESH * size; if (total_elems == 0) @@ -942,7 +904,7 @@ void wxQsort(void* pbase, size_t total_elems, char *thresh = base_ptr + max_thresh; if ( thresh > end_ptr ) thresh = end_ptr; - register char *run_ptr; + char *run_ptr; /* Find smallest element in first threshold and place it at the array's beginning. This is the smallest array element, @@ -984,10 +946,58 @@ void wxQsort(void* pbase, size_t total_elems, } } +// ---------------------------------------------------------------------------- +// wxGCD +// Compute the greatest common divisor of two positive integers +// using binary GCD algorithm. +// See: +// http://en.wikipedia.org/wiki/Binary_GCD_algorithm#Iterative_version_in_C +// ---------------------------------------------------------------------------- + +unsigned int wxGCD(unsigned int u, unsigned int v) +{ + // GCD(0,v) == v; GCD(u,0) == u, GCD(0,0) == 0 + if (u == 0) + return v; + if (v == 0) + return u; + + int shift; + + // Let shift := lg K, where K is the greatest power of 2 + // dividing both u and v. + for (shift = 0; ((u | v) & 1) == 0; ++shift) + { + u >>= 1; + v >>= 1; + } + + while ((u & 1) == 0) + u >>= 1; + + // From here on, u is always odd. + do + { + // remove all factors of 2 in v -- they are not common + // note: v is not zero, so while will terminate + while ((v & 1) == 0) + v >>= 1; + + // Now u and v are both odd. Swap if necessary so u <= v, + // then set v = v - u (which is even) + if (u > v) + { + wxSwap(u, v); + } + v -= u; // Here v >= u + } while (v != 0); + + // restore common factors of 2 + return u << shift; +} + #endif // wxUSE_BASE - - // ============================================================================ // GUI-only functions from now on // ============================================================================ @@ -1008,21 +1018,17 @@ bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) ) // Launch default browser // ---------------------------------------------------------------------------- -#if defined(__WINDOWS__) +#if defined(__WINDOWS__) || \ + defined(__WXX11__) || defined(__WXGTK__) || defined(__WXMOTIF__) || \ + defined(__WXOSX__) // implemented in a port-specific utils source file: -bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags); - -#elif defined(__WXX11__) || defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || \ - (defined(__WXOSX__) ) - -// implemented in a port-specific utils source file: -bool wxDoLaunchDefaultBrowser(const wxString& url, int flags); +bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params); #else // a "generic" implementation: -bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { // on other platforms try to use mime types or wxExecute... @@ -1036,7 +1042,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) wxString mt; ft->GetMimeType(&mt); - ok = ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(url)); + ok = ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(params.url)); delete ft; } #endif // wxUSE_MIMETYPE @@ -1045,7 +1051,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) { // fallback to checking for the BROWSER environment variable if ( !wxGetEnv(wxT("BROWSER"), &cmd) || cmd.empty() ) - cmd << wxT(' ') << url; + cmd << wxT(' ') << params.url; } ok = ( !cmd.empty() && wxExecute(cmd) ); @@ -1059,90 +1065,54 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) } #endif -static bool DoLaunchDefaultBrowserHelper(const wxString& urlOrig, int flags) +static bool DoLaunchDefaultBrowserHelper(const wxString& url, int flags) { - // NOTE: we don't have to care about the wxBROWSER_NOBUSYCURSOR flag - // as it was already handled by wxLaunchDefaultBrowser + wxLaunchBrowserParams params(flags); - wxUnusedVar(flags); - - wxString url(urlOrig), scheme; - wxURI uri(url); + const wxURI uri(url); // this check is useful to avoid that wxURI recognizes as scheme parts of - // the filename, in case urlOrig is a local filename + // the filename, in case url is a local filename // (e.g. "C:\\test.txt" when parsed by wxURI reports a scheme == "C") bool hasValidScheme = uri.HasScheme() && uri.GetScheme().length() > 1; -#if defined(__WINDOWS__) - - // NOTE: when testing wxMSW's wxLaunchDefaultBrowser all possible forms - // of the URL/flags should be tested; e.g.: - // - // for (int i=0; i<2; i++) - // { - // // test arguments without a valid URL scheme: - // wxLaunchDefaultBrowser("C:\\test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); - // wxLaunchDefaultBrowser("wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); - // - // // test arguments with different valid schemes: - // wxLaunchDefaultBrowser("file:/C%3A/test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); - // wxLaunchDefaultBrowser("http://wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); - // wxLaunchDefaultBrowser("mailto:user@host.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); - // } - // (assuming you have a C:\test.txt file) - if ( !hasValidScheme ) { - if (wxFileExists(urlOrig) || wxDirExists(urlOrig)) + if (wxFileExists(url) || wxDirExists(url)) { - scheme = "file"; - // do not prepend the file scheme to the URL as ShellExecuteEx() doesn't like it + params.scheme = "file"; + params.path = url; } else { - url.Prepend(wxS("http://")); - scheme = "http"; + params.scheme = "http"; } + + params.url << params.scheme << wxS("://") << url; } else if ( hasValidScheme ) { - scheme = uri.GetScheme(); + params.url = url; + params.scheme = uri.GetScheme(); - if ( uri.GetScheme() == "file" ) + if ( params.scheme == "file" ) { // TODO: extract URLToFileName() to some always compiled in // function #if wxUSE_FILESYSTEM - // ShellExecuteEx() doesn't like the "file" scheme when opening local files; - // remove it - url = wxFileSystem::URLToFileName(url).GetFullPath(); + // for same reason as above, remove the scheme from the URL + params.path = wxFileSystem::URLToFileName(url).GetFullPath(); #endif // wxUSE_FILESYSTEM } } - if (wxDoLaunchDefaultBrowser(url, scheme, flags)) - return true; - //else: call wxLogSysError -#else - if ( !hasValidScheme ) + if ( !wxDoLaunchDefaultBrowser(params) ) { - // set the scheme of url to "http" or "file" if it does not have one - if (wxFileExists(urlOrig) || wxDirExists(urlOrig)) - url.Prepend(wxS("file://")); - else - url.Prepend(wxS("http://")); + wxLogSysError(_("Failed to open URL \"%s\" in default browser."), url); + return false; } - if (wxDoLaunchDefaultBrowser(url, flags)) - return true; - //else: call wxLogSysError -#endif - - wxLogSysError(_("Failed to open URL \"%s\" in default browser."), - url.c_str()); - - return false; + return true; } bool wxLaunchDefaultBrowser(const wxString& url, int flags) @@ -1161,30 +1131,6 @@ bool wxLaunchDefaultBrowser(const wxString& url, int flags) // Menu accelerators related functions // ---------------------------------------------------------------------------- -#if WXWIN_COMPATIBILITY_2_6 -wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out) -{ -#if wxUSE_MENUS - wxString s = wxMenuItem::GetLabelText(in); -#else - wxString str(in); - wxString s = wxStripMenuCodes(str); -#endif // wxUSE_MENUS - if ( out ) - { - // go smash their buffer if it's not big enough - I love char * params - memcpy(out, s.c_str(), s.length() * sizeof(wxChar)); - } - else - { - out = new wxChar[s.length() + 1]; - wxStrcpy(out, s.c_str()); - } - - return out; -} -#endif - wxString wxStripMenuCodes(const wxString& in, int flags) { wxASSERT_MSG( flags, wxT("this is useless to call without any flags") ); @@ -1417,12 +1363,17 @@ wxVersionInfo wxGetLibraryVersionInfo() GTK_MICRO_VERSION); #endif // __WXGTK__ +#ifdef __WXQT__ + msg += wxString::Format("Compile-time QT version is %s.\n", + QT_VERSION_STR); +#endif // __WXQT__ + return wxVersionInfo(wxS("wxWidgets"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, msg, - wxS("Copyright (c) 1995-2013 wxWidgets team")); + wxS("Copyright (c) 1995-2016 wxWidgets team")); } void wxInfoMessageBox(wxWindow* parent) diff --git a/Externals/wxWidgets3/src/common/valgen.cpp b/Externals/wxWidgets3/src/common/valgen.cpp index 19c26df510..3f09530cd8 100644 --- a/Externals/wxWidgets3/src/common/valgen.cpp +++ b/Externals/wxWidgets3/src/common/valgen.cpp @@ -49,7 +49,7 @@ #include "wx/valgen.h" -IMPLEMENT_CLASS(wxGenericValidator, wxValidator) +wxIMPLEMENT_CLASS(wxGenericValidator, wxValidator); wxGenericValidator::wxGenericValidator(bool *val) { diff --git a/Externals/wxWidgets3/src/common/validate.cpp b/Externals/wxWidgets3/src/common/validate.cpp index 306cac028d..bfe7f66287 100644 --- a/Externals/wxWidgets3/src/common/validate.cpp +++ b/Externals/wxWidgets3/src/common/validate.cpp @@ -25,7 +25,7 @@ const wxValidator wxDefaultValidator; -IMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler); // VZ: personally, I think true would be more appropriate - these bells are // _annoying_ diff --git a/Externals/wxWidgets3/src/common/valnum.cpp b/Externals/wxWidgets3/src/common/valnum.cpp index 4b12bbf531..bb483502a6 100644 --- a/Externals/wxWidgets3/src/common/valnum.cpp +++ b/Externals/wxWidgets3/src/common/valnum.cpp @@ -36,10 +36,10 @@ // wxNumValidatorBase implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxNumValidatorBase, wxValidator) +wxBEGIN_EVENT_TABLE(wxNumValidatorBase, wxValidator) EVT_CHAR(wxNumValidatorBase::OnChar) EVT_KILL_FOCUS(wxNumValidatorBase::OnKillFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() int wxNumValidatorBase::GetFormatFlags() const { diff --git a/Externals/wxWidgets3/src/common/valtext.cpp b/Externals/wxWidgets3/src/common/valtext.cpp index e0621d050a..04f85840e2 100644 --- a/Externals/wxWidgets3/src/common/valtext.cpp +++ b/Externals/wxWidgets3/src/common/valtext.cpp @@ -56,10 +56,10 @@ static bool wxIsNumeric(const wxString& val) // wxTextValidator // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTextValidator, wxValidator) -BEGIN_EVENT_TABLE(wxTextValidator, wxValidator) +wxIMPLEMENT_DYNAMIC_CLASS(wxTextValidator, wxValidator); +wxBEGIN_EVENT_TABLE(wxTextValidator, wxValidator) EVT_CHAR(wxTextValidator::OnChar) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTextValidator::wxTextValidator(long style, wxString *val) { @@ -156,10 +156,15 @@ bool wxTextValidator::Validate(wxWindow *parent) wxString val(text->GetValue()); wxString errormsg; + + // We can only do some kinds of validation once the input is complete, so + // check for them here: if ( HasFlag(wxFILTER_EMPTY) && val.empty() ) - { errormsg = _("Required information entry is empty."); - } + else if ( HasFlag(wxFILTER_INCLUDE_LIST) && m_includes.Index(val) == wxNOT_FOUND ) + errormsg = wxString::Format(_("'%s' is not one of the valid strings"), val); + else if ( HasFlag(wxFILTER_EXCLUDE_LIST) && m_excludes.Index(val) != wxNOT_FOUND ) + errormsg = wxString::Format(_("'%s' is one of the invalid strings"), val); else if ( !(errormsg = IsValid(val)).empty() ) { // NB: this format string should always contain exactly one '%s' @@ -245,14 +250,10 @@ wxString wxTextValidator::IsValid(const wxString& val) const return _("'%s' should only contain digits."); if ( HasFlag(wxFILTER_NUMERIC) && !wxIsNumeric(val) ) return _("'%s' should be numeric."); - if ( HasFlag(wxFILTER_INCLUDE_LIST) && m_includes.Index(val) == wxNOT_FOUND ) - return _("'%s' is invalid"); if ( HasFlag(wxFILTER_INCLUDE_CHAR_LIST) && !ContainsOnlyIncludedCharacters(val) ) - return _("'%s' is invalid"); - if ( HasFlag(wxFILTER_EXCLUDE_LIST) && m_excludes.Index(val) != wxNOT_FOUND ) - return _("'%s' is invalid"); + return _("'%s' doesn't consist only of valid characters"); if ( HasFlag(wxFILTER_EXCLUDE_CHAR_LIST) && ContainsExcludedCharacters(val) ) - return _("'%s' is invalid"); + return _("'%s' contains illegal characters"); return wxEmptyString; } @@ -301,32 +302,34 @@ void wxTextValidator::SetCharExcludes(const wxString& chars) void wxTextValidator::OnChar(wxKeyEvent& event) { - if (!m_validatorWindow) - { - event.Skip(); - return; - } + // Let the event propagate by default. + event.Skip(); + if (!m_validatorWindow) + return; + +#if wxUSE_UNICODE + // We only filter normal, printable characters. + int keyCode = event.GetUnicodeKey(); +#else // !wxUSE_UNICODE int keyCode = event.GetKeyCode(); + if (keyCode > WXK_START) + return; +#endif // wxUSE_UNICODE/!wxUSE_UNICODE // we don't filter special keys and delete - if (keyCode < WXK_SPACE || keyCode == WXK_DELETE || keyCode >= WXK_START) - { - event.Skip(); + if (keyCode < WXK_SPACE || keyCode == WXK_DELETE) return; - } wxString str((wxUniChar)keyCode, 1); - if (!IsValid(str).empty()) - { - if ( !wxValidator::IsSilent() ) - wxBell(); - - // eat message + if (IsValid(str).empty()) return; - } - else - event.Skip(); + + if ( !wxValidator::IsSilent() ) + wxBell(); + + // eat message + event.Skip(false); } diff --git a/Externals/wxWidgets3/src/common/variant.cpp b/Externals/wxWidgets3/src/common/variant.cpp index 5fc1931bba..a8693207dd 100644 --- a/Externals/wxWidgets3/src/common/variant.cpp +++ b/Externals/wxWidgets3/src/common/variant.cpp @@ -53,7 +53,7 @@ WX_DEFINE_LIST(wxVariantList) * wxVariant */ -IMPLEMENT_DYNAMIC_CLASS(wxVariant, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxVariant, wxObject); wxVariant::wxVariant() : wxObject() @@ -247,22 +247,22 @@ public: inline long GetValue() const { return m_value; } inline void SetValue(long value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; + virtual bool Read(wxString& str) wxOVERRIDE; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; + virtual bool Read(wxSTD istream& str) wxOVERRIDE; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream &str) const; #endif // wxUSE_STREAMS - wxVariantData* Clone() const { return new wxVariantDataLong(m_value); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataLong(m_value); } - virtual wxString GetType() const { return wxT("long"); } + virtual wxString GetType() const wxOVERRIDE { return wxT("long"); } #if wxUSE_ANY // Since wxAny does not have separate type for integers shorter than @@ -271,7 +271,7 @@ public: #ifndef wxLongLong_t DECLARE_WXANY_CONVERSION() #else - bool GetAsAny(wxAny* any) const + bool GetAsAny(wxAny* any) const wxOVERRIDE { *any = m_value; return true; @@ -416,22 +416,22 @@ public: inline double GetValue() const { return m_value; } inline void SetValue(double value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; - virtual bool Read(wxString& str); + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; + virtual bool Read(wxString& str) wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream &str) const; #endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("double"); } + virtual wxString GetType() const wxOVERRIDE { return wxT("double"); } - wxVariantData* Clone() const { return new wxVariantDoubleData(m_value); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDoubleData(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -556,22 +556,22 @@ public: inline bool GetValue() const { return m_value; } inline void SetValue(bool value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; - virtual bool Read(wxString& str); + virtual bool Write(wxString& str) const wxOVERRIDE; + virtual bool Read(wxString& str) wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream& str) const; #endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("bool"); } + virtual wxString GetType() const wxOVERRIDE { return wxT("bool"); } - wxVariantData* Clone() const { return new wxVariantDataBool(m_value); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataBool(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -699,19 +699,19 @@ public: inline wxUniChar GetValue() const { return m_value; } inline void SetValue(const wxUniChar& value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; + virtual bool Read(wxSTD istream& str) wxOVERRIDE; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; + virtual bool Read(wxString& str) wxOVERRIDE; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream& str) const; #endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("char"); } - wxVariantData* Clone() const { return new wxVariantDataChar(m_value); } + virtual wxString GetType() const wxOVERRIDE { return wxT("char"); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataChar(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -852,21 +852,21 @@ public: inline wxString GetValue() const { return m_value; } inline void SetValue(const wxString& value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; + virtual bool Read(wxString& str) wxOVERRIDE; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& WXUNUSED(str)) { return false; } + virtual bool Read(wxSTD istream& WXUNUSED(str)) wxOVERRIDE { return false; } #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream& str) const; #endif // wxUSE_STREAMS - virtual wxString GetType() const { return wxT("string"); } - wxVariantData* Clone() const { return new wxVariantDataString(m_value); } + virtual wxString GetType() const wxOVERRIDE { return wxT("string"); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataString(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -879,12 +879,12 @@ IMPLEMENT_TRIVIAL_WXANY_CONVERSION(wxString, wxVariantDataString) // This allows converting string literal wxAnys to string variants wxVariantData* wxVariantDataFromConstCharPAny(const wxAny& any) { - return new wxVariantDataString(wxANY_AS(any, const char*)); + return new wxVariantDataString(any.As()); } wxVariantData* wxVariantDataFromConstWchar_tPAny(const wxAny& any) { - return new wxVariantDataString(wxANY_AS(any, const wchar_t*)); + return new wxVariantDataString(any.As()); } _REGISTER_WXANY_CONVERSION(const char*, @@ -1047,19 +1047,19 @@ public: inline wxObject* GetValue() const { return m_value; } inline void SetValue(wxObject* value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual wxString GetType() const ; - virtual wxVariantData* Clone() const { return new wxVariantDataWxObjectPtr(m_value); } + virtual bool Read(wxString& str) wxOVERRIDE; + virtual wxString GetType() const wxOVERRIDE ; + virtual wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataWxObjectPtr(m_value); } - virtual wxClassInfo* GetValueClassInfo(); + virtual wxClassInfo* GetValueClassInfo() wxOVERRIDE; DECLARE_WXANY_CONVERSION() protected: @@ -1171,17 +1171,17 @@ public: inline void* GetValue() const { return m_value; } inline void SetValue(void* value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("void*"); } - virtual wxVariantData* Clone() const { return new wxVariantDataVoidPtr(m_value); } + virtual bool Read(wxString& str) wxOVERRIDE; + virtual wxString GetType() const wxOVERRIDE { return wxT("void*"); } + virtual wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataVoidPtr(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -1286,17 +1286,17 @@ public: inline wxDateTime GetValue() const { return m_value; } inline void SetValue(const wxDateTime& value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("datetime"); } - virtual wxVariantData* Clone() const { return new wxVariantDataDateTime(m_value); } + virtual bool Read(wxString& str) wxOVERRIDE; + virtual wxString GetType() const wxOVERRIDE { return wxT("datetime"); } + virtual wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataDateTime(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -1419,17 +1419,17 @@ public: wxArrayString GetValue() const { return m_value; } void SetValue(const wxArrayString& value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("arrstring"); } - virtual wxVariantData* Clone() const { return new wxVariantDataArrayString(m_value); } + virtual bool Read(wxString& str) wxOVERRIDE; + virtual wxString GetType() const wxOVERRIDE { return wxT("arrstring"); } + virtual wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataArrayString(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -1547,25 +1547,25 @@ public: wxLongLong GetValue() const { return m_value; } void SetValue(wxLongLong value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; + virtual bool Read(wxString& str) wxOVERRIDE; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; + virtual bool Read(wxSTD istream& str) wxOVERRIDE; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream &str) const; #endif // wxUSE_STREAMS - wxVariantData* Clone() const + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataLongLong(m_value); } - virtual wxString GetType() const { return wxS("longlong"); } + virtual wxString GetType() const wxOVERRIDE { return wxS("longlong"); } DECLARE_WXANY_CONVERSION() protected: @@ -1586,7 +1586,7 @@ bool wxVariantDataLongLong::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataLongLong::VariantDataFactory(const wxAny& any) { - return new wxVariantDataLongLong(wxANY_AS(any, wxLongLong_t)); + return new wxVariantDataLongLong(any.As()); } REGISTER_WXANY_CONVERSION(wxLongLong_t, wxVariantDataLongLong) @@ -1601,7 +1601,7 @@ bool wxVariantDataLongLong::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataLongLong::VariantDataFactory(const wxAny& any) { - return new wxVariantDataLongLong(wxANY_AS(any, wxLongLong)); + return new wxVariantDataLongLong(any.As()); } REGISTER_WXANY_CONVERSION(wxLongLong, wxVariantDataLongLong) @@ -1746,25 +1746,25 @@ public: wxULongLong GetValue() const { return m_value; } void SetValue(wxULongLong value) { m_value = value; } - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; - virtual bool Read(wxString& str); - virtual bool Write(wxString& str) const; + virtual bool Read(wxString& str) wxOVERRIDE; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); - virtual bool Write(wxSTD ostream& str) const; + virtual bool Read(wxSTD istream& str) wxOVERRIDE; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif #if wxUSE_STREAMS virtual bool Read(wxInputStream& str); virtual bool Write(wxOutputStream &str) const; #endif // wxUSE_STREAMS - wxVariantData* Clone() const + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataULongLong(m_value); } - virtual wxString GetType() const { return wxS("ulonglong"); } + virtual wxString GetType() const wxOVERRIDE { return wxS("ulonglong"); } DECLARE_WXANY_CONVERSION() protected: @@ -1785,7 +1785,7 @@ bool wxVariantDataULongLong::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataULongLong::VariantDataFactory(const wxAny& any) { - return new wxVariantDataULongLong(wxANY_AS(any, wxULongLong_t)); + return new wxVariantDataULongLong(any.As()); } REGISTER_WXANY_CONVERSION(wxULongLong_t, wxVariantDataULongLong) @@ -1800,7 +1800,7 @@ bool wxVariantDataULongLong::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataULongLong::VariantDataFactory(const wxAny& any) { - return new wxVariantDataULongLong(wxANY_AS(any, wxULongLong)); + return new wxVariantDataULongLong(any.As()); } REGISTER_WXANY_CONVERSION(wxULongLong, wxVariantDataULongLong) @@ -1945,20 +1945,20 @@ public: wxVariantList& GetValue() { return m_value; } void SetValue(const wxVariantList& value) ; - virtual bool Eq(wxVariantData& data) const; + virtual bool Eq(wxVariantData& data) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Write(wxSTD ostream& str) const; + virtual bool Write(wxSTD ostream& str) const wxOVERRIDE; #endif - virtual bool Write(wxString& str) const; + virtual bool Write(wxString& str) const wxOVERRIDE; #if wxUSE_STD_IOSTREAM - virtual bool Read(wxSTD istream& str); + virtual bool Read(wxSTD istream& str) wxOVERRIDE; #endif - virtual bool Read(wxString& str); - virtual wxString GetType() const { return wxT("list"); } + virtual bool Read(wxString& str) wxOVERRIDE; + virtual wxString GetType() const wxOVERRIDE { return wxT("list"); } void Clear(); - wxVariantData* Clone() const { return new wxVariantDataList(m_value); } + wxVariantData* Clone() const wxOVERRIDE { return new wxVariantDataList(m_value); } DECLARE_WXANY_CONVERSION() protected: @@ -1988,7 +1988,7 @@ bool wxVariantDataList::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataList::VariantDataFactory(const wxAny& any) { - wxAnyList src = wxANY_AS(any, wxAnyList); + wxAnyList src = any.As(); wxVariantList dst; wxAnyList::compatibility_iterator node = src.GetFirst(); while (node) diff --git a/Externals/wxWidgets3/src/common/webview.cpp b/Externals/wxWidgets3/src/common/webview.cpp index afaf3ffd09..4ef397022a 100644 --- a/Externals/wxWidgets3/src/common/webview.cpp +++ b/Externals/wxWidgets3/src/common/webview.cpp @@ -17,7 +17,7 @@ #include "wx/webview.h" -#if defined(__WXOSX_COCOA__) || defined(__WXOSX_CARBON__) +#if defined(__WXOSX__) #include "wx/osx/webview_webkit.h" #elif defined(__WXGTK__) #include "wx/gtk/webview_webkit.h" diff --git a/Externals/wxWidgets3/src/common/wincmn.cpp b/Externals/wxWidgets3/src/common/wincmn.cpp index ad4887093b..d9f52733c7 100644 --- a/Externals/wxWidgets3/src/common/wincmn.cpp +++ b/Externals/wxWidgets3/src/common/wincmn.cpp @@ -27,6 +27,7 @@ #include "wx/string.h" #include "wx/log.h" #include "wx/intl.h" + #include "wx/math.h" #include "wx/frame.h" #include "wx/window.h" #include "wx/control.h" @@ -41,6 +42,7 @@ #include "wx/statusbr.h" #include "wx/toolbar.h" #include "wx/dcclient.h" + #include "wx/dcscreen.h" #include "wx/scrolbar.h" #include "wx/layout.h" #include "wx/sizer.h" @@ -97,18 +99,22 @@ bool IsInCaptureStack(wxWindowBase* win); } // wxMouseCapture +// We consider 96 DPI to be the standard value, this is correct at least for +// MSW, but could conceivably need adjustment for the other platforms. +static const int BASELINE_DPI = 96; + // ---------------------------------------------------------------------------- // static data // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler) +wxIMPLEMENT_ABSTRACT_CLASS(wxWindowBase, wxEvtHandler); // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler) EVT_SYS_COLOUR_CHANGED(wxWindowBase::OnSysColourChanged) EVT_INIT_DIALOG(wxWindowBase::OnInitDialog) EVT_MIDDLE_DOWN(wxWindowBase::OnMiddleClick) @@ -118,7 +124,7 @@ BEGIN_EVENT_TABLE(wxWindowBase, wxEvtHandler) #endif // wxUSE_HELP EVT_SIZE(wxWindowBase::InternalOnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation of the common functionality of the wxWindow class @@ -251,7 +257,7 @@ wxCONSTRUCTOR_DUMMY(wxWindow) #else #ifndef __WXUNIVERSAL__ -IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase); #endif #endif @@ -416,14 +422,6 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent, SetValidator(validator); #endif // wxUSE_VALIDATORS - // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to - // have it too - like this it's possible to set it only in the top level - // dialog/frame and all children will inherit it by defult - if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) ) - { - SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY); - } - return true; } @@ -791,6 +789,17 @@ wxSize wxWindowBase::DoGetBestSize() const return best; } +double wxWindowBase::GetContentScaleFactor() const +{ + // Currently we don't support per-monitor DPI, so it's useless to construct + // a DC associated with this window, just use the global value. + // + // We also use just the vertical component of the DPI because it's the one + // that counts most and, in practice, it's equal to the horizontal one + // anyhow. + return double(wxScreenDC().GetPPI().y) / BASELINE_DPI; +} + // helper of GetWindowBorderSize(): as many ports don't implement support for // wxSYS_BORDER/EDGE_X/Y metrics in their wxSystemSettings, use hard coded // fallbacks in this case @@ -1017,15 +1026,15 @@ void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant ) break; case wxWINDOW_VARIANT_SMALL: - size = wxRound(size * 3.0 / 4.0); + size = wxRound(size / 1.2); break; case wxWINDOW_VARIANT_MINI: - size = wxRound(size * 2.0 / 3.0); + size = wxRound(size / (1.2 * 1.2)); break; case wxWINDOW_VARIANT_LARGE: - size = wxRound(size * 5.0 / 4.0); + size = wxRound(size * 1.2); break; default: @@ -1569,17 +1578,7 @@ wxWindowBase::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) wxVisualAttributes attrs; attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); - - // On Smartphone/PocketPC, wxSYS_COLOUR_WINDOW is a better reflection of - // the usual background colour than wxSYS_COLOUR_BTNFACE. - // It's a pity that wxSYS_COLOUR_WINDOW isn't always a suitable background - // colour on other platforms. - -#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) - attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); -#else attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); -#endif return attrs; } @@ -1912,23 +1911,20 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent, long id, wxFindWindowCmp cmp) { - if ( parent ) - { - // see if this is the one we're looking for - if ( (*cmp)(parent, label, id) ) - return (wxWindow *)parent; + // see if this is the one we're looking for + if ( (*cmp)(parent, label, id) ) + return (wxWindow *)parent; - // It wasn't, so check all its children - for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - // recursively check each child - wxWindow *win = (wxWindow *)node->GetData(); - wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp); - if (retwin) - return retwin; - } + // It wasn't, so check all its children + for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); + node; + node = node->GetNext() ) + { + // recursively check each child + wxWindow *win = (wxWindow *)node->GetData(); + wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp); + if (retwin) + return retwin; } // Not found @@ -2032,12 +2028,9 @@ public: } // Traverse all the direct children calling OnDo() on them and also all - // grandchildren if wxWS_EX_VALIDATE_RECURSIVELY is used, calling - // OnRecurse() for them. + // grandchildren, calling OnRecurse() for them. bool DoForAllChildren() { - const bool recurse = m_win->HasExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); - wxWindowList& children = m_win->GetChildren(); for ( wxWindowList::iterator i = children.begin(); i != children.end(); @@ -2053,7 +2046,7 @@ public: // Notice that validation should never recurse into top level // children, e.g. some other dialog which might happen to be // currently shown. - if ( recurse && !child->IsTopLevel() && !OnRecurse(child) ) + if ( !child->IsTopLevel() && !OnRecurse(child) ) { return false; } @@ -2096,12 +2089,12 @@ bool wxWindowBase::Validate() { } - virtual bool OnDo(wxValidator* validator) + virtual bool OnDo(wxValidator* validator) wxOVERRIDE { return validator->Validate(m_win); } - virtual bool OnRecurse(wxWindow* child) + virtual bool OnRecurse(wxWindow* child) wxOVERRIDE { return child->Validate(); } @@ -2124,7 +2117,7 @@ bool wxWindowBase::TransferDataToWindow() { } - virtual bool OnDo(wxValidator* validator) + virtual bool OnDo(wxValidator* validator) wxOVERRIDE { if ( !validator->TransferToWindow() ) { @@ -2139,7 +2132,7 @@ bool wxWindowBase::TransferDataToWindow() return true; } - virtual bool OnRecurse(wxWindow* child) + virtual bool OnRecurse(wxWindow* child) wxOVERRIDE { return child->TransferDataToWindow(); } @@ -2162,12 +2155,12 @@ bool wxWindowBase::TransferDataFromWindow() { } - virtual bool OnDo(wxValidator* validator) + virtual bool OnDo(wxValidator* validator) wxOVERRIDE { return validator->TransferFromWindow(); } - virtual bool OnRecurse(wxWindow* child) + virtual bool OnRecurse(wxWindow* child) wxOVERRIDE { return child->TransferDataFromWindow(); } @@ -2282,7 +2275,7 @@ wxString wxWindowBase::GetToolTipText() const return m_tooltip ? m_tooltip->GetTip() : wxString(); } -void wxWindowBase::SetToolTip( const wxString &tip ) +void wxWindowBase::DoSetToolTipText( const wxString &tip ) { // don't create the new tooltip if we already have one if ( m_tooltip ) @@ -2462,12 +2455,21 @@ void wxWindowBase::SetSizerAndFit(wxSizer *sizer, bool deleteOld) void wxWindowBase::SetContainingSizer(wxSizer* sizer) { - // adding a window to a sizer twice is going to result in fatal and - // hard to debug problems later because when deleting the second - // associated wxSizerItem we're going to dereference a dangling - // pointer; so try to detect this as early as possible - wxASSERT_MSG( !sizer || m_containingSizer != sizer, - wxT("Adding a window to the same sizer twice?") ); + // Adding a window to another sizer if it's already managed by one would + // result in crashes later because one of the two sizers won't be notified + // about the window destruction and so will use a dangling pointer when it + // is destroyed itself. As such problems are hard to debug, don't allow + // them to happen in the first place. + if ( sizer ) + { + // This would be caught by the check below too, but give a more clear + // error message in this case. + wxASSERT_MSG( m_containingSizer != sizer, + wxS("Adding a window to the same sizer twice?") ); + + wxCHECK_RET( !m_containingSizer, + wxS("Adding a window already in a sizer, detach it first!") ); + } m_containingSizer = sizer; } @@ -2848,9 +2850,37 @@ void wxWindowBase::OnInternalIdle() } // ---------------------------------------------------------------------------- -// dialog units translations +// DPI-independent pixels and dialog units translations // ---------------------------------------------------------------------------- +#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS + +/* static */ +wxSize +wxWindowBase::FromDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) +{ + const wxSize dpi = wxScreenDC().GetPPI(); + + // Take care to not scale -1 because it has a special meaning of + // "unspecified" which should be preserved. + return wxSize(sz.x == -1 ? -1 : wxMulDivInt32(sz.x, dpi.x, BASELINE_DPI), + sz.y == -1 ? -1 : wxMulDivInt32(sz.y, dpi.y, BASELINE_DPI)); +} + +/* static */ +wxSize +wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* WXUNUSED(w)) +{ + const wxSize dpi = wxScreenDC().GetPPI(); + + // Take care to not scale -1 because it has a special meaning of + // "unspecified" which should be preserved. + return wxSize(sz.x == -1 ? -1 : wxMulDivInt32(sz.x, BASELINE_DPI, dpi.x), + sz.y == -1 ? -1 : wxMulDivInt32(sz.y, BASELINE_DPI, dpi.y)); +} + +#endif // !wxHAVE_DPI_INDEPENDENT_PIXELS + // Windows' computes dialog units using average character width over upper- // and lower-case ASCII alphabet and not using the average character width // metadata stored in the font; see @@ -3560,7 +3590,7 @@ public: DragAcceptFilesTarget(wxWindowBase *win) : m_win(win) {} virtual bool OnDropFiles(wxCoord x, wxCoord y, - const wxArrayString& filenames) + const wxArrayString& filenames) wxOVERRIDE { wxDropFilesEvent event(wxEVT_DROP_FILES, filenames.size(), diff --git a/Externals/wxWidgets3/src/common/windowid.cpp b/Externals/wxWidgets3/src/common/windowid.cpp index d0ee64ff54..20a0efbe20 100644 --- a/Externals/wxWidgets3/src/common/windowid.cpp +++ b/Externals/wxWidgets3/src/common/windowid.cpp @@ -26,8 +26,6 @@ // Not needed, included in defs.h // #include "wx/windowid.h" -#define wxTRACE_WINDOWID wxT("windowid") - namespace { @@ -89,9 +87,6 @@ void UnreserveIdRefCount(wxWindowID winid) // Get the usage count of an id int GetIdRefCount(wxWindowID winid) { - wxCHECK_MSG(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST, 0, - wxT("invalid id range")); - winid -= wxID_AUTO_LOWEST; int refCount = gs_autoIdsRefCount[winid]; if (refCount == ID_COUNTTOOLARGE) @@ -102,9 +97,6 @@ int GetIdRefCount(wxWindowID winid) // Increase the count for an id void IncIdRefCount(wxWindowID winid) { - wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST, - wxT("invalid id range")); - winid -= wxID_AUTO_LOWEST; wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id should first be reserved")); @@ -130,17 +122,11 @@ void IncIdRefCount(wxWindowID winid) { gs_autoIdsRefCount[winid]++; } - - wxLogTrace(wxTRACE_WINDOWID, wxT("Increasing ref count of ID %d to %d"), - winid + wxID_AUTO_LOWEST, GetIdRefCount(winid + wxID_AUTO_LOWEST)); } // Decrease the count for an id void DecIdRefCount(wxWindowID winid) { - wxCHECK_RET(winid >= wxID_AUTO_LOWEST && winid <= wxID_AUTO_HIGHEST, - wxT("invalid id range")); - winid -= wxID_AUTO_LOWEST; wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id count already 0")); @@ -167,9 +153,6 @@ void DecIdRefCount(wxWindowID winid) } else gs_autoIdsRefCount[winid]--; - - wxLogTrace(wxTRACE_WINDOWID, wxT("Decreasing ref count of ID %d to %d"), - winid + wxID_AUTO_LOWEST, GetIdRefCount(winid + wxID_AUTO_LOWEST)); } #else // wxUSE_AUTOID_MANAGEMENT diff --git a/Externals/wxWidgets3/src/common/wrapsizer.cpp b/Externals/wxWidgets3/src/common/wrapsizer.cpp index e1b112bed5..90118e3c74 100644 --- a/Externals/wxWidgets3/src/common/wrapsizer.cpp +++ b/Externals/wxWidgets3/src/common/wrapsizer.cpp @@ -67,7 +67,7 @@ private: // wxWrapSizer implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxWrapSizer, wxBoxSizer) +wxIMPLEMENT_DYNAMIC_CLASS(wxWrapSizer, wxBoxSizer); wxWrapSizer::wxWrapSizer(int orient, int flags) : wxBoxSizer(orient), @@ -141,8 +141,8 @@ bool wxWrapSizer::InformFirstDirection(int direction, // Store the values for later use m_availSize = size; m_availableOtherDir = availableOtherDir + - (direction == wxHORIZONTAL ? m_minSize.y - : m_minSize.x); + (direction == wxHORIZONTAL ? m_calculatedMinSize.y + : m_calculatedMinSize.x); m_dirInform = direction; m_lastUsed = false; return true; @@ -208,7 +208,7 @@ wxSize wxWrapSizer::CalcMin() } } - return m_minSize; + return m_calculatedMinSize; } void wxWrapSizer::CalcMinFittingSize(const wxSize& szBoundary) @@ -220,7 +220,7 @@ void wxWrapSizer::CalcMinFittingSize(const wxSize& szBoundary) if ( m_minSizeMinor < SizeInMinorDir(m_size) && m_maxSizeMajor < SizeInMajorDir(m_size) ) { - m_minSize = sizeMin; + m_calculatedMinSize = sizeMin; } else { @@ -231,9 +231,9 @@ void wxWrapSizer::CalcMinFittingSize(const wxSize& szBoundary) // We try to present a lower min value by removing an item in // the major direction (and preserving current minor min size). CalcMinFromMajor(m_maxSizeMajor - m_minItemMajor); - if ( m_minSize.x <= szBoundary.x && m_minSize.y <= szBoundary.y ) + if ( m_calculatedMinSize.x <= szBoundary.x && m_calculatedMinSize.y <= szBoundary.y ) { - SizeInMinorDir(m_minSize) = SizeInMinorDir(sizeMin); + SizeInMinorDir(m_calculatedMinSize) = SizeInMinorDir(sizeMin); done = true; } } @@ -241,7 +241,7 @@ void wxWrapSizer::CalcMinFittingSize(const wxSize& szBoundary) if ( !done ) { // If failed finding little smaller area, go back to what we had - m_minSize = sizeMin; + m_calculatedMinSize = sizeMin; } } } @@ -269,7 +269,7 @@ void wxWrapSizer::CalcMaxSingleItemSize() // This is, of course, not our real minimal size but if we return more // than this it would be impossible to shrink us to one row/column so // we have to pretend that this is all we need for now. - m_minSize = SizeFromMajorMinor(maxMajor, maxMinor); + m_calculatedMinSize = SizeFromMajorMinor(maxMajor, maxMinor); } void wxWrapSizer::CalcMinFromMajor(int totMajor) @@ -325,7 +325,7 @@ void wxWrapSizer::CalcMinFromMajor(int totMajor) if ( rowTotalMajor > maxTotalMajor ) maxTotalMajor = rowTotalMajor; - m_minSize = SizeFromMajorMinor(maxTotalMajor, minorSum); + m_calculatedMinSize = SizeFromMajorMinor(maxTotalMajor, minorSum); } // Helper struct for CalcMinFromMinor @@ -370,7 +370,7 @@ void wxWrapSizer::CalcMinFromMinor(int totMinor) // The trivial case if ( !itemCount || totMajor==0 || maxMinor==0 ) { - m_minSize = wxSize(0,0); + m_calculatedMinSize = wxSize(0,0); return; } @@ -379,7 +379,7 @@ void wxWrapSizer::CalcMinFromMinor(int totMinor) if ( nrLines<=1 ) { // Another simple case, everything fits on one line - m_minSize = SizeFromMajorMinor(totMajor,maxMinor); + m_calculatedMinSize = SizeFromMajorMinor(totMajor,maxMinor); return; } @@ -469,7 +469,7 @@ void wxWrapSizer::CalcMinFromMinor(int totMinor) } // Now have min size in the opposite direction - m_minSize = SizeFromMajorMinor(lineSize,sumMinor); + m_calculatedMinSize = SizeFromMajorMinor(lineSize,sumMinor); } void wxWrapSizer::FinishRow(size_t n, @@ -565,19 +565,29 @@ void wxWrapSizer::RecalcSizes() sizer->Add(itemSpace); } + // We must pretend that any window item is not part of this sizer, + // otherwise adding it to another one would trigger an assert due + // to a conflict with the current containing sizer. + wxWindow * const win = item->GetWindow(); + if ( win ) + win->SetContainingSizer(NULL); + // Notice that we reuse a pointer to our own sizer item here, so we // must remember to remove it by calling ClearRows() to avoid // double deletion later sizer->Add(item); + // If item is a window, it now has a pointer to the child sizer, + // which is wrong. Set it to point to us. + if ( win ) + { + win->SetContainingSizer(NULL); + win->SetContainingSizer(this); + } + itemLast = item; itemSpace = NULL; } - - // If item is a window, it now has a pointer to the child sizer, - // which is wrong. Set it to point to us. - if ( wxWindow *win = item->GetWindow() ) - win->SetContainingSizer(this); } FinishRow(nRow, rowTotalMajor, maxRowMinor, itemLast); diff --git a/Externals/wxWidgets3/src/common/wxcrt.cpp b/Externals/wxWidgets3/src/common/wxcrt.cpp index 819700c2bf..3071e58edc 100644 --- a/Externals/wxWidgets3/src/common/wxcrt.cpp +++ b/Externals/wxWidgets3/src/common/wxcrt.cpp @@ -39,12 +39,8 @@ extern "C" int vswscanf(const wchar_t *, const wchar_t *, va_list); #endif -#ifndef __WXWINCE__ - #include - #include -#else - #include "wx/msw/wince/time.h" -#endif +#include +#include #ifndef WX_PRECOMP #include "wx/string.h" @@ -57,14 +53,7 @@ #include #endif -#ifdef __WXWINCE__ - // there is no errno.h under CE apparently - #define wxSET_ERRNO(value) -#else - #include - - #define wxSET_ERRNO(value) errno = value -#endif +#include #if defined(__DARWIN__) #include "wx/osx/core/cfref.h" @@ -73,6 +62,10 @@ #include #endif +wxDECL_FOR_STRICT_MINGW32(int, vswprintf, (wchar_t*, const wchar_t*, __VALIST)) +wxDECL_FOR_STRICT_MINGW32(int, _putws, (const wchar_t*)) +wxDECL_FOR_STRICT_MINGW32(void, _wperror, (const wchar_t*)) + WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n) { // assume that we have mbsrtowcs() too if we have wcsrtombs() @@ -89,7 +82,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n) #ifdef HAVE_WCSRTOMBS return mbsrtowcs(buf, &psz, n, &mbstate); #else - return mbstowcs(buf, psz, n); + return wxMbstowcs(buf, psz, n); #endif } @@ -102,7 +95,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n) #ifdef HAVE_WCSRTOMBS return mbsrtowcs(NULL, &psz, 0, &mbstate); #else - return mbstowcs(NULL, psz, 0); + return wxMbstowcs(NULL, psz, 0); #endif } @@ -122,26 +115,19 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *pwz, size_t n) #ifdef HAVE_WCSRTOMBS return wcsrtombs(buf, &pwz, n, &mbstate); #else - return wcstombs(buf, pwz, n); + return wxWcstombs(buf, pwz, n); #endif } #ifdef HAVE_WCSRTOMBS return wcsrtombs(NULL, &pwz, 0, &mbstate); #else - return wcstombs(NULL, pwz, 0); + return wxWcstombs(NULL, pwz, 0); #endif } char* wxSetlocale(int category, const char *locale) { -#ifdef __WXWINCE__ - // FIXME-CE: there is no setlocale() in CE CRT, use SetThreadLocale()? - wxUnusedVar(category); - wxUnusedVar(locale); - - return NULL; -#else // !__WXWINCE__ #ifdef __WXMAC__ char *rv = NULL ; if ( locale != NULL && locale[0] == 0 ) @@ -169,7 +155,6 @@ char* wxSetlocale(int category, const char *locale) wxUpdateLocaleIsUtf8(); } return rv; -#endif // __WXWINCE__/!__WXWINCE__ } // ============================================================================ @@ -192,19 +177,6 @@ char* wxSetlocale(int category, const char *locale) int wxCRT_VfprintfW( FILE *stream, const wchar_t *format, va_list argptr ); #endif -#if defined(__DMC__) -/* Digital Mars adds count to _stprintf (C99) so convert */ -int wxCRT_SprintfW (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... ) -{ - va_list arglist; - - va_start( arglist, format ); - int iLen = swprintf ( s, -1, format, arglist ); - va_end( arglist ); - return iLen ; -} -#endif //__DMC__ - // ---------------------------------------------------------------------------- // implement the standard IO functions for wide char if libc doesn't have them // ---------------------------------------------------------------------------- @@ -299,13 +271,13 @@ static int vswscanf(const wchar_t *ws, const wchar_t *format, va_list argptr) // of the function. This doesn't work with %c and %s because of difference // in size of char and wchar_t, though. - wxCHECK_MSG( wxStrstr(format, wxT("%s")) == NULL, -1, + wxCHECK_MSG( wxStrstr(format, L"%s") == NULL, -1, wxT("incomplete vswscanf implementation doesn't allow %s") ); - wxCHECK_MSG( wxStrstr(format, wxT("%c")) == NULL, -1, + wxCHECK_MSG( wxStrstr(format, L"%c") == NULL, -1, wxT("incomplete vswscanf implementation doesn't allow %c") ); - return vsscanf(static_cast(wxConvLibc.cWX2MB(ws)), - wxConvLibc.cWX2MB(format), argptr); + return wxCRT_VsscanfA(static_cast(wxConvLibc.cWC2MB(ws)), + wxConvLibc.cWC2MB(format), argptr); } #endif @@ -648,20 +620,7 @@ int wxVsprintf(char *str, const wxString& format, va_list argptr) int wxVsprintf(wchar_t *str, const wxString& format, va_list argptr) { #if wxUSE_UNICODE_WCHAR -#ifdef __DMC__ -/* -This fails with a bug similar to -http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=c++.beta&artnum=680 -in DMC 8.49 and 8.50 -I don't see it being used in the wxWidgets sources at present (oct 2007) CE -*/ -#pragma message ( "warning ::::: wxVsprintf(wchar_t *str, const wxString& format, va_list argptr) not yet implemented" ) - wxFAIL_MSG( wxT("TODO") ); - - return -1; -#else return wxCRT_VsprintfW(str, format.wc_str(), argptr); -#endif //DMC #else // wxUSE_UNICODE_UTF8 #if !wxUSE_UTF8_LOCALE_ONLY if ( !wxLocaleIsUtf8 ) @@ -794,7 +753,7 @@ wxChar32* wxStrdup(const wxChar32* s) #ifndef wxCRT_StricmpA WXDLLIMPEXP_BASE int wxCRT_StricmpA(const char *psz1, const char *psz2) { - register char c1, c2; + char c1, c2; do { c1 = wxTolower(*psz1++); c2 = wxTolower(*psz2++); @@ -806,7 +765,7 @@ WXDLLIMPEXP_BASE int wxCRT_StricmpA(const char *psz1, const char *psz2) #ifndef wxCRT_StricmpW WXDLLIMPEXP_BASE int wxCRT_StricmpW(const wchar_t *psz1, const wchar_t *psz2) { - register wchar_t c1, c2; + wchar_t c1, c2; do { c1 = wxTolower(*psz1++); c2 = wxTolower(*psz2++); @@ -819,7 +778,7 @@ WXDLLIMPEXP_BASE int wxCRT_StricmpW(const wchar_t *psz1, const wchar_t *psz2) WXDLLIMPEXP_BASE int wxCRT_StrnicmpA(const char *s1, const char *s2, size_t n) { // initialize the variables just to suppress stupid gcc warning - register char c1 = 0, c2 = 0; + char c1 = 0, c2 = 0; while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1) n--, s1++, s2++; if (n) { if (c1 < c2) return -1; @@ -833,7 +792,7 @@ WXDLLIMPEXP_BASE int wxCRT_StrnicmpA(const char *s1, const char *s2, size_t n) WXDLLIMPEXP_BASE int wxCRT_StrnicmpW(const wchar_t *s1, const wchar_t *s2, size_t n) { // initialize the variables just to suppress stupid gcc warning - register wchar_t c1 = 0, c2 = 0; + wchar_t c1 = 0, c2 = 0; while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1) n--, s1++, s2++; if (n) { if (c1 < c2) return -1; @@ -949,7 +908,7 @@ wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign) // Then it's an error. if ( endptr ) *endptr = (T*) nptr; - wxSET_ERRNO(EINVAL); + errno = EINVAL; return sum; } } @@ -989,7 +948,7 @@ wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign) if ( sum < prevsum ) { - wxSET_ERRNO(ERANGE); + errno = ERANGE; break; } } @@ -1010,7 +969,7 @@ static wxULongLong_t wxCRT_DoStrtoull(const T* nptr, T** endptr, int base) if ( sign == wxT('-') ) { - wxSET_ERRNO(ERANGE); + errno = ERANGE; uval = 0; } @@ -1032,7 +991,7 @@ static wxLongLong_t wxCRT_DoStrtoll(const T* nptr, T** endptr, int base) } else { - wxSET_ERRNO(ERANGE); + errno = ERANGE; } } else if ( uval <= wxINT64_MAX ) @@ -1041,7 +1000,7 @@ static wxLongLong_t wxCRT_DoStrtoll(const T* nptr, T** endptr, int base) } else { - wxSET_ERRNO(ERANGE); + errno = ERANGE; } return val; @@ -1127,17 +1086,6 @@ char *strdup(const char *s) } #endif // wxNEED_STRDUP -#if defined(__WXWINCE__) && (_WIN32_WCE <= 211) - -void *calloc( size_t num, size_t size ) -{ - void** ptr = (void **)malloc(num * size); - memset( ptr, 0, num * size); - return ptr; -} - -#endif // __WXWINCE__ <= 211 - // ============================================================================ // wxLocaleIsUtf8 // ============================================================================ @@ -1276,7 +1224,7 @@ wchar_t *wxFgets(wchar_t *s, int size, FILE *stream) // wxScanf() and friends // ---------------------------------------------------------------------------- -#ifdef HAVE_VSSCANF // __VISUALC__ and __DMC__ see wx/crt.h +#ifdef HAVE_VSSCANF // __VISUALC__, see wx/crt.h int wxVsscanf(const char *str, const char *format, va_list ap) { return wxCRT_VsscanfA(str, format, ap); } int wxVsscanf(const wchar_t *str, const wchar_t *format, va_list ap) @@ -1294,3 +1242,99 @@ int wxVsscanf(const wxCStrData& str, const char *format, va_list ap) int wxVsscanf(const wxCStrData& str, const wchar_t *format, va_list ap) { return wxCRT_VsscanfW(str.AsWCharBuf(), format, ap); } #endif // HAVE_NO_VSSCANF + +// ============================================================================ +// ANDROID specific private implementations (due stubs/missing support in NDK) +// ============================================================================ + +// On android, most wchar_t functions are broken, so instead we must +// convert a byte at a time + +#ifdef __ANDROID__ + +#define ANDROID_WCSTO_START \ + int len = wcslen(nptr) + 1; \ + char dst[len]; \ + for(int i=0; iGetLocaleName().c_str()); } } +#endif // wxUSE_INTL #if wxCHECK_VISUALC_VERSION(8) diff --git a/Externals/wxWidgets3/src/common/xtistrm.cpp b/Externals/wxWidgets3/src/common/xtistrm.cpp index d96db65eb3..b4ec20d411 100644 --- a/Externals/wxWidgets3/src/common/xtistrm.cpp +++ b/Externals/wxWidgets3/src/common/xtistrm.cpp @@ -119,34 +119,30 @@ void wxObjectWriter::FindConnectEntry(const wxEvtHandler * evSource, const wxObject* &sink, const wxHandlerInfo *&handler) { - wxList *dynamicEvents = evSource->GetDynamicEventTable(); - - if ( dynamicEvents ) + size_t cookie; + for ( wxDynamicEventTableEntry* entry = evSource->GetFirstDynamicEntry(cookie); + entry; + entry = evSource->GetNextDynamicEntry(cookie) ) { - for ( wxList::const_iterator node = dynamicEvents->begin(); node != dynamicEvents->end(); ++node ) + // find the match + if ( entry->m_fn && + (dti->GetEventType() == entry->m_eventType) && + (entry->m_id == -1 ) && + (entry->m_fn->GetEvtHandler() != NULL ) ) { - wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)(*node); - - // find the match - if ( entry->m_fn && - (dti->GetEventType() == entry->m_eventType) && - (entry->m_id == -1 ) && - (entry->m_fn->GetEvtHandler() != NULL ) ) + sink = entry->m_fn->GetEvtHandler(); + const wxClassInfo* sinkClassInfo = sink->GetClassInfo(); + const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler(); + while ( sinkHandler ) { - sink = entry->m_fn->GetEvtHandler(); - const wxClassInfo* sinkClassInfo = sink->GetClassInfo(); - const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler(); - while ( sinkHandler ) + if ( sinkHandler->GetEventFunction() == entry->m_fn->GetEvtMethod() ) { - if ( sinkHandler->GetEventFunction() == entry->m_fn->GetEvtMethod() ) - { - handler = sinkHandler; - break; - } - sinkHandler = sinkHandler->GetNext(); + handler = sinkHandler; + break; } - break; + sinkHandler = sinkHandler->GetNext(); } + break; } } } @@ -315,7 +311,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c wx_dynamic_cast(const wxEnumTypeInfo*, pi->GetTypeInfo() ); if ( eti ) { - eti->ConvertFromLong( wxANY_AS(value, long ), value ); + eti->ConvertFromLong( value.As(), value ); } else { diff --git a/Externals/wxWidgets3/src/common/zipstrm.cpp b/Externals/wxWidgets3/src/common/zipstrm.cpp index 07b526d15f..aa68db4bb4 100644 --- a/Externals/wxWidgets3/src/common/zipstrm.cpp +++ b/Externals/wxWidgets3/src/common/zipstrm.cpp @@ -33,7 +33,8 @@ // value for the 'version needed to extract' field (20 means 2.0) enum { - VERSION_NEEDED_TO_EXTRACT = 20 + VERSION_NEEDED_TO_EXTRACT = 20, + Z64_VERSION_NEEDED_TO_EXTRACT = 45 // File uses ZIP64 format extensions }; // signatures for the various records (PKxx) @@ -41,7 +42,9 @@ enum { CENTRAL_MAGIC = 0x02014b50, // central directory record LOCAL_MAGIC = 0x04034b50, // local header END_MAGIC = 0x06054b50, // end of central directory record - SUMS_MAGIC = 0x08074b50 // data descriptor (info-zip) + SUMS_MAGIC = 0x08074b50, // data descriptor (info-zip) + Z64_LOC_MAGIC = 0x07064b50, // zip64 end of central directory locator + Z64_END_MAGIC = 0x06064b50 // zip64 end of central directory record }; // unix file attributes. zip stores them in the high 16 bits of the @@ -57,7 +60,9 @@ enum { CENTRAL_SIZE = 46, LOCAL_SIZE = 30, END_SIZE = 22, - SUMS_SIZE = 12 + SUMS_SIZE = 12, + Z64_LOC_SIZE = 20, + Z64_END_SIZE = 56 }; // The number of bytes that must be written to an wxZipOutputStream before @@ -73,8 +78,8 @@ enum { SUMS_OFFSET = 14 }; -IMPLEMENT_DYNAMIC_CLASS(wxZipEntry, wxArchiveEntry) -IMPLEMENT_DYNAMIC_CLASS(wxZipClassFactory, wxArchiveClassFactory) +wxIMPLEMENT_DYNAMIC_CLASS(wxZipEntry, wxArchiveEntry); +wxIMPLEMENT_DYNAMIC_CLASS(wxZipClassFactory, wxArchiveClassFactory); ///////////////////////////////////////////////////////////////////////////// @@ -103,6 +108,34 @@ static wxString ReadString(wxInputStream& stream, wxUint16 len, wxMBConv& conv) return str; } +static inline wxUint16 LimitUint16(wxUint64 value) +{ + if (value > 0xffff) + return 0xffff; + else + return wx_truncate_cast(wxUint16, value); +} + +static inline wxUint32 LimitUint32(wxUint64 value) +{ + if (value > 0xffffffff) + return 0xffffffff; + else + return wx_truncate_cast(wxUint32,value); +} + +// Decode a little endian wxUint64 number from a character array +// +static inline wxUint64 CrackUint64(const char *m) +{ + const unsigned char *n = (const unsigned char*)m; + return (static_cast(n[7]) << 56) | + (static_cast(n[6]) << 48) | + (static_cast(n[5]) << 40) | + (static_cast(n[4]) << 32) | + (n[3] << 24) | (n[2] << 16) | (n[1] << 8) | n[0]; +} + // Decode a little endian wxUint32 number from a character array // static inline wxUint32 CrackUint32(const char *m) @@ -171,10 +204,12 @@ class wxZipHeader { public: wxZipHeader(wxInputStream& stream, size_t size); + wxZipHeader(const char* data, size_t size); inline wxUint8 Read8(); inline wxUint16 Read16(); inline wxUint32 Read32(); + inline wxUint64 Read64(); const char *GetData() const { return m_data; } size_t GetSize() const { return m_size; } @@ -186,6 +221,7 @@ public: wxZipHeader& operator>>(wxUint8& n) { n = Read8(); return *this; } wxZipHeader& operator>>(wxUint16& n) { n = Read16(); return *this; } wxZipHeader& operator>>(wxUint32& n) { n = Read32(); return *this; } + wxZipHeader& operator>>(wxUint64& n) { n = Read64(); return *this; } private: char m_data[64]; @@ -204,6 +240,15 @@ wxZipHeader::wxZipHeader(wxInputStream& stream, size_t size) m_ok = m_size == size; } +wxZipHeader::wxZipHeader(const char* data, size_t size) + : m_size(size), + m_pos(0), + m_ok(true) +{ + wxCHECK_RET(size <= sizeof(m_data), wxT("buffer too small")); + memcpy(m_data, data, size); +} + inline wxUint8 wxZipHeader::Read8() { wxASSERT(m_pos < m_size); @@ -226,6 +271,13 @@ inline wxUint32 wxZipHeader::Read32() return n; } +inline wxUint64 wxZipHeader::Read64() +{ + wxASSERT(m_pos + 8 <= m_size); + wxUint64 n = CrackUint64(m_data + m_pos); + m_pos += 8; + return n; +} ///////////////////////////////////////////////////////////////////////////// // Stored input stream @@ -239,12 +291,12 @@ public: void Open(wxFileOffset len) { Close(); m_len = len; } void Close() { m_pos = 0; m_lasterror = wxSTREAM_NO_ERROR; } - virtual char Peek() { return wxInputStream::Peek(); } - virtual wxFileOffset GetLength() const { return m_len; } + virtual char Peek() wxOVERRIDE { return wxInputStream::Peek(); } + virtual wxFileOffset GetLength() const wxOVERRIDE { return m_len; } protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: wxFileOffset m_pos; @@ -284,15 +336,15 @@ public: wxStoredOutputStream(wxOutputStream& stream) : wxFilterOutputStream(stream), m_pos(0) { } - bool Close() { + bool Close() wxOVERRIDE { m_pos = 0; m_lasterror = wxSTREAM_NO_ERROR; return true; } protected: - virtual size_t OnSysWrite(const void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } + virtual size_t OnSysWrite(const void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: wxFileOffset m_pos; @@ -320,7 +372,7 @@ size_t wxStoredOutputStream::OnSysWrite(const void *buffer, size_t size) // non-seekable stream. // // In this case there's no option but to decompress the stream to find -// it's length, but we can still write the raw compressed data to avoid the +// its length, but we can still write the raw compressed data to avoid the // compression overhead (which is the greater one). // // Usage is like this: @@ -346,11 +398,11 @@ public: void Open(); bool Final(); - wxInputStream& Read(void *buffer, size_t size); + wxInputStream& Read(void *buffer, size_t size) wxOVERRIDE; protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: wxFileOffset m_pos; @@ -444,8 +496,8 @@ public: wxInputStream& GetTee() const { return *m_tee; } protected: - virtual size_t OnSysRead(void *buffer, size_t size); - virtual wxFileOffset OnSysTell() const { return m_pos; } + virtual size_t OnSysRead(void *buffer, size_t size) wxOVERRIDE; + virtual wxFileOffset OnSysTell() const wxOVERRIDE { return m_pos; } private: wxFileOffset m_pos; @@ -510,7 +562,7 @@ public: wxZlibOutputStream(stream, level, wxZLIB_NO_HEADER) { } bool Open(wxOutputStream& stream); - bool Close() { DoFlush(true); m_pos = wxInvalidOffset; return IsOk(); } + bool Close() wxOVERRIDE { DoFlush(true); m_pos = wxInvalidOffset; return IsOk(); } }; bool wxZlibOutputStream2::Open(wxOutputStream& stream) @@ -785,15 +837,15 @@ wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const switch (wxFileName::GetFormat(format)) { case wxPATH_DOS: { - wxString name(isDir ? m_Name + wxT("\\") : m_Name); - for (size_t i = 0; i < name.length(); i++) - if (name[i] == wxT('/')) - name[i] = wxT('\\'); + wxString name(m_Name); + name.Replace(wxFILE_SEP_PATH_UNIX, wxFILE_SEP_PATH_DOS); + if (isDir) + name += wxFILE_SEP_PATH_DOS; return name; } case wxPATH_UNIX: - return isDir ? m_Name + wxT("/") : m_Name; + return isDir ? m_Name + wxFILE_SEP_PATH_UNIX : m_Name; default: ; @@ -809,6 +861,18 @@ wxString wxZipEntry::GetName(wxPathFormat format /*=wxPATH_NATIVE*/) const return fn.GetFullPath(format); } +namespace +{ + +// Accept both slashes and backslashes for compatibility as a lot of broken +// programs create such archives even though the ZIP specification explicitly +// says to use slashes (see 4.4.17.1). +inline bool IsDOSPathSep(wxUniChar ch) +{ + return ch == wxFILE_SEP_PATH_DOS || ch == wxFILE_SEP_PATH_UNIX; +} +} // anonymous namespace + // Static - Internally tars and zips use forward slashes for the path // separator, absolute paths aren't allowed, and directory names have a // trailing slash. This function converts a path into this internal format, @@ -825,15 +889,16 @@ wxString wxZipEntry::GetInternalName(const wxString& name, else internal = name; - bool isDir = !internal.empty() && internal.Last() == '/'; + bool isDir = !internal.empty() && IsDOSPathSep(internal.Last()); if (pIsDir) *pIsDir = isDir; if (isDir) internal.erase(internal.length() - 1); - while (!internal.empty() && *internal.begin() == '/') + while (!internal.empty() && IsDOSPathSep(*internal.begin())) internal.erase(0, 1); - while (!internal.empty() && internal.compare(0, 2, wxT("./")) == 0) + while (!internal.empty() && + (internal[0] == wxS('.') && IsDOSPathSep(internal[1]))) internal.erase(0, 2); if (internal == wxT(".") || internal == wxT("..")) internal = wxEmptyString; @@ -962,6 +1027,44 @@ void wxZipEntry::UnsetNotifier() m_zipnotifier = NULL; } +bool wxZipEntry::LoadExtraInfo(const char* extraData, wxUint16 extraLen, bool localInfo) +{ + // We need to iterate over all headers + // seeking for the field with Header ID = 1. + // (There is not stated in the documentation + // that it should be the first one in the collection.) + while ( extraLen >= 4 ) + { + // Parse extra header + wxZipHeader hds(extraData, 4); + wxUint16 fieldID = hds.Read16(); + wxUint16 fieldLen = hds.Read16(); + if ( fieldID == 1 ) + { + // Data block for extra field with Header ID = 1 (ZIP64) + // can have length up to 28 bytes. + wxZipHeader ds(extraData+4, wxMin(fieldLen, 28)); + // A file may contain larger size, compressed size or offset + // in a zip64 extra data block. Use the 64 bit values if available + if ( m_Size == 0xffffffff ) + m_Size = ds.Read64(); + if ( m_CompressedSize == 0xffffffff ) + m_CompressedSize = ds.Read64(); + if ( !localInfo && m_Offset == 0xffffffff ) + m_Offset = ds.Read64(); + // extraInfo was used and parsed + return true; + } + + fieldLen += 4; + extraData += fieldLen; + extraLen -= fieldLen; + } + + // extraInfo had unknown format + return false; +} + size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) { wxUint16 nameLen, extraLen; @@ -984,7 +1087,12 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) if ((sumsValid || size) || m_Method == wxZIP_METHOD_STORE) m_Size = size; - SetName(ReadString(stream, nameLen, conv), wxPATH_UNIX); + // Explicit cast to the base class is needed to work around apparent + // compiler bug in MSVS 2005 (FIXME-VC8). + wxMBConv& strConv = m_Flags & wxZIP_LANG_ENC_UTF8 + ? static_cast(wxConvUTF8) + : conv; + SetName(ReadString(stream, nameLen, strConv), wxPATH_UNIX); if (stream.LastRead() != nameLen + 0u) return 0; @@ -994,6 +1102,12 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv) stream.Read(m_LocalExtra->GetData(), extraLen); if (stream.LastRead() != extraLen + 0u) return 0; + + if (LoadExtraInfo(m_LocalExtra->GetData(), extraLen, true)) + { + Release(m_LocalExtra); + m_LocalExtra = NULL; + } } } @@ -1008,24 +1122,37 @@ size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const if (!name) name = ""; wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name)); + bool z64Required = m_CompressedSize > 0xffffffff || m_Size > 0xffffffff; + wxUint16 versionNeeded = + z64Required ? Z64_VERSION_NEEDED_TO_EXTRACT : int(m_VersionNeeded); + wxDataOutputStream ds(stream); - ds << m_VersionNeeded << m_Flags << m_Method; + ds << versionNeeded << m_Flags << m_Method; ds.Write32(GetDateTime().GetAsDOS()); ds.Write32(m_Crc); ds.Write32(m_CompressedSize != wxInvalidOffset ? - wx_truncate_cast(wxUint32, m_CompressedSize) : 0); + LimitUint32(m_CompressedSize) : 0); ds.Write32(m_Size != wxInvalidOffset ? - wx_truncate_cast(wxUint32, m_Size) : 0); + LimitUint32(m_Size) : 0); ds << nameLen; wxUint16 extraLen = wx_truncate_cast(wxUint16, GetLocalExtraLen()); + if (z64Required) + extraLen += 20; // tag and 2x64bit file sizes ds.Write16(extraLen); stream.Write(name, nameLen); - if (extraLen) - stream.Write(m_LocalExtra->GetData(), extraLen); + if (z64Required) + { + ds.Write16(1); // id + ds.Write16(16); // record size + ds.Write64(static_cast(m_CompressedSize)); + ds.Write64(static_cast(m_Size)); + } + if (GetLocalExtraLen()) + stream.Write(m_LocalExtra->GetData(), GetLocalExtraLen()); return LOCAL_SIZE + nameLen + extraLen; } @@ -1052,7 +1179,11 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) >> m_DiskStart >> m_InternalAttributes >> m_ExternalAttributes; SetOffset(ds.Read32()); - SetName(ReadString(stream, nameLen, conv), wxPATH_UNIX); + // Another MSVS 2005 workaround, see above (FIXME-VC8). + wxMBConv& strConv = m_Flags & wxZIP_LANG_ENC_UTF8 + ? static_cast(wxConvUTF8) + : conv; + SetName(ReadString(stream, nameLen, strConv), wxPATH_UNIX); if (stream.LastRead() != nameLen + 0u) return 0; @@ -1062,11 +1193,17 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv) stream.Read(m_Extra->GetData(), extraLen); if (stream.LastRead() != extraLen + 0u) return 0; + + if (LoadExtraInfo(m_Extra->GetData(), extraLen, false)) + { + Release(m_Extra); + m_Extra = NULL; + } } } if (commentLen) { - m_Comment = ReadString(stream, commentLen, conv); + m_Comment = ReadString(stream, commentLen, strConv); if (stream.LastRead() != commentLen + 0u) return 0; } else { @@ -1090,27 +1227,63 @@ size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment)); wxUint16 extraLen = wx_truncate_cast(wxUint16, GetExtraLen()); + wxUint16 z64InfoLen = 0; + + bool z64Required = false; + if ( m_CompressedSize > 0xffffffff ) + { + z64Required = true; + z64InfoLen += 8; + } + if ( m_Size > 0xffffffff ) + { + z64Required = true; + z64InfoLen += 8; + } + if ( m_Offset > 0xffffffff ) + { + z64Required = true; + z64InfoLen += 8; + } + if (z64Required) + { + extraLen += 4 + z64InfoLen; + } + + wxUint16 versionNeeded = + (z64Required) ? Z64_VERSION_NEEDED_TO_EXTRACT : GetVersionNeeded(); wxDataOutputStream ds(stream); ds << CENTRAL_MAGIC << m_VersionMadeBy << m_SystemMadeBy; - ds.Write16(wx_truncate_cast(wxUint16, GetVersionNeeded())); + ds.Write16(versionNeeded); ds.Write16(wx_truncate_cast(wxUint16, GetFlags())); ds.Write16(wx_truncate_cast(wxUint16, GetMethod())); ds.Write32(GetDateTime().GetAsDOS()); ds.Write32(GetCrc()); - ds.Write32(wx_truncate_cast(wxUint32, GetCompressedSize())); - ds.Write32(wx_truncate_cast(wxUint32, GetSize())); + ds.Write32(LimitUint32(GetCompressedSize())); + ds.Write32(LimitUint32(GetSize())); ds.Write16(nameLen); ds.Write16(extraLen); ds << commentLen << m_DiskStart << m_InternalAttributes - << m_ExternalAttributes << wx_truncate_cast(wxUint32, GetOffset()); + << m_ExternalAttributes << LimitUint32(GetOffset()); stream.Write(name, nameLen); - if (extraLen) - stream.Write(GetExtra(), extraLen); + if (z64Required) + { + ds.Write16(1); // tag + ds.Write16(z64InfoLen); // record size + if (m_CompressedSize > 0xffffffff) + ds.Write64(static_cast(m_CompressedSize)); + if (m_Size > 0xffffffff) + ds.Write64(static_cast(m_Size)); + if (m_Offset > 0xffffffff) + ds.Write64(static_cast(m_Offset)); + } + if (GetExtraLen()) + stream.Write(GetExtra(), GetExtraLen()); stream.Write(comment, commentLen); return CENTRAL_SIZE + nameLen + extraLen + commentLen; @@ -1119,7 +1292,7 @@ size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const // Info-zip prefixes this record with a signature, but pkzip doesn't. So if // the 1st value is the signature then it is probably an info-zip record, // though there is a small chance that it is in fact a pkzip record which -// happens to have the signature as it's CRC. +// happens to have the signature as its CRC. // size_t wxZipEntry::ReadDescriptor(wxInputStream& stream) { @@ -1195,17 +1368,17 @@ public: wxString GetComment() const { return m_Comment; } void SetDiskNumber(int num) - { m_DiskNumber = wx_truncate_cast(wxUint16, num); } + { m_DiskNumber = wx_truncate_cast(wxUint32, num); } void SetStartDisk(int num) - { m_StartDisk = wx_truncate_cast(wxUint16, num); } + { m_StartDisk = wx_truncate_cast(wxUint32, num); } void SetEntriesHere(int num) - { m_EntriesHere = wx_truncate_cast(wxUint16, num); } + { m_EntriesHere = wx_truncate_cast(wxUint32, num); } void SetTotalEntries(int num) - { m_TotalEntries = wx_truncate_cast(wxUint16, num); } + { m_TotalEntries = wx_truncate_cast(wxUint32, num); } void SetSize(wxFileOffset size) - { m_Size = wx_truncate_cast(wxUint32, size); } + { m_Size = wx_truncate_cast(wxUint64, size); } void SetOffset(wxFileOffset offset) - { m_Offset = wx_truncate_cast(wxUint32, offset); } + { m_Offset = wx_truncate_cast(wxUint64, offset); } void SetComment(const wxString& comment) { m_Comment = comment; } @@ -1213,12 +1386,12 @@ public: bool Write(wxOutputStream& stream, wxMBConv& conv) const; private: - wxUint16 m_DiskNumber; - wxUint16 m_StartDisk; - wxUint16 m_EntriesHere; - wxUint16 m_TotalEntries; - wxUint32 m_Size; - wxUint32 m_Offset; + wxUint32 m_DiskNumber; + wxUint32 m_StartDisk; + wxUint64 m_EntriesHere; + wxUint64 m_TotalEntries; + wxUint64 m_Size; + wxUint64 m_Offset; wxString m_Comment; }; @@ -1241,8 +1414,41 @@ bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const wxDataOutputStream ds(stream); - ds << END_MAGIC << m_DiskNumber << m_StartDisk << m_EntriesHere - << m_TotalEntries << m_Size << m_Offset << commentLen; + // Check if zip64 is required + if (m_DiskNumber > 0xffff || m_StartDisk > 0xffff || + m_EntriesHere > 0xffff || m_TotalEntries > 0xffff || + m_Size > 0xffffffff || m_Offset > 0xffffffff) + { + // Write zip64 end of central directory record + wxFileOffset z64endOffset = stream.TellO(); + ds.Write32(Z64_END_MAGIC); + ds.Write64(static_cast(Z64_END_SIZE - 12)); // size of zip64 end record + ds.Write16(Z64_VERSION_NEEDED_TO_EXTRACT); + ds.Write16(Z64_VERSION_NEEDED_TO_EXTRACT); + ds.Write32(m_DiskNumber); + ds.Write32(m_StartDisk); + ds.Write64(m_EntriesHere); + ds.Write64(m_TotalEntries); + ds.Write64(m_Size); + ds.Write64(m_Offset); + + // Write zip64 end of central directory locator + ds.Write32(Z64_LOC_MAGIC); + ds.Write32(m_StartDisk); + ds.Write64(static_cast(z64endOffset)); + ds.Write32(1); // total number of disks + } + + ds << END_MAGIC; + + ds.Write16(LimitUint16(m_DiskNumber)); + ds.Write16(LimitUint16(m_StartDisk)); + ds.Write16(LimitUint16(m_EntriesHere)); + ds.Write16(LimitUint16(m_TotalEntries)); + ds.Write32(LimitUint32(m_Size)); + ds.Write32(LimitUint32(m_Offset)); + + ds << commentLen; stream.Write(comment, commentLen); @@ -1257,8 +1463,13 @@ bool wxZipEndRec::Read(wxInputStream& stream, wxMBConv& conv) wxUint16 commentLen; - ds >> m_DiskNumber >> m_StartDisk >> m_EntriesHere - >> m_TotalEntries >> m_Size >> m_Offset >> commentLen; + m_DiskNumber = ds.Read16(); + m_StartDisk = ds.Read16(); + m_EntriesHere = ds.Read16(); + m_TotalEntries = ds.Read16(); + m_Size = ds.Read32(); + m_Offset = ds.Read32(); + ds >> commentLen; if (commentLen) { m_Comment = ReadString(stream, commentLen, conv); @@ -1272,6 +1483,34 @@ bool wxZipEndRec::Read(wxInputStream& stream, wxMBConv& conv) wxLogWarning(_("assuming this is a multi-part zip concatenated")); } + // Look for zip64 end record + stream.SeekI(-(END_SIZE+Z64_LOC_SIZE), wxFromCurrent); + wxZipHeader dsLoc(stream, Z64_LOC_SIZE); + if ( dsLoc && dsLoc.Read32() == Z64_LOC_MAGIC ) + { + // Found zip64 locator, read z64 directory + dsLoc.Read32(); // skip: disk with the start of the zip64 + wxUint64 z64EndOffset = dsLoc.Read64(); + + // Read zip64 end of central directory record + if (stream.SeekI(z64EndOffset) == wxInvalidOffset) + return false; + wxZipHeader dsEnd(stream, Z64_END_SIZE); + if ( dsEnd.Read32() != Z64_END_MAGIC || + dsEnd.Read64() < Z64_END_SIZE - 12 ) // Check record size + return false; + + dsEnd.Read16(); // skip: version made by + dsEnd.Read16(); // skip: version needed to extract + + m_DiskNumber = dsEnd.Read32(); + m_StartDisk = dsEnd.Read32(); + m_EntriesHere = dsEnd.Read64(); + m_TotalEntries = dsEnd.Read64(); + m_Size = dsEnd.Read64(); + m_Offset = dsEnd.Read64(); + } + return true; } @@ -1325,40 +1564,6 @@ wxZipInputStream::wxZipInputStream(wxInputStream *stream, Init(); } -#if WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - -// Part of the compatibility constructor, which has been made inline to -// avoid a problem with it not being exported by mingw 3.2.3 -// -void wxZipInputStream::Init(const wxString& file) -{ - // no error messages - wxLogNull nolog; - Init(); - m_allowSeeking = true; - wxFFileInputStream *ffile; - ffile = static_cast(m_parent_i_stream); - wxZipEntryPtr_ entry; - - if (ffile->IsOk()) { - do { - entry.reset(GetNextEntry()); - } - while (entry.get() != NULL && entry->GetInternalName() != file); - } - - if (entry.get() == NULL) - m_lasterror = wxSTREAM_READ_ERROR; -} - -wxInputStream* wxZipInputStream::OpenFile(const wxString& archive) -{ - wxLogNull nolog; - return new wxFFileInputStream(archive); -} - -#endif // WXWIN_COMPATIBILITY_2_6 && wxUSE_FFILE - void wxZipInputStream::Init() { m_store = new wxStoredInputStream(*m_parent_i_stream); @@ -1375,9 +1580,6 @@ void wxZipInputStream::Init() m_signature = 0; m_TotalEntries = 0; m_lasterror = m_parent_i_stream->GetLastError(); -#if WXWIN_COMPATIBILITY_2_6 - m_allowSeeking = false; -#endif } wxZipInputStream::~wxZipInputStream() @@ -1569,7 +1771,7 @@ wxStreamError wxZipInputStream::ReadCentral() if (!AtHeader()) CloseEntry(); - if (m_signature == END_MAGIC) + if (m_signature == END_MAGIC || m_signature == Z64_END_MAGIC) return wxSTREAM_EOF; if (m_signature != CENTRAL_MAGIC) { @@ -1604,7 +1806,8 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/) if (!m_signature) m_signature = ReadSignature(); - if (m_signature == CENTRAL_MAGIC || m_signature == END_MAGIC) { + if (m_signature == CENTRAL_MAGIC || m_signature == END_MAGIC || + m_signature == Z64_END_MAGIC) { if (m_streamlink && !m_streamlink->GetOutputStream()) { m_streamlink->Release(this); m_streamlink = NULL; @@ -1637,7 +1840,7 @@ wxStreamError wxZipInputStream::ReadLocal(bool readEndRec /*=false*/) m_signature = ReadSignature(); } - if (m_signature == END_MAGIC) { + if (m_signature == END_MAGIC || m_signature == Z64_END_MAGIC) { if (readEndRec || m_streamlink) { wxZipEndRec endrec; endrec.Read(*m_parent_i_stream, GetConv()); @@ -1892,74 +2095,6 @@ size_t wxZipInputStream::OnSysRead(void *buffer, size_t size) return count; } -#if WXWIN_COMPATIBILITY_2_6 - -// Borrowed from VS's zip stream (c) 1999 Vaclav Slavik -// -wxFileOffset wxZipInputStream::OnSysSeek(wxFileOffset seek, wxSeekMode mode) -{ - // seeking works when the stream is created with the compatibility - // constructor - if (!m_allowSeeking) - return wxInvalidOffset; - if (!IsOpened()) - if ((AtHeader() && !DoOpen()) || !OpenDecompressor()) - m_lasterror = wxSTREAM_READ_ERROR; - if (!IsOk()) - return wxInvalidOffset; - - // NB: since ZIP files don't natively support seeking, we have to - // implement a brute force workaround -- reading all the data - // between current and the new position (or between beginning of - // the file and new position...) - - wxFileOffset nextpos; - wxFileOffset pos = TellI(); - - switch ( mode ) - { - case wxFromCurrent : nextpos = seek + pos; break; - case wxFromStart : nextpos = seek; break; - case wxFromEnd : nextpos = GetLength() + seek; break; - default : nextpos = pos; break; /* just to fool compiler, never happens */ - } - - wxFileOffset toskip wxDUMMY_INITIALIZE(0); - if ( nextpos >= pos ) - { - toskip = nextpos - pos; - } - else - { - wxZipEntry current(m_entry); - if (!OpenEntry(current)) - { - m_lasterror = wxSTREAM_READ_ERROR; - return pos; - } - toskip = nextpos; - } - - if ( toskip > 0 ) - { - const int BUFSIZE = 4096; - size_t sz; - char buffer[BUFSIZE]; - while ( toskip > 0 ) - { - sz = wx_truncate_cast(size_t, wxMin(toskip, BUFSIZE)); - Read(buffer, sz); - toskip -= sz; - } - } - - pos = nextpos; - return pos; -} - -#endif // WXWIN_COMPATIBILITY_2_6 - - ///////////////////////////////////////////////////////////////////////////// // Output stream diff --git a/Externals/wxWidgets3/src/common/zstream.cpp b/Externals/wxWidgets3/src/common/zstream.cpp index e10e3d774e..8ae6c1c466 100644 --- a/Externals/wxWidgets3/src/common/zstream.cpp +++ b/Externals/wxWidgets3/src/common/zstream.cpp @@ -63,7 +63,7 @@ wxVersionInfo wxGetZlibVersionInfo() ///////////////////////////////////////////////////////////////////////////// // Zlib Class factory -IMPLEMENT_DYNAMIC_CLASS(wxZlibClassFactory, wxFilterClassFactory) +wxIMPLEMENT_DYNAMIC_CLASS(wxZlibClassFactory, wxFilterClassFactory); static wxZlibClassFactory g_wxZlibClassFactory; @@ -91,7 +91,7 @@ wxZlibClassFactory::GetProtocols(wxStreamProtocolType type) const ///////////////////////////////////////////////////////////////////////////// // Gzip Class factory -IMPLEMENT_DYNAMIC_CLASS(wxGzipClassFactory, wxFilterClassFactory) +wxIMPLEMENT_DYNAMIC_CLASS(wxGzipClassFactory, wxFilterClassFactory); static wxGzipClassFactory g_wxGzipClassFactory; @@ -266,7 +266,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) return major > 1 || (major == 1 && minor >= 2); } -bool wxZlibInputStream::SetDictionary(const char *data, const size_t datalen) +bool wxZlibInputStream::SetDictionary(const char *data, size_t datalen) { return (inflateSetDictionary(m_inflate, (Bytef*)data, datalen) == Z_OK); } @@ -437,7 +437,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size) return wxZlibInputStream::CanHandleGZip(); } -bool wxZlibOutputStream::SetDictionary(const char *data, const size_t datalen) +bool wxZlibOutputStream::SetDictionary(const char *data, size_t datalen) { return (deflateSetDictionary(m_deflate, (Bytef*)data, datalen) == Z_OK); } diff --git a/Externals/wxWidgets3/src/generic/accel.cpp b/Externals/wxWidgets3/src/generic/accel.cpp index e540ec9c03..10288b59cf 100644 --- a/Externals/wxWidgets3/src/generic/accel.cpp +++ b/Externals/wxWidgets3/src/generic/accel.cpp @@ -78,7 +78,7 @@ public: // wxAcceleratorTable ctors // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject); wxAcceleratorTable::wxAcceleratorTable() { diff --git a/Externals/wxWidgets3/src/generic/activityindicator.cpp b/Externals/wxWidgets3/src/generic/activityindicator.cpp new file mode 100644 index 0000000000..53c65e14bf --- /dev/null +++ b/Externals/wxWidgets3/src/generic/activityindicator.cpp @@ -0,0 +1,261 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/generic/activityindicator.cpp +// Purpose: Generic wxActivityIndicator implementation. +// Author: Vadim Zeitlin +// Created: 2015-03-06 +// Copyright: (c) 2015 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_ACTIVITYINDICATOR && !defined(__WXGTK3__) + +#include "wx/activityindicator.h" + +#ifndef WX_PRECOMP + #include "wx/dcclient.h" + #include "wx/timer.h" +#endif // WX_PRECOMP + +#include "wx/graphics.h" +#include "wx/scopedptr.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// For now the appearance is fixed, we could make these constants customizable +// later if really needed. +namespace +{ + +// Total number of "running" dots. +static const int NUM_DOTS = 8; + +// Delay between the consecutive updates in milliseconds. +static const int FRAME_DELAY = 150; + +} // anonymous namespace + +// ---------------------------------------------------------------------------- +// wxActivityIndicatorImpl: class containing the real implementation. +// ---------------------------------------------------------------------------- + +class wxActivityIndicatorImpl +{ +public: + explicit wxActivityIndicatorImpl(wxWindow* win) + : m_timer(this), + m_win(win) + { + m_frame = 0; + + win->Bind(wxEVT_PAINT, &wxActivityIndicatorImpl::OnPaint, this); + } + + void Start() + { + // Avoid restarting the timer if it's already running, this could + // result in jumps in appearance of the next frame while calling + // Start() is not supposed to have any effect at all in this case. + if ( m_timer.IsRunning() ) + return; + + m_timer.Start(FRAME_DELAY); + } + + void Stop() + { + // Unlike above, it's not a problem to call Stop() even if we're not + // running. + m_timer.Stop(); + } + + bool IsRunning() const + { + return m_timer.IsRunning(); + } + + // This one is only called by AdvanceTimer. + void Advance() + { + if ( ++m_frame == NUM_DOTS ) + m_frame = 0; + + m_win->Refresh(); + } + +private: + class AdvanceTimer : public wxTimer + { + public: + explicit AdvanceTimer(wxActivityIndicatorImpl* owner) + : m_owner(owner) + { + } + + virtual void Notify() wxOVERRIDE + { + m_owner->Advance(); + } + + private: + wxActivityIndicatorImpl* const m_owner; + + wxDECLARE_NO_COPY_CLASS(AdvanceTimer); + }; + + void OnPaint(wxPaintEvent& WXUNUSED(event)) + { + wxPaintDC pdc(m_win); + + wxScopedPtr const + gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(pdc)); + + const wxSize size = m_win->GetClientSize(); + + // Centre everything. + gc->Translate(size.x/2., size.y/2.); + + // Radius of 1/10th allows to have reasonably sized dots with a bit of + // separation between them and so subjectively looks a bit nicer than + // perhaps more natural 1/8th. + static const double RADIUS_FACTOR = 10; + + const double r = wxMin(size.x, size.y) / RADIUS_FACTOR; + + // The initial dot touches the top border. + wxGraphicsPath path = gc->CreatePath(); + path.AddCircle(0, -(RADIUS_FACTOR / 2. - 1.)*r, r); + + // Subsequent dots are rotated by this angle with respect to the + // previous one. + const double angle = wxDegToRad(360. / NUM_DOTS); + + // And the animation effect is achieved just by starting to draw from + // the next position every time. + gc->Rotate(m_frame*angle); + + const bool isEnabled = m_win->IsThisEnabled(); + for ( int n = 0; n < NUM_DOTS; n++ ) + { + // Draw all dots uniformly grey when the window is disabled, + // otherwise each subsequent dot is slightly more opaque. + const int opacityIndex = isEnabled ? n + 1 : 2; + + // wxALPHA_OPAQUE+1 is used just because it is divisible by the + // default NUM_DOTS value, and we need -1 because of this to keep + // it in 0..wxALPHA_OPAQUE range. + const int opacity = opacityIndex*(wxALPHA_OPAQUE + 1)/NUM_DOTS - 1; + + gc->SetBrush(wxBrush(wxColour(0, 0, 0, opacity))); + + gc->FillPath(path); + gc->Rotate(angle); + } + } + + AdvanceTimer m_timer; + wxWindow* const m_win; + + int m_frame; + + wxDECLARE_NO_COPY_CLASS(wxActivityIndicatorImpl); +}; + +// ============================================================================ +// implementation +// ============================================================================ + +#ifndef wxHAS_NATIVE_ACTIVITYINDICATOR + wxIMPLEMENT_DYNAMIC_CLASS(wxActivityIndicator, wxControl); +#endif + +bool +wxActivityIndicatorGeneric::Create(wxWindow* parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + // Notice that we skip wxControl version, we don't need the validator + // support that it adds. + if ( !wxWindow::Create(parent, winid, pos, size, style, name) ) + return false; + + m_impl = new wxActivityIndicatorImpl(this); + + return true; +} + +wxActivityIndicatorGeneric::~wxActivityIndicatorGeneric() +{ + delete m_impl; +} + +void wxActivityIndicatorGeneric::Start() +{ + wxCHECK_RET( m_impl, wxS("Must be created first") ); + + m_impl->Start(); +} + +void wxActivityIndicatorGeneric::Stop() +{ + wxCHECK_RET( m_impl, wxS("Must be created first") ); + + m_impl->Stop(); +} + +bool wxActivityIndicatorGeneric::IsRunning() const +{ + return m_impl && m_impl->IsRunning(); +} + +wxSize wxActivityIndicatorGeneric::DoGetBestClientSize() const +{ + int size = 0; + switch ( GetWindowVariant() ) + { + case wxWINDOW_VARIANT_MAX: + wxFAIL_MSG(wxS("Invalid window variant")); + wxFALLTHROUGH; + + case wxWINDOW_VARIANT_NORMAL: + size = 24; + break; + + case wxWINDOW_VARIANT_SMALL: + size = 16; + break; + + case wxWINDOW_VARIANT_MINI: + size = 12; + break; + + case wxWINDOW_VARIANT_LARGE: + size = 32; + break; + } + + wxASSERT_MSG( size, wxS("Unknown window variant") ); + + return FromDIP(wxSize(size, size)); +} + +#endif // wxUSE_ACTIVITYINDICATOR && !__WXGTK3__ diff --git a/Externals/wxWidgets3/src/generic/animateg.cpp b/Externals/wxWidgets3/src/generic/animateg.cpp index f267c21cdb..1d95134114 100644 --- a/Externals/wxWidgets3/src/generic/animateg.cpp +++ b/Externals/wxWidgets3/src/generic/animateg.cpp @@ -40,7 +40,7 @@ wxAnimationDecoderList wxAnimation::sm_handlers; // wxAnimation // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase); #define M_ANIMDATA static_cast(m_refData) wxSize wxAnimation::GetSize() const @@ -250,26 +250,26 @@ void wxAnimation::CleanUpHandlers() class wxAnimationModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxAnimationModule) + wxDECLARE_DYNAMIC_CLASS(wxAnimationModule); public: wxAnimationModule() {} - bool OnInit() { wxAnimation::InitStandardHandlers(); return true; } - void OnExit() { wxAnimation::CleanUpHandlers(); } + bool OnInit() wxOVERRIDE { wxAnimation::InitStandardHandlers(); return true; } + void OnExit() wxOVERRIDE { wxAnimation::CleanUpHandlers(); } }; -IMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationModule, wxModule); // ---------------------------------------------------------------------------- // wxAnimationCtrl // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxAnimationCtrl, wxAnimationCtrlBase) -BEGIN_EVENT_TABLE(wxAnimationCtrl, wxAnimationCtrlBase) +wxIMPLEMENT_CLASS(wxAnimationCtrl, wxAnimationCtrlBase); +wxBEGIN_EVENT_TABLE(wxAnimationCtrl, wxAnimationCtrlBase) EVT_PAINT(wxAnimationCtrl::OnPaint) EVT_SIZE(wxAnimationCtrl::OnSize) EVT_TIMER(wxID_ANY, wxAnimationCtrl::OnTimer) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxAnimationCtrl::Init() { @@ -358,7 +358,7 @@ void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp) // (which uses the bitmap's mask), our background colour would be used for // transparent areas - and that's not what we want (at least for // consistency with the GTK version) - if ( bmp.GetMask() != NULL && GetParent() != NULL ) + if ( bmp.IsOk() && bmp.GetMask() != NULL && GetParent() != NULL ) SetBackgroundColour(GetParent()->GetBackgroundColour()); wxAnimationCtrlBase::SetInactiveBitmap(bmp); diff --git a/Externals/wxWidgets3/src/generic/bannerwindow.cpp b/Externals/wxWidgets3/src/generic/bannerwindow.cpp index f5452cd886..15c2719b67 100644 --- a/Externals/wxWidgets3/src/generic/bannerwindow.cpp +++ b/Externals/wxWidgets3/src/generic/bannerwindow.cpp @@ -36,10 +36,10 @@ const int MARGIN_Y = 5; const char wxBannerWindowNameStr[] = "bannerwindow"; -BEGIN_EVENT_TABLE(wxBannerWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxBannerWindow, wxWindow) EVT_SIZE(wxBannerWindow::OnSize) EVT_PAINT(wxBannerWindow::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxBannerWindow::Init() { diff --git a/Externals/wxWidgets3/src/generic/bmpcboxg.cpp b/Externals/wxWidgets3/src/generic/bmpcboxg.cpp index 9a948eed8c..332e6ca4d3 100644 --- a/Externals/wxWidgets3/src/generic/bmpcboxg.cpp +++ b/Externals/wxWidgets3/src/generic/bmpcboxg.cpp @@ -41,7 +41,12 @@ #endif -#define IMAGE_SPACING_CTRL_VERTICAL 7 // Spacing used in control size calculation +// Spacing used in control size calculation +#ifdef __WXOSX__ + #define IMAGE_SPACING_CTRL_VERTICAL 12 +#else + #define IMAGE_SPACING_CTRL_VERTICAL 7 +#endif // ============================================================================ @@ -49,12 +54,12 @@ // ============================================================================ -BEGIN_EVENT_TABLE(wxBitmapComboBox, wxOwnerDrawnComboBox) +wxBEGIN_EVENT_TABLE(wxBitmapComboBox, wxOwnerDrawnComboBox) EVT_SIZE(wxBitmapComboBox::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxOwnerDrawnComboBox) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxOwnerDrawnComboBox); void wxBitmapComboBox::Init() { diff --git a/Externals/wxWidgets3/src/generic/busyinfo.cpp b/Externals/wxWidgets3/src/generic/busyinfo.cpp index 003853d86a..458b21cc5d 100644 --- a/Externals/wxWidgets3/src/generic/busyinfo.cpp +++ b/Externals/wxWidgets3/src/generic/busyinfo.cpp @@ -16,109 +16,116 @@ // for all others, include the necessary headers #ifndef WX_PRECOMP - #include "wx/frame.h" + #include "wx/busyinfo.h" #include "wx/stattext.h" #include "wx/panel.h" + #include "wx/frame.h" + #include "wx/sizer.h" + #include "wx/statbmp.h" #include "wx/utils.h" #endif #include "wx/busyinfo.h" -#include "wx/generic/stattextg.h" -class WXDLLEXPORT wxInfoFrame : public wxFrame -{ -public: - wxInfoFrame(wxWindow *parent, const wxString& message); +// wxStaticText currently supports markup only in wxGTK and wxOSX/Cocoa, so use +// the generic version for markup support in the other ports. +#if wxUSE_MARKUP && !(defined(__WXGTK__) || defined(__WXOSX_COCOA__)) + #include "wx/generic/stattextg.h" -private: - wxDECLARE_NO_COPY_CLASS(wxInfoFrame); -}; - - -wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) - : wxFrame(parent, wxID_ANY, wxT("Busy"), - wxDefaultPosition, wxDefaultSize, -#if defined(__WXX11__) - wxRESIZE_BORDER + #define wxStaticTextWithMarkupSupport wxGenericStaticText #else - wxSIMPLE_BORDER -#endif - | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP) -{ - wxPanel *panel = new wxPanel( this ); -#ifdef __WXGTK__ - wxGenericStaticText *text = new wxGenericStaticText(panel, wxID_ANY, message); -#else - wxStaticText *text = new wxStaticText(panel, wxID_ANY, message); + #define wxStaticTextWithMarkupSupport wxStaticText #endif - panel->SetCursor(*wxHOURGLASS_CURSOR); - text->SetCursor(*wxHOURGLASS_CURSOR); - - // make the frame of at least the standard size (400*80) but big enough - // for the text we show - wxSize sizeText = text->GetBestSize(); -#ifdef __WXPM__ - int nX = 0; - int nY = 0; - int nWidth = 0; - int nHeight = 0; - int nParentHeight = parent->GetClientSize().y; - int nParentWidth = parent->GetClientSize().x; - int nColor; - - SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwnd() - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - panel->SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)panel->GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwndOf(panel) - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - nWidth = wxMax(sizeText.x, 340) + 60; - nHeight = wxMax(sizeText.y, 40) + 40; - nX = (nParentWidth - nWidth) / 2; - nY = (nParentHeight / 2) - (nHeight / 2); - nY = nParentHeight - (nY + nHeight); - ::WinSetWindowPos( m_hFrame - ,HWND_TOP - ,nX - ,nY - ,nWidth - ,nHeight - ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE - ); - text->SetBackgroundColour(wxT("WHITE")); - nColor = (LONG)text->GetBackgroundColour().GetPixel(); - - ::WinSetPresParam( GetHwndOf(text) - ,PP_BACKGROUNDCOLOR - ,sizeof(LONG) - ,(PVOID)&nColor - ); - text->Center(wxBOTH); -#else - SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40); - - // need to size the panel correctly first so that text->Centre() works - panel->SetSize(GetClientSize()); - - text->Centre(wxBOTH); - Centre(wxBOTH); -#endif -} - -wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent) +void wxBusyInfo::Init(const wxBusyInfoFlags& flags) { - m_InfoFrame = new wxInfoFrame(parent, message); + m_InfoFrame = new wxFrame(flags.m_parent, wxID_ANY, wxString(), + wxDefaultPosition, wxDefaultSize, + wxSIMPLE_BORDER | + wxFRAME_TOOL_WINDOW | + wxSTAY_ON_TOP); + + wxPanel* const panel = new wxPanel(m_InfoFrame); + + wxBoxSizer* const sizer = new wxBoxSizer(wxVERTICAL); + + if ( flags.m_icon.IsOk() ) + { + sizer->Add(new wxStaticBitmap(panel, wxID_ANY, flags.m_icon), + wxSizerFlags().DoubleBorder().Centre()); + } + + wxControl* title; + if ( !flags.m_title.empty() ) + { + title = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_CENTRE); + title->SetFont(title->GetFont().Scaled(2)); +#if wxUSE_MARKUP + title->SetLabelMarkup(flags.m_title); +#else + title->SetLabelText(flags.m_title); +#endif + + sizer->Add(title, wxSizerFlags().DoubleBorder().Expand()); + } + else + { + title = NULL; + } + + // Vertically center the text in the window. + sizer->AddStretchSpacer(); + + wxControl* text; +#if wxUSE_MARKUP + if ( !flags.m_text.empty() ) + { + text = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_CENTRE); + text->SetLabelMarkup(flags.m_text); + } + else +#endif // wxUSE_MARKUP + { + text = new wxStaticText(panel, wxID_ANY, wxString()); + text->SetLabelText(flags.m_label); + } + + sizer->Add(text, wxSizerFlags().DoubleBorder().Centre()); + + sizer->AddStretchSpacer(); + + panel->SetSizer(sizer); + + if ( flags.m_foreground.IsOk() ) + { + if ( title ) + title->SetForegroundColour(flags.m_foreground); + text->SetForegroundColour(flags.m_foreground); + } + + if ( flags.m_background.IsOk() ) + panel->SetBackgroundColour(flags.m_background); + + if ( flags.m_alpha != wxALPHA_OPAQUE ) + m_InfoFrame->SetTransparent(flags.m_alpha); + + m_InfoFrame->SetCursor(*wxHOURGLASS_CURSOR); + + // We need to accommodate our contents, but also impose some minimal size + // to make the busy info frame more noticeable. + wxSize size = panel->GetBestSize(); + size.IncTo(wxSize(400, 80)); + + m_InfoFrame->SetClientSize(size); + m_InfoFrame->Layout(); + + m_InfoFrame->Centre(wxBOTH); m_InfoFrame->Show(true); m_InfoFrame->Refresh(); m_InfoFrame->Update(); diff --git a/Externals/wxWidgets3/src/generic/buttonbar.cpp b/Externals/wxWidgets3/src/generic/buttonbar.cpp index a2529b0091..c67ddd4d16 100644 --- a/Externals/wxWidgets3/src/generic/buttonbar.cpp +++ b/Externals/wxWidgets3/src/generic/buttonbar.cpp @@ -95,13 +95,13 @@ private: // wxButtonToolBar implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxButtonToolBar, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxButtonToolBar, wxControl); -BEGIN_EVENT_TABLE(wxButtonToolBar, wxControl) +wxBEGIN_EVENT_TABLE(wxButtonToolBar, wxControl) EVT_BUTTON(wxID_ANY, wxButtonToolBar::OnCommand) EVT_PAINT(wxButtonToolBar::OnPaint) EVT_LEFT_UP(wxButtonToolBar::OnLeftUp) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxButtonToolBar creation diff --git a/Externals/wxWidgets3/src/generic/calctrlg.cpp b/Externals/wxWidgets3/src/generic/calctrlg.cpp index 40a549fbf4..a03cfbd4da 100644 --- a/Externals/wxWidgets3/src/generic/calctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/calctrlg.cpp @@ -48,20 +48,21 @@ #ifdef wxHAS_NATIVE_CALENDARCTRL -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericCalendarCtrl, wxControl,"wx/calctrl.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericCalendarCtrl, wxControl, "wx/calctrl.h"); #endif -BEGIN_EVENT_TABLE(wxGenericCalendarCtrl, wxControl) +wxBEGIN_EVENT_TABLE(wxGenericCalendarCtrl, wxControl) EVT_PAINT(wxGenericCalendarCtrl::OnPaint) EVT_CHAR(wxGenericCalendarCtrl::OnChar) EVT_LEFT_DOWN(wxGenericCalendarCtrl::OnClick) EVT_LEFT_DCLICK(wxGenericCalendarCtrl::OnDClick) + EVT_MOUSEWHEEL(wxGenericCalendarCtrl::OnWheel) EVT_SYS_COLOUR_CHANGED(wxGenericCalendarCtrl::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -916,8 +917,8 @@ void wxGenericCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) if ( HasFlag( wxCAL_SHOW_WEEK_NUMBERS ) && IsExposed( 0, y, m_calendarWeekWidth, m_heightRow * 6 )) { dc.SetBackgroundMode(wxTRANSPARENT); - dc.SetBrush(wxBrush(m_colHeaderBg, wxSOLID)); - dc.SetPen(wxPen(m_colHeaderBg, 1, wxSOLID)); + dc.SetBrush(wxBrush(m_colHeaderBg, wxBRUSHSTYLE_SOLID)); + dc.SetPen(wxPen(m_colHeaderBg, 1, wxPENSTYLE_SOLID)); dc.DrawRectangle( 0, y, m_calendarWeekWidth, m_heightRow * 6 ); wxDateTime date = GetStartDate(); for ( size_t i = 0; i < 6; ++i ) @@ -1324,13 +1325,26 @@ bool wxGenericCalendarCtrl::GetDateCoord(const wxDateTime& date, int *day, int * void wxGenericCalendarCtrl::OnDClick(wxMouseEvent& event) { - if ( HitTest(event.GetPosition()) != wxCAL_HITTEST_DAY ) + wxDateTime date; + switch ( HitTest(event.GetPosition(), &date) ) { - event.Skip(); - } - else - { - GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED); + case wxCAL_HITTEST_DAY: + GenerateEvent(wxEVT_CALENDAR_DOUBLECLICKED); + break; + + case wxCAL_HITTEST_DECMONTH: + case wxCAL_HITTEST_INCMONTH: + // Consecutive simple clicks result in a series of simple and + // double click events, so handle them in the same way. + SetDateAndNotify(date); + break; + + case wxCAL_HITTEST_WEEK: + case wxCAL_HITTEST_HEADER: + case wxCAL_HITTEST_SURROUNDING_WEEK: + case wxCAL_HITTEST_NOWHERE: + event.Skip(); + break; } } @@ -1352,14 +1366,14 @@ void wxGenericCalendarCtrl::OnClick(wxMouseEvent& event) // GenerateAllChangeEvents() here, we know which event to send GenerateEvent(wxEVT_CALENDAR_DAY_CHANGED); } - break; + break; case wxCAL_HITTEST_WEEK: - { - wxCalendarEvent send( this, date, wxEVT_CALENDAR_WEEK_CLICKED ); - HandleWindowEvent( send ); - } - break; + { + wxCalendarEvent send( this, date, wxEVT_CALENDAR_WEEK_CLICKED ); + HandleWindowEvent( send ); + } + break; case wxCAL_HITTEST_HEADER: { @@ -1378,7 +1392,7 @@ void wxGenericCalendarCtrl::OnClick(wxMouseEvent& event) default: wxFAIL_MSG(wxT("unknown hittest code")); - // fall through + wxFALLTHROUGH; case wxCAL_HITTEST_NOWHERE: event.Skip(); @@ -1512,6 +1526,31 @@ wxCalendarHitTestResult wxGenericCalendarCtrl::HitTest(const wxPoint& pos, } } +void wxGenericCalendarCtrl::OnWheel(wxMouseEvent& event) +{ + wxDateSpan span; + switch ( event.GetWheelAxis() ) + { + case wxMOUSE_WHEEL_VERTICAL: + // For consistency with the native controls, scrolling upwards + // should go to the past, even if the rotation is positive and + // could be normally expected to increase the date. + span = -wxDateSpan::Month(); + break; + + case wxMOUSE_WHEEL_HORIZONTAL: + span = wxDateSpan::Year(); + break; + } + + // Currently we only take into account the rotation direction, not its + // magnitude. + if ( event.GetWheelRotation() < 0 ) + span = -span; + + SetDateAndNotify(m_date + span); +} + // ---------------------------------------------------------------------------- // subcontrols events handling // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/generic/choicbkg.cpp b/Externals/wxWidgets3/src/generic/choicbkg.cpp index e397cc0003..06dfcd5140 100644 --- a/Externals/wxWidgets3/src/generic/choicbkg.cpp +++ b/Externals/wxWidgets3/src/generic/choicbkg.cpp @@ -35,25 +35,18 @@ #include "wx/imaglist.h" -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase); wxDEFINE_EVENT( wxEVT_CHOICEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_CHOICEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase) EVT_CHOICE(wxID_ANY, wxChoicebook::OnChoiceSelected) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxChoicebook implementation @@ -99,8 +92,13 @@ wxChoicebook::Create(wxWindow *parent, mainSizer->Add(0, 0, 1, wxEXPAND, 0); m_controlSizer = new wxBoxSizer(IsVertical() ? wxHORIZONTAL : wxVERTICAL); - m_controlSizer->Add(m_bookctrl, 1, (IsVertical() ? wxALIGN_CENTRE_VERTICAL : wxALIGN_CENTRE) |wxGROW, 0); - mainSizer->Add(m_controlSizer, 0, (IsVertical() ? (int) wxGROW : (int) wxALIGN_CENTRE_VERTICAL)|wxALL, m_controlMargin); + m_controlSizer->Add(m_bookctrl, wxSizerFlags(1).Expand()); + wxSizerFlags flags; + if ( IsVertical() ) + flags.Expand(); + else + flags.CentreVertical(); + mainSizer->Add(m_controlSizer, flags.Border(wxALL, m_controlMargin)); SetSizer(mainSizer); return true; } diff --git a/Externals/wxWidgets3/src/generic/choicdgg.cpp b/Externals/wxWidgets3/src/generic/choicdgg.cpp index 6acb6833f9..9075821e5f 100644 --- a/Externals/wxWidgets3/src/generic/choicdgg.cpp +++ b/Externals/wxWidgets3/src/generic/choicdgg.cpp @@ -52,30 +52,10 @@ // private functions // ---------------------------------------------------------------------------- -// convert wxArrayString into a wxString[] which must be delete[]d by caller -static int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices); - // ============================================================================ // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// helpers -// ---------------------------------------------------------------------------- - -int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices) -{ - int n = aChoices.GetCount(); - *choices = new wxString[n]; - - for ( int i = 0; i < n; i++ ) - { - (*choices)[i] = aChoices[i]; - } - - return n; -} - // ---------------------------------------------------------------------------- // wrapper functions // ---------------------------------------------------------------------------- @@ -92,31 +72,22 @@ wxString wxGetSingleChoice( const wxString& message, wxSingleChoiceDialog dialog(parent, message, caption, n, choices); dialog.SetSelection(initialSelection); - - wxString choice; - if ( dialog.ShowModal() == wxID_OK ) - choice = dialog.GetStringSelection(); - - return choice; + return dialog.ShowModal() == wxID_OK ? dialog.GetStringSelection() : wxString(); } wxString wxGetSingleChoice( const wxString& message, const wxString& caption, - const wxArrayString& aChoices, + const wxArrayString& choices, wxWindow *parent, - int x, int y, - bool centre, - int width, int height, + int WXUNUSED(x), int WXUNUSED(y), + bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height), int initialSelection) { - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - wxString res = wxGetSingleChoice(message, caption, n, choices, parent, - x, y, centre, width, height, - initialSelection); - delete [] choices; + wxSingleChoiceDialog dialog(parent, message, caption, choices); - return res; + dialog.SetSelection(initialSelection); + return dialog.ShowModal() == wxID_OK ? dialog.GetStringSelection() : wxString(); } wxString wxGetSingleChoice( const wxString& message, @@ -155,33 +126,22 @@ int wxGetSingleChoiceIndex( const wxString& message, wxSingleChoiceDialog dialog(parent, message, caption, n, choices); dialog.SetSelection(initialSelection); - - int choice; - if ( dialog.ShowModal() == wxID_OK ) - choice = dialog.GetSelection(); - else - choice = -1; - - return choice; + return dialog.ShowModal() == wxID_OK ? dialog.GetSelection() : -1; } int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, - const wxArrayString& aChoices, + const wxArrayString& choices, wxWindow *parent, - int x, int y, - bool centre, - int width, int height, + int WXUNUSED(x), int WXUNUSED(y), + bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height), int initialSelection) { - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - int res = wxGetSingleChoiceIndex(message, caption, n, choices, parent, - x, y, centre, width, height, - initialSelection); - delete [] choices; + wxSingleChoiceDialog dialog(parent, message, caption, choices); - return res; + dialog.SetSelection(initialSelection); + return dialog.ShowModal() == wxID_OK ? dialog.GetSelection() : -1; } int wxGetSingleChoiceIndex( const wxString& message, @@ -224,35 +184,23 @@ void *wxGetSingleChoiceData( const wxString& message, client_data); dialog.SetSelection(initialSelection); - - void *data; - if ( dialog.ShowModal() == wxID_OK ) - data = dialog.GetSelectionData(); - else - data = NULL; - - return data; + return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : NULL; } void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, - const wxArrayString& aChoices, + const wxArrayString& choices, void **client_data, wxWindow *parent, - int x, int y, - bool centre, - int width, int height, + int WXUNUSED(x), int WXUNUSED(y), + bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height), int initialSelection) { - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - void *res = wxGetSingleChoiceData(message, caption, n, choices, - client_data, parent, - x, y, centre, width, height, - initialSelection); - delete [] choices; + wxSingleChoiceDialog dialog(parent, message, caption, choices, client_data); - return res; + dialog.SetSelection(initialSelection); + return dialog.ShowModal() == wxID_OK ? dialog.GetSelectionData() : NULL; } void* wxGetSingleChoiceData( const wxString& message, @@ -285,13 +233,13 @@ void* wxGetSingleChoiceData( const wxString& message, int wxGetSelectedChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - int n, const wxString *choices, - wxWindow *parent, - int WXUNUSED(x), int WXUNUSED(y), - bool WXUNUSED(centre), - int WXUNUSED(width), int WXUNUSED(height)) + const wxString& message, + const wxString& caption, + int n, const wxString *choices, + wxWindow *parent, + int WXUNUSED(x), int WXUNUSED(y), + bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height)) { wxMultiChoiceDialog dialog(parent, message, caption, n, choices); @@ -308,26 +256,34 @@ int wxGetSelectedChoices(wxArrayInt& selections, } selections = dialog.GetSelections(); - return selections.GetCount(); + return static_cast(selections.GetCount()); } int wxGetSelectedChoices(wxArrayInt& selections, - const wxString& message, - const wxString& caption, - const wxArrayString& aChoices, - wxWindow *parent, - int x, int y, - bool centre, - int width, int height) + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + wxWindow *parent, + int WXUNUSED(x), int WXUNUSED(y), + bool WXUNUSED(centre), + int WXUNUSED(width), int WXUNUSED(height)) { - wxString *choices; - int n = ConvertWXArrayToC(aChoices, &choices); - int res = wxGetSelectedChoices(selections, message, caption, - n, choices, parent, - x, y, centre, width, height); - delete [] choices; + wxMultiChoiceDialog dialog(parent, message, caption, choices); - return res; + // call this even if selections array is empty and this then (correctly) + // deselects the first item which is selected by default + dialog.SetSelections(selections); + + if ( dialog.ShowModal() != wxID_OK ) + { + // NB: intentionally do not clear the selections array here, the caller + // might want to preserve its original contents if the dialog was + // cancelled + return -1; + } + + selections = dialog.GetSelections(); + return static_cast(selections.GetCount()); } #if WXWIN_COMPATIBILITY_2_8 @@ -390,7 +346,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, const long styleBtns = styleDlg & (wxOK | wxCANCEL); styleDlg &= ~styleBtns; - if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) + if ( !wxDialog::Create(GetParentForModalDialog(parent, styleDlg), wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) return false; wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); @@ -454,17 +410,12 @@ wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, lon // wxSingleChoiceDialog // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) -#ifndef __SMARTPHONE__ EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) -#endif -#ifdef __WXWINCE__ - EVT_JOY_BUTTON_DOWN(wxSingleChoiceDialog::OnJoystickButtonDown) -#endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog); bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, @@ -519,19 +470,10 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) DoChoice(); } -#ifndef __SMARTPHONE__ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { DoChoice(); } -#endif - -#ifdef __WXWINCE__ -void wxSingleChoiceDialog::OnJoystickButtonDown(wxJoystickEvent& WXUNUSED(event)) -{ - DoChoice(); -} -#endif void wxSingleChoiceDialog::DoChoice() { @@ -548,7 +490,7 @@ void wxSingleChoiceDialog::DoChoice() // wxMultiChoiceDialog // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog); bool wxMultiChoiceDialog::Create( wxWindow *parent, const wxString& message, diff --git a/Externals/wxWidgets3/src/generic/clrpickerg.cpp b/Externals/wxWidgets3/src/generic/clrpickerg.cpp index b76115f04a..e7df508057 100644 --- a/Externals/wxWidgets3/src/generic/clrpickerg.cpp +++ b/Externals/wxWidgets3/src/generic/clrpickerg.cpp @@ -35,7 +35,7 @@ // ============================================================================ wxColourData wxGenericColourButton::ms_data; -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxBitmapButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxBitmapButton); // ---------------------------------------------------------------------------- // wxGenericColourButton diff --git a/Externals/wxWidgets3/src/generic/collheaderctrlg.cpp b/Externals/wxWidgets3/src/generic/collheaderctrlg.cpp new file mode 100644 index 0000000000..ac5527a312 --- /dev/null +++ b/Externals/wxWidgets3/src/generic/collheaderctrlg.cpp @@ -0,0 +1,197 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/generic/collheaderctrlg.cpp +// Purpose: Generic wxCollapsibleHeaderCtrl implementation +// Author: Tobias Taschner +// Created: 2015-09-19 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/defs.h" + +#if wxUSE_COLLPANE + +#include "wx/collheaderctrl.h" + +#ifndef WX_PRECOMP + #include "wx/dcclient.h" + #include "wx/sizer.h" +#endif // !WX_PRECOMP + +#include "wx/renderer.h" + +// if we have another implementation of this class we should extract +// the lines below to a common file + +const char wxCollapsibleHeaderCtrlNameStr[] = "collapsibleHeader"; + +wxDEFINE_EVENT(wxEVT_COLLAPSIBLEHEADER_CHANGED, wxCommandEvent); + +// ============================================================================ +// implementation +// ============================================================================ + +void wxGenericCollapsibleHeaderCtrl::Init() +{ + m_collapsed = true; + m_inWindow = false; + m_mouseDown = false; +} + +bool wxGenericCollapsibleHeaderCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + if ( !wxCollapsibleHeaderCtrlBase::Create(parent, id, label, pos, size, + style, validator, name) ) + { + return false; + } + + Bind(wxEVT_PAINT, &wxGenericCollapsibleHeaderCtrl::OnPaint, this); + Bind(wxEVT_LEFT_DOWN, &wxGenericCollapsibleHeaderCtrl::OnLeftDown, this); + Bind(wxEVT_LEFT_UP, &wxGenericCollapsibleHeaderCtrl::OnLeftUp, this); + Bind(wxEVT_ENTER_WINDOW, &wxGenericCollapsibleHeaderCtrl::OnEnterWindow, this); + Bind(wxEVT_LEAVE_WINDOW, &wxGenericCollapsibleHeaderCtrl::OnLeaveWindow, this); + Bind(wxEVT_CHAR, &wxGenericCollapsibleHeaderCtrl::OnChar, this); + Bind(wxEVT_SET_FOCUS, &wxGenericCollapsibleHeaderCtrl::OnFocus, this); + Bind(wxEVT_KILL_FOCUS, &wxGenericCollapsibleHeaderCtrl::OnFocus, this); + + return true; +} + +wxSize wxGenericCollapsibleHeaderCtrl::DoGetBestClientSize() const +{ + wxClientDC dc(const_cast(this)); + wxSize btnSize = wxRendererNative::Get().GetCollapseButtonSize(const_cast(this), dc); + wxString text; + wxControl::FindAccelIndex(GetLabel(), &text); + wxSize textSize = dc.GetTextExtent(text); + // Add some padding if the label is not empty + if ( textSize.x > 0 ) + textSize.x += FromDIP(4); + + return wxSize(btnSize.x + textSize.x, + wxMax(textSize.y, btnSize.y)); +} + +void wxGenericCollapsibleHeaderCtrl::SetCollapsed(bool collapsed) +{ + m_collapsed = collapsed; + Refresh(); +} + +void wxGenericCollapsibleHeaderCtrl::DoSetCollapsed(bool collapsed) +{ + SetCollapsed(collapsed); + + wxCommandEvent evt(wxEVT_COLLAPSIBLEHEADER_CHANGED, GetId()); + evt.SetEventObject(this); + ProcessEvent(evt); +} + +void wxGenericCollapsibleHeaderCtrl::OnFocus(wxFocusEvent& event) +{ + Refresh(); + event.Skip(); +} + +void wxGenericCollapsibleHeaderCtrl::OnChar(wxKeyEvent& event) +{ + switch (event.GetKeyCode()) + { + case WXK_SPACE: + case WXK_RETURN: + DoSetCollapsed(!m_collapsed); + break; + default: + event.Skip(); + break; + } +} + +void wxGenericCollapsibleHeaderCtrl::OnEnterWindow(wxMouseEvent& event) +{ + m_inWindow = true; + Refresh(); + event.Skip(); +} + +void wxGenericCollapsibleHeaderCtrl::OnLeaveWindow(wxMouseEvent& event) +{ + m_inWindow = false; + Refresh(); + event.Skip(); +} + +void wxGenericCollapsibleHeaderCtrl::OnLeftUp(wxMouseEvent& event) +{ + m_mouseDown = false; + DoSetCollapsed(!m_collapsed); + event.Skip(); +} + +void wxGenericCollapsibleHeaderCtrl::OnLeftDown(wxMouseEvent& event) +{ + m_mouseDown = true; + Refresh(); + event.Skip(); +} + +void wxGenericCollapsibleHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) +{ + wxPaintDC dc(this); + + wxRect rect(wxPoint(0, 0), GetClientSize()); + + wxSize btnSize = wxRendererNative::Get().GetCollapseButtonSize(this, dc); + + wxRect btnRect(wxPoint(0, 0), btnSize); + btnRect = btnRect.CenterIn(rect, wxVERTICAL); + + int flags = 0; + + if ( m_inWindow ) + flags |= wxCONTROL_CURRENT; + + if ( m_mouseDown ) + flags |= wxCONTROL_PRESSED; + + if ( !m_collapsed ) + flags |= wxCONTROL_EXPANDED; + + wxRendererNative::Get().DrawCollapseButton(this, dc, btnRect, flags); + + wxString text; + int indexAccel = wxControl::FindAccelIndex(GetLabel(), &text); + + wxSize textSize = dc.GetTextExtent(text); + + wxRect textRect(wxPoint(btnSize.x + FromDIP(2), 0), textSize); + textRect = textRect.CenterIn(rect, wxVERTICAL); + + dc.DrawLabel(text, textRect, wxALIGN_CENTRE_VERTICAL, indexAccel); + +#ifdef __WXMSW__ + if ( HasFocus() ) + wxRendererNative::Get().DrawFocusRect(this, dc, textRect.Inflate(1), flags); +#endif +} + + +#endif // wxUSE_COLLPANE diff --git a/Externals/wxWidgets3/src/generic/collpaneg.cpp b/Externals/wxWidgets3/src/generic/collpaneg.cpp index 1dc4e47e6e..886b4ab9cf 100644 --- a/Externals/wxWidgets3/src/generic/collpaneg.cpp +++ b/Externals/wxWidgets3/src/generic/collpaneg.cpp @@ -28,12 +28,12 @@ #ifndef WX_PRECOMP #include "wx/toplevel.h" - #include "wx/button.h" #include "wx/sizer.h" #include "wx/panel.h" #endif // !WX_PRECOMP #include "wx/statline.h" +#include "wx/collheaderctrl.h" // ---------------------------------------------------------------------------- // constants @@ -50,13 +50,13 @@ const char wxCollapsiblePaneNameStr[] = "collapsiblePane"; //----------------------------------------------------------------------------- wxDEFINE_EVENT( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxGenericCollapsiblePane, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericCollapsiblePane, wxControl); +wxIMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent); -BEGIN_EVENT_TABLE(wxGenericCollapsiblePane, wxControl) - EVT_BUTTON(wxID_ANY, wxGenericCollapsiblePane::OnButton) +wxBEGIN_EVENT_TABLE(wxGenericCollapsiblePane, wxControl) + EVT_COLLAPSIBLEHEADER_CHANGED(wxID_ANY, wxGenericCollapsiblePane::OnButton) EVT_SIZE(wxGenericCollapsiblePane::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGenericCollapsiblePane::Init() { @@ -78,31 +78,26 @@ bool wxGenericCollapsiblePane::Create(wxWindow *parent, if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) return false; - m_strLabel = label; - // sizer containing the expand button and possibly a static line - m_sz = new wxBoxSizer(wxHORIZONTAL); + m_sz = new wxBoxSizer(wxVERTICAL); -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - // on Mac we use the special disclosure triangle button - m_pStaticLine = NULL; - m_pButton = new wxDisclosureTriangle(this, wxID_ANY, GetBtnLabel()); - m_sz->Add(m_pButton); -#else // create children and lay them out using a wxBoxSizer // (so that we automatically get RTL features) - m_pButton = new wxButton(this, wxID_ANY, GetBtnLabel(), wxPoint(0, 0), - wxDefaultSize, wxBU_EXACTFIT); - m_pStaticLine = new wxStaticLine(this, wxID_ANY); + m_pButton = new wxCollapsibleHeaderCtrl(this, wxID_ANY, label, wxPoint(0, 0), + wxDefaultSize); // on other platforms we put the static line and the button horizontally m_sz->Add(m_pButton, 0, wxLEFT|wxTOP|wxBOTTOM, GetBorder()); - m_sz->Add(m_pStaticLine, 1, wxALIGN_CENTER|wxLEFT|wxRIGHT, GetBorder()); + +#if !defined( __WXMAC__ ) || defined(__WXUNIVERSAL__) + m_pStaticLine = new wxStaticLine(this, wxID_ANY); + m_sz->Add(m_pStaticLine, 0, wxEXPAND, GetBorder()); + m_pStaticLine->Hide(); #endif - // FIXME: at least under wxCE and wxGTK1 the background is black if we don't do + // FIXME: at least under wxGTK1 the background is black if we don't do // this, no idea why... -#if defined(__WXWINCE__) || defined(__WXGTK__) +#if defined(__WXGTK__) SetBackgroundColour(parent->GetBackgroundColour()); #endif @@ -143,16 +138,6 @@ wxSize wxGenericCollapsiblePane::DoGetBestSize() const return sz; } -wxString wxGenericCollapsiblePane::GetBtnLabel() const -{ - // on mac the triangle indicates the state, no string change -#ifdef __WXMAC__ - return m_strLabel; -#else - return m_strLabel + (IsCollapsed() ? wxT(" >>") : wxT(" <<")); -#endif -} - void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) { // minimal size has priority over the best size so set here our min size @@ -194,13 +179,11 @@ void wxGenericCollapsiblePane::Collapse(bool collapse) // update our state m_pPane->Show(!collapse); - // update button label -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) - m_pButton->SetOpen( !collapse ); -#else + // update button // NB: this must be done after updating our "state" - m_pButton->SetLabel(GetBtnLabel()); -#endif + m_pButton->SetCollapsed(collapse); + if ( m_pStaticLine ) + m_pStaticLine->Show(!collapse); OnStateChange(GetBestSize()); @@ -208,17 +191,17 @@ void wxGenericCollapsiblePane::Collapse(bool collapse) void wxGenericCollapsiblePane::SetLabel(const wxString &label) { - m_strLabel = label; -#ifdef __WXMAC__ - m_pButton->SetLabel(GetBtnLabel()); -#else - m_pButton->SetLabel(GetBtnLabel()); + m_pButton->SetLabel(label); m_pButton->SetInitialSize(); -#endif Layout(); } +wxString wxGenericCollapsiblePane::GetLabel() const +{ + return m_pButton->GetLabel(); +} + bool wxGenericCollapsiblePane::Layout() { #ifdef __WXMAC__ diff --git a/Externals/wxWidgets3/src/generic/colrdlgg.cpp b/Externals/wxWidgets3/src/generic/colrdlgg.cpp index 60bdf6a787..1ba9c1b5ce 100644 --- a/Externals/wxWidgets3/src/generic/colrdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/colrdlgg.cpp @@ -18,6 +18,7 @@ #if wxUSE_COLOURDLG #ifndef WX_PRECOMP + #include "wx/settings.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/dialog.h" @@ -37,9 +38,22 @@ #include "wx/colourdata.h" #include "wx/generic/colrdlgg.h" -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog) +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +#include "wx/statbmp.h" +#include "wx/dcmemory.h" +#include "wx/dcgraph.h" +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA -BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) +#define wxID_ADD_CUSTOM 3000 +#if wxUSE_SLIDER + #define wxID_RED_SLIDER 3001 + #define wxID_GREEN_SLIDER 3002 + #define wxID_BLUE_SLIDER 3003 +#endif // wxUSE_SLIDER + +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog); + +wxBEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) #if wxUSE_SLIDER EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) @@ -49,7 +63,7 @@ BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) EVT_PAINT(wxGenericColourDialog::OnPaint) EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) EVT_CLOSE(wxGenericColourDialog::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() /* @@ -164,18 +178,11 @@ int wxGenericColourDialog::ShowModal() // Internal functions void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) { - if (event.ButtonDown(1)) + if (event.ButtonDown(wxMOUSE_BTN_LEFT)) { int x = (int)event.GetX(); int y = (int)event.GetY(); -#ifdef __WXPM__ - // Handle OS/2's reverse coordinate system and account for the dialog title - int nClientHeight; - - GetClientSize(NULL, &nClientHeight); - y = (nClientHeight - y) + 20; -#endif if ((x >= m_standardColoursRect.x && x <= (m_standardColoursRect.x + m_standardColoursRect.width)) && (y >= m_standardColoursRect.y && y <= (m_standardColoursRect.y + m_standardColoursRect.height))) { @@ -184,6 +191,8 @@ void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) int ptr = (int)(selX + selY*8); OnBasicColourClick(ptr); } + // wxStaticBitmap (used to ARGB preview) events are handled in the dedicated handler. +#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA else if ((x >= m_customColoursRect.x && x <= (m_customColoursRect.x + m_customColoursRect.width)) && (y >= m_customColoursRect.y && y <= (m_customColoursRect.y + m_customColoursRect.height))) { @@ -192,6 +201,7 @@ void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) int ptr = (int)(selX + selY*8); OnCustomColourClick(ptr); } +#endif else event.Skip(); } @@ -199,32 +209,49 @@ void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) event.Skip(); } +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +void wxGenericColourDialog::OnCustomColourMouseClick(wxMouseEvent& event) +{ + // Find index of custom colour + // and call the handler. + for (unsigned i = 0; i < WXSIZEOF(m_customColoursBmp); i++) + { + if ( m_customColoursBmp[i]->GetId() == event.GetId() ) + { + OnCustomColourClick(i); + return; + } + } + + event.Skip(); +} +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + void wxGenericColourDialog::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PaintBasicColours(dc); - PaintCustomColours(dc); + // wxStaticBitmap controls are updated on their own. +#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + PaintCustomColours(dc, -1); PaintCustomColour(dc); +#endif // !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA PaintHighlight(dc, true); } void wxGenericColourDialog::CalculateMeasurements() { - m_smallRectangleSize.x = 18; - m_smallRectangleSize.y = 14; - m_customRectangleSize.x = 40; - m_customRectangleSize.y = 40; + // For single customizable colour + const wxSize customRectangleSize(40, 40); + + m_smallRectangleSize.Set(18, 14); m_gridSpacing = 6; m_sectionSpacing = 15; m_standardColoursRect.x = 10; -#ifdef __WXPM__ - m_standardColoursRect.y = 15 + 20; /* OS/2 needs to account for dialog titlebar */ -#else m_standardColoursRect.y = 15; -#endif m_standardColoursRect.width = (8*m_smallRectangleSize.x) + (7*m_gridSpacing); m_standardColoursRect.height = (6*m_smallRectangleSize.y) + (5*m_gridSpacing); @@ -235,8 +262,7 @@ void wxGenericColourDialog::CalculateMeasurements() m_singleCustomColourRect.x = m_customColoursRect.width + m_customColoursRect.x + m_sectionSpacing; m_singleCustomColourRect.y = 80; - m_singleCustomColourRect.width = m_customRectangleSize.x; - m_singleCustomColourRect.height = m_customRectangleSize.y; + m_singleCustomColourRect.SetSize(customRectangleSize); m_okButtonX = 10; m_customButtonX = m_singleCustomColourRect.x ; @@ -247,6 +273,33 @@ void wxGenericColourDialog::CreateWidgets() { wxBeginBusyCursor(); +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + // Bitmap to preview selected colour (with alpha channel) + wxBitmap customColourBmp(m_singleCustomColourRect.GetSize(), 32); + customColourBmp.UseAlpha(); + DoPreviewBitmap(customColourBmp, m_colourData.GetColour()); + m_customColourBmp = new wxStaticBitmap(this, wxID_ANY, customColourBmp, + m_singleCustomColourRect.GetLeftTop(), + m_singleCustomColourRect.GetSize(), + wxBORDER_SUNKEN); + + // 16 bitmaps to preview custom colours (with alpha channel) + for (unsigned i = 0; i < WXSIZEOF(m_customColoursBmp); i++) + { + int x = ((i % 8)*(m_smallRectangleSize.x+m_gridSpacing)) + m_customColoursRect.x; + int y = ((i / 8)*(m_smallRectangleSize.y+m_gridSpacing)) + m_customColoursRect.y; + + wxBitmap bmp(m_smallRectangleSize, 32); + bmp.UseAlpha(); + DoPreviewBitmap(bmp, m_customColours[i]); + m_customColoursBmp[i] = new wxStaticBitmap(this, wxID_ANY, bmp, + wxPoint(x, y), m_smallRectangleSize); + m_customColoursBmp[i]->Bind(wxEVT_LEFT_DOWN, + &wxGenericColourDialog::OnCustomColourMouseClick, this); + + } +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); const int sliderHeight = 160; @@ -255,23 +308,53 @@ void wxGenericColourDialog::CreateWidgets() #if wxUSE_SLIDER const int sliderX = m_singleCustomColourRect.x + m_singleCustomColourRect.width + m_sectionSpacing; - m_redSlider = new wxSlider(this, wxID_RED_SLIDER, m_colourData.m_dataColour.Red(), 0, 255, + wxColour c = m_colourData.GetColour(); + m_redSlider = new wxSlider(this, wxID_RED_SLIDER, c.Red(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); - m_greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, m_colourData.m_dataColour.Green(), 0, 255, + m_greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, c.Green(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); - m_blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, m_colourData.m_dataColour.Blue(), 0, 255, + m_blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, c.Blue(), 0, 255, wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); + if ( m_colourData.GetChooseAlpha() ) + { + m_alphaSlider = new wxSlider(this, wxID_ANY, c.Alpha(), 0, 255, + wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE); + m_alphaSlider->Bind(wxEVT_SLIDER, &wxGenericColourDialog::OnAlphaSlider, this); + } + else + { + m_alphaSlider = NULL; + } wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL ); sliderSizer->Add(sliderX, sliderHeight ); - wxSizerFlags flagsRight; - flagsRight.Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL).DoubleBorder(); + const wxSizerFlags sliderLabelFlags = wxSizerFlags().Right().Border(); + const wxSizerFlags onesliderFlags = wxSizerFlags().CenterHorizontal(); + const wxSizerFlags sliderFlags + = wxSizerFlags().CentreVertical().DoubleBorder(); - sliderSizer->Add(m_redSlider, flagsRight); - sliderSizer->Add(m_greenSlider,flagsRight); - sliderSizer->Add(m_blueSlider,flagsRight); + wxBoxSizer *redSliderSizer = new wxBoxSizer(wxVERTICAL); + redSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Red:")), sliderLabelFlags); + redSliderSizer->Add(m_redSlider, onesliderFlags); + wxBoxSizer *greenSliderSizer = new wxBoxSizer(wxVERTICAL); + greenSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Green:")), sliderLabelFlags); + greenSliderSizer->Add(m_greenSlider, onesliderFlags); + wxBoxSizer *blueSliderSizer = new wxBoxSizer(wxVERTICAL); + blueSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Blue:")), sliderLabelFlags); + blueSliderSizer->Add(m_blueSlider, onesliderFlags); + + sliderSizer->Add(redSliderSizer, sliderFlags); + sliderSizer->Add(greenSliderSizer, sliderFlags); + sliderSizer->Add(blueSliderSizer, sliderFlags); + if ( m_colourData.GetChooseAlpha() ) + { + wxBoxSizer *alphaSliderSizer = new wxBoxSizer(wxVERTICAL); + alphaSliderSizer->Add(new wxStaticText(this, wxID_ANY, _("Opacity:")), sliderLabelFlags); + alphaSliderSizer->Add(m_alphaSlider, onesliderFlags); + sliderSizer->Add(alphaSliderSizer, sliderFlags); + } topSizer->Add(sliderSizer, wxSizerFlags().Centre().DoubleBorder()); #else @@ -350,13 +433,13 @@ void wxGenericColourDialog::InitializeColours(void) } } } - m_colourData.m_dataColour.Set( curr.Red(), curr.Green(), curr.Blue() ); + m_colourData.SetColour(curr); } else { m_whichKind = 1; m_colourSelection = 0; - m_colourData.m_dataColour.Set( 0, 0, 0 ); + m_colourData.SetColour(wxColour(0, 0, 0)); } } @@ -382,87 +465,90 @@ void wxGenericColourDialog::PaintBasicColours(wxDC& dc) } } -void wxGenericColourDialog::PaintCustomColours(wxDC& dc) +#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +void wxGenericColourDialog::PaintCustomColours(wxDC& dc, int clrIndex) { - int i; - for (i = 0; i < 2; i++) - { - int j; - for (j = 0; j < 8; j++) + int idxStart; + int idxEnd; + // For clrIndex == -1 redraw all custom colours + if ( clrIndex < 0 || static_cast(clrIndex) >= WXSIZEOF(m_customColours) ) { - int ptr = i*8 + j; - - int x = (j*(m_smallRectangleSize.x+m_gridSpacing)) + m_customColoursRect.x; - int y = (i*(m_smallRectangleSize.y+m_gridSpacing)) + m_customColoursRect.y; - - dc.SetPen(*wxBLACK_PEN); - - wxBrush brush(m_customColours[ptr]); - dc.SetBrush(brush); - - dc.DrawRectangle( x, y, m_smallRectangleSize.x, m_smallRectangleSize.y); + idxStart = 0; + idxEnd = WXSIZEOF(m_customColours) - 1; + } + else + { + idxStart = clrIndex; + idxEnd = clrIndex; + } + + for (int i = idxStart; i <= idxEnd; i++) + { + int x = ((i % 8)*(m_smallRectangleSize.x+m_gridSpacing)) + m_customColoursRect.x; + int y = ((i / 8)*(m_smallRectangleSize.y+m_gridSpacing)) + m_customColoursRect.y; + + dc.SetPen(*wxBLACK_PEN); + + wxBrush brush(m_customColours[i]); + dc.SetBrush(brush); + + dc.DrawRectangle(x, y, m_smallRectangleSize.x, m_smallRectangleSize.y); } - } } +#endif // !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw) { if ( m_colourSelection < 0 ) return; - // Number of pixels bigger than the standard rectangle size - // for drawing a highlight - int deltaX = 2; - int deltaY = 2; - + wxRect r(m_smallRectangleSize); if (m_whichKind == 1) { // Standard colours - int y = (int)(m_colourSelection / 8); - int x = (int)(m_colourSelection - (y*8)); - - x = (x*(m_smallRectangleSize.x + m_gridSpacing) + m_standardColoursRect.x) - deltaX; - y = (y*(m_smallRectangleSize.y + m_gridSpacing) + m_standardColoursRect.y) - deltaY; - - if (draw) - dc.SetPen(*wxBLACK_PEN); - else - dc.SetPen(*wxLIGHT_GREY_PEN); - - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRectangle( x, y, (m_smallRectangleSize.x + (2*deltaX)), (m_smallRectangleSize.y + (2*deltaY))); + r.Offset(m_standardColoursRect.GetLeftTop()); } else { // User-defined colours - int y = (int)(m_colourSelection / 8); - int x = (int)(m_colourSelection - (y*8)); - - x = (x*(m_smallRectangleSize.x + m_gridSpacing) + m_customColoursRect.x) - deltaX; - y = (y*(m_smallRectangleSize.y + m_gridSpacing) + m_customColoursRect.y) - deltaY; - - if (draw) - dc.SetPen(*wxBLACK_PEN); - else - dc.SetPen(*wxLIGHT_GREY_PEN); - - dc.SetBrush(*wxTRANSPARENT_BRUSH); - dc.DrawRectangle( x, y, (m_smallRectangleSize.x + (2*deltaX)), (m_smallRectangleSize.y + (2*deltaY))); + r.Offset(m_customColoursRect.GetLeftTop()); } + + const int x = (m_colourSelection % 8) * (m_smallRectangleSize.x + m_gridSpacing); + const int y = (m_colourSelection / 8) * (m_smallRectangleSize.y + m_gridSpacing); + r.Offset(x, y); + // Highlight is drawn with rectangle bigger than the item rectangle. + r.Inflate(2, 2); + + // Highlighting frame is drawn with black colour. + // Highlighting frame is removed by drawing using dialog background colour. + wxPen pen(draw ? *wxBLACK_PEN : wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); + + dc.SetPen(pen); + dc.SetBrush(*wxTRANSPARENT_BRUSH); + dc.DrawRectangle(r); } void wxGenericColourDialog::PaintCustomColour(wxDC& dc) { +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + wxUnusedVar(dc); + + wxBitmap bmp(m_singleCustomColourRect.GetSize(), 32); + bmp.UseAlpha(); + DoPreviewBitmap(bmp, m_colourData.GetColour()); + m_customColourBmp->SetBitmap(bmp); +#else dc.SetPen(*wxBLACK_PEN); - wxBrush *brush = new wxBrush(m_colourData.m_dataColour); + wxBrush *brush = new wxBrush(m_colourData.GetColour()); dc.SetBrush(*brush); - dc.DrawRectangle( m_singleCustomColourRect.x, m_singleCustomColourRect.y, - m_customRectangleSize.x, m_customRectangleSize.y); + dc.DrawRectangle(m_singleCustomColourRect); dc.SetBrush(wxNullBrush); delete brush; +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA/!wxCLRDLGG_USE_PREVIEW_WITH_ALPHA } void wxGenericColourDialog::OnBasicColourClick(int which) @@ -477,11 +563,13 @@ void wxGenericColourDialog::OnBasicColourClick(int which) m_redSlider->SetValue( m_standardColours[m_colourSelection].Red() ); m_greenSlider->SetValue( m_standardColours[m_colourSelection].Green() ); m_blueSlider->SetValue( m_standardColours[m_colourSelection].Blue() ); + if ( m_colourData.GetChooseAlpha() ) + { + m_alphaSlider->SetValue( m_standardColours[m_colourSelection].Alpha() ); + } #endif // wxUSE_SLIDER - m_colourData.m_dataColour.Set(m_standardColours[m_colourSelection].Red(), - m_standardColours[m_colourSelection].Green(), - m_standardColours[m_colourSelection].Blue()); + m_colourData.SetColour(m_standardColours[m_colourSelection]); PaintCustomColour(dc); PaintHighlight(dc, true); @@ -498,11 +586,13 @@ void wxGenericColourDialog::OnCustomColourClick(int which) m_redSlider->SetValue( m_customColours[m_colourSelection].Red() ); m_greenSlider->SetValue( m_customColours[m_colourSelection].Green() ); m_blueSlider->SetValue( m_customColours[m_colourSelection].Blue() ); + if ( m_colourData.GetChooseAlpha() ) + { + m_alphaSlider->SetValue( m_customColours[m_colourSelection].Alpha() ); + } #endif // wxUSE_SLIDER - m_colourData.m_dataColour.Set(m_customColours[m_colourSelection].Red(), - m_customColours[m_colourSelection].Green(), - m_customColours[m_colourSelection].Blue()); + m_colourData.SetColour(m_customColours[m_colourSelection]); PaintCustomColour(dc); PaintHighlight(dc, true); @@ -532,13 +622,18 @@ void wxGenericColourDialog::OnAddCustom(wxCommandEvent& WXUNUSED(event)) PaintHighlight(dc, true); } - m_customColours[m_colourSelection].Set(m_colourData.m_dataColour.Red(), - m_colourData.m_dataColour.Green(), - m_colourData.m_dataColour.Blue()); + m_customColours[m_colourSelection] = m_colourData.GetColour(); m_colourData.SetCustomColour(m_colourSelection, m_customColours[m_colourSelection]); - PaintCustomColours(dc); +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + wxBitmap bmp(m_smallRectangleSize, 32); + bmp.UseAlpha(); + DoPreviewBitmap(bmp, m_customColours[m_colourSelection]); + m_customColoursBmp[m_colourSelection]->SetBitmap(bmp); +#else + PaintCustomColours(dc, m_colourSelection); +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA/!wxCLRDLGG_USE_PREVIEW_WITH_ALPHA } #if wxUSE_SLIDER @@ -549,7 +644,8 @@ void wxGenericColourDialog::OnRedSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - m_colourData.m_dataColour.Set((unsigned char)m_redSlider->GetValue(), m_colourData.m_dataColour.Green(), m_colourData.m_dataColour.Blue()); + wxColour c = m_colourData.GetColour(); + m_colourData.SetColour(wxColour((unsigned char)m_redSlider->GetValue(), c.Green(), c.Blue(), c.Alpha())); PaintCustomColour(dc); } @@ -559,7 +655,8 @@ void wxGenericColourDialog::OnGreenSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - m_colourData.m_dataColour.Set(m_colourData.m_dataColour.Red(), (unsigned char)m_greenSlider->GetValue(), m_colourData.m_dataColour.Blue()); + wxColour c = m_colourData.GetColour(); + m_colourData.SetColour(wxColour(c.Red(), (unsigned char)m_greenSlider->GetValue(), c.Blue(), c.Alpha())); PaintCustomColour(dc); } @@ -569,10 +666,86 @@ void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event)) return; wxClientDC dc(this); - m_colourData.m_dataColour.Set(m_colourData.m_dataColour.Red(), m_colourData.m_dataColour.Green(), (unsigned char)m_blueSlider->GetValue()); + wxColour c = m_colourData.GetColour(); + m_colourData.SetColour(wxColour(c.Red(), c.Green(), (unsigned char)m_blueSlider->GetValue(), c.Alpha())); PaintCustomColour(dc); } +void wxGenericColourDialog::OnAlphaSlider(wxCommandEvent& WXUNUSED(event)) +{ + wxColour c = m_colourData.GetColour(); + m_colourData.SetColour(wxColour(c.Red(), c.Green(), c.Blue(), (unsigned char)m_alphaSlider->GetValue())); + + wxClientDC dc(this); + PaintCustomColour(dc); +} + #endif // wxUSE_SLIDER +#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA +void wxGenericColourDialog::DoPreviewBitmap(wxBitmap& bmp, const wxColour& colour) +{ + if ( bmp.HasAlpha() && colour.Alpha() != wxALPHA_OPAQUE ) + { + // For real ARGB draw a chessboard grid + // with actual ARGB fields and reference RGB fields. + const int w = bmp.GetWidth(); + const int h = bmp.GetHeight(); + + // Calculate field size: 4 fields per row/column, + // with size in range [2..10] + int dx = wxMax(wxMin(w / 4, 10), 2); + int dy = wxMax(wxMin(h / 4, 10), 2); + // We want a square field + dx = wxMax(dx, dy); + dy = dx; + + // Prepare opaque colour + wxColour colourRGB(colour.Red(), colour.Green(), colour.Blue(), wxALPHA_OPAQUE); + + { + wxBrush brushARGB(colour); + wxBrush brushRGB(colourRGB); + + wxMemoryDC mdc(bmp); + { + wxGCDC gdc(mdc); + + gdc.SetPen(*wxTRANSPARENT_PEN); + + for (int x = 0, ix = 0; x < w; x += dx, ix++) + { + for (int y = 0, iy = 0; y < h; y += dy, iy++) + { + if ( (ix+iy) % 2 == 0 ) + { + gdc.SetBrush(brushARGB); + } + else + { + gdc.SetBrush(brushRGB); + } + gdc.DrawRectangle(x, y, dx, dy); + } + } + + // Draw a frame + gdc.SetPen(*wxBLACK_PEN); + gdc.SetBrush(*wxTRANSPARENT_BRUSH); + gdc.DrawRectangle(0, 0, w, h); + } + } + } + else + { + wxMemoryDC mdc(bmp); + // Fill with custom colour + wxBrush brush(colour); + mdc.SetPen(*wxBLACK_PEN); + mdc.SetBrush(brush); + mdc.DrawRectangle(wxPoint(0, 0), bmp.GetSize()); + } +} +#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA + #endif // wxUSE_COLOURDLG diff --git a/Externals/wxWidgets3/src/generic/combog.cpp b/Externals/wxWidgets3/src/generic/combog.cpp index 9d14f00991..0e79b2cdf7 100644 --- a/Externals/wxWidgets3/src/generic/combog.cpp +++ b/Externals/wxWidgets3/src/generic/combog.cpp @@ -45,7 +45,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 #elif defined(__WXMSW__) @@ -54,7 +53,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 2 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 17 #elif defined(__WXGTK__) @@ -63,7 +61,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST -1 -#define TEXTXADJUST 1 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 23 #elif defined(__WXMAC__) @@ -72,7 +69,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 22 #else @@ -81,7 +77,6 @@ // meaningless if LEFT_MARGIN_CAN_BE_SET set to 1 in combocmn.cpp #define TEXTCTRLXADJUST 0 -#define TEXTXADJUST 0 // how much is read-only text's x adjusted #define DEFAULT_DROPBUTTON_WIDTH 19 #endif @@ -99,13 +94,13 @@ // wxGenericComboCtrl // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericComboCtrl, wxComboCtrlBase) +wxBEGIN_EVENT_TABLE(wxGenericComboCtrl, wxComboCtrlBase) EVT_PAINT(wxGenericComboCtrl::OnPaintEvent) EVT_MOUSE_EVENTS(wxGenericComboCtrl::OnMouseEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxGenericComboCtrl, wxComboCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericComboCtrl, wxComboCtrlBase); void wxGenericComboCtrl::Init() { @@ -257,7 +252,7 @@ void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) #ifdef __WXMAC__ wxPen pen1( wxColour(133,133,133), customBorder, - wxSOLID ); + wxPENSTYLE_SOLID ); #else wxPen pen1( wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), customBorder, @@ -496,7 +491,7 @@ bool wxGenericComboCtrl::PerformAction(const wxControlAction& action, // If native wxComboCtrl was not defined, then prepare a simple // front-end so that wxRTTI works as expected. #ifndef _WX_COMBOCONTROL_H_ -IMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxGenericComboCtrl) +wxIMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxGenericComboCtrl); #endif #endif // !wxCOMBOCONTROL_FULLY_FEATURED diff --git a/Externals/wxWidgets3/src/generic/commandlinkbuttong.cpp b/Externals/wxWidgets3/src/generic/commandlinkbuttong.cpp index 8a8d001c2e..1a995349cd 100644 --- a/Externals/wxWidgets3/src/generic/commandlinkbuttong.cpp +++ b/Externals/wxWidgets3/src/generic/commandlinkbuttong.cpp @@ -23,7 +23,7 @@ #include "wx/commandlinkbutton.h" #include "wx/artprov.h" -wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCommandLinkButton, wxButton, "wx/commandlinkbutton.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxCommandLinkButton, wxButton, "wx/commandlinkbutton.h"); wxDEFINE_FLAGS( wxCommandLinkButtonStyle ) wxBEGIN_FLAGS( wxCommandLinkButtonStyle ) diff --git a/Externals/wxWidgets3/src/generic/datavgen.cpp b/Externals/wxWidgets3/src/generic/datavgen.cpp index 996640097f..715b103433 100644 --- a/Externals/wxWidgets3/src/generic/datavgen.cpp +++ b/Externals/wxWidgets3/src/generic/datavgen.cpp @@ -46,8 +46,10 @@ #include "wx/imaglist.h" #include "wx/headerctrl.h" #include "wx/dnd.h" +#include "wx/selstore.h" #include "wx/stopwatch.h" #include "wx/weakref.h" +#include "wx/generic/private/widthcalc.h" //----------------------------------------------------------------------------- // classes @@ -78,7 +80,6 @@ static const int EXPANDER_OFFSET = 1; // Below is the compare stuff. // For the generic implementation, both the leaf nodes and the nodes are sorted for // fast search when needed -static wxDataViewModel* g_model; // The column is either the index of the column to be used for sorting or one // of the special values in this enum: @@ -94,9 +95,6 @@ enum SortColumn_Default = -1 }; -static int g_column = SortColumn_None; -static bool g_asending = true; - // ---------------------------------------------------------------------------- // helper functions // ---------------------------------------------------------------------------- @@ -122,8 +120,8 @@ wxDataViewColumn* GetExpanderColumnOrFirstOne(wxDataViewCtrl* dataview) wxTextCtrl *CreateEditorTextCtrl(wxWindow *parent, const wxRect& labelRect, const wxString& value) { wxTextCtrl* ctrl = new wxTextCtrl(parent, wxID_ANY, value, - wxPoint(labelRect.x,labelRect.y), - wxSize(labelRect.width,labelRect.height), + labelRect.GetPosition(), + labelRect.GetSize(), wxTE_PROCESS_ENTER); // Adjust size of wxTextCtrl editor to fit text, even if it means being @@ -193,7 +191,7 @@ void wxDataViewColumn::UnsetAsSortKey() m_sort = false; if ( m_owner ) - m_owner->SetSortingColumnIndex(wxNOT_FOUND); + m_owner->DontUseColumnForSorting(m_owner->GetColumnIndex(this)); UpdateDisplay(); } @@ -203,19 +201,19 @@ 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 ) + const int idx = m_owner->GetColumnIndex(this); + + // If this column isn't sorted already, mark it as sorted + if ( !m_sort ) { - m_owner->GetColumn(oldSortKey)->UnsetAsSortKey(); + wxASSERT(!m_owner->IsColumnSorted(idx)); + + // Now set this one as the new sort column. + m_owner->UseColumnForSorting(idx); + m_sort = true; } - // 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; + m_sortAscending = ascending; // Call this directly instead of using UpdateDisplay() as we already have // the column index, no need to look it up again. @@ -237,6 +235,30 @@ public: wxDataViewCtrl *GetOwner() const { return static_cast(GetParent()); } + // Add/Remove additional column to sorting columns + void ToggleSortByColumn(int column) + { + wxDataViewCtrl * const owner = GetOwner(); + + if ( !owner->IsMultiColumnSortAllowed() ) + return; + + wxDataViewColumn * const col = owner->GetColumn(column); + if ( !col->IsSortable() ) + return; + + if ( owner->IsColumnSorted(column) ) + { + col->UnsetAsSortKey(); + SendEvent(wxEVT_DATAVIEW_COLUMN_SORTED, column); + } + else // Do start sortign by it. + { + col->SetSortOrder(true); + SendEvent(wxEVT_DATAVIEW_COLUMN_SORTED, column); + } + } + protected: // implement/override wxHeaderCtrl functions by forwarding them to the main // control @@ -301,6 +323,11 @@ private: } else // not using this column for sorting yet { + // We will sort by this column only now, so reset all the + // previously used ones. + owner->ResetAllSortColumns(); + + // Sort the column col->SetSortOrder(true); } @@ -315,9 +342,13 @@ private: void OnRClick(wxHeaderCtrlEvent& event) { + // Event wasn't processed somewhere, use default behaviour if ( !SendEvent(wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK, event.GetColumn()) ) + { event.Skip(); + ToggleSortByColumn(event.GetColumn()); + } } void OnResize(wxHeaderCtrlEvent& event) @@ -340,11 +371,11 @@ private: event.GetNewOrder()); } - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxDataViewHeaderWindow); }; -BEGIN_EVENT_TABLE(wxDataViewHeaderWindow, wxHeaderCtrl) +wxBEGIN_EVENT_TABLE(wxDataViewHeaderWindow, wxHeaderCtrl) EVT_HEADER_CLICK(wxID_ANY, wxDataViewHeaderWindow::OnClick) EVT_HEADER_RIGHT_CLICK(wxID_ANY, wxDataViewHeaderWindow::OnRClick) @@ -352,7 +383,7 @@ BEGIN_EVENT_TABLE(wxDataViewHeaderWindow, wxHeaderCtrl) EVT_HEADER_END_RESIZE(wxID_ANY, wxDataViewHeaderWindow::OnResize) EVT_HEADER_END_REORDER(wxID_ANY, wxDataViewHeaderWindow::OnEndReorder) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() //----------------------------------------------------------------------------- // wxDataViewRenameTimer @@ -372,17 +403,18 @@ public: // wxDataViewTreeNode //----------------------------------------------------------------------------- +class wxDataViewMainWindow; class wxDataViewTreeNode; WX_DEFINE_ARRAY( wxDataViewTreeNode *, wxDataViewTreeNodes ); -int LINKAGEMODE wxGenericTreeModelNodeCmp( wxDataViewTreeNode ** node1, - wxDataViewTreeNode ** node2); - class wxDataViewTreeNode { public: - wxDataViewTreeNode(wxDataViewTreeNode *parent, const wxDataViewItem& item) - : m_parent(parent), + wxDataViewTreeNode(wxDataViewMainWindow *window, + wxDataViewTreeNode *parent, + const wxDataViewItem& item) + : m_window(window), + m_parent(parent), m_item(item), m_branchData(NULL) { @@ -404,9 +436,9 @@ public: } } - static wxDataViewTreeNode* CreateRootNode() + static wxDataViewTreeNode* CreateRootNode(wxDataViewMainWindow *w) { - wxDataViewTreeNode *n = new wxDataViewTreeNode(NULL, wxDataViewItem()); + wxDataViewTreeNode *n = new wxDataViewTreeNode(w, NULL, wxDataViewItem()); n->m_branchData = new BranchNodeData; n->m_branchData->open = true; return n; @@ -420,17 +452,7 @@ public: 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 InsertChild(wxDataViewTreeNode *node, unsigned index); void RemoveChild(wxDataViewTreeNode *node) { @@ -545,27 +567,10 @@ public: m_parent->ChangeSubTreeCount(num); } - void Resort() - { - if ( !m_branchData ) - return; - - if (g_column >= -1) - { - wxDataViewTreeNodes& nodes = m_branchData->children; - - nodes.Sort( &wxGenericTreeModelNodeCmp ); - int len = nodes.GetCount(); - for (int i = 0; i < len; i ++) - { - if ( nodes[i]->HasChildren() ) - nodes[i]->Resort(); - } - } - } - + void Resort(); private: + wxDataViewMainWindow * const m_window; wxDataViewTreeNode *m_parent; // Corresponding model item. @@ -599,12 +604,6 @@ private: }; -int LINKAGEMODE wxGenericTreeModelNodeCmp( wxDataViewTreeNode ** node1, - wxDataViewTreeNode ** node2) -{ - return g_model->Compare( (*node1)->GetItem(), (*node2)->GetItem(), g_column, g_asending ); -} - //----------------------------------------------------------------------------- // wxDataViewMainWindow @@ -645,10 +644,10 @@ public: // SortPrepare() was called -- and ignored -- while we were frozen. virtual void DoThaw() { - if ( g_column == SortColumn_OnThaw ) + if ( m_sortColumn == SortColumn_OnThaw ) { Resort(); - g_column = SortColumn_None; + m_sortColumn = SortColumn_None; } wxWindow::DoThaw(); @@ -656,23 +655,23 @@ public: void SortPrepare() { - g_model = GetModel(); + wxDataViewModel* model = GetModel(); wxDataViewColumn* col = GetOwner()->GetSortingColumn(); if( !col ) { - if (g_model->HasDefaultCompare()) + if (model->HasDefaultCompare()) { // See below for the explanation of IsFrozen() test. if ( IsFrozen() ) - g_column = SortColumn_OnThaw; + m_sortColumn = SortColumn_OnThaw; else - g_column = SortColumn_Default; + m_sortColumn = SortColumn_Default; } else - g_column = SortColumn_None; + m_sortColumn = SortColumn_None; - g_asending = true; + m_sortAscending = true; return; } @@ -681,12 +680,12 @@ public: // them all at once when the window is finally thawed, see above. if ( IsFrozen() ) { - g_column = SortColumn_OnThaw; + m_sortColumn = SortColumn_OnThaw; return; } - g_column = col->GetModelColumn(); - g_asending = col->IsSortOrderAscending(); + m_sortColumn = col->GetModelColumn(); + m_sortAscending = col->IsSortOrderAscending(); } void SetOwner( wxDataViewCtrl* owner ) { m_owner = owner; } @@ -702,9 +701,9 @@ public: void OnPaint( wxPaintEvent &event ); void OnCharHook( wxKeyEvent &event ); void OnChar( wxKeyEvent &event ); - void OnVerticalNavigation(int delta, const wxKeyEvent& event); - void OnLeftKey(); - void OnRightKey(); + void OnVerticalNavigation(const wxKeyEvent& event, int delta); + void OnLeftKey(wxKeyEvent& event); + void OnRightKey(wxKeyEvent& event); void OnMouse( wxMouseEvent &event ); void OnSetFocus( wxFocusEvent &event ); void OnKillFocus( wxFocusEvent &event ); @@ -721,7 +720,7 @@ 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); + bool TryAdvanceCurrentColumn(wxDataViewTreeNode *node, wxKeyEvent& event, bool forward); wxDataViewColumn *GetCurrentColumn() const { return m_currentCol; } void ClearCurrentColumn() { m_currentCol = NULL; } @@ -739,13 +738,23 @@ public: unsigned int GetLastVisibleRow(); unsigned int GetRowCount() const; - const wxDataViewSelection& GetSelections() const { return m_selection; } - void SetSelections( const wxDataViewSelection & sel ) - { m_selection = sel; UpdateDisplay(); } + const wxSelectionStore& GetSelections() const { return m_selection; } + void ClearSelection() { m_selection.SelectRange(0, GetRowCount() - 1, false); } void Select( const wxArrayInt& aSelections ); - void SelectAllRows( bool on ); + + void SelectAllRows() + { + m_selection.SelectRange(0, GetRowCount() - 1); + Refresh(); + } + + // If a valid row is specified and it was previously selected, it is left + // selected and the function returns false. Otherwise, i.e. if there is + // really no selection left in the control, it returns true. + bool UnselectAllRows(unsigned int except = (unsigned int)-1); + void SelectRow( unsigned int row, bool on ); - void SelectRows( unsigned int from, unsigned int to, bool on ); + void SelectRows( unsigned int from, unsigned int to ); void ReverseRowSelection( unsigned int row ); bool IsRowSelected( unsigned int row ); void SendSelectionChangedEvent( const wxDataViewItem& item); @@ -810,7 +819,17 @@ public: void StartEditing(const wxDataViewItem& item, const wxDataViewColumn* col); void FinishEditing(); + int GetSortColumn() const { return m_sortColumn; } + bool IsAscendingSort() const { return m_sortAscending; } + private: + void InvalidateCount() { m_count = -1; } + void UpdateCount(int count) + { + m_count = count; + m_selection.SetItemCount(count); + } + int RecalculateCount() const; // Return false only if the event was vetoed by its handler. @@ -831,7 +850,7 @@ private: wxDataViewColumn *m_currentCol; unsigned int m_currentRow; - wxDataViewSelection m_selection; + wxSelectionStore m_selection; wxDataViewRenameTimer *m_renameTimer; bool m_lastOnSame; @@ -871,6 +890,10 @@ private: // This is the tree node under the cursor wxDataViewTreeNode * m_underMouse; + // sorted column + extra flags + int m_sortColumn; + bool m_sortAscending; + // The control used for editing or NULL. wxWeakRef m_editorCtrl; @@ -878,8 +901,8 @@ private: wxDataViewRenderer* m_editorRenderer; private: - DECLARE_DYNAMIC_CLASS(wxDataViewMainWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS(wxDataViewMainWindow); + wxDECLARE_EVENT_TABLE(); }; // --------------------------------------------------------- @@ -912,7 +935,7 @@ public: // wxDataViewRenderer // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer, wxDataViewRendererBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer, wxDataViewRendererBase); wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewCellMode mode, @@ -958,7 +981,7 @@ int wxDataViewRenderer::GetAlignment() const // wxDataViewCustomRenderer // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer); wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -970,7 +993,7 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, // wxDataViewTextRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer); wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1026,7 +1049,7 @@ wxSize wxDataViewTextRenderer::GetSize() const // wxDataViewBitmapRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer); wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1073,7 +1096,7 @@ wxSize wxDataViewBitmapRenderer::GetSize() const // wxDataViewToggleRenderer // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer); wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1140,16 +1163,14 @@ bool wxDataViewToggleRenderer::WXActivateCell(const wxRect& WXUNUSED(cellRect), wxSize wxDataViewToggleRenderer::GetSize() const { - // the window parameter is not used by GetCheckBoxSize() so it's - // safe to pass NULL - return wxRendererNative::Get().GetCheckBoxSize(NULL); + return wxRendererNative::Get().GetCheckBoxSize(GetView()); } // --------------------------------------------------------- // wxDataViewProgressRenderer // --------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer, wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer, wxDataViewRenderer); wxDataViewProgressRenderer::wxDataViewProgressRenderer( const wxString &label, const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1178,20 +1199,12 @@ bool wxDataViewProgressRenderer::GetValue( wxVariant &value ) const bool wxDataViewProgressRenderer::Render(wxRect rect, wxDC *dc, int WXUNUSED(state)) { - // deflate the rect to leave a small border between bars in adjacent rows - wxRect bar = rect.Deflate(0, 1); - - dc->SetBrush( *wxTRANSPARENT_BRUSH ); - dc->SetPen( *wxBLACK_PEN ); - dc->DrawRectangle( bar ); - - bar.width = (int)(bar.width * m_value / 100.); - dc->SetPen( *wxTRANSPARENT_PEN ); - - const wxDataViewItemAttr& attr = GetAttr(); - dc->SetBrush( attr.HasColour() ? wxBrush(attr.GetColour()) - : *wxBLUE_BRUSH ); - dc->DrawRectangle( bar ); + wxRendererNative::Get().DrawGauge( + GetOwner()->GetOwner(), + *dc, + rect, + m_value, + 100); return true; } @@ -1209,7 +1222,7 @@ wxSize wxDataViewProgressRenderer::GetSize() const // wxDataViewIconTextRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewRenderer); wxDataViewIconTextRenderer::wxDataViewIconTextRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1436,37 +1449,89 @@ void wxDataViewRenameTimer::Notify() m_owner->OnRenameTimer(); } + + +// ---------------------------------------------------------------------------- +// wxDataViewTreeNode +// ---------------------------------------------------------------------------- + +// Used by wxGenericTreeModelNodeCmp sort callback only. +// +// This is not thread safe but it should be fine if all events are handled in +// one thread. +static wxDataViewModel* g_model; +static int g_column; +static bool g_asending; + +int LINKAGEMODE wxGenericTreeModelNodeCmp(wxDataViewTreeNode ** node1, + wxDataViewTreeNode ** node2) +{ + return g_model->Compare((*node1)->GetItem(), (*node2)->GetItem(), g_column, g_asending); +} + + +void wxDataViewTreeNode::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 = m_window->GetSortColumn()) >= -1) + { + g_model = m_window->GetModel(); + g_asending = m_window->IsAscendingSort(); + + m_branchData->children.Sort(&wxGenericTreeModelNodeCmp); + } +} + +void wxDataViewTreeNode::Resort() +{ + if (!m_branchData) + return; + + if ((g_column = m_window->GetSortColumn()) >= -1) + { + wxDataViewTreeNodes& nodes = m_branchData->children; + + g_model = m_window->GetModel(); + g_asending = m_window->IsAscendingSort(); + nodes.Sort(&wxGenericTreeModelNodeCmp); + int len = nodes.GetCount(); + for (int i = 0; i < len; i++) + { + if (nodes[i]->HasChildren()) + nodes[i]->Resort(); + } + } +} + //----------------------------------------------------------------------------- // wxDataViewMainWindow //----------------------------------------------------------------------------- // The tree building helper, declared firstly -static void BuildTreeHelper( const wxDataViewModel * model, const wxDataViewItem & item, - wxDataViewTreeNode * node); +static void BuildTreeHelper(wxDataViewMainWindow *window, + const wxDataViewModel *model, + const wxDataViewItem & item, + wxDataViewTreeNode * node); -int LINKAGEMODE wxDataViewSelectionCmp( unsigned int row1, unsigned int row2 ) -{ - if (row1 > row2) return 1; - if (row1 == row2) return 0; - return -1; -} +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewMainWindow, wxWindow); -IMPLEMENT_ABSTRACT_CLASS(wxDataViewMainWindow, wxWindow) - -BEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow) +wxBEGIN_EVENT_TABLE(wxDataViewMainWindow,wxWindow) EVT_PAINT (wxDataViewMainWindow::OnPaint) 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() +wxEND_EVENT_TABLE() wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxString &name ) : - wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ), - m_selection( wxDataViewSelectionCmp ) - + wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE, name ) { SetOwner( parent ); @@ -1508,11 +1573,15 @@ wxDataViewMainWindow::wxDataViewMainWindow( wxDataViewCtrl *parent, wxWindowID i // TODO: maybe there is something system colour to use m_penExpander = wxPen(wxColour(0,0,0)); - m_root = wxDataViewTreeNode::CreateRootNode(); + m_root = wxDataViewTreeNode::CreateRootNode(this); // Make m_count = -1 will cause the class recaculate the real displaying number of rows. m_count = -1; m_underMouse = NULL; + + m_sortColumn = SortColumn_None; + m_sortAscending = true; + UpdateDisplay(); } @@ -1575,13 +1644,10 @@ wxDragResult wxDataViewMainWindow::OnDragOver( wxDataFormat format, wxCoord x, m_owner->CalcUnscrolledPosition( xx, yy, &xx, &yy ); unsigned int row = GetLineAt( yy ); - if ((row >= GetRowCount()) || (xx > GetEndOfLastCol())) - { - RemoveDropHint(); - return wxDragNone; - } + wxDataViewItem item; - wxDataViewItem item = GetItemByRow( row ); + if ( row < GetRowCount() && xx <= GetEndOfLastCol() ) + item = GetItemByRow( row ); wxDataViewModel *model = GetModel(); @@ -1591,25 +1657,25 @@ wxDragResult wxDataViewMainWindow::OnDragOver( wxDataFormat format, wxCoord x, event.SetModel( model ); event.SetDataFormat( format ); event.SetDropEffect( def ); - if (!m_owner->HandleWindowEvent( event )) + if ( !m_owner->HandleWindowEvent( event ) || !event.IsAllowed() ) { RemoveDropHint(); return wxDragNone; } - if (!event.IsAllowed()) + if ( item.IsOk() ) + { + if (m_dropHint && (row != m_dropHintLine)) + RefreshRow( m_dropHintLine ); + m_dropHint = true; + m_dropHintLine = row; + RefreshRow( row ); + } + else { RemoveDropHint(); - return wxDragNone; } - - if (m_dropHint && (row != m_dropHintLine)) - RefreshRow( m_dropHintLine ); - m_dropHint = true; - m_dropHintLine = row; - RefreshRow( row ); - return def; } @@ -1622,10 +1688,10 @@ bool wxDataViewMainWindow::OnDrop( wxDataFormat format, wxCoord x, wxCoord y ) m_owner->CalcUnscrolledPosition( xx, yy, &xx, &yy ); unsigned int row = GetLineAt( yy ); - if ((row >= GetRowCount()) || (xx > GetEndOfLastCol())) - return false; + wxDataViewItem item; - wxDataViewItem item = GetItemByRow( row ); + if ( row < GetRowCount() && xx <= GetEndOfLastCol()) + item = GetItemByRow( row ); wxDataViewModel *model = GetModel(); @@ -1634,10 +1700,7 @@ bool wxDataViewMainWindow::OnDrop( wxDataFormat format, wxCoord x, wxCoord y ) event.SetItem( item ); event.SetModel( model ); event.SetDataFormat( format ); - if (!m_owner->HandleWindowEvent( event )) - return false; - - if (!event.IsAllowed()) + if (!m_owner->HandleWindowEvent( event ) || !event.IsAllowed()) return false; return true; @@ -1651,10 +1714,10 @@ wxDragResult wxDataViewMainWindow::OnData( wxDataFormat format, wxCoord x, wxCoo m_owner->CalcUnscrolledPosition( xx, yy, &xx, &yy ); unsigned int row = GetLineAt( yy ); - if ((row >= GetRowCount()) || (xx > GetEndOfLastCol())) - return wxDragNone; + wxDataViewItem item; - wxDataViewItem item = GetItemByRow( row ); + if ( row < GetRowCount() && xx <= GetEndOfLastCol() ) + item = GetItemByRow( row ); wxDataViewModel *model = GetModel(); @@ -1668,10 +1731,7 @@ wxDragResult wxDataViewMainWindow::OnData( wxDataFormat format, wxCoord x, wxCoo event.SetDataSize( obj->GetSize() ); event.SetDataBuffer( obj->GetData() ); event.SetDropEffect( def ); - if (!m_owner->HandleWindowEvent( event )) - return wxDragNone; - - if (!event.IsAllowed()) + if ( !m_owner->HandleWindowEvent( event ) || !event.IsAllowed() ) return wxDragNone; return def; @@ -1750,52 +1810,16 @@ 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 = GetModel(); wxAutoBufferedPaintDC dc( this ); + const wxSize size = GetClientSize(); + dc.SetBrush(GetOwner()->GetBackgroundColour()); dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle(GetClientSize()); + dc.DrawRectangle(size); if ( IsEmpty() ) { @@ -1881,13 +1905,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(altRowColour)); + // We only need to draw the visible part, so limit the rectangle to it. + const int xRect = m_owner->CalcUnscrolledPosition(wxPoint(0, 0)).x; + const int widthRect = size.x; for (unsigned int item = item_start; item < item_last; item++) { if ( item % 2 ) { - dc.DrawRectangle(x_start, + dc.DrawRectangle(xRect, GetLineStart(item), - GetClientSize().GetWidth(), + widthRect, GetLineHeight(item)); } } @@ -1934,33 +1961,22 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) // redraw the background for the items which are selected/current for (unsigned int item = item_start; item < item_last; item++) { - bool selected = m_selection.Index( item ) != wxNOT_FOUND; + bool selected = m_selection.IsSelected(item); if (selected || item == m_currentRow) { - wxRect rect( x_start, GetLineStart( item ), + wxRect rowRect( x_start, GetLineStart( item ), x_last - x_start, GetLineHeight( item ) ); - // draw selection and whole-item focus: - if ( selected ) - { - int flags = wxCONTROL_SELECTED; - if (m_hasFocus) - flags |= wxCONTROL_FOCUSED; + bool renderColumnFocus = false; - wxRendererNative::Get().DrawItemSelectionRect - ( - this, - dc, - rect, - flags - ); - } + int flags = wxCONTROL_SELECTED; + if ( m_hasFocus ) + flags |= wxCONTROL_FOCUSED; // draw keyboard focus rect if applicable if ( item == m_currentRow && m_hasFocus ) { - bool renderColumnFocus = false; if ( m_useCellFocus && m_currentCol && m_currentColSetByKeyboard ) { @@ -1977,54 +1993,76 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) if ( renderColumnFocus ) { + wxRect colRect(rowRect); + for ( unsigned int i = col_start; i < col_last; i++ ) { wxDataViewColumn *col = GetOwner()->GetColumnAt(i); if ( col->IsHidden() ) continue; - rect.width = col->GetWidth(); + colRect.width = col->GetWidth(); if ( col == m_currentCol ) { - // make the rect more visible by adding a small - // margin around it: - rect.Deflate(1, 1); + // Draw selection rect left of column + { + wxRect clipRect(rowRect); + clipRect.width = colRect.x; - 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); + wxDCClipper clip(dc, clipRect); + wxRendererNative::Get().DrawItemSelectionRect + ( + this, + dc, + rowRect, + flags + ); } - else + + // Draw selection rect right of column { - wxRendererNative::Get().DrawFocusRect - ( - this, - dc, - rect, - 0 - ); + wxRect clipRect(rowRect); + clipRect.x = colRect.x + colRect.width; + clipRect.width = rowRect.width - clipRect.x; + + wxDCClipper clip(dc, clipRect); + wxRendererNative::Get().DrawItemSelectionRect + ( + this, + dc, + rowRect, + flags + ); } + + // Draw column selection rect + wxRendererNative::Get().DrawItemSelectionRect + ( + this, + dc, + colRect, + flags | wxCONTROL_CURRENT | wxCONTROL_CELL + ); + break; } - rect.x += rect.width; + colRect.x += colRect.width; } } - else - { - // render focus rectangle for the whole row - wxRendererNative::Get().DrawFocusRect - ( - this, - dc, - rect, - selected ? (int)wxCONTROL_SELECTED : 0 - ); - } + } + + // draw selection and whole-item focus: + if ( selected && !renderColumnFocus ) + { + wxRendererNative::Get().DrawItemSelectionRect + ( + this, + dc, + rowRect, + flags | wxCONTROL_CURRENT + ); } } } @@ -2081,14 +2119,14 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dataitem = wxDataViewItem( wxUIntToPtr(item+1) ); } - cell->PrepareForItem(model, dataitem, col->GetModelColumn()); - // update cell_rect cell_rect.y = GetLineStart( item ); cell_rect.height = GetLineHeight( item ); + cell->PrepareForItem(model, dataitem, col->GetModelColumn()); + // draw the background - bool selected = m_selection.Index( item ) != wxNOT_FOUND; + bool selected = m_selection.IsSelected(item); if ( !selected ) DrawCellBackground( cell, dc, cell_rect ); @@ -2213,6 +2251,8 @@ wxDataViewMainWindow::StartEditing(const wxDataViewItem& item, const wxRect itemRect = GetItemRect(item, col); if ( renderer->StartEditing(item, itemRect) ) { + renderer->NotifyEditingStarted(item); + // 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; @@ -2291,6 +2331,8 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData wxDataViewVirtualListModel *list_model = (wxDataViewVirtualListModel*) GetModel(); m_count = list_model->GetCount(); + + m_selection.OnItemsInserted(GetRowByItem(item), 1); } else { @@ -2308,7 +2350,7 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData int posInModel = modelSiblings.Index(item, /*fromEnd=*/true); wxCHECK_MSG( posInModel != wxNOT_FOUND, false, "adding non-existent item?" ); - wxDataViewTreeNode *itemNode = new wxDataViewTreeNode(parentNode, item); + wxDataViewTreeNode *itemNode = new wxDataViewTreeNode(this, parentNode, item); itemNode->SetHasChildren(GetModel()->IsContainer(item)); parentNode->SetHasChildren(true); @@ -2355,7 +2397,7 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const wxData parentNode->ChangeSubTreeCount(+1); parentNode->InsertChild(itemNode, nodePos); - m_count = -1; + InvalidateCount(); } GetOwner()->InvalidateColBestWidths(); @@ -2373,25 +2415,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, (wxDataViewVirtualListModel*) GetModel(); m_count = list_model->GetCount(); - if ( !m_selection.empty() ) - { - const int row = GetRowByItem(item); - - int rowIndexInSelection = wxNOT_FOUND; - - const size_t selCount = m_selection.size(); - for ( size_t i = 0; i < selCount; 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); - } - + m_selection.OnItemDelete(GetRowByItem(item)); } else // general case { @@ -2444,7 +2468,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, parentNode->ChangeSubTreeCount(-itemsDeleted); // Make the row number invalid and get a new valid one when user call GetRowCount - m_count = -1; + InvalidateCount(); // 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. @@ -2462,7 +2486,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, } // Update selection by removing 'item' and its entire children tree from the selection. - if ( !m_selection.empty() ) + if ( !m_selection.IsEmpty() ) { // 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 @@ -2482,20 +2506,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, 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; + m_selection.OnItemsDeleted(itemRow, itemsDeleted); } } @@ -2512,7 +2523,7 @@ bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent, bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item) { SortPrepare(); - g_model->Resort(); + GetModel()->Resort(); GetOwner()->InvalidateColBestWidths(); @@ -2543,7 +2554,7 @@ bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned i return true; */ SortPrepare(); - g_model->Resort(); + GetModel()->Resort(); GetOwner()->InvalidateColBestWidth(view_column); @@ -2715,7 +2726,7 @@ unsigned int wxDataViewMainWindow::GetRowCount() const { wxDataViewMainWindow* const self = const_cast(this); - self->m_count = RecalculateCount(); + self->UpdateCount(RecalculateCount()); self->UpdateDisplay(); } return m_count; @@ -2728,77 +2739,56 @@ void wxDataViewMainWindow::ChangeCurrentRow( unsigned int row ) // send event } -void wxDataViewMainWindow::SelectAllRows( bool on ) +bool wxDataViewMainWindow::UnselectAllRows(unsigned int except) { - if (IsEmpty()) - return; - - if (on) + if (!m_selection.IsEmpty()) { - m_selection.Clear(); - for (unsigned int i = 0; i < GetRowCount(); i++) - m_selection.Add( i ); - Refresh(); - } - else - { - unsigned int first_visible = GetFirstVisibleRow(); - unsigned int last_visible = GetLastVisibleRow(); - unsigned int i; - for (i = 0; i < m_selection.GetCount(); i++) + for (unsigned i = GetFirstVisibleRow(); i <= GetLastVisibleRow(); i++) { - unsigned int row = m_selection[i]; - if ((row >= first_visible) && (row <= last_visible)) - RefreshRow( row ); + if (m_selection.IsSelected(i) && i != except) + RefreshRow(i); + } + + if (except != (unsigned int)-1) + { + const bool wasSelected = m_selection.IsSelected(except); + ClearSelection(); + if (wasSelected) + { + m_selection.SelectItem(except); + + // The special item is still selected. + return false; + } + } + else + { + ClearSelection(); } - m_selection.Clear(); } + + // There are no selected items left. + return true; } void wxDataViewMainWindow::SelectRow( unsigned int row, bool on ) { - if (m_selection.Index( row ) == wxNOT_FOUND) - { - if (on) - { - m_selection.Add( row ); - RefreshRow( row ); - } - } - else - { - if (!on) - { - m_selection.Remove( row ); - RefreshRow( row ); - } - } + if ( m_selection.SelectItem(row, on) ) + RefreshRow(row); } -void wxDataViewMainWindow::SelectRows( unsigned int from, unsigned int to, bool on ) +void wxDataViewMainWindow::SelectRows( unsigned int from, unsigned int to ) { - if (from > to) + wxArrayInt changed; + if ( m_selection.SelectRange(from, to, true, &changed) ) { - unsigned int tmp = from; - from = to; - to = tmp; + for (unsigned i = 0; i < changed.size(); i++) + RefreshRow(changed[i]); } - - unsigned int i; - for (i = from; i <= to; i++) + else // Selection of too many rows has changed. { - if (m_selection.Index( i ) == wxNOT_FOUND) - { - if (on) - m_selection.Add( i ); - } - else - { - if (!on) - m_selection.Remove( i ); - } + RefreshRows( from, to ); } - RefreshRows( from, to ); } void wxDataViewMainWindow::Select( const wxArrayInt& aSelections ) @@ -2807,23 +2797,20 @@ void wxDataViewMainWindow::Select( const wxArrayInt& aSelections ) { int n = aSelections[i]; - m_selection.Add( n ); - RefreshRow( n ); + if ( m_selection.SelectItem(n) ) + RefreshRow( n ); } } void wxDataViewMainWindow::ReverseRowSelection( unsigned int row ) { - if (m_selection.Index( row ) == wxNOT_FOUND) - m_selection.Add( row ); - else - m_selection.Remove( row ); + m_selection.SelectItem(row, !m_selection.IsSelected(row)); RefreshRow( row ); } bool wxDataViewMainWindow::IsRowSelected( unsigned int row ) { - return (m_selection.Index( row ) != wxNOT_FOUND); + return m_selection.IsSelected(row); } void wxDataViewMainWindow::SendSelectionChangedEvent( const wxDataViewItem& item) @@ -3041,10 +3028,10 @@ int wxDataViewMainWindow::GetLineHeight( unsigned int row ) const class RowToTreeNodeJob: public DoJob { public: - RowToTreeNodeJob( unsigned int row , int current, wxDataViewTreeNode * node ) + RowToTreeNodeJob( unsigned int row_ , int current_, wxDataViewTreeNode * node ) { - this->row = row; - this->current = current; + this->row = row_; + this->current = current_; ret = NULL; parent = node; } @@ -3192,26 +3179,24 @@ void wxDataViewMainWindow::Expand( unsigned int row ) if( node->GetChildNodes().empty() ) { SortPrepare(); - ::BuildTreeHelper(GetModel(), node->GetItem(), node); + ::BuildTreeHelper(this, GetModel(), node->GetItem(), node); } - // By expanding the node all row indices that are currently in the selection list - // and are greater than our node have become invalid. So we have to correct that now. - const unsigned rowAdjustment = node->GetSubTreeCount(); - for(unsigned i=0; iGetSubTreeCount(); - m_selection[i] += rowAdjustment; - } + // Shift all stored indices after this row by the number of newly added + // rows. + m_selection.OnItemsInserted(row + 1, countNewRows); + if ( m_currentRow > row ) + ChangeCurrentRow(m_currentRow + countNewRows); - if(m_currentRow > row) - ChangeCurrentRow(m_currentRow + rowAdjustment); + if ( m_count != -1 ) + m_count += countNewRows; + + // Expanding this item means the previously cached column widths could + // have become invalid as new items are now visible. + GetOwner()->InvalidateColBestWidths(); - m_count = -1; UpdateDisplay(); // Send the expanded event SendExpanderEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,node->GetItem()); @@ -3238,55 +3223,31 @@ void wxDataViewMainWindow::Collapse(unsigned int row) return; } - // Find out if there are selected items below the current node. - bool selectCollapsingRow = false; - const unsigned rowAdjustment = node->GetSubTreeCount(); - unsigned maxRowToBeTested = row + rowAdjustment; - for(unsigned i=0; iGetSubTreeCount(); + + if ( m_selection.OnItemsDeleted(row + 1, countDeletedRows) ) { - const unsigned testRow = m_selection[i]; - if(testRow > row && testRow <= maxRowToBeTested) - { - selectCollapsingRow = true; - // get out as soon as we have found a node that is selected - break; - } + SendSelectionChangedEvent(GetItemByRow(row)); } node->ToggleOpen(); - // If the node to be closed has selected items the user won't see those any longer. - // We select the collapsing node in this case. - if(selectCollapsingRow) + // Adjust the current row if necessary. + if ( m_currentRow > row ) { - SelectAllRows(false); - ChangeCurrentRow(row); - SelectRow(row, true); - SendSelectionChangedEvent(GetItemByRow(row)); - } - else - { - // if there were no selected items below our node we still need to "fix" the - // selection list to adjust for the changing of the row indices. - // We actually do the opposite of what we are doing in Expand(). - for(unsigned i=0; i row && m_currentRow <= maxRowToBeTested) + // If the current row was among the collapsed items, make the + // parent itself current. + if ( m_currentRow <= row + countDeletedRows ) ChangeCurrentRow(row); - else if(m_currentRow > row) - ChangeCurrentRow(m_currentRow - rowAdjustment); + else // Otherwise just update the index. + ChangeCurrentRow(m_currentRow - countDeletedRows); } - m_count = -1; + if ( m_count != -1 ) + m_count -= countDeletedRows; + + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); SendExpanderEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,node->GetItem()); } @@ -3323,7 +3284,7 @@ wxDataViewTreeNode * wxDataViewMainWindow::FindNode( const wxDataViewItem & item // child nodes in the control's representation yet. We have // to realize its subtree now. SortPrepare(); - ::BuildTreeHelper(model, node->GetItem(), node); + ::BuildTreeHelper(this, model, node->GetItem(), node); } const wxDataViewTreeNodes& nodes = node->GetChildNodes(); @@ -3533,8 +3494,8 @@ int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const } } -static void BuildTreeHelper( const wxDataViewModel * model, const wxDataViewItem & item, - wxDataViewTreeNode * node) +static void BuildTreeHelper( wxDataViewMainWindow *window, const wxDataViewModel * model, + const wxDataViewItem & item, wxDataViewTreeNode * node) { if( !model->IsContainer( item ) ) return; @@ -3544,7 +3505,7 @@ static void BuildTreeHelper( const wxDataViewModel * model, const wxDataViewIte for ( unsigned int index = 0; index < num; index++ ) { - wxDataViewTreeNode *n = new wxDataViewTreeNode(node, children[index]); + wxDataViewTreeNode *n = new wxDataViewTreeNode(window, node, children[index]); if( model->IsContainer(children[index]) ) n->SetHasChildren( true ); @@ -3562,17 +3523,17 @@ void wxDataViewMainWindow::BuildTree(wxDataViewModel * model) if (GetModel()->IsVirtualListModel()) { - m_count = -1; + InvalidateCount(); return; } - m_root = wxDataViewTreeNode::CreateRootNode(); + m_root = wxDataViewTreeNode::CreateRootNode(this); // First we define a invalid item to fetch the top-level elements wxDataViewItem item; SortPrepare(); - BuildTreeHelper( model, item, m_root); - m_count = -1; + BuildTreeHelper(this, model, item, m_root); + InvalidateCount(); } void wxDataViewMainWindow::DestroyTree() @@ -3673,10 +3634,32 @@ void wxDataViewMainWindow::OnCharHook(wxKeyEvent& event) return; case WXK_RETURN: + // Shift-Enter is not special neither. + if ( event.ShiftDown() ) + break; + wxFALLTHROUGH; + + case WXK_TAB: + // Ctrl/Alt-Tab or Enter could be used for something else, so + // don't handle them here. + if ( event.HasModifiers() ) + break; + m_editorRenderer->FinishEditing(); return; } } + else if ( m_useCellFocus ) + { + if ( event.GetKeyCode() == WXK_TAB && !event.HasModifiers() ) + { + if ( event.ShiftDown() ) + OnLeftKey(event); + else + OnRightKey(event); + return; + } + } event.Skip(); } @@ -3701,10 +3684,6 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) return; } - // don't use m_linesPerPage directly as it might not be computed yet - const int pageSize = GetCountPerPage(); - wxCHECK_RET( pageSize, wxT("should have non zero page size") ); - switch ( event.GetKeyCode() ) { case WXK_RETURN: @@ -3775,16 +3754,21 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) } else { - if( !m_selection.empty() ) + if ( !m_selection.IsEmpty() ) { // 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 ) + unsigned sel; + if ( m_selection.IsSelected(m_currentRow) ) + { sel = m_currentRow; - else - sel = m_selection[0]; + } + else // Focused item is not selected. + { + wxSelectionStore::IterationState cookie; + sel = m_selection.GetFirstSelectedItem(cookie); + } const wxDataViewItem item = GetItemByRow(sel); @@ -3801,35 +3785,35 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) break; case WXK_UP: - OnVerticalNavigation( -1, event ); + OnVerticalNavigation(event, -1); break; case WXK_DOWN: - OnVerticalNavigation( +1, event ); + OnVerticalNavigation(event, +1); break; // Add the process for tree expanding/collapsing case WXK_LEFT: - OnLeftKey(); + OnLeftKey(event); break; case WXK_RIGHT: - OnRightKey(); + OnRightKey(event); break; case WXK_END: - OnVerticalNavigation( +(int)GetRowCount(), event ); + OnVerticalNavigation(event, +(int)GetRowCount()); break; case WXK_HOME: - OnVerticalNavigation( -(int)GetRowCount(), event ); + OnVerticalNavigation(event, -(int)GetRowCount()); break; case WXK_PAGEUP: - OnVerticalNavigation( -(pageSize - 1), event ); + OnVerticalNavigation(event, -(GetCountPerPage() - 1)); break; case WXK_PAGEDOWN: - OnVerticalNavigation( +(pageSize - 1), event ); + OnVerticalNavigation(event, +(GetCountPerPage() - 1)); break; default: @@ -3837,7 +3821,7 @@ void wxDataViewMainWindow::OnChar( wxKeyEvent &event ) } } -void wxDataViewMainWindow::OnVerticalNavigation(int delta, const wxKeyEvent& event) +void wxDataViewMainWindow::OnVerticalNavigation(const wxKeyEvent& event, int delta) { // if there is no selection, we cannot move it anywhere if (!HasCurrentRow() || IsEmpty()) @@ -3856,6 +3840,9 @@ void wxDataViewMainWindow::OnVerticalNavigation(int delta, const wxKeyEvent& eve unsigned int oldCurrent = m_currentRow; unsigned int newCurrent = (unsigned int)newRow; + if ( newCurrent == oldCurrent ) + return; + // in single selection we just ignore Shift as we can't select several // items anyhow if ( event.ShiftDown() && !IsSingleSel() ) @@ -3871,9 +3858,12 @@ void wxDataViewMainWindow::OnVerticalNavigation(int delta, const wxKeyEvent& eve oldCurrent = m_currentRow; } - SelectRows( oldCurrent, newCurrent, true ); - if (oldCurrent!=newCurrent) - SendSelectionChangedEvent(GetItemByRow(m_selection[0])); + SelectRows(oldCurrent, newCurrent); + + wxSelectionStore::IterationState cookie; + const unsigned firstSel = m_selection.GetFirstSelectedItem(cookie); + if ( firstSel != wxSelectionStore::NO_SELECTION ) + SendSelectionChangedEvent(GetItemByRow(firstSel)); } else // !shift { @@ -3881,7 +3871,7 @@ void wxDataViewMainWindow::OnVerticalNavigation(int delta, const wxKeyEvent& eve // all previously selected items are unselected unless ctrl is held if ( !event.ControlDown() ) - SelectAllRows(false); + UnselectAllRows(); ChangeCurrentRow( newCurrent ); @@ -3897,11 +3887,11 @@ void wxDataViewMainWindow::OnVerticalNavigation(int delta, const wxKeyEvent& eve GetOwner()->EnsureVisible( m_currentRow, -1 ); } -void wxDataViewMainWindow::OnLeftKey() +void wxDataViewMainWindow::OnLeftKey(wxKeyEvent& event) { if ( IsList() ) { - TryAdvanceCurrentColumn(NULL, /*forward=*/false); + TryAdvanceCurrentColumn(NULL, event, /*forward=*/false); } else { @@ -3909,9 +3899,18 @@ void wxDataViewMainWindow::OnLeftKey() if ( !node ) return; - if ( TryAdvanceCurrentColumn(node, /*forward=*/false) ) + if ( TryAdvanceCurrentColumn(node, event, /*forward=*/false) ) return; + const bool dontCollapseNodes = event.GetKeyCode() == WXK_TAB; + if ( dontCollapseNodes ) + { + m_currentCol = NULL; + // allow focus change + event.Skip(); + 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. @@ -3941,11 +3940,11 @@ void wxDataViewMainWindow::OnLeftKey() } } -void wxDataViewMainWindow::OnRightKey() +void wxDataViewMainWindow::OnRightKey(wxKeyEvent& event) { if ( IsList() ) { - TryAdvanceCurrentColumn(NULL, /*forward=*/true); + TryAdvanceCurrentColumn(NULL, event, /*forward=*/true); } else { @@ -3972,12 +3971,12 @@ void wxDataViewMainWindow::OnRightKey() } else { - TryAdvanceCurrentColumn(node, /*forward=*/true); + TryAdvanceCurrentColumn(node, event, /*forward=*/true); } } } -bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, bool forward) +bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, wxKeyEvent& event, bool forward) { if ( GetOwner()->GetColumnCount() == 0 ) return false; @@ -3985,6 +3984,8 @@ bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, boo if ( !m_useCellFocus ) return false; + const bool wrapAround = event.GetKeyCode() == WXK_TAB; + if ( node ) { // navigation shouldn't work in branch nodes without other columns: @@ -4002,13 +4003,48 @@ bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, boo return true; } else - return false; + { + if ( !wrapAround ) + return false; + } } int idx = GetOwner()->GetColumnIndex(m_currentCol) + (forward ? +1 : -1); if ( idx >= (int)GetOwner()->GetColumnCount() ) - return false; + { + if ( !wrapAround ) + return false; + + if ( GetCurrentRow() < GetRowCount() - 1 ) + { + // go to the first column of the next row: + idx = 0; + OnVerticalNavigation(wxKeyEvent()/*dummy*/, +1); + } + else + { + // allow focus change + event.Skip(); + return false; + } + } + + if ( idx < 0 && wrapAround ) + { + if ( GetCurrentRow() > 0 ) + { + // go to the last column of the previous row: + idx = (int)GetOwner()->GetColumnCount() - 1; + OnVerticalNavigation(wxKeyEvent()/*dummy*/, -1); + } + else + { + // allow focus change + event.Skip(); + return false; + } + } GetOwner()->EnsureVisible(m_currentRow, idx); @@ -4117,23 +4153,23 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) wxDataViewItem itemDragged = GetItemByRow( drag_item_row ); // Notify cell about drag - wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); - event.SetEventObject( m_owner ); - event.SetItem( itemDragged ); - event.SetModel( model ); - if (!m_owner->HandleWindowEvent( event )) + wxDataViewEvent evt( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); + evt.SetEventObject( m_owner ); + evt.SetItem( itemDragged ); + evt.SetModel( model ); + if (!m_owner->HandleWindowEvent( evt )) return; - if (!event.IsAllowed()) + if (!evt.IsAllowed()) return; - wxDataObject *obj = event.GetDataObject(); + wxDataObject *obj = evt.GetDataObject(); if (!obj) return; wxDataViewDropSource drag( this, drag_item_row ); drag.SetData( *obj ); - /* wxDragResult res = */ drag.DoDragDrop(event.GetDragFlags()); + /* wxDragResult res = */ drag.DoDragDrop(evt.GetDragFlags()); delete obj; } return; @@ -4151,7 +4187,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) // not middle) button clears the existing selection. if (m_owner && (event.LeftDown() || event.RightDown())) { - if (!GetSelections().empty()) + if (!m_selection.IsEmpty()) { m_owner->UnselectAll(); SendSelectionChangedEvent(wxDataViewItem()); @@ -4181,7 +4217,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) { // 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(itemOffset, + wxRect rect(xpos + itemOffset, GetLineStart( current ) + (GetLineHeight(current) - m_lineHeight)/2, m_lineHeight, m_lineHeight); @@ -4232,12 +4268,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (event.LeftDClick()) { - if(hoverOverExpander) - { - // a double click on the expander will be converted into a "simulated" normal click - simulateClick = true; - } - else if ( current == m_lineLastClicked ) + if ( !hoverOverExpander && (current == m_lineLastClicked) ) { wxWindow *parent = GetParent(); wxDataViewEvent le(wxEVT_DATAVIEW_ITEM_ACTIVATED, parent->GetId()); @@ -4247,15 +4278,19 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) le.SetEventObject(parent); le.SetModel(GetModel()); - parent->ProcessWindowEvent(le); - return; - } - else - { - // The first click was on another item, so don't interpret this as - // a double click, but as a simple click instead - simulateClick = true; + if ( parent->ProcessWindowEvent(le) ) + { + // Item activation was handled from the user code. + return; + } } + + // Either it was a double click over the expander, or the second click + // happened on another item than the first one or it was a bona fide + // double click which was unhandled. In all these cases we continue + // processing this event as a simple click, e.g. to select the item or + // activate the renderer. + simulateClick = true; } if (event.LeftUp() && !hoverOverExpander) @@ -4263,9 +4298,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (m_lineSelectSingleOnUp != (unsigned int)-1) { // select single line - SelectAllRows( false ); - SelectRow( m_lineSelectSingleOnUp, true ); - SendSelectionChangedEvent( GetItemByRow(m_lineSelectSingleOnUp) ); + if ( UnselectAllRows(m_lineSelectSingleOnUp) ) + { + SelectRow( m_lineSelectSingleOnUp, true ); + SendSelectionChangedEvent( GetItemByRow(m_lineSelectSingleOnUp) ); + } + //else: it was already selected, nothing to do } // If the user click the expander, we do not do editing even if the column @@ -4300,7 +4338,8 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) // Multi-selections should not be cleared if a selected item is clicked. if (!IsRowSelected(current)) { - SelectAllRows(false); + UnselectAllRows(); + const unsigned oldCurrent = m_currentRow; ChangeCurrentRow(current); SelectRow(m_currentRow,true); @@ -4337,10 +4376,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) { if ( IsSingleSel() || !IsRowSelected(current) ) { - SelectAllRows( false ); ChangeCurrentRow(current); - SelectRow(m_currentRow,true); - SendSelectionChangedEvent(GetItemByRow( m_currentRow ) ); + if ( UnselectAllRows(current) ) + { + SelectRow(m_currentRow,true); + SendSelectionChangedEvent(GetItemByRow( m_currentRow ) ); + } } else // multi sel & current is highlighted & no mod keys { @@ -4363,14 +4404,25 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) unsigned int lineFrom = oldCurrentRow, lineTo = current; + if ( lineFrom == static_cast(-1) ) + { + // If we hadn't had any current row before, treat this as a + // simple click and select the new row only. + lineFrom = current; + } + if ( lineTo < lineFrom ) { lineTo = lineFrom; lineFrom = m_currentRow; } - SelectRows(lineFrom, lineTo, true); - SendSelectionChangedEvent(GetItemByRow(m_selection[0]) ); + SelectRows(lineFrom, lineTo); + + wxSelectionStore::IterationState cookie; + const unsigned firstSel = m_selection.GetFirstSelectedItem(cookie); + if ( firstSel != wxSelectionStore::NO_SELECTION ) + SendSelectionChangedEvent(GetItemByRow(firstSel) ); } else // !ctrl, !shift { @@ -4402,13 +4454,17 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if ( IsCellEditableInMode(item, col, wxDATAVIEW_CELL_ACTIVATABLE) ) { // notify cell about click - cell->PrepareForItem(model, item, col->GetModelColumn()); wxRect cell_rect( xpos + itemOffset, GetLineStart( current ), col->GetWidth() - itemOffset, GetLineHeight( current ) ); + // Note that PrepareForItem() should be called after GetLineStart() + // call in cell_rect initialization above as GetLineStart() calls + // PrepareForItem() for other items from inside it. + cell->PrepareForItem(model, item, col->GetModelColumn()); + // Report position relative to the cell's custom area, i.e. // not the entire space as given by the control but the one // used by the renderer after calculation of alignment etc. @@ -4463,6 +4519,13 @@ void wxDataViewMainWindow::OnSetFocus( wxFocusEvent &event ) { m_hasFocus = true; + // Make the control usable from keyboard once it gets focus by ensuring + // that it has a current row, if at all possible. + if ( !HasCurrentRow() && !IsEmpty() ) + { + ChangeCurrentRow(0); + } + if (HasCurrentRow()) Refresh(); @@ -4537,10 +4600,10 @@ void wxDataViewMainWindow::UpdateColumnSizes() WX_DEFINE_LIST(wxDataViewColumnList) -IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase) -BEGIN_EVENT_TABLE(wxDataViewCtrl, wxDataViewCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase); +wxBEGIN_EVENT_TABLE(wxDataViewCtrl, wxDataViewCtrlBase) EVT_SIZE(wxDataViewCtrl::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxDataViewCtrl::~wxDataViewCtrl() { @@ -4556,13 +4619,12 @@ void wxDataViewCtrl::Init() m_cols.DeleteContents(true); m_notifier = NULL; - // No sorting column at start - m_sortingColumnIdx = wxNOT_FOUND; - m_headerArea = NULL; m_clientArea = NULL; m_colsDirty = false; + + m_allowMultiColumnSort = false; } bool wxDataViewCtrl::Create(wxWindow *parent, @@ -4608,6 +4670,8 @@ bool wxDataViewCtrl::Create(wxWindow *parent, sizer->Add( m_clientArea, 1, wxGROW ); SetSizer( sizer ); + EnableSystemTheme(); + return true; } @@ -4623,13 +4687,11 @@ WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg, { WXLRESULT rc = wxDataViewCtrlBase::MSWWindowProc(nMsg, wParam, lParam); -#ifndef __WXWINCE__ // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) { rc |= DLGC_WANTARROWS; } -#endif return rc; } @@ -4712,9 +4774,12 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model ) m_notifier = new wxGenericDataViewModelNotifier( m_clientArea ); model->AddNotifier( m_notifier ); } - else if (m_notifier) + else { - m_notifier->Cleared(); + // Our previous notifier has either been already deleted when the + // previous model was DecRef()'d in the base class AssociateModel() or + // is not associated with us any more because if the model is still + // alive, it's not used by this control. m_notifier = NULL; } @@ -4865,6 +4930,60 @@ int wxDataViewCtrl::GetModelColumnIndex( unsigned int model_column ) const return wxNOT_FOUND; } +class wxDataViewMaxWidthCalculator : public wxMaxWidthCalculatorBase +{ +public: + wxDataViewMaxWidthCalculator(const wxDataViewCtrl *dvc, + wxDataViewMainWindow *clientArea, + wxDataViewRenderer *renderer, + const wxDataViewModel *model, + size_t model_column, + int expanderSize) + : wxMaxWidthCalculatorBase(model_column), + m_dvc(dvc), + m_clientArea(clientArea), + m_renderer(renderer), + m_model(model), + m_expanderSize(expanderSize) + { + int index = dvc->GetModelColumnIndex( model_column ); + wxDataViewColumn* column = index == wxNOT_FOUND ? NULL : dvc->GetColumn(index); + m_isExpanderCol = + !clientArea->IsList() && + (column == 0 || + GetExpanderColumnOrFirstOne(const_cast(dvc)) == column ); + } + + virtual void UpdateWithRow(int row) wxOVERRIDE + { + 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, GetColumn()); + UpdateWithWidth(m_renderer->GetSize().x + indent); + } + +private: + const wxDataViewCtrl *m_dvc; + wxDataViewMainWindow *m_clientArea; + wxDataViewRenderer *m_renderer; + const wxDataViewModel *m_model; + bool m_isExpanderCol; + int m_expanderSize; +}; + + unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const { if ( m_colsBestWidths[idx].width != 0 ) @@ -4875,146 +4994,19 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const wxDataViewRenderer *renderer = const_cast(column->GetRenderer()); - class MaxWidthCalculator - { - public: - MaxWidthCalculator(const wxDataViewCtrl *dvc, - wxDataViewMainWindow *clientArea, - wxDataViewRenderer *renderer, - const wxDataViewModel *model, - unsigned int model_column, - int expanderSize) - : m_width(0), - m_dvc(dvc), - m_clientArea(clientArea), - m_renderer(renderer), - m_model(model), - m_model_column(model_column), - m_expanderSize(expanderSize) - - { - int index = dvc->GetModelColumnIndex( model_column ); - wxDataViewColumn* column = index == wxNOT_FOUND ? NULL : dvc->GetColumn(index); - m_isExpanderCol = - !clientArea->IsList() && - (column == 0 || - GetExpanderColumnOrFirstOne(const_cast(dvc)) == column ); - } - - void UpdateWithWidth(int width) - { - m_width = wxMax(m_width, width); - } - - void UpdateWithRow(int 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_model_column); - 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_model_column; - bool m_isExpanderCol; - int m_expanderSize; - }; - - MaxWidthCalculator calculator(this, m_clientArea, renderer, - GetModel(), column->GetModelColumn(), - m_clientArea->GetRowHeight()); + wxDataViewMaxWidthCalculator calculator(this, m_clientArea, renderer, + GetModel(), column->GetModelColumn(), + m_clientArea->GetRowHeight()); calculator.UpdateWithWidth(column->GetMinWidth()); if ( m_headerArea ) 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 - // long. So the best we can do is to check the first and the last N/2 - // items in the control for some sufficiently large N and calculate best - // sizes from that. That can result in the calculated best width being too - // small for some outliers, but it's better to get slightly imperfect - // result than to wait several seconds after every update. To avoid highly - // visible miscalculations, we also include all currently visible items - // no matter what. Finally, the value of N is determined dynamically by - // measuring how much time we spent on the determining item widths so far. - -#if wxUSE_STOPWATCH - int top_part_end = count; - static const long CALC_TIMEOUT = 20/*ms*/; - // don't call wxStopWatch::Time() too often - static const unsigned CALC_CHECK_FREQ = 100; - wxStopWatch timer; -#else - // use some hard-coded limit, that's the best we can do without timer - int top_part_end = wxMin(500, count); -#endif // wxUSE_STOPWATCH/!wxUSE_STOPWATCH - - int row = 0; - - for ( row = 0; row < top_part_end; row++ ) - { -#if wxUSE_STOPWATCH - if ( row % CALC_CHECK_FREQ == CALC_CHECK_FREQ-1 && - timer.Time() > CALC_TIMEOUT ) - break; -#endif // wxUSE_STOPWATCH - calculator.UpdateWithRow(row); - } - - // row is the first unmeasured item now; that's our value of N/2 - - if ( row < count ) - { - top_part_end = row; - - // add bottom N/2 items now: - const int bottom_part_start = wxMax(row, count - row); - for ( row = bottom_part_start; row < count; row++ ) - { - calculator.UpdateWithRow(row); - } - - // finally, include currently visible items in the calculation: - const wxPoint origin = CalcUnscrolledPosition(wxPoint(0, 0)); - int first_visible = m_clientArea->GetLineAt(origin.y); - int last_visible = m_clientArea->GetLineAt(origin.y + GetClientSize().y); - - first_visible = wxMax(first_visible, top_part_end); - last_visible = wxMin(bottom_part_start, last_visible); - - for ( row = first_visible; row < last_visible; row++ ) - { - calculator.UpdateWithRow(row); - } - - wxLogTrace("dataview", - "determined best size from %d top, %d bottom plus %d more visible items out of %d total", - top_part_end, - count - bottom_part_start, - wxMax(0, last_visible - first_visible), - count); - } + const wxPoint origin = CalcUnscrolledPosition(wxPoint(0, 0)); + calculator.ComputeBestColumnWidth(count, + m_clientArea->GetLineAt(origin.y), + m_clientArea->GetLineAt(origin.y + GetClientSize().y)); int max_width = calculator.GetMaxWidth(); if ( max_width > 0 ) @@ -5054,6 +5046,7 @@ bool wxDataViewCtrl::ClearColumns() { SetExpanderColumn(NULL); m_cols.Clear(); + m_sortingColumnIdxs.clear(); m_colsBestWidths.clear(); m_clientArea->ClearCurrentColumn(); @@ -5127,8 +5120,25 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const { - return m_sortingColumnIdx == wxNOT_FOUND ? NULL - : GetColumn(m_sortingColumnIdx); + if ( m_sortingColumnIdxs.empty() ) + return NULL; + + return GetColumn(m_sortingColumnIdxs.front()); +} + +wxVector wxDataViewCtrl::GetSortingColumns() const +{ + wxVector out; + + for ( wxVector::const_iterator it = m_sortingColumnIdxs.begin(), + end = m_sortingColumnIdxs.end(); + it != end; + ++it ) + { + out.push_back(GetColumn(*it)); + } + + return out; } wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const @@ -5156,18 +5166,20 @@ wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const int wxDataViewCtrl::GetSelectedItemsCount() const { - return m_clientArea->GetSelections().size(); + return m_clientArea->GetSelections().GetSelectedCount(); } int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const { sel.Empty(); - const wxDataViewSelection& selections = m_clientArea->GetSelections(); + const wxSelectionStore& selections = m_clientArea->GetSelections(); - const size_t len = selections.size(); - for ( size_t i = 0; i < len; i++ ) + wxSelectionStore::IterationState cookie; + for ( unsigned row = selections.GetFirstSelectedItem(cookie); + row != wxSelectionStore::NO_SELECTION; + row = selections.GetNextSelectedItem(cookie) ) { - wxDataViewItem item = m_clientArea->GetItemByRow(selections[i]); + wxDataViewItem item = m_clientArea->GetItemByRow(row); if ( item.IsOk() ) { sel.Add(item); @@ -5183,12 +5195,11 @@ int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) { - wxDataViewSelection selection(wxDataViewSelectionCmp); + m_clientArea->ClearSelection(); wxDataViewItem last_parent; - int len = sel.GetCount(); - for( int i = 0; i < len; i ++ ) + for ( size_t i = 0; i < sel.size(); i++ ) { wxDataViewItem item = sel[i]; wxDataViewItem parent = GetModel()->GetParent( item ); @@ -5201,10 +5212,8 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel ) last_parent = parent; int row = m_clientArea->GetRowByItem( item ); if( row >= 0 ) - selection.Add( static_cast(row) ); + m_clientArea->SelectRow(static_cast(row), true); } - - m_clientArea->SetSelections( selection ); } void wxDataViewCtrl::Select( const wxDataViewItem & item ) @@ -5216,7 +5225,7 @@ void wxDataViewCtrl::Select( const wxDataViewItem & item ) { // Unselect all rows before select another in the single select mode if (m_clientArea->IsSingleSel()) - m_clientArea->SelectAllRows(false); + m_clientArea->UnselectAllRows(); m_clientArea->SelectRow(row, true); @@ -5249,12 +5258,12 @@ void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) void wxDataViewCtrl::SelectAll() { - m_clientArea->SelectAllRows(true); + m_clientArea->SelectAllRows(); } void wxDataViewCtrl::UnselectAll() { - m_clientArea->SelectAllRows(false); + m_clientArea->UnselectAllRows(); } void wxDataViewCtrl::EnsureVisible( int row, int column ) @@ -5319,20 +5328,14 @@ void wxDataViewCtrl::Expand( const wxDataViewItem & item ) int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Expand(row); - InvalidateColBestWidths(); - } } void wxDataViewCtrl::Collapse( const wxDataViewItem & item ) { int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Collapse(row); - InvalidateColBestWidths(); - } } bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const @@ -5351,6 +5354,91 @@ void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn m_clientArea->StartEditing(item, column); } +void wxDataViewCtrl::ResetAllSortColumns() +{ + // Must make copy, because unsorting will remove it from original vector + wxVector const copy(m_sortingColumnIdxs); + for ( wxVector::const_iterator it = copy.begin(), + end = copy.end(); + it != end; + ++it ) + { + GetColumn(*it)->UnsetAsSortKey(); + } + + wxASSERT( m_sortingColumnIdxs.empty() ); +} + +bool wxDataViewCtrl::AllowMultiColumnSort(bool allow) +{ + if ( m_allowMultiColumnSort == allow ) + return true; + + m_allowMultiColumnSort = allow; + + // If disabling, must disable any multiple sort that are active + if ( !allow ) + { + ResetAllSortColumns(); + + if ( wxDataViewModel *model = GetModel() ) + model->Resort(); + } + + return true; +} + + +bool wxDataViewCtrl::IsColumnSorted(int idx) const +{ + for ( wxVector::const_iterator it = m_sortingColumnIdxs.begin(), + end = m_sortingColumnIdxs.end(); + it != end; + ++it ) + { + if ( *it == idx ) + return true; + } + + return false; +} + +void wxDataViewCtrl::UseColumnForSorting(int idx ) +{ + m_sortingColumnIdxs.push_back(idx); +} + +void wxDataViewCtrl::DontUseColumnForSorting(int idx) +{ + for ( wxVector::iterator it = m_sortingColumnIdxs.begin(), + end = m_sortingColumnIdxs.end(); + it != end; + ++it ) + { + if ( *it == idx ) + { + m_sortingColumnIdxs.erase(it); + return; + } + } + + wxFAIL_MSG( "Column is not used for sorting" ); +} + +void wxDataViewCtrl::ToggleSortByColumn(int column) +{ + m_headerArea->ToggleSortByColumn(column); +} + +void wxDataViewCtrl::DoEnableSystemTheme(bool enable, wxWindow* window) +{ + typedef wxSystemThemedControl Base; + Base::DoEnableSystemTheme(enable, window); + Base::DoEnableSystemTheme(enable, m_clientArea); + if ( m_headerArea ) + Base::DoEnableSystemTheme(enable, m_headerArea); +} + #endif // !wxUSE_GENERICDATAVIEWCTRL #endif // wxUSE_DATAVIEWCTRL diff --git a/Externals/wxWidgets3/src/generic/datectlg.cpp b/Externals/wxWidgets3/src/generic/datectlg.cpp index 6ea3d01c4a..4a89d31d57 100644 --- a/Externals/wxWidgets3/src/generic/datectlg.cpp +++ b/Externals/wxWidgets3/src/generic/datectlg.cpp @@ -63,14 +63,14 @@ public: { } - virtual void Init() + virtual void Init() wxOVERRIDE { } // NB: Don't create lazily since it didn't work that way before // wxComboCtrl was used, and changing behaviour would almost // certainly introduce new bugs. - virtual bool Create(wxWindow* parent) + virtual bool Create(wxWindow* parent) wxOVERRIDE { if ( !wxCalendarCtrl::Create(parent, wxID_ANY, wxDefaultDateTime, wxPoint(0, 0), wxDefaultSize, @@ -95,12 +95,12 @@ public: virtual wxSize GetAdjustedSize(int WXUNUSED(minWidth), int WXUNUSED(prefHeight), - int WXUNUSED(maxHeight)) + int WXUNUSED(maxHeight)) wxOVERRIDE { return m_useSize; } - virtual wxWindow *GetControl() { return this; } + virtual wxWindow *GetControl() wxOVERRIDE { return this; } void SetDateValue(const wxDateTime& date) { @@ -251,7 +251,7 @@ private: return true; } - virtual void SetStringValue(const wxString& s) + virtual void SetStringValue(const wxString& s) wxOVERRIDE { wxDateTime dt; if ( !s.empty() && ParseDateTime(s, &dt) ) @@ -259,7 +259,7 @@ private: //else: keep the old value } - virtual wxString GetStringValue() const + virtual wxString GetStringValue() const wxOVERRIDE { return GetStringValueFor(GetDate()); } @@ -279,30 +279,30 @@ private: wxSize m_useSize; wxString m_format; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxCalendarComboPopup, wxCalendarCtrl) +wxBEGIN_EVENT_TABLE(wxCalendarComboPopup, wxCalendarCtrl) EVT_KEY_DOWN(wxCalendarComboPopup::OnCalKey) EVT_CALENDAR_SEL_CHANGED(wxID_ANY, wxCalendarComboPopup::OnSelChange) EVT_CALENDAR_PAGE_CHANGED(wxID_ANY, wxCalendarComboPopup::OnSelChange) EVT_CALENDAR(wxID_ANY, wxCalendarComboPopup::OnSelChange) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxDatePickerCtrlGeneric implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase) +wxBEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase) EVT_TEXT(wxID_ANY, wxDatePickerCtrlGeneric::OnText) EVT_SIZE(wxDatePickerCtrlGeneric::OnSize) EVT_SET_FOCUS(wxDatePickerCtrlGeneric::OnFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #ifndef wxHAS_NATIVE_DATEPICKCTRL - IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl) + wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl); #endif // ---------------------------------------------------------------------------- @@ -409,7 +409,21 @@ bool wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate, const wxDateTime& upperdate) { - return m_popup->SetDateRange(lowerdate, upperdate); + if ( !m_popup->SetDateRange(lowerdate, upperdate) ) + return false; + + // If the limits were, check that our current value lies between them and + // adjust it if it doesn't. + const wxDateTime old = GetValue(); + if ( old.IsValid() ) + { + if ( lowerdate.IsValid() && old < lowerdate ) + SetValue(lowerdate); + else if ( upperdate.IsValid() && old > upperdate ) + SetValue(upperdate); + } + + return true; } @@ -436,7 +450,7 @@ bool wxDatePickerCtrlGeneric::GetRange(wxDateTime *dt1, wxDateTime *dt2) const void wxDatePickerCtrlGeneric::SetRange(const wxDateTime &dt1, const wxDateTime &dt2) { - m_popup->SetDateRange(dt1, dt2); + SetDateRange(dt1, dt2); } wxCalendarCtrl *wxDatePickerCtrlGeneric::GetCalendar() const diff --git a/Externals/wxWidgets3/src/generic/dbgrptg.cpp b/Externals/wxWidgets3/src/generic/dbgrptg.cpp index 99416162ce..a39280a1e8 100644 --- a/Externals/wxWidgets3/src/generic/dbgrptg.cpp +++ b/Externals/wxWidgets3/src/generic/dbgrptg.cpp @@ -141,17 +141,17 @@ private: void OnBrowse(wxCommandEvent& event); #endif // wxUSE_FILEDLG - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxDumpOpenExternalDlg); }; -BEGIN_EVENT_TABLE(wxDumpOpenExternalDlg, wxDialog) +wxBEGIN_EVENT_TABLE(wxDumpOpenExternalDlg, wxDialog) #if wxUSE_FILEDLG EVT_BUTTON(wxID_MORE, wxDumpOpenExternalDlg::OnBrowse) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxDumpOpenExternalDlg::wxDumpOpenExternalDlg(wxWindow *parent, @@ -231,7 +231,7 @@ void wxDumpOpenExternalDlg::OnBrowse(wxCommandEvent& ) fname.GetPathWithSep(), fname.GetFullName() #ifdef __WXMSW__ - , _("Executable files (*.exe)|*.exe|") + wxALL_FILES + , wxString(_("Executable files (*.exe)|*.exe|")) + wxALL_FILES #endif // __WXMSW__ ); if ( dlg.ShowModal() == wxID_OK ) @@ -252,8 +252,8 @@ class wxDebugReportDialog : public wxDialog public: wxDebugReportDialog(wxDebugReport& dbgrpt); - virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow() wxOVERRIDE; + virtual bool TransferDataFromWindow() wxOVERRIDE; private: void OnView(wxCommandEvent& ); @@ -275,7 +275,7 @@ private: wxArrayString m_files; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxDebugReportDialog); }; @@ -283,12 +283,12 @@ private: // wxDebugReportDialog implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxDebugReportDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxDebugReportDialog, wxDialog) EVT_BUTTON(wxID_VIEW_DETAILS, wxDebugReportDialog::OnView) EVT_UPDATE_UI(wxID_VIEW_DETAILS, wxDebugReportDialog::OnViewUpdate) EVT_BUTTON(wxID_OPEN, wxDebugReportDialog::OnOpen) EVT_UPDATE_UI(wxID_OPEN, wxDebugReportDialog::OnViewUpdate) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -332,7 +332,7 @@ wxDebugReportDialog::wxDebugReportDialog(wxDebugReport& dbgrpt) wxSizer *sizerPreview = new wxStaticBoxSizer(wxVERTICAL, this, _("&Debug report preview:")); - sizerPreview->Add(CreateTextSizer(msg), SizerFlags(0).Centre()); + sizerPreview->Add(CreateTextSizer(msg), wxSizerFlags().Centre().Border()); // ... and the list of files in this debug report with buttons to view them wxSizer *sizerFileBtns = new wxBoxSizer(wxVERTICAL); diff --git a/Externals/wxWidgets3/src/generic/dcpsg.cpp b/Externals/wxWidgets3/src/generic/dcpsg.cpp index b5c493b0f4..1754ac83a9 100644 --- a/Externals/wxWidgets3/src/generic/dcpsg.cpp +++ b/Externals/wxWidgets3/src/generic/dcpsg.cpp @@ -235,7 +235,7 @@ static const char wxPostScriptHeaderReencodeISO2[] = //------------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC); wxPostScriptDC::wxPostScriptDC() : wxDC(new wxPostScriptDCImpl(this)) @@ -247,9 +247,6 @@ wxPostScriptDC::wxPostScriptDC(const wxPrintData& printData) { } -// conversion -static const double RAD2DEG = 180.0 / M_PI; - // we don't want to use only 72 dpi from PS print static const int DPI = 600; static const double PS2DEV = 600.0 / 72.0; @@ -261,7 +258,7 @@ static const double DEV2PS = 72.0 / 600.0; #define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS) -IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl); //------------------------------------------------------------------------------- @@ -468,10 +465,10 @@ void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord { alpha1 = (x1 - xc == 0) ? (y1 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y1-yc), double(x1-xc)) * RAD2DEG; + wxRadToDeg(-atan2(double(y1-yc), double(x1-xc))); alpha2 = (x2 - xc == 0) ? (y2 - yc < 0) ? 90.0 : -90.0 : - -atan2(double(y2-yc), double(x2-xc)) * RAD2DEG; + wxRadToDeg(-atan2(double(y2-yc), double(x2-xc))); } while (alpha1 <= 0) alpha1 += 360; while (alpha2 <= 0) alpha2 += 360; // adjust angles to be between @@ -1041,8 +1038,8 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font ) m_font = font; - int Style = m_font.GetStyle(); - int Weight = m_font.GetWeight(); + wxFontStyle Style = m_font.GetStyle(); + wxFontWeight Weight = m_font.GetWeight(); const char *name; switch (m_font.GetFamily()) @@ -1050,16 +1047,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font ) case wxTELETYPE: case wxMODERN: { - if (Style == wxITALIC) + if (Style == wxFONTSTYLE_ITALIC) { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Courier-BoldOblique"; else name = "/Courier-Oblique"; } else { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Courier-Bold"; else name = "/Courier"; @@ -1068,16 +1065,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font ) } case wxROMAN: { - if (Style == wxITALIC) + if (Style == wxFONTSTYLE_ITALIC) { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Times-BoldItalic"; else name = "/Times-Italic"; } else { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Times-Bold"; else name = "/Times-Roman"; @@ -1092,16 +1089,16 @@ void wxPostScriptDCImpl::SetFont( const wxFont& font ) case wxSWISS: default: { - if (Style == wxITALIC) + if (Style == wxFONTSTYLE_ITALIC) { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Helvetica-BoldOblique"; else name = "/Helvetica-Oblique"; } else { - if (Weight == wxBOLD) + if (Weight == wxFONTWEIGHT_BOLD) name = "/Helvetica-Bold"; else name = "/Helvetica"; @@ -2092,7 +2089,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, / dc.StartDoc("Test"); / dc.StartPage(); / wxCoord w,h; - / dc.SetFont(new wxFont(10, wxROMAN, wxNORMAL, wxNORMAL)); + / dc.SetFont(new wxFontInfo(10).Family(wxFONTFAMILY_ROMAN)); / dc.GetTextExtent("Hallo",&w,&h); / dc.EndPage(); / dc.EndDoc(); @@ -2135,17 +2132,17 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, case wxMODERN: case wxTELETYPE: { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("CourO.afm"); + if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBoO.afm"); + else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("CourBo.afm"); + else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("CourO.afm"); else name = wxT("Cour.afm"); break; } case wxROMAN: { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("TimesO.afm"); + if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBoO.afm"); + else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("TimesBo.afm"); + else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("TimesO.afm"); else name = wxT("TimesRo.afm"); break; } @@ -2157,9 +2154,9 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, case wxSWISS: default: { - if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBoO.afm"); - else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBo.afm"); - else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("HelvO.afm"); + if ((Style == wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBoO.afm"); + else if ((Style != wxFONTSTYLE_ITALIC) && (Weight == wxFONTWEIGHT_BOLD)) name = wxT("HelvBo.afm"); + else if ((Style == wxFONTSTYLE_ITALIC) && (Weight != wxFONTWEIGHT_BOLD)) name = wxT("HelvO.afm"); else name = wxT("Helv.afm"); break; } @@ -2339,7 +2336,7 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, long sum=0; float height=fontSize; /* by default */ - unsigned char *p=(unsigned char *)wxMBSTRINGCAST strbuf; + const unsigned char *p=reinterpret_cast(static_cast(strbuf)); if(!p) { // String couldn't be converted which used to SEGV as reported here: diff --git a/Externals/wxWidgets3/src/generic/descrip.mms b/Externals/wxWidgets3/src/generic/descrip.mms index 0c61de6fd8..05355a33c1 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 January 2013 * +# Date : 22 September 2015 * # * #***************************************************************************** .first @@ -95,7 +95,7 @@ OBJECTS = \ editlbox.obj,datavgen.obj,dbgrptg.obj,dragimgg.obj,\ richmsgdlgg.obj,commandlinkbuttong.obj,spinctlg.obj,\ markuptext.obj,bannerwindow.obj,timectrlg.obj,richtooltipg.obj\ - ,statbmpg.obj,splash.obj + ,statbmpg.obj,splash.obj,collheaderctrlg.obj SOURCES = \ aboutdlgg.cpp,\ @@ -168,7 +168,7 @@ SOURCES = \ datavgen.cpp,dbgrptg.cpp,dragimgg.cpp,richmsgdlgg.cpp,\ commandlinkbuttong.cpp,spinctlg.cpp markuptext.cpp \ bannerwindow.cpp timectrlg.cpp richtooltipg.cpp statbmpg.cpp \ - textmeasure.cpp + textmeasure.cpp collheaderctrlg.cpp .ifdef __WXMOTIF__ OBJECTS0=statusbr.obj,statline.obj,notebook.obj,spinctlg.obj,collpaneg.obj,\ @@ -311,3 +311,4 @@ richtooltipg.obj : richtooltipg.cpp statbmpg.obj : statbmpg.cpp textmeasure.obj : textmeasure.cpp editlbox.obj : editlbox.cpp +collheaderctrlg.obj : collheaderctrlg.cpp diff --git a/Externals/wxWidgets3/src/generic/dirctrlg.cpp b/Externals/wxWidgets3/src/generic/dirctrlg.cpp index bbbc4ef43f..d89c705816 100644 --- a/Externals/wxWidgets3/src/generic/dirctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/dirctrlg.cpp @@ -59,31 +59,17 @@ #include "wx/msw/winundef.h" #include "wx/volume.h" -// FIXME - Mingw32 1.0 has both _getdrive() and _chdrive(). For now, let's assume -// older releases don't, but it should be verified and the checks modified -// accordingly. -#if !defined(__GNUWIN32__) || (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) -#if !defined(__WXWINCE__) - #include +// MinGW has _getdrive() and _chdrive(), Cygwin doesn't. +#if defined(__GNUWIN32__) && !defined(__CYGWIN__) + #define wxHAS_DRIVE_FUNCTIONS #endif - #include - #include + +#ifdef wxHAS_DRIVE_FUNCTIONS + #include #endif #endif // __WINDOWS__ -#if defined(__OS2__) || defined(__DOS__) - #ifdef __OS2__ - #define INCL_BASE - #include - #ifndef __EMX__ - #include - #endif - #include - #include - #endif -#endif // __OS2__ - #if defined(__WXMAC__) // #include "MoreFilesX.h" #endif @@ -109,19 +95,14 @@ wxDEFINE_EVENT( wxEVT_DIRCTRL_SELECTIONCHANGED, wxTreeEvent ); wxDEFINE_EVENT( wxEVT_DIRCTRL_FILEACTIVATED, wxTreeEvent ); // ---------------------------------------------------------------------------- -// wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/") +// wxGetAvailableDrives, for WINDOWS, DOS, MAC, UNIX (returns "/") // ---------------------------------------------------------------------------- size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids) { #ifdef wxHAS_FILESYSTEM_VOLUMES -#ifdef __WXWINCE__ - // No logical drives; return "\" - paths.Add(wxT("\\")); - names.Add(wxT("\\")); - icon_ids.Add(wxFileIconsTable::computer); -#elif defined(__WIN32__) && wxUSE_FSVOLUME +#if defined(__WIN32__) && wxUSE_FSVOLUME // TODO: this code (using wxFSVolumeBase) should be used for all platforms // but unfortunately wxFSVolumeBase is not implemented everywhere const wxArrayString as = wxFSVolumeBase::GetVolumes(); @@ -158,56 +139,7 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI names.Add(vol.GetDisplayName()); icon_ids.Add(imageId); } -#elif defined(__OS2__) - APIRET rc; - ULONG ulDriveNum = 0; - ULONG ulDriveMap = 0; - rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap); - if ( rc == 0) - { - size_t i = 0; - while (i < 26) - { - if (ulDriveMap & ( 1 << i )) - { - const wxString path = wxFileName::GetVolumeString( - 'A' + i, wxPATH_GET_SEPARATOR); - const wxString name = wxFileName::GetVolumeString( - 'A' + i, wxPATH_NO_SEPARATOR); - - // Note: If _filesys is unsupported by some compilers, - // we can always replace it by DosQueryFSAttach - char filesysname[20]; -#ifdef __WATCOMC__ - ULONG cbBuffer = sizeof(filesysname); - PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)filesysname; - APIRET rc = ::DosQueryFSAttach(name.fn_str(),0,FSAIL_QUERYNAME,pfsqBuffer,&cbBuffer); - if (rc != NO_ERROR) - { - filesysname[0] = '\0'; - } -#else - _filesys(name.fn_str(), filesysname, sizeof(filesysname)); -#endif - /* FAT, LAN, HPFS, CDFS, NFS */ - int imageId; - if (path == wxT("A:\\") || path == wxT("B:\\")) - imageId = wxFileIconsTable::floppy; - else if (!strcmp(filesysname, "CDFS")) - imageId = wxFileIconsTable::cdrom; - else if (!strcmp(filesysname, "LAN") || - !strcmp(filesysname, "NFS")) - imageId = wxFileIconsTable::drive; - else - imageId = wxFileIconsTable::drive; - paths.Add(path); - names.Add(name); - icon_ids.Add(imageId); - } - i ++; - } - } -#else // !__WIN32__, !__OS2__ +#else // !__WIN32__ /* If we can switch to the drive, it exists. */ for ( char drive = 'A'; drive <= 'Z'; drive++ ) { @@ -272,36 +204,11 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI // wxIsDriveAvailable // ---------------------------------------------------------------------------- -#if defined(__DOS__) +#if defined(__WINDOWS__) -bool wxIsDriveAvailable(const wxString& dirName) +int setdrive(int drive) { - // FIXME: this method leads to hang up under Watcom for some reason -#ifdef __WATCOMC__ - wxUnusedVar(dirName); -#else - if ( dirName.length() == 3 && dirName[1u] == wxT(':') ) - { - wxString dirNameLower(dirName.Lower()); - // VS: always return true for removable media, since Win95 doesn't - // like it when MS-DOS app accesses empty floppy drive - return (dirNameLower[0u] == wxT('a') || - dirNameLower[0u] == wxT('b') || - wxDirExists(dirNameLower)); - } - else -#endif - return true; -} - -#elif defined(__WINDOWS__) || defined(__OS2__) - -int setdrive(int WXUNUSED_IN_WINCE(drive)) -{ -#ifdef __WXWINCE__ - return 0; -#elif defined(__GNUWIN32__) && \ - (defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) +#if defined(wxHAS_DRIVE_FUNCTIONS) return _chdrive(drive); #else wxChar newdrive[4]; @@ -310,12 +217,7 @@ int setdrive(int WXUNUSED_IN_WINCE(drive)) return -1; newdrive[0] = (wxChar)(wxT('A') + drive - 1); newdrive[1] = wxT(':'); -#ifdef __OS2__ - newdrive[2] = wxT('\\'); - newdrive[3] = wxT('\0'); -#else newdrive[2] = wxT('\0'); -#endif #if defined(__WINDOWS__) if (::SetCurrentDirectory(newdrive)) #else @@ -328,11 +230,8 @@ int setdrive(int WXUNUSED_IN_WINCE(drive)) #endif // !GNUWIN32 } -bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) +bool wxIsDriveAvailable(const wxString& dirName) { -#ifdef __WXWINCE__ - return false; -#else #ifdef __WIN32__ UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); #endif @@ -343,14 +242,9 @@ bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) if (dirName.length() == 3 && dirName[(size_t)1] == wxT(':')) { wxString dirNameLower(dirName.Lower()); -#if defined(__GNUWIN32__) && !(defined(__MINGW32_MAJOR_VERSION) && __MINGW32_MAJOR_VERSION >= 1) +#ifndef wxHAS_DRIVE_FUNCTIONS success = wxDirExists(dirNameLower); #else - #if defined(__OS2__) - // Avoid changing to drive since no media may be inserted. - if (dirNameLower[(size_t)0] == 'a' || dirNameLower[(size_t)0] == 'b') - return success; - #endif int currentDrive = _getdrive(); int thisDrive = (int) (dirNameLower[(size_t)0] - 'a' + 1) ; int err = setdrive( thisDrive ) ; @@ -367,9 +261,8 @@ bool wxIsDriveAvailable(const wxString& WXUNUSED_IN_WINCE(dirName)) #endif return success; -#endif } -#endif // __WINDOWS__ || __OS2__ +#endif // __WINDOWS__ #endif // wxUSE_DIRDLG || wxUSE_FILEDLG @@ -442,7 +335,7 @@ bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const // wxGenericDirCtrl //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) +wxBEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) EVT_TREE_ITEM_EXPANDING (wxID_TREECTRL, wxGenericDirCtrl::OnExpandItem) EVT_TREE_ITEM_COLLAPSED (wxID_TREECTRL, wxGenericDirCtrl::OnCollapseItem) EVT_TREE_BEGIN_LABEL_EDIT (wxID_TREECTRL, wxGenericDirCtrl::OnBeginEditItem) @@ -450,7 +343,7 @@ BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl) EVT_TREE_SEL_CHANGED (wxID_TREECTRL, wxGenericDirCtrl::OnTreeSelChange) EVT_TREE_ITEM_ACTIVATED (wxID_TREECTRL, wxGenericDirCtrl::OnItemActivated) EVT_SIZE (wxGenericDirCtrl::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGenericDirCtrl::wxGenericDirCtrl(void) { @@ -478,7 +371,7 @@ void wxGenericDirCtrl::ExpandRoot() } bool wxGenericDirCtrl::Create(wxWindow *parent, - const wxWindowID treeid, + wxWindowID treeid, const wxString& dir, const wxPoint& pos, const wxSize& size, @@ -493,15 +386,9 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); - Init(); - long treeStyle = wxTR_HAS_BUTTONS; - // On Windows CE, if you hide the root, you get a crash when - // attempting to access data for children of the root item. -#ifndef __WXWINCE__ treeStyle |= wxTR_HIDE_ROOT; -#endif #ifdef __WXGTK20__ treeStyle |= wxTR_NO_LINES; @@ -533,6 +420,19 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, if (m_filterListCtrl) m_filterListCtrl->FillFilterList(filter, defaultFilter); + // TODO: set the icon size according to current scaling for this window. + // Currently, there's insufficient API in wxWidgets to determine what icons + // are available and whether to take the nearest size according to a tolerance + // instead of scaling. + // if (!wxTheFileIconsTable->IsOk()) + // wxTheFileIconsTable->SetSize(scaledSize); + + // Meanwhile, in your application initialisation, where you have better knowledge of what + // icons are available and whether to scale, you can do this: + // + // wxTheFileIconsTable->SetSize(calculatedIconSizeForDPI); + // + // Obviously this can't take into account monitors with different DPI. m_treeCtrl->SetImageList(wxTheFileIconsTable->GetSmallImageList()); m_showHidden = false; @@ -540,7 +440,7 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, wxString rootName; -#if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__) +#if defined(__WINDOWS__) rootName = _("Computer"); #else rootName = _("Sections"); @@ -798,7 +698,7 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) wxString dirName(data->m_path); -#if (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__DOS__) || defined(__OS2__) +#if defined(__WINDOWS__) // Check if this is a root directory and if so, // whether the drive is available. if (!wxIsDriveAvailable(dirName)) @@ -812,7 +712,7 @@ void wxGenericDirCtrl::PopulateNode(wxTreeItemId parentId) // This may take a longish time. Go to busy cursor wxBusyCursor busy; -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) +#if defined(__WINDOWS__) if (dirName.Last() == ':') dirName += wxString(wxFILE_SEP_PATH); #endif @@ -961,8 +861,8 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& // Append a separator to foil bogus substring matching path2 += wxString(wxFILE_SEP_PATH); - // In MSW or PM, case is not significant -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) + // In MSW case is not significant +#if defined(__WINDOWS__) path2.MakeLower(); #endif @@ -978,8 +878,8 @@ wxTreeItemId wxGenericDirCtrl::FindChild(wxTreeItemId parentId, const wxString& if (!wxEndsWithPathSeparator(childPath)) childPath += wxString(wxFILE_SEP_PATH); - // In MSW and PM, case is not significant -#if defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__) + // In MSW case is not significant +#if defined(__WINDOWS__) childPath.MakeLower(); #endif @@ -1227,7 +1127,7 @@ void wxGenericDirCtrl::FindChildFiles(wxTreeItemId treeid, int dirFlags, wxArray wxString dirName(data->m_path); -#if defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) if (dirName.Last() == ':') dirName += wxString(wxFILE_SEP_PATH); #endif @@ -1365,14 +1265,14 @@ wxTreeItemId wxGenericDirCtrl::AppendItem (const wxTreeItemId & parent, // wxDirFilterListCtrl //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxDirFilterListCtrl, wxChoice) +wxIMPLEMENT_CLASS(wxDirFilterListCtrl, wxChoice); -BEGIN_EVENT_TABLE(wxDirFilterListCtrl, wxChoice) +wxBEGIN_EVENT_TABLE(wxDirFilterListCtrl, wxChoice) EVT_CHOICE(wxID_ANY, wxDirFilterListCtrl::OnSelFilter) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, - const wxWindowID treeid, + wxWindowID treeid, const wxPoint& pos, const wxSize& size, long style) @@ -1448,6 +1348,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt // wxFileIconsTable icons // ---------------------------------------------------------------------------- +#if 0 #ifndef __WXGTK20__ /* Computer (c) Julian Smart */ static const char* const file_icons_tbl_computer_xpm[] = { @@ -1514,6 +1415,7 @@ static const char* const file_icons_tbl_computer_xpm[] = { " " }; #endif // !GTK+ 2 +#endif // ---------------------------------------------------------------------------- // wxFileIconsTable & friends @@ -1526,17 +1428,17 @@ wxFileIconsTable* wxTheFileIconsTable = NULL; class wxFileIconsTableModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxFileIconsTableModule) + wxDECLARE_DYNAMIC_CLASS(wxFileIconsTableModule); public: wxFileIconsTableModule() {} - bool OnInit() { wxTheFileIconsTable = new wxFileIconsTable; return true; } - void OnExit() + bool OnInit() wxOVERRIDE { wxTheFileIconsTable = new wxFileIconsTable; return true; } + void OnExit() wxOVERRIDE { wxDELETE(wxTheFileIconsTable); } }; -IMPLEMENT_DYNAMIC_CLASS(wxFileIconsTableModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileIconsTableModule, wxModule); class wxFileIconEntry : public wxObject { @@ -1550,6 +1452,7 @@ wxFileIconsTable::wxFileIconsTable() { m_HashTable = NULL; m_smallImageList = NULL; + m_size = wxSize(16, 16); } wxFileIconsTable::~wxFileIconsTable() @@ -1563,55 +1466,59 @@ wxFileIconsTable::~wxFileIconsTable() } // delayed initialization - wait until first use (wxArtProv not created yet) -void wxFileIconsTable::Create() +void wxFileIconsTable::Create(const wxSize& sz) { wxCHECK_RET(!m_smallImageList && !m_HashTable, wxT("creating icons twice")); m_HashTable = new wxHashTable(wxKEY_STRING); - m_smallImageList = new wxImageList(16, 16); + m_smallImageList = new wxImageList(sz.x, sz.y); // folder: m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // folder_open m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER_OPEN, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // computer #ifdef __WXGTK20__ // GTK24 uses this icon in the file open dialog m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); #else - m_smallImageList->Add(wxIcon(file_icons_tbl_computer_xpm)); + m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, + wxART_CMN_DIALOG, + sz)); + // TODO: add computer icon if really necessary + //m_smallImageList->Add(wxIcon(file_icons_tbl_computer_xpm)); #endif // drive m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // cdrom m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_CDROM, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // floppy m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FLOPPY, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // removeable m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_REMOVABLE, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // file m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); // executable if (GetIconID(wxEmptyString, wxT("application/x-executable")) == file) { m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG, - wxSize(16, 16))); + sz)); delete m_HashTable->Get(wxT("exe")); m_HashTable->Delete(wxT("exe")); m_HashTable->Put(wxT("exe"), new wxFileIconEntry(executable)); @@ -1624,7 +1531,7 @@ void wxFileIconsTable::Create() wxImageList *wxFileIconsTable::GetSmallImageList() { if (!m_smallImageList) - Create(); + Create(m_size); return m_smallImageList; } @@ -1633,9 +1540,9 @@ wxImageList *wxFileIconsTable::GetSmallImageList() // VS: we don't need this function w/o wxMimeTypesManager because we'll only have // one icon and we won't resize it -static wxBitmap CreateAntialiasedBitmap(const wxImage& img) +static wxBitmap CreateAntialiasedBitmap(const wxImage& img, const wxSize& sz) { - const unsigned int size = 16; + const unsigned int size = sz.x; wxImage smallimg (size, size); unsigned char *p1, *p2, *ps; @@ -1739,7 +1646,7 @@ static wxImage CutEmptyBorders(const wxImage& img) int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) { if (!m_smallImageList) - Create(); + Create(m_size); #if wxUSE_MIMETYPE if (!extension.empty()) @@ -1782,7 +1689,7 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) return newid; } - const unsigned int size = 16; + int size = m_size.x; int treeid = m_smallImageList->GetImageCount(); if ((bmp.GetWidth() == (int) size) && (bmp.GetHeight() == (int) size)) @@ -1796,9 +1703,9 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime) if ((img.GetWidth() != size*2) || (img.GetHeight() != size*2)) // m_smallImageList->Add(CreateAntialiasedBitmap(CutEmptyBorders(img).Rescale(size*2, size*2))); - m_smallImageList->Add(CreateAntialiasedBitmap(img.Rescale(size*2, size*2))); + m_smallImageList->Add(CreateAntialiasedBitmap(img.Rescale(size*2, size*2), m_size)); else - m_smallImageList->Add(CreateAntialiasedBitmap(img)); + m_smallImageList->Add(CreateAntialiasedBitmap(img, m_size)); } #endif // wxUSE_IMAGE diff --git a/Externals/wxWidgets3/src/generic/dirdlgg.cpp b/Externals/wxWidgets3/src/generic/dirdlgg.cpp index 80ddf5ca5e..d1c58900b0 100644 --- a/Externals/wxWidgets3/src/generic/dirdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/dirdlgg.cpp @@ -48,9 +48,9 @@ static const int ID_GO_HOME = 1006; // wxGenericDirDialog //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericDirDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericDirDialog, wxDialog); -BEGIN_EVENT_TABLE(wxGenericDirDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericDirDialog, wxDialog) EVT_CLOSE (wxGenericDirDialog::OnCloseWindow) EVT_BUTTON (wxID_OK, wxGenericDirDialog::OnOK) EVT_BUTTON (ID_NEW, wxGenericDirDialog::OnNew) @@ -59,7 +59,7 @@ BEGIN_EVENT_TABLE(wxGenericDirDialog, wxDialog) EVT_TREE_SEL_CHANGED (wxID_ANY, wxGenericDirDialog::OnTreeSelected) EVT_TEXT_ENTER (ID_TEXTCTRL, wxGenericDirDialog::OnOK) EVT_CHECKBOX (ID_SHOW_HIDDEN, wxGenericDirDialog::OnShowHidden) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title, const wxString& defaultPath, long style, @@ -91,33 +91,13 @@ bool wxGenericDirDialog::Create(wxWindow* parent, wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - // smartphones does not support or do not waste space for wxButtons -#if defined(__SMARTPHONE__) - - wxMenu *dirMenu = new wxMenu; - dirMenu->Append(ID_GO_HOME, _("Home")); - - if (!HasFlag(wxDD_DIR_MUST_EXIST)) - { - dirMenu->Append(ID_NEW, _("New directory")); - } - - dirMenu->AppendCheckItem(ID_SHOW_HIDDEN, _("Show hidden directories")); - dirMenu->AppendSeparator(); - dirMenu->Append(wxID_CANCEL, _("Cancel")); - -#else - // 0) 'New' and 'Home' Buttons wxSizer* buttonsizer = new wxBoxSizer( wxHORIZONTAL ); - // VS: 'Home directory' concept is unknown to MS-DOS -#if !defined(__DOS__) wxBitmapButton* homeButton = new wxBitmapButton(this, ID_GO_HOME, wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_BUTTON)); buttonsizer->Add( homeButton, 0, wxLEFT|wxRIGHT, 10 ); -#endif // I'm not convinced we need a New button, and we tend to get annoying // accidental-editing with label editing enabled. @@ -138,8 +118,6 @@ bool wxGenericDirDialog::Create(wxWindow* parent, topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 ); -#endif // __SMARTPHONE__/!__SMARTPHONE__ - // 1) dir ctrl m_dirCtrl = NULL; // this is necessary, event handler called from // wxGenericDirCtrl would crash otherwise! @@ -164,12 +142,10 @@ bool wxGenericDirDialog::Create(wxWindow* parent, topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand()); -#ifndef __SMARTPHONE__ // 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()); -#endif // !__SMARTPHONE__ // 2) text ctrl m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition ); @@ -182,11 +158,6 @@ bool wxGenericDirDialog::Create(wxWindow* parent, topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); } -#ifdef __SMARTPHONE__ - // overwrite menu set by CreateSeparatedButtonSizer() call above - SetRightMenu(wxID_ANY, _("Options"), dirMenu); -#endif - m_input->SetFocus(); SetAutoLayout( true ); diff --git a/Externals/wxWidgets3/src/generic/dragimgg.cpp b/Externals/wxWidgets3/src/generic/dragimgg.cpp index 15561e5e54..270717a63b 100644 --- a/Externals/wxWidgets3/src/generic/dragimgg.cpp +++ b/Externals/wxWidgets3/src/generic/dragimgg.cpp @@ -46,7 +46,7 @@ // macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericDragImage, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericDragImage, wxObject); // ============================================================================ // implementation @@ -78,55 +78,6 @@ void wxGenericDragImage::Init() #endif } -#if WXWIN_COMPATIBILITY_2_6 -wxGenericDragImage::wxGenericDragImage(const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - Create(cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(image, cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(image, cursor); -} - -wxGenericDragImage::wxGenericDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - Init(); - - Create(str, cursor); -} - -bool wxGenericDragImage::Create(const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(cursor); -} - -bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(image, cursor); -} - -bool wxGenericDragImage::Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(image, cursor); -} - -bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) -{ - return Create(str, cursor); -} -#endif // WXWIN_COMPATIBILITY_2_6 - // Attributes //////////////////////////////////////////////////////////////////////////// diff --git a/Externals/wxWidgets3/src/generic/editlbox.cpp b/Externals/wxWidgets3/src/generic/editlbox.cpp index a236e62f59..074fa5fac2 100644 --- a/Externals/wxWidgets3/src/generic/editlbox.cpp +++ b/Externals/wxWidgets3/src/generic/editlbox.cpp @@ -24,6 +24,7 @@ #include "wx/editlbox.h" #include "wx/sizer.h" #include "wx/listctrl.h" +#include "wx/artprov.h" // ============================================================================ // implementation @@ -31,116 +32,6 @@ const char wxEditableListBoxNameStr[] = "editableListBox"; -static const char* const eledit_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #00007F", -" ", -" ", -" .. .. ", -" . ", -" . ", -" ++++ . ++++ ", -" ++ . ++ ++", -" +++++ . ++++++", -" ++ ++ . ++ ", -" ++ ++ . ++ ++", -" +++++ . ++++ ", -" . ", -" . ", -" .. .. ", -" ", -" "}; - -static const char* const elnew_xpm[] = { -"16 16 5 1", -" c None", -". c #7F7F7F", -"+ c #FFFFFF", -"@ c #FFFF00", -"# c #000000", -" ", -" ", -" . .+ .@ ", -" . .@.@# # # ", -" @.@+.... # ", -" ... @@ ", -" @ . @. # ", -" .# .@ ", -" . # ", -" # ", -" # ", -" # ", -" # ", -" # # # # # # ", -" ", -" "}; - -static const char* const eldel_xpm[] = { -"16 16 3 1", -" c None", -". c #7F0000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ..+ ..+ ", -" ....+ ..+ ", -" ....+ ..+ ", -" ...+ .+ ", -" .....+ ", -" ...+ ", -" .....+ ", -" ...+ ..+ ", -" ...+ ..+ ", -" ...+ .+ ", -" ...+ .+ ", -" . . ", -" "}; - -static const char* const eldown_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ........... ", -" ......... ", -" ....... ", -" ..... ", -" ... ", -" . ", -" ", -" "}; - -static const char* const elup_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" . ", -" ... ", -" ..... ", -" ....... ", -" ......... ", -" ........... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ... ", -" ", -" ", -" "}; - // list control with auto-resizable column: class CleverListCtrl : public wxListCtrl { @@ -176,7 +67,7 @@ public: } private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); void OnSize(wxSizeEvent& event) { SizeColumns(); @@ -184,16 +75,16 @@ private: } }; -BEGIN_EVENT_TABLE(CleverListCtrl, wxListCtrl) +wxBEGIN_EVENT_TABLE(CleverListCtrl, wxListCtrl) EVT_SIZE(CleverListCtrl::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxEditableListBox // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxEditableListBox, wxPanel) +wxIMPLEMENT_CLASS(wxEditableListBox, wxPanel); // NB: generate the IDs at runtime to avoid conflict with XRCID values, // they could cause XRCCTRL() failures in XRC-based dialogs @@ -204,7 +95,7 @@ const wxWindowIDRef wxID_ELB_UP = wxWindow::NewControlId(); const wxWindowIDRef wxID_ELB_DOWN = wxWindow::NewControlId(); const wxWindowIDRef wxID_ELB_LISTCTRL = wxWindow::NewControlId(); -BEGIN_EVENT_TABLE(wxEditableListBox, wxPanel) +wxBEGIN_EVENT_TABLE(wxEditableListBox, wxPanel) EVT_LIST_ITEM_SELECTED(wxID_ELB_LISTCTRL, wxEditableListBox::OnItemSelected) EVT_LIST_END_LABEL_EDIT(wxID_ELB_LISTCTRL, wxEditableListBox::OnEndLabelEdit) EVT_BUTTON(wxID_ELB_NEW, wxEditableListBox::OnNewItem) @@ -212,7 +103,7 @@ BEGIN_EVENT_TABLE(wxEditableListBox, wxPanel) EVT_BUTTON(wxID_ELB_DOWN, wxEditableListBox::OnDownItem) EVT_BUTTON(wxID_ELB_EDIT, wxEditableListBox::OnEditItem) EVT_BUTTON(wxID_ELB_DELETE, wxEditableListBox::OnDelItem) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, @@ -243,28 +134,33 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, if ( m_style & wxEL_ALLOW_EDIT ) { - m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxBitmap(eledit_xpm)); + m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, + wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if ( m_style & wxEL_ALLOW_NEW ) { - m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxBitmap(elnew_xpm)); + m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, + wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if ( m_style & wxEL_ALLOW_DELETE ) { - m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxBitmap(eldel_xpm)); + m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, + wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } if (!(m_style & wxEL_NO_REORDER)) { - m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxBitmap(elup_xpm)); + m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, + wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); - m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxBitmap(eldown_xpm)); + m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, + wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); } diff --git a/Externals/wxWidgets3/src/generic/fdrepdlg.cpp b/Externals/wxWidgets3/src/generic/fdrepdlg.cpp index af1ebb03ef..c1eed43257 100644 --- a/Externals/wxWidgets3/src/generic/fdrepdlg.cpp +++ b/Externals/wxWidgets3/src/generic/fdrepdlg.cpp @@ -49,9 +49,9 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxGenericFindReplaceDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericFindReplaceDialog, wxDialog); -BEGIN_EVENT_TABLE(wxGenericFindReplaceDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericFindReplaceDialog, wxDialog) EVT_BUTTON(wxID_FIND, wxGenericFindReplaceDialog::OnFind) EVT_BUTTON(wxID_REPLACE, wxGenericFindReplaceDialog::OnReplace) EVT_BUTTON(wxID_REPLACE_ALL, wxGenericFindReplaceDialog::OnReplaceAll) @@ -62,7 +62,7 @@ BEGIN_EVENT_TABLE(wxGenericFindReplaceDialog, wxDialog) EVT_UPDATE_UI(wxID_REPLACE_ALL, wxGenericFindReplaceDialog::OnUpdateFindUI) EVT_CLOSE(wxGenericFindReplaceDialog::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxGenericFindReplaceDialog diff --git a/Externals/wxWidgets3/src/generic/filectrlg.cpp b/Externals/wxWidgets3/src/generic/filectrlg.cpp index 1dfba4421c..4c030d2b14 100644 --- a/Externals/wxWidgets3/src/generic/filectrlg.cpp +++ b/Externals/wxWidgets3/src/generic/filectrlg.cpp @@ -38,9 +38,7 @@ #include "wx/msw/wrapwin.h" #endif -#if defined(__WXWINCE__) -#define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/")) -#elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__)) +#if defined(__WINDOWS__) #define IsTopMostDir(dir) (dir.empty()) #else #define IsTopMostDir(dir) (dir == wxT("/")) @@ -175,7 +173,7 @@ void wxFileData::ReadData() return; } -#if defined(__DOS__) || (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__OS2__) +#if defined(__WINDOWS__) // c:\.. is a drive don't stat it if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5)) { @@ -183,45 +181,13 @@ void wxFileData::ReadData() m_size = 0; return; } -#endif // __DOS__ || __WINDOWS__ - -#ifdef __WXWINCE__ - - // WinCE - - DWORD fileAttribs = GetFileAttributes(m_filePath.fn_str()); - m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0; - - wxString p, f, ext; - wxFileName::SplitPath(m_filePath, & p, & f, & ext); - if (wxStricmp(ext, wxT("exe")) == 0) - m_type |= is_exe; - - // Find out size - m_size = 0; - HANDLE fileHandle = CreateFile(m_filePath.fn_str(), - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (fileHandle != INVALID_HANDLE_VALUE) - { - m_size = GetFileSize(fileHandle, 0); - CloseHandle(fileHandle); - } - - m_dateTime = wxFileModificationTime(m_filePath); - -#else +#endif // __WINDOWS__ // OTHER PLATFORMS wxStructStat buff; -#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS)) +#if defined(__UNIX__) && !defined(__VMS) const bool hasStat = lstat( m_filePath.fn_str(), &buff ) == 0; if ( hasStat ) m_type |= S_ISLNK(buff.st_mode) ? is_link : 0; @@ -238,8 +204,6 @@ void wxFileData::ReadData() m_dateTime = buff.st_mtime; } -#endif - // __WXWINCE__ #if defined(__UNIX__) if ( hasStat ) @@ -393,14 +357,14 @@ void wxFileData::MakeItem( wxListItem &item ) // wxFileListCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileListCtrl,wxListCtrl); -BEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl) +wxBEGIN_EVENT_TABLE(wxFileListCtrl,wxListCtrl) EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileListCtrl::OnListDeleteItem) EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileListCtrl::OnListDeleteAllItems) EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileListCtrl::OnListEndLabelEdit) EVT_LIST_COL_CLICK(wxID_ANY, wxFileListCtrl::OnListColClick) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxFileListCtrl::wxFileListCtrl() @@ -457,7 +421,7 @@ void wxFileListCtrl::ChangeToReportMode() GetTextExtent(txt, &w, &h); InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w ); - InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 ); + InsertColumn( 1, _("Size"), wxLIST_FORMAT_RIGHT, w/2 ); InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 ); InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w ); #if defined(__UNIX__) @@ -534,7 +498,7 @@ void wxFileListCtrl::UpdateFiles() item.m_itemId = 0; item.m_col = 0; -#if (defined(__WINDOWS__) || defined(__DOS__) || defined(__WXMAC__) || defined(__OS2__)) && !defined(__WXWINCE__) +#if defined(__WINDOWS__) || defined(__WXMAC__) if ( IsTopMostDir(m_dirName) ) { wxArrayString names, paths; @@ -563,13 +527,13 @@ void wxFileListCtrl::UpdateFiles() } } else -#endif // defined(__DOS__) || defined(__WINDOWS__) +#endif // defined(__WINDOWS__) || defined(__WXMAC__) { // Real directory... if ( !IsTopMostDir(m_dirName) && !m_dirName.empty() ) { wxString p(wxPathOnly(m_dirName)); -#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__) +#if defined(__UNIX__) if (p.empty()) p = wxT("/"); #endif // __UNIX__ wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder); @@ -580,10 +544,10 @@ void wxFileListCtrl::UpdateFiles() } wxString dirname(m_dirName); -#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) if (dirname.length() == 2 && dirname[1u] == wxT(':')) dirname << wxT('\\'); -#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) +#endif // defined(__WINDOWS__) if (dirname.empty()) dirname = wxFILE_SEP_PATH; @@ -705,7 +669,7 @@ void wxFileListCtrl::GoToParentDir() m_dirName.Remove( len-1, 1 ); wxString fname( wxFileNameFromPath(m_dirName) ); m_dirName = wxPathOnly( m_dirName ); -#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) if (!m_dirName.empty()) { if (m_dirName.Last() == wxT('.')) @@ -889,16 +853,16 @@ wxFileListCtrl::~wxFileListCtrl() // wxGenericFileCtrl implementation /////////////////////////////////////////////////////////////////////////////// -IMPLEMENT_DYNAMIC_CLASS( wxGenericFileCtrl, wxNavigationEnabled ) +wxIMPLEMENT_DYNAMIC_CLASS( wxGenericFileCtrl, wxNavigationEnabled ); -BEGIN_EVENT_TABLE( wxGenericFileCtrl, wxNavigationEnabled ) +wxBEGIN_EVENT_TABLE( wxGenericFileCtrl, wxNavigationEnabled ) EVT_LIST_ITEM_SELECTED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnSelected ) EVT_LIST_ITEM_ACTIVATED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnActivated ) EVT_CHOICE( ID_CHOICE, wxGenericFileCtrl::OnChoiceFilter ) EVT_TEXT_ENTER( ID_TEXT, wxGenericFileCtrl::OnTextEnter ) EVT_TEXT( ID_TEXT, wxGenericFileCtrl::OnTextChange ) EVT_CHECKBOX( ID_CHECK, wxGenericFileCtrl::OnCheck ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxGenericFileCtrl::Create( wxWindow *parent, wxWindowID id, @@ -963,11 +927,7 @@ bool wxGenericFileCtrl::Create( wxWindow *parent, if ( !( m_style & wxFC_MULTIPLE ) ) style2 |= wxLC_SINGLE_SEL; -#ifdef __WXWINCE__ - style2 |= wxSIMPLE_BORDER; -#else style2 |= wxSUNKEN_BORDER; -#endif m_list = new wxFileListCtrl( this, ID_FILELIST_CTRL, wxEmptyString, false, @@ -1064,9 +1024,14 @@ wxFileName wxGenericFileCtrl::DoGetFileName() const wxListItem item; item.m_itemId = m_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - m_list->GetItem(item); - fn.Assign(m_list->GetDir(), item.m_text); + // ... if anything is selected in the list + if ( item.m_itemId != wxNOT_FOUND ) + { + m_list->GetItem(item); + + fn.Assign(m_list->GetDir(), item.m_text); + } } else // user entered the value { @@ -1140,15 +1105,16 @@ bool wxGenericFileCtrl::SetDirectory( const wxString& dir ) bool wxGenericFileCtrl::SetFilename( const wxString& name ) { - const long item = m_list->FindItem( -1, name ); - - if ( item == -1 ) // file not found either because it doesn't exist or the - // current filter doesn't show it. - return false; + wxString dir, fn, ext; + wxFileName::SplitPath(name, &dir, &fn, &ext); + wxCHECK_MSG( dir.empty(), false, + wxS( "can't specify directory component to SetFilename" ) ); m_noSelChgEvent = true; - // Deselect selected items + m_text->ChangeValue( name ); + + // Deselect previously selected items { const int numSelectedItems = m_list->GetSelectedItemCount(); @@ -1159,7 +1125,7 @@ bool wxGenericFileCtrl::SetFilename( const wxString& name ) for ( ;; ) { itemIndex = m_list->GetNextItem( itemIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); - if ( itemIndex == -1 ) + if ( itemIndex == wxNOT_FOUND ) break; m_list->SetItemState( itemIndex, 0, wxLIST_STATE_SELECTED ); @@ -1167,8 +1133,14 @@ bool wxGenericFileCtrl::SetFilename( const wxString& name ) } } - m_list->SetItemState( item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - m_list->EnsureVisible( item ); + // Select new filename if it's in the list + long item = m_list->FindItem(wxNOT_FOUND, name); + + if ( item != wxNOT_FOUND ) + { + m_list->SetItemState( item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); + m_list->EnsureVisible( item ); + } m_noSelChgEvent = false; @@ -1282,10 +1254,6 @@ void wxGenericFileCtrl::OnSelected( wxListEvent &event ) m_inSelected = true; const wxString filename( event.m_item.m_text ); -#ifdef __WXWINCE__ - // No double-click on most WinCE devices, so do action immediately. - HandleAction( filename ); -#else if ( filename == wxT( ".." ) ) { m_inSelected = false; @@ -1316,7 +1284,6 @@ void wxGenericFileCtrl::OnSelected( wxListEvent &event ) GenerateSelectionChangedEvent( this, this ); m_ignoreChanges = false; -#endif m_inSelected = false; } @@ -1431,12 +1398,15 @@ void wxGenericFileCtrl::HandleAction( const wxString &fn ) bool wxGenericFileCtrl::SetPath( const wxString& path ) { - if ( !wxFileName::FileExists( ( path ) ) ) + wxString dir, fn, ext; + wxFileName::SplitPath(path, &dir, &fn, &ext); + + if ( !dir.empty() && !wxFileName::DirExists(dir) ) return false; - wxString ext; - wxFileName::SplitPath( path, &m_dir, &m_fileName, &ext ); - if ( !ext.empty() ) + m_dir = dir; + m_fileName = fn; + if ( !ext.empty() || path.Last() == '.' ) { m_fileName += wxT( "." ); m_fileName += ext; diff --git a/Externals/wxWidgets3/src/generic/filedlgg.cpp b/Externals/wxWidgets3/src/generic/filedlgg.cpp index 9ec0842c64..bacc3a2dbb 100644 --- a/Externals/wxWidgets3/src/generic/filedlgg.cpp +++ b/Externals/wxWidgets3/src/generic/filedlgg.cpp @@ -18,7 +18,7 @@ #if wxUSE_FILEDLG // NOTE : it probably also supports MAC, untested -#if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__) && !defined(__OS2__) +#if !defined(__UNIX__) && !defined(__WIN32__) #error wxGenericFileDialog currently only supports Unix, win32 and DOS #endif @@ -57,10 +57,8 @@ #include "wx/config.h" #endif -#ifndef __WXWINCE__ - #include - #include -#endif +#include +#include #ifdef __UNIX__ #include @@ -70,25 +68,13 @@ #endif #endif -#ifdef __WINDOWS__ - #include "wx/msw/mslu.h" -#endif - -#ifdef __WATCOMC__ - #include -#endif - -#ifndef __WXWINCE__ #include -#endif -#if defined(__UNIX__) || defined(__DOS__) +#if defined(__UNIX__) #include #endif -#if defined(__WXWINCE__) -#define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/")) -#elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__)) +#if defined(__WINDOWS__) #define IsTopMostDir(dir) (dir.empty()) #else #define IsTopMostDir(dir) (dir == wxT("/")) @@ -105,9 +91,9 @@ #define ID_NEW_DIR (wxID_FILEDLGG + 4) #define ID_FILE_CTRL (wxID_FILEDLGG + 5) -IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase); -BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog) EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList) EVT_BUTTON(ID_REPORT_MODE, wxGenericFileDialog::OnReport) EVT_BUTTON(ID_UP_DIR, wxGenericFileDialog::OnUp) @@ -117,10 +103,10 @@ BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog) EVT_FILECTRL_FILEACTIVATED(ID_FILE_CTRL, wxGenericFileDialog::OnFileActivated) EVT_UPDATE_UI(ID_UP_DIR, wxGenericFileDialog::OnUpdateButtonsUI) -#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) +#if defined(__WINDOWS__) EVT_UPDATE_UI(ID_NEW_DIR, wxGenericFileDialog::OnUpdateButtonsUI) -#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__) -END_EVENT_TABLE() +#endif // defined(__WINDOWS__) +wxEND_EVENT_TABLE() long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST; bool wxGenericFileDialog::ms_lastShowHidden = false; @@ -218,11 +204,9 @@ bool wxGenericFileDialog::Create( wxWindow *parent, m_upDirButton = AddBitmapButton( ID_UP_DIR, wxART_GO_DIR_UP, _("Go to parent directory"), buttonsizer ); -#ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS... AddBitmapButton( ID_HOME_DIR, wxART_GO_HOME, _("Go to home directory"), buttonsizer ); buttonsizer->Add( 20, 20 ); -#endif //!__DOS__ m_newDirButton = AddBitmapButton( ID_NEW_DIR, wxART_NEW_DIR, _("Create new directory"), buttonsizer ); @@ -339,14 +323,40 @@ bool wxGenericFileDialog::Show( bool show ) void wxGenericFileDialog::OnOk( wxCommandEvent &WXUNUSED(event) ) { wxArrayString selectedFiles; - m_filectrl->GetFilenames(selectedFiles); + m_filectrl->GetPaths(selectedFiles); if (selectedFiles.Count() == 0) return; + const wxString& path = selectedFiles[0]; + if (selectedFiles.Count() == 1) { - SetPath( selectedFiles[0] ); + SetPath(path); + } + + // check that the file [doesn't] exist if necessary + if ( HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OVERWRITE_PROMPT) && + wxFileExists(path) ) + { + if ( wxMessageBox + ( + wxString::Format + ( + _("File '%s' already exists, do you really want to overwrite it?"), + path + ), + _("Confirm"), + wxYES_NO + ) != wxYES) + return; + } + else if ( HasFdFlag(wxFD_OPEN) && HasFdFlag(wxFD_FILE_MUST_EXIST) && + !wxFileExists(path) ) + { + wxMessageBox(_("Please choose an existing file."), _("Error"), + wxOK | wxICON_ERROR ); + return; } EndModal(wxID_OK); @@ -399,7 +409,7 @@ void wxGenericFileDialog::OnUpdateButtonsUI(wxUpdateUIEvent& event) #ifdef wxHAS_GENERIC_FILEDIALOG -IMPLEMENT_DYNAMIC_CLASS(wxFileDialog, wxGenericFileDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFileDialog, wxGenericFileDialog); #endif // wxHAS_GENERIC_FILEDIALOG diff --git a/Externals/wxWidgets3/src/generic/filepickerg.cpp b/Externals/wxWidgets3/src/generic/filepickerg.cpp index 225da729d2..20f6f77e82 100644 --- a/Externals/wxWidgets3/src/generic/filepickerg.cpp +++ b/Externals/wxWidgets3/src/generic/filepickerg.cpp @@ -35,8 +35,8 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxGenericFileButton, wxButton) -IMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton, wxButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericFileButton, wxButton); +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton, wxButton); // ---------------------------------------------------------------------------- // wxGenericFileButton diff --git a/Externals/wxWidgets3/src/generic/fontdlgg.cpp b/Externals/wxWidgets3/src/generic/fontdlgg.cpp index 58a7835c96..4908035680 100644 --- a/Externals/wxWidgets3/src/generic/fontdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/fontdlgg.cpp @@ -57,12 +57,12 @@ public: private: void OnPaint(wxPaintEvent& event); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxFontPreviewer, wxWindow) +wxBEGIN_EVENT_TABLE(wxFontPreviewer, wxWindow) EVT_PAINT(wxFontPreviewer::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxFontPreviewer::OnPaint(wxPaintEvent& WXUNUSED(event)) { @@ -94,11 +94,11 @@ static const wxChar *wxFontWeightIntToString(int weight) { switch (weight) { - case wxLIGHT: + case wxFONTWEIGHT_LIGHT: return wxT("Light"); - case wxBOLD: + case wxFONTWEIGHT_BOLD: return wxT("Bold"); - case wxNORMAL: + case wxFONTWEIGHT_NORMAL: default: return wxT("Normal"); } @@ -108,11 +108,11 @@ static const wxChar *wxFontStyleIntToString(int style) { switch (style) { - case wxITALIC: + case wxFONTSTYLE_ITALIC: return wxT("Italic"); - case wxSLANT: + case wxFONTSTYLE_SLANT: return wxT("Slant"); - case wxNORMAL: + case wxFONTSTYLE_NORMAL: default: return wxT("Normal"); } @@ -122,71 +122,71 @@ static const wxChar *wxFontFamilyIntToString(int family) { switch (family) { - case wxROMAN: + case wxFONTFAMILY_ROMAN: return wxT("Roman"); - case wxDECORATIVE: + case wxFONTFAMILY_DECORATIVE: return wxT("Decorative"); - case wxMODERN: + case wxFONTFAMILY_MODERN: return wxT("Modern"); - case wxSCRIPT: + case wxFONTFAMILY_SCRIPT: return wxT("Script"); - case wxTELETYPE: + case wxFONTFAMILY_TELETYPE: return wxT("Teletype"); - case wxSWISS: + case wxFONTFAMILY_SWISS: default: return wxT("Swiss"); } } -static int wxFontFamilyStringToInt(const wxString& family) +static wxFontFamily wxFontFamilyStringToInt(const wxString& family) { if (family.empty()) - return wxSWISS; + return wxFONTFAMILY_SWISS; if (wxStrcmp(family, wxT("Roman")) == 0) - return wxROMAN; + return wxFONTFAMILY_ROMAN; else if (wxStrcmp(family, wxT("Decorative")) == 0) - return wxDECORATIVE; + return wxFONTFAMILY_DECORATIVE; else if (wxStrcmp(family, wxT("Modern")) == 0) - return wxMODERN; + return wxFONTFAMILY_MODERN; else if (wxStrcmp(family, wxT("Script")) == 0) - return wxSCRIPT; + return wxFONTFAMILY_SCRIPT; else if (wxStrcmp(family, wxT("Teletype")) == 0) - return wxTELETYPE; - else return wxSWISS; + return wxFONTFAMILY_TELETYPE; + else return wxFONTFAMILY_SWISS; } -static int wxFontStyleStringToInt(const wxString& style) +static wxFontStyle wxFontStyleStringToInt(const wxString& style) { if (style.empty()) - return wxNORMAL; + return wxFONTSTYLE_NORMAL; if (wxStrcmp(style, wxT("Italic")) == 0) - return wxITALIC; + return wxFONTSTYLE_ITALIC; else if (wxStrcmp(style, wxT("Slant")) == 0) - return wxSLANT; + return wxFONTSTYLE_SLANT; else - return wxNORMAL; + return wxFONTSTYLE_NORMAL; } -static int wxFontWeightStringToInt(const wxString& weight) +static wxFontWeight wxFontWeightStringToInt(const wxString& weight) { if (weight.empty()) - return wxNORMAL; + return wxFONTWEIGHT_NORMAL; if (wxStrcmp(weight, wxT("Bold")) == 0) - return wxBOLD; + return wxFONTWEIGHT_BOLD; else if (wxStrcmp(weight, wxT("Light")) == 0) - return wxLIGHT; + return wxFONTWEIGHT_LIGHT; else - return wxNORMAL; + return wxFONTWEIGHT_NORMAL; } //----------------------------------------------------------------------------- // wxGenericFontDialog //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog); -BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) @@ -199,7 +199,7 @@ BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) #endif EVT_CLOSE(wxGenericFontDialog::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #define NUM_COLS 48 @@ -543,9 +543,9 @@ void wxGenericFontDialog::CreateWidgets() void wxGenericFontDialog::InitializeFont() { - int fontFamily = wxSWISS; - int fontWeight = wxNORMAL; - int fontStyle = wxNORMAL; + wxFontFamily fontFamily = wxFONTFAMILY_SWISS; + wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL; + wxFontStyle fontStyle = wxFONTSTYLE_NORMAL; int fontSize = 12; bool fontUnderline = false; @@ -574,9 +574,9 @@ void wxGenericFontDialog::DoChangeFont() { if (!m_useEvents) return; - int fontFamily = wxFontFamilyStringToInt(m_familyChoice->GetStringSelection()); - int fontWeight = wxFontWeightStringToInt(m_weightChoice->GetStringSelection()); - int fontStyle = wxFontStyleStringToInt(m_styleChoice->GetStringSelection()); + wxFontFamily fontFamily = wxFontFamilyStringToInt(m_familyChoice->GetStringSelection()); + wxFontWeight fontWeight = wxFontWeightStringToInt(m_weightChoice->GetStringSelection()); + wxFontStyle fontStyle = wxFontStyleStringToInt(m_styleChoice->GetStringSelection()); #if USE_SPINCTRL_FOR_POINT_SIZE wxSpinCtrl* fontSizeCtrl = wxDynamicCast(FindWindow(wxID_FONT_SIZE), wxSpinCtrl); int fontSize = fontSizeCtrl->GetValue(); diff --git a/Externals/wxWidgets3/src/generic/fontpickerg.cpp b/Externals/wxWidgets3/src/generic/fontpickerg.cpp index 62599b7892..6c74756fd8 100644 --- a/Externals/wxWidgets3/src/generic/fontpickerg.cpp +++ b/Externals/wxWidgets3/src/generic/fontpickerg.cpp @@ -34,7 +34,7 @@ // implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton); // ---------------------------------------------------------------------------- // wxGenericFontButton @@ -62,9 +62,10 @@ bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id, wxCommandEventHandler(wxGenericFontButton::OnButtonClick), NULL, this); + InitFontData(); + m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT; UpdateFont(); - InitFontData(); return true; } diff --git a/Externals/wxWidgets3/src/generic/graphicc.cpp b/Externals/wxWidgets3/src/generic/graphicc.cpp index c89d338f51..891d734887 100644 --- a/Externals/wxWidgets3/src/generic/graphicc.cpp +++ b/Externals/wxWidgets3/src/generic/graphicc.cpp @@ -59,6 +59,8 @@ using namespace std; // wxGraphicsPath implementation //----------------------------------------------------------------------------- +#include +#ifdef __WXMSW__ // TODO remove this dependency (gdiplus needs the macros) #ifndef max @@ -69,8 +71,6 @@ using namespace std; #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif -#include -#ifdef __WXMSW__ #include // Notice that the order is important: cairo-win32.h includes windows.h which // pollutes the global name space with macros so include our own header which @@ -86,6 +86,11 @@ using namespace std; #endif #endif +#ifdef __WXQT__ +#include +#include "wx/qt/dc.h" +#endif + #ifdef __WXMAC__ #include "wx/osx/private.h" #include @@ -98,33 +103,33 @@ public : wxCairoPathData(wxGraphicsRenderer* renderer, cairo_t* path = NULL); ~wxCairoPathData(); - virtual wxGraphicsObjectRefData *Clone() const; + virtual wxGraphicsObjectRefData *Clone() const wxOVERRIDE; // // These are the path primitives from which everything else can be constructed // // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ); + virtual void MoveToPoint( wxDouble x, wxDouble y ) wxOVERRIDE; // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ); + virtual void AddLineToPoint( wxDouble x, wxDouble y ) wxOVERRIDE; // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ); + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) wxOVERRIDE; // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) ; + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) wxOVERRIDE ; // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const wxOVERRIDE; // adds another path - virtual void AddPath( const wxGraphicsPathData* path ); + virtual void AddPath( const wxGraphicsPathData* path ) wxOVERRIDE; // closes the current sub-path - virtual void CloseSubpath(); + virtual void CloseSubpath() wxOVERRIDE; // // These are convenience functions which - if not available natively will be assembled @@ -143,18 +148,18 @@ public : */ // returns the native path - virtual void * GetNativePath() const ; + virtual void * GetNativePath() const wxOVERRIDE ; // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *p) const; + virtual void UnGetNativePath(void *p) const wxOVERRIDE; // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ) ; + virtual void Transform( const wxGraphicsMatrixData* matrix ) wxOVERRIDE ; // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const; + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const wxOVERRIDE; - virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxWINDING_RULE) const; + virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxWINDING_RULE) const wxOVERRIDE; private : cairo_t* m_pathContext; @@ -166,53 +171,53 @@ public : wxCairoMatrixData(wxGraphicsRenderer* renderer, const cairo_matrix_t* matrix = NULL ) ; virtual ~wxCairoMatrixData() ; - virtual wxGraphicsObjectRefData *Clone() const ; + virtual wxGraphicsObjectRefData *Clone() const wxOVERRIDE ; // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ); + virtual void Concat( const wxGraphicsMatrixData *t ) wxOVERRIDE; // sets the matrix to the respective values virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); + wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE; // gets the component valuess of the matrix virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const wxOVERRIDE; // makes this the inverse matrix - virtual void Invert(); + virtual void Invert() wxOVERRIDE; // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const ; + virtual bool IsEqual( const wxGraphicsMatrixData* t) const wxOVERRIDE ; // return true if this is the identity matrix - virtual bool IsIdentity() const; + virtual bool IsIdentity() const wxOVERRIDE; // // transformation // // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ); + virtual void Translate( wxDouble dx , wxDouble dy ) wxOVERRIDE; // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ); + virtual void Scale( wxDouble xScale , wxDouble yScale ) wxOVERRIDE; // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ); + virtual void Rotate( wxDouble angle ) wxOVERRIDE; // // apply the transforms // // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const wxOVERRIDE; // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const wxOVERRIDE; // returns the native representation - virtual void * GetNativeMatrix() const; + virtual void * GetNativeMatrix() const wxOVERRIDE; private: cairo_matrix_t m_matrix ; } ; @@ -262,7 +267,7 @@ public: void Init(); - virtual void Apply( wxGraphicsContext* context ); + virtual void Apply( wxGraphicsContext* context ) wxOVERRIDE; virtual wxDouble GetWidth() { return m_width; } private : @@ -357,7 +362,7 @@ public: virtual cairo_surface_t* GetCairoSurface() { return m_surface; } virtual cairo_pattern_t* GetCairoPattern() { return m_pattern; } - virtual void* GetNativeBitmap() const { return m_surface; } + virtual void* GetNativeBitmap() const wxOVERRIDE { return m_surface; } virtual wxSize GetSize() { return wxSize(m_width, m_height); } #if wxUSE_IMAGE @@ -387,7 +392,9 @@ class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext public: wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ); wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ); +#if wxUSE_PRINTING_ARCHITECTURE wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ); +#endif #ifdef __WXGTK__ wxCairoContext( wxGraphicsRenderer* renderer, GdkWindow *window ); #endif @@ -402,7 +409,7 @@ public: virtual ~wxCairoContext(); - virtual bool ShouldOffset() const + virtual bool ShouldOffset() const wxOVERRIDE { if ( !m_enableOffset ) return false; @@ -417,61 +424,67 @@ public: return ( penwidth % 2 ) == 1; } - virtual void Clip( const wxRegion ®ion ); + virtual void Clip( const wxRegion ®ion ) wxOVERRIDE; #ifdef __WXMSW__ cairo_surface_t* m_mswSurface; WindowHDC m_mswWindowHDC; #endif // clips drawings to the rect - virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; // resets the clipping to original extent - virtual void ResetClip(); + virtual void ResetClip() wxOVERRIDE; - virtual void * GetNativeContext(); + virtual void * GetNativeContext() wxOVERRIDE; - virtual bool SetAntialiasMode(wxAntialiasMode antialias); + virtual bool SetAntialiasMode(wxAntialiasMode antialias) wxOVERRIDE; - virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation); + virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) wxOVERRIDE; - virtual bool SetCompositionMode(wxCompositionMode op); + virtual bool SetCompositionMode(wxCompositionMode op) wxOVERRIDE; - virtual void BeginLayer(wxDouble opacity); + virtual void BeginLayer(wxDouble opacity) wxOVERRIDE; - virtual void EndLayer(); + virtual void EndLayer() wxOVERRIDE; - virtual void StrokePath( const wxGraphicsPath& p ); - virtual void FillPath( const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxWINDING_RULE ); + virtual void StrokePath( const wxGraphicsPath& p ) wxOVERRIDE; + virtual void FillPath( const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxWINDING_RULE ) wxOVERRIDE; - virtual void Translate( wxDouble dx , wxDouble dy ); - virtual void Scale( wxDouble xScale , wxDouble yScale ); - virtual void Rotate( wxDouble angle ); + virtual void Translate( wxDouble dx , wxDouble dy ) wxOVERRIDE; + virtual void Scale( wxDouble xScale , wxDouble yScale ) wxOVERRIDE; + virtual void Rotate( wxDouble angle ) wxOVERRIDE; // concatenates this transform with the current transform of this context - virtual void ConcatTransform( const wxGraphicsMatrix& matrix ); + virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) wxOVERRIDE; // sets the transform of this context - virtual void SetTransform( const wxGraphicsMatrix& matrix ); + virtual void SetTransform( const wxGraphicsMatrix& matrix ) wxOVERRIDE; // gets the matrix of this context - virtual wxGraphicsMatrix GetTransform() const; + virtual wxGraphicsMatrix GetTransform() const wxOVERRIDE; - virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); - virtual void PushState(); - virtual void PopState(); + virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; + virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; + virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; + virtual void PushState() wxOVERRIDE; + virtual void PopState() wxOVERRIDE; virtual void GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const; - virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const; + wxDouble *descent, wxDouble *externalLeading ) const wxOVERRIDE; + virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const wxOVERRIDE; protected: - virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ); + virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ) wxOVERRIDE; void Init(cairo_t *context); +#ifdef __WXQT__ + QPainter* m_qtPainter; + QImage* m_qtImage; + cairo_surface_t* m_qtSurface; +#endif + private: cairo_t* m_context; @@ -497,6 +510,11 @@ public: } virtual ~wxCairoImageContext() + { + Flush(); + } + + virtual void Flush() wxOVERRIDE { m_image = m_data.ConvertToImage(); } @@ -1310,14 +1328,22 @@ void wxCairoBitmapData::InitSurface(cairo_format_t format, int stride) } wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, cairo_surface_t* bitmap ) : - wxGraphicsBitmapData( renderer ) + wxGraphicsBitmapData(renderer) { m_surface = bitmap; m_pattern = cairo_pattern_create_for_surface(m_surface); + + m_width = cairo_image_surface_get_width(m_surface); + m_height = cairo_image_surface_get_height(m_surface); + m_buffer = NULL; } -wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) : wxGraphicsBitmapData( renderer ) +wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitmap& bmp ) + : wxGraphicsBitmapData(renderer) { + m_surface = NULL; + m_pattern = NULL; + m_buffer = NULL; wxCHECK_RET( bmp.IsOk(), wxT("Invalid bitmap in wxCairoContext::DrawBitmap")); #ifdef wxHAS_RAW_BITMAP @@ -1543,6 +1569,7 @@ wxImage wxCairoBitmapData::ConvertToImage() const } // Prepare for copying data. + cairo_surface_flush(m_surface); const wxUint32* src = (wxUint32*)cairo_image_surface_get_data(m_surface); wxCHECK_MSG( src, wxNullImage, wxS("Failed to get Cairo surface data.") ); @@ -1569,12 +1596,13 @@ wxImage wxCairoBitmapData::ConvertToImage() const { const wxUint32 argb = *src++; - *alpha++ = (argb & 0xff000000) >> 24; + const unsigned char a = argb >> 24; + *alpha++ = a; // 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)); + *dst++ = Unpremultiply(a, argb >> 16); + *dst++ = Unpremultiply(a, argb >> 8); + *dst++ = Unpremultiply(a, argb); } src = rowStart + stride; @@ -1639,6 +1667,7 @@ public : bool m_offset; } ; +#if wxUSE_PRINTING_ARCHITECTURE wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& dc ) : wxGraphicsContext(renderer) { @@ -1657,6 +1686,8 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& cairo_t* cr = static_cast(impl->GetCairoContext()); if (cr) Init(cairo_reference(cr)); + else + m_context = NULL; #endif wxSize sz = dc.GetSize(); m_width = sz.x; @@ -1683,6 +1714,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxPrinterDC& org = dc.GetLogicalOrigin(); cairo_translate( m_context, -org.x, -org.y ); } +#endif wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc ) : wxGraphicsContext(renderer) @@ -1692,7 +1724,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& m_width = width; m_height = height; - m_enableOffset = true; + m_enableOffset = dc.GetContentScaleFactor() <= 1; #ifdef __WXMSW__ m_mswSurface = cairo_win32_surface_create((HDC)dc.GetHDC()); @@ -1724,12 +1756,29 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& #endif #endif -#ifdef __WXMAC__ +#ifdef __WXX11__ + cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); + if ( cr ) + Init(cairo_reference(cr)); +#elif defined(__WXMAC__) CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); Init( cairo_create( surface ) ); cairo_surface_destroy( surface ); #endif + +#ifdef __WXQT__ + m_qtPainter = (QPainter*) dc.GetHandle(); + // create a internal buffer (fallback if cairo_qt_surface is missing) + m_qtImage = new QImage(width, height, QImage::Format_ARGB32_Premultiplied); + // clear the buffer to be painted over the current contents + m_qtImage->fill(Qt::transparent); + m_qtSurface = cairo_image_surface_create_for_data(m_qtImage->bits(), + CAIRO_FORMAT_ARGB32, + width, height, + m_qtImage->bytesPerLine()); + Init( cairo_create( m_qtSurface ) ); +#endif } wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc ) @@ -1740,7 +1789,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& m_width = width; m_height = height; - m_enableOffset = true; + m_enableOffset = dc.GetContentScaleFactor() <= 1; #ifdef __WXMSW__ @@ -1799,12 +1848,31 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& #endif #endif +#ifdef __WXX11__ + cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); + if ( cr ) + Init(cairo_reference(cr)); +#endif + #ifdef __WXMAC__ CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef(); cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height); Init( cairo_create( surface ) ); cairo_surface_destroy( surface ); #endif + +#ifdef __WXQT__ + m_qtPainter = NULL; + // create a internal buffer (fallback if cairo_qt_surface is missing) + m_qtImage = new QImage(width, height, QImage::Format_ARGB32_Premultiplied); + // clear the buffer to be painted over the current contents + m_qtImage->fill(Qt::transparent); + m_qtSurface = cairo_image_surface_create_for_data(m_qtImage->bits(), + CAIRO_FORMAT_ARGB32, + width, height, + m_qtImage->bytesPerLine()); + Init( cairo_create( m_qtSurface ) ); +#endif } #ifdef __WXGTK20__ @@ -1851,7 +1919,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) , m_mswWindowHDC(GetHwndOf(window)) #endif { - m_enableOffset = true; + m_enableOffset = window->GetContentScaleFactor() <= 1; #ifdef __WXGTK__ // something along these lines (copied from dcclient) @@ -1877,6 +1945,9 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, wxWindow *window) Init(cairo_create(m_mswSurface)); #endif +#ifdef __WXQT__ + // direct m_qtSurface is not being used yet (this needs cairo qt surface) +#endif } wxCairoContext::wxCairoContext(wxGraphicsRenderer* renderer) : @@ -1897,6 +1968,17 @@ wxCairoContext::~wxCairoContext() if ( m_mswSurface ) cairo_surface_destroy(m_mswSurface); #endif +#ifdef __WXQT__ + if ( m_qtPainter != NULL ) + { + // draw the internal buffered image to the widget + cairo_surface_flush(m_qtSurface); + m_qtPainter->drawImage( 0,0, *m_qtImage ); + delete m_qtImage; + cairo_surface_destroy( m_qtSurface ); + } +#endif + } void wxCairoContext::Init(cairo_t *context) @@ -2333,20 +2415,22 @@ public : // Context - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc); - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); - virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) wxOVERRIDE; + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) wxOVERRIDE; +#if wxUSE_PRINTING_ARCHITECTURE + virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) wxOVERRIDE; +#endif - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); + virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) wxOVERRIDE; - virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); + virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) wxOVERRIDE; #if wxUSE_IMAGE - virtual wxGraphicsContext * CreateContextFromImage(wxImage& image); + virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) wxOVERRIDE; #endif // wxUSE_IMAGE - virtual wxGraphicsContext * CreateContext( wxWindow* window ); + virtual wxGraphicsContext * CreateContext( wxWindow* window ) wxOVERRIDE; - virtual wxGraphicsContext * CreateMeasuringContext(); + virtual wxGraphicsContext * CreateMeasuringContext() wxOVERRIDE; #ifdef __WXMSW__ #if wxUSE_ENH_METAFILE virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); @@ -2354,57 +2438,60 @@ public : #endif // Path - virtual wxGraphicsPath CreatePath(); + virtual wxGraphicsPath CreatePath() wxOVERRIDE; // Matrix virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); + wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE; - virtual wxGraphicsPen CreatePen(const wxPen& pen) ; + virtual wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE ; - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ; + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) wxOVERRIDE ; virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops); + const wxGraphicsGradientStops& stops) wxOVERRIDE; virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxGraphicsGradientStops& stops); + const wxGraphicsGradientStops& stops) wxOVERRIDE; // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ; + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) wxOVERRIDE ; virtual wxGraphicsFont CreateFont(double sizeInPixels, const wxString& facename, int flags = wxFONTFLAG_DEFAULT, - const wxColour& col = *wxBLACK); + const wxColour& col = *wxBLACK) wxOVERRIDE; // create a native bitmap representation - virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ); + virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) wxOVERRIDE; #if wxUSE_IMAGE - virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image); - virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp); + virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) wxOVERRIDE; + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) wxOVERRIDE; #endif // wxUSE_IMAGE // create a graphics bitmap from a native bitmap - virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ); + virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) wxOVERRIDE; // create a subimage from a native image representation - virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer) + virtual wxString GetName() const wxOVERRIDE; + virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE; + + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxCairoRenderer); } ; //----------------------------------------------------------------------------- // wxCairoRenderer implementation //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer) +wxIMPLEMENT_DYNAMIC_CLASS(wxCairoRenderer,wxGraphicsRenderer); static wxCairoRenderer gs_cairoGraphicsRenderer; @@ -2428,11 +2515,13 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) return new wxCairoContext(this,dc); } +#if wxUSE_PRINTING_ARCHITECTURE wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); return new wxCairoContext(this, dc); } +#endif #ifdef __WXMSW__ #if wxUSE_ENH_METAFILE @@ -2650,6 +2739,20 @@ wxCairoRenderer::CreateSubBitmap(const wxGraphicsBitmap& WXUNUSED(bitmap), return p; } +wxString wxCairoRenderer::GetName() const +{ + return "cairo"; +} + +void wxCairoRenderer::GetVersion(int *major, int *minor, int *micro) const +{ + int dummy; + sscanf(cairo_version_string(), "%d.%d.%d", + major ? major : &dummy, + minor ? minor : &dummy, + micro ? micro : &dummy); +} + wxGraphicsRenderer* wxGraphicsRenderer::GetCairoRenderer() { return &gs_cairoGraphicsRenderer; diff --git a/Externals/wxWidgets3/src/generic/grid.cpp b/Externals/wxWidgets3/src/generic/grid.cpp index 31f9297c63..921780caf3 100644 --- a/Externals/wxWidgets3/src/generic/grid.cpp +++ b/Externals/wxWidgets3/src/generic/grid.cpp @@ -56,18 +56,6 @@ const char wxGridNameStr[] = "grid"; -#if defined(__WXMOTIF__) - #define WXUNUSED_MOTIF(identifier) WXUNUSED(identifier) -#else - #define WXUNUSED_MOTIF(identifier) identifier -#endif - -#if defined(__WXGTK__) - #define WXUNUSED_GTK(identifier) WXUNUSED(identifier) -#else - #define WXUNUSED_GTK(identifier) identifier -#endif - // Required for wxIs... functions #include @@ -178,15 +166,15 @@ namespace // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxGridCellEditorEvtHandler, wxEvtHandler) +wxIMPLEMENT_ABSTRACT_CLASS(wxGridCellEditorEvtHandler, wxEvtHandler); -BEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler ) +wxBEGIN_EVENT_TABLE( wxGridCellEditorEvtHandler, wxEvtHandler ) EVT_KILL_FOCUS( wxGridCellEditorEvtHandler::OnKillFocus ) EVT_KEY_DOWN( wxGridCellEditorEvtHandler::OnKeyDown ) EVT_CHAR( wxGridCellEditorEvtHandler::OnChar ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxGridHeaderCtrl, wxHeaderCtrl) +wxBEGIN_EVENT_TABLE(wxGridHeaderCtrl, wxHeaderCtrl) EVT_HEADER_CLICK(wxID_ANY, wxGridHeaderCtrl::OnClick) EVT_HEADER_DCLICK(wxID_ANY, wxGridHeaderCtrl::OnDoubleClick) EVT_HEADER_RIGHT_CLICK(wxID_ANY, wxGridHeaderCtrl::OnRightClick) @@ -197,7 +185,7 @@ BEGIN_EVENT_TABLE(wxGridHeaderCtrl, wxHeaderCtrl) EVT_HEADER_BEGIN_REORDER(wxID_ANY, wxGridHeaderCtrl::OnBeginReorder) EVT_HEADER_END_REORDER(wxID_ANY, wxGridHeaderCtrl::OnEndReorder) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGridOperations& wxGridRowOperations::Dual() const { @@ -666,7 +654,7 @@ void wxGridCellAttrData::UpdateAttrRows( size_t pos, int numRows ) { if (numRows > 0) { - // If rows inserted, include row counter where necessary + // If rows inserted, increment row counter where necessary coords.SetRow(row + numRows); } else if (numRows < 0) @@ -700,15 +688,15 @@ void wxGridCellAttrData::UpdateAttrCols( size_t pos, int numCols ) { if ( numCols > 0 ) { - // If rows inserted, include row counter where necessary + // If cols inserted, increment col counter where necessary coords.SetCol(col + numCols); } else if (numCols < 0) { - // If rows deleted ... + // If cols deleted ... if ((size_t)col >= pos - numCols) { - // ...either decrement row counter (if row still exists)... + // ...either decrement col counter (if col still exists)... coords.SetCol(col + numCols); } else @@ -812,12 +800,12 @@ void wxGridRowOrColAttrData::UpdateAttrRowsOrCols( size_t pos, int numRowsOrCols { if ( numRowsOrCols > 0 ) { - // If rows inserted, include row counter where necessary + // If rows or cols inserted, increment row/col counter where necessary rowOrCol += numRowsOrCols; } else if ( numRowsOrCols < 0) { - // If rows deleted, either decrement row counter (if row still exists) + // If rows/cols deleted, either decrement row/col counter (if row/col still exists) if ((size_t)rowOrCol >= pos - numRowsOrCols) rowOrCol += numRowsOrCols; else @@ -1009,7 +997,7 @@ const wxGridCornerHeaderRenderer& wxGridCellAttrProvider::GetCornerRenderer() // wxGridTableBase // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS( wxGridTableBase, wxObject ) +wxIMPLEMENT_ABSTRACT_CLASS(wxGridTableBase, wxObject); wxGridTableBase::wxGridTableBase() { @@ -1067,7 +1055,8 @@ void wxGridTableBase::SetRowAttr(wxGridCellAttr *attr, int row) { if ( m_attrProvider ) { - attr->SetKind(wxGridCellAttr::Row); + if ( attr ) + attr->SetKind(wxGridCellAttr::Row); m_attrProvider->SetRowAttr(attr, row); } else @@ -1082,7 +1071,8 @@ void wxGridTableBase::SetColAttr(wxGridCellAttr *attr, int col) { if ( m_attrProvider ) { - attr->SetKind(wxGridCellAttr::Col); + if ( attr ) + attr->SetKind(wxGridCellAttr::Col); m_attrProvider->SetColAttr(attr, col); } else @@ -1266,7 +1256,7 @@ wxGridTableMessage::wxGridTableMessage( wxGridTableBase *table, int id, WX_DEFINE_OBJARRAY(wxGridStringArray) -IMPLEMENT_DYNAMIC_CLASS( wxGridStringTable, wxGridTableBase ) +wxIMPLEMENT_DYNAMIC_CLASS(wxGridStringTable, wxGridTableBase); wxGridStringTable::wxGridStringTable() : wxGridTableBase() @@ -1329,18 +1319,14 @@ void wxGridStringTable::Clear() bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) { - size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : - ( GetView() ? GetView()->GetNumberCols() : 0 ) ); - - if ( pos >= curNumRows ) + if ( pos >= m_data.size() ) { return AppendRows( numRows ); } wxArrayString sa; - sa.Alloc( curNumCols ); - sa.Add( wxEmptyString, curNumCols ); + sa.Alloc( m_numCols ); + sa.Add( wxEmptyString, m_numCols ); m_data.Insert( sa, pos, numRows ); if ( GetView() ) @@ -1358,16 +1344,11 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) bool wxGridStringTable::AppendRows( size_t numRows ) { - size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 - ? m_data[0].GetCount() - : ( GetView() ? GetView()->GetNumberCols() : 0 ) ); - wxArrayString sa; - if ( curNumCols > 0 ) + if ( m_numCols > 0 ) { - sa.Alloc( curNumCols ); - sa.Add( wxEmptyString, curNumCols ); + sa.Alloc( m_numCols ); + sa.Add( wxEmptyString, m_numCols ); } m_data.Add( sa, numRows ); @@ -1430,14 +1411,7 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) { - size_t row, col; - - size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 - ? m_data[0].GetCount() - : ( GetView() ? GetView()->GetNumberCols() : 0 ) ); - - if ( pos >= curNumCols ) + if ( pos >= static_cast(m_numCols) ) { return AppendCols( numCols ); } @@ -1446,14 +1420,13 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) { m_colLabels.Insert( wxEmptyString, pos, numCols ); - size_t i; - for ( i = pos; i < pos + numCols; i++ ) + for ( size_t i = pos; i < pos + numCols; i++ ) m_colLabels[i] = wxGridTableBase::GetColLabelValue( i ); } - for ( row = 0; row < curNumRows; row++ ) + for ( size_t row = 0; row < m_data.size(); row++ ) { - for ( col = pos; col < pos + numCols; col++ ) + for ( size_t col = pos; col < pos + numCols; col++ ) { m_data[row].Insert( wxEmptyString, col ); } @@ -1476,11 +1449,7 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) bool wxGridStringTable::AppendCols( size_t numCols ) { - size_t row; - - size_t curNumRows = m_data.GetCount(); - - for ( row = 0; row < curNumRows; row++ ) + for ( size_t row = 0; row < m_data.size(); row++ ) { m_data[row].Add( wxEmptyString, numCols ); } @@ -1504,8 +1473,7 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) size_t row; size_t curNumRows = m_data.GetCount(); - size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : - ( GetView() ? GetView()->GetNumberCols() : 0 ) ); + size_t curNumCols = m_numCols; if ( pos >= curNumCols ) { @@ -1636,20 +1604,20 @@ void wxGridStringTable::SetColLabelValue( int col, const wxString& value ) ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE(wxGridSubwindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxGridSubwindow, wxWindow) EVT_MOUSE_CAPTURE_LOST(wxGridSubwindow::OnMouseCaptureLost) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGridSubwindow::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event)) { m_owner->CancelMouseCapture(); } -BEGIN_EVENT_TABLE( wxGridRowLabelWindow, wxGridSubwindow ) +wxBEGIN_EVENT_TABLE( wxGridRowLabelWindow, wxGridSubwindow ) EVT_PAINT( wxGridRowLabelWindow::OnPaint ) EVT_MOUSEWHEEL( wxGridRowLabelWindow::OnMouseWheel ) EVT_MOUSE_EVENTS( wxGridRowLabelWindow::OnMouseEvent ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGridRowLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) { @@ -1683,11 +1651,11 @@ void wxGridRowLabelWindow::OnMouseWheel( wxMouseEvent& event ) ////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( wxGridColLabelWindow, wxGridSubwindow ) +wxBEGIN_EVENT_TABLE( wxGridColLabelWindow, wxGridSubwindow ) EVT_PAINT( wxGridColLabelWindow::OnPaint ) EVT_MOUSEWHEEL( wxGridColLabelWindow::OnMouseWheel ) EVT_MOUSE_EVENTS( wxGridColLabelWindow::OnMouseEvent ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGridColLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) { @@ -1702,10 +1670,7 @@ void wxGridColLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) int x, y; m_owner->CalcUnscrolledPosition( 0, 0, &x, &y ); wxPoint pt = dc.GetDeviceOrigin(); - if (GetLayoutDirection() == wxLayout_RightToLeft) - dc.SetDeviceOrigin( pt.x+x, pt.y ); - else - dc.SetDeviceOrigin( pt.x-x, pt.y ); + dc.SetDeviceOrigin( pt.x-x, pt.y ); wxArrayInt cols = m_owner->CalcColLabelsExposed( GetUpdateRegion() ); m_owner->DrawColLabels( dc, cols ); @@ -1724,11 +1689,11 @@ void wxGridColLabelWindow::OnMouseWheel( wxMouseEvent& event ) ////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxGridSubwindow ) +wxBEGIN_EVENT_TABLE( wxGridCornerLabelWindow, wxGridSubwindow ) EVT_MOUSEWHEEL( wxGridCornerLabelWindow::OnMouseWheel ) EVT_MOUSE_EVENTS( wxGridCornerLabelWindow::OnMouseEvent ) EVT_PAINT( wxGridCornerLabelWindow::OnPaint ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGridCornerLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) { @@ -1750,7 +1715,7 @@ void wxGridCornerLabelWindow::OnMouseWheel( wxMouseEvent& event ) ////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( wxGridWindow, wxGridSubwindow ) +wxBEGIN_EVENT_TABLE( wxGridWindow, wxGridSubwindow ) EVT_PAINT( wxGridWindow::OnPaint ) EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel ) EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent ) @@ -1760,7 +1725,7 @@ BEGIN_EVENT_TABLE( wxGridWindow, wxGridSubwindow ) EVT_SET_FOCUS( wxGridWindow::OnFocus ) EVT_KILL_FOCUS( wxGridWindow::OnFocus ) EVT_ERASE_BACKGROUND( wxGridWindow::OnEraseBackground ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { @@ -2139,7 +2104,8 @@ void wxGridWindow::OnFocus(wxFocusEvent& event) m_owner->GetGridCursorCol()); const wxRect cursor = m_owner->BlockToDeviceRect(cursorCoords, cursorCoords); - Refresh(true, &cursor); + if (cursor != wxGridNoCellRect) + Refresh(true, &cursor); } if ( !m_owner->GetEventHandler()->ProcessEvent( event ) ) @@ -2151,7 +2117,7 @@ void wxGridWindow::OnFocus(wxFocusEvent& event) ///////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow ) +wxBEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow ) EVT_PAINT( wxGrid::OnPaint ) EVT_SIZE( wxGrid::OnSize ) EVT_KEY_DOWN( wxGrid::OnKeyDown ) @@ -2159,7 +2125,7 @@ BEGIN_EVENT_TABLE( wxGrid, wxScrolledWindow ) EVT_CHAR ( wxGrid::OnChar ) EVT_ERASE_BACKGROUND( wxGrid::OnEraseBackground ) EVT_COMMAND(wxID_ANY, wxEVT_GRID_HIDE_EDITOR, wxGrid::OnHideEditor ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -2295,7 +2261,7 @@ void wxGrid::Create() // now that we have the grid window, use its font to compute the default // row height m_defaultRowHeight = m_gridWin->GetCharHeight(); -#if defined(__WXMOTIF__) || defined(__WXGTK__) // see also text ctrl sizing in ShowCellEditControl() +#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXQT__) // see also text ctrl sizing in ShowCellEditControl() m_defaultRowHeight += 8; #else m_defaultRowHeight += 4; @@ -2381,12 +2347,15 @@ wxGrid::SetTable(wxGridTableBase *table, m_numRows = table->GetNumberRows(); m_numCols = table->GetNumberCols(); - if ( m_useNativeHeader ) - GetGridColHeader()->SetColumnCount(m_numCols); - m_table = table; m_table->SetView( this ); m_ownTable = takeOwnership; + + // Notice that this must be called after setting m_table as it uses it + // indirectly, via wxGrid::GetColLabelValue(). + if ( m_useNativeHeader ) + GetGridColHeader()->SetColumnCount(m_numCols); + m_selection = new wxGridSelection( this, selmode ); if (checkSelection) { @@ -2449,7 +2418,7 @@ void wxGrid::Init() m_attrCache.attr = NULL; m_labelFont = GetFont(); - m_labelFont.SetWeight( wxBOLD ); + m_labelFont.SetWeight( wxFONTWEIGHT_BOLD ); m_rowLabelHorizAlign = wxALIGN_CENTRE; m_rowLabelVertAlign = wxALIGN_CENTRE; @@ -2747,7 +2716,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = pos; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2792,7 +2761,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = oldNumRows; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2828,7 +2797,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) int h = 0; for ( i = 0; i < m_numRows; i++ ) { - h += m_rowHeights[i]; + h += GetRowHeight(i); m_rowBottoms[i] = h; } } @@ -2912,7 +2881,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -2970,7 +2939,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -3031,7 +3000,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - w += m_colWidths[i]; + w += GetColWidth(i); m_colRights[i] = w; } } @@ -3746,29 +3715,27 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) // get the position of the column we're over int pos = XToPos(x); - // we may need to adjust the drop position but don't bother - // checking for it if we can't anyhow - if ( pos > 1 ) - { - // also find the index of the column we're over: notice - // that the existing "col" variable may be invalid but - // we need a valid one here - const int colValid = GetColAt(pos); + // insert the column being dragged either before or after + // it, depending on where exactly it was dropped, so + // find the index of the column we're over: notice + // that the existing "col" variable may be invalid but + // we need a valid one here + const int colValid = GetColAt(pos); - // if we're on the "near" (usually left but right in - // RTL case) part of the column, the actual position we - // should be placed in is actually the one before it - bool onNearPart; - const int middle = GetColLeft(colValid) + - GetColWidth(colValid)/2; - if ( GetLayoutDirection() == wxLayout_LeftToRight ) - onNearPart = (x <= middle); - else // wxLayout_RightToLeft - onNearPart = (x > middle); + // and check if we're on the "near" (usually left but right + // in RTL case) part of the column + const int middle = GetColLeft(colValid) + + GetColWidth(colValid)/2; + const bool onNearPart = (x <= middle); - if ( onNearPart ) - pos--; - } + // adjust for the column being dragged itself + if ( pos < GetColPos(m_dragRowOrCol) ) + pos++; + + // and if it's on the near part of the target column, + // insert it before it, not after + if ( onNearPart ) + pos--; DoEndMoveCol(pos); } @@ -3976,7 +3943,9 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, case wxMOD_CONTROL: if ( m_selectedBlockCorner == wxGridNoCellCoords) m_selectedBlockCorner = coords; - UpdateBlockBeingSelected(m_selectedBlockCorner, coords); + if ( isFirstDrag ) + SetGridCursor(coords); + UpdateBlockBeingSelected(m_currentCellCoords, coords); break; case wxMOD_NONE: @@ -4489,7 +4458,11 @@ void wxGrid::RefreshAfterColPosChange() { int colID = GetColAt( colPos ); - colRight += m_colWidths[colID]; + // Ignore the currently hidden columns. + const int width = m_colWidths[colID]; + if ( width > 0 ) + colRight += width; + m_colRights[colID] = colRight; } } @@ -4565,12 +4538,6 @@ bool wxGrid::ProcessTableMessage( wxGridTableMessage& msg ) { switch ( msg.GetId() ) { - case wxGRIDTABLE_REQUEST_VIEW_GET_VALUES: - return GetModelValues(); - - case wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES: - return SetModelValues(); - case wxGRIDTABLE_NOTIFY_ROWS_INSERTED: case wxGRIDTABLE_NOTIFY_ROWS_APPENDED: case wxGRIDTABLE_NOTIFY_ROWS_DELETED: @@ -4659,7 +4626,7 @@ wxGrid::SendGridSizeEvent(wxEventType type, // +1 if the event was processed (but not vetoed) // 0 if the event wasn't handled int -wxGrid::SendEvent(const wxEventType type, +wxGrid::SendEvent(wxEventType type, int row, int col, const wxMouseEvent& mouseEv) { @@ -4734,7 +4701,7 @@ wxGrid::SendEvent(const wxEventType type, // Generate a grid event of specified type, return value same as above // int -wxGrid::SendEvent(const wxEventType type, int row, int col, const wxString& s) +wxGrid::SendEvent(wxEventType type, int row, int col, const wxString& s) { wxGridEvent gridEvt( GetId(), type, this, row, col ); gridEvt.SetString(s); @@ -4992,7 +4959,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) MoveCursorRight(false); break; } - //else: fall through + wxFALLTHROUGH; default: event.Skip(); @@ -5207,7 +5174,7 @@ wxGrid::UpdateBlockBeingSelected(int topRow, int leftCol, { default: wxFAIL_MSG( "unknown selection mode" ); - // fall through + wxFALLTHROUGH; case wxGridSelectCells: // arbitrary blocks selection allowed so just use the cell @@ -5215,7 +5182,7 @@ wxGrid::UpdateBlockBeingSelected(int topRow, int leftCol, break; case wxGridSelectRows: - // only full rows selection allowd, ensure that we do select + // only full rows selection allowed, ensure that we do select // full rows leftCol = 0; rightCol = GetNumberCols() - 1; @@ -5335,51 +5302,6 @@ wxGrid::UpdateBlockBeingSelected(int topRow, int leftCol, m_selectedBlockBottomRight = updateBottomRight; } -// -// ------ functions to get/send data (see also public functions) -// - -bool wxGrid::GetModelValues() -{ - // Hide the editor, so it won't hide a changed value. - HideCellEditControl(); - - if ( m_table ) - { - // all we need to do is repaint the grid - // - m_gridWin->Refresh(); - return true; - } - - return false; -} - -bool wxGrid::SetModelValues() -{ - int row, col; - - // Disable the editor, so it won't hide a changed value. - // Do we also want to save the current value of the editor first? - // I think so ... - DisableCellEditControl(); - - if ( m_table ) - { - for ( row = 0; row < m_numRows; row++ ) - { - for ( col = 0; col < m_numCols; col++ ) - { - m_table->SetValue( row, col, GetCellValue(row, col) ); - } - } - - return true; - } - - return false; -} - // Note - this function only draws cells that are in the list of // exposed cells (usually set from the update region by // CalcExposedCells) @@ -5598,11 +5520,12 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ) // size of the rectangle is reduced to compensate for the thickness of // the line. If this is too strange on non-wxMSW platforms then // please #ifdef this appropriately. +#ifndef __WXQT__ rect.x += penWidth / 2; rect.y += penWidth / 2; rect.width -= penWidth - 1; rect.height -= penWidth - 1; - +#endif // Now draw the rectangle // use the cellHighlightColour if the cell is inside a selection, this // will ensure the cell is always visible. @@ -5870,7 +5793,7 @@ wxGrid::DoDrawGridLines(wxDC& dc, int i = GetColAt( colPos ); int colRight = GetColRight(i); -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXQT__) if (GetLayoutDirection() != wxLayout_RightToLeft) #endif colRight--; @@ -6392,6 +6315,7 @@ void wxGrid::ShowCellEditControl() if (rect.x < 0) nXMove = rect.x; +#ifndef __WXQT__ // cell is shifted by one pixel // However, don't allow x or y to become negative // since the SetSize() method interprets that as @@ -6400,6 +6324,11 @@ void wxGrid::ShowCellEditControl() rect.x--; if (rect.y > 0) rect.y--; +#else + // Substract 1 pixel in every dimension to fit in the cell area. + // If not, Qt will draw the control outside the cell. + rect.Deflate(1, 1); +#endif wxGridCellEditor* editor = attr->GetEditor(this, row, col); if ( !editor->IsCreated() ) @@ -6734,12 +6663,14 @@ wxRect wxGrid::CellToRect( int row, int col ) const for (i=row; i < row + cell_rows; i++) rect.height += GetRowHeight(i); +#ifndef __WXQT__ // if grid lines are enabled, then the area of the cell is a bit smaller if (m_gridLinesEnabled) { rect.width -= 1; rect.height -= 1; } +#endif } return rect; @@ -7276,9 +7207,9 @@ void wxGrid::SetColLabelAlignment( int horiz, int vert ) // Note: under MSW, the default column label font must be changed because it // does not support vertical printing // -// Example: wxFont font(9, wxSWISS, wxNORMAL, wxBOLD); -// pGrid->SetLabelFont(font); -// pGrid->SetColLabelTextOrientation(wxVERTICAL); +// Example: +// pGrid->SetLabelFont(wxFontInfo(9).Family(wxFONTFAMILY_SWISS)); +// pGrid->SetColLabelTextOrientation(wxVERTICAL); // void wxGrid::SetColLabelTextOrientation( int textOrientation ) { @@ -7471,7 +7402,7 @@ int wxGrid::GetColSize( int col ) const void wxGrid::SetDefaultCellBackgroundColour( const wxColour& col ) { m_defaultCellAttr->SetBackgroundColour(col); -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXQT__) m_gridWin->SetBackgroundColour(col); #endif } @@ -8169,8 +8100,9 @@ void wxGrid::SetRowSize( int row, int height ) dc.SetFont(GetLabelFont()); StringToLines(GetRowLabelValue( row ), lines); GetTextBoxSize( dc, lines, &w, &h ); - //check that it is not less than the minimal height - height = wxMax(h, GetRowMinimalAcceptableHeight()); + + // As with the columns, don't make the row smaller than minimal height. + height = wxMax(h, GetRowMinimalHeight(row)); } DoSetRowSize(row, height); @@ -8250,8 +8182,14 @@ void wxGrid::SetColSize( int col, int width ) else GetTextBoxSize( dc, lines, &h, &w ); width = w + 6; - //check that it is not less than the minimal width - width = wxMax(width, GetColMinimalAcceptableWidth()); + + // Check that it is not less than the minimal width and do use the + // possibly greater than minimal-acceptable-width minimal-width itself + // here as we shouldn't become too small when auto-sizing, otherwise + // the column could be resized to be too small by double clicking its + // divider line (which ends up in a call to this function) even though + // it couldn't be resized to this size by dragging it. + width = wxMax(width, GetColMinimalWidth(col)); } DoSetColSize(col, width); @@ -8434,8 +8372,11 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col); if ( renderer ) { - wxSize size = renderer->GetBestSize(*this, *attr, dc, row, col); - extent = column ? size.x : size.y; + extent = column + ? renderer->GetBestWidth(*this, *attr, dc, row, col, + GetRowHeight(row)) + : renderer->GetBestHeight(*this, *attr, dc, row, col, + GetColWidth(col)); if ( span != CellSpan_None ) { @@ -9125,7 +9066,7 @@ void wxGrid::SetDropTarget(wxDropTarget *dropTarget) // grid event classes // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS( wxGridEvent, wxNotifyEvent ) +wxIMPLEMENT_DYNAMIC_CLASS(wxGridEvent, wxNotifyEvent); wxGridEvent::wxGridEvent( int id, wxEventType type, wxObject* obj, int row, int col, int x, int y, bool sel, @@ -9138,7 +9079,7 @@ wxGridEvent::wxGridEvent( int id, wxEventType type, wxObject* obj, SetEventObject(obj); } -IMPLEMENT_DYNAMIC_CLASS( wxGridSizeEvent, wxNotifyEvent ) +wxIMPLEMENT_DYNAMIC_CLASS(wxGridSizeEvent, wxNotifyEvent); wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, int rowOrCol, int x, int y, @@ -9152,7 +9093,7 @@ wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, } -IMPLEMENT_DYNAMIC_CLASS( wxGridRangeSelectEvent, wxNotifyEvent ) +wxIMPLEMENT_DYNAMIC_CLASS(wxGridRangeSelectEvent, wxNotifyEvent); wxGridRangeSelectEvent::wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj, const wxGridCellCoords& topLeft, @@ -9168,7 +9109,7 @@ wxGridRangeSelectEvent::wxGridRangeSelectEvent(int id, wxEventType type, wxObjec } -IMPLEMENT_DYNAMIC_CLASS(wxGridEditorCreatedEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxGridEditorCreatedEvent, wxCommandEvent); wxGridEditorCreatedEvent::wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj, int row, diff --git a/Externals/wxWidgets3/src/generic/gridctrl.cpp b/Externals/wxWidgets3/src/generic/gridctrl.cpp index 25c3359d3b..36ff071777 100644 --- a/Externals/wxWidgets3/src/generic/gridctrl.cpp +++ b/Externals/wxWidgets3/src/generic/gridctrl.cpp @@ -435,21 +435,58 @@ wxGridCellAutoWrapStringRenderer::GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col) +{ + // We have to make a choice here and fix either width or height because we + // don't have any naturally best size. This choice is mostly arbitrary, but + // we need to be consistent about it, otherwise wxGrid auto-sizing code + // would get confused. For now we decide to use a single line of text and + // compute the width needed to fully display everything. + const int height = dc.GetCharHeight(); + + return wxSize(GetBestWidth(grid, attr, dc, row, col, height), height); +} + +static const int AUTOWRAP_Y_MARGIN = 4; + +int +wxGridCellAutoWrapStringRenderer::GetBestHeight(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int width) { const int lineHeight = dc.GetCharHeight(); - // Search for a shape no taller than the golden ratio. - wxSize size; - for ( size.x = 10; ; size.x += 10 ) - { - const size_t - numLines = GetTextLines(grid, dc, attr, size, row, col).size(); - size.y = numLines * lineHeight; - if ( size.x >= size.y*1.68 ) - break; - } + // Use as many lines as we need for this width and add a small border to + // improve the appearance. + return GetTextLines(grid, dc, attr, wxSize(width, lineHeight), + row, col).size() * lineHeight + AUTOWRAP_Y_MARGIN; +} - return size; +int +wxGridCellAutoWrapStringRenderer::GetBestWidth(wxGrid& grid, + wxGridCellAttr& attr, + wxDC& dc, + int row, int col, + int height) +{ + const int lineHeight = dc.GetCharHeight(); + + // Maximal number of lines that fully fit but at least 1. + const size_t maxLines = height - AUTOWRAP_Y_MARGIN < lineHeight + ? 1 + : (height - AUTOWRAP_Y_MARGIN)/lineHeight; + + // Increase width until all the text fits. + // + // TODO: this is not the most efficient to do it for the long strings. + const int charWidth = dc.GetCharWidth(); + int width = 2*charWidth; + while ( GetTextLines(grid, dc, attr, wxSize(width, height), + row, col).size() > maxLines ) + width += charWidth; + + return width; } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/generic/grideditors.cpp b/Externals/wxWidgets3/src/generic/grideditors.cpp index aef0f36453..4cc103ca73 100644 --- a/Externals/wxWidgets3/src/generic/grideditors.cpp +++ b/Externals/wxWidgets3/src/generic/grideditors.cpp @@ -415,11 +415,13 @@ void wxGridCellTextEditor::DoCreate(wxWindow* parent, { Text()->SetMaxLength(m_maxChars); } +#if wxUSE_VALIDATORS // validate text in textctrl, if validator is set if ( m_validator ) { Text()->SetValidator(*m_validator); } +#endif wxGridCellEditor::Create(parent, id, evtHandler); } @@ -638,18 +640,22 @@ void wxGridCellTextEditor::SetParameters(const wxString& params) } } +#if wxUSE_VALIDATORS void wxGridCellTextEditor::SetValidator(const wxValidator& validator) { m_validator.reset(static_cast(validator.Clone())); } +#endif wxGridCellEditor *wxGridCellTextEditor::Clone() const { wxGridCellTextEditor* editor = new wxGridCellTextEditor(m_maxChars); +#if wxUSE_VALIDATORS if ( m_validator ) { editor->SetValidator(*m_validator); } +#endif return editor; } diff --git a/Externals/wxWidgets3/src/generic/gridsel.cpp b/Externals/wxWidgets3/src/generic/gridsel.cpp index e79f7f2031..c6cf59f389 100644 --- a/Externals/wxWidgets3/src/generic/gridsel.cpp +++ b/Externals/wxWidgets3/src/generic/gridsel.cpp @@ -379,7 +379,7 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol, { default: wxFAIL_MSG( "unknown selection mode" ); - // fall through + wxFALLTHROUGH; case wxGrid::wxGridSelectCells: // nothing to do -- in this mode arbitrary blocks can be selected diff --git a/Externals/wxWidgets3/src/generic/headerctrlg.cpp b/Externals/wxWidgets3/src/generic/headerctrlg.cpp index 6dcccfdce8..cc720c8617 100644 --- a/Externals/wxWidgets3/src/generic/headerctrlg.cpp +++ b/Externals/wxWidgets3/src/generic/headerctrlg.cpp @@ -465,7 +465,7 @@ void wxHeaderCtrl::DoMoveCol(unsigned int idx, unsigned int pos) // wxHeaderCtrl event handlers // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxHeaderCtrl, wxHeaderCtrlBase) +wxBEGIN_EVENT_TABLE(wxHeaderCtrl, wxHeaderCtrlBase) EVT_PAINT(wxHeaderCtrl::OnPaint) EVT_MOUSE_EVENTS(wxHeaderCtrl::OnMouse) @@ -473,7 +473,7 @@ BEGIN_EVENT_TABLE(wxHeaderCtrl, wxHeaderCtrlBase) EVT_MOUSE_CAPTURE_LOST(wxHeaderCtrl::OnCaptureLost) EVT_KEY_DOWN(wxHeaderCtrl::OnKeyDown) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { diff --git a/Externals/wxWidgets3/src/generic/helpext.cpp b/Externals/wxWidgets3/src/generic/helpext.cpp index af4644ad85..f4e769eb27 100644 --- a/Externals/wxWidgets3/src/generic/helpext.cpp +++ b/Externals/wxWidgets3/src/generic/helpext.cpp @@ -14,7 +14,7 @@ #pragma hdrstop #endif -#if wxUSE_HELP && !defined(__WXWINCE__) +#if wxUSE_HELP #ifndef WX_PRECOMP #include "wx/list.h" @@ -34,14 +34,10 @@ #include #include -#if !defined(__WINDOWS__) && !defined(__OS2__) +#if !defined(__WINDOWS__) #include #endif -#ifdef __WINDOWS__ -#include "wx/msw/mslu.h" -#endif - #ifdef __WXMSW__ #include #include "wx/msw/winundef.h" @@ -66,7 +62,7 @@ // Is browser a netscape browser? #define WXEXTHELP_ENVVAR_BROWSERISNETSCAPE wxT("WX_HELPBROWSER_NS") -IMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase) +wxIMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase); wxExtHelpController::wxExtHelpController(wxWindow* parentWindow) : wxHelpControllerBase(parentWindow) diff --git a/Externals/wxWidgets3/src/generic/htmllbox.cpp b/Externals/wxWidgets3/src/generic/htmllbox.cpp index 178f8c44ef..507badf53b 100644 --- a/Externals/wxWidgets3/src/generic/htmllbox.cpp +++ b/Externals/wxWidgets3/src/generic/htmllbox.cpp @@ -161,7 +161,7 @@ class wxHtmlListBoxStyle : public wxDefaultHtmlRenderingStyle public: wxHtmlListBoxStyle(const wxHtmlListBox& hlbox) : m_hlbox(hlbox) { } - virtual wxColour GetSelectedTextColour(const wxColour& colFg) + virtual wxColour GetSelectedTextColour(const wxColour& colFg) wxOVERRIDE { // by default wxHtmlListBox doesn't implement GetSelectedTextColour() // and returns wxNullColour from it, so use the default HTML colour for @@ -175,7 +175,7 @@ public: return col; } - virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) + virtual wxColour GetSelectedTextBgColour(const wxColour& colBg) wxOVERRIDE { wxColour col = m_hlbox.GetSelectedTextBgColour(colBg); if ( !col.IsOk() ) @@ -196,17 +196,17 @@ private: // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxHtmlListBox, wxVListBox) +wxBEGIN_EVENT_TABLE(wxHtmlListBox, wxVListBox) EVT_SIZE(wxHtmlListBox::OnSize) EVT_MOTION(wxHtmlListBox::OnMouseMove) EVT_LEFT_DOWN(wxHtmlListBox::OnLeftDown) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxHtmlListBox, wxVListBox) +wxIMPLEMENT_ABSTRACT_CLASS(wxHtmlListBox, wxVListBox); // ---------------------------------------------------------------------------- @@ -295,37 +295,40 @@ wxString wxHtmlListBox::OnGetItemMarkup(size_t n) const // wxHtmlListBox cache handling // ---------------------------------------------------------------------------- +wxHtmlCell* wxHtmlListBox::CreateCellForItem(size_t n) const +{ + if ( !m_htmlParser ) + { + wxHtmlListBox *self = wxConstCast(this, wxHtmlListBox); + + self->m_htmlParser = new wxHtmlWinParser(self); + m_htmlParser->SetDC(new wxClientDC(self)); + m_htmlParser->SetFS(&self->m_filesystem); +#if !wxUSE_UNICODE + if (GetFont().IsOk()) + m_htmlParser->SetInputEncoding(GetFont().GetEncoding()); +#endif + // use system's default GUI font by default: + m_htmlParser->SetStandardFonts(); + } + + wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser-> + Parse(OnGetItemMarkup(n)); + wxCHECK_MSG( cell, NULL, wxT("wxHtmlParser::Parse() returned NULL?") ); + + // set the cell's ID to item's index so that CellCoordsToPhysical() + // can quickly find the item: + cell->SetId(wxString::Format(wxT("%lu"), (unsigned long)n)); + + cell->Layout(GetClientSize().x - 2*GetMargins().x); + + return cell; +} + void wxHtmlListBox::CacheItem(size_t n) const { if ( !m_cache->Has(n) ) - { - if ( !m_htmlParser ) - { - wxHtmlListBox *self = wxConstCast(this, wxHtmlListBox); - - self->m_htmlParser = new wxHtmlWinParser(self); - m_htmlParser->SetDC(new wxClientDC(self)); - m_htmlParser->SetFS(&self->m_filesystem); -#if !wxUSE_UNICODE - if (GetFont().IsOk()) - m_htmlParser->SetInputEncoding(GetFont().GetEncoding()); -#endif - // use system's default GUI font by default: - m_htmlParser->SetStandardFonts(); - } - - wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser-> - Parse(OnGetItemMarkup(n)); - wxCHECK_RET( cell, wxT("wxHtmlParser::Parse() returned NULL?") ); - - // set the cell's ID to item's index so that CellCoordsToPhysical() - // can quickly find the item: - cell->SetId(wxString::Format(wxT("%lu"), (unsigned long)n)); - - cell->Layout(GetClientSize().x - 2*GetMargins().x); - - m_cache->Store(n, cell); - } + m_cache->Store(n, CreateCellForItem(n)); } void wxHtmlListBox::OnSize(wxSizeEvent& event) @@ -425,12 +428,18 @@ void wxHtmlListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const wxCoord wxHtmlListBox::OnMeasureItem(size_t n) const { - CacheItem(n); + // Notice that we can't cache the cell here because we could be called from + // some code updating an existing cell which could be displaced from the + // cache if we called CacheItem() and destroyed -- resulting in a crash + // when we return to its method from here, see #16651. + wxHtmlCell * const cell = CreateCellForItem(n); + if ( !cell ) + return 0; - wxHtmlCell *cell = m_cache->Get(n); - wxCHECK_MSG( cell, 0, wxT("this cell should be cached!") ); + const wxCoord h = cell->GetHeight() + cell->GetDescent() + 4; + delete cell; - return cell->GetHeight() + cell->GetDescent() + 4; + return h; } // ---------------------------------------------------------------------------- @@ -598,7 +607,7 @@ void wxHtmlListBox::OnLeftDown(wxMouseEvent& event) // wxSimpleHtmlListBox // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxSimpleHtmlListBox, wxHtmlListBox) +wxIMPLEMENT_ABSTRACT_CLASS(wxSimpleHtmlListBox, wxHtmlListBox); bool wxSimpleHtmlListBox::Create(wxWindow *parent, wxWindowID id, @@ -606,7 +615,7 @@ bool wxSimpleHtmlListBox::Create(wxWindow *parent, wxWindowID id, const wxSize& size, int n, const wxString choices[], long style, - const wxValidator& validator, + const wxValidator& wxVALIDATOR_PARAM(validator), const wxString& name) { if (!wxHtmlListBox::Create(parent, id, pos, size, style, name)) @@ -626,7 +635,7 @@ bool wxSimpleHtmlListBox::Create(wxWindow *parent, wxWindowID id, const wxSize& size, const wxArrayString& choices, long style, - const wxValidator& validator, + const wxValidator& wxVALIDATOR_PARAM(validator), const wxString& name) { if (!wxHtmlListBox::Create(parent, id, pos, size, style, name)) diff --git a/Externals/wxWidgets3/src/generic/hyperlinkg.cpp b/Externals/wxWidgets3/src/generic/hyperlinkg.cpp index eb8485955d..1d0bb412d7 100644 --- a/Externals/wxWidgets3/src/generic/hyperlinkg.cpp +++ b/Externals/wxWidgets3/src/generic/hyperlinkg.cpp @@ -83,7 +83,7 @@ bool wxGenericHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, // connect our event handlers: // NOTE: since this class is the base class of the GTK+'s native implementation - // of wxHyperlinkCtrl, we cannot use the static macros in BEGIN/END_EVENT_TABLE + // of wxHyperlinkCtrl, we cannot use the static macros in wxBEGIN/wxEND_EVENT_TABLE // blocks, otherwise the GTK+'s native impl of wxHyperlinkCtrl would not // behave correctly (as we intercept events doing things which interfere // with GTK+'s native handling): diff --git a/Externals/wxWidgets3/src/generic/icon.cpp b/Externals/wxWidgets3/src/generic/icon.cpp index ffe0335ad0..53b1c80fee 100644 --- a/Externals/wxWidgets3/src/generic/icon.cpp +++ b/Externals/wxWidgets3/src/generic/icon.cpp @@ -21,7 +21,7 @@ // wxIcon //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) +wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap); wxIcon::wxIcon(const char* const* bits) : wxBitmap( bits ) diff --git a/Externals/wxWidgets3/src/generic/imaglist.cpp b/Externals/wxWidgets3/src/generic/imaglist.cpp index ba98cc4003..14c8127a80 100644 --- a/Externals/wxWidgets3/src/generic/imaglist.cpp +++ b/Externals/wxWidgets3/src/generic/imaglist.cpp @@ -27,8 +27,8 @@ // wxImageList //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericImageList, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxGenericImageList) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericImageList, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxGenericImageList); wxGenericImageList::wxGenericImageList( int width, int height, bool mask, int initialCount ) { @@ -155,13 +155,7 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) wxCHECK_MSG( node, false, wxT("wrong index in image list") ); wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ? - #if defined(__VISAGECPP__) - //just can't do this in VisualAge now, with all this new Bitmap-Icon stuff - //so construct it from a bitmap object until I can figure this nonsense out. (DW) - new wxBitmap(bitmap) - #else new wxBitmap( (const wxIcon&) bitmap ) - #endif : new wxBitmap(bitmap) ; if (index == (int) m_images.GetCount() - 1) @@ -188,13 +182,7 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap, const wxBit wxCHECK_MSG( node, false, wxT("wrong index in image list") ); wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ? - #if defined(__VISAGECPP__) - //just can't do this in VisualAge now, with all this new Bitmap-Icon stuff - //so construct it from a bitmap object until I can figure this nonsense out. (DW) - new wxBitmap(bitmap) - #else new wxBitmap( (const wxIcon&) bitmap ) - #endif : new wxBitmap(bitmap) ; if (index == (int) m_images.GetCount() - 1) diff --git a/Externals/wxWidgets3/src/generic/infobar.cpp b/Externals/wxWidgets3/src/generic/infobar.cpp index 3ae926223a..2ca258faf9 100644 --- a/Externals/wxWidgets3/src/generic/infobar.cpp +++ b/Externals/wxWidgets3/src/generic/infobar.cpp @@ -39,9 +39,9 @@ #include "wx/artprov.h" #include "wx/scopeguard.h" -BEGIN_EVENT_TABLE(wxInfoBarGeneric, wxInfoBarBase) +wxBEGIN_EVENT_TABLE(wxInfoBarGeneric, wxInfoBarBase) EVT_BUTTON(wxID_ANY, wxInfoBarGeneric::OnButton) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -127,13 +127,10 @@ wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const if ( !sizer ) return BarPlacement_Unknown; - // FIXME-VC6: can't compare "const wxInfoBarGeneric *" and "wxWindow *", - // so need this workaround - wxWindow * const self = const_cast(this); const wxSizerItemList& siblings = sizer->GetChildren(); - if ( siblings.GetFirst()->GetData()->GetWindow() == self ) + if ( siblings.GetFirst()->GetData()->GetWindow() == this ) return BarPlacement_Top; - else if ( siblings.GetLast()->GetData()->GetWindow() == self ) + else if ( siblings.GetLast()->GetData()->GetWindow() == this ) return BarPlacement_Bottom; else return BarPlacement_Unknown; @@ -154,7 +151,7 @@ wxShowEffect wxInfoBarGeneric::GetShowEffect() const default: wxFAIL_MSG( "unknown info bar placement" ); - // fall through + wxFALLTHROUGH; case BarPlacement_Unknown: return wxSHOW_EFFECT_NONE; @@ -176,7 +173,7 @@ wxShowEffect wxInfoBarGeneric::GetHideEffect() const default: wxFAIL_MSG( "unknown info bar placement" ); - // fall through + wxFALLTHROUGH; case BarPlacement_Unknown: return wxSHOW_EFFECT_NONE; @@ -280,6 +277,110 @@ void wxInfoBarGeneric::AddButton(wxWindowID btnid, const wxString& label) sizer->Add(button, wxSizerFlags().Centre().DoubleBorder()); } +size_t wxInfoBarGeneric::GetButtonCount() const +{ + size_t count = 0; + wxSizer * const sizer = GetSizer(); + if ( !sizer ) + return 0; + + // iterate over the sizer items in reverse order + const wxSizerItemList& items = sizer->GetChildren(); + for ( wxSizerItemList::compatibility_iterator node = items.GetLast(); + node != items.GetFirst(); + node = node->GetPrevious() ) + { + const wxSizerItem * const item = node->GetData(); + + // if we reached the spacer separating the buttons from the text + // break the for-loop. + if ( item->IsSpacer() ) + break; + + // if the standard button is shown, there must be no other ones + if ( item->GetWindow() == m_button ) + return 0; + + ++count; + } + + return count; +} + +wxWindowID wxInfoBarGeneric::GetButtonId(size_t idx) const +{ + wxCHECK_MSG( idx < GetButtonCount(), wxID_NONE, + "Invalid infobar button position" ); + + wxSizer * const sizer = GetSizer(); + if ( !sizer ) + return wxID_NONE; + + bool foundSpacer = false; + + size_t count = 0; + const wxSizerItemList& items = sizer->GetChildren(); + for ( wxSizerItemList::compatibility_iterator node = items.GetLast(); + node != items.GetFirst() || node != items.GetLast(); + ) + { + const wxSizerItem * const item = node->GetData(); + + if ( item->IsSpacer() ) + foundSpacer = true; + + if ( foundSpacer ) + { + if ( !item->IsSpacer() ) + { + if ( count == idx ) + { + if ( item->GetWindow() != m_button ) + return item->GetWindow()->GetId(); + } + + ++count; + } + + node = node->GetNext(); + } + else + { + node = node->GetPrevious(); + } + } + + return wxID_NONE; +} + +bool wxInfoBarGeneric::HasButtonId(wxWindowID btnid) const +{ + wxSizer * const sizer = GetSizer(); + if ( !sizer ) + return false; + + // iterate over the sizer items in reverse order to find the last added + // button with this id + const wxSizerItemList& items = sizer->GetChildren(); + for ( wxSizerItemList::compatibility_iterator node = items.GetLast(); + node != items.GetFirst(); + node = node->GetPrevious() ) + { + const wxSizerItem * const item = node->GetData(); + + // if we reached the spacer separating the buttons from the text + // then the wanted ID is not inside. + if ( item->IsSpacer() ) + return false; + + // check if we found our button + if ( item->GetWindow()->GetId() == btnid ) + return true; + } + + return false; +} + void wxInfoBarGeneric::RemoveButton(wxWindowID btnid) { wxSizer * const sizer = GetSizer(); diff --git a/Externals/wxWidgets3/src/generic/laywin.cpp b/Externals/wxWidgets3/src/generic/laywin.cpp index 5cb58f3f6a..b77f26bb5b 100644 --- a/Externals/wxWidgets3/src/generic/laywin.cpp +++ b/Externals/wxWidgets3/src/generic/laywin.cpp @@ -26,8 +26,8 @@ #include "wx/mdi.h" -IMPLEMENT_DYNAMIC_CLASS(wxQueryLayoutInfoEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxCalculateLayoutEvent, wxEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxQueryLayoutInfoEvent, wxEvent); +wxIMPLEMENT_DYNAMIC_CLASS(wxCalculateLayoutEvent, wxEvent); wxDEFINE_EVENT( wxEVT_QUERY_LAYOUT_INFO, wxQueryLayoutInfoEvent ); wxDEFINE_EVENT( wxEVT_CALCULATE_LAYOUT, wxCalculateLayoutEvent ); @@ -38,11 +38,11 @@ wxDEFINE_EVENT( wxEVT_CALCULATE_LAYOUT, wxCalculateLayoutEvent ); // ---------------------------------------------------------------------------- #if wxUSE_SASH -IMPLEMENT_CLASS(wxSashLayoutWindow, wxSashWindow) -BEGIN_EVENT_TABLE(wxSashLayoutWindow, wxSashWindow) +wxIMPLEMENT_CLASS(wxSashLayoutWindow, wxSashWindow); +wxBEGIN_EVENT_TABLE(wxSashLayoutWindow, wxSashWindow) EVT_CALCULATE_LAYOUT(wxSashLayoutWindow::OnCalculateLayout) EVT_QUERY_LAYOUT_INFO(wxSashLayoutWindow::OnQueryLayoutInfo) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxSashLayoutWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) diff --git a/Externals/wxWidgets3/src/generic/listbkg.cpp b/Externals/wxWidgets3/src/generic/listbkg.cpp index c9584d1ff3..bbb5cd4435 100644 --- a/Externals/wxWidgets3/src/generic/listbkg.cpp +++ b/Externals/wxWidgets3/src/generic/listbkg.cpp @@ -35,26 +35,19 @@ #include "wx/statline.h" #include "wx/imaglist.h" -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase); wxDEFINE_EVENT( wxEVT_LISTBOOK_PAGE_CHANGING, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_LISTBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase) EVT_SIZE(wxListbook::OnSize) EVT_LIST_ITEM_SELECTED(wxID_ANY, wxListbook::OnListSelected) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxListbook implementation @@ -102,16 +95,10 @@ wxListbook::Create(wxWindow *parent, if ( GetListView()->InReportView() ) GetListView()->InsertColumn(0, wxS("Pages")); -#ifdef __WXMSW__ - // On XP with themes enabled the GetViewRect used in GetControllerSize() to - // determine the space needed for the list view will incorrectly return - // (0,0,0,0) the first time. So send a pending event so OnSize will be - // called again after the window is ready to go. Technically we don't - // need to do this on non-XP windows, but if things are already sized - // correctly then nothing changes and so there is no harm. - wxSizeEvent evt; - GetEventHandler()->AddPendingEvent(evt); -#endif + // Ensure that we rearrange the items in our list view after all the pages + // are added. + PostSizeEvent(); + return true; } @@ -149,6 +136,10 @@ long wxListbook::GetListCtrlFlags() const { flags |= wxLC_LIST; } + +#ifdef __WXQT__ + flags |= wxLC_NO_HEADER; +#endif } // Use single selection in any case. @@ -168,8 +159,14 @@ void wxListbook::OnSize(wxSizeEvent& event) // the other one is not accounted for in client size computations) wxListView * const list = GetListView(); if ( list ) + { list->Arrange(); + const int sel = GetSelection(); + if ( sel != wxNOT_FOUND ) + list->EnsureVisible(sel); + } + event.Skip(); } diff --git a/Externals/wxWidgets3/src/generic/listctrl.cpp b/Externals/wxWidgets3/src/generic/listctrl.cpp index bbe22e4eef..ef7aa27c6c 100644 --- a/Externals/wxWidgets3/src/generic/listctrl.cpp +++ b/Externals/wxWidgets3/src/generic/listctrl.cpp @@ -39,13 +39,14 @@ #include "wx/imaglist.h" #include "wx/renderer.h" #include "wx/generic/private/listctrl.h" +#include "wx/generic/private/widthcalc.h" #ifdef __WXMAC__ #include "wx/osx/private.h" #endif -#if defined(__WXMSW__) && !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) - #define "wx/msw/wrapwin.h" +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) + #include "wx/msw/wrapwin.h" #endif // NOTE: If using the wxListBox visual attributes works everywhere then this can @@ -101,6 +102,8 @@ static const int IMAGE_MARGIN_IN_REPORT_MODE = 5; // the space between the image and the text in the report mode in header static const int HEADER_IMAGE_MARGIN_IN_REPORT_MODE = 2; +// space after a checkbox +static const int MARGIN_AROUND_CHECKBOX = 5; // ---------------------------------------------------------------------------- @@ -409,6 +412,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner ) m_gi = new GeometryInfo; m_highlighted = false; + m_checked = false; InitItems( GetMode() == wxLC_REPORT ? m_owner->GetColumnCount() : 1 ); } @@ -677,11 +681,7 @@ void wxListLineData::ApplyAttributes(wxDC *dc, wxWindow * const listctrl = m_owner->GetParent(); - const bool hasFocus = listctrl->HasFocus() -#if defined(__WXMAC__) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - && IsControlActive( (ControlRef)listctrl->GetHandle() ) -#endif - ; + const bool hasFocus = listctrl->HasFocus(); // fg colour @@ -797,6 +797,21 @@ void wxListLineData::DrawInReportMode( wxDC *dc, x += 2; #endif + if ( m_owner->HasCheckboxes() ) + { + wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(m_owner); + int yOffset = (rect.height - cbSize.GetHeight()) / 2; + wxRect rr(wxPoint(x, rect.y + yOffset), cbSize); + rr.x += MARGIN_AROUND_CHECKBOX; + + int flags = 0; + if (m_checked) + flags |= wxCONTROL_CHECKED; + wxRendererNative::Get().DrawCheckBox(m_owner, *dc, rr, flags); + + x += cbSize.GetWidth() + (2 * MARGIN_AROUND_CHECKBOX); + } + size_t col = 0; for ( wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); node; @@ -805,6 +820,8 @@ void wxListLineData::DrawInReportMode( wxDC *dc, wxListItemData *item = node->GetData(); int width = m_owner->GetColumnWidth(col); + if (col == 0 && m_owner->HasCheckboxes()) + width -= x; int xOld = x; x += width; @@ -930,10 +947,10 @@ void wxListLineData::ReverseHighlight( void ) // wxListHeaderWindow //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow) +wxBEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow) EVT_PAINT (wxListHeaderWindow::OnPaint) EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxListHeaderWindow::Init() { @@ -1110,7 +1127,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { default: wxFAIL_MSG( wxT("unknown list item format") ); - // fall through + wxFALLTHROUGH; case wxLIST_FORMAT_LEFT: xAligned = x; @@ -1387,11 +1404,11 @@ void wxListFindTimer::Notify() // wxListTextCtrlWrapper (internal) //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxListTextCtrlWrapper, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxListTextCtrlWrapper, wxEvtHandler) EVT_CHAR (wxListTextCtrlWrapper::OnChar) EVT_KEY_UP (wxListTextCtrlWrapper::OnKeyUp) EVT_KILL_FOCUS (wxListTextCtrlWrapper::OnKillFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxListTextCtrlWrapper::wxListTextCtrlWrapper(wxListMainWindow *owner, wxTextCtrl *text, @@ -1420,6 +1437,13 @@ wxListTextCtrlWrapper::wxListTextCtrlWrapper(wxListMainWindow *owner, void wxListTextCtrlWrapper::EndEdit(EndReason reason) { + if( m_aboutToFinish ) + { + // We already called Finish which cannot be called + // more than once. + return; + } + m_aboutToFinish = true; switch ( reason ) @@ -1525,6 +1549,7 @@ void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) { if ( !m_aboutToFinish ) { + m_aboutToFinish = true; if ( !AcceptChanges() ) m_owner->OnRenameCancelled( m_itemEdited ); @@ -1539,7 +1564,7 @@ void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) // wxListMainWindow //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxListMainWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxListMainWindow, wxWindow) EVT_PAINT (wxListMainWindow::OnPaint) EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse) EVT_CHAR_HOOK (wxListMainWindow::OnCharHook) @@ -1550,7 +1575,7 @@ BEGIN_EVENT_TABLE(wxListMainWindow, wxWindow) EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus) EVT_SCROLLWIN (wxListMainWindow::OnScroll) EVT_CHILD_FOCUS (wxListMainWindow::OnChildFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxListMainWindow::Init() { @@ -1583,6 +1608,8 @@ void wxListMainWindow::Init() m_lineLastClicked = m_lineSelectSingleOnUp = m_lineBeforeLastClicked = (size_t)-1; + + m_hasCheckboxes = false; } wxListMainWindow::wxListMainWindow() @@ -1927,6 +1954,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo ) size_t visibleFrom, visibleTo; GetVisibleLinesRange(&visibleFrom, &visibleTo); + if ( lineFrom > visibleTo || lineTo < visibleFrom ) + { + // None of these lines are currently visible at all, don't bother + // doing anything. + return; + } + if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; if ( lineTo > visibleTo ) @@ -2252,6 +2286,17 @@ wxTextCtrl *wxListMainWindow::EditLabel(long item, wxClassInfo* textControlClass return m_textctrlWrapper->GetText(); } +bool wxListMainWindow::EndEditLabel(bool cancel) +{ + if (!m_textctrlWrapper) + { + return false; + } + + m_textctrlWrapper->EndEdit(cancel ? wxListTextCtrlWrapper::End_Discard : wxListTextCtrlWrapper::End_Accept); + return true; +} + void wxListMainWindow::OnRenameTimer() { wxCHECK_RET( HasCurrent(), wxT("unexpected rename timer") ); @@ -2405,8 +2450,6 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) // outside of any item if (event.RightDown()) { - SendNotify( (size_t) -1, wxEVT_LIST_ITEM_RIGHT_CLICK, event.GetPosition() ); - wxContextMenuEvent evtCtx( wxEVT_CONTEXT_MENU, GetParent()->GetId(), @@ -2536,9 +2579,13 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) bool cmdModifierDown = event.CmdDown(); if ( IsSingleSel() || !(cmdModifierDown || event.ShiftDown()) ) { - if ( IsSingleSel() || !IsHighlighted(current) ) + if (IsInsideCheckbox(current, x, y)) { - HighlightAll( false ); + CheckItem(current, !IsItemChecked(current)); + } + else if (IsSingleSel() || !IsHighlighted(current)) + { + HighlightAll(false); ChangeCurrent(current); @@ -2622,7 +2669,7 @@ void wxListMainWindow::MoveToItem(size_t item) if (rect.y + rect.height + 5 > view_y + client_h) GetListCtrl()->Scroll( -1, (rect.y + rect.height - client_h + hLine) / hLine ); -#ifdef __WXMAC__ +#if defined(__WXMAC__) || defined(__WXUNIVERSAL__) // At least on Mac the visible lines value will get reset inside of // Scroll *before* it actually scrolls the window because of the // Update() that happens there, so it will still have the wrong value. @@ -2630,6 +2677,7 @@ void wxListMainWindow::MoveToItem(size_t item) // next paint event. I would expect this problem to show up in wxGTK // too but couldn't duplicate it there. Perhaps the order of events // is different... --Robin + // Same in wxUniv/X11 ResetVisibleLinesRange(); #endif } @@ -2672,7 +2720,7 @@ bool wxListMainWindow::ScrollList(int WXUNUSED(dx), int dy) GetListCtrl()->Scroll(-1, top + dy / hLine); -#ifdef __WXMAC__ +#if defined(__WXMAC__) || defined(__WXUNIVERSAL__) // see comment in MoveToItem() for why we do this ResetVisibleLinesRange(); #endif @@ -3167,6 +3215,35 @@ void wxListMainWindow::SetColumn( int col, const wxListItem &item ) m_headerWidth = 0; } +class wxListCtrlMaxWidthCalculator : public wxMaxWidthCalculatorBase +{ +public: + wxListCtrlMaxWidthCalculator(wxListMainWindow *listmain, unsigned int column) + : wxMaxWidthCalculatorBase(column), + m_listmain(listmain) + { + } + + virtual void UpdateWithRow(int row) wxOVERRIDE + { + wxListLineData *line = m_listmain->GetLine( row ); + wxListItemDataList::compatibility_iterator n = line->m_items.Item( GetColumn() ); + + wxCHECK_RET( n, wxS("no subitem?") ); + + wxListItemData* const itemData = n->GetData(); + + wxListItem item; + itemData->GetItem(item); + + UpdateWithWidth(m_listmain->GetItemWidthWithImage(&item)); + } + +private: + wxListMainWindow* const m_listmain; +}; + + void wxListMainWindow::SetColumnWidth( int col, int width ) { wxCHECK_RET( col >= 0 && col < GetColumnCount(), @@ -3188,48 +3265,42 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) size_t count = GetItemCount(); - if (width == wxLIST_AUTOSIZE_USEHEADER) + if ( width == wxLIST_AUTOSIZE_USEHEADER || width == wxLIST_AUTOSIZE ) { - width = ComputeMinHeaderWidth(column); - } - else if ( width == wxLIST_AUTOSIZE ) - { - width = ComputeMinHeaderWidth(column); + wxListCtrlMaxWidthCalculator calculator(this, col); - if ( !IsVirtual() ) + calculator.UpdateWithWidth(AUTOSIZE_COL_MARGIN); + + if ( width == wxLIST_AUTOSIZE_USEHEADER ) + calculator.UpdateWithWidth(ComputeMinHeaderWidth(column)); + + // if the cached column width isn't valid then recalculate it + wxColWidthInfo* const pWidthInfo = m_aColWidths.Item(col); + if ( pWidthInfo->bNeedsUpdate ) { - wxClientDC dc(this); - dc.SetFont( GetFont() ); + size_t first_visible, last_visible; + GetVisibleLinesRange(&first_visible, &last_visible); - int max = AUTOSIZE_COL_MARGIN; - - // if the cached column width isn't valid then recalculate it - if (m_aColWidths.Item(col)->bNeedsUpdate) - { - for (size_t i = 0; i < count; i++) - { - wxListLineData *line = GetLine( i ); - wxListItemDataList::compatibility_iterator n = line->m_items.Item( col ); - - wxCHECK_RET( n, wxT("no subitem?") ); - - wxListItemData *itemData = n->GetData(); - wxListItem item; - - itemData->GetItem(item); - int itemWidth = GetItemWidthWithImage(&item); - if (itemWidth > max) - max = itemWidth; - } - - m_aColWidths.Item(col)->bNeedsUpdate = false; - m_aColWidths.Item(col)->nMaxWidth = max; - } - - max = m_aColWidths.Item(col)->nMaxWidth + AUTOSIZE_COL_MARGIN; - if ( width < max ) - width = max; + calculator.ComputeBestColumnWidth(count, first_visible, last_visible); + pWidthInfo->nMaxWidth = calculator.GetMaxWidth(); + pWidthInfo->bNeedsUpdate = false; } + else + { + calculator.UpdateWithWidth(pWidthInfo->nMaxWidth); + } + + // expand the last column to fit the client size + // only for AUTOSIZE_USEHEADER to mimic MSW behaviour + int margin = 0; + if ( (width == wxLIST_AUTOSIZE_USEHEADER) && (col == GetColumnCount() - 1) ) + { + margin = GetClientSize().GetX(); + for ( int i = 0; i < col && margin > 0; ++i ) + margin -= m_columns.Item(i)->GetData()->GetWidth(); + } + + width = wxMax(margin, calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN); } column->SetWidth( width ); @@ -3296,8 +3367,12 @@ void wxListMainWindow::SetItem( wxListItem &item ) // update the Max Width Cache if needed int width = GetItemWidthWithImage(&item); - if (width > m_aColWidths.Item(item.m_col)->nMaxWidth) - m_aColWidths.Item(item.m_col)->nMaxWidth = width; + wxColWidthInfo* const pWidthInfo = m_aColWidths.Item(item.m_col); + if ( width > pWidthInfo->nMaxWidth ) + { + pWidthInfo->nMaxWidth = width; + pWidthInfo->bNeedsUpdate = true; + } } } @@ -3624,6 +3699,58 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const return true; } +// ---------------------------------------------------------------------------- +// checkboxes +// ---------------------------------------------------------------------------- + +bool wxListMainWindow::HasCheckboxes() const +{ + return m_hasCheckboxes; +} + +bool wxListMainWindow::EnableCheckboxes(bool enable) +{ + m_hasCheckboxes = enable; + + m_dirty = true; + m_headerWidth = 0; + Refresh(); + + return true; +} + +void wxListMainWindow::CheckItem(long item, bool state) +{ + wxListLineData *line = GetLine((size_t)item); + line->Check(state); + + RefreshLine(item); + + SendNotify(item, state ? wxEVT_LIST_ITEM_CHECKED + : wxEVT_LIST_ITEM_UNCHECKED); +} + +bool wxListMainWindow::IsItemChecked(long item) const +{ + wxListLineData *line = GetLine((size_t)item); + return line->IsChecked(); +} + +bool wxListMainWindow::IsInsideCheckbox(long item, int x, int y) +{ + if ( HasCheckboxes() ) + { + wxRect lineRect = GetLineRect(item); + wxSize cbSize = wxRendererNative::Get().GetCheckBoxSize(this); + int yOffset = (lineRect.height - cbSize.GetHeight()) / 2; + wxRect rr(wxPoint(MARGIN_AROUND_CHECKBOX, lineRect.y + yOffset), cbSize); + + return rr.Contains(wxPoint(x, y)); + } + + return false; +} + // ---------------------------------------------------------------------------- // geometry calculation // ---------------------------------------------------------------------------- @@ -3940,8 +4067,9 @@ void wxListMainWindow::DeleteItem( long lindex ) itemWidth = GetItemWidthWithImage(&item); - if (itemWidth >= m_aColWidths.Item(i)->nMaxWidth) - m_aColWidths.Item(i)->bNeedsUpdate = true; + wxColWidthInfo *pWidthInfo = m_aColWidths.Item(i); + if ( itemWidth >= pWidthInfo->nMaxWidth ) + pWidthInfo->bNeedsUpdate = true; } ResetVisibleLinesRange(); @@ -4014,6 +4142,13 @@ void wxListMainWindow::DeleteColumn( int col ) void wxListMainWindow::DoDeleteAllItems() { + // We will need to update all columns if any items are inserted again. + if ( InReportView() ) + { + for ( size_t i = 0; i < m_aColWidths.GetCount(); i++ ) + m_aColWidths.Item(i)->bNeedsUpdate = true; + } + if ( IsEmpty() ) // nothing to do - in particular, don't send the event return; @@ -4036,13 +4171,7 @@ void wxListMainWindow::DoDeleteAllItems() } if ( InReportView() ) - { ResetVisibleLinesRange(); - for (size_t i = 0; i < m_aColWidths.GetCount(); i++) - { - m_aColWidths.Item(i)->bNeedsUpdate = true; - } - } m_lines.Clear(); } @@ -4206,7 +4335,10 @@ void wxListMainWindow::InsertItem( wxListItem &item ) int width = GetItemWidthWithImage(&item); item.SetWidth(width); if (width > pWidthInfo->nMaxWidth) + { pWidthInfo->nMaxWidth = width; + pWidthInfo->bNeedsUpdate = true; + } } wxListLineData *line = new wxListLineData(this); @@ -4252,7 +4384,7 @@ long wxListMainWindow::InsertColumn( long col, const wxListItem &item ) if (item.m_width == wxLIST_AUTOSIZE_USEHEADER) column->SetWidth(ComputeMinHeaderWidth(column)); - wxColWidthInfo *colWidthInfo = new wxColWidthInfo(); + wxColWidthInfo *colWidthInfo = new wxColWidthInfo(0, IsVirtual()); bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount()); if ( insert ) @@ -4477,12 +4609,12 @@ wxListMainWindow::PrefixFindItem(size_t idParent, // wxGenericListCtrl // ------------------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl); -BEGIN_EVENT_TABLE(wxGenericListCtrl,wxListCtrlBase) +wxBEGIN_EVENT_TABLE(wxGenericListCtrl,wxListCtrlBase) EVT_SIZE(wxGenericListCtrl::OnSize) EVT_SCROLLWIN(wxGenericListCtrl::OnScroll) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGenericListCtrl::Init() { @@ -4535,7 +4667,7 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() ), wxTAB_TRAVERSAL ); - + #if defined( __WXMAC__ ) static wxFont font( wxOSX_SYSTEM_FONT_SMALL ); m_headerWin->SetFont( font ); @@ -4595,7 +4727,7 @@ wxBorder wxGenericListCtrl::GetDefaultBorder() const return wxBORDER_THEME; } -#if defined(__WXMSW__) && !defined(__WXWINCE__) && !defined(__WXUNIVERSAL__) +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) WXLRESULT wxGenericListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) @@ -4637,6 +4769,36 @@ void wxGenericListCtrl::OnScroll(wxScrollWinEvent& event) event.Skip(); } +bool wxGenericListCtrl::HasCheckboxes() const +{ + if (!InReportView()) + return false; + + return m_mainWin->HasCheckboxes(); +} + +bool wxGenericListCtrl::EnableCheckboxes(bool enable) +{ + if (!InReportView()) + return false; + + return m_mainWin->EnableCheckboxes(enable); +} + +void wxGenericListCtrl::CheckItem(long item, bool state) +{ + if (InReportView()) + m_mainWin->CheckItem(item, state); +} + +bool wxGenericListCtrl::IsItemChecked(long item) const +{ + if (!InReportView()) + return false; + + return m_mainWin->IsItemChecked(item); +} + void wxGenericListCtrl::SetSingleStyle( long style, bool add ) { wxASSERT_MSG( !(style & wxLC_VIRTUAL), @@ -4875,13 +5037,6 @@ wxSize wxGenericListCtrl::GetItemSpacing() const return wxSize(spacing, spacing); } -#if WXWIN_COMPATIBILITY_2_6 -int wxGenericListCtrl::GetItemSpacing( bool isSmall ) const -{ - return m_mainWin->GetItemSpacing( isSmall ); -} -#endif // WXWIN_COMPATIBILITY_2_6 - void wxGenericListCtrl::SetItemTextColour( long item, const wxColour &col ) { wxListItem info; @@ -5057,6 +5212,11 @@ wxTextCtrl *wxGenericListCtrl::EditLabel(long item, return m_mainWin->EditLabel( item, textControlClass ); } +bool wxGenericListCtrl::EndEditLabel(bool cancel) +{ + return m_mainWin->EndEditLabel(cancel); +} + wxTextCtrl *wxGenericListCtrl::GetEditControl() const { return m_mainWin->GetEditControl(); diff --git a/Externals/wxWidgets3/src/generic/logg.cpp b/Externals/wxWidgets3/src/generic/logg.cpp index 6204463346..36c832d389 100644 --- a/Externals/wxWidgets3/src/generic/logg.cpp +++ b/Externals/wxWidgets3/src/generic/logg.cpp @@ -51,6 +51,7 @@ #include "wx/collpane.h" #include "wx/arrstr.h" #include "wx/msgout.h" +#include "wx/scopeguard.h" #ifdef __WXMSW__ // for OutputDebugString() @@ -58,10 +59,6 @@ #endif // Windows -#ifdef __WXPM__ - #include -#endif - #if wxUSE_LOG_DIALOG #include "wx/listctrl.h" #include "wx/imaglist.h" @@ -70,9 +67,6 @@ #include "wx/time.h" -// the suffix we add to the button to show that the dialog can be expanded -#define EXPAND_SUFFIX wxT(" >>") - #define CAN_SAVE_FILES (wxUSE_FILE && wxUSE_FILEDLG) // ---------------------------------------------------------------------------- @@ -157,11 +151,11 @@ private: // the maximum length of the log message static size_t ms_maxLength; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxLogDialog); }; -BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxLogDialog, wxDialog) EVT_BUTTON(wxID_OK, wxLogDialog::OnOk) #if wxUSE_CLIPBOARD EVT_BUTTON(wxID_COPY, wxLogDialog::OnCopy) @@ -170,7 +164,7 @@ BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave) #endif // CAN_SAVE_FILES EVT_LIST_ITEM_ACTIVATED(wxID_ANY, wxLogDialog::OnListItemActivated) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #endif // wxUSE_LOG_DIALOG @@ -236,7 +230,7 @@ wxString wxLogGui::GetTitle() const default: wxFAIL_MSG( "unexpected icon severity" ); - // fall through + wxFALLTHROUGH; case wxICON_INFORMATION: titleFormat = _("%s Information"); @@ -311,6 +305,10 @@ void wxLogGui::Flush() // showing right now: nested modal dialogs make for really bad UI! Suspend(); + // and ensure that we allow showing the log again afterwards, even if an + // exception is thrown + wxON_BLOCK_EXIT0(wxLog::Resume); + if ( nMsgCount == 1 ) { // make a copy before calling Clear() @@ -333,9 +331,6 @@ void wxLogGui::Flush() DoShowMultipleLogMessages(messages, severities, times, title, style); } - - // allow flushing the logs again - Resume(); } // log all kinds of messages @@ -346,7 +341,6 @@ void wxLogGui::DoLogRecord(wxLogLevel level, switch ( level ) { case wxLOG_Info: - if ( GetVerbose() ) case wxLOG_Message: { m_aMessages.Add(msg); @@ -394,7 +388,7 @@ void wxLogGui::DoLogRecord(wxLogLevel level, #endif // wxUSE_LOG_DIALOG m_bErrors = true; } - // fall through + wxFALLTHROUGH; case wxLOG_Warning: if ( !m_bErrors ) { @@ -448,7 +442,7 @@ public: virtual ~wxLogFrame(); // Don't prevent the application from exiting if just this frame remains. - virtual bool ShouldPreventAppExit() const { return false; } + virtual bool ShouldPreventAppExit() const wxOVERRIDE { return false; } // menu callbacks void OnClose(wxCommandEvent& event); @@ -479,11 +473,11 @@ private: wxTextCtrl *m_pTextCtrl; wxLogWindow *m_log; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxLogFrame); }; -BEGIN_EVENT_TABLE(wxLogFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxLogFrame, wxFrame) // wxLogWindow menu events EVT_MENU(Menu_Close, wxLogFrame::OnClose) #if CAN_SAVE_FILES @@ -492,7 +486,7 @@ BEGIN_EVENT_TABLE(wxLogFrame, wxFrame) EVT_MENU(Menu_Clear, wxLogFrame::OnClear) EVT_CLOSE(wxLogFrame::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxLogFrame::wxLogFrame(wxWindow *pParent, wxLogWindow *log, const wxString& szTitle) : wxFrame(pParent, wxID_ANY, szTitle) @@ -687,9 +681,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, // happens to pop up a Log message while translating this :-) ms_details = wxTRANSLATE("&Details"); ms_details = wxGetTranslation(ms_details); -#ifdef __SMARTPHONE__ - ms_details = wxStripMenuCodes(ms_details); -#endif } if ( ms_maxLength == 0 ) @@ -744,8 +735,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, // add the details pane -#ifndef __SMARTPHONE__ - #if wxUSE_COLLPANE wxCollapsiblePane * const collpane = new wxCollapsiblePane(this, wxID_ANY, ms_details); @@ -781,10 +770,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, win->SetSizer(paneSz); paneSz->SetSizeHints(win); -#else // __SMARTPHONE__ - SetLeftMenu(wxID_OK); - SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX); -#endif // __SMARTPHONE__/!__SMARTPHONE__ SetSizerAndFit(sizerTop); @@ -810,11 +795,6 @@ void wxLogDialog::CreateDetailsControls(wxWindow *parent) wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL); -#ifdef __WXWINCE__ - // This makes a big aesthetic difference on WinCE but I - // don't want to risk problems on other platforms - m_listctrl->Hide(); -#endif // no need to translate these strings as they're not shown to the // user anyhow (we use wxLC_NO_HEADER style) diff --git a/Externals/wxWidgets3/src/generic/markuptext.cpp b/Externals/wxWidgets3/src/generic/markuptext.cpp index 03c587c91a..6516e791c0 100644 --- a/Externals/wxWidgets3/src/generic/markuptext.cpp +++ b/Externals/wxWidgets3/src/generic/markuptext.cpp @@ -59,7 +59,7 @@ public: const wxSize& GetSize() const { return m_size; } - virtual void OnText(const wxString& text_) + virtual void OnText(const wxString& text_) wxOVERRIDE { const wxString text(wxControl::RemoveMnemonics(text_)); @@ -79,12 +79,12 @@ public: } } - virtual void OnAttrStart(const Attr& attr) + virtual void OnAttrStart(const Attr& attr) wxOVERRIDE { m_dc.SetFont(attr.font); } - virtual void OnAttrEnd(const Attr& WXUNUSED(attr)) + virtual void OnAttrEnd(const Attr& WXUNUSED(attr)) wxOVERRIDE { m_dc.SetFont(GetFont()); } @@ -132,7 +132,7 @@ public: m_origTextBackground = dc.GetTextBackground(); } - virtual void OnText(const wxString& text_) + virtual void OnText(const wxString& text_) wxOVERRIDE { wxString text; int indexAccel = wxControl::FindAccelIndex(text_, &text); @@ -161,7 +161,7 @@ public: m_pos += bounds.width; } - virtual void OnAttrStart(const Attr& attr) + virtual void OnAttrStart(const Attr& attr) wxOVERRIDE { m_dc.SetFont(attr.font); if ( attr.foreground.IsOk() ) @@ -176,7 +176,7 @@ public: } } - virtual void OnAttrEnd(const Attr& attr) + virtual void OnAttrEnd(const Attr& attr) wxOVERRIDE { // We always restore the font because we always change it... m_dc.SetFont(GetFont()); diff --git a/Externals/wxWidgets3/src/generic/mask.cpp b/Externals/wxWidgets3/src/generic/mask.cpp index 504a462855..27fbbc6e96 100644 --- a/Externals/wxWidgets3/src/generic/mask.cpp +++ b/Externals/wxWidgets3/src/generic/mask.cpp @@ -33,7 +33,7 @@ // wxMask implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject); void wxMask::FreeData() { diff --git a/Externals/wxWidgets3/src/generic/mdig.cpp b/Externals/wxWidgets3/src/generic/mdig.cpp index c4a9a21f7b..a4f2117104 100644 --- a/Externals/wxWidgets3/src/generic/mdig.cpp +++ b/Externals/wxWidgets3/src/generic/mdig.cpp @@ -51,14 +51,14 @@ enum MDI_MENU_ID // wxGenericMDIParentFrame //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericMDIParentFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericMDIParentFrame, wxFrame); -BEGIN_EVENT_TABLE(wxGenericMDIParentFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxGenericMDIParentFrame, wxFrame) EVT_CLOSE(wxGenericMDIParentFrame::OnClose) #if wxUSE_MENUS EVT_MENU(wxID_ANY, wxGenericMDIParentFrame::OnWindowMenu) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGenericMDIParentFrame::Init() { @@ -379,13 +379,13 @@ bool wxGenericMDIParentFrame::ProcessEvent(wxEvent& event) // wxGenericMDIChildFrame // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericMDIChildFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericMDIChildFrame, wxFrame); -BEGIN_EVENT_TABLE(wxGenericMDIChildFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxGenericMDIChildFrame, wxFrame) EVT_MENU_HIGHLIGHT_ALL(wxGenericMDIChildFrame::OnMenuHighlight) EVT_CLOSE(wxGenericMDIChildFrame::OnClose) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGenericMDIChildFrame::Init() { @@ -525,7 +525,7 @@ bool wxGenericMDIChildFrame::TryAfter(wxEvent& event) // wxGenericMDIClientWindow // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericMDIClientWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericMDIClientWindow, wxWindow); bool wxGenericMDIClientWindow::CreateGenericClient(wxWindow *parent) diff --git a/Externals/wxWidgets3/src/generic/msgdlgg.cpp b/Externals/wxWidgets3/src/generic/msgdlgg.cpp index 5fbded43cc..132a00d90c 100644 --- a/Externals/wxWidgets3/src/generic/msgdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/msgdlgg.cpp @@ -57,7 +57,7 @@ public: } protected: - virtual wxWindow *OnCreateLine(const wxString& s) + virtual wxWindow *OnCreateLine(const wxString& s) wxOVERRIDE { wxWindow * const win = wxTextSizerWrapper::OnCreateLine(s); @@ -71,14 +71,14 @@ protected: // icons // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) +wxBEGIN_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() +wxEND_EVENT_TABLE() -IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) +wxIMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog); wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString& message, @@ -96,7 +96,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() { -#ifndef __SMARTPHONE__ if ( HasCustomLabels() ) { wxStdDialogButtonSizer * const sizerStd = new wxStdDialogButtonSizer; @@ -151,7 +150,6 @@ wxSizer *wxGenericMessageDialog::CreateMsgDlgButtonSizer() return CreateSeparatedSizer(sizerStd); } -#endif // !__SMARTPHONE__ // Use standard labels for all buttons return CreateSeparatedButtonSizer diff --git a/Externals/wxWidgets3/src/generic/notebook.cpp b/Externals/wxWidgets3/src/generic/notebook.cpp index 8caf0cda1e..01c4e29fdb 100644 --- a/Externals/wxWidgets3/src/generic/notebook.cpp +++ b/Externals/wxWidgets3/src/generic/notebook.cpp @@ -48,14 +48,14 @@ // event table // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange) EVT_SIZE(wxNotebook::OnSize) EVT_PAINT(wxNotebook::OnPaint) EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent) EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -74,7 +74,7 @@ WX_DECLARE_HASH_MAP(wxNotebookPage*, int, wxPointerHash, wxPointerEqual, // This reuses wxTabView to draw the tabs. class WXDLLEXPORT wxNotebookTabView: public wxTabView { -DECLARE_DYNAMIC_CLASS(wxNotebookTabView) + wxDECLARE_DYNAMIC_CLASS(wxNotebookTabView); public: wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); virtual ~wxNotebookTabView(void); @@ -673,7 +673,7 @@ wxRect wxNotebook::GetAvailableClientSize() * wxNotebookTabView */ -IMPLEMENT_CLASS(wxNotebookTabView, wxTabView) +wxIMPLEMENT_CLASS(wxNotebookTabView, wxTabView); wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style) : wxTabView(style), m_nextid(1) diff --git a/Externals/wxWidgets3/src/generic/notifmsgg.cpp b/Externals/wxWidgets3/src/generic/notifmsgg.cpp index c941cfa39b..0d5b3c1461 100644 --- a/Externals/wxWidgets3/src/generic/notifmsgg.cpp +++ b/Externals/wxWidgets3/src/generic/notifmsgg.cpp @@ -22,120 +22,242 @@ #pragma hdrstop #endif -#ifndef wxUSE_LIBHILDON - #define wxUSE_LIBHILDON 0 -#endif - -#ifndef wxUSE_LIBHILDON2 - #define wxUSE_LIBHILDON2 0 -#endif - -#if wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2) +#if wxUSE_NOTIFICATION_MESSAGE #ifndef WX_PRECOMP - #include "wx/dialog.h" + #include "wx/frame.h" #include "wx/timer.h" #include "wx/sizer.h" #include "wx/statbmp.h" + #include "wx/settings.h" + #include "wx/panel.h" #endif //WX_PRECOMP #include "wx/artprov.h" +#include "wx/bmpbuttn.h" // even if the platform has the native implementation, we still normally want -// to use the generic one (unless it's totally unsuitable for the target UI as -// is the case of Hildon) because it may provide more features, so include +// to use the generic one (unless it's totally unsuitable for the target UI) +// because it may provide more features, so include // wx/generic/notifmsg.h to get wxGenericNotificationMessage declaration even // if wx/notifmsg.h only declares wxNotificationMessage itself (if it already // uses the generic version, the second inclusion will do no harm) #include "wx/notifmsg.h" #include "wx/generic/notifmsg.h" +#include "wx/generic/private/notifmsg.h" +#include "wx/display.h" +#include "wx/textwrapper.h" // ---------------------------------------------------------------------------- -// wxNotificationMessageDialog +// wxNotificationMessageWindow // ---------------------------------------------------------------------------- -class wxNotificationMessageDialog : public wxDialog +class wxNotificationMessageWindow : public wxFrame { public: - wxNotificationMessageDialog(wxWindow *parent, - const wxString& text, - int timeout, - int flags); + wxNotificationMessageWindow(wxGenericNotificationMessageImpl* notificationImpl); - void Set(wxWindow *parent, - const wxString& text, - int timeout, - int flags); + virtual ~wxNotificationMessageWindow(); - bool IsAutomatic() const { return m_timer.IsRunning(); } - void SetDeleteOnHide() { m_deleteOnHide = true; } + void Set(int timeout); + + bool Hide(); + + void SetMessageTitle(const wxString& title); + + void SetMessage(const wxString& message); + + void SetMessageIcon(const wxIcon& icon); + + bool AddAction(wxWindowID actionid, const wxString &label); private: void OnClose(wxCloseEvent& event); void OnTimer(wxTimerEvent& event); + void OnNotificationClicked(wxMouseEvent& event); + void OnNotificationMouseEnter(wxMouseEvent& event); + void OnNotificationMouseLeave(wxMouseEvent& event); + void OnCloseClicked(wxCommandEvent& event); + void OnActionButtonClicked(wxCommandEvent& event); - // if true, delete the dialog when it should disappear, otherwise just hide - // it (initially false) - bool m_deleteOnHide; + // Dialog elements + wxPanel* m_messagePanel; + wxStaticBitmap* m_messageBmp; + wxStaticText* m_messageText; + wxStaticText* m_messageTitle; + wxBitmapButton* m_closeBtn; + wxBoxSizer* m_buttonSizer; - // timer which will hide this dialog when it expires, if it's not running - // it means we were created without timeout wxTimer m_timer; + int m_timeout; + long m_timeoutTargetTime; + int m_mouseActiveCount; + wxGenericNotificationMessageImpl* m_notificationImpl; - DECLARE_EVENT_TABLE() - wxDECLARE_NO_COPY_CLASS(wxNotificationMessageDialog); + void PrepareNotificationControl(wxWindow* ctrl, bool handleClick = true); + + static wxPoint ms_presentationPos; + + static int ms_presentationDirection; + + static wxVector ms_visibleNotifications; + + static void AddVisibleNotification(wxNotificationMessageWindow* notif); + + static void RemoveVisibleNotification(wxNotificationMessageWindow* notif); + + static void ResizeAndFitVisibleNotifications(); + + wxDECLARE_EVENT_TABLE(); + wxDECLARE_NO_COPY_CLASS(wxNotificationMessageWindow); }; +int wxNotificationMessageWindow::ms_presentationDirection = 0; +wxPoint wxNotificationMessageWindow::ms_presentationPos = wxDefaultPosition; + // ============================================================================ -// wxNotificationMessageDialog implementation +// wxNotificationMessageWindow implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxNotificationMessageDialog, wxDialog) - EVT_CLOSE(wxNotificationMessageDialog::OnClose) +wxBEGIN_EVENT_TABLE(wxNotificationMessageWindow, wxFrame) + EVT_CLOSE(wxNotificationMessageWindow::OnClose) - EVT_TIMER(wxID_ANY, wxNotificationMessageDialog::OnTimer) -END_EVENT_TABLE() + EVT_TIMER(wxID_ANY, wxNotificationMessageWindow::OnTimer) +wxEND_EVENT_TABLE() -wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent, - const wxString& text, - int timeout, - int flags) - : wxDialog(parent, wxID_ANY, _("Notice"), +wxVector wxNotificationMessageWindow::ms_visibleNotifications; + +wxNotificationMessageWindow::wxNotificationMessageWindow(wxGenericNotificationMessageImpl* notificationImpl) + : wxFrame(NULL, wxID_ANY, _("Notice"), wxDefaultPosition, wxDefaultSize, - 0 /* no caption, no border styles */), - m_timer(this) + wxBORDER_NONE | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP /* no caption, no border styles */), + m_timer(this), + m_mouseActiveCount(0), + m_notificationImpl(notificationImpl) { - m_deleteOnHide = false; + m_buttonSizer = NULL; - Set(parent, text, timeout, flags); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); + + m_messagePanel = new wxPanel(this, wxID_ANY); + wxSizer * const msgSizer = new wxBoxSizer(wxHORIZONTAL); + m_messagePanel->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + m_messagePanel->SetSizer(msgSizer); + PrepareNotificationControl(m_messagePanel); + + // Add message icon to layout + m_messageBmp = new wxStaticBitmap + ( + m_messagePanel, + wxID_ANY, + wxArtProvider::GetMessageBoxIcon(wxICON_INFORMATION) + ); + m_messageBmp->Hide(); + PrepareNotificationControl(m_messageBmp); + msgSizer->Add(m_messageBmp, wxSizerFlags().Centre().DoubleBorder()); + + // Create title and message sizers + wxSizer* textSizer = new wxBoxSizer(wxVERTICAL); + + m_messageTitle = new wxStaticText(m_messagePanel, wxID_ANY, wxString()); + m_messageTitle->SetFont(m_messageTitle->GetFont().MakeBold()); + textSizer->Add(m_messageTitle, wxSizerFlags(0).Border()); + m_messageTitle->Hide(); + PrepareNotificationControl(m_messageTitle); + + m_messageText = new wxStaticText(m_messagePanel, wxID_ANY, wxString()); + textSizer->Add(m_messageText, wxSizerFlags(0).Border(wxLEFT | wxRIGHT | wxBOTTOM)); + PrepareNotificationControl(m_messageText); + + msgSizer->Add(textSizer, wxSizerFlags(1).Center()); + + // Add a single close button if no actions are specified + m_closeBtn = wxBitmapButton::NewCloseButton(m_messagePanel, wxID_ANY); + msgSizer->Add(m_closeBtn, wxSizerFlags(0).Border(wxALL, 3).Top()); + m_closeBtn->Bind(wxEVT_BUTTON, &wxNotificationMessageWindow::OnCloseClicked, this); + PrepareNotificationControl(m_closeBtn, false); + + wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL); + sizerTop->Add(m_messagePanel, wxSizerFlags().Border(wxALL, FromDIP(1))); + SetSizer(sizerTop); } -void -wxNotificationMessageDialog::Set(wxWindow * WXUNUSED(parent), - const wxString& text, - int timeout, - int flags) +wxNotificationMessageWindow::~wxNotificationMessageWindow() { - wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL); - if ( flags & wxICON_MASK ) + RemoveVisibleNotification(this); +} + +void wxNotificationMessageWindow::PrepareNotificationControl(wxWindow* ctrl, bool handleClick) +{ + ctrl->Bind(wxEVT_ENTER_WINDOW, &wxNotificationMessageWindow::OnNotificationMouseEnter, this); + ctrl->Bind(wxEVT_LEAVE_WINDOW, &wxNotificationMessageWindow::OnNotificationMouseLeave, this); + + if ( handleClick ) + ctrl->Bind(wxEVT_LEFT_DOWN, &wxNotificationMessageWindow::OnNotificationClicked, this); +} + +void wxNotificationMessageWindow::SetMessageTitle(const wxString& title) +{ + m_messageTitle->SetLabelText(title); + m_messageTitle->Show(!title.empty()); +} + +void wxNotificationMessageWindow::SetMessage(const wxString& message) +{ + m_messageText->SetLabelText(message); + m_messageText->Show(!message.empty()); +} + +void wxNotificationMessageWindow::SetMessageIcon(const wxIcon& icon) +{ + m_messageBmp->SetBitmap(icon); + m_messageBmp->Show(icon.IsOk()); +} + +bool wxNotificationMessageWindow::AddAction(wxWindowID actionid, const wxString &label) +{ + wxSizer* msgSizer = m_messagePanel->GetSizer(); + if ( m_buttonSizer == NULL ) { - sizerTop->Add(new wxStaticBitmap - ( - this, - wxID_ANY, - wxArtProvider::GetMessageBoxIcon(flags) - ), - wxSizerFlags().Centre().Border()); + msgSizer->Detach(m_closeBtn); + m_closeBtn->Hide(); + m_buttonSizer = new wxBoxSizer(wxVERTICAL); + msgSizer->Add(m_buttonSizer, wxSizerFlags(0).Center().Border()); } - sizerTop->Add(CreateTextSizer(text), wxSizerFlags(1).Border()); - SetSizerAndFit(sizerTop); + wxButton* actionButton = new wxButton(m_messagePanel, actionid, label); + actionButton->Bind(wxEVT_BUTTON, &wxNotificationMessageWindow::OnActionButtonClicked, this); + PrepareNotificationControl(actionButton, false); + int borderDir = (m_buttonSizer->GetChildren().empty()) ? 0 : wxTOP; + m_buttonSizer->Add(actionButton, wxSizerFlags(0).Border(borderDir).Expand()); + + return true; +} + + +bool wxNotificationMessageWindow::Hide() +{ + if ( m_timer.IsRunning() ) + m_timer.Stop(); + + RemoveVisibleNotification(this); + return wxFrame::HideWithEffect(wxSHOW_EFFECT_BLEND); +} + +void wxNotificationMessageWindow::Set(int timeout) +{ + Layout(); + Fit(); + + AddVisibleNotification(this); if ( timeout != wxGenericNotificationMessage::Timeout_Never ) { // wxTimer uses ms, timeout is in seconds - m_timer.Start(timeout*1000, true /* one shot only */); + m_timer.Start(500); + m_timeout = timeout; + m_timeoutTargetTime = wxGetUTCTime() + timeout; } else if ( m_timer.IsRunning() ) { @@ -143,102 +265,263 @@ wxNotificationMessageDialog::Set(wxWindow * WXUNUSED(parent), } } -void wxNotificationMessageDialog::OnClose(wxCloseEvent& event) +void wxNotificationMessageWindow::OnClose(wxCloseEvent& WXUNUSED(event)) { - if ( m_deleteOnHide ) - { - // we don't need to keep this dialog alive any more - Destroy(); - } - else // don't really close, just hide, as we can be shown again later - { - event.Veto(); + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + m_notificationImpl->ProcessNotificationEvent(evt); - Hide(); + if ( m_timer.IsRunning() ) + m_timer.Stop(); + + m_notificationImpl->Close(); +} + +void wxNotificationMessageWindow::OnTimer(wxTimerEvent& WXUNUSED(event)) +{ + if ( m_mouseActiveCount > 0 ) + { + m_timeoutTargetTime = wxGetUTCTime() + m_timeout; + } + else if ( m_timeoutTargetTime != -1 && + wxGetUTCTime() >= m_timeoutTargetTime ) + { + m_notificationImpl->Close(); } } -void wxNotificationMessageDialog::OnTimer(wxTimerEvent& WXUNUSED(event)) +void wxNotificationMessageWindow::OnNotificationClicked(wxMouseEvent& WXUNUSED(event)) { - if ( m_deleteOnHide ) - Destroy(); - else - Hide(); + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_CLICK); + m_notificationImpl->ProcessNotificationEvent(evt); + + m_notificationImpl->Close(); +} + +void wxNotificationMessageWindow::OnNotificationMouseEnter(wxMouseEvent& WXUNUSED(event)) +{ + m_mouseActiveCount++; +} + +void wxNotificationMessageWindow::OnNotificationMouseLeave(wxMouseEvent& WXUNUSED(event)) +{ + m_mouseActiveCount--; +} + +void wxNotificationMessageWindow::OnCloseClicked(wxCommandEvent& WXUNUSED(event)) +{ + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + m_notificationImpl->ProcessNotificationEvent(evt); + + m_notificationImpl->Close(); +} + +void wxNotificationMessageWindow::OnActionButtonClicked(wxCommandEvent& event) +{ + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_ACTION, event.GetId()); + m_notificationImpl->ProcessNotificationEvent(evt); + + m_notificationImpl->Close(); +} + +void wxNotificationMessageWindow::AddVisibleNotification(wxNotificationMessageWindow* notif) +{ + bool found = false; + for ( wxVector::iterator it = ms_visibleNotifications.begin(); + it != ms_visibleNotifications.end(); it++ ) + { + if ( *it == notif ) + { + found = true; + break; + } + } + + if ( !found ) + ms_visibleNotifications.push_back(notif); + + ResizeAndFitVisibleNotifications(); +} + +void wxNotificationMessageWindow::RemoveVisibleNotification(wxNotificationMessageWindow* notif) +{ + for ( wxVector::iterator it = ms_visibleNotifications.begin(); + it != ms_visibleNotifications.end(); it++ ) + { + if ( *it == notif ) + { + ms_visibleNotifications.erase(it); + break; + } + } + ResizeAndFitVisibleNotifications(); +} + +void wxNotificationMessageWindow::ResizeAndFitVisibleNotifications() +{ + if ( ms_presentationDirection == 0 ) + { + // Determine presentation position + + wxDisplay display; + wxRect clientArea = display.GetClientArea(); + wxRect geom = display.GetGeometry(); + if ( clientArea.y > 0 ) // Taskbar is at top + { + ms_presentationDirection = 1; + ms_presentationPos = clientArea.GetTopRight(); + } + else if ( clientArea.GetHeight() != geom.GetHeight() ) // Taskbar at bottom + { + ms_presentationDirection = -1; + ms_presentationPos = clientArea.GetBottomRight(); + } + else // Default to upper right screen corner with some padding + { + ms_presentationDirection = 1; + ms_presentationPos.x = geom.GetWidth() - 30; + ms_presentationPos.y = 30; + } + } + + int maxWidth = -1; + + // Determine max width + for (wxVector::iterator notif = ms_visibleNotifications.begin(); + notif != ms_visibleNotifications.end(); ++notif) + { + wxSize notifSize = (*notif)->GetSize(); + if ( notifSize.GetWidth() > maxWidth ) + maxWidth = notifSize.GetWidth(); + } + + int notifPadding = 2; + + wxPoint presentPos = ms_presentationPos; + presentPos.x -= notifPadding + maxWidth; + + int prevNotifHeight = 0; + + for (wxVector::iterator notif = ms_visibleNotifications.begin(); + notif != ms_visibleNotifications.end(); ++notif) + { + // Modify existing maxwidth + wxSize notifSize = (*notif)->GetSize(); + if ( notifSize.GetWidth() < maxWidth ) + { + notifSize.SetWidth(maxWidth); + (*notif)->SetSize(notifSize); + (*notif)->Layout(); + } + + if ( ms_presentationDirection > 0 ) + { + presentPos.y += (notifPadding + prevNotifHeight); + prevNotifHeight = notifSize.GetHeight(); + } + else + { + presentPos.y -= (notifPadding + notifSize.GetHeight()); + } + + (*notif)->SetPosition(presentPos); + } } // ============================================================================ // wxGenericNotificationMessage implementation // ============================================================================ -int wxGenericNotificationMessage::ms_timeout = 10; - /* static */ void wxGenericNotificationMessage::SetDefaultTimeout(int timeout) { - wxASSERT_MSG( timeout > 0, - "negative or zero default timeout doesn't make sense" ); - - ms_timeout = timeout; + wxGenericNotificationMessageImpl::SetDefaultTimeout(timeout); } void wxGenericNotificationMessage::Init() { - m_dialog = NULL; + m_impl = new wxGenericNotificationMessageImpl(this); } -wxGenericNotificationMessage::~wxGenericNotificationMessage() +// ---------------------------------------------------------------------------- +// wxGenericNotificationMessageImpl +// ---------------------------------------------------------------------------- + +int wxGenericNotificationMessageImpl::ms_timeout = 3; + +wxGenericNotificationMessageImpl::wxGenericNotificationMessageImpl(wxNotificationMessageBase* notification) : + wxNotificationMessageImpl(notification) { - if ( m_dialog->IsAutomatic() ) - { - // we want to allow the user to create an automatically hidden - // notification just by creating a local wxGenericNotificationMessage object - // and so we shouldn't hide the notification when this object goes out - // of scope - m_dialog->SetDeleteOnHide(); - } - else // manual dialog, hide it immediately - { - // OTOH for permanently shown dialogs only the code can hide them and - // if the object is deleted, we must do it now as it won't be - // accessible programmatically any more - delete m_dialog; - } + m_window = new wxNotificationMessageWindow(this); } -bool wxGenericNotificationMessage::Show(int timeout) +wxGenericNotificationMessageImpl::~wxGenericNotificationMessageImpl() { - if ( timeout == Timeout_Auto ) + m_window->Destroy(); +} + +/* static */ void wxGenericNotificationMessageImpl::SetDefaultTimeout(int timeout) +{ + wxASSERT_MSG(timeout > 0, + "negative or zero default timeout doesn't make sense"); + + ms_timeout = timeout; +} + +bool wxGenericNotificationMessageImpl::Show(int timeout) +{ + if ( timeout == wxNotificationMessageBase::Timeout_Auto ) { timeout = GetDefaultTimeout(); } - if ( !m_dialog ) - { - m_dialog = new wxNotificationMessageDialog - ( - GetParent(), - GetFullMessage(), - timeout, - GetFlags() - ); - } - else // update the existing dialog - { - m_dialog->Set(GetParent(), GetFullMessage(), timeout, GetFlags()); - } + SetActive(true); + m_window->Set(timeout); - m_dialog->Show(); + m_window->ShowWithEffect(wxSHOW_EFFECT_BLEND); return true; } -bool wxGenericNotificationMessage::Close() +bool wxGenericNotificationMessageImpl::Close() { - if ( !m_dialog ) + if ( !m_window ) return false; - m_dialog->Hide(); + m_window->Hide(); + + SetActive(false); return true; } -#endif // wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2) +void wxGenericNotificationMessageImpl::SetTitle(const wxString& title) +{ + m_window->SetMessageTitle(title); +} + +void wxGenericNotificationMessageImpl::SetMessage(const wxString& message) +{ + m_window->SetMessage(message); +} + +void wxGenericNotificationMessageImpl::SetParent(wxWindow *WXUNUSED(parent)) +{ + +} + +void wxGenericNotificationMessageImpl::SetFlags(int flags) +{ + m_window->SetMessageIcon( wxArtProvider::GetMessageBoxIcon(flags) ); +} + +void wxGenericNotificationMessageImpl::SetIcon(const wxIcon& icon) +{ + m_window->SetMessageIcon(icon); +} + +bool wxGenericNotificationMessageImpl::AddAction(wxWindowID actionid, const wxString &label) +{ + return m_window->AddAction(actionid, label); +} + + +#endif // wxUSE_NOTIFICATION_MESSAGE diff --git a/Externals/wxWidgets3/src/generic/numdlgg.cpp b/Externals/wxWidgets3/src/generic/numdlgg.cpp index 8b742e7edd..17c15f8788 100644 --- a/Externals/wxWidgets3/src/generic/numdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/numdlgg.cpp @@ -61,14 +61,14 @@ // wxNumberEntryDialog // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxNumberEntryDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxNumberEntryDialog, wxDialog) EVT_BUTTON(wxID_OK, wxNumberEntryDialog::OnOK) EVT_BUTTON(wxID_CANCEL, wxNumberEntryDialog::OnCancel) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_CLASS(wxNumberEntryDialog, wxDialog) +wxIMPLEMENT_CLASS(wxNumberEntryDialog, wxDialog); -wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, +bool wxNumberEntryDialog::Create(wxWindow *parent, const wxString& message, const wxString& prompt, const wxString& caption, @@ -76,10 +76,14 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, long min, long max, const wxPoint& pos) - : wxDialog(GetParentForModalDialog(parent, 0), - wxID_ANY, caption, - pos, wxDefaultSize) { + if ( !wxDialog::Create(GetParentForModalDialog(parent, 0), + wxID_ANY, caption, + pos, wxDefaultSize) ) + { + return false; + } + m_value = value; m_max = max; m_min = min; @@ -104,7 +108,11 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, // spin ctrl wxString valStr; valStr.Printf(wxT("%ld"), m_value); +#if wxUSE_SPINCTRL m_spinctrl = new wxSpinCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord ), wxSP_ARROW_KEYS, (int)m_min, (int)m_max, (int)m_value); +#else + m_spinctrl = new wxTextCtrl(this, wxID_ANY, valStr, wxDefaultPosition, wxSize( 140, wxDefaultCoord )); +#endif inputsizer->Add( m_spinctrl, 1, wxCENTER | wxLEFT | wxRIGHT, 10 ); // add both topsizer->Add( inputsizer, 0, wxEXPAND | wxLEFT|wxRIGHT, 5 ); @@ -128,6 +136,8 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, m_spinctrl->SetFocus(); wxEndBusyCursor(); + + return true; } void wxNumberEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event)) diff --git a/Externals/wxWidgets3/src/generic/odcombo.cpp b/Externals/wxWidgets3/src/generic/odcombo.cpp index d48bf5a085..71cc3ad5f8 100644 --- a/Externals/wxWidgets3/src/generic/odcombo.cpp +++ b/Externals/wxWidgets3/src/generic/odcombo.cpp @@ -50,12 +50,12 @@ // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxVListBoxComboPopup, wxVListBox) +wxBEGIN_EVENT_TABLE(wxVListBoxComboPopup, wxVListBox) EVT_MOTION(wxVListBoxComboPopup::OnMouseMove) EVT_KEY_DOWN(wxVListBoxComboPopup::OnKey) EVT_CHAR(wxVListBoxComboPopup::OnChar) EVT_LEFT_UP(wxVListBoxComboPopup::OnLeftClick) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxVListBoxComboPopup::Init() @@ -587,6 +587,7 @@ void wxVListBoxComboPopup::ClearClientDatas() } m_clientDatas.Empty(); + m_clientDataItemsType = wxClientData_None; } void wxVListBoxComboPopup::SetItemClientData( unsigned int n, @@ -877,8 +878,8 @@ void wxVListBoxComboPopup::Populate( const wxArrayString& choices ) // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboCtrl) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxOwnerDrawnComboBox, wxComboCtrl) +wxEND_EVENT_TABLE() void wxOwnerDrawnComboBox::Init() { @@ -998,6 +999,7 @@ void wxOwnerDrawnComboBox::DoClear() void wxOwnerDrawnComboBox::Clear() { DoClear(); + SetClientDataType(wxClientData_None); } void wxOwnerDrawnComboBox::DoDeleteOneItem(unsigned int n) diff --git a/Externals/wxWidgets3/src/generic/paletteg.cpp b/Externals/wxWidgets3/src/generic/paletteg.cpp index 746f3cedc3..41de19195a 100644 --- a/Externals/wxWidgets3/src/generic/paletteg.cpp +++ b/Externals/wxWidgets3/src/generic/paletteg.cpp @@ -61,7 +61,7 @@ wxPaletteRefData::~wxPaletteRefData() #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject); wxPalette::wxPalette() { diff --git a/Externals/wxWidgets3/src/generic/preferencesg.cpp b/Externals/wxWidgets3/src/generic/preferencesg.cpp index 97236af305..fc6fc0cc34 100644 --- a/Externals/wxWidgets3/src/generic/preferencesg.cpp +++ b/Externals/wxWidgets3/src/generic/preferencesg.cpp @@ -48,11 +48,9 @@ public: wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)) { - SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); - wxSizer *sizer = new wxBoxSizer(wxVERTICAL); - m_notebook = new wxNotebook(this, wxID_ANY); + m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_MULTILINE); sizer->Add(m_notebook, wxSizerFlags(1).Expand().DoubleBorder()); #ifdef __WXGTK__ @@ -81,6 +79,11 @@ public: m_notebook->ChangeSelection(page); } + bool ShouldPreventAppExit() const wxOVERRIDE + { + return false; + } + private: wxNotebook *m_notebook; }; diff --git a/Externals/wxWidgets3/src/generic/printps.cpp b/Externals/wxWidgets3/src/generic/printps.cpp index 00de8a9666..cedf7278f7 100644 --- a/Externals/wxWidgets3/src/generic/printps.cpp +++ b/Externals/wxWidgets3/src/generic/printps.cpp @@ -48,8 +48,8 @@ // wxWin macros // ---------------------------------------------------------------------------- - IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase) - IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase) + wxIMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase); + wxIMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase); // ============================================================================ // implementation diff --git a/Externals/wxWidgets3/src/generic/prntdlgg.cpp b/Externals/wxWidgets3/src/generic/prntdlgg.cpp index 41d3dda771..5140283de9 100644 --- a/Externals/wxWidgets3/src/generic/prntdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/prntdlgg.cpp @@ -82,7 +82,7 @@ extern wxPrintPaperDatabase *wxThePrintPaperDatabase; // wxPostScriptNativeData //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPostScriptPrintNativeData, wxPrintNativeDataBase) +wxIMPLEMENT_CLASS(wxPostScriptPrintNativeData, wxPrintNativeDataBase); wxPostScriptPrintNativeData::wxPostScriptPrintNativeData() { @@ -129,13 +129,13 @@ bool wxPostScriptPrintNativeData::TransferFrom( const wxPrintData &WXUNUSED(data // Generic print dialog for non-Windows printing use. // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGenericPrintDialog, wxPrintDialogBase) +wxIMPLEMENT_CLASS(wxGenericPrintDialog, wxPrintDialogBase); -BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxPrintDialogBase) +wxBEGIN_EVENT_TABLE(wxGenericPrintDialog, wxPrintDialogBase) EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK) EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup) EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent, wxPrintDialogData* data) @@ -439,11 +439,11 @@ wxDC *wxGenericPrintDialog::GetPrintDC() // Generic print setup dialog // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog) +wxIMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog); -BEGIN_EVENT_TABLE(wxGenericPrintSetupDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericPrintSetupDialog, wxDialog) EVT_LIST_ITEM_ACTIVATED(wxPRINTID_PRINTER, wxGenericPrintSetupDialog::OnPrinter) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGenericPrintSetupDialog::wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data): wxDialog(parent, wxID_ANY, _("Print Setup"), wxPoint(0,0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL) @@ -815,11 +815,11 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice() // Generic page setup dialog // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxPageSetupDialogBase) +wxIMPLEMENT_CLASS(wxGenericPageSetupDialog, wxPageSetupDialogBase); -BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxPageSetupDialogBase) +wxBEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxPageSetupDialogBase) EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, wxPageSetupDialogData* data) diff --git a/Externals/wxWidgets3/src/generic/progdlgg.cpp b/Externals/wxWidgets3/src/generic/progdlgg.cpp index 7b6fd4701b..e61586b2c9 100644 --- a/Externals/wxWidgets3/src/generic/progdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/progdlgg.cpp @@ -43,25 +43,11 @@ #include "wx/progdlg.h" #include "wx/evtloop.h" -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -/* Macro for avoiding #ifdefs when value have to be different depending on size of - device we display on - take it from something like wxDesktopPolicy in the future - */ - -#if defined(__SMARTPHONE__) - #define wxLARGESMALL(large,small) small -#else - #define wxLARGESMALL(large,small) large -#endif - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- -#define LAYOUT_MARGIN wxLARGESMALL(8,2) +#define LAYOUT_MARGIN 8 static const int wxID_SKIP = 32000; // whatever @@ -69,12 +55,12 @@ static const int wxID_SKIP = 32000; // whatever // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericProgressDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxGenericProgressDialog, wxDialog) EVT_BUTTON(wxID_CANCEL, wxGenericProgressDialog::OnCancel) EVT_BUTTON(wxID_SKIP, wxGenericProgressDialog::OnSkip) EVT_CLOSE(wxGenericProgressDialog::OnClose) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxGenericProgressDialog implementation @@ -112,10 +98,8 @@ void wxGenericProgressDialog::Init() m_skip = false; -#if !defined(__SMARTPHONE__) m_btnAbort = m_btnSkip = NULL; -#endif m_display_estimated = m_last_timeupdate = @@ -125,6 +109,8 @@ void wxGenericProgressDialog::Init() m_winDisabler = NULL; m_tempEventLoop = NULL; + + SetWindowStyle(wxDEFAULT_DIALOG_STYLE); } wxGenericProgressDialog::wxGenericProgressDialog() @@ -164,7 +150,7 @@ bool wxGenericProgressDialog::Create( const wxString& title, wxWindow* const realParent = GetParentForModalDialog(parent, GetWindowStyle()); - if (!wxDialog::Create(realParent, wxID_ANY, title)) + if (!wxDialog::Create(realParent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, GetWindowStyle())) return false; SetMaximum(maximum); @@ -191,21 +177,18 @@ bool wxGenericProgressDialog::Create( const wxString& title, } #endif // wxMSW -#if defined(__SMARTPHONE__) - SetLeftMenu(); -#endif - m_state = HasPDFlag(wxPD_CAN_ABORT) ? Continue : Uncancelable; // top-level sizerTop wxSizer * const sizerTop = new wxBoxSizer(wxVERTICAL); m_msg = new wxStaticText(this, wxID_ANY, message); - sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); + sizerTop->Add(m_msg, 0, wxLEFT | wxRIGHT | wxTOP, 2*LAYOUT_MARGIN); int gauge_style = wxGA_HORIZONTAL; if ( style & wxPD_SMOOTH ) gauge_style |= wxGA_SMOOTH; + gauge_style |= wxGA_PROGRESS; #ifdef __WXMSW__ maximum /= m_factor; @@ -257,45 +240,33 @@ bool wxGenericProgressDialog::Create( const wxString& title, } sizerTop->Add(sizerLabels, 0, wxALIGN_CENTER_HORIZONTAL | wxTOP, LAYOUT_MARGIN); -#if defined(__SMARTPHONE__) - if ( HasPDFlag(wxPD_CAN_SKIP) ) - SetRightMenu(wxID_SKIP, _("Skip")); - if ( HasPDFlag(wxPD_CAN_ABORT) ) - SetLeftMenu(wxID_CANCEL); -#else - m_btnAbort = - m_btnSkip = NULL; + wxStdDialogButtonSizer *buttonSizer = wxDialog::CreateStdDialogButtonSizer(0); - wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL); + const int borderFlags = wxALL; - // Windows dialogs usually have buttons in the lower right corner - const int sizerFlags = -#if defined(__WXMSW__) || defined(__WXPM__) || defined(__WXOSX__) - wxALIGN_RIGHT | wxALL -#else // !MSW - wxALIGN_CENTER_HORIZONTAL | wxBOTTOM | wxTOP -#endif // MSW/!MSW - ; + wxSizerFlags sizerFlags + = wxSizerFlags().Border(borderFlags, LAYOUT_MARGIN); if ( HasPDFlag(wxPD_CAN_SKIP) ) { m_btnSkip = new wxButton(this, wxID_SKIP, _("&Skip")); - buttonSizer->Add(m_btnSkip, 0, sizerFlags, LAYOUT_MARGIN); + buttonSizer->SetNegativeButton(m_btnSkip); } if ( HasPDFlag(wxPD_CAN_ABORT) ) { m_btnAbort = new wxButton(this, wxID_CANCEL); - buttonSizer->Add(m_btnAbort, 0, sizerFlags, LAYOUT_MARGIN); + buttonSizer->SetCancelButton(m_btnAbort); } if ( !HasPDFlag(wxPD_CAN_SKIP | wxPD_CAN_ABORT) ) buttonSizer->AddSpacer(LAYOUT_MARGIN); - sizerTop->Add(buttonSizer, 0, sizerFlags, LAYOUT_MARGIN ); -#endif // __SMARTPHONE__/!__SMARTPHONE__ + buttonSizer->Realize(); + + sizerTop->Add(buttonSizer, sizerFlags.Expand()); SetSizerAndFit(sizerTop); @@ -399,13 +370,9 @@ wxGenericProgressDialog::CreateLabel(const wxString& text, wxSizer *sizer) wxStaticText *value = new wxStaticText(this, wxID_ANY, _("unknown")); // select placement most native or nice on target GUI -#if defined(__SMARTPHONE__) - // value and time to the left in two rows - sizer->Add(label, 1, wxALIGN_LEFT); - sizer->Add(value, 1, wxALIGN_LEFT); -#elif defined(__WXMSW__) || defined(__WXPM__) || defined(__WXMAC__) || defined(__WXGTK20__) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK20__) // value and time centered in one row - sizer->Add(label, 1, wxLARGESMALL(wxALIGN_RIGHT,wxALIGN_LEFT) | wxTOP | wxRIGHT, LAYOUT_MARGIN); + sizer->Add(label, 1, wxALIGN_RIGHT | wxTOP | wxRIGHT, LAYOUT_MARGIN); sizer->Add(value, 1, wxALIGN_LEFT | wxTOP, LAYOUT_MARGIN); #else // value and time to the right in one row @@ -620,7 +587,7 @@ void wxGenericProgressDialog::SetMaximum(int maximum) { m_maximum = maximum; -#if defined(__WXMSW__) || defined(__WXPM__) +#if defined(__WXMSW__) // we can't have values > 65,536 in the progress control under Windows, so // scale everything down m_factor = m_maximum / 65536 + 1; @@ -768,15 +735,8 @@ void wxGenericProgressDialog::EnableSkip(bool enable) { if ( HasPDFlag(wxPD_CAN_SKIP) ) { -#ifdef __SMARTPHONE__ - if(enable) - SetRightMenu(wxID_SKIP, _("Skip")); - else - SetRightMenu(); -#else if(m_btnSkip) m_btnSkip->Enable(enable); -#endif } } @@ -784,15 +744,8 @@ void wxGenericProgressDialog::EnableAbort(bool enable) { if( HasPDFlag(wxPD_CAN_ABORT) ) { -#ifdef __SMARTPHONE__ - if(enable) - SetLeftMenu(wxID_CANCEL); // stock buttons makes Cancel label - else - SetLeftMenu(); -#else if(m_btnAbort) m_btnAbort->Enable(enable); -#endif } } @@ -800,15 +753,11 @@ void wxGenericProgressDialog::EnableClose() { if(HasPDFlag(wxPD_CAN_ABORT)) { -#ifdef __SMARTPHONE__ - SetLeftMenu(wxID_CANCEL, _("Close")); -#else if(m_btnAbort) { m_btnAbort->Enable(); m_btnAbort->SetLabel(_("Close")); } -#endif } } diff --git a/Externals/wxWidgets3/src/generic/propdlg.cpp b/Externals/wxWidgets3/src/generic/propdlg.cpp index d33530a831..264a194dec 100644 --- a/Externals/wxWidgets3/src/generic/propdlg.cpp +++ b/Externals/wxWidgets3/src/generic/propdlg.cpp @@ -50,12 +50,11 @@ // wxPropertySheetDialog //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialog, wxDialog); -BEGIN_EVENT_TABLE(wxPropertySheetDialog, wxDialog) - EVT_ACTIVATE(wxPropertySheetDialog::OnActivate) +wxBEGIN_EVENT_TABLE(wxPropertySheetDialog, wxDialog) EVT_IDLE(wxPropertySheetDialog::OnIdle) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& sz, long style, @@ -72,9 +71,6 @@ bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxStri // This gives more space around the edges m_innerSizer = new wxBoxSizer( wxVERTICAL ); -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - m_sheetOuterBorder = 0; -#endif topSizer->Add(m_innerSizer, 1, wxGROW|wxALL, m_sheetOuterBorder); m_bookCtrl = CreateBookCtrl(); @@ -95,41 +91,21 @@ void wxPropertySheetDialog::Init() // Layout the dialog, to be called after pages have been created void wxPropertySheetDialog::LayoutDialog(int centreFlags) { -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); if (centreFlags) Centre(centreFlags); -#else - wxUnusedVar(centreFlags); -#endif -#if defined(__SMARTPHONE__) - if (m_bookCtrl) - m_bookCtrl->SetFocus(); -#endif } // Creates the buttons, if any void wxPropertySheetDialog::CreateButtons(int flags) { -#ifdef __POCKETPC__ - // keep system option status - const wxChar *optionName = wxT("wince.dialog.real-ok-cancel"); - const int status = wxSystemOptions::GetOptionInt(optionName); - wxSystemOptions::SetOption(optionName,0); -#endif - wxSizer *buttonSizer = CreateButtonSizer(flags); if( buttonSizer ) { - m_innerSizer->Add( buttonSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxRIGHT, 2); + m_innerSizer->Add( buttonSizer, wxSizerFlags().Expand().Border(wxALL, 2) ); m_innerSizer->AddSpacer(2); } - -#ifdef __POCKETPC__ - // restore system option - wxSystemOptions::SetOption(optionName,status); -#endif } // Creates the book control @@ -176,32 +152,7 @@ wxBookCtrlBase* wxPropertySheetDialog::CreateBookCtrl() // Adds the book control to the inner sizer. void wxPropertySheetDialog::AddBookCtrl(wxSizer* sizer) { -#if defined(__POCKETPC__) && wxUSE_NOTEBOOK - // The book control has to be sized larger than the dialog because of a border bug - // in WinCE - int borderSize = -2; - sizer->Add( m_bookCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxRIGHT, borderSize ); -#else - sizer->Add( m_bookCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, m_sheetInnerBorder ); -#endif -} - -void wxPropertySheetDialog::OnActivate(wxActivateEvent& event) -{ -#if defined(__SMARTPHONE__) - // Attempt to focus the choice control: not yet working, but might - // be a step in the right direction. OnActivate overrides the default - // handler in toplevel.cpp that sets the focus for the first child of - // of the dialog (the choicebook). - if (event.GetActive()) - { - wxChoicebook* choiceBook = wxDynamicCast(GetBookCtrl(), wxChoicebook); - if (choiceBook) - choiceBook->SetFocus(); - } - else -#endif - event.Skip(); + sizer->Add( m_bookCtrl, wxSizerFlags(1).Expand().Border(wxALL, m_sheetInnerBorder) ); } // Resize dialog if necessary diff --git a/Externals/wxWidgets3/src/generic/regiong.cpp b/Externals/wxWidgets3/src/generic/regiong.cpp index 7580c44432..8249dcf0b3 100644 --- a/Externals/wxWidgets3/src/generic/regiong.cpp +++ b/Externals/wxWidgets3/src/generic/regiong.cpp @@ -238,7 +238,7 @@ private: // ======================================================================== // wxRegionGeneric // ======================================================================== -//IMPLEMENT_DYNAMIC_CLASS(wxRegionGeneric, wxGDIObject) +//wxIMPLEMENT_DYNAMIC_CLASS(wxRegionGeneric, wxGDIObject); #define M_REGIONDATA ((wxRegionRefData *)m_refData) #define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData)) @@ -400,7 +400,7 @@ wxRegionContain wxRegionGeneric::DoContainsRect(const wxRect& rect) const // ======================================================================== // wxRegionIteratorGeneric // ======================================================================== -//IMPLEMENT_DYNAMIC_CLASS(wxRegionIteratorGeneric,wxObject) +//wxIMPLEMENT_DYNAMIC_CLASS(wxRegionIteratorGeneric, wxObject); wxRegionIteratorGeneric::wxRegionIteratorGeneric() { @@ -655,9 +655,7 @@ bool REGION::XClipBox(Region r, wxRect *rect) void REGION:: miSetExtents (Region pReg) { - register BoxPtr pBox, - pBoxEnd, - pExtents; + BoxPtr pBox, pBoxEnd, pExtents; if (pReg->numRects == 0) { @@ -720,8 +718,8 @@ XOffsetRegion( register int x, register int y) { - register int nbox; - register BOX *pbox; + int nbox; + BOX *pbox; pbox = pRegion->rects; nbox = pRegion->numRects; @@ -768,9 +766,9 @@ miIntersectO ( wxCoord y1, wxCoord y2) { - register wxCoord x1; - register wxCoord x2; - register BoxPtr pNextRect; + wxCoord x1; + wxCoord x2; + BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; @@ -911,9 +909,9 @@ miCoalesce( int prevStart, /* Index of start of previous band */ int curStart) /* Index of start of current band */ { - register BoxPtr pPrevBox; /* Current box in previous band */ - register BoxPtr pCurBox; /* Current box in current band */ - register BoxPtr pRegEnd; /* End of region */ + BoxPtr pPrevBox; /* Current box in previous band */ + BoxPtr pCurBox; /* Current box in current band */ + BoxPtr pRegEnd; /* End of region */ int curNumRects; /* Number of rectangles in current * band */ int prevNumRects; /* Number of rectangles in previous @@ -1088,19 +1086,19 @@ miRegionOp( * overlapping bands in region * 2 */ { - register BoxPtr r1; /* Pointer into first region */ - register BoxPtr r2; /* Pointer into 2d region */ + BoxPtr r1; /* Pointer into first region */ + BoxPtr r2; /* Pointer into 2d region */ BoxPtr r1End; /* End of 1st region */ BoxPtr r2End; /* End of 2d region */ - register wxCoord ybot; /* Bottom of intersection */ - register wxCoord ytop; /* Top of intersection */ + wxCoord ybot; /* Bottom of intersection */ + wxCoord ytop; /* Top of intersection */ BoxPtr oldRects; /* Old rects for newReg */ int prevBand; /* Index of start of * previous band in newReg */ int curBand; /* Index of start of current * band in newReg */ - register BoxPtr r1BandEnd; /* End of current band in r1 */ - register BoxPtr r2BandEnd; /* End of current band in r2 */ + BoxPtr r1BandEnd; /* End of current band in r1 */ + BoxPtr r2BandEnd; /* End of current band in r2 */ wxCoord top; /* Top of non-overlapping * band */ wxCoord bot; /* Bottom of non-overlapping @@ -1374,7 +1372,7 @@ miUnionNonO ( register wxCoord y1, register wxCoord y2) { - register BoxPtr pNextRect; + BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; @@ -1425,7 +1423,7 @@ miUnionO ( register wxCoord y1, register wxCoord y2) { - register BoxPtr pNextRect; + BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; @@ -1575,7 +1573,7 @@ miSubtractNonO1 ( register wxCoord y1, register wxCoord y2) { - register BoxPtr pNextRect; + BoxPtr pNextRect; pNextRect = &pReg->rects[pReg->numRects]; @@ -1624,8 +1622,8 @@ miSubtractO ( register wxCoord y1, register wxCoord y2) { - register BoxPtr pNextRect; - register int x1; + BoxPtr pNextRect; + int x1; x1 = r1->x1; @@ -1858,10 +1856,10 @@ wxRegionContain REGION::XRectInRegion(register Region region, unsigned int rwidth, unsigned int rheight) { - register BoxPtr pbox; - register BoxPtr pboxEnd; + BoxPtr pbox; + BoxPtr pboxEnd; Box rect; - register BoxPtr prect = ▭ + BoxPtr prect = ▭ int partIn, partOut; prect->x1 = rx; diff --git a/Externals/wxWidgets3/src/generic/renderg.cpp b/Externals/wxWidgets3/src/generic/renderg.cpp index 93354ab404..b76c96b9bf 100644 --- a/Externals/wxWidgets3/src/generic/renderg.cpp +++ b/Externals/wxWidgets3/src/generic/renderg.cpp @@ -34,13 +34,19 @@ #include "wx/control.h" #endif //WX_PRECOMP -#include "wx/splitter.h" #include "wx/dcmirror.h" +#include "wx/math.h" +#include "wx/splitter.h" #ifdef __WXMAC__ #include "wx/osx/private.h" #endif +#ifdef __WINDOWS__ + // We only need it to get ::MulDiv() declaration, used by wxMulDivInt32(). + #include "wx/msw/wrapwin.h" +#endif + // ---------------------------------------------------------------------------- // wxRendererGeneric: our wxRendererNative implementation // ---------------------------------------------------------------------------- @@ -55,84 +61,101 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); + wxHeaderButtonParams* params = NULL) wxOVERRIDE; virtual int DrawHeaderButtonContents(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); + wxHeaderButtonParams* params = NULL) wxOVERRIDE; - virtual int GetHeaderButtonHeight(wxWindow *win); + virtual int GetHeaderButtonHeight(wxWindow *win) wxOVERRIDE; - virtual int GetHeaderButtonMargin(wxWindow *win); + virtual int GetHeaderButtonMargin(wxWindow *win) wxOVERRIDE; virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, wxCoord position, wxOrientation orient, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawComboBoxDropButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawDropArrow(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawCheckBox(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; - virtual wxSize GetCheckBoxSize(wxWindow *win); + virtual wxSize GetCheckBoxSize(wxWindow *win) wxOVERRIDE; virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; + + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE; + + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) wxOVERRIDE; virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; - virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) wxOVERRIDE; - virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP virtual void DrawTitleBarBitmap(wxWindow *win, wxDC& dc, const wxRect& rect, wxTitleBarButton button, - int flags = 0); + int flags = 0) wxOVERRIDE; #endif // wxHAS_DRAW_TITLE_BAR_BITMAP - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); + virtual void DrawGauge(wxWindow* win, wxDC& dc, const wxRect& rect, int value, int max, int flags = 0) wxOVERRIDE; - virtual wxRendererVersion GetVersion() const + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END) wxOVERRIDE; + + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE; + + virtual wxRendererVersion GetVersion() const wxOVERRIDE { return wxRendererVersion(wxRendererVersion::Current_Version, wxRendererVersion::Current_Age); @@ -160,6 +183,46 @@ protected: static wxRendererGeneric* sm_rendererGeneric; }; +// ---------------------------------------------------------------------------- +// misc. drawing functions +// ---------------------------------------------------------------------------- + +// 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); +} + // ============================================================================ // wxRendererGeneric implementation // ============================================================================ @@ -295,8 +358,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win, wxRect ar = rect; // make a rect for the arrow - ar.height = 4; - ar.width = 8; + ar.SetSize(wxWindow::FromDIP(wxSize(8, 4), win)); ar.y += (rect.height - ar.height)/2; ar.x = ar.x + rect.width - 3*ar.width/2; arrowSpace = 3*ar.width/2; // space to preserve when drawing the label @@ -568,11 +630,11 @@ wxRendererGeneric::DrawSplitterSash(wxWindow *win, } dc.SetPen(*wxTRANSPARENT_PEN); - dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); if ( win->HasFlag(wxSP_3DSASH) ) { // Draw the 3D sash + dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE))); dc.DrawRectangle(position + 2, 0, 3, h); dc.SetPen(m_penLightGrey); @@ -590,6 +652,7 @@ wxRendererGeneric::DrawSplitterSash(wxWindow *win, else { // Draw a flat sash + dc.SetBrush(wxBrush(win->GetBackgroundColour())); dc.DrawRectangle(position, 0, 3, h); } } @@ -649,9 +712,9 @@ wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win), } } -wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *WXUNUSED(win)) +wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *win) { - return wxSize(16, 16); + return win->FromDIP(wxSize(16, 16)); } void @@ -671,7 +734,43 @@ wxRendererGeneric::DrawPushButton(wxWindow *win, } void -wxRendererGeneric::DrawItemSelectionRect(wxWindow * win, +wxRendererGeneric::DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags) +{ + int arrowHalf = rect.width / 5; + int rectMid = rect.width / 2; + int arrowTopY = (rect.height / 2) - (arrowHalf / 2); + + wxPoint pt[3]; + if (flags & wxCONTROL_EXPANDED) + { + // This should always result in arrow with odd width. + pt[0] = wxPoint(rectMid - arrowHalf, arrowTopY); + pt[1] = wxPoint(rectMid + arrowHalf, arrowTopY); + pt[2] = wxPoint(rectMid, arrowTopY + arrowHalf); + } + else + { + // This should always result in arrow with odd height. + pt[0] = wxPoint(arrowTopY, rectMid - arrowHalf); + pt[1] = wxPoint(arrowTopY + arrowHalf, rectMid); + pt[2] = wxPoint(arrowTopY, rectMid + arrowHalf); + } + + dc.SetBrush(wxBrush(win->GetForegroundColour())); + dc.SetPen(wxPen(win->GetForegroundColour())); + dc.DrawPolygon(WXSIZEOF(pt), pt, rect.x, rect.y); +} + +wxSize wxRendererGeneric::GetCollapseButtonSize(wxWindow *WXUNUSED(win), wxDC& WXUNUSED(dc)) +{ + return wxSize(18, 18); +} + +void +wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win), wxDC& dc, const wxRect& rect, int flags) @@ -694,19 +793,22 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * win, } dc.SetBrush(brush); - if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED) -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - && IsControlActive( (ControlRef)win->GetHandle() ) -#endif - ) + bool drawFocusRect = (flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED); + + if ( drawFocusRect && !(flags & wxCONTROL_CELL) ) dc.SetPen( *wxBLACK_PEN ); else dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle( rect ); - // it's unused everywhere except in wxOSX/Carbon - wxUnusedVar(win); + if ( drawFocusRect && (flags & wxCONTROL_CELL) ) + { + wxRect focusRect(rect); + focusRect.Deflate(1); + + DrawSelectedCellFocusRect(dc, focusRect); + } } void @@ -769,10 +871,21 @@ void wxRendererGeneric::DrawRadioBitmap(wxWindow* WXUNUSED(win), wxDC& WXUNUSED( wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawRadioBitmap"); } -void wxRendererGeneric::DrawTextCtrl(wxWindow* WXUNUSED(win), wxDC& WXUNUSED(dc), - const wxRect& WXUNUSED(rect), int WXUNUSED(flags)) +void wxRendererGeneric::DrawTextCtrl(wxWindow* WXUNUSED(win), + wxDC& dc, + const wxRect& rect, + int WXUNUSED(flags)) { - wxFAIL_MSG("UNIMPLEMENTED: wxRendererGeneric::DrawTextCtrl"); + wxColour fill; + wxColour bdr; + { + fill = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + bdr = *wxBLACK; + } + + dc.SetPen(bdr); + dc.SetBrush(fill); + dc.DrawRectangle(rect); } #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP @@ -792,6 +905,67 @@ void wxRendererGeneric::DrawTitleBarBitmap(wxWindow * WXUNUSED(win), #endif // wxHAS_DRAW_TITLE_BAR_BITMAP +void wxRendererGeneric::DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int WXUNUSED(flags)) +{ + // Use same background as text controls. + DrawTextCtrl(win, dc, rect); + + // Calculate the progress bar size. + wxRect progRect(rect); + progRect.Deflate(2); + progRect.width = wxMulDivInt32(progRect.width, value, max); + + dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); + dc.SetPen(*wxTRANSPARENT_PEN); + dc.DrawRectangle(progRect); +} + +void +wxRendererGeneric::DrawItemText(wxWindow* WXUNUSED(win), + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align, + int flags, + wxEllipsizeMode ellipsizeMode) +{ + // Determine text color + wxColour textColour; + if ( flags & wxCONTROL_SELECTED ) + { + if ( flags & wxCONTROL_FOCUSED ) + { + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + } + else // !focused + { + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); + } + } + else if ( flags & wxCONTROL_DISABLED ) + { + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); + } + + // Be careful to avoid using the default flags here as otherwise any + // ampersands in the text would be consumed (and tabs expanded). + const wxString paintText = wxControl::Ellipsize(text, dc, + ellipsizeMode, + rect.GetWidth(), + wxELLIPSIZE_FLAGS_NONE); + + // Draw text taking care not to change its colour if it had been set by the + // caller for a normal item to allow having items in non-default colours. + if ( textColour.IsOk() ) + dc.SetTextForeground(textColour); + dc.SetTextBackground(wxTransparentColour); + dc.DrawLabel(paintText, rect, align); +} // ---------------------------------------------------------------------------- // A module to allow cleanup of generic renderer. @@ -799,11 +973,11 @@ void wxRendererGeneric::DrawTitleBarBitmap(wxWindow * WXUNUSED(win), class wxGenericRendererModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxGenericRendererModule) + wxDECLARE_DYNAMIC_CLASS(wxGenericRendererModule); public: wxGenericRendererModule() {} - bool OnInit() { return true; } - void OnExit() { wxRendererGeneric::Cleanup(); } + bool OnInit() wxOVERRIDE { return true; } + void OnExit() wxOVERRIDE { wxRendererGeneric::Cleanup(); } }; -IMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule); diff --git a/Externals/wxWidgets3/src/generic/richmsgdlgg.cpp b/Externals/wxWidgets3/src/generic/richmsgdlgg.cpp index 397cfd051a..c74e380f57 100644 --- a/Externals/wxWidgets3/src/generic/richmsgdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/richmsgdlgg.cpp @@ -31,10 +31,10 @@ wxIMPLEMENT_CLASS(wxRichMessageDialog, wxDialog) // Events and handlers // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase) +wxBEGIN_EVENT_TABLE(wxGenericRichMessageDialog, wxRichMessageDialogBase) EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, wxGenericRichMessageDialog::OnPaneChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxGenericRichMessageDialog::OnPaneChanged(wxCollapsiblePaneEvent& event) { diff --git a/Externals/wxWidgets3/src/generic/richtooltipg.cpp b/Externals/wxWidgets3/src/generic/richtooltipg.cpp index 2986f9be31..0b3ed6a4bf 100644 --- a/Externals/wxWidgets3/src/generic/richtooltipg.cpp +++ b/Externals/wxWidgets3/src/generic/richtooltipg.cpp @@ -272,7 +272,7 @@ public: } protected: - virtual void OnDismiss() + virtual void OnDismiss() wxOVERRIDE { Destroy(); } diff --git a/Externals/wxWidgets3/src/generic/sashwin.cpp b/Externals/wxWidgets3/src/generic/sashwin.cpp index a26595a652..c5ba834f32 100644 --- a/Externals/wxWidgets3/src/generic/sashwin.cpp +++ b/Externals/wxWidgets3/src/generic/sashwin.cpp @@ -36,10 +36,10 @@ wxDEFINE_EVENT( wxEVT_SASH_DRAGGED, wxSashEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxSashWindow, wxWindow) -IMPLEMENT_DYNAMIC_CLASS(wxSashEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxSashWindow, wxWindow); +wxIMPLEMENT_DYNAMIC_CLASS(wxSashEvent, wxCommandEvent); -BEGIN_EVENT_TABLE(wxSashWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxSashWindow, wxWindow) EVT_PAINT(wxSashWindow::OnPaint) EVT_SIZE(wxSashWindow::OnSize) EVT_MOUSE_EVENTS(wxSashWindow::OnMouseEvent) @@ -47,7 +47,7 @@ BEGIN_EVENT_TABLE(wxSashWindow, wxWindow) EVT_SET_CURSOR(wxSashWindow::OnSetCursor) #endif // __WXMSW__ || __WXMAC__ -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxSashWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) diff --git a/Externals/wxWidgets3/src/generic/scrlwing.cpp b/Externals/wxWidgets3/src/generic/scrlwing.cpp index c14ab53075..6315f5a97f 100644 --- a/Externals/wxWidgets3/src/generic/scrlwing.cpp +++ b/Externals/wxWidgets3/src/generic/scrlwing.cpp @@ -39,8 +39,6 @@ #include "wx/scrolbar.h" #endif -#include "wx/recguard.h" - #ifdef __WXMSW__ #include // for DLGC_WANTARROWS #include "wx/msw/winundef.h" @@ -76,7 +74,7 @@ public: m_scrollHelper = scrollHelper; } - virtual bool ProcessEvent(wxEvent& event); + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; private: wxScrollHelperBase *m_scrollHelper; @@ -98,7 +96,7 @@ public: wxEventType eventTypeToSend, int pos, int orient); - virtual void Notify(); + virtual void Notify() wxOVERRIDE; private: wxWindow *m_win; @@ -882,7 +880,7 @@ void wxAnyScrollHelperBase::HandleOnChar(wxKeyEvent& event) case WXK_LEFT: newEvent.SetOrientation(wxHORIZONTAL); - // fall through + wxFALLTHROUGH; case WXK_UP: newEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP); @@ -890,7 +888,7 @@ void wxAnyScrollHelperBase::HandleOnChar(wxKeyEvent& event) case WXK_RIGHT: newEvent.SetOrientation(wxHORIZONTAL); - // fall through + wxFALLTHROUGH; case WXK_DOWN: newEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN); @@ -1205,6 +1203,7 @@ wxScrollHelper::wxScrollHelper(wxWindow *winToScroll) { m_xVisibility = m_yVisibility = wxSHOW_SB_DEFAULT; + m_adjustScrollFlagReentrancy = 0; } bool wxScrollHelper::IsScrollbarShown(int orient) const @@ -1292,7 +1291,7 @@ wxScrollHelper::DoAdjustScrollbar(int orient, default: wxFAIL_MSG( wxS("unknown scrollbar visibility") ); - // fall through + wxFALLTHROUGH; case wxSHOW_SB_DEFAULT: range = scrollUnits; @@ -1305,8 +1304,7 @@ wxScrollHelper::DoAdjustScrollbar(int orient, void wxScrollHelper::AdjustScrollbars() { - static wxRecursionGuardFlag s_flagReentrancy; - wxRecursionGuard guard(s_flagReentrancy); + wxRecursionGuard guard(m_adjustScrollFlagReentrancy); if ( guard.IsInside() ) { // don't reenter AdjustScrollbars() while another call to @@ -1537,7 +1535,7 @@ wxSize wxScrolledT_Helper::FilterBestSize(const wxWindow *win, // the window into sizer as expandable so that it can use all space // available to it. // - // See also http://svn.wxwidgets.org/viewvc/wx?view=rev&revision=45864 + // See also https://github.com/wxWidgets/wxWidgets/commit/7e0f7539 wxSize minSize = win->GetMinSize(); @@ -1554,17 +1552,15 @@ wxSize wxScrolledT_Helper::FilterBestSize(const wxWindow *win, #ifdef __WXMSW__ WXLRESULT wxScrolledT_Helper::FilterMSWWindowProc(WXUINT nMsg, WXLRESULT rc) { -#ifndef __WXWINCE__ // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) { rc |= DLGC_WANTARROWS; } -#endif return rc; } #endif // __WXMSW__ -// NB: skipping wxScrolled in wxRTTI information because being a templte, +// NB: skipping wxScrolled in wxRTTI information because being a template, // it doesn't and can't implement wxRTTI support -IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel) +wxIMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxPanel); diff --git a/Externals/wxWidgets3/src/generic/selstore.cpp b/Externals/wxWidgets3/src/generic/selstore.cpp index 6f606c335a..af2dd12a41 100644 --- a/Externals/wxWidgets3/src/generic/selstore.cpp +++ b/Externals/wxWidgets3/src/generic/selstore.cpp @@ -28,6 +28,8 @@ // wxSelectionStore // ============================================================================ +const unsigned wxSelectionStore::NO_SELECTION = static_cast(-1); + // ---------------------------------------------------------------------------- // tests // ---------------------------------------------------------------------------- @@ -190,6 +192,31 @@ bool wxSelectionStore::SelectRange(unsigned itemFrom, unsigned itemTo, // callbacks // ---------------------------------------------------------------------------- +void wxSelectionStore::OnItemsInserted(unsigned item, unsigned numItems) +{ + const size_t count = m_itemsSel.GetCount(); + + size_t idx = m_itemsSel.IndexForInsert(item); + + for ( size_t i = idx; i < count; i++ ) + { + m_itemsSel[i] += numItems; + } + + if ( m_defaultState ) + { + // All newly inserted items are not selected, so if the default state + // is to be selected, we need to manually add them to the deselected + // items indices. + for ( unsigned n = item; n < item + numItems; n++ ) + { + m_itemsSel.AddAt(item, idx++); + } + } + + m_count += numItems; +} + void wxSelectionStore::OnItemDelete(unsigned item) { size_t count = m_itemsSel.GetCount(), @@ -211,8 +238,44 @@ void wxSelectionStore::OnItemDelete(unsigned item) m_itemsSel[i++]--; } + + m_count--; } +bool wxSelectionStore::OnItemsDeleted(unsigned item, unsigned numItems) +{ + bool anyDeletedInSelItems = false, + allDeletedInSelItems = true; + + size_t i = m_itemsSel.IndexForInsert(item); + + const unsigned firstAfterDeleted = item + numItems; + while ( i < m_itemsSel.size() ) + { + if ( m_itemsSel[i] < firstAfterDeleted ) + { + // This item is going to be deleted, so remove it from the + // selected indices entirely. Notice that we do not update i here + // as it now refers to the next element. + m_itemsSel.RemoveAt(i); + + anyDeletedInSelItems = true; + } + else + { + // This item remains, just update its index. + m_itemsSel[i++] -= numItems; + + allDeletedInSelItems = false; + } + } + + m_count -= numItems; + + return m_defaultState ? allDeletedInSelItems : anyDeletedInSelItems; +} + + void wxSelectionStore::SetItemCount(unsigned count) { // forget about all items whose indices are now invalid if the size @@ -229,3 +292,42 @@ void wxSelectionStore::SetItemCount(unsigned count) // remember the new number of items m_count = count; } + +// ---------------------------------------------------------------------------- +// Iteration +// ---------------------------------------------------------------------------- + +unsigned wxSelectionStore::GetFirstSelectedItem(IterationState& cookie) const +{ + cookie = 0; + + return GetNextSelectedItem(cookie); +} + +unsigned wxSelectionStore::GetNextSelectedItem(IterationState& cookie) const +{ + if ( m_defaultState ) + { + // We have no choice but to iterate over all items in this case. It + // shouldn't be that bad in practice because (almost) all items are + // supposed to be selected if m_defaultState == true anyhow. + for ( unsigned item = cookie; ; item++ ) + { + if ( item >= m_count ) + return NO_SELECTION; + + if ( IsSelected(item) ) + { + cookie = item + 1; + return item; + } + } + } + else // Simple case when we directly have the selected items. + { + if ( cookie >= m_itemsSel.size() ) + return NO_SELECTION; + + return m_itemsSel[cookie++]; + } +} diff --git a/Externals/wxWidgets3/src/generic/spinctlg.cpp b/Externals/wxWidgets3/src/generic/spinctlg.cpp index 3da88c9404..f48ff32c2d 100644 --- a/Externals/wxWidgets3/src/generic/spinctlg.cpp +++ b/Externals/wxWidgets3/src/generic/spinctlg.cpp @@ -32,7 +32,7 @@ #if wxUSE_SPINCTRL -IMPLEMENT_DYNAMIC_CLASS(wxSpinDoubleEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxSpinDoubleEvent, wxNotifyEvent); // There are port-specific versions for the wxSpinCtrl, so exclude the // contents of this file in those cases @@ -110,10 +110,10 @@ public: wxSpinCtrlGenericBase *m_spin; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl) +wxBEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl) EVT_CHAR(wxSpinCtrlTextGeneric::OnChar) // Forward the text events to wxSpinCtrl itself adjusting them slightly in @@ -126,7 +126,7 @@ BEGIN_EVENT_TABLE(wxSpinCtrlTextGeneric, wxTextCtrl) EVT_TEXT_ENTER(wxID_ANY, wxSpinCtrlTextGeneric::OnTextEvent) EVT_KILL_FOCUS(wxSpinCtrlTextGeneric::OnKillFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxSpinCtrlButtonGeneric: spin button used by spin control @@ -156,13 +156,13 @@ public: wxSpinCtrlGenericBase *m_spin; private: - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxSpinCtrlButtonGeneric, wxSpinButton) +wxBEGIN_EVENT_TABLE(wxSpinCtrlButtonGeneric, wxSpinButton) EVT_SPIN_UP( wxID_ANY, wxSpinCtrlButtonGeneric::OnSpinButton) EVT_SPIN_DOWN(wxID_ANY, wxSpinCtrlButtonGeneric::OnSpinButton) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxSpinCtrlGenericBase @@ -210,7 +210,18 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, m_max = max; m_increment = increment; - m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style); + // the string value overrides the numeric one (for backwards compatibility + // reasons and also because it is simpler to specify the string value which + // comes much sooner in the list of arguments and leave the initial + // parameter unspecified) + if ( !value.empty() ) + { + double d; + if ( DoTextToValue(value, &d) ) + m_value = d; + } + + m_textCtrl = new wxSpinCtrlTextGeneric(this, DoValueToText(m_value), style); m_spinButton = new wxSpinCtrlButtonGeneric(this, style); #if wxUSE_TOOLTIPS @@ -220,20 +231,6 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, m_spin_value = m_spinButton->GetValue(); - // the string value overrides the numeric one (for backwards compatibility - // reasons and also because it is simpler to satisfy the string value which - // comes much sooner in the list of arguments and leave the initial - // parameter unspecified) - if ( !value.empty() ) - { - double d; - if ( DoTextToValue(value, &d) ) - { - m_value = d; - m_textCtrl->ChangeValue(DoValueToText(m_value)); - } - } - SetInitialSize(size); Move(pos); @@ -353,32 +350,6 @@ bool wxSpinCtrlGenericBase::Show(bool show) return true; } -#if wxUSE_TOOLTIPS -void wxSpinCtrlGenericBase::DoSetToolTip(wxToolTip *tip) -{ - // Notice that we must check for the subcontrols not being NULL (as they - // could be if we were created with the default ctor and this is called - // before Create() for some reason) and that we can't call SetToolTip(tip) - // because this would take ownership of the wxToolTip object (twice). - if ( m_textCtrl ) - { - if ( tip ) - m_textCtrl->SetToolTip(tip->GetTip()); - else - m_textCtrl->SetToolTip(NULL); - } - - if ( m_spinButton ) - { - if( tip ) - m_spinButton->SetToolTip(tip->GetTip()); - else - m_spinButton->SetToolTip(NULL); - } - - wxWindowBase::DoSetToolTip(tip); -} -#endif // wxUSE_TOOLTIPS bool wxSpinCtrlGenericBase::SetBackgroundColour(const wxColour& colour) { @@ -395,15 +366,19 @@ bool wxSpinCtrlGenericBase::SetBackgroundColour(const wxColour& colour) // Handle sub controls events // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxSpinCtrlGenericBase, wxSpinCtrlBase) +wxBEGIN_EVENT_TABLE(wxSpinCtrlGenericBase, wxSpinCtrlBase) EVT_CHAR(wxSpinCtrlGenericBase::OnTextChar) EVT_KILL_FOCUS(wxSpinCtrlGenericBase::OnTextLostFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event) { event.Skip(); + // Pressing the spin button should also give the focus to the text part of + // the control, at least this is how the native control behaves under MSW. + SetFocus(); + // Sync the textctrl since the user expects that the button will modify // what they see in the textctrl. SyncSpinToText(SendEvent_None); @@ -676,7 +651,7 @@ wxString wxSpinCtrl::DoValueToText(double val) default: wxFAIL_MSG( wxS("Unsupported spin control base") ); - // Fall through + wxFALLTHROUGH; case 10: return wxString::Format("%ld", static_cast(val)); @@ -689,7 +664,7 @@ wxString wxSpinCtrl::DoValueToText(double val) // wxSpinCtrlDouble //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGenericBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGenericBase); void wxSpinCtrlDouble::DoSendEvent() { diff --git a/Externals/wxWidgets3/src/generic/splash.cpp b/Externals/wxWidgets3/src/generic/splash.cpp index 10f8b10449..9d52d9aad4 100644 --- a/Externals/wxWidgets3/src/generic/splash.cpp +++ b/Externals/wxWidgets3/src/generic/splash.cpp @@ -35,11 +35,11 @@ #define wxSPLASH_TIMER_ID 9999 -IMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame) -BEGIN_EVENT_TABLE(wxSplashScreen, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame); +wxBEGIN_EVENT_TABLE(wxSplashScreen, wxFrame) EVT_TIMER(wxSPLASH_TIMER_ID, wxSplashScreen::OnNotify) EVT_CLOSE(wxSplashScreen::OnCloseWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxSplashScreen::Init() { @@ -133,12 +133,12 @@ void wxSplashScreen::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) // wxSplashScreenWindow // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow) #ifdef __WXGTK__ EVT_PAINT(wxSplashScreenWindow::OnPaint) #endif EVT_ERASE_BACKGROUND(wxSplashScreenWindow::OnEraseBackground) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos, diff --git a/Externals/wxWidgets3/src/generic/splitter.cpp b/Externals/wxWidgets3/src/generic/splitter.cpp index 826b92a7d8..cae9e6c5ae 100644 --- a/Externals/wxWidgets3/src/generic/splitter.cpp +++ b/Externals/wxWidgets3/src/generic/splitter.cpp @@ -43,7 +43,7 @@ wxDEFINE_EVENT( wxEVT_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent ); wxDEFINE_EVENT( wxEVT_SPLITTER_DOUBLECLICKED, wxSplitterEvent ); wxDEFINE_EVENT( wxEVT_SPLITTER_UNSPLIT, wxSplitterEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow); /* TODO PROPERTIES @@ -54,9 +54,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow) orientation */ -IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent, wxNotifyEvent); -BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) EVT_PAINT(wxSplitterWindow::OnPaint) EVT_SIZE(wxSplitterWindow::OnSize) EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent) @@ -65,7 +65,7 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow) #if defined( __WXMSW__ ) || defined( __WXMAC__) EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor) #endif // wxMSW -END_EVENT_TABLE() +wxEND_EVENT_TABLE() static bool IsLive(wxSplitterWindow* wnd) { @@ -192,21 +192,15 @@ void wxSplitterWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - // 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. + // We may need to update the children sizes if we're in the middle of + // a live update as indicated by m_needUpdating. The other possible case, + // when we have a requested but not yet set sash position (as indicated + // by m_requestedSashPosition having a valid value) is handled by OnSize. if ( m_needUpdating ) { m_needUpdating = false; + SizeWindows(); } - else if ( m_requestedSashPosition == INT_MAX ) - { - // We don't need to resize the children. - return; - } - - SizeWindows(); } void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) @@ -662,6 +656,8 @@ void wxSplitterWindow::SetSashPositionAndNotify(int sashPos) // including the edges next to the sash. void wxSplitterWindow::SizeWindows() { + int oldSashPosition = m_sashPosition; + // check if we have delayed setting the real sash position if ( m_requestedSashPosition != INT_MAX ) { @@ -727,8 +723,11 @@ void wxSplitterWindow::SizeWindows() GetWindow1()->SetSize(border, border, w1, h1); } - wxClientDC dc(this); - DrawSash(dc); + if ( oldSashPosition != m_sashPosition ) + { + wxClientDC dc(this); + DrawSash(dc); + } } // Set pane for unsplit window diff --git a/Externals/wxWidgets3/src/generic/srchctlg.cpp b/Externals/wxWidgets3/src/generic/srchctlg.cpp index ccf7ccbcfc..eed9aa7348 100644 --- a/Externals/wxWidgets3/src/generic/srchctlg.cpp +++ b/Externals/wxWidgets3/src/generic/srchctlg.cpp @@ -38,17 +38,6 @@ // the margin between the text control and the search/cancel buttons static const wxCoord MARGIN = 2; -// border around all controls to compensate for wxSIMPLE_BORDER -#if defined(__WXMSW__) -static const wxCoord BORDER = 0; -static const wxCoord ICON_MARGIN = 2; -static const wxCoord ICON_OFFSET = 2; -#else -static const wxCoord BORDER = 2; -static const wxCoord ICON_MARGIN = 0; -static const wxCoord ICON_OFFSET = 0; -#endif - #define LIGHT_STEP 160 // ---------------------------------------------------------------------------- @@ -71,24 +60,24 @@ public: InvalidateBestSize(); } - virtual wxWindow* GetMainWindowOfCompositeControl() + virtual wxWindow* GetMainWindowOfCompositeControl() wxOVERRIDE { return m_search; } // provide access to the base class protected methods to wxSearchCtrl which // needs to forward to them - void DoSetValue(const wxString& value, int flags) + void DoSetValue(const wxString& value, int flags) wxOVERRIDE { wxTextCtrl::DoSetValue(value, flags); } - bool DoLoadFile(const wxString& file, int fileType) + bool DoLoadFile(const wxString& file, int fileType) wxOVERRIDE { return wxTextCtrl::DoLoadFile(file, fileType); } - bool DoSaveFile(const wxString& file, int fileType) + bool DoSaveFile(const wxString& file, int fileType) wxOVERRIDE { return wxTextCtrl::DoSaveFile(file, fileType); } @@ -137,7 +126,15 @@ protected: wxSearchTextCtrl* const self = const_cast(this); self->SetWindowStyleFlag((flags & ~wxBORDER_MASK) | wxBORDER_DEFAULT); - const wxSize size = wxTextCtrl::DoGetBestSize(); + wxSize size = wxTextCtrl::DoGetBestSize(); + + // The calculation for no external borders in wxTextCtrl::DoGetSizeFromTextSize also + // removes any padding around the value, which is wrong for this situation. So we + // can't use wxBORDER_NONE to calculate a good height, in which case we just have to + // assume a border in the code above and then subtract the space that would be taken up + // by a themed border (the thin blue border and the white internal border). + size.y -= 4; + self->SetWindowStyleFlag(flags); return size; @@ -147,15 +144,15 @@ protected: private: wxSearchCtrl* m_search; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) +wxBEGIN_EVENT_TABLE(wxSearchTextCtrl, wxTextCtrl) EVT_TEXT(wxID_ANY, wxSearchTextCtrl::OnText) EVT_TEXT_ENTER(wxID_ANY, wxSearchTextCtrl::OnText) EVT_TEXT_URL(wxID_ANY, wxSearchTextCtrl::OnTextUrl) EVT_TEXT_MAXLEN(wxID_ANY, wxSearchTextCtrl::OnText) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxSearchButton: search button used by search control @@ -183,15 +180,15 @@ public: // 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; } + virtual bool AcceptsFocusFromKeyboard() const wxOVERRIDE { return false; } - virtual wxWindow* GetMainWindowOfCompositeControl() + virtual wxWindow* GetMainWindowOfCompositeControl() wxOVERRIDE { return m_search; } protected: - wxSize DoGetBestSize() const + wxSize DoGetBestSize() const wxOVERRIDE { return wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()); } @@ -234,21 +231,21 @@ private: wxEventType m_eventType; wxBitmap m_bmp; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxSearchButton, wxControl) +wxBEGIN_EVENT_TABLE(wxSearchButton, wxControl) EVT_LEFT_UP(wxSearchButton::OnLeftUp) EVT_PAINT(wxSearchButton::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) +wxBEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) EVT_SEARCHCTRL_CANCEL_BTN(wxID_ANY, wxSearchCtrl::OnCancelButton) EVT_SET_FOCUS(wxSearchCtrl::OnSetFocus) EVT_SIZE(wxSearchCtrl::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase); // ============================================================================ // implementation @@ -381,8 +378,7 @@ void wxSearchCtrl::SetMenu( wxMenu* menu ) m_searchButton->Refresh(); } } - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); + LayoutControls(); } wxMenu* wxSearchCtrl::GetMenu() @@ -405,8 +401,7 @@ void wxSearchCtrl::ShowSearchButton( bool show ) RecalcBitmaps(); } - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); + LayoutControls(); } bool wxSearchCtrl::IsSearchButtonVisible() const @@ -424,8 +419,7 @@ void wxSearchCtrl::ShowCancelButton( bool show ) } m_cancelButtonVisible = show; - wxRect rect = GetRect(); - LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); + LayoutControls(); } bool wxSearchCtrl::IsCancelButtonVisible() const @@ -447,7 +441,7 @@ wxString wxSearchCtrl::GetDescriptiveText() const // geometry // ---------------------------------------------------------------------------- -wxSize wxSearchCtrl::DoGetBestSize() const +wxSize wxSearchCtrl::DoGetBestClientSize() const { wxSize sizeText = m_text->GetBestSize(); wxSize sizeSearch(0,0); @@ -470,30 +464,30 @@ wxSize wxSearchCtrl::DoGetBestSize() const // buttons are square and equal to the height of the text control int height = sizeText.y; return wxSize(sizeSearch.x + searchMargin + sizeText.x + cancelMargin + sizeCancel.x + 2*horizontalBorder, - height + 2*BORDER); + height); } void wxSearchCtrl::DoMoveWindow(int x, int y, int width, int height) { wxSearchCtrlBase::DoMoveWindow(x, y, width, height); - LayoutControls(0, 0, width, height); + LayoutControls(); } -void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) +void wxSearchCtrl::LayoutControls() { if ( !m_text ) return; + const wxSize sizeTotal = GetClientSize(); + int width = sizeTotal.x, + height = sizeTotal.y; + wxSize sizeText = m_text->GetBestSize(); // make room for the search menu & clear button - int horizontalBorder = ( sizeText.y - sizeText.y * 14 / 21 ) / 2; - x += horizontalBorder; - y += BORDER; + int horizontalBorder = 1 + ( sizeText.y - sizeText.y * 14 / 21 ) / 2; + int x = horizontalBorder; width -= horizontalBorder*2; - height -= BORDER*2; - if (width < 0) width = 0; - if (height < 0) height = 0; wxSize sizeSearch(0,0); wxSize sizeCancel(0,0); @@ -524,13 +518,27 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) // position the subcontrols inside the client area - m_searchButton->SetSize(x, y + ICON_OFFSET - 1, sizeSearch.x, height); - m_text->SetSize( x + sizeSearch.x + searchMargin, - y + ICON_OFFSET - BORDER, - textWidth, - height); - m_cancelButton->SetSize(x + sizeSearch.x + searchMargin + textWidth + cancelMargin, - y + ICON_OFFSET - 1, sizeCancel.x, height); + m_searchButton->SetSize(x, (height - sizeSearch.y) / 2, + sizeSearch.x, height); + x += sizeSearch.x; + x += searchMargin; + +#ifdef __WXMSW__ + // The text control is too high up on Windows; normally a text control looks OK because + // of the white border that's part of the theme border. We can also remove a pixel from + // the height to fit the text control in, because the padding in EDIT_HEIGHT_FROM_CHAR_HEIGHT + // is already generous. + int textY = 1; +#else + int textY = 0; +#endif + + m_text->SetSize(x, textY, textWidth, height-textY); + x += textWidth; + x += cancelMargin; + + m_cancelButton->SetSize(x, (height - sizeCancel.y) / 2, + sizeCancel.x, height); } wxWindowList wxSearchCtrl::GetCompositeWindowParts() const @@ -918,10 +926,6 @@ bool wxSearchCtrl::ShouldInheritColours() const // antialiasing static int GetMultiplier() { -#ifdef __WXWINCE__ - // speed up bitmap generation by using a small bitmap - return 3; -#else int depth = ::wxDisplayDepth(); if ( depth >= 24 ) @@ -929,7 +933,32 @@ static int GetMultiplier() return 8; } return 6; -#endif +} + +static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded) +{ + wxCHECK_RET( sizeNeeded.IsFullySpecified(), wxS("New size must be given") ); + +#if wxUSE_IMAGE + wxImage img = bmp.ConvertToImage(); + img.Rescale(sizeNeeded.x, sizeNeeded.y); + bmp = wxBitmap(img); +#else // !wxUSE_IMAGE + // Fallback method of scaling the bitmap + wxBitmap newBmp(sizeNeeded, bmp.GetDepth()); +#if defined(__WXMSW__) || defined(__WXOSX__) + // wxBitmap::UseAlpha() is used only on wxMSW and wxOSX. + newBmp.UseAlpha(bmp.HasAlpha()); +#endif // __WXMSW__ || __WXOSX__ + { + wxMemoryDC dc(newBmp); + double scX = (double)sizeNeeded.GetWidth() / bmp.GetWidth(); + double scY = (double)sizeNeeded.GetHeight() / bmp.GetHeight(); + dc.SetUserScale(scX, scY); + dc.DrawBitmap(bmp, 0, 0); + } + bmp = newBmp; +#endif // wxUSE_IMAGE/!wxUSE_IMAGE } wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) @@ -1024,9 +1053,7 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) if ( multiplier != 1 ) { - wxImage image = bitmap.ConvertToImage(); - image.Rescale(x,y); - bitmap = wxBitmap( image ); + RescaleBitmap(bitmap, wxSize(x, y)); } if ( !renderDrop ) { @@ -1114,9 +1141,7 @@ wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y ) if ( multiplier != 1 ) { - wxImage image = bitmap.ConvertToImage(); - image.Rescale(x,y); - bitmap = wxBitmap( image ); + RescaleBitmap(bitmap, wxSize(x, y)); } return bitmap; @@ -1130,7 +1155,7 @@ void wxSearchCtrl::RecalcBitmaps() } wxSize sizeText = m_text->GetBestSize(); - int bitmapHeight = sizeText.y - 2 * ICON_MARGIN; + int bitmapHeight = sizeText.y - 4; int bitmapWidth = sizeText.y * 20 / 14; if ( !m_searchBitmapUser ) @@ -1177,7 +1202,7 @@ void wxSearchCtrl::RecalcBitmaps() m_cancelBitmap.GetWidth() != bitmapHeight ) { - m_cancelBitmap = RenderCancelBitmap(bitmapHeight-BORDER-1,bitmapHeight-BORDER-1); // square + m_cancelBitmap = RenderCancelBitmap(bitmapHeight,bitmapHeight); // square m_cancelButton->SetBitmapLabel(m_cancelBitmap); } // else this bitmap was set by user, don't alter @@ -1200,9 +1225,7 @@ void wxSearchCtrl::OnSetFocus( wxFocusEvent& /*event*/ ) void wxSearchCtrl::OnSize( wxSizeEvent& WXUNUSED(event) ) { - int width, height; - GetSize(&width, &height); - LayoutControls(0, 0, width, height); + LayoutControls(); } #if wxUSE_MENUS diff --git a/Externals/wxWidgets3/src/generic/statbmpg.cpp b/Externals/wxWidgets3/src/generic/statbmpg.cpp index a21ef57e0b..285c86d798 100644 --- a/Externals/wxWidgets3/src/generic/statbmpg.cpp +++ b/Externals/wxWidgets3/src/generic/statbmpg.cpp @@ -17,6 +17,14 @@ #include "wx/generic/statbmpg.h" +#if wxUSE_GRAPHICS_CONTEXT + #include "wx/graphics.h" + #include "wx/scopedptr.h" +#else + #include "wx/image.h" + #include "wx/math.h" +#endif + bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, @@ -25,6 +33,7 @@ bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, if (! wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) return false; + m_scaleMode = Scale_None; SetBitmap(bitmap); Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticBitmap::OnPaint)); return true; @@ -32,15 +41,61 @@ bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event)) { + if ( !m_bitmap.IsOk() ) + return; + wxPaintDC dc(this); - if (m_bitmap.IsOk()) - dc.DrawBitmap(m_bitmap, 0, 0, true); + const wxSize drawSize = GetClientSize(); + const wxSize bmpSize = m_bitmap.GetSize(); + wxDouble w = 0; + wxDouble h = 0; + switch ( m_scaleMode ) + { + case Scale_None: + dc.DrawBitmap(m_bitmap, 0, 0, true); + return; + case Scale_Fill: + w = drawSize.x; + h = drawSize.y; + break; + case Scale_AspectFill: + case Scale_AspectFit: + { + wxDouble scaleFactor; + wxDouble scaleX = (wxDouble)drawSize.x / (wxDouble)bmpSize.x; + wxDouble scaleY = (wxDouble)drawSize.y / (wxDouble)bmpSize.y; + if ( ( m_scaleMode == Scale_AspectFit && scaleY < scaleX ) || + ( m_scaleMode == Scale_AspectFill && scaleY > scaleX ) ) + scaleFactor = scaleY; + else + scaleFactor = scaleX; + + w = bmpSize.x * scaleFactor; + h = bmpSize.y * scaleFactor; + + break; + } + } + + wxASSERT_MSG(w, wxS("Unknown scale mode")); + + wxDouble x = (drawSize.x - w) / 2; + wxDouble y = (drawSize.y - h) / 2; +#if wxUSE_GRAPHICS_CONTEXT + wxScopedPtr const + gc(wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc)); + gc->DrawBitmap(m_bitmap, x, y, w, h); +#else + wxImage img = m_bitmap.ConvertToImage(); + img.Rescale(wxRound(w), wxRound(h), wxIMAGE_QUALITY_HIGH); + dc.DrawBitmap(wxBitmap(img), wxRound(x), wxRound(y), true); +#endif } // under OSX_cocoa is a define, avoid duplicate info #ifndef wxGenericStaticBitmap -IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase); #endif diff --git a/Externals/wxWidgets3/src/generic/stattextg.cpp b/Externals/wxWidgets3/src/generic/stattextg.cpp index 74843fa21e..a8b4b5c150 100644 --- a/Externals/wxWidgets3/src/generic/stattextg.cpp +++ b/Externals/wxWidgets3/src/generic/stattextg.cpp @@ -27,7 +27,7 @@ #include "wx/generic/private/markuptext.h" #endif // wxUSE_MARKUP -IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticText, wxStaticTextBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericStaticText, wxStaticTextBase); bool wxGenericStaticText::Create(wxWindow *parent, @@ -70,12 +70,7 @@ void wxGenericStaticText::OnPaint(wxPaintEvent& WXUNUSED(event)) wxPaintDC dc(this); wxRect rect = GetClientRect(); - if ( IsEnabled() ) - { - dc.SetTextForeground( - wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); - } - else // paint disabled text + if ( !IsEnabled() ) { // draw shadow of the text dc.SetTextForeground( @@ -106,8 +101,11 @@ void wxGenericStaticText::SetLabel(const wxString& label) { wxControl::SetLabel(label); DoSetLabel(GetEllipsizedLabel()); - if ( !HasFlag(wxST_NO_AUTORESIZE) && !IsEllipsized() ) - InvalidateBestSize(); + + InvalidateBestSize(); + + if ( !IsEllipsized() ) + AutoResizeIfNecessary(); #if wxUSE_MARKUP if ( m_markupText ) @@ -137,8 +135,7 @@ bool wxGenericStaticText::DoSetLabelMarkup(const wxString& markup) else m_markupText->SetMarkup(markup); - if ( !HasFlag(wxST_NO_AUTORESIZE) ) - InvalidateBestSize(); + AutoResizeIfNecessary(); Refresh(); @@ -151,8 +148,9 @@ bool wxGenericStaticText::SetFont(const wxFont &font) { if ( !wxControl::SetFont(font) ) return false; - if ( !HasFlag(wxST_NO_AUTORESIZE) ) - InvalidateBestSize(); + + AutoResizeIfNecessary(); + Refresh(); return true; } diff --git a/Externals/wxWidgets3/src/generic/statusbr.cpp b/Externals/wxWidgets3/src/generic/statusbr.cpp index 6de10c46aa..46af9b0877 100644 --- a/Externals/wxWidgets3/src/generic/statusbr.cpp +++ b/Externals/wxWidgets3/src/generic/statusbr.cpp @@ -34,13 +34,13 @@ // we only have to do it here when we use wxStatusBarGeneric in addition to the // standard wxStatusBar class, if wxStatusBarGeneric is the same as -// wxStatusBar, then the corresponding IMPLEMENT_DYNAMIC_CLASS is already in +// wxStatusBar, then the corresponding wxIMPLEMENT_DYNAMIC_CLASS is already in // common/statbar.cpp #if defined(__WXMAC__) || \ (defined(wxUSE_NATIVE_STATUSBAR) && wxUSE_NATIVE_STATUSBAR) #include "wx/generic/statusbr.h" - IMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow) + wxIMPLEMENT_DYNAMIC_CLASS(wxStatusBarGeneric, wxWindow); #endif // wxUSE_NATIVE_STATUSBAR // Default status border dimensions @@ -87,7 +87,7 @@ gboolean statusbar_query_tooltip(GtkWidget* WXUNUSED(widget), // wxStatusBarGeneric // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) +wxBEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) EVT_PAINT(wxStatusBarGeneric::OnPaint) EVT_SIZE(wxStatusBarGeneric::OnSize) #ifdef __WXGTK20__ @@ -95,7 +95,7 @@ BEGIN_EVENT_TABLE(wxStatusBarGeneric, wxWindow) EVT_RIGHT_DOWN(wxStatusBarGeneric::OnRightDown) #endif EVT_SYS_COLOUR_CHANGED(wxStatusBarGeneric::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxStatusBarGeneric::Init() { @@ -123,10 +123,6 @@ bool wxStatusBarGeneric::Create(wxWindow *parent, InitColours(); -#ifdef __WXPM__ - SetFont(*wxSMALL_FONT); -#endif - int height = (int)((11*GetCharHeight())/10 + 2*GetBorderY()); SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, height); @@ -299,8 +295,6 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen); -#ifndef __WXPM__ - // Right and bottom lines dc.DrawLine(rect.x + rect.width, rect.y, rect.x + rect.width, rect.y + rect.height); @@ -314,19 +308,6 @@ void wxStatusBarGeneric::DrawField(wxDC& dc, int i, int textHeight) rect.x, rect.y); dc.DrawLine(rect.x, rect.y, rect.x + rect.width, rect.y); -#else - - dc.DrawLine(rect.x + rect.width, rect.height + 2, - rect.x, rect.height + 2); - dc.DrawLine(rect.x + rect.width, rect.y, - rect.x + rect.width, rect.y + rect.height); - - dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen); - dc.DrawLine(rect.x, rect.y, - rect.x + rect.width, rect.y); - dc.DrawLine(rect.x, rect.y + rect.height, - rect.x, rect.y); -#endif } DrawFieldText(dc, rect, i, textHeight); @@ -387,16 +368,8 @@ int wxStatusBarGeneric::GetFieldFromPoint(const wxPoint& pt) const void wxStatusBarGeneric::InitColours() { -#if defined(__WXPM__) - m_mediumShadowPen = wxPen(wxColour(127, 127, 127)); - m_hilightPen = *wxWHITE_PEN; - - SetBackgroundColour(*wxLIGHT_GREY); - SetForegroundColour(*wxBLACK); -#else // !__WXPM__ m_mediumShadowPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); m_hilightPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT)); -#endif // __WXPM__/!__WXPM__ } void wxStatusBarGeneric::SetMinHeight(int height) @@ -436,8 +409,10 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) #ifdef __WXGTK3__ GtkWidget* toplevel = gtk_widget_get_toplevel(m_widget); GdkRectangle rect; + wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (toplevel && (!gtk_window_get_resize_grip_area(GTK_WINDOW(toplevel), &rect) || rect.width == 0 || rect.height == 0)) + wxGCC_WARNING_RESTORE() { GtkStyleContext* sc = gtk_widget_get_style_context(toplevel); gtk_style_context_save(sc); @@ -495,8 +470,10 @@ void wxStatusBarGeneric::OnLeftDown(wxMouseEvent& event) GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget); #ifdef __WXGTK3__ GdkRectangle rect; + wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) && rect.width && rect.height) + wxGCC_WARNING_RESTORE() { ancestor = NULL; } @@ -543,8 +520,10 @@ void wxStatusBarGeneric::OnRightDown(wxMouseEvent& event) GtkWidget* ancestor = gtk_widget_get_toplevel(m_widget); #ifdef __WXGTK3__ GdkRectangle rect; + wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (ancestor && gtk_window_get_resize_grip_area(GTK_WINDOW(ancestor), &rect) && rect.width && rect.height) + wxGCC_WARNING_RESTORE() { ancestor = NULL; } diff --git a/Externals/wxWidgets3/src/generic/tabg.cpp b/Externals/wxWidgets3/src/generic/tabg.cpp index 7d4dbdf09b..2580a9aece 100644 --- a/Externals/wxWidgets3/src/generic/tabg.cpp +++ b/Externals/wxWidgets3/src/generic/tabg.cpp @@ -35,9 +35,9 @@ WX_DEFINE_LIST(wxTabLayerList) // defined: use new, rounded tab implementation (doesn't colour in tabs) // #define wxUSE_NEW_METHOD -IMPLEMENT_DYNAMIC_CLASS(wxTabControl, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxTabControl, wxObject); -// IMPLEMENT_DYNAMIC_CLASS(wxTabLayer, wxList) +// wxIMPLEMENT_DYNAMIC_CLASS(wxTabLayer, wxList); wxTabControl::wxTabControl(wxTabView *v) { @@ -501,7 +501,7 @@ bool wxTabControl::HitTest(int x, int y) const return false; } -IMPLEMENT_DYNAMIC_CLASS(wxTabView, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxTabView, wxObject); wxTabView::wxTabView(long style) { @@ -1135,13 +1135,13 @@ int wxTabView::CalculateTabWidth(int noTabs, bool adjustView) * wxTabbedDialog */ -IMPLEMENT_CLASS(wxTabbedDialog, wxDialog) +wxIMPLEMENT_CLASS(wxTabbedDialog, wxDialog); -BEGIN_EVENT_TABLE(wxTabbedDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxTabbedDialog, wxDialog) EVT_CLOSE(wxTabbedDialog::OnCloseWindow) EVT_MOUSE_EVENTS(wxTabbedDialog::OnMouseEvent) EVT_PAINT(wxTabbedDialog::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTabbedDialog::wxTabbedDialog(wxWindow *parent, wxWindowID id, const wxString& title, @@ -1180,12 +1180,12 @@ void wxTabbedDialog::OnPaint(wxPaintEvent& WXUNUSED(event) ) * wxTabbedPanel */ -IMPLEMENT_CLASS(wxTabbedPanel, wxPanel) +wxIMPLEMENT_CLASS(wxTabbedPanel, wxPanel); -BEGIN_EVENT_TABLE(wxTabbedPanel, wxPanel) +wxBEGIN_EVENT_TABLE(wxTabbedPanel, wxPanel) EVT_MOUSE_EVENTS(wxTabbedPanel::OnMouseEvent) EVT_PAINT(wxTabbedPanel::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTabbedPanel::wxTabbedPanel(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long windowStyle, const wxString& name): @@ -1216,7 +1216,7 @@ void wxTabbedPanel::OnPaint(wxPaintEvent& WXUNUSED(event) ) * wxPanelTabView */ -IMPLEMENT_CLASS(wxPanelTabView, wxTabView) +wxIMPLEMENT_CLASS(wxPanelTabView, wxTabView); wxPanelTabView::wxPanelTabView(wxPanel *pan, long style) : wxTabView(style) diff --git a/Externals/wxWidgets3/src/generic/textdlgg.cpp b/Externals/wxWidgets3/src/generic/textdlgg.cpp index f3d697fafc..979d7cc9e6 100644 --- a/Externals/wxWidgets3/src/generic/textdlgg.cpp +++ b/Externals/wxWidgets3/src/generic/textdlgg.cpp @@ -58,11 +58,11 @@ static const int wxID_TEXT = 3000; // wxTextEntryDialog // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) +wxIMPLEMENT_CLASS(wxTextEntryDialog, wxDialog); bool wxTextEntryDialog::Create(wxWindow *parent, const wxString& message, @@ -71,7 +71,13 @@ bool wxTextEntryDialog::Create(wxWindow *parent, long style, const wxPoint& pos) { - if ( !wxDialog::Create(GetParentForModalDialog(parent, style), + // Do not pass style to GetParentForModalDialog() as wxDIALOG_NO_PARENT + // has the same numeric value as wxTE_MULTILINE and so attempting to create + // a dialog for editing multiline text would also prevent it from having a + // parent which is undesirable. As it is, we can't create a text entry + // dialog without a parent which is not ideal neither but is a much less + // important problem. + if ( !wxDialog::Create(GetParentForModalDialog(parent, 0), wxID_ANY, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) ) @@ -130,14 +136,20 @@ bool wxTextEntryDialog::Create(wxWindow *parent, bool wxTextEntryDialog::TransferDataToWindow() { - m_textctrl->SetValue(m_value); + if ( m_textctrl ) + { + m_textctrl->SetValue(m_value); + } return wxDialog::TransferDataToWindow(); } bool wxTextEntryDialog::TransferDataFromWindow() { - m_value = m_textctrl->GetValue(); + if ( m_textctrl ) + { + m_value = m_textctrl->GetValue(); + } return wxDialog::TransferDataFromWindow(); } @@ -152,14 +164,28 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) ) void wxTextEntryDialog::SetMaxLength(unsigned long len) { - m_textctrl->SetMaxLength(len); + if ( m_textctrl ) + { + m_textctrl->SetMaxLength(len); + } } void wxTextEntryDialog::SetValue(const wxString& val) { m_value = val; - m_textctrl->SetValue(val); + if ( m_textctrl ) + { + m_textctrl->SetValue(val); + } +} + +void wxTextEntryDialog::ForceUpper() +{ + if ( m_textctrl ) + { + m_textctrl->ForceUpper(); + } } #if wxUSE_VALIDATORS @@ -178,7 +204,10 @@ void wxTextEntryDialog::SetTextValidator( wxTextValidatorStyle style ) void wxTextEntryDialog::SetTextValidator( const wxTextValidator& validator ) { - m_textctrl->SetValidator( validator ); + if ( m_textctrl ) + { + m_textctrl->SetValidator( validator ); + } } #endif // wxUSE_VALIDATORS @@ -187,18 +216,18 @@ void wxTextEntryDialog::SetTextValidator( const wxTextValidator& validator ) // wxPasswordEntryDialog // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxPasswordEntryDialog, wxTextEntryDialog) +wxIMPLEMENT_CLASS(wxPasswordEntryDialog, wxTextEntryDialog); -wxPasswordEntryDialog::wxPasswordEntryDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - const wxString& value, - long style, - const wxPoint& pos) - : wxTextEntryDialog(parent, message, caption, value, - style | wxTE_PASSWORD, pos) +bool wxPasswordEntryDialog::Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxString& value, + long style, + const wxPoint& pos) { // Only change from wxTextEntryDialog is the password style + return wxTextEntryDialog::Create(parent, message, caption, value, + style | wxTE_PASSWORD, pos); } #endif // wxUSE_TEXTDLG diff --git a/Externals/wxWidgets3/src/generic/timectrlg.cpp b/Externals/wxWidgets3/src/generic/timectrlg.cpp index 71867c2f35..e474338db6 100644 --- a/Externals/wxWidgets3/src/generic/timectrlg.cpp +++ b/Externals/wxWidgets3/src/generic/timectrlg.cpp @@ -26,6 +26,7 @@ #ifndef WX_PRECOMP #include "wx/textctrl.h" + #include "wx/utils.h" // wxMax() #endif // WX_PRECOMP #include "wx/timectrl.h" @@ -42,7 +43,7 @@ #include "wx/spinbutt.h" #ifndef wxHAS_NATIVE_TIMEPICKERCTRL - IMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl); #endif // ---------------------------------------------------------------------------- @@ -85,7 +86,11 @@ public: // 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. +#if wxUSE_XLOCALE m_useAMPM = wxLocale::GetInfo(wxLOCALE_TIME_FMT).Contains("%p"); +#else + m_useAMPM = false; +#endif m_text->Connect ( @@ -409,6 +414,7 @@ private: case Field_Max: wxFAIL_MSG( "Invalid field" ); + return; } UpdateText(); @@ -657,7 +663,7 @@ void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height) return; const int widthBtn = m_impl->m_btn->GetSize().x; - const int widthText = width - widthBtn - HMARGIN_TEXT_SPIN; + const int widthText = wxMax(width - widthBtn - HMARGIN_TEXT_SPIN, 0); m_impl->m_text->SetSize(0, 0, widthText, height); m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height); diff --git a/Externals/wxWidgets3/src/generic/timer.cpp b/Externals/wxWidgets3/src/generic/timer.cpp index 0f0ccd1601..b037400524 100644 --- a/Externals/wxWidgets3/src/generic/timer.cpp +++ b/Externals/wxWidgets3/src/generic/timer.cpp @@ -232,14 +232,14 @@ void wxGenericTimerImpl::Stop() // A module to deallocate memory properly: class wxTimerModule: public wxModule { -DECLARE_DYNAMIC_CLASS(wxTimerModule) + wxDECLARE_DYNAMIC_CLASS(wxTimerModule); public: wxTimerModule() {} bool OnInit() { return true; } void OnExit() { wxDELETE(gs_scheduler); } }; -IMPLEMENT_DYNAMIC_CLASS(wxTimerModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimerModule, wxModule); // ---------------------------------------------------------------------------- // wxGUIAppTraits diff --git a/Externals/wxWidgets3/src/generic/tipdlg.cpp b/Externals/wxWidgets3/src/generic/tipdlg.cpp index 47d180962e..aaece5895c 100644 --- a/Externals/wxWidgets3/src/generic/tipdlg.cpp +++ b/Externals/wxWidgets3/src/generic/tipdlg.cpp @@ -50,20 +50,6 @@ static const int wxID_NEXT_TIP = 32000; // whatever -// --------------------------------------------------------------------------- -// macros -// --------------------------------------------------------------------------- - -/* Macro for avoiding #ifdefs when value have to be different depending on size of - device we display on - take it from something like wxDesktopPolicy in the future - */ - -#if defined(__SMARTPHONE__) - #define wxLARGESMALL(large,small) small -#else - #define wxLARGESMALL(large,small) large -#endif - // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -76,7 +62,7 @@ class WXDLLIMPEXP_ADV wxFileTipProvider : public wxTipProvider public: wxFileTipProvider(const wxString& filename, size_t currentTip); - virtual wxString GetTip(); + virtual wxString GetTip() wxOVERRIDE; private: wxTextFile m_textfile; @@ -127,7 +113,7 @@ private: wxTextCtrl *m_text; wxCheckBox *m_checkbox; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTipDialog); }; @@ -159,9 +145,8 @@ wxString wxFileTipProvider::GetTip() // Comments start with a # symbol. // Loop reading lines until get the first one that isn't a comment. // The max number of loop executions is the number of lines in the - // textfile so that can't go into an eternal loop in the [oddball] - // case of a comment-only tips file, or the developer has vetoed - // them all via PreprecessTip(). + // textfile so that can't go into an infinite loop in the [oddball] + // case of a comment-only tips file. for ( size_t i=0; i < count; i++ ) { // The current tip may be at the last line of the textfile, (or @@ -177,10 +162,6 @@ wxString wxFileTipProvider::GetTip() // Read the tip, and increment the current tip counter. tip = m_textfile.GetLine(m_currentTip++); - // Allow a derived class's overrided virtual to modify the tip - // now if so desired. - tip = PreprocessTip(tip); - // Break if tip isn't a comment, and isn't an empty string // (or only stray space characters). if ( !tip.StartsWith(wxT("#")) && (tip.Trim() != wxEmptyString) ) @@ -210,9 +191,9 @@ wxString wxFileTipProvider::GetTip() // wxTipDialog // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTipDialog, wxDialog) +wxBEGIN_EVENT_TABLE(wxTipDialog, wxDialog) EVT_BUTTON(wxID_NEXT_TIP, wxTipDialog::OnNextTip) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTipDialog::wxTipDialog(wxWindow *parent, wxTipProvider *tipProvider, @@ -246,41 +227,20 @@ wxTipDialog::wxTipDialog(wxWindow *parent, wxDEFAULT_CONTROL_BORDER ); #if defined(__WXMSW__) - m_text->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxNORMAL)); + m_text->SetFont(wxFont(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); #endif -//#if defined(__WXPM__) - // - // The only way to get icons into an OS/2 static bitmap control - // -// wxBitmap vBitmap; - -// vBitmap.SetId(wxICON_TIP); // OS/2 specific bitmap method--OS/2 wxBitmaps all have an ID. -// // and for StatBmp's under OS/2 it MUST be a valid resource ID. -// -// wxStaticBitmap* bmp = new wxStaticBitmap(this, wxID_ANY, vBitmap); -// -//#else - wxIcon icon = wxArtProvider::GetIcon(wxART_TIP, wxART_CMN_DIALOG); wxStaticBitmap *bmp = new wxStaticBitmap(this, wxID_ANY, icon); -//#endif - m_checkbox = new wxCheckBox(this, wxID_ANY, _("&Show tips at startup")); m_checkbox->SetValue(showAtStartup); m_checkbox->SetFocus(); - // smart phones does not support or do not waste space for wxButtons -#ifndef __SMARTPHONE__ wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next Tip")); -#endif - // smart phones does not support or do not waste space for wxButtons -#ifndef __SMARTPHONE__ wxButton *btnClose = new wxButton(this, wxID_CLOSE); SetAffirmativeId(wxID_CLOSE); -#endif // 2) put them in boxes @@ -289,10 +249,10 @@ wxTipDialog::wxTipDialog(wxWindow *parent, wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); icon_text->Add( bmp, 0, wxCENTER ); - icon_text->Add( text, 1, wxCENTER | wxLEFT, wxLARGESMALL(20,0) ); - topsizer->Add( icon_text, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) ); + icon_text->Add( text, 1, wxCENTER | wxLEFT, 20 ); + topsizer->Add( icon_text, 0, wxEXPAND | wxALL, 10 ); - topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(10,0) ); + topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 ); wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL ); if (isPda) @@ -300,21 +260,15 @@ wxTipDialog::wxTipDialog(wxWindow *parent, else bottom->Add( m_checkbox, 0, wxCENTER ); - // smart phones does not support or do not waste space for wxButtons -#ifdef __SMARTPHONE__ - SetRightMenu(wxID_NEXT_TIP, _("Next")); - SetLeftMenu(wxID_CLOSE); -#else if (!isPda) bottom->Add( 10,10,1 ); - bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); - bottom->Add( btnClose, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); -#endif + bottom->Add( btnNext, 0, wxCENTER | wxLEFT, 10 ); + bottom->Add( btnClose, 0, wxCENTER | wxLEFT, 10 ); if (isPda) topsizer->Add( bottom, 0, wxCENTER | wxALL, 5 ); else - topsizer->Add( bottom, 0, wxEXPAND | wxALL, wxLARGESMALL(10,0) ); + topsizer->Add( bottom, 0, wxEXPAND | wxALL, 10 ); SetTipText(); diff --git a/Externals/wxWidgets3/src/generic/tipwin.cpp b/Externals/wxWidgets3/src/generic/tipwin.cpp index 7ab7e77ee0..abe66b3275 100644 --- a/Externals/wxWidgets3/src/generic/tipwin.cpp +++ b/Externals/wxWidgets3/src/generic/tipwin.cpp @@ -69,7 +69,7 @@ private: long m_creationTime; #endif // !wxUSE_POPUPWIN - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTipWindowView); }; @@ -81,7 +81,7 @@ private: // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTipWindow, wxTipWindowBase) +wxBEGIN_EVENT_TABLE(wxTipWindow, wxTipWindowBase) EVT_LEFT_DOWN(wxTipWindow::OnMouseClick) EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick) EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick) @@ -90,9 +90,9 @@ BEGIN_EVENT_TABLE(wxTipWindow, wxTipWindowBase) EVT_KILL_FOCUS(wxTipWindow::OnKillFocus) EVT_ACTIVATE(wxTipWindow::OnActivate) #endif // !wxUSE_POPUPWIN -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxTipWindowView, wxWindow) +wxBEGIN_EVENT_TABLE(wxTipWindowView, wxWindow) EVT_PAINT(wxTipWindowView::OnPaint) EVT_LEFT_DOWN(wxTipWindowView::OnMouseClick) @@ -104,7 +104,7 @@ BEGIN_EVENT_TABLE(wxTipWindowView, wxWindow) #if !wxUSE_POPUPWIN EVT_KILL_FOCUS(wxTipWindowView::OnKillFocus) #endif // !wxUSE_POPUPWIN -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxTipWindow diff --git a/Externals/wxWidgets3/src/generic/toolbkg.cpp b/Externals/wxWidgets3/src/generic/toolbkg.cpp index ef724cbac3..40ea3a99c2 100644 --- a/Externals/wxWidgets3/src/generic/toolbkg.cpp +++ b/Externals/wxWidgets3/src/generic/toolbkg.cpp @@ -31,27 +31,20 @@ #include "wx/generic/buttonbar.h" #endif -// ---------------------------------------------------------------------------- -// various wxWidgets macros -// ---------------------------------------------------------------------------- - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase); wxDEFINE_EVENT( wxEVT_TOOLBOOK_PAGE_CHANGING, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_TOOLBOOK_PAGE_CHANGED, wxBookCtrlEvent ); -BEGIN_EVENT_TABLE(wxToolbook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxToolbook, wxBookCtrlBase) EVT_SIZE(wxToolbook::OnSize) EVT_TOOL_RANGE(1, 50, wxToolbook::OnToolSelected) EVT_IDLE(wxToolbook::OnIdle) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxToolbook implementation @@ -174,16 +167,9 @@ bool wxToolbook::SetPageImage(size_t n, int imageId) if (!GetImageList()) return false; - wxToolBarToolBase* tool = GetToolBar()->FindById(n + 1); - if (tool) - { - // Find the image list index for this tool - wxBitmap bitmap = GetImageList()->GetBitmap(imageId); - tool->SetNormalBitmap(bitmap); - return true; - } - else - return false; + GetToolBar()->SetToolNormalBitmap(n + 1, GetImageList()->GetBitmap(imageId)); + + return true; } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/generic/treebkg.cpp b/Externals/wxWidgets3/src/generic/treebkg.cpp index 4e1917d1ca..7e3599564d 100644 --- a/Externals/wxWidgets3/src/generic/treebkg.cpp +++ b/Externals/wxWidgets3/src/generic/treebkg.cpp @@ -44,18 +44,18 @@ // event table // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase); wxDEFINE_EVENT( wxEVT_TREEBOOK_PAGE_CHANGING, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_TREEBOOK_NODE_COLLAPSED, wxBookCtrlEvent ); wxDEFINE_EVENT( wxEVT_TREEBOOK_NODE_EXPANDED, wxBookCtrlEvent ); -BEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase) EVT_TREE_SEL_CHANGED (wxID_ANY, wxTreebook::OnTreeSelectionChange) EVT_TREE_ITEM_EXPANDED (wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxTreebook::OnTreeNodeExpandedCollapsed) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // wxTreebook implementation diff --git a/Externals/wxWidgets3/src/generic/treectlg.cpp b/Externals/wxWidgets3/src/generic/treectlg.cpp index 9a90c457d0..aa8a7dc0da 100644 --- a/Externals/wxWidgets3/src/generic/treectlg.cpp +++ b/Externals/wxWidgets3/src/generic/treectlg.cpp @@ -1,4 +1,3 @@ -// XXX comex: scale support ///////////////////////////////////////////////////////////////////////////// // Name: src/generic/treectlg.cpp // Purpose: generic tree control implementation @@ -81,7 +80,7 @@ public: wxTreeRenameTimer( wxGenericTreeCtrl *owner ); - virtual void Notify(); + virtual void Notify() wxOVERRIDE; private: wxGenericTreeCtrl *m_owner; @@ -113,7 +112,7 @@ private: wxString m_startValue; bool m_aboutToFinish; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxTreeTextCtrl); }; @@ -127,7 +126,7 @@ public: wxTreeFindTimer( wxGenericTreeCtrl *owner ) { m_owner = owner; } - virtual void Notify() { m_owner->ResetFindState(); } + virtual void Notify() wxOVERRIDE { m_owner->ResetFindState(); } private: wxGenericTreeCtrl *m_owner; @@ -416,11 +415,11 @@ void wxTreeRenameTimer::Notify() // wxTreeTextCtrl (internal) //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTreeTextCtrl,wxTextCtrl) +wxBEGIN_EVENT_TABLE(wxTreeTextCtrl,wxTextCtrl) EVT_CHAR (wxTreeTextCtrl::OnChar) EVT_KEY_UP (wxTreeTextCtrl::OnKeyUp) EVT_KILL_FOCUS (wxTreeTextCtrl::OnKillFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *itm) @@ -441,14 +440,6 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, rect.y -= 2; rect.width += 8; rect.height += 4; -#elif defined(wxOSX_USE_CARBON) && wxOSX_USE_CARBON - int bestHeight = GetBestSize().y - 8; - if ( rect.height > bestHeight ) - { - int diff = rect.height - bestHeight; - rect.height -= diff; - rect.y += diff / 2; - } #endif // platforms (void)Create(m_owner, wxID_ANY, m_startValue, @@ -459,6 +450,13 @@ wxTreeTextCtrl::wxTreeTextCtrl(wxGenericTreeCtrl *owner, void wxTreeTextCtrl::EndEdit(bool discardChanges) { + if ( m_aboutToFinish ) + { + // We already called Finish which cannot be called + // more than once. + return; + } + m_aboutToFinish = true; if ( discardChanges ) @@ -509,6 +507,13 @@ void wxTreeTextCtrl::Finish( bool setfocus ) { m_owner->ResetTextControl(); +#ifdef __WXMAC__ + // On wxMac, modal event loops avoid deleting pending objects. + // Hide control so it does not remain visible e.g. if the tree + // control is used in a dialog. + Hide(); +#endif + wxPendingDelete.Append(this); if (setfocus) @@ -556,6 +561,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event ) { if ( !m_aboutToFinish ) { + m_aboutToFinish = true; if ( !AcceptChanges() ) m_owner->OnRenameCancelled( m_itemEdited ); @@ -896,9 +902,9 @@ void wxGenericTreeItem::RecursiveResetTextSize() // wxGenericTreeCtrl implementation // ----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGenericTreeCtrl, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxGenericTreeCtrl, wxControl); -BEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase) +wxBEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase) EVT_PAINT (wxGenericTreeCtrl::OnPaint) EVT_SIZE (wxGenericTreeCtrl::OnSize) EVT_MOUSE_EVENTS (wxGenericTreeCtrl::OnMouse) @@ -907,7 +913,7 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl, wxTreeCtrlBase) EVT_SET_FOCUS (wxGenericTreeCtrl::OnSetFocus) EVT_KILL_FOCUS (wxGenericTreeCtrl::OnKillFocus) EVT_TREE_ITEM_GETTOOLTIP(wxID_ANY, wxGenericTreeCtrl::OnGetToolTip) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ----------------------------------------------------------------------------- // construction/destruction @@ -982,12 +988,6 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, const wxString& name ) { #ifdef __WXMAC__ - int major, minor; - wxGetOsVersion(&major, &minor); - - if (major < 10) - style |= wxTR_ROW_LINES; - if (style & wxTR_HAS_BUTTONS) style |= wxTR_NO_LINES; #endif // __WXMAC__ @@ -1088,7 +1088,7 @@ wxGenericTreeCtrl::GetChildrenCount(const wxTreeItemId& item, return ((wxGenericTreeItem*) item.m_pItem)->GetChildrenCount(recursively); } -void wxGenericTreeCtrl::SetWindowStyle(const long styles) +void wxGenericTreeCtrl::SetWindowStyleFlag(long styles) { // Do not try to expand the root node if it hasn't been created yet if (m_anchor && !HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) @@ -1308,6 +1308,10 @@ bool wxGenericTreeCtrl::IsVisible(const wxTreeItemId& item) const { wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") ); + // Hidden root item is never visible. + if ( item == GetRootItem() && HasFlag(wxTR_HIDE_ROOT) ) + return false; + // An item is only visible if it's not a descendant of a collapsed item wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem; wxGenericTreeItem* parent = pItem->GetParent(); @@ -1955,6 +1959,8 @@ void wxGenericTreeCtrl::ClearFocusedItem() wxTreeItemId item = GetFocusedItem(); if ( item.IsOk() ) SelectItem(item, false); + + m_current = NULL; } void wxGenericTreeCtrl::SetFocusedItem(const wxTreeItemId& item) @@ -2309,21 +2315,20 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item) if ( itemY + itemHeight > start_y*PIXELS_PER_UNIT + clientHeight ) { - // need to scroll up by enough to show this item fully + // need to scroll down by enough to show this item fully itemY += itemHeight - clientHeight; -#ifdef __WXOSX__ + // because itemY below will be divided by PIXELS_PER_UNIT it may // be rounded down, with the result of the item still only being // partially visible, so make sure we are rounding up - itemY += PIXELS_PER_UNIT-1; -#endif + itemY += PIXELS_PER_UNIT - 1; } else if ( itemY > start_y*PIXELS_PER_UNIT ) { // item is already fully visible, don't do anything return; } - //else: scroll down to make this item the top one displayed + //else: scroll up to make this item the top one displayed Scroll(-1, itemY/PIXELS_PER_UNIT); } @@ -2578,11 +2583,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) else { int flags = wxCONTROL_SELECTED; - if (m_hasFocus -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS - && IsControlActive( (ControlRef)GetHandle() ) -#endif - ) + if (m_hasFocus) flags |= wxCONTROL_FOCUSED; if ((item == m_current) && (m_hasFocus)) flags |= wxCONTROL_CURRENT; @@ -2775,15 +2776,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, wxTRANSPARENT_PEN; wxColour colText; - if ( item->IsSelected() -#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS - // On wxMac, if the tree doesn't have the focus we draw an empty - // rectangle, so we want to make sure that the text is visible - // against the normal background, not the highlightbackground, so - // don't use the highlight text colour unless we have the focus. - && m_hasFocus && IsControlActive( (ControlRef)GetHandle() ) -#endif - ) + if ( item->IsSelected() ) { #ifdef __WXMAC__ colText = *wxWHITE; @@ -3124,7 +3117,7 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) ExpandAllChildren(m_current); break; } - //else: fall through to Collapse() it + wxFALLTHROUGH;//else: fall through to Collapse() it case '-': case WXK_SUBTRACT: @@ -3231,14 +3224,12 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event ) break; case WXK_RIGHT: - // this works the same as the down arrow except that we - // also expand the item if it wasn't expanded yet + // right arrow just expand the item will be fine if (m_current != GetRootItem().m_pItem || !HasFlag(wxTR_HIDE_ROOT)) Expand(m_current); //else: don't try to expand hidden root item (which can be the // current one when the tree is empty) - - // fall through + break; case WXK_DOWN: { @@ -3504,9 +3495,10 @@ wxTextCtrl* wxGenericTreeCtrl::GetEditControl() const void wxGenericTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges) { - wxCHECK_RET( m_textCtrl, wxT("not editing label") ); - - m_textCtrl->EndEdit(discardChanges); + if (m_textCtrl) + { + m_textCtrl->EndEdit(discardChanges); + } } bool wxGenericTreeCtrl::OnRenameAccept(wxGenericTreeItem *item, diff --git a/Externals/wxWidgets3/src/generic/treelist.cpp b/Externals/wxWidgets3/src/generic/treelist.cpp index 73fbe6c466..e93a708790 100644 --- a/Externals/wxWidgets3/src/generic/treelist.cpp +++ b/Externals/wxWidgets3/src/generic/treelist.cpp @@ -170,10 +170,15 @@ public: wxScopedArray oldTexts(m_columnsTexts); m_columnsTexts = new wxString[numColumns - 2]; + + // As above, 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 ) + if ( m == col ) { + // Skip copying the deleted column and keep the new index the + // same (so compensate for "n++" done in the loop). n--; } else // Not the deleted column. @@ -363,24 +368,24 @@ public: // Implement the base class pure virtual methods. - virtual unsigned GetColumnCount() const; - virtual wxString GetColumnType(unsigned col) const; + virtual unsigned GetColumnCount() const wxOVERRIDE; + virtual wxString GetColumnType(unsigned col) const wxOVERRIDE; virtual void GetValue(wxVariant& variant, const wxDataViewItem& item, - unsigned col) const; + unsigned col) const wxOVERRIDE; 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; + unsigned col) wxOVERRIDE; + virtual wxDataViewItem GetParent(const wxDataViewItem& item) const wxOVERRIDE; + virtual bool IsContainer(const wxDataViewItem& item) const wxOVERRIDE; + virtual bool HasContainerColumns(const wxDataViewItem& item) const wxOVERRIDE; virtual unsigned GetChildren(const wxDataViewItem& item, - wxDataViewItemArray& children) const; - virtual bool IsListModel() const { return m_isFlat; } + wxDataViewItemArray& children) const wxOVERRIDE; + virtual bool IsListModel() const wxOVERRIDE { return m_isFlat; } virtual int Compare(const wxDataViewItem& item1, const wxDataViewItem& item2, unsigned col, - bool ascending) const; + bool ascending) const wxOVERRIDE; private: // The control we're associated with. @@ -427,12 +432,6 @@ public: { } - 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; @@ -456,18 +455,18 @@ public: { } - virtual bool SetValue(const wxVariant& value) + virtual bool SetValue(const wxVariant& value) wxOVERRIDE { m_value << value; return true; } - virtual bool GetValue(wxVariant& WXUNUSED(value)) const + virtual bool GetValue(wxVariant& WXUNUSED(value)) const wxOVERRIDE { return false; } - wxSize GetSize() const + wxSize GetSize() const wxOVERRIDE { wxSize size = GetCheckSize(); size.x += MARGIN_CHECK_ICON; @@ -494,7 +493,7 @@ public: return size; } - virtual bool Render(wxRect cell, wxDC* dc, int state) + virtual bool Render(wxRect cell, wxDC* dc, int state) wxOVERRIDE { // Draw the checkbox first. int renderFlags = 0; @@ -552,7 +551,7 @@ public: wxDataViewModel *model, const wxDataViewItem & item, unsigned int WXUNUSED(col), - const wxMouseEvent *mouseEvent) + const wxMouseEvent *mouseEvent) wxOVERRIDE { if ( mouseEvent ) { @@ -664,20 +663,16 @@ wxTreeListModel::InsertItem(Node* parent, 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()) ) + if ( previous == wxTLI_FIRST || + (previous == wxTLI_LAST && !parent->GetChild()) ) { parent->InsertChild(newItem.get()); } else // Not the first item, find the previous one. { - if ( previousItem == wxTLI_LAST ) + if ( previous == wxTLI_LAST ) { previous = parent->GetChild(); @@ -738,7 +733,10 @@ void wxTreeListModel::DeleteItem(Node* item) previous->DeleteNext(); } - ItemDeleted(ToDVI(parent), ToDVI(item)); + // Note that the item is already deleted by now, so we can't use it in any + // way, e.g. by calling ToDVI(item) which does dereference the pointer, but + // ToNonRootDVI() that we use here does not. + ItemDeleted(ToDVI(parent), ToNonRootDVI(item)); } void wxTreeListModel::DeleteAllItems() @@ -984,7 +982,7 @@ wxTreeListModel::Compare(const wxDataViewItem& item1, // wxTreeListCtrl implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxTreeListCtrl, wxWindow) +wxBEGIN_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) @@ -993,7 +991,7 @@ BEGIN_EVENT_TABLE(wxTreeListCtrl, wxWindow) EVT_DATAVIEW_COLUMN_SORTED(wxID_ANY, wxTreeListCtrl::OnColumnSorted) EVT_SIZE(wxTreeListCtrl::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // Creation @@ -1410,6 +1408,14 @@ void wxTreeListCtrl::UnselectAll() m_view->UnselectAll(); } +void wxTreeListCtrl::EnsureVisible(wxTreeListItem item) +{ + wxCHECK_RET( m_view, "Must create first" ); + + m_view->EnsureVisible(m_model->ToDVI(item)); +} + + // ---------------------------------------------------------------------------- // Checkbox handling // ---------------------------------------------------------------------------- @@ -1662,7 +1668,7 @@ wxWindow* wxTreeListCtrl::GetView() const // wxTreeListEvent implementation // ============================================================================ -wxIMPLEMENT_DYNAMIC_CLASS(wxTreeListEvent, wxNotifyEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxTreeListEvent, wxNotifyEvent); #define wxDEFINE_TREELIST_EVENT(name) \ wxDEFINE_EVENT(wxEVT_TREELIST_##name, wxTreeListEvent) diff --git a/Externals/wxWidgets3/src/generic/vlbox.cpp b/Externals/wxWidgets3/src/generic/vlbox.cpp index e277070b3d..60c524dbd2 100644 --- a/Externals/wxWidgets3/src/generic/vlbox.cpp +++ b/Externals/wxWidgets3/src/generic/vlbox.cpp @@ -41,7 +41,7 @@ // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow) +wxBEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow) EVT_PAINT(wxVListBox::OnPaint) EVT_KEY_DOWN(wxVListBox::OnKeyDown) @@ -52,13 +52,13 @@ BEGIN_EVENT_TABLE(wxVListBox, wxVScrolledWindow) EVT_KILL_FOCUS(wxVListBox::OnSetOrKillFocus) EVT_SIZE(wxVListBox::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxVListBox, wxVScrolledWindow) +wxIMPLEMENT_ABSTRACT_CLASS(wxVListBox, wxVScrolledWindow); const char wxVListBoxNameStr[] = "wxVListBox"; // ---------------------------------------------------------------------------- @@ -696,13 +696,7 @@ void wxVListBox::OnLeftDown(wxMouseEvent& event) if ( event.ShiftDown() ) flags |= ItemClick_Shift; - // under Mac Apple-click is used in the same way as Ctrl-click - // elsewhere -#ifdef __WXMAC__ - if ( event.MetaDown() ) -#else if ( event.ControlDown() ) -#endif flags |= ItemClick_Ctrl; DoHandleItemClick(item, flags); diff --git a/Externals/wxWidgets3/src/generic/vscroll.cpp b/Externals/wxWidgets3/src/generic/vscroll.cpp index 38e882bbb0..995f4d2c7a 100644 --- a/Externals/wxWidgets3/src/generic/vscroll.cpp +++ b/Externals/wxWidgets3/src/generic/vscroll.cpp @@ -49,7 +49,7 @@ public: m_scrollHelper = scrollHelper; } - virtual bool ProcessEvent(wxEvent& event); + virtual bool ProcessEvent(wxEvent& event) wxOVERRIDE; private: wxVarScrollHelperBase *m_scrollHelper; @@ -996,9 +996,9 @@ bool wxVarHVScrollHelper::IsVisible(size_t row, size_t column) const // wx[V/H/HV]ScrolledWindow implementations // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel) -IMPLEMENT_ABSTRACT_CLASS(wxHScrolledWindow, wxPanel) -IMPLEMENT_ABSTRACT_CLASS(wxHVScrolledWindow, wxPanel) +wxIMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel); +wxIMPLEMENT_ABSTRACT_CLASS(wxHScrolledWindow, wxPanel); +wxIMPLEMENT_ABSTRACT_CLASS(wxHVScrolledWindow, wxPanel); #if WXWIN_COMPATIBILITY_2_8 diff --git a/Externals/wxWidgets3/src/generic/wizard.cpp b/Externals/wxWidgets3/src/generic/wizard.cpp index 25d1a669d0..d877d14cf8 100644 --- a/Externals/wxWidgets3/src/generic/wizard.cpp +++ b/Externals/wxWidgets3/src/generic/wizard.cpp @@ -53,10 +53,10 @@ class wxWizardSizer : public wxSizer public: wxWizardSizer(wxWizard *owner); - virtual wxSizerItem *Insert(size_t index, wxSizerItem *item); + virtual wxSizerItem *Insert(size_t index, wxSizerItem *item) wxOVERRIDE; - virtual void RecalcSizes(); - virtual wxSize CalcMin(); + virtual void RecalcSizes() wxOVERRIDE; + virtual wxSize CalcMin() wxOVERRIDE; // get the max size of all wizard pages wxSize GetMaxChildSize(); @@ -88,7 +88,7 @@ wxDEFINE_EVENT( wxEVT_WIZARD_FINISHED, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_HELP, wxWizardEvent ); wxDEFINE_EVENT( wxEVT_WIZARD_PAGE_SHOWN, wxWizardEvent ); -BEGIN_EVENT_TABLE(wxWizard, wxDialog) +wxBEGIN_EVENT_TABLE(wxWizard, wxDialog) EVT_BUTTON(wxID_CANCEL, wxWizard::OnCancel) EVT_BUTTON(wxID_BACKWARD, wxWizard::OnBackOrNext) EVT_BUTTON(wxID_FORWARD, wxWizard::OnBackOrNext) @@ -99,9 +99,9 @@ BEGIN_EVENT_TABLE(wxWizard, wxDialog) EVT_WIZARD_CANCEL(wxID_ANY, wxWizard::OnWizEvent) EVT_WIZARD_FINISHED(wxID_ANY, wxWizard::OnWizEvent) EVT_WIZARD_HELP(wxID_ANY, wxWizard::OnWizEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxWizard, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxWizard, wxDialog); /* TODO PROPERTIES : @@ -110,9 +110,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxWizard, wxDialog) title */ -IMPLEMENT_ABSTRACT_CLASS(wxWizardPage, wxPanel) -IMPLEMENT_DYNAMIC_CLASS(wxWizardPageSimple, wxWizardPage) -IMPLEMENT_DYNAMIC_CLASS(wxWizardEvent, wxNotifyEvent) +wxIMPLEMENT_ABSTRACT_CLASS(wxWizardPage, wxPanel); +wxIMPLEMENT_DYNAMIC_CLASS(wxWizardPageSimple, wxWizardPage); +wxIMPLEMENT_DYNAMIC_CLASS(wxWizardEvent, wxNotifyEvent); // ============================================================================ // implementation @@ -271,6 +271,7 @@ void wxWizard::Init() { m_posWizard = wxDefaultPosition; m_page = NULL; + m_firstpage = NULL; m_btnPrev = m_btnNext = NULL; m_statbmp = NULL; m_sizerBmpAndPage = NULL; @@ -410,7 +411,7 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) mainColumn->Add( buttonRow, 0, // Vertically unstretchable - wxGROW|wxALIGN_CENTRE + wxEXPAND ); else #endif @@ -620,7 +621,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) // and update the buttons state - m_btnPrev->Enable(HasPrevPage(m_page)); + m_btnPrev->Enable(m_page != m_firstpage); const bool hasNext = HasNextPage(m_page); const wxString label = hasNext ? _("&Next >") : _("&Finish"); @@ -687,6 +688,8 @@ bool wxWizard::RunWizard(wxWizardPage *firstPage) { wxCHECK_MSG( firstPage, false, wxT("can't run empty wizard") ); + m_firstpage = firstPage; + // can't return false here because there is no old page (void)ShowPage(firstPage, true /* forward */); diff --git a/Externals/wxWidgets3/src/gtk/aboutdlg.cpp b/Externals/wxWidgets3/src/gtk/aboutdlg.cpp index fc978bf990..e65eb41d24 100644 --- a/Externals/wxWidgets3/src/gtk/aboutdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/aboutdlg.cpp @@ -23,7 +23,7 @@ #include "wx/aboutdlg.h" #ifndef WX_PRECOMP - #include "wx/utils.h" // for wxLaunchDefaultBrowser() + #include "wx/window.h" #endif //WX_PRECOMP #include @@ -131,7 +131,7 @@ static void wxGtkAboutDialogOnLink(GtkAboutDialog*, const char* link, void*) } #endif -void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent)) +void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent) { // don't create another dialog if one is already present if ( !gs_aboutDialog ) @@ -235,6 +235,11 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent)) g_signal_connect(dlg, "response", G_CALLBACK(wxGtkAboutDialogOnClose), NULL); + GtkWindow* gtkParent = NULL; + if (parent && parent->m_widget) + gtkParent = (GtkWindow*)gtk_widget_get_ancestor(parent->m_widget, GTK_TYPE_WINDOW); + gtk_window_set_transient_for(GTK_WINDOW(dlg), gtkParent); + gtk_window_present(GTK_WINDOW(dlg)); } diff --git a/Externals/wxWidgets3/src/gtk/activityindicator.cpp b/Externals/wxWidgets3/src/gtk/activityindicator.cpp new file mode 100644 index 0000000000..c64d84601a --- /dev/null +++ b/Externals/wxWidgets3/src/gtk/activityindicator.cpp @@ -0,0 +1,168 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/activityindicator.cpp +// Purpose: wxActivityIndicator implementation for wxGTK. +// Author: Vadim Zeitlin +// Created: 2015-03-05 +// Copyright: (c) 2015 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_ACTIVITYINDICATOR && defined(__WXGTK220__) + +#include "wx/activityindicator.h" + +#include "wx/math.h" + +#include + +// Macro return the specified expression only if GTK+ run time version is less +// than 2.20 and compiling it only if it is less than 3.0 (which is why this +// has to be a macro and not a function). +#if defined(__WXGTK220__) && !defined(__WXGTK3__) + #define RETURN_IF_NO_GTK_SPINNER(expr) \ + if ( gtk_check_version(2, 20, 0) != 0 ) { return expr; } +#else + #define RETURN_IF_NO_GTK_SPINNER(expr) +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +wxIMPLEMENT_DYNAMIC_CLASS(wxActivityIndicator, wxControl); + +bool +wxActivityIndicator::Create(wxWindow* parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + RETURN_IF_NO_GTK_SPINNER( + wxActivityIndicatorGeneric::Create(parent, winid, pos, size, style, name) + ) + + if ( !PreCreation(parent, pos, size) || + !CreateBase(parent, winid, pos, size, style, name) ) + return false; + + m_widget = gtk_spinner_new(); + g_object_ref(m_widget); + + m_parent->DoAddChild(this); + + PostCreation(size); + + return true; +} + +void wxActivityIndicator::Start() +{ + RETURN_IF_NO_GTK_SPINNER( wxActivityIndicatorGeneric::Start() ) + + wxCHECK_RET( m_widget, wxS("Must be created first") ); + + gtk_spinner_start(GTK_SPINNER(m_widget)); +} + +void wxActivityIndicator::Stop() +{ + RETURN_IF_NO_GTK_SPINNER( wxActivityIndicatorGeneric::Stop() ) + + wxCHECK_RET( m_widget, wxS("Must be created first") ); + + gtk_spinner_stop(GTK_SPINNER(m_widget)); +} + +bool wxActivityIndicator::IsRunning() const +{ + RETURN_IF_NO_GTK_SPINNER( wxActivityIndicatorGeneric::IsRunning() ) + + if ( !m_widget ) + return false; + + gboolean b; + g_object_get(m_widget, "active", &b, NULL); + + return b != 0; +} + +wxSize wxActivityIndicator::DoGetBestClientSize() const +{ + RETURN_IF_NO_GTK_SPINNER( wxActivityIndicatorGeneric::DoGetBestClientSize() ) + + if ( !m_widget ) + return wxDefaultSize; + + gint w, h; + +#ifdef __WXGTK3__ + // gtk_widget_get_preferred_size() seems to return the size based on the + // current size of the widget and also always returns 0 if it is hidden, + // so ask GtkSpinner for its preferred size directly instead of using it. + GtkWidgetClass* const wc = GTK_WIDGET_GET_CLASS(m_widget); + + // We're not interested in the natural size (and it's the same as minimal + // one anyhow currently), but we still need a non-NULL pointer for it. + gint dummy; + wc->get_preferred_width(m_widget, &w, &dummy); + wc->get_preferred_height(m_widget, &h, &dummy); +#else // GTK+ 2 + // GTK+ 2 doesn't return any valid preferred size for this control, so we + // use the size of something roughly equivalent to it. + gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &w, &h); +#endif // GTK+ 3/2 + + // Adjust for the window variant: note that the default size in GTK+ 3 is + // really small (12px until ~3.10, 16px since then), so we use this size as + // the small size and double it for the normal size. + double factor = 0.; + switch ( GetWindowVariant() ) + { + case wxWINDOW_VARIANT_MAX: + wxFAIL_MSG(wxS("Invalid window variant")); + wxFALLTHROUGH; + + case wxWINDOW_VARIANT_NORMAL: + factor = 2.; + break; + + case wxWINDOW_VARIANT_SMALL: + factor = 1.; + break; + + case wxWINDOW_VARIANT_MINI: + factor = 0.75; + break; + + case wxWINDOW_VARIANT_LARGE: + // GTK+ 3.11+ limits GtkSpinner size to twice its minimal size, so + // the effective factor here is actually just 2, i.e. the same as + // for the normal size, but use something larger just in case GTK+ + // changes its mind again later. + factor = 2.5; + break; + } + + wxASSERT_MSG( !wxIsSameDouble(factor, 0), wxS("Unknown window variant") ); + + return wxSize(wxRound(w*factor), wxRound(h*factor)); +} + +#endif // wxUSE_ACTIVITYINDICATOR diff --git a/Externals/wxWidgets3/src/gtk/animate.cpp b/Externals/wxWidgets3/src/gtk/animate.cpp index 8ed590bbe9..a36a16f33d 100644 --- a/Externals/wxWidgets3/src/gtk/animate.cpp +++ b/Externals/wxWidgets3/src/gtk/animate.cpp @@ -51,7 +51,7 @@ void gdk_pixbuf_area_updated(GdkPixbufLoader *loader, // wxAnimation //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxAnimation, wxAnimationBase); wxAnimation::wxAnimation(const wxAnimation& that) : base_type(that) @@ -202,10 +202,10 @@ void wxAnimation::SetPixbuf(GdkPixbufAnimation* p) // wxAnimationCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrl, wxAnimationCtrlBase) -BEGIN_EVENT_TABLE(wxAnimationCtrl, wxAnimationCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxAnimationCtrl, wxAnimationCtrlBase); +wxBEGIN_EVENT_TABLE(wxAnimationCtrl, wxAnimationCtrlBase) EVT_TIMER(wxID_ANY, wxAnimationCtrl::OnTimer) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxAnimationCtrl::Init() { diff --git a/Externals/wxWidgets3/src/gtk/anybutton.cpp b/Externals/wxWidgets3/src/gtk/anybutton.cpp index d64948f55e..16e7b4a22d 100644 --- a/Externals/wxWidgets3/src/gtk/anybutton.cpp +++ b/Externals/wxWidgets3/src/gtk/anybutton.cpp @@ -136,20 +136,35 @@ void wxAnyButton::GTKOnFocus(wxFocusEvent& event) GTKUpdateBitmap(); } -wxAnyButton::State wxAnyButton::GTKGetCurrentState() const +wxAnyButton::State wxAnyButton::GTKGetCurrentBitmapState() const { if ( !IsThisEnabled() ) - return m_bitmaps[State_Disabled].IsOk() ? State_Disabled : State_Normal; + { + if ( m_bitmaps[State_Disabled].IsOk() ) + return State_Disabled; + } + else + { + if ( m_isPressed && m_bitmaps[State_Pressed].IsOk() ) + return State_Pressed; - if ( m_isPressed && m_bitmaps[State_Pressed].IsOk() ) - return State_Pressed; + if ( m_isCurrent && m_bitmaps[State_Current].IsOk() ) + return State_Current; - if ( m_isCurrent && m_bitmaps[State_Current].IsOk() ) - return State_Current; + if ( HasFocus() && m_bitmaps[State_Focused].IsOk() ) + return State_Focused; + } - if ( HasFocus() && m_bitmaps[State_Focused].IsOk() ) - return State_Focused; + // Fall back on the normal state: which still might be different from + // State_Normal for the toggle buttons, so the check for bitmap validity is + // still needed. + const State normalState = GetNormalState(); + if ( m_bitmaps[normalState].IsOk() ) + return normalState; + // And if nothing else can (or should) be used, finally fall back to the + // normal state which is the only one guaranteed to have a bitmap (if we're + // using bitmaps at all and we're only called in this case). return State_Normal; } @@ -160,7 +175,7 @@ void wxAnyButton::GTKUpdateBitmap() { // if we do show them, this will return a state for which we do have a // valid bitmap - State state = GTKGetCurrentState(); + State state = GTKGetCurrentBitmapState(); GTKDoShowBitmap(m_bitmaps[state]); } @@ -215,6 +230,11 @@ void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) { image = gtk_image_new(); gtk_button_set_image(GTK_BUTTON(m_widget), image); + + // Setting the image recreates the label, so we need to + // reapply the styles to it to preserve the existing text + // font and colour if they're different from defaults. + GTKApplyWidgetStyle(); } else // image presence or absence didn't change { @@ -360,7 +380,7 @@ void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) // 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() ) + if ( bitmap.IsOk() && which == GTKGetCurrentBitmapState() ) { GTKDoShowBitmap(bitmap); } @@ -396,6 +416,11 @@ void wxAnyButton::DoSetBitmapPosition(wxDirection dir) } gtk_button_set_image_position(GTK_BUTTON(m_widget), gtkpos); + + // As in DoSetBitmap() above, the above call can invalidate the label + // style, so reapply it to preserve its font and colour. + GTKApplyWidgetStyle(); + InvalidateBestSize(); } #endif // GTK+ 2.10+ diff --git a/Externals/wxWidgets3/src/gtk/app.cpp b/Externals/wxWidgets3/src/gtk/app.cpp index 2bd616a4ba..517541ea2e 100644 --- a/Externals/wxWidgets3/src/gtk/app.cpp +++ b/Externals/wxWidgets3/src/gtk/app.cpp @@ -28,14 +28,6 @@ #include "wx/apptrait.h" #include "wx/fontmap.h" -#if wxUSE_LIBHILDON - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 - #include -#endif // wxUSE_LIBHILDON2 - #include #include "wx/gtk/private.h" @@ -108,6 +100,21 @@ static gboolean wxapp_idle_callback(gpointer) } } +// 0: no change, 1: focus in, 2: focus out +static int gs_focusChange; + +extern "C" { +static gboolean +wx_focus_event_hook(GSignalInvocationHint*, unsigned, const GValue* param_values, void* data) +{ + // If focus change on TLW + if (GTK_IS_WINDOW(g_value_peek_pointer(param_values))) + gs_focusChange = GPOINTER_TO_INT(data); + + return true; +} +} + bool wxApp::DoIdle() { guint id_save; @@ -131,6 +138,12 @@ bool wxApp::DoIdle() } gdk_threads_enter(); + + if (gs_focusChange) { + SetActive(gs_focusChange == 1, NULL); + gs_focusChange = 0; + } + bool needMore; do { ProcessPendingEvents(); @@ -164,27 +177,11 @@ bool wxApp::DoIdle() return keepSource; } -//----------------------------------------------------------------------------- -// Access to the root window global -//----------------------------------------------------------------------------- - -GtkWidget* wxGetRootWindow() -{ - static GtkWidget *s_RootWindow = NULL; - - if (s_RootWindow == NULL) - { - s_RootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_realize( s_RootWindow ); - } - return s_RootWindow; -} - //----------------------------------------------------------------------------- // wxApp //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler); wxApp::wxApp() { @@ -270,14 +267,6 @@ bool wxApp::OnInitGui() } #endif -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - if ( !GetHildonProgram() ) - { - wxLogError(_("Unable to initialize Hildon program")); - return false; - } -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - return true; } @@ -290,7 +279,13 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) #if wxUSE_THREADS if (!g_thread_supported()) { + // g_thread_init() does nothing and is deprecated in recent glib but + // might still be needed in the older versions, which are the only ones + // for which this code is going to be executed (as g_thread_supported() + // is always TRUE in these recent glib versions anyhow). + wxGCC_WARNING_SUPPRESS(deprecated-declarations) g_thread_init(NULL); + wxGCC_WARNING_RESTORE() gdk_threads_init(); } #endif // wxUSE_THREADS @@ -447,8 +442,18 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding()); #endif - // make sure GtkWidget type is loaded, idle hooks need it - g_type_class_ref(GTK_TYPE_WIDGET); + // make sure GtkWidget type is loaded, signal emission hooks need it + const GType widgetType = GTK_TYPE_WIDGET; + g_type_class_ref(widgetType); + + // focus in/out hooks used for generating wxEVT_ACTIVATE_APP + g_signal_add_emission_hook( + g_signal_lookup("focus_in_event", widgetType), + 0, wx_focus_event_hook, GINT_TO_POINTER(1), NULL); + g_signal_add_emission_hook( + g_signal_lookup("focus_out_event", widgetType), + 0, wx_focus_event_hook, GINT_TO_POINTER(2), NULL); + WakeUpIdle(); return true; @@ -460,7 +465,9 @@ void wxApp::CleanUp() g_source_remove(m_idleSourceId); // release reference acquired by Initialize() - g_type_class_unref(g_type_class_peek(GTK_TYPE_WIDGET)); + gpointer gt = g_type_class_peek(GTK_TYPE_WIDGET); + if (gt != NULL) + g_type_class_unref(gt); gdk_threads_leave(); @@ -546,12 +553,3 @@ bool wxApp::GTKIsUsingGlobalMenu() return s_isUsingGlobalMenu == 1; } - -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 -// Maemo-specific method: get the main program object -HildonProgram *wxApp::GetHildonProgram() -{ - return hildon_program_get_instance(); -} - -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 diff --git a/Externals/wxWidgets3/src/gtk/artgtk.cpp b/Externals/wxWidgets3/src/gtk/artgtk.cpp index addcca0f1f..ba56942264 100644 --- a/Externals/wxWidgets3/src/gtk/artgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/artgtk.cpp @@ -24,14 +24,9 @@ #include #include "wx/gtk/private.h" -// compatibility with older GTK+ versions: -#ifndef GTK_STOCK_FILE - #define GTK_STOCK_FILE "gtk-file" +#if !GTK_CHECK_VERSION(2,8,0) + #define GTK_STOCK_FULLSCREEN "gtk-fullscreen" #endif -#ifndef GTK_STOCK_DIRECTORY - #define GTK_STOCK_DIRECTORY "gtk-directory" -#endif - // ---------------------------------------------------------------------------- // wxGTK2ArtProvider @@ -41,9 +36,9 @@ class wxGTK2ArtProvider : public wxArtProvider { protected: virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size); + const wxSize& size) wxOVERRIDE; virtual wxIconBundle CreateIconBundle(const wxArtID& id, - const wxArtClient& client); + const wxArtClient& client) wxOVERRIDE; }; /*static*/ void wxArtProvider::InitNativeProvider() @@ -124,6 +119,7 @@ wxString wxArtIDToStock(const wxArtID& id) ART(wxART_FIND, GTK_STOCK_FIND) ART(wxART_FIND_AND_REPLACE, GTK_STOCK_FIND_AND_REPLACE) + ART(wxART_FULL_SCREEN, GTK_STOCK_FULLSCREEN) #undef ART diff --git a/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp b/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp index a495ce7ace..8f24ef6746 100644 --- a/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp +++ b/Externals/wxWidgets3/src/gtk/assertdlg_gtk.cpp @@ -113,7 +113,8 @@ void gtk_assert_dialog_process_backtrace (GtkAssertDialog *dlg) { /* set busy cursor */ GdkWindow *parent = gtk_widget_get_window(GTK_WIDGET(dlg)); - GdkCursor *cur = gdk_cursor_new (GDK_WATCH); + GdkDisplay* display = gdk_window_get_display(parent); + GdkCursor* cur = gdk_cursor_new_for_display(display, GDK_WATCH); gdk_window_set_cursor (parent, cur); gdk_flush (); diff --git a/Externals/wxWidgets3/src/gtk/bitmap.cpp b/Externals/wxWidgets3/src/gtk/bitmap.cpp index 6ab6bcb628..5e57df7410 100644 --- a/Externals/wxWidgets3/src/gtk/bitmap.cpp +++ b/Externals/wxWidgets3/src/gtk/bitmap.cpp @@ -15,6 +15,7 @@ #include "wx/icon.h" #include "wx/image.h" #include "wx/colour.h" + #include "wx/cursor.h" #endif #include "wx/rawbmp.h" @@ -24,7 +25,7 @@ #include -extern GtkWidget *wxGetRootWindow(); +GdkWindow* wxGetTopLevelGDK(); #ifndef __WXGTK3__ static void PixmapToPixbuf(GdkPixmap* pixmap, GdkPixbuf* pixbuf, int w, int h) @@ -74,7 +75,7 @@ static void MaskToAlpha(GdkPixmap* mask, GdkPixbuf* pixbuf, int w, int h) // wxMask //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxMaskBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxMaskBase); wxMask::wxMask() { @@ -245,7 +246,7 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) } g_object_unref(image); } - m_bitmap = gdk_bitmap_create_from_data(wxGetRootWindow()->window, (char*)out, w, h); + m_bitmap = gdk_bitmap_create_from_data(wxGetTopLevelGDK(), (char*)out, w, h); delete[] out; #endif return true; @@ -260,7 +261,7 @@ bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) #ifdef __WXGTK3__ InitFromColour(bitmap, *wxBLACK); #else - m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 ); + m_bitmap = gdk_pixmap_new(wxGetTopLevelGDK(), bitmap.GetWidth(), bitmap.GetHeight(), 1); if (!m_bitmap) return false; @@ -331,12 +332,13 @@ public: wxBitmapRefData(int width, int height, int depth); virtual ~wxBitmapRefData(); - virtual bool IsOk() const; + virtual bool IsOk() const wxOVERRIDE; #ifdef __WXGTK3__ GdkPixbuf* m_pixbufMask; GdkPixbuf* m_pixbufNoMask; cairo_surface_t* m_surface; + double m_scaleFactor; #else GdkPixmap *m_pixmap; GdkPixbuf *m_pixbuf; @@ -362,6 +364,7 @@ wxBitmapRefData::wxBitmapRefData(int width, int height, int depth) m_pixbufMask = NULL; m_pixbufNoMask = NULL; m_surface = NULL; + m_scaleFactor = 1; #else m_pixmap = NULL; m_pixbuf = NULL; @@ -375,7 +378,7 @@ wxBitmapRefData::wxBitmapRefData(int width, int height, int depth) m_bpp = 24; #else if (m_bpp < 0) - m_bpp = gdk_drawable_get_depth(wxGetRootWindow()->window); + m_bpp = gdk_drawable_get_depth(wxGetTopLevelGDK()); m_alphaRequested = depth == 32; #endif } @@ -409,7 +412,7 @@ bool wxBitmapRefData::IsOk() const #define M_BMPDATA static_cast(m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject); wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type) { @@ -443,7 +446,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) } #else M_BMPDATA->m_pixmap = gdk_bitmap_create_from_data( - wxGetRootWindow()->window, bits, width, height); + wxGetTopLevelGDK(), bits, width, height); #endif } } @@ -466,7 +469,8 @@ wxBitmap::wxBitmap(const char* const* bits) } #else GdkBitmap* mask = NULL; - GdkPixmap* pixmap = gdk_pixmap_create_from_xpm_d(wxGetRootWindow()->window, &mask, NULL, const_cast(bits)); + GdkPixmap* pixmap = gdk_pixmap_create_from_xpm_d( + wxGetTopLevelGDK(), &mask, NULL, const_cast(bits)); if (pixmap) { int width, height; @@ -514,6 +518,19 @@ wxBitmap::wxBitmap(GdkPixmap* pixmap) } #endif +wxBitmap::wxBitmap(const wxCursor& cursor) +{ +#if GTK_CHECK_VERSION(2,8,0) + if (gtk_check_version(2,8,0) == NULL) + { + GdkPixbuf *pixbuf = gdk_cursor_get_image(cursor.GetCursor()); + *this = wxBitmap(pixbuf); + } +#else + wxUnusedVar(cursor); +#endif +} + wxBitmap::~wxBitmap() { } @@ -521,7 +538,7 @@ wxBitmap::~wxBitmap() bool wxBitmap::Create( int width, int height, int depth ) { UnRef(); - wxCHECK_MSG(width >= 0 && height >= 0, false, "invalid bitmap size"); + wxCHECK_MSG(width > 0 && height > 0, false, "invalid bitmap size"); m_refData = new wxBitmapRefData(width, height, depth); return true; } @@ -575,7 +592,7 @@ static void CopyImageData( #if wxUSE_IMAGE #ifdef __WXGTK3__ -wxBitmap::wxBitmap(const wxImage& image, int depth) +wxBitmap::wxBitmap(const wxImage& image, int depth, double scale) { wxCHECK_RET(image.IsOk(), "invalid image"); @@ -587,6 +604,7 @@ wxBitmap::wxBitmap(const wxImage& image, int depth) else if (depth != 1 && depth != 32) depth = 24; wxBitmapRefData* bmpData = new wxBitmapRefData(w, h, depth); + bmpData->m_scaleFactor = scale; m_refData = bmpData; GdkPixbuf* pixbuf_dst = gdk_pixbuf_new(GDK_COLORSPACE_RGB, depth == 32, 8, w, h); bmpData->m_pixbufNoMask = pixbuf_dst; @@ -621,7 +639,7 @@ wxBitmap::wxBitmap(const wxImage& image, int depth) } } #else -wxBitmap::wxBitmap(const wxImage& image, int depth) +wxBitmap::wxBitmap(const wxImage& image, int depth, double WXUNUSED(scale)) { wxCHECK_RET(image.IsOk(), "invalid image"); @@ -655,7 +673,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth) // move index to next byte boundary bit_index = (bit_index + 7) & ~7u; } - SetPixmap(gdk_bitmap_create_from_data(wxGetRootWindow()->window, (char*)out, w, h)); + SetPixmap(gdk_bitmap_create_from_data(wxGetTopLevelGDK(), (char*)out, w, h)); delete[] out; if (!M_BMPDATA) // SetPixmap may have failed @@ -663,7 +681,7 @@ bool wxBitmap::CreateFromImageAsPixmap(const wxImage& image, int depth) } else { - SetPixmap(gdk_pixmap_new(wxGetRootWindow()->window, w, h, depth)); + SetPixmap(gdk_pixmap_new(wxGetTopLevelGDK(), w, h, depth)); if (!M_BMPDATA) return false; @@ -955,6 +973,18 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) } #ifdef __WXGTK3__ +bool wxBitmap::CreateScaled(int w, int h, int depth, double scale) +{ + Create(int(w * scale), int(h * scale), depth); + M_BMPDATA->m_scaleFactor = scale; + return true; +} + +double wxBitmap::GetScaleFactor() const +{ + return M_BMPDATA->m_scaleFactor; +} + static cairo_surface_t* GetSubSurface(cairo_surface_t* surface, const wxRect& rect) { cairo_surface_flush(surface); @@ -993,6 +1023,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const ret.m_refData = newRef; #ifdef __WXGTK3__ + newRef->m_scaleFactor = bmpData->m_scaleFactor; if (bmpData->m_pixbufNoMask) { GdkPixbuf* pixbuf = gdk_pixbuf_new_subpixbuf(bmpData->m_pixbufNoMask, rect.x, rect.y, w, h); @@ -1170,7 +1201,7 @@ GdkPixmap *wxBitmap::GetPixmap() const } else { - bmpData->m_pixmap = gdk_pixmap_new(wxGetRootWindow()->window, + bmpData->m_pixmap = gdk_pixmap_new(wxGetTopLevelGDK(), bmpData->m_width, bmpData->m_height, bmpData->m_bpp == 1 ? 1 : -1); } return bmpData->m_pixmap; @@ -1303,6 +1334,8 @@ cairo_t* wxBitmap::CairoCreate() const bmpData->m_pixbufMask = NULL; } wxASSERT(cr && cairo_status(cr) == 0); + if (!wxIsSameDouble(bmpData->m_scaleFactor, 1)) + cairo_scale(cr, bmpData->m_scaleFactor, bmpData->m_scaleFactor); return cr; } @@ -1311,6 +1344,14 @@ void wxBitmap::Draw(cairo_t* cr, int x, int y, bool useMask, const wxColour* fg, wxCHECK_RET(IsOk(), "invalid bitmap"); wxBitmapRefData* bmpData = M_BMPDATA; + if (!wxIsSameDouble(bmpData->m_scaleFactor, 1)) + { + cairo_translate(cr, x, y); + const double scale = 1 / bmpData->m_scaleFactor; + cairo_scale(cr, scale, scale); + x = 0; + y = 0; + } SetSourceSurface(cr, x, y, fg, bg); cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_NEAREST); cairo_surface_t* mask = NULL; @@ -1428,6 +1469,11 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) } #else GdkPixbuf *pixbuf = GetPixbuf(); + + // Pixmap will get out of date when our pixbuf is accessed directly, so + // ensure we don't keep the old data in it. + PurgeOtherRepresentations(Pixbuf); + const bool hasAlpha = HasAlpha(); // allow access if bpp is valid and matches existence of alpha @@ -1470,6 +1516,7 @@ wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const oldRef->m_height, oldRef->m_bpp); #ifdef __WXGTK3__ + newRef->m_scaleFactor = oldRef->m_scaleFactor; if (oldRef->m_pixbufNoMask) newRef->m_pixbufNoMask = gdk_pixbuf_copy(oldRef->m_pixbufNoMask); if (oldRef->m_surface) diff --git a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp index 127b50d5e3..43d522c08a 100644 --- a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp +++ b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp @@ -37,7 +37,7 @@ // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxComboBox) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxComboBox); // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/gtk/brush.cpp b/Externals/wxWidgets3/src/gtk/brush.cpp index 2c29ba5cba..4fe673d2bc 100644 --- a/Externals/wxWidgets3/src/gtk/brush.cpp +++ b/Externals/wxWidgets3/src/gtk/brush.cpp @@ -53,19 +53,17 @@ public: #define M_BRUSHDATA ((wxBrushRefData *)m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject); wxBrush::wxBrush( const wxColour &colour, wxBrushStyle style ) { m_refData = new wxBrushRefData(colour, style); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxBrush::wxBrush(const wxColour& col, int style) { m_refData = new wxBrushRefData(col, (wxBrushStyle)style); } -#endif wxBrush::wxBrush( const wxBitmap &stippleBitmap ) { diff --git a/Externals/wxWidgets3/src/gtk/checkbox.cpp b/Externals/wxWidgets3/src/gtk/checkbox.cpp index af822e1b90..166d37cf02 100644 --- a/Externals/wxWidgets3/src/gtk/checkbox.cpp +++ b/Externals/wxWidgets3/src/gtk/checkbox.cpp @@ -15,6 +15,7 @@ #include #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/eventsdisabler.h" //----------------------------------------------------------------------------- // data @@ -45,7 +46,7 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) bool active = gtk_toggle_button_get_active(toggle) != 0; bool inconsistent = gtk_toggle_button_get_inconsistent(toggle) != 0; - cb->GTKDisableEvents(); + wxGtkEventsDisabler noEvents(cb); if (!active && !inconsistent) { @@ -67,8 +68,6 @@ static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) { wxFAIL_MSG(wxT("3state wxCheckBox in unexpected state!")); } - - cb->GTKEnableEvents(); } else { @@ -171,11 +170,8 @@ void wxCheckBox::SetValue( bool state ) if (state == GetValue()) return; - GTKDisableEvents(); - + wxGtkEventsDisabler noEvents(this); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state ); - - GTKEnableEvents(); } bool wxCheckBox::GetValue() const diff --git a/Externals/wxWidgets3/src/gtk/checklst.cpp b/Externals/wxWidgets3/src/gtk/checklst.cpp index 9c5e7065d1..4105ce2716 100644 --- a/Externals/wxWidgets3/src/gtk/checklst.cpp +++ b/Externals/wxWidgets3/src/gtk/checklst.cpp @@ -16,6 +16,7 @@ #include #include "wx/gtk/private.h" +#include "wx/gtk/private/treeview.h" //----------------------------------------------------------------------------- // "toggled" @@ -27,13 +28,12 @@ static void gtk_checklist_toggled(GtkCellRendererToggle * WXUNUSED(renderer), { wxCHECK_RET( listbox->m_treeview != NULL, wxT("invalid listbox") ); - GtkTreePath* path = gtk_tree_path_new_from_string(stringpath); + wxGtkTreePath path(stringpath); wxCommandEvent new_event( wxEVT_CHECKLISTBOX, listbox->GetId() ); new_event.SetEventObject( listbox ); new_event.SetInt( gtk_tree_path_get_indices(path)[0] ); new_event.SetString( listbox->GetString( new_event.GetInt() )); - gtk_tree_path_free(path); listbox->Check( new_event.GetInt(), !listbox->IsChecked(new_event.GetInt())); listbox->HandleWindowEvent( new_event ); } @@ -83,11 +83,7 @@ void wxCheckListBox::DoCreateCheckList() gtk_tree_view_column_new_with_attributes( "", renderer, "active", 0, NULL ); -#if wxUSE_LIBHILDON2 - gtk_tree_view_column_set_fixed_width(column, 40); -#else gtk_tree_view_column_set_fixed_width(column, 22); -#endif // wxUSE_LIBHILDON2/!wxUSE_LIBHILDON2 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_clickable(column, TRUE); diff --git a/Externals/wxWidgets3/src/gtk/choice.cpp b/Externals/wxWidgets3/src/gtk/choice.cpp index c30e031087..de01dfaed1 100644 --- a/Externals/wxWidgets3/src/gtk/choice.cpp +++ b/Externals/wxWidgets3/src/gtk/choice.cpp @@ -19,6 +19,7 @@ #include #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/eventsdisabler.h" // ---------------------------------------------------------------------------- // GTK callbacks @@ -155,7 +156,7 @@ void wxChoice::DoClear() { wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); GtkTreeModel* model = gtk_combo_box_get_model( combobox ); @@ -166,8 +167,6 @@ void wxChoice::DoClear() if (m_strings) m_strings->Clear(); - GTKEnableEvents(); - InvalidateBestSize(); } @@ -290,12 +289,10 @@ void wxChoice::SetSelection( int n ) { wxCHECK_RET( m_widget != NULL, wxT("invalid control") ); - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); gtk_combo_box_set_active( combobox, n ); - - GTKEnableEvents(); } void wxChoice::SetColumns(int n) diff --git a/Externals/wxWidgets3/src/gtk/clipbrd.cpp b/Externals/wxWidgets3/src/gtk/clipbrd.cpp index c1c9c9c99b..1777b25a06 100644 --- a/Externals/wxWidgets3/src/gtk/clipbrd.cpp +++ b/Externals/wxWidgets3/src/gtk/clipbrd.cpp @@ -429,7 +429,7 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget), // wxClipboard ctor/dtor // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject); wxClipboard::wxClipboard() { @@ -626,7 +626,7 @@ bool wxClipboard::AddData( wxDataObject *data ) // get formats from wxDataObjects const size_t count = data->GetFormatCount(); - wxDataFormatArray formats(new wxDataFormat[count]); + wxDataFormatArray formats(count); data->GetAllFormats(formats.get()); // always provide TIMESTAMP as a target, see comments in selection_handler @@ -690,7 +690,7 @@ bool wxClipboard::GetData( wxDataObject& data ) // get all supported formats from wxDataObjects: notice that we are setting // the object data, so we need them in "Set" direction const size_t count = data.GetFormatCount(wxDataObject::Set); - wxDataFormatArray formats(new wxDataFormat[count]); + wxDataFormatArray formats(count); data.GetAllFormats(formats.get(), wxDataObject::Set); for ( size_t i = 0; i < count; i++ ) diff --git a/Externals/wxWidgets3/src/gtk/clrpicker.cpp b/Externals/wxWidgets3/src/gtk/clrpicker.cpp index e821a2d16e..14cff5db3e 100644 --- a/Externals/wxWidgets3/src/gtk/clrpicker.cpp +++ b/Externals/wxWidgets3/src/gtk/clrpicker.cpp @@ -55,7 +55,7 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget, // wxColourButton //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxButton); bool wxColourButton::Create( wxWindow *parent, wxWindowID id, const wxColour &col, @@ -78,6 +78,9 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id, #endif g_object_ref(m_widget); + // Display opacity slider + g_object_set(G_OBJECT(m_widget), "use-alpha", + static_cast(style & wxCLRP_SHOW_ALPHA), NULL); // GtkColourButton signals g_signal_connect(m_widget, "color-set", G_CALLBACK(gtk_clrbutton_setcolor_callback), this); diff --git a/Externals/wxWidgets3/src/gtk/collpane.cpp b/Externals/wxWidgets3/src/gtk/collpane.cpp index ac2b928d80..9d67ea4ca6 100644 --- a/Externals/wxWidgets3/src/gtk/collpane.cpp +++ b/Externals/wxWidgets3/src/gtk/collpane.cpp @@ -34,7 +34,7 @@ const char wxCollapsiblePaneNameStr[] = "collapsiblePane"; wxDEFINE_EVENT( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEvent ); -IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent) +wxIMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent); // ============================================================================ // implementation @@ -163,11 +163,11 @@ void wxCollapsiblePane::AddChildGTK(wxWindowGTK* child) // wxCollapsiblePane //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePane, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePane, wxControl); -BEGIN_EVENT_TABLE(wxCollapsiblePane, wxCollapsiblePaneBase) +wxBEGIN_EVENT_TABLE(wxCollapsiblePane, wxCollapsiblePaneBase) EVT_SIZE(wxCollapsiblePane::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxCollapsiblePane::Create(wxWindow *parent, wxWindowID id, @@ -220,16 +220,9 @@ wxSize wxCollapsiblePane::DoGetBestSize() const { wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") ); - GtkRequisition req; -#ifdef __WXGTK3__ - gtk_widget_get_preferred_size(m_widget, NULL, &req); -#else - GTK_WIDGET_GET_CLASS(m_widget)->size_request(m_widget, &req); -#endif - // notice that we do not cache our best size here as it changes // all times the user expands/hide our pane - return wxSize(req.width, req.height); + return GTKGetPreferredSize(m_widget); } void wxCollapsiblePane::Collapse(bool collapse) @@ -271,7 +264,9 @@ void wxCollapsiblePane::OnSize(wxSizeEvent &ev) // here we need to resize the pane window otherwise, even if the GtkExpander container // is expanded or shrunk, the pane window won't be updated! - m_pPane->SetSize(ev.GetSize().x, ev.GetSize().y - m_szCollapsed.y); + int h = ev.GetSize().y - m_szCollapsed.y; + if (h < 0) h = 0; + m_pPane->SetSize(ev.GetSize().x, h); // we need to explicitly call m_pPane->Layout() or else it won't correctly relayout // (even if SetAutoLayout(true) has been called on it!) diff --git a/Externals/wxWidgets3/src/gtk/colordlg.cpp b/Externals/wxWidgets3/src/gtk/colordlg.cpp index 781a2316e1..4fd714213b 100644 --- a/Externals/wxWidgets3/src/gtk/colordlg.cpp +++ b/Externals/wxWidgets3/src/gtk/colordlg.cpp @@ -18,7 +18,6 @@ #if wxUSE_COLOURDLG #include "wx/colordlg.h" -#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -29,17 +28,14 @@ #include "wx/gtk/private/gtk2-compat.h" #include "wx/gtk/private/dialogcount.h" -#if wxUSE_LIBHILDON - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 extern "C" { - #include +static void response(GtkDialog*, int response_id, wxColourDialog* win) +{ + win->EndModal(response_id == GTK_RESPONSE_OK ? wxID_OK : wxID_CANCEL); +} } -#endif // wxUSE_LIBHILDON2 -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) { @@ -55,14 +51,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) GtkWindow * const parentGTK = m_parent ? GTK_WINDOW(m_parent->m_widget) : NULL; -#if wxUSE_LIBHILDON - m_widget = hildon_color_selector_new(parentGTK); -#elif wxUSE_LIBHILDON2 // !wxUSE_LIBHILDON - m_widget = hildon_color_chooser_dialog_new(); -#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 wxString title(_("Choose colour")); m_widget = gtk_color_selection_dialog_new(wxGTK_CONV(title)); -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON g_object_ref(m_widget); @@ -71,67 +61,31 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) gtk_window_set_transient_for(GTK_WINDOW(m_widget), parentGTK); } -#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 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 + gtk_color_selection_set_has_opacity_control(sel, m_data.GetChooseAlpha()); return true; } int wxColourDialog::ShowModal() { - WX_HOOK_MODAL_DIALOG(); - ColourDataToDialog(); - wxOpenModalDialogLocker modalLocker; + gulong id = g_signal_connect(m_widget, "response", G_CALLBACK(response), this); + int rc = wxDialog::ShowModal(); + g_signal_handler_disconnect(m_widget, id); - gint result = gtk_dialog_run(GTK_DIALOG(m_widget)); - gtk_widget_hide(m_widget); + if (rc == wxID_OK) + DialogToColourData(); - switch (result) - { - default: - wxFAIL_MSG(wxT("unexpected GtkColorSelectionDialog return code")); - // fall through - - case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: - case GTK_RESPONSE_CLOSE: - return wxID_CANCEL; - - case GTK_RESPONSE_OK: - DialogToColourData(); - return wxID_OK; - } + return rc; } void wxColourDialog::ColourDataToDialog() { -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - const GdkColor * const - col = m_data.GetColour().IsOk() ? m_data.GetColour().GetColor() - : NULL; -#endif -#if wxUSE_LIBHILDON - HildonColorSelector * const sel = HILDON_COLOR_SELECTOR(m_widget); - hildon_color_selector_set_color(sel, const_cast(col)); -#elif wxUSE_LIBHILDON2 - GdkColor clr; - if (col) - clr = *col; - else { - clr.pixel = 0; - clr.red = 32768; - clr.green = 32768; - clr.blue = 32768; - } - - 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_get_color_selection( GTK_COLOR_SELECTION_DIALOG(m_widget))); @@ -143,6 +97,8 @@ void wxColourDialog::ColourDataToDialog() gtk_color_selection_set_current_rgba(sel, color); #else gtk_color_selection_set_current_color(sel, color.GetColor()); + // Convert alpha range: [0,255] -> [0,65535] + gtk_color_selection_set_current_alpha(sel, 257*color.Alpha()); #endif } @@ -164,35 +120,10 @@ void wxColourDialog::ColourDataToDialog() GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel)); g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL); -#endif // wxUSE_LIBHILDON / wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } void wxColourDialog::DialogToColourData() { -#if wxUSE_LIBHILDON - HildonColorSelector * const sel = HILDON_COLOR_SELECTOR(m_widget); - const GdkColor * const clr = hildon_color_selector_get_color(sel); - if ( clr ) - m_data.SetColour(*clr); -#elif wxUSE_LIBHILDON2 // !wxUSE_LIBHILDON - const GdkColor * const - col = m_data.GetColour().IsOk() ? m_data.GetColour().GetColor() : NULL; - - GdkColor clr; - if (col) - clr = *col; - else { - clr.pixel = 0; - clr.red = 32768; - clr.green = 32768; - clr.blue = 32768; - } - GdkColor new_color = clr; - hildon_color_chooser_dialog_get_color((HildonColorChooserDialog *)m_widget, &new_color); - - m_data.SetColour(new_color); -#else // !wxUSE_LIBHILDON2 - GtkColorSelection* sel = GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection( GTK_COLOR_SELECTION_DIALOG(m_widget))); @@ -200,11 +131,17 @@ void wxColourDialog::DialogToColourData() #ifdef __WXGTK3__ GdkRGBA clr; gtk_color_selection_get_current_rgba(sel, &clr); + m_data.SetColour(clr); #else GdkColor clr; gtk_color_selection_get_current_color(sel, &clr); + // Set RGB colour + wxColour cRGB(clr); + guint16 alpha = gtk_color_selection_get_current_alpha(sel); + // Set RGBA colour (convert alpha range: [0,65535] -> [0,255]). + wxColour cRGBA(cRGB.Red(), cRGB.Green(), cRGB.Blue(), alpha/257); + m_data.SetColour(cRGBA); #endif - m_data.SetColour(clr); // Extract custom palette: @@ -224,7 +161,6 @@ void wxColourDialog::DialogToColourData() } g_free(pal); -#endif // wxUSE_LIBHILDON / wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } #endif // wxUSE_COLOURDLG diff --git a/Externals/wxWidgets3/src/gtk/combobox.cpp b/Externals/wxWidgets3/src/gtk/combobox.cpp index 27ad2e756c..6782de03f5 100644 --- a/Externals/wxWidgets3/src/gtk/combobox.cpp +++ b/Externals/wxWidgets3/src/gtk/combobox.cpp @@ -55,7 +55,19 @@ gtkcombobox_popupshown_callback(GObject *WXUNUSED(gobject), : wxEVT_COMBOBOX_CLOSEUP, combo->GetId() ); event.SetEventObject( combo ); - combo->HandleWindowEvent( event ); + +#ifndef __WXGTK3__ + // Process the close up event once the combobox is already closed with GTK+ + // 2, otherwise changing the combobox from its handler result in errors. + if ( !isShown ) + { + combo->GetEventHandler()->AddPendingEvent( event ); + } + else +#endif // GTK+ < 3 + { + combo->HandleWindowEvent( event ); + } } } @@ -64,7 +76,7 @@ gtkcombobox_popupshown_callback(GObject *WXUNUSED(gobject), // wxComboBox //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxComboBox, wxChoice) +wxBEGIN_EVENT_TABLE(wxComboBox, wxChoice) EVT_CHAR(wxComboBox::OnChar) EVT_MENU(wxID_CUT, wxComboBox::OnCut) @@ -82,7 +94,7 @@ BEGIN_EVENT_TABLE(wxComboBox, wxChoice) EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo) EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete) EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxComboBox::~wxComboBox() { @@ -278,8 +290,7 @@ GtkWidget* wxComboBox::GetConnectWidget() GdkWindow* wxComboBox::GTKGetWindow(wxArrayGdkWindows& /* windows */) const { #ifdef __WXGTK3__ - // no access to internal GdkWindows - return NULL; + return GTKFindWindow(GTK_WIDGET(GetEntry())); #else return gtk_entry_get_text_window(GetEntry()); #endif @@ -296,6 +307,12 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) #endif } +void wxComboBox::Clear() +{ + wxTextEntry::Clear(); + wxItemContainer::Clear(); +} + void wxComboBox::SetValue(const wxString& value) { if ( HasFlag(wxCB_READONLY) ) diff --git a/Externals/wxWidgets3/src/gtk/control.cpp b/Externals/wxWidgets3/src/gtk/control.cpp index c2633772fe..bc1ee187eb 100644 --- a/Externals/wxWidgets3/src/gtk/control.cpp +++ b/Externals/wxWidgets3/src/gtk/control.cpp @@ -34,7 +34,7 @@ // wxControl creation // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow); wxControl::wxControl() { @@ -45,7 +45,7 @@ bool wxControl::Create( wxWindow *parent, const wxPoint &pos, const wxSize &size, long style, - const wxValidator& validator, + const wxValidator& wxVALIDATOR_PARAM(validator), const wxString &name ) { bool ret = wxWindow::Create(parent, id, pos, size, style, name); @@ -61,11 +61,13 @@ bool wxControl::Create( wxWindow *parent, bool wxControl::SetFont(const wxFont& font) { const bool changed = base_type::SetFont(font); - if (changed && !gtk_widget_get_realized(m_widget)) + if (changed && !gtk_widget_get_realized(m_widget) && gtk_check_version(3,5,0)) { // GTK defers sending "style-updated" until widget is realized, but // GetBestSize() won't compute correct result until the signal is sent, // so we have to do it now + // But don't bother for GTK > 3.4, the change won't take effect until + // GTK updates it's style cache g_signal_emit_by_name(m_widget, "style-updated"); } return changed; @@ -248,15 +250,17 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, stateFlag = GTK_STATE_FLAG_ACTIVE; } GtkStyleContext* sc = gtk_widget_get_style_context(widget); - GdkRGBA c; - gtk_style_context_get_color(sc, stateFlag, &c); - attr.colFg = wxColour(c); - gtk_style_context_get_background_color(sc, stateFlag, &c); - attr.colBg = wxColour(c); + GdkRGBA *fc, *bc; wxNativeFontInfo info; - gtk_style_context_get( - sc, stateFlag, GTK_STYLE_PROPERTY_FONT, &info.description, NULL); + gtk_style_context_set_state(sc, stateFlag); + gtk_style_context_get(sc, stateFlag, + "color", &fc, "background-color", &bc, + GTK_STYLE_PROPERTY_FONT, &info.description, NULL); + attr.colFg = wxColour(*fc); + attr.colBg = wxColour(*bc); attr.font = wxFont(info); + gdk_rgba_free(fc); + gdk_rgba_free(bc); #else GtkStyle* style; @@ -299,8 +303,10 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if (!font_name) attr.font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); else - attr.font = wxFont(wxString::FromAscii(font_name)); - g_free (font_name); + { + attr.font = wxFont(wxString::FromUTF8(font_name)); + g_free(font_name); + } } if (tlw) @@ -315,7 +321,11 @@ wxSize wxControl::GTKGetPreferredSize(GtkWidget* widget) const { GtkRequisition req; #ifdef __WXGTK3__ + int w, h; + gtk_widget_get_size_request(widget, &w, &h); + gtk_widget_set_size_request(widget, -1, -1); gtk_widget_get_preferred_size(widget, NULL, &req); + gtk_widget_set_size_request(widget, w, h); #else GTK_WIDGET_GET_CLASS(widget)->size_request(widget, &req); #endif @@ -330,7 +340,10 @@ wxPoint wxControl::GTKGetEntryMargins(GtkEntry* entry) const #ifndef __WXGTK3__ #if GTK_CHECK_VERSION(2,10,0) // The margins we have previously set - const GtkBorder* border = gtk_entry_get_inner_border(entry); + const GtkBorder* border = NULL; + if (gtk_check_version(2,10,0) == NULL) + border = gtk_entry_get_inner_border(entry); + if ( border ) { marg.x = border->left + border->right; diff --git a/Externals/wxWidgets3/src/gtk/cursor.cpp b/Externals/wxWidgets3/src/gtk/cursor.cpp index aab088f64a..9973fe9f14 100644 --- a/Externals/wxWidgets3/src/gtk/cursor.cpp +++ b/Externals/wxWidgets3/src/gtk/cursor.cpp @@ -22,6 +22,8 @@ #include "wx/gtk/private/object.h" #include "wx/gtk/private/gtk2-compat.h" +GdkWindow* wxGetTopLevelGDK(); + //----------------------------------------------------------------------------- // wxCursorRefData //----------------------------------------------------------------------------- @@ -32,7 +34,7 @@ public: wxCursorRefData(); virtual ~wxCursorRefData(); - virtual bool IsOk() const { return m_cursor != NULL; } + virtual bool IsOk() const wxOVERRIDE { return m_cursor != NULL; } GdkCursor *m_cursor; @@ -65,10 +67,7 @@ wxCursorRefData::~wxCursorRefData() #define M_CURSORDATA static_cast(m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject) - -// used in the following two ctors -extern GtkWidget *wxGetRootWindow(); +wxIMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject); wxCursor::wxCursor() { @@ -143,7 +142,8 @@ wxCursor::wxCursor(const char bits[], int width, int height, } } } - M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(wxGetRootWindow()), pixbuf, hotSpotX, hotSpotY); + M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf( + gdk_window_get_display(wxGetTopLevelGDK()), pixbuf, hotSpotX, hotSpotY); #else if (!maskBits) maskBits = bits; @@ -153,9 +153,9 @@ wxCursor::wxCursor(const char bits[], int width, int height, bg = wxWHITE; GdkBitmap* data = gdk_bitmap_create_from_data( - gtk_widget_get_window(wxGetRootWindow()), const_cast(bits), width, height); + wxGetTopLevelGDK(), const_cast(bits), width, height); GdkBitmap* mask = gdk_bitmap_create_from_data( - gtk_widget_get_window(wxGetRootWindow()), const_cast(maskBits), width, height); + wxGetTopLevelGDK(), const_cast(maskBits), width, height); M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap( data, mask, fg->GetColor(), bg->GetColor(), @@ -170,6 +170,35 @@ wxCursor::~wxCursor() { } +wxPoint wxCursor::GetHotSpot() const +{ +#if GTK_CHECK_VERSION(2,8,0) + if (GetCursor()) + { + if (gtk_check_version(2,8,0) == NULL) + { + GdkPixbuf *pixbuf = gdk_cursor_get_image(GetCursor()); + if (pixbuf) + { + wxPoint hotSpot = wxDefaultPosition; + const gchar* opt_xhot = gdk_pixbuf_get_option(pixbuf, "x_hot"); + const gchar* opt_yhot = gdk_pixbuf_get_option(pixbuf, "y_hot"); + if (opt_xhot && opt_yhot) + { + const int xhot = atoi(opt_xhot); + const int yhot = atoi(opt_yhot); + hotSpot = wxPoint(xhot, yhot); + } + g_object_unref(pixbuf); + return hotSpot; + } + } + } +#endif + + return wxDefaultPosition; +} + void wxCursor::InitFromStock( wxStockCursor cursorId ) { m_refData = new wxCursorRefData(); @@ -236,7 +265,8 @@ void wxCursor::InitFromStock( wxStockCursor cursorId ) break; } - M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur ); + GdkDisplay* display = gdk_window_get_display(wxGetTopLevelGDK()); + M_CURSORDATA->m_cursor = gdk_cursor_new_for_display(display, gdk_cur); } #if wxUSE_IMAGE @@ -275,7 +305,8 @@ void wxCursor::InitFromImage( const wxImage & image ) } } m_refData = new wxCursorRefData; - M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(wxGetRootWindow()), pixbuf, hotSpotX, hotSpotY); + M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf( + gdk_window_get_display(wxGetTopLevelGDK()), pixbuf, hotSpotX, hotSpotY); g_object_unref(pixbuf); } @@ -283,7 +314,10 @@ void wxCursor::InitFromImage( const wxImage & image ) GdkCursor *wxCursor::GetCursor() const { - return M_CURSORDATA->m_cursor; + GdkCursor* cursor = NULL; + if (m_refData) + cursor = M_CURSORDATA->m_cursor; + return cursor; } wxGDIRefData *wxCursor::CreateGDIRefData() const @@ -308,59 +342,70 @@ wxCursor::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const // busy cursor routines //----------------------------------------------------------------------------- -/* Current cursor, in order to hang on to - * cursor handle when setting the cursor globally */ wxCursor g_globalCursor; - -static wxCursor gs_savedCursor; +wxCursor g_busyCursor; +static wxCursor gs_storedCursor; static int gs_busyCount = 0; -const wxCursor &wxBusyCursor::GetStoredCursor() +const wxCursor& wxBusyCursor::GetStoredCursor() { - return gs_savedCursor; + return gs_storedCursor; } const wxCursor wxBusyCursor::GetBusyCursor() { - return wxCursor(wxCURSOR_WATCH); + return g_busyCursor; } -static void UpdateCursors(GdkDisplay** display) +static void UpdateCursors(wxWindow* win, bool isBusyOrGlobalCursor) { + win->GTKUpdateCursor(isBusyOrGlobalCursor); + const wxWindowList& children = win->GetChildren(); + wxWindowList::const_iterator i = children.begin(); + for (size_t n = children.size(); n--; ++i) + UpdateCursors(*i, isBusyOrGlobalCursor); +} + +static void SetGlobalCursor(const wxCursor& cursor) +{ + GdkCursor* gdk_cursor = cursor.GetCursor(); + GdkDisplay* display = NULL; wxWindowList::const_iterator i = wxTopLevelWindows.begin(); for (size_t n = wxTopLevelWindows.size(); n--; ++i) { wxWindow* win = *i; - win->GTKUpdateCursor(); - if (display && *display == NULL && win->m_widget) - *display = gtk_widget_get_display(win->m_widget); + GdkWindow* window; + if (win->m_widget && (window = gtk_widget_get_window(win->m_widget))) + { + gdk_window_set_cursor(window, gdk_cursor); + UpdateCursors(win, gdk_cursor != NULL); + if (display == NULL) + display = gdk_window_get_display(window); + } + } + if (display) + gdk_display_flush(display); +} + +void wxBeginBusyCursor(const wxCursor* cursor) +{ + if (gs_busyCount++ == 0) + { + g_busyCursor = *cursor; + gs_storedCursor = g_globalCursor; + SetGlobalCursor(*cursor); } } void wxEndBusyCursor() { - if (--gs_busyCount > 0) - return; - - g_globalCursor = gs_savedCursor; - gs_savedCursor = wxNullCursor; - UpdateCursors(NULL); -} - -void wxBeginBusyCursor(const wxCursor* cursor) -{ - if (gs_busyCount++ > 0) - return; - - wxASSERT_MSG( !gs_savedCursor.IsOk(), - wxT("forgot to call wxEndBusyCursor, will leak memory") ); - - gs_savedCursor = g_globalCursor; - g_globalCursor = *cursor; - GdkDisplay* display = NULL; - UpdateCursors(&display); - if (display) - gdk_display_flush(display); + if (gs_busyCount && --gs_busyCount == 0) + { + g_globalCursor = gs_storedCursor; + gs_storedCursor = + g_busyCursor = wxCursor(); + SetGlobalCursor(g_globalCursor); + } } bool wxIsBusy() @@ -371,5 +416,5 @@ bool wxIsBusy() void wxSetCursor( const wxCursor& cursor ) { g_globalCursor = cursor; - UpdateCursors(NULL); + SetGlobalCursor(cursor); } diff --git a/Externals/wxWidgets3/src/gtk/dataobj.cpp b/Externals/wxWidgets3/src/gtk/dataobj.cpp index 9a3960797d..afdea3f3ee 100644 --- a/Externals/wxWidgets3/src/gtk/dataobj.cpp +++ b/Externals/wxWidgets3/src/gtk/dataobj.cpp @@ -235,16 +235,22 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats, bool wxFileDataObject::GetDataHere(void *buf) const { - wxString filenames; + char* out = static_cast(buf); for (size_t i = 0; i < m_filenames.GetCount(); i++) { - filenames += wxT("file:"); - filenames += m_filenames[i]; - filenames += wxT("\r\n"); + char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0); + if (uri) + { + size_t const len = strlen(uri); + memcpy(out, uri, len); + out += len; + *(out++) = '\r'; + *(out++) = '\n'; + g_free(uri); + } } - - memcpy( buf, filenames.mbc_str(), filenames.length() + 1 ); + *out = 0; return true; } @@ -255,9 +261,11 @@ size_t wxFileDataObject::GetDataSize() const for (size_t i = 0; i < m_filenames.GetCount(); i++) { - // This is junk in UTF-8 - res += m_filenames[i].length(); - res += 5 + 2; // "file:" (5) + "\r\n" (2) + char* uri = g_filename_to_uri(m_filenames[i].mbc_str(), 0, 0); + if (uri) { + res += strlen(uri) + 2; // Including "\r\n" + g_free(uri); + } } return res + 1; @@ -432,7 +440,7 @@ public: void SetURL(const wxString& url) { m_url = url; } - virtual size_t GetDataSize() const + virtual size_t GetDataSize() const wxOVERRIDE { // It is not totally clear whether we should include "\r\n" at the end // of the string if there is only one URL or not, but not doing it @@ -440,7 +448,7 @@ public: return strlen(m_url.utf8_str()) + 1; } - virtual bool GetDataHere(void *buf) const + virtual bool GetDataHere(void *buf) const wxOVERRIDE { char* const dst = static_cast(buf); @@ -449,7 +457,7 @@ public: return true; } - virtual bool SetData(size_t len, const void *buf) + virtual bool SetData(size_t len, const void *buf) wxOVERRIDE { const char* const src = static_cast(buf); @@ -469,15 +477,15 @@ public: } // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const + virtual size_t GetDataSize(const wxDataFormat&) const wxOVERRIDE { return GetDataSize(); } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const + virtual bool GetDataHere(const wxDataFormat&, void *buf) const wxOVERRIDE { return GetDataHere(buf); } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) wxOVERRIDE { return SetData(len, buf); } diff --git a/Externals/wxWidgets3/src/gtk/dataview.cpp b/Externals/wxWidgets3/src/gtk/dataview.cpp index 7a181fd4c5..7b73d1a9ba 100644 --- a/Externals/wxWidgets3/src/gtk/dataview.cpp +++ b/Externals/wxWidgets3/src/gtk/dataview.cpp @@ -38,6 +38,7 @@ #include "wx/gtk/private/gdkconv.h" #include "wx/gtk/private/gtk2-compat.h" #include "wx/gtk/private/list.h" +#include "wx/gtk/private/treeview.h" using namespace wxGTKImpl; class wxGtkDataViewModelNotifier; @@ -59,55 +60,6 @@ extern "C" { typedef struct _GtkWxTreeModel GtkWxTreeModel; } -// ---------------------------------------------------------------------------- -// wxGtkTreePath: self-destroying GtkTreePath -// ---------------------------------------------------------------------------- - -// Usually this object is initialized with the associated GtkTreePath -// immediately when it's constructed but it can also be changed later either by -// using Assign() or by getting the pointer to the internally stored pointer -// value using ByRef(). The latter should be avoided but is very convenient -// when using GTK functions with GtkTreePath output parameters. -class wxGtkTreePath -{ -public: - // Ctor takes ownership of the given path and will free it if non-NULL. - wxGtkTreePath(GtkTreePath *path = NULL) : m_path(path) { } - - // Creates a tree path for the given string path. - wxGtkTreePath(const gchar *strpath) - : m_path(gtk_tree_path_new_from_string(strpath)) - { - } - - // Set the stored pointer if not done by ctor. - void Assign(GtkTreePath *path) - { - wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); - - m_path = path; - } - - // Return the pointer to the internally stored pointer. This should only be - // used to initialize the object by passing it to some GTK function. - GtkTreePath **ByRef() - { - wxASSERT_MSG( !m_path, "shouldn't be already initialized" ); - - return &m_path; - } - - - operator GtkTreePath *() const { return m_path; } - - ~wxGtkTreePath() { if ( m_path ) gtk_tree_path_free(m_path); } - -private: - GtkTreePath *m_path; - - wxDECLARE_NO_COPY_CLASS(wxGtkTreePath); -}; - // ---------------------------------------------------------------------------- // wxGtkTreePathList: self-destroying list of GtkTreePath objects. // ---------------------------------------------------------------------------- @@ -135,9 +87,11 @@ public: // Implementation note: it could be expected that setting the selection // function in this class ctor and resetting it back to the old value in its -// dtor would work. However currently gtk_tree_selection_get_select_function() -// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276) -// so we can't do this. Instead, we always use the selection function (which +// dtor would work, However in GTK+2 gtk_tree_selection_get_select_function() +// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276 +// which was only fixed in 2.90.5-304-g316b9da) so we can't do this. +// +// Instead, we always use the selection function (which // imposes extra overhead, albeit minimal one, on all selection operations) and // just set/reset the flag telling it whether it should allow or forbid the // selection. @@ -168,7 +122,15 @@ public: ms_instance = this; - CheckCurrentSelectionFunc(NULL); + if ( ms_firstTime ) + { + ms_firstTime = false; + CheckCurrentSelectionFunc(NULL); + } + else + { + CheckCurrentSelectionFunc(wxdataview_selection_func); + } // Pass some non-NULL pointer as "data" for the callback, it doesn't // matter what it is as long as it's non-NULL. @@ -215,6 +177,7 @@ private: } static wxGtkTreeSelectionLock *ms_instance; + static bool ms_firstTime; GtkTreeSelection * const m_selection; @@ -222,6 +185,7 @@ private: }; wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = NULL; +bool wxGtkTreeSelectionLock::ms_firstTime = true; //----------------------------------------------------------------------------- // wxDataViewCtrlInternal @@ -1179,6 +1143,168 @@ static GtkCellEditable *gtk_wx_cell_renderer_text_start_editing( return NULL; } +// ---------------------------------------------------------------------------- +// GTK+ class GtkWxCellEditorBin: needed only to implement GtkCellEditable for +// our editor widgets which don't necessarily implement it on their own. +// ---------------------------------------------------------------------------- + +enum +{ + CELL_EDITOR_BIN_PROP_0, + CELL_EDITOR_BIN_PROP_EDITING_CANCELED +}; + +extern "C" { + +#define GTK_TYPE_WX_CELL_EDITOR_BIN (gtk_wx_cell_editor_bin_get_type ()) +#define GTK_WX_CELL_EDITOR_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WX_CELL_EDITOR_BIN, GtkWxCellEditorBin)) +#define GTK_IS_WX_CELL_EDITOR_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WX_CELL_EDITOR_BIN)) +#define GTK_IS_WX_CELL_EDITOR_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WX_CELL_EDITOR_BIN)) + +GType gtk_wx_cell_editor_bin_get_type(); + +struct GtkWxCellEditorBin +{ + GtkBin parent; + + // The actual user-created editor. + wxWindow* editor; +}; + +static GtkWidget* gtk_wx_cell_editor_bin_new(wxWindow* editor); +static void gtk_wx_cell_editor_bin_init(GTypeInstance* instance, void*); +static void gtk_wx_cell_editor_bin_class_init(void* klass, void*); +static void gtk_wx_cell_editor_bin_get_property(GObject*, guint, GValue*, GParamSpec*); +static void gtk_wx_cell_editor_bin_set_property(GObject*, guint, const GValue*, GParamSpec*); + +static void gtk_wx_cell_editor_bin_cell_editable_init(void* g_iface, void*); +static void gtk_wx_cell_editor_bin_cell_editable_start_editing( + GtkCellEditable *cell_editable, + GdkEvent *event); + +} + +GType +gtk_wx_cell_editor_bin_get_type() +{ + static GType cell_editor_bin_type = 0; + + if ( !cell_editor_bin_type ) + { + const GTypeInfo cell_editor_bin_info = + { + sizeof (GtkBinClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + gtk_wx_cell_editor_bin_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkWxCellEditorBin), + 0, /* n_preallocs */ + gtk_wx_cell_editor_bin_init, + NULL + }; + + cell_editor_bin_type = g_type_register_static( GTK_TYPE_BIN, + "GtkWxCellEditorBin", &cell_editor_bin_info, (GTypeFlags)0 ); + + + static const GInterfaceInfo cell_editable_iface_info = + { + gtk_wx_cell_editor_bin_cell_editable_init, + NULL, + NULL + }; + + g_type_add_interface_static (cell_editor_bin_type, + GTK_TYPE_CELL_EDITABLE, + &cell_editable_iface_info); + } + + return cell_editor_bin_type; +} + +static void +gtk_wx_cell_editor_bin_init(GTypeInstance* instance, void*) +{ + GtkWxCellEditorBin* const bin = GTK_WX_CELL_EDITOR_BIN(instance); + bin->editor = NULL; +} + +static void gtk_wx_cell_editor_bin_class_init(void* klass, void*) +{ + GObjectClass* const oclass = G_OBJECT_CLASS(klass); + + oclass->set_property = gtk_wx_cell_editor_bin_set_property; + oclass->get_property = gtk_wx_cell_editor_bin_get_property; + + g_object_class_override_property(oclass, + CELL_EDITOR_BIN_PROP_EDITING_CANCELED, + "editing-canceled"); +} + +// We need to provide these virtual methods as we must support the +// editing-canceled property, but they don't seem to be actually ever called, +// so it's not clear if we must implement them and how. For now just do +// nothing. + +static void +gtk_wx_cell_editor_bin_get_property(GObject*, guint, GValue*, GParamSpec*) +{ +} + +static void +gtk_wx_cell_editor_bin_set_property(GObject*, guint, const GValue*, GParamSpec*) +{ +} + +GtkWidget* +gtk_wx_cell_editor_bin_new(wxWindow* editor) +{ + if ( !editor ) + return NULL; + + GtkWxCellEditorBin* const + bin = (GtkWxCellEditorBin*)g_object_new (GTK_TYPE_WX_CELL_EDITOR_BIN, NULL); + + bin->editor = editor; + gtk_container_add(GTK_CONTAINER(bin), editor->m_widget); + + return GTK_WIDGET(bin); +} + +// GtkCellEditable interface implementation for GtkWxCellEditorBin + +static void +gtk_wx_cell_editor_bin_cell_editable_init(void* g_iface, void*) +{ + GtkCellEditableIface* iface = static_cast(g_iface); + iface->start_editing = gtk_wx_cell_editor_bin_cell_editable_start_editing; +} + +static void +gtk_wx_cell_editor_bin_cell_editable_start_editing(GtkCellEditable *cell_editable, + GdkEvent *event) +{ + GtkWxCellEditorBin* const bin = (GtkWxCellEditorBin *)cell_editable; + + // If we have an editable widget inside the editor, forward to it. + for ( wxWindow* win = bin->editor; win; ) + { + GtkWidget* const widget = win->m_widget; + if ( GTK_IS_CELL_EDITABLE(widget) ) + { + gtk_cell_editable_start_editing(GTK_CELL_EDITABLE(widget), event); + break; + } + + if ( win == bin->editor ) + win = win->GetChildren().front(); + else + win = win->GetNextSibling(); + } +} + //----------------------------------------------------------------------------- // define new GTK+ class GtkWxCellRenderer //----------------------------------------------------------------------------- @@ -1200,6 +1326,9 @@ struct _GtkWxCellRenderer /*< private >*/ wxDataViewCustomRenderer *cell; + + // Non null only while editing. + GtkWidget* editor_bin; }; static GtkCellRenderer *gtk_wx_cell_renderer_new (void); @@ -1281,6 +1410,7 @@ gtk_wx_cell_renderer_init(GTypeInstance* instance, void*) { GtkWxCellRenderer* cell = GTK_WX_CELL_RENDERER(instance); cell->cell = NULL; + cell->editor_bin = NULL; } static void @@ -1338,9 +1468,13 @@ static GtkCellEditable *gtk_wx_cell_renderer_start_editing( wxDataViewItem item(cell->GetOwner()->GetOwner()->GTKPathToItem(wxGtkTreePath(path))); - cell->StartEditing( item, renderrect ); + if (!cell->StartEditing(item, renderrect)) + return NULL; - return NULL; + wxrenderer->editor_bin = gtk_wx_cell_editor_bin_new(cell->GetEditorCtrl()); + gtk_widget_show(wxrenderer->editor_bin); + + return GTK_CELL_EDITABLE(wxrenderer->editor_bin); } static void @@ -1481,8 +1615,6 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, state |= wxDATAVIEW_CELL_PRELIT; if (flags & GTK_CELL_RENDERER_INSENSITIVE) state |= wxDATAVIEW_CELL_INSENSITIVE; - if (flags & GTK_CELL_RENDERER_INSENSITIVE) - state |= wxDATAVIEW_CELL_INSENSITIVE; if (flags & GTK_CELL_RENDERER_FOCUSED) state |= wxDATAVIEW_CELL_FOCUSED; cell->WXCallRender( rect, dc, state ); @@ -1563,14 +1695,14 @@ public: wxGtkDataViewModelNotifier( wxDataViewModel *wx_model, wxDataViewCtrlInternal *internal ); ~wxGtkDataViewModelNotifier(); - virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ); - virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ); - virtual bool ItemChanged( const wxDataViewItem &item ); - virtual bool ValueChanged( const wxDataViewItem &item, unsigned int model_column ); - virtual bool Cleared(); - virtual void Resort(); - virtual bool BeforeReset(); - virtual bool AfterReset(); + virtual bool ItemAdded( const wxDataViewItem &parent, const wxDataViewItem &item ) wxOVERRIDE; + virtual bool ItemDeleted( const wxDataViewItem &parent, const wxDataViewItem &item ) wxOVERRIDE; + virtual bool ItemChanged( const wxDataViewItem &item ) wxOVERRIDE; + virtual bool ValueChanged( const wxDataViewItem &item, unsigned int model_column ) wxOVERRIDE; + virtual bool Cleared() wxOVERRIDE; + virtual void Resort() wxOVERRIDE; + virtual bool BeforeReset() wxOVERRIDE; + virtual bool AfterReset() wxOVERRIDE; void UpdateLastCount(); @@ -1638,11 +1770,11 @@ bool wxGtkDataViewModelNotifier::ItemDeleted( const wxDataViewItem &parent, cons gtk_tree_path_append_index( path, index ); #endif + m_internal->ItemDeleted( parent, item ); + gtk_tree_model_row_deleted( GTK_TREE_MODEL(wxgtk_model), path ); - m_internal->ItemDeleted( parent, item ); - // Did we remove the last child, causing 'parent' to become a leaf? if ( !m_wx_model->IsContainer(parent) ) { @@ -1707,20 +1839,27 @@ bool wxGtkDataViewModelNotifier::ValueChanged( const wxDataViewItem &item, unsig GTK_TREE_MODEL(wxgtk_model), &iter )); GdkRectangle cell_area; gtk_tree_view_get_cell_area( widget, path, gcolumn, &cell_area ); -#ifdef __WXGTK3__ - GtkAdjustment* hadjust = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget)); -#else - GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); -#endif - double d = gtk_adjustment_get_value( hadjust ); - int xdiff = (int) d; - GtkAllocation a; - gtk_widget_get_allocation(GTK_WIDGET(gtk_tree_view_column_get_button(gcolumn)), &a); - int ydiff = a.height; - // Redraw - gtk_widget_queue_draw_area( GTK_WIDGET(widget), - cell_area.x - xdiff, ydiff + cell_area.y, cell_area.width, cell_area.height ); + // Don't try to redraw the column if it's invisible, this just + // results in "BUG" messages from pixman_region32_init_rect() + // and would be useful even if it didn't anyhow. + if ( cell_area.width > 0 && cell_area.height > 0 ) + { +#ifdef __WXGTK3__ + GtkAdjustment* hadjust = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget)); +#else + GtkAdjustment* hadjust = gtk_tree_view_get_hadjustment( widget ); +#endif + double d = gtk_adjustment_get_value( hadjust ); + int xdiff = (int) d; + + GtkAllocation a; + gtk_widget_get_allocation(GTK_WIDGET(gtk_tree_view_column_get_button(gcolumn)), &a); + int ydiff = a.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 ); @@ -1779,20 +1918,11 @@ bool wxGtkDataViewModelNotifier::Cleared() // wxDataViewRenderer // --------------------------------------------------------- -static gpointer s_user_data = NULL; - static void wxgtk_cell_editable_editing_done( GtkCellEditable *WXUNUSED(editable), wxDataViewRenderer *wxrenderer ) { - wxDataViewColumn *column = wxrenderer->GetOwner(); - wxDataViewCtrl *dv = column->GetOwner(); - wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_DONE, dv->GetId() ); - event.SetDataViewColumn( column ); - event.SetModel( dv->GetModel() ); - wxDataViewItem item( s_user_data ); - event.SetItem( item ); - dv->HandleWindowEvent( event ); + wxrenderer->FinishEditing(); } static void @@ -1804,17 +1934,11 @@ wxgtk_renderer_editing_started( GtkCellRenderer *WXUNUSED(cell), GtkCellEditable wxDataViewColumn *column = wxrenderer->GetOwner(); wxDataViewCtrl *dv = column->GetOwner(); - wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_STARTED, dv->GetId() ); - event.SetDataViewColumn( column ); - event.SetModel( dv->GetModel() ); wxDataViewItem item(dv->GTKPathToItem(wxGtkTreePath(path))); - event.SetItem( item ); - dv->HandleWindowEvent( event ); + wxrenderer->NotifyEditingStarted(item); if (GTK_IS_CELL_EDITABLE(editable)) { - s_user_data = item.GetID(); - g_signal_connect (editable, "editing_done", G_CALLBACK (wxgtk_cell_editable_editing_done), (gpointer) wxrenderer ); @@ -1823,7 +1947,7 @@ wxgtk_renderer_editing_started( GtkCellRenderer *WXUNUSED(cell), GtkCellEditable } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer, wxDataViewRendererBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer, wxDataViewRendererBase); wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -1839,6 +1963,24 @@ wxDataViewRenderer::wxDataViewRenderer( const wxString &varianttype, wxDataViewC // after the m_renderer pointer has been initialized } +bool wxDataViewRenderer::FinishEditing() +{ + wxWindow* editorCtrl = m_editorCtrl; + + bool ret = wxDataViewRendererBase::FinishEditing(); + + if (editorCtrl && wxGetTopLevelParent(editorCtrl)->IsBeingDeleted()) + { + // remove editor widget before editor control is deleted, + // to prevent several GTK warnings + gtk_cell_editable_remove_widget(GTK_CELL_EDITABLE(GtkGetEditorWidget())); + // delete editor control now, if it is deferred multiple erroneous + // focus-out events will occur, causing debug warnings + delete editorCtrl; + } + return ret; +} + void wxDataViewRenderer::GtkPackIntoColumn(GtkTreeViewColumn *column) { gtk_tree_view_column_pack_end( column, m_renderer, TRUE /* expand */); @@ -1853,7 +1995,37 @@ void wxDataViewRenderer::GtkInitHandlers() } } +GtkWidget* wxDataViewRenderer::GtkGetEditorWidget() const +{ + return GetEditorCtrl()->m_widget; +} + void wxDataViewRenderer::SetMode( wxDataViewCellMode mode ) +{ + m_mode = mode; + + GtkSetMode(mode); +} + +void wxDataViewRenderer::SetEnabled(bool enabled) +{ + // a) this sets the appearance to disabled grey and should only be done for + // the active cells which are disabled, not for the cells which can never + // be edited at all + if ( GetMode() != wxDATAVIEW_CELL_INERT ) + { + GValue gvalue = G_VALUE_INIT; + g_value_init( &gvalue, G_TYPE_BOOLEAN ); + g_value_set_boolean( &gvalue, enabled ); + g_object_set_property( G_OBJECT(m_renderer), "sensitive", &gvalue ); + g_value_unset( &gvalue ); + } + + // b) this actually disables the control/renderer + GtkSetMode(enabled ? GetMode() : wxDATAVIEW_CELL_INERT); +} + +void wxDataViewRenderer::GtkSetMode( wxDataViewCellMode mode ) { GtkCellRendererMode gtkMode; switch (mode) @@ -1875,9 +2047,6 @@ void wxDataViewRenderer::SetMode( wxDataViewCellMode mode ) return; } - m_mode = mode; - - // This value is most often ignored in GtkTreeView GValue gvalue = G_VALUE_INIT; g_value_init( &gvalue, gtk_cell_renderer_mode_get_type() ); g_value_set_enum( &gvalue, gtkMode ); @@ -1887,33 +2056,7 @@ void wxDataViewRenderer::SetMode( wxDataViewCellMode mode ) wxDataViewCellMode wxDataViewRenderer::GetMode() const { - wxDataViewCellMode ret; - - GValue gvalue; - g_object_get( G_OBJECT(m_renderer), "mode", &gvalue, NULL); - - switch (g_value_get_enum(&gvalue)) - { - default: - wxFAIL_MSG( "unknown GtkCellRendererMode value" ); - // fall through (we have to return something) - - case GTK_CELL_RENDERER_MODE_INERT: - ret = wxDATAVIEW_CELL_INERT; - break; - - case GTK_CELL_RENDERER_MODE_ACTIVATABLE: - ret = wxDATAVIEW_CELL_ACTIVATABLE; - break; - - case GTK_CELL_RENDERER_MODE_EDITABLE: - ret = wxDATAVIEW_CELL_EDITABLE; - break; - } - - g_value_unset( &gvalue ); - - return ret; + return m_mode; } void wxDataViewRenderer::GtkApplyAlignment(GtkCellRenderer *renderer) @@ -2024,6 +2167,12 @@ wxDataViewRenderer::GtkOnCellChanged(const wxVariant& value, model->ChangeValue( value, item, col ); } +void wxDataViewRenderer::SetAttr(const wxDataViewItemAttr& WXUNUSED(attr)) +{ + // There is no way to apply attributes to an arbitrary renderer, so we + // simply can't do anything here. +} + // --------------------------------------------------------- // wxDataViewTextRenderer // --------------------------------------------------------- @@ -2047,10 +2196,9 @@ namespace // helper function used by wxDataViewTextRenderer and // wxDataViewCustomRenderer::RenderText(): it applies the attributes to the -// given text renderer and returns true if anything was done -bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) +// given text renderer +void GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) { - bool usingDefaultAttrs = true; if (attr.HasColour()) { const GdkColor * const gcol = attr.GetColour().GetColor(); @@ -2060,8 +2208,6 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) g_value_set_boxed( &gvalue, gcol ); g_object_set_property( G_OBJECT(renderer), "foreground_gdk", &gvalue ); g_value_unset( &gvalue ); - - usingDefaultAttrs = false; } else { @@ -2079,8 +2225,6 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) g_value_set_enum( &gvalue, PANGO_STYLE_ITALIC ); g_object_set_property( G_OBJECT(renderer), "style", &gvalue ); g_value_unset( &gvalue ); - - usingDefaultAttrs = false; } else { @@ -2099,8 +2243,6 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) g_value_set_enum( &gvalue, PANGO_WEIGHT_BOLD ); g_object_set_property( G_OBJECT(renderer), "weight", &gvalue ); g_value_unset( &gvalue ); - - usingDefaultAttrs = false; } else { @@ -2132,13 +2274,11 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr) g_value_unset( &gvalue ); } #endif - - return !usingDefaultAttrs; } } // anonymous namespace -IMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer); wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -2210,9 +2350,16 @@ void wxDataViewTextRenderer::SetAlignment( int align ) g_value_unset( &gvalue ); } -bool wxDataViewTextRenderer::GtkSetAttr(const wxDataViewItemAttr& attr) +void wxDataViewTextRenderer::SetAttr(const wxDataViewItemAttr& attr) { - return GtkApplyAttr(GtkGetTextRenderer(), attr); + // An optimization: don't bother resetting the attributes if we're already + // using the defaults. + if ( attr.IsDefault() && m_usingDefaultAttrs ) + return; + + GtkApplyAttr(GtkGetTextRenderer(), attr); + + m_usingDefaultAttrs = attr.IsDefault(); } GtkCellRendererText *wxDataViewTextRenderer::GtkGetTextRenderer() const @@ -2239,7 +2386,7 @@ void SetPixbufProp(GtkCellRenderer *renderer, GdkPixbuf *pixbuf) } // anonymous namespace -IMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer); wxDataViewBitmapRenderer::wxDataViewBitmapRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -2317,7 +2464,7 @@ static void wxGtkToggleRendererToggledCallback( GtkCellRendererToggle *renderer, model->ChangeValue( value, item, model_col ); } -IMPLEMENT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer); wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -2408,7 +2555,7 @@ public: // wxDataViewCustomRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer); wxDataViewCustomRenderer::wxDataViewCustomRenderer( const wxString &varianttype, wxDataViewCellMode mode, @@ -2432,6 +2579,7 @@ void wxDataViewCustomRenderer::GtkInitTextRenderer() g_object_ref_sink(m_text_renderer); GtkApplyAlignment(GTK_CELL_RENDERER(m_text_renderer)); + gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(m_text_renderer), 0, 0); } GtkCellRendererText *wxDataViewCustomRenderer::GtkGetTextRenderer() const @@ -2445,6 +2593,11 @@ GtkCellRendererText *wxDataViewCustomRenderer::GtkGetTextRenderer() const return m_text_renderer; } +GtkWidget* wxDataViewCustomRenderer::GtkGetEditorWidget() const +{ + return GTK_WX_CELL_RENDERER(m_renderer)->editor_bin; +} + void wxDataViewCustomRenderer::RenderText( const wxString &text, int xoffset, wxRect cell, @@ -2510,17 +2663,19 @@ wxDC *wxDataViewCustomRenderer::GetDC() { if (m_dc == NULL) { + wxDataViewCtrl* ctrl = NULL; + wxDataViewColumn* column = GetOwner(); + if (column) + ctrl = column->GetOwner(); #ifdef __WXGTK3__ wxASSERT(m_renderParams); cairo_t* cr = m_renderParams->cr; wxASSERT(cr && cairo_status(cr) == 0); - m_dc = new wxGTKCairoDC(cr); + m_dc = new wxGTKCairoDC(cr, ctrl); #else - if (GetOwner() == NULL) + if (ctrl == NULL) return NULL; - if (GetOwner()->GetOwner() == NULL) - return NULL; - m_dc = new wxDataViewCtrlDC( GetOwner()->GetOwner() ); + m_dc = new wxDataViewCtrlDC(ctrl); #endif } @@ -2531,7 +2686,7 @@ wxDC *wxDataViewCustomRenderer::GetDC() // wxDataViewProgressRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewProgressRenderer, wxDataViewCustomRenderer) +wxIMPLEMENT_CLASS(wxDataViewProgressRenderer, wxDataViewCustomRenderer); wxDataViewProgressRenderer::wxDataViewProgressRenderer( const wxString &label, const wxString &varianttype, wxDataViewCellMode mode, int align ) : @@ -2730,6 +2885,7 @@ wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer( const wxArrayS wxDataViewCellMode mode, int alignment ) : wxDataViewChoiceRenderer( choices, mode, alignment ) { + m_variantType = wxS("long"); } void wxDataViewChoiceByIndexRenderer::GtkOnTextEdited(const char *itempath, const wxString& str) @@ -2765,7 +2921,7 @@ bool wxDataViewChoiceByIndexRenderer::GetValue( wxVariant &value ) const // wxDataViewIconTextRenderer // --------------------------------------------------------- -IMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewCustomRenderer) +wxIMPLEMENT_CLASS(wxDataViewIconTextRenderer, wxDataViewCustomRenderer); wxDataViewIconTextRenderer::wxDataViewIconTextRenderer ( @@ -2881,6 +3037,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), wxDataViewRenderer *cell = (wxDataViewRenderer*) data; wxDataViewItem item( (void*) iter->user_data ); + const unsigned column = cell->GetOwner()->GetModelColumn(); wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel(); @@ -2889,8 +3046,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), gboolean visible; if (wx_model->IsContainer( item )) { - visible = wx_model->HasContainerColumns( item ) || - (cell->GetOwner()->GetModelColumn() == 0); + visible = wx_model->HasContainerColumns( item ) || (column == 0); } else { @@ -2907,51 +3063,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column), return; } - wxVariant value; - wx_model->GetValue( value, item, cell->GetOwner()->GetModelColumn() ); - - if (value.GetType() != cell->GetVariantType()) - { - wxLogError( wxT("Wrong type, required: %s but: %s"), - value.GetType().c_str(), - cell->GetVariantType().c_str() ); - } - - cell->SetValue( value ); - - // deal with disabled items - bool enabled = wx_model->IsEnabled( item, cell->GetOwner()->GetModelColumn() ); - - // a) this sets the appearance to disabled grey - GValue gvalue = G_VALUE_INIT; - g_value_init( &gvalue, G_TYPE_BOOLEAN ); - g_value_set_boolean( &gvalue, enabled ); - g_object_set_property( G_OBJECT(renderer), "sensitive", &gvalue ); - g_value_unset( &gvalue ); - - // b) this actually disables the control/renderer - if (enabled) - cell->SetMode( cell->GtkGetMode() ); - else - cell->SetMode( wxDATAVIEW_CELL_INERT ); - - - // deal with attributes: if the renderer doesn't support them at all, we - // don't even need to query the model for them - if ( !cell->GtkSupportsAttrs() ) - return; - - // it can support attributes so check if this item has any - wxDataViewItemAttr attr; - if ( wx_model->GetAttr( item, cell->GetOwner()->GetModelColumn(), attr ) - || !cell->GtkIsUsingDefaultAttrs() ) - { - bool usingDefaultAttrs = !cell->GtkSetAttr(attr); - cell->GtkSetUsingDefaultAttrs(usingDefaultAttrs); - } - // else: no custom attributes specified and we're already using the default - // ones -- nothing to do - + cell->PrepareForItem(wx_model, item, column); } } // extern "C" @@ -3160,12 +3272,17 @@ void wxDataViewColumn::SetSortOrder( bool ascending ) { GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column); + GtkSortType order = GTK_SORT_DESCENDING; if (ascending) - gtk_tree_view_column_set_sort_order( column, GTK_SORT_ASCENDING ); - else - gtk_tree_view_column_set_sort_order( column, GTK_SORT_DESCENDING ); + order = GTK_SORT_ASCENDING; + gtk_tree_view_column_set_sort_order(column, order); gtk_tree_view_column_set_sort_indicator( column, TRUE ); + + wxDataViewCtrlInternal* internal = m_owner->GtkGetInternal(); + internal->SetSortOrder(order); + internal->SetSortColumn(m_model_column); + internal->SetDataViewSortColumn(this); } bool wxDataViewColumn::IsSortOrderAscending() const @@ -3192,19 +3309,15 @@ int wxDataViewColumn::GetWidth() const void wxDataViewColumn::SetWidth( int width ) { - if ( width == wxCOL_WIDTH_AUTOSIZE ) + // Notice that we don't have anything to do for wxCOL_WIDTH_DEFAULT and + // wxCOL_WIDTH_AUTOSIZE as the native control tries to use the appropriate + // width by default anyhow, don't use GTK_TREE_VIEW_COLUMN_AUTOSIZE to + // force it because, as mentioned in GTK+ documentation, it's completely + // inappropriate for controls with a lot of items (because it's O(N)) and + // it would also prevent the user from resizing the column manually which + // we want to allow for resizeable columns. + if ( width >= 0 ) { - // NB: this disables user resizing - gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_AUTOSIZE ); - } - else - { - if ( width == wxCOL_WIDTH_DEFAULT ) - { - // TODO find a better calculation - width = wxDVC_DEFAULT_WIDTH; - } - gtk_tree_view_column_set_sizing( GTK_TREE_VIEW_COLUMN(m_column), GTK_TREE_VIEW_COLUMN_FIXED ); gtk_tree_view_column_set_fixed_width( GTK_TREE_VIEW_COLUMN(m_column), width ); } @@ -3562,8 +3675,6 @@ wxDataViewCtrlInternal::drag_data_received(GtkTreeDragDest *WXUNUSED(drag_dest), GtkSelectionData *selection_data) { wxDataViewItem item(GetOwner()->GTKPathToItem(path)); - if ( !item ) - return FALSE; wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_DROP, m_owner->GetId() ); event.SetEventObject( m_owner ); @@ -3587,8 +3698,6 @@ wxDataViewCtrlInternal::row_drop_possible(GtkTreeDragDest *WXUNUSED(drag_dest), GtkSelectionData *selection_data) { wxDataViewItem item(GetOwner()->GTKPathToItem(path)); - if ( !item ) - return FALSE; wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE, m_owner->GetId() ); event.SetEventObject( m_owner ); @@ -4337,39 +4446,10 @@ wxdataview_row_collapsed_callback( GtkTreeView* WXUNUSED(treeview), GtkTreeIter* // wxDataViewCtrl //----------------------------------------------------------------------------- -void wxDataViewCtrl::AddChildGTK(wxWindowGTK* child) +void wxDataViewCtrl::AddChildGTK(wxWindowGTK*) { - GtkWidget* treeview = GtkGetTreeView(); - - // Insert widget in GtkTreeView - 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 ); -} - -static -void gtk_dataviewctrl_size_callback( GtkWidget *WXUNUSED(widget), - GtkAllocation *WXUNUSED(gtk_alloc), - wxDataViewCtrl *win ) -{ - wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - while (node) - { - wxWindow *child = node->GetData(); - - GtkRequisition req; - gtk_widget_get_preferred_size(child->m_widget, NULL, &req); - - GtkAllocation alloc; - alloc.x = child->m_x; - alloc.y = child->m_y; - alloc.width = child->m_width; - alloc.height = child->m_height; - gtk_widget_size_allocate( child->m_widget, &alloc ); - - node = node->GetNext(); - } + // this is for cell editing controls, which will be + // made children of the GtkTreeView automatically } @@ -4461,7 +4541,7 @@ gtk_dataview_button_press_callback( GtkWidget *WXUNUSED(widget), return FALSE; } -IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl, wxDataViewCtrlBase); wxDataViewCtrl::~wxDataViewCtrl() { @@ -4526,9 +4606,6 @@ bool wxDataViewCtrl::Create(wxWindow *parent, m_focusWidget = GTK_WIDGET(m_treeview); - g_signal_connect (m_treeview, "size_allocate", - G_CALLBACK (gtk_dataviewctrl_size_callback), this); - bool fixed = (style & wxDV_VARIABLE_LINE_HEIGHT) == 0; gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed ); @@ -4639,9 +4716,6 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model ) if (!wxDataViewCtrlBase::AssociateModel( model )) return false; - bool fixed = (((GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) == 0) || (model->IsVirtualListModel())); - gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed ); - if ( model ) m_internal = new wxDataViewCtrlInternal( this, model ); @@ -5124,6 +5198,12 @@ void wxDataViewCtrl::DoSetExpanderColumn() void wxDataViewCtrl::DoSetIndent() { +#if GTK_CHECK_VERSION(2, 12, 0) + if ( gtk_check_version(2, 12, 0) == NULL ) + { + gtk_tree_view_set_level_indentation(GTK_TREE_VIEW(m_treeview), GetIndent()); + } +#endif // GTK+ 2.12+ } void wxDataViewCtrl::GtkDisableSelectionEvents() diff --git a/Externals/wxWidgets3/src/gtk/dc.cpp b/Externals/wxWidgets3/src/gtk/dc.cpp index 7640bf3c6e..e87585b6d5 100644 --- a/Externals/wxWidgets3/src/gtk/dc.cpp +++ b/Externals/wxWidgets3/src/gtk/dc.cpp @@ -34,6 +34,14 @@ wxGTKCairoDCImpl::wxGTKCairoDCImpl(wxDC* owner, int) m_height = 0; } +wxGTKCairoDCImpl::wxGTKCairoDCImpl(wxDC* owner, double scaleFactor) + : base_type(owner, 0) +{ + m_width = 0; + m_height = 0; + m_contentScaleFactor = scaleFactor; +} + wxGTKCairoDCImpl::wxGTKCairoDCImpl(wxDC* owner, wxWindow* window) : base_type(owner, 0) { @@ -43,6 +51,7 @@ wxGTKCairoDCImpl::wxGTKCairoDCImpl(wxDC* owner, wxWindow* window) m_textBackgroundColour = window->GetBackgroundColour(); m_width = 0; m_height = 0; + m_contentScaleFactor = window->GetContentScaleFactor(); } void wxGTKCairoDCImpl::DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask) @@ -200,7 +209,9 @@ wxWindowDCImpl::wxWindowDCImpl(wxWindowDC* owner, wxWindow* window) if (gdkWindow) { cairo_t* cr = gdk_cairo_create(gdkWindow); - SetGraphicsContext(wxGraphicsContext::CreateFromNative(cr)); + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(m_contentScaleFactor <= 1); + SetGraphicsContext(gc); GtkAllocation a; gtk_widget_get_allocation(widget, &a); int x, y; @@ -243,7 +254,9 @@ wxClientDCImpl::wxClientDCImpl(wxClientDC* owner, wxWindow* window) if (gdkWindow) { cairo_t* cr = gdk_cairo_create(gdkWindow); - SetGraphicsContext(wxGraphicsContext::CreateFromNative(cr)); + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(m_contentScaleFactor <= 1); + SetGraphicsContext(gc); if (gtk_widget_get_has_window(widget)) { m_width = gdk_window_get_width(gdkWindow); @@ -274,7 +287,9 @@ wxPaintDCImpl::wxPaintDCImpl(wxPaintDC* owner, wxWindow* window) m_width = gdk_window_get_width(gdkWindow); m_height = gdk_window_get_height(gdkWindow); cairo_reference(cr); - SetGraphicsContext(wxGraphicsContext::CreateFromNative(cr)); + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(m_contentScaleFactor <= 1); + SetGraphicsContext(gc); } //----------------------------------------------------------------------------- @@ -285,7 +300,9 @@ wxScreenDCImpl::wxScreenDCImpl(wxScreenDC* owner) m_width = gdk_window_get_width(window); m_height = gdk_window_get_height(window); cairo_t* cr = gdk_cairo_create(window); - SetGraphicsContext(wxGraphicsContext::CreateFromNative(cr)); + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(m_contentScaleFactor <= 1); + SetGraphicsContext(gc); } //----------------------------------------------------------------------------- @@ -335,20 +352,24 @@ void wxMemoryDCImpl::Setup() m_ok = m_bitmap.IsOk(); if (m_ok) { - m_width = m_bitmap.GetWidth(); - m_height = m_bitmap.GetHeight(); + m_width = int(m_bitmap.GetScaledWidth()); + m_height = int(m_bitmap.GetScaledHeight()); + m_contentScaleFactor = m_bitmap.GetScaleFactor(); cairo_t* cr = m_bitmap.CairoCreate(); gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(m_contentScaleFactor <= 1); } SetGraphicsContext(gc); } //----------------------------------------------------------------------------- -wxGTKCairoDC::wxGTKCairoDC(cairo_t* cr) - : base_type(new wxGTKCairoDCImpl(this, 0)) +wxGTKCairoDC::wxGTKCairoDC(cairo_t* cr, wxWindow* window) + : base_type(new wxGTKCairoDCImpl(this, window->GetContentScaleFactor())) { cairo_reference(cr); - SetGraphicsContext(wxGraphicsContext::CreateFromNative(cr)); + wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(cr); + gc->EnableOffset(window->GetContentScaleFactor() <= 1); + SetGraphicsContext(gc); } #else @@ -359,7 +380,7 @@ wxGTKCairoDC::wxGTKCairoDC(cairo_t* cr) // wxGTKDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxGTKDCImpl, wxDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxGTKDCImpl, wxDCImpl); wxGTKDCImpl::wxGTKDCImpl( wxDC *owner ) : wxDCImpl( owner ) diff --git a/Externals/wxWidgets3/src/gtk/dcclient.cpp b/Externals/wxWidgets3/src/gtk/dcclient.cpp index 2c4a716964..1a3d60cc8e 100644 --- a/Externals/wxWidgets3/src/gtk/dcclient.cpp +++ b/Externals/wxWidgets3/src/gtk/dcclient.cpp @@ -254,7 +254,7 @@ static void wxFreePoolGC( GdkGC *gc ) // wxWindowDC //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGTKDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGTKDCImpl); wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) : wxGTKDCImpl( owner ) @@ -663,6 +663,16 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC { wxCoord start = wxCoord(sa * 64.0); wxCoord end = wxCoord((ea-sa) * 64.0); + // We want to draw always in the counter-clokwise direction. + if (end < 0) + { + end = end % (360*64) + 360*64; + } + // If end angle equals start engle we want to draw a full ellipse. + if (end == 0) + { + end = 360*64; + } if ( m_brush.IsNonTransparent() ) { @@ -832,32 +842,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo if ( m_pen.IsNonTransparent() ) { - if ((m_pen.GetWidth() == 2) && (m_pen.GetCap() == wxCAP_ROUND) && - (m_pen.GetJoin() == wxJOIN_ROUND) && (m_pen.GetStyle() == wxPENSTYLE_SOLID)) - { - // Use 2 1-line rects instead - gdk_gc_set_line_attributes( m_penGC, 1, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); - - if (m_signX == -1) - { - // Different for RTL - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx+1, yy, ww-2, hh-2 ); - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy-1, ww, hh ); - } - else - { - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-2, hh-2 ); - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx-1, yy-1, ww, hh ); - } - - // reset - gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND ); - } - else - { - // Just use X11 for other cases - gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-1, hh-1 ); - } + gdk_draw_rectangle(m_gdkwindow, m_penGC, false, xx, yy, ww - 1, hh - 1); } } @@ -1199,9 +1184,8 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, gdk_gc_set_clip_region(use_gc, clipRegion); // Notice that we can only release the mask now, we can't do it before - // the calls to gdk_draw_xxx() above as they crash with X error with - // GTK+ up to 2.20.1 (i.e. it works with 2.20 but is known to not work - // with 2.16.1 and below). + // the calls to gdk_draw_xxx() above as they crash with BadPixmap X + // error with GTK+ 2.16 and earlier. if (mask_new) g_object_unref(mask_new); } @@ -1311,6 +1295,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, GdkGC* const use_gc = m_penGC; + GdkPixmap* mask_new = NULL; if (mask) { int srcMask_x = src_x; @@ -1320,7 +1305,6 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, srcMask_x = source->LogicalToDeviceX(xsrcMask); srcMask_y = source->LogicalToDeviceY(ysrcMask); } - GdkPixmap* mask_new = NULL; if (isScaled) { mask = ScaleMask(mask, srcMask_x, srcMask_y, @@ -1343,8 +1327,6 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } gdk_gc_set_clip_mask(use_gc, mask); gdk_gc_set_clip_origin(use_gc, dst_x - srcMask_x, dst_y - srcMask_y); - if (mask_new) - g_object_unref(mask_new); } GdkPixmap* pixmap = NULL; @@ -1385,7 +1367,12 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, if (pixmap) g_object_unref(pixmap); if (mask) + { gdk_gc_set_clip_region(use_gc, clipRegion); + // see comment at end of DoDrawBitmap() + if (mask_new) + g_object_unref(mask_new); + } return true; } @@ -1675,7 +1662,13 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; } case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; } case wxJOIN_ROUND: - default: { joinStyle = GDK_JOIN_ROUND; break; } + default: + break; + } + if (width < 3) + { + // width 2 rounded join looks bad on X11 (missing one corner pixel) + joinStyle = GDK_JOIN_MITER; } gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle ); @@ -2015,7 +2008,7 @@ int wxWindowDCImpl::GetDepth() const // wxClientDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl); wxClientDCImpl::wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) @@ -2047,7 +2040,7 @@ void wxClientDCImpl::DoGetSize(int *width, int *height) const // wxPaintDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl); // Limit the paint region to the window size. Sometimes // the paint region is too big, and this risks X11 errors @@ -2108,14 +2101,14 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *win ) class wxDCModule : public wxModule { public: - bool OnInit(); - void OnExit(); + bool OnInit() wxOVERRIDE; + void OnExit() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxDCModule) + wxDECLARE_DYNAMIC_CLASS(wxDCModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule); bool wxDCModule::OnInit() { diff --git a/Externals/wxWidgets3/src/gtk/dcmemory.cpp b/Externals/wxWidgets3/src/gtk/dcmemory.cpp index 05009c9e59..a75c8ed21d 100644 --- a/Externals/wxWidgets3/src/gtk/dcmemory.cpp +++ b/Externals/wxWidgets3/src/gtk/dcmemory.cpp @@ -17,7 +17,7 @@ // wxMemoryDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl); wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxWindowDCImpl( owner ) diff --git a/Externals/wxWidgets3/src/gtk/dcscreen.cpp b/Externals/wxWidgets3/src/gtk/dcscreen.cpp index 3e6dc777f9..c895c9e200 100644 --- a/Externals/wxWidgets3/src/gtk/dcscreen.cpp +++ b/Externals/wxWidgets3/src/gtk/dcscreen.cpp @@ -17,7 +17,7 @@ // wxScreenDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl); wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) : wxWindowDCImpl( owner ) diff --git a/Externals/wxWidgets3/src/gtk/descrip.mms b/Externals/wxWidgets3/src/gtk/descrip.mms index f6f7ae09f7..d35c8a6bf0 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 : 6 November 2012 * +# Date : 21 April 2015 * # * #***************************************************************************** .first @@ -100,7 +100,7 @@ OBJECTS0= \ msgdlg.obj,\ treeentry_gtk.obj,textentry.obj,filectrl.obj,print.obj,win_gtk.obj,\ mnemonics.obj,private.obj,assertdlg_gtk.obj,infobar.obj,anybutton.obj,\ - nonownedwnd.obj,textmeasure.obj + nonownedwnd.obj,textmeasure.obj,display.obj,activityindicator.obj SOURCES =\ animate.cpp,\ @@ -167,7 +167,7 @@ SOURCES =\ window.cpp,\ treeentry_gtk.c,textentry.cpp,filectrl.cpp,print.cpp,win_gtk.cpp,\ mnemonics.cpp,private.cpp,assertdlg_gtk.cpp,infobar.cpp,anybutton.cpp,\ - nonownedwnd.cpp,textmeasure.cpp + nonownedwnd.cpp,textmeasure.cpp,display.cpp all : $(SOURCES) $(MMS)$(MMSQUALIFIERS) $(OBJECTS) @@ -266,3 +266,5 @@ infobar.obj : infobar.cpp anybutton.obj : anybutton.cpp nonownedwnd.obj : nonownedwnd.cpp textmeasure.obj : textmeasure.cpp +display.obj : display.cpp +activityindicator.obj : activityindicator.cpp diff --git a/Externals/wxWidgets3/src/gtk/dialog.cpp b/Externals/wxWidgets3/src/gtk/dialog.cpp index 98f08d7d6f..b57b9b4992 100644 --- a/Externals/wxWidgets3/src/gtk/dialog.cpp +++ b/Externals/wxWidgets3/src/gtk/dialog.cpp @@ -12,7 +12,6 @@ #include "wx/dialog.h" #ifndef WX_PRECOMP - #include "wx/cursor.h" #endif // WX_PRECOMP #include "wx/evtloop.h" @@ -137,9 +136,7 @@ int wxDialog::ShowModal() // release the mouse if it's currently captured as the window having it // will be disabled when this dialog is shown -- but will still keep the // capture making it impossible to do anything in the modal dialog itself - wxWindow * const win = wxWindow::GetCapture(); - if ( win ) - win->GTKReleaseMouseAndNotify(); + GTKReleaseMouseAndNotify(); wxWindow * const parent = GetParentForModalDialog(); if ( parent ) @@ -148,8 +145,6 @@ int wxDialog::ShowModal() GTK_WINDOW(parent->m_widget) ); } - wxBusyCursorSuspender cs; // temporarily suppress the busy cursor - #if GTK_CHECK_VERSION(2,10,0) unsigned sigId = 0; gulong hookId = 0; @@ -163,14 +158,20 @@ int wxDialog::ShowModal() } #endif + // NOTE: this will cause a gtk_grab_add() during Show() + gtk_window_set_modal(GTK_WINDOW(m_widget), true); + Show( true ); m_modalShowing = true; wxOpenModalDialogLocker modalLock; - // NOTE: gtk_window_set_modal internally calls gtk_grab_add() ! - gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE); + // Prevent the widget from being destroyed if the user closes the window. + // Needed for derived classes which bypass wxTLW::Create(), and therefore + // the wxTLW "delete-event" handler is not connected + gulong handler_id = g_signal_connect( + m_widget, "delete-event", G_CALLBACK(gtk_true), this); // Run modal dialog event loop. { @@ -178,6 +179,7 @@ int wxDialog::ShowModal() m_modalLoop->Run(); } + g_signal_handler_disconnect(m_widget, handler_id); #if GTK_CHECK_VERSION(2,10,0) if (sigId) g_signal_remove_emission_hook(sigId, hookId); diff --git a/Externals/wxWidgets3/src/gtk/dirdlg.cpp b/Externals/wxWidgets3/src/gtk/dirdlg.cpp index e42d66da42..c47abbd0f0 100644 --- a/Externals/wxWidgets3/src/gtk/dirdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/dirdlg.cpp @@ -46,7 +46,7 @@ static void gtk_dirdialog_response_callback(GtkWidget * WXUNUSED(w), // wxDirDialog //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDirDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxDirDialog, wxDialog); wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title, @@ -93,14 +93,15 @@ bool wxDirDialog::Create(wxWindow* parent, g_object_ref(m_widget); gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT); - - // gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys - // the dialog when the user press ESC on the dialog: in that case a second call to - // ShowModal() would result in a bunch of Gtk-CRITICAL errors... - g_signal_connect (m_widget, - "delete_event", - G_CALLBACK (gtk_widget_hide_on_delete), - (gpointer)this); +#if GTK_CHECK_VERSION(2,18,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,18,0) == NULL) +#endif + { + gtk_file_chooser_set_create_folders( + GTK_FILE_CHOOSER(m_widget), (style & wxDD_DIR_MUST_EXIST) == 0); + } +#endif // 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 diff --git a/Externals/wxWidgets3/src/gtk/display.cpp b/Externals/wxWidgets3/src/gtk/display.cpp new file mode 100644 index 0000000000..f30e2037f7 --- /dev/null +++ b/Externals/wxWidgets3/src/gtk/display.cpp @@ -0,0 +1,239 @@ +/////////////////////////////////////////////////////////////////////////// +// Name: src/gtk/display.cpp +// Author: Paul Cornett +// Created: 2014-04-17 +// Copyright: (c) 2014 Paul Cornett +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_DISPLAY + #include "wx/display.h" + #include "wx/display_impl.h" +#endif +#include "wx/utils.h" // wxClientDisplayRect + +#include +#ifdef GDK_WINDOWING_X11 + #include +#endif +#include "wx/gtk/private/gtk2-compat.h" + +GdkWindow* wxGetTopLevelGDK(); + +//----------------------------------------------------------------------------- + +#ifdef GDK_WINDOWING_X11 +void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height); +#endif + +#ifndef __WXGTK3__ +static inline int wx_gdk_screen_get_primary_monitor(GdkScreen* screen) +{ + int monitor = 0; +#if GTK_CHECK_VERSION(2,20,0) + if (gtk_check_version(2,20,0) == NULL) + monitor = gdk_screen_get_primary_monitor(screen); +#endif + return monitor; +} +#define gdk_screen_get_primary_monitor wx_gdk_screen_get_primary_monitor +#endif // !__WXGTK3__ + +static inline void +wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* dest) +{ +#if GTK_CHECK_VERSION(3,4,0) + if (gtk_check_version(3,4,0) == NULL) + gdk_screen_get_monitor_workarea(screen, monitor, dest); + else +#endif + { + gdk_screen_get_monitor_geometry(screen, monitor, dest); +#ifdef GDK_WINDOWING_X11 +#ifdef __WXGTK3__ + if (GDK_IS_X11_SCREEN(screen)) +#endif + { + GdkRectangle rect = { 0 }; + wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen), + rect.x, rect.y, rect.width, rect.height); + // in case _NET_WORKAREA result is too large + if (rect.width && rect.height) + gdk_rectangle_intersect(dest, &rect, dest); + } +#endif // GDK_WINDOWING_X11 + } +} +#define gdk_screen_get_monitor_workarea wx_gdk_screen_get_monitor_workarea + +void wxClientDisplayRect(int* x, int* y, int* width, int* height) +{ + GdkRectangle rect; + GdkWindow* window = wxGetTopLevelGDK(); + GdkScreen* screen = gdk_window_get_screen(window); + int monitor = gdk_screen_get_monitor_at_window(screen, window); + gdk_screen_get_monitor_workarea(screen, monitor, &rect); + if (x) + *x = rect.x; + if (y) + *y = rect.y; + if (width) + *width = rect.width; + if (height) + *height = rect.height; +} +//----------------------------------------------------------------------------- + +#if wxUSE_DISPLAY +class wxDisplayFactoryGTK: public wxDisplayFactory +{ +public: + virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; +}; + +class wxDisplayImplGTK: public wxDisplayImpl +{ + typedef wxDisplayImpl base_type; +public: + wxDisplayImplGTK(unsigned i); + virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxRect GetClientArea() const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE; + virtual bool IsPrimary() const wxOVERRIDE; + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; + + GdkScreen* const m_screen; +}; + +static inline GdkScreen* GetScreen() +{ + return gdk_window_get_screen(wxGetTopLevelGDK()); +} +//----------------------------------------------------------------------------- + +wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n) +{ + return new wxDisplayImplGTK(n); +} + +unsigned wxDisplayFactoryGTK::GetCount() +{ + return gdk_screen_get_n_monitors(GetScreen()); +} + +int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) +{ + GdkScreen* screen = GetScreen(); + int monitor = gdk_screen_get_monitor_at_point(screen, pt.x, pt.y); + GdkRectangle rect; + gdk_screen_get_monitor_geometry(screen, monitor, &rect); + if (!wxRect(rect.x, rect.y, rect.width, rect.height).Contains(pt)) + monitor = wxNOT_FOUND; + return monitor; +} +//----------------------------------------------------------------------------- + +wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) + : base_type(i) + , m_screen(GetScreen()) +{ +} + +wxRect wxDisplayImplGTK::GetGeometry() const +{ + GdkRectangle rect; + gdk_screen_get_monitor_geometry(m_screen, m_index, &rect); + return wxRect(rect.x, rect.y, rect.width, rect.height); +} + +wxRect wxDisplayImplGTK::GetClientArea() const +{ + GdkRectangle rect; + gdk_screen_get_monitor_workarea(m_screen, m_index, &rect); + return wxRect(rect.x, rect.y, rect.width, rect.height); +} + +wxString wxDisplayImplGTK::GetName() const +{ + return wxString(); +} + +bool wxDisplayImplGTK::IsPrimary() const +{ + return gdk_screen_get_primary_monitor(m_screen) == int(m_index); +} + +#ifdef GDK_WINDOWING_X11 +wxArrayVideoModes wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* pDisplay, int nScreen); +wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen); +bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen); +wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display); +#endif + +wxArrayVideoModes wxDisplayImplGTK::GetModes(const wxVideoMode& mode) const +{ + wxArrayVideoModes modes; +#ifdef GDK_WINDOWING_X11 +#ifdef __WXGTK3__ + if (GDK_IS_X11_SCREEN(m_screen)) +#endif + { + Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + int nScreen = gdk_x11_screen_get_screen_number(m_screen); + modes = wxXF86VidMode_GetModes(mode, display, nScreen); +#else + modes = wxX11_GetModes(this, mode, display); +#endif + } +#else + wxUnusedVar(mode); +#endif + return modes; +} + +wxVideoMode wxDisplayImplGTK::GetCurrentMode() const +{ + wxVideoMode mode; +#if defined(GDK_WINDOWING_X11) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) +#ifdef __WXGTK3__ + if (GDK_IS_X11_SCREEN(m_screen)) +#endif + { + Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); + int nScreen = gdk_x11_screen_get_screen_number(m_screen); + mode = wxXF86VidMode_GetCurrentMode(display, nScreen); + } +#endif + return mode; +} + +bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& mode) +{ + bool success = false; +#if defined(GDK_WINDOWING_X11) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) +#ifdef __WXGTK3__ + if (GDK_IS_X11_SCREEN(m_screen)) +#endif + { + Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); + int nScreen = gdk_x11_screen_get_screen_number(m_screen); + success = wxXF86VidMode_ChangeMode(mode, display, nScreen); + } +#else + wxUnusedVar(mode); +#endif + return success; +} + +wxDisplayFactory* wxDisplay::CreateFactory() +{ + return new wxDisplayFactoryGTK; +} +#endif // wxUSE_DISPLAY diff --git a/Externals/wxWidgets3/src/gtk/evtloop.cpp b/Externals/wxWidgets3/src/gtk/evtloop.cpp index 59d0e31c18..9e7a2f44d2 100644 --- a/Externals/wxWidgets3/src/gtk/evtloop.cpp +++ b/Externals/wxWidgets3/src/gtk/evtloop.cpp @@ -35,14 +35,14 @@ #include "wx/apptrait.h" #include -#include +#include "wx/gtk/private/gtk2-compat.h" + +GdkWindow* wxGetTopLevelGDK(); // ============================================================================ // wxEventLoop implementation // ============================================================================ -extern GtkWidget *wxGetRootWindow(); - // ---------------------------------------------------------------------------- // wxEventLoop running and exiting // ---------------------------------------------------------------------------- @@ -78,6 +78,13 @@ int wxGUIEventLoop::DoRun() OnExit(); +#if wxUSE_EXCEPTIONS + // Rethrow any exceptions which could have been produced by the handlers + // ran by the event loop. + if ( wxTheApp ) + wxTheApp->RethrowStoredException(); +#endif // wxUSE_EXCEPTIONS + return m_exitcode; } @@ -149,7 +156,7 @@ class wxGUIEventLoopSourcesManager : public wxEventLoopSourcesManagerBase { public: virtual wxEventLoopSource* - AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) + AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) wxOVERRIDE { wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); @@ -361,25 +368,8 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data) } } -bool wxGUIEventLoop::YieldFor(long eventsToProcess) +void wxGUIEventLoop::DoYieldFor(long eventsToProcess) { -#if wxUSE_THREADS - if ( !wxThread::IsMain() ) - { - // can't call gtk_main_iteration() from other threads like this - return true; - } -#endif // wxUSE_THREADS - - m_isInsideYield = true; - m_eventsToProcessInsideYield = eventsToProcess; - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); -#endif - // temporarily replace the global GDK event handler with our function, which // categorizes the events and using m_eventsToProcessInsideYield decides // if an event should be processed immediately or not @@ -393,27 +383,10 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) gtk_main_iteration(); gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL); - // Process all pending events too, this is consistent with wxMSW behaviour - // and the behaviour of wxGTK itself in the previous versions. - if ( wxTheApp ) - wxTheApp->ProcessPendingEvents(); - - if (eventsToProcess != wxEVT_CATEGORY_CLIPBOARD) - { - // It's necessary to call ProcessIdle() to update the frames sizes which - // might have been changed (it also will update other things set from - // OnUpdateUI() which is a nice (and desired) side effect). But we - // call ProcessIdle() only once since this is not meant for longish - // background jobs (controlled by wxIdleEvent::RequestMore() and the - // return value of Processidle(). - ProcessIdle(); - } - //else: if we are inside ~wxClipboardSync() and we call ProcessIdle() and - // the user app contains an UI update handler which calls wxClipboard::IsSupported, - // then we fall into a never-ending loop... + wxEventLoopBase::DoYieldFor(eventsToProcess); // put all unprocessed GDK events back in the queue - GdkDisplay* disp = gtk_widget_get_display(wxGetRootWindow()); + GdkDisplay* disp = gdk_window_get_display(wxGetTopLevelGDK()); for (size_t i=0; im_bIgnoreNextChange) - { - p->m_bIgnoreNextChange=false; - return; - } - wxASSERT(p); - // NB: it's important to use gtk_file_chooser_get_filename instead of // gtk_file_chooser_get_current_folder (see GTK docs) ! wxGtkString filename(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget))); @@ -190,7 +184,13 @@ static void gtk_dirbutton_currentfolderchanged_callback(GtkFileChooserButton *wi // thus we need to make sure the current working directory is updated if wxDIRP_CHANGE_DIR // style was given. if (p->HasFlag(wxDIRP_CHANGE_DIR)) - chdir(filename); + { + if ( chdir(filename) != 0 ) + { + wxLogSysError(_("Changing current directory to \"%s\" failed"), + wxString::FromUTF8(filename)); + } + } // ...and fire an event wxFileDirPickerEvent event(wxEVT_DIRPICKER_CHANGED, p, p->GetId(), p->GetPath()); @@ -198,12 +198,29 @@ static void gtk_dirbutton_currentfolderchanged_callback(GtkFileChooserButton *wi } } +//----------------------------------------------------------------------------- +// "selection-changed" +//----------------------------------------------------------------------------- + +extern "C" { +static void selection_changed(GtkFileChooser* chooser, wxDirButton* win) +{ + char* filename = gtk_file_chooser_get_filename(chooser); + + if (wxString::FromUTF8(filename) == win->GetPath()) + win->m_bIgnoreNextChange = false; + else if (!win->m_bIgnoreNextChange) + file_set(chooser, win); + + g_free(filename); +} +} //----------------------------------------------------------------------------- // wxDirButtonGTK //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDirButton, wxButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxDirButton, wxButton); bool wxDirButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxString &path, @@ -231,7 +248,6 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, m_wildcard = wildcard; if ((m_dialog = CreateDialog()) == NULL) return false; - SetPath(path); // little trick used to avoid problems when there are other GTK windows 'grabbed': // GtkFileChooserDialog won't be responsive to user events if there is another @@ -250,10 +266,19 @@ bool wxDirButton::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); + SetPath(path); - // GtkFileChooserButton signals - g_signal_connect(m_widget, "current-folder-changed", - G_CALLBACK(gtk_dirbutton_currentfolderchanged_callback), this); +#ifdef __WXGTK3__ + if (gtk_check_version(3,8,0) == NULL) + g_signal_connect(m_widget, "file_set", G_CALLBACK(file_set), this); + else +#endif + { + // prior to GTK+ 3.8 neither "file-set" nor "current-folder-changed" will be + // emitted when the user selects one of the special folders from the combobox + g_signal_connect(m_widget, "selection_changed", + G_CALLBACK(selection_changed), this); + } m_parent->DoAddChild( this ); @@ -283,21 +308,15 @@ void wxDirButton::GTKUpdatePath(const char *gtkpath) void wxDirButton::SetPath(const wxString& str) { if ( m_path == str ) - { - // don't do anything and especially don't set m_bIgnoreNextChange return; - } m_path = str; - // wxDirButton uses the "current-folder-changed" signal which is triggered also - // when we set the path on the dialog associated with this button; thus we need - // to set the following flag to avoid sending a wxFileDirPickerEvent from this - // function (which would be inconsistent with wxFileButton's behaviour and in - // general with all wxWidgets control-manipulation functions which do not send events). m_bIgnoreNextChange = true; - if (m_dialog) + if (GTK_IS_FILE_CHOOSER(m_widget)) + gtk_file_chooser_set_filename((GtkFileChooser*)m_widget, str.utf8_str()); + else if (m_dialog) UpdateDialogPath(m_dialog); } diff --git a/Externals/wxWidgets3/src/gtk/font.cpp b/Externals/wxWidgets3/src/gtk/font.cpp index 9cd46bac4b..54ec1b403c 100644 --- a/Externals/wxWidgets3/src/gtk/font.cpp +++ b/Externals/wxWidgets3/src/gtk/font.cpp @@ -113,6 +113,18 @@ void wxFontRefData::Init(int pointSize, const wxString& faceName, wxFontEncoding WXUNUSED(encoding)) { + // Old code could wrongly specify wxDEFAULT instead of -1 or wxNORMAL or, + // preferably, wxFONTSTYLE_NORMAL or wxFONTWEIGHT_NORMAL, continue handling + // this for compatibility. + if ( pointSize == wxDEFAULT ) + pointSize = -1; + + if ( static_cast(style) == wxDEFAULT ) + style = wxFONTSTYLE_NORMAL; + + if ( static_cast(weight) == wxDEFAULT ) + weight = wxFONTWEIGHT_NORMAL; + if (family == wxFONTFAMILY_DEFAULT) family = wxFONTFAMILY_SWISS; @@ -130,11 +142,9 @@ void wxFontRefData::Init(int pointSize, SetFamily(family); } - SetStyle( style == wxDEFAULT ? wxFONTSTYLE_NORMAL : style ); - SetPointSize( (pointSize == wxDEFAULT || pointSize == -1) - ? wxDEFAULT_FONT_SIZE - : pointSize ); - SetWeight( weight == wxDEFAULT ? wxFONTWEIGHT_NORMAL : weight ); + SetStyle( style ); + SetPointSize( pointSize == -1 ? wxDEFAULT_FONT_SIZE : pointSize ); + SetWeight( weight ); SetUnderlined( underlined ); SetStrikethrough( strikethrough ); } @@ -151,12 +161,9 @@ void wxFontRefData::InitFromNative() } wxFontRefData::wxFontRefData( const wxFontRefData& data ) - : wxGDIRefData() + : wxGDIRefData(), + m_nativeFontInfo(data.m_nativeFontInfo) { - // Forces a copy of the internal data. wxNativeFontInfo should probably - // have a copy ctor and assignment operator to fix this properly but that - // would break binary compatibility... - m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString()); } wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style, diff --git a/Externals/wxWidgets3/src/gtk/fontdlg.cpp b/Externals/wxWidgets3/src/gtk/fontdlg.cpp index bdf2dd4a2d..3f651fbe63 100644 --- a/Externals/wxWidgets3/src/gtk/fontdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/fontdlg.cpp @@ -41,9 +41,11 @@ static void response(GtkDialog* dialog, int response_id, wxFontDialog* win) else #endif { + wxGCC_WARNING_SUPPRESS(deprecated-declarations) GtkFontSelectionDialog* sel = GTK_FONT_SELECTION_DIALOG(dialog); wxGtkString name(gtk_font_selection_dialog_get_font_name(sel)); win->GetFontData().SetChosenFont(wxFont(wxString::FromUTF8(name))); + wxGCC_WARNING_RESTORE() } } @@ -58,7 +60,7 @@ static void response(GtkDialog* dialog, int response_id, wxFontDialog* win) // wxFontDialog //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); bool wxFontDialog::DoCreate(wxWindow *parent) { @@ -78,14 +80,19 @@ bool wxFontDialog::DoCreate(wxWindow *parent) gtk_parent = GTK_WINDOW(parent->m_widget); #if GTK_CHECK_VERSION(3,2,0) +#if GLIB_CHECK_VERSION(2, 34, 0) + g_type_ensure(PANGO_TYPE_FONT_FACE); +#endif if (gtk_check_version(3,2,0) == NULL) m_widget = gtk_font_chooser_dialog_new(wxGTK_CONV(message), gtk_parent); else #endif { + wxGCC_WARNING_SUPPRESS(deprecated-declarations) m_widget = gtk_font_selection_dialog_new(wxGTK_CONV(message)); if (gtk_parent) gtk_window_set_transient_for(GTK_WINDOW(m_widget), gtk_parent); + wxGCC_WARNING_RESTORE() } g_object_ref(m_widget); @@ -104,9 +111,11 @@ bool wxFontDialog::DoCreate(wxWindow *parent) else #endif { + wxGCC_WARNING_SUPPRESS(deprecated-declarations) const wxString& fontname = info->ToString(); GtkFontSelectionDialog* sel = GTK_FONT_SELECTION_DIALOG(m_widget); gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname)); + wxGCC_WARNING_RESTORE() } } else diff --git a/Externals/wxWidgets3/src/gtk/fontpicker.cpp b/Externals/wxWidgets3/src/gtk/fontpicker.cpp index 49e0710cff..e5f98b64c8 100644 --- a/Externals/wxWidgets3/src/gtk/fontpicker.cpp +++ b/Externals/wxWidgets3/src/gtk/fontpicker.cpp @@ -49,7 +49,7 @@ static void gtk_fontbutton_setfont_callback(GtkFontButton *widget, // wxFontButton //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxButton); bool wxFontButton::Create( wxWindow *parent, wxWindowID id, const wxFont &initial, @@ -106,4 +106,8 @@ void wxFontButton::UpdateFont() gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname)); } +void wxFontButton::SetNativeFontInfo(const char* gtkdescription) +{ + m_selectedFont.SetNativeFontInfo(wxString::FromUTF8(gtkdescription)); +} #endif // wxUSE_FONTPICKERCTRL diff --git a/Externals/wxWidgets3/src/gtk/frame.cpp b/Externals/wxWidgets3/src/gtk/frame.cpp index 3f7ab5ab1d..1361cde8e0 100644 --- a/Externals/wxWidgets3/src/gtk/frame.cpp +++ b/Externals/wxWidgets3/src/gtk/frame.cpp @@ -20,14 +20,6 @@ #include #include "wx/gtk/private/gtk2-compat.h" -#if wxUSE_LIBHILDON - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 - #include -#endif // wxUSE_LIBHILDON2 - // ---------------------------------------------------------------------------- // event tables // ---------------------------------------------------------------------------- @@ -56,13 +48,6 @@ bool wxFrame::Create( wxWindow *parent, return wxFrameBase::Create(parent, id, title, pos, sizeOrig, style, name); } -wxFrame::~wxFrame() -{ - SendDestroyEvent(); - - DeleteAllBars(); -} - // ---------------------------------------------------------------------------- // overridden wxWindow methods // ---------------------------------------------------------------------------- @@ -84,9 +69,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const { int h; gtk_widget_get_preferred_height(m_frameMenuBar->m_widget, NULL, &h); -#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 *height -= h; -#endif } #endif // wxUSE_MENUS_NATIVE @@ -277,13 +260,9 @@ void wxFrame::DetachMenuBar() if ( m_frameMenuBar ) { -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - hildon_window_set_menu(HILDON_WINDOW(m_widget), NULL); -#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 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 } wxFrameBase::DetachMenuBar(); @@ -299,11 +278,6 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) if (m_frameMenuBar) { -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - hildon_window_set_menu(HILDON_WINDOW(m_widget), - GTK_MENU(m_frameMenuBar->m_widget)); -#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 - // menubar goes into top of vbox (m_mainWidget) gtk_box_pack_start( GTK_BOX(m_mainWidget), menuBar->m_widget, false, false, 0); @@ -313,7 +287,6 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) gtk_widget_set_size_request(menuBar->m_widget, -1, -1); gtk_widget_show( m_frameMenuBar->m_widget ); -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } // make sure next size_allocate causes a wxSizeEvent m_useCachedClientSize = false; @@ -328,6 +301,8 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) m_frameToolBar = toolbar; if (toolbar) { + gtk_container_remove( + GTK_CONTAINER(gtk_widget_get_parent(toolbar->m_widget)), toolbar->m_widget); if (toolbar->IsVertical()) { // Vertical toolbar and m_wxwindow go into an hbox, inside the @@ -338,11 +313,12 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(m_mainWidget), hbox, true, true, 0); - gtk_widget_reparent(m_wxwindow, hbox); + g_object_ref(m_wxwindow); + gtk_container_remove(GTK_CONTAINER(m_mainWidget), m_wxwindow); + gtk_box_pack_start(GTK_BOX(hbox), m_wxwindow, true, true, 0); + g_object_unref(m_wxwindow); } - gtk_widget_reparent(toolbar->m_widget, hbox); - gtk_box_set_child_packing(GTK_BOX(hbox), - toolbar->m_widget, false, false, 0, GTK_PACK_START); + gtk_box_pack_start(GTK_BOX(hbox), toolbar->m_widget, false, false, 0); int pos = 0; // left if (toolbar->HasFlag(wxTB_RIGHT)) @@ -352,9 +328,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) else { // Horizontal toolbar goes into vbox (m_mainWidget) - gtk_widget_reparent(toolbar->m_widget, m_mainWidget); - gtk_box_set_child_packing(GTK_BOX(m_mainWidget), - toolbar->m_widget, false, false, 0, GTK_PACK_START); + gtk_box_pack_start(GTK_BOX(m_mainWidget), toolbar->m_widget, false, false, 0); int pos = 0; // top if (m_frameMenuBar) @@ -382,9 +356,9 @@ void wxFrame::SetStatusBar(wxStatusBar *statbar) if (statbar) { // statusbar goes into bottom of vbox (m_mainWidget) - gtk_widget_reparent(statbar->m_widget, m_mainWidget); - gtk_box_set_child_packing(GTK_BOX(m_mainWidget), - statbar->m_widget, false, false, 0, GTK_PACK_END); + gtk_container_remove( + GTK_CONTAINER(gtk_widget_get_parent(statbar->m_widget)), statbar->m_widget); + gtk_box_pack_end(GTK_BOX(m_mainWidget), statbar->m_widget, false, false, 0); // make sure next size_allocate on statusbar causes a size event statbar->m_useCachedClientSize = false; statbar->m_clientWidth = 0; diff --git a/Externals/wxWidgets3/src/gtk/glcanvas.cpp b/Externals/wxWidgets3/src/gtk/glcanvas.cpp index d4acb9c8c2..1e68741ca0 100644 --- a/Externals/wxWidgets3/src/gtk/glcanvas.cpp +++ b/Externals/wxWidgets3/src/gtk/glcanvas.cpp @@ -140,7 +140,22 @@ parent_set_hook(GSignalInvocationHint*, guint, const GValue* param_values, void* // wxGlCanvas //--------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGLCanvas, wxWindow) +wxIMPLEMENT_CLASS(wxGLCanvas, wxWindow); + +wxGLCanvas::wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) +#if WXWIN_COMPATIBILITY_2_8 + : m_createImplicitContext(false) +#endif +{ + Create(parent, dispAttrs, id, pos, size, style, name, palette); +} wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, @@ -216,6 +231,24 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxString& name, const int *attribList, const wxPalette& palette) +{ + // Separate 'GLXFBConfig/XVisual' attributes. + // Also store context attributes for wxGLContext ctor + wxGLAttributes dispAttrs; + if ( ! ParseAttribList(attribList, dispAttrs, &m_GLCTXAttrs) ) + return false; + + return Create(parent, dispAttrs, id, pos, size, style, name, palette); +} + +bool wxGLCanvas::Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) { #if wxUSE_PALETTE wxASSERT_MSG( !palette.IsOk(), wxT("palettes not supported") ); @@ -230,7 +263,7 @@ bool wxGLCanvas::Create(wxWindow *parent, m_backgroundStyle = wxBG_STYLE_PAINT; #endif - if ( !InitVisual(attribList) ) + if ( !InitVisual(dispAttrs) ) return false; // watch for the "parent-set" signal on m_wxwindow so we can set colormap diff --git a/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp b/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Externals/wxWidgets3/src/gtk/gnome/gvfs.cpp b/Externals/wxWidgets3/src/gtk/gnome/gvfs.cpp index 3f86418b10..94986b7cc9 100644 --- a/Externals/wxWidgets3/src/gtk/gnome/gvfs.cpp +++ b/Externals/wxWidgets3/src/gtk/gnome/gvfs.cpp @@ -138,7 +138,7 @@ public: void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxGnomeVFSModule) + wxDECLARE_DYNAMIC_CLASS(wxGnomeVFSModule); }; bool wxGnomeVFSModule::OnInit() @@ -160,6 +160,6 @@ void wxGnomeVFSModule::OnExit() delete gs_lgvfs; } -IMPLEMENT_DYNAMIC_CLASS(wxGnomeVFSModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGnomeVFSModule, wxModule); #endif // wxUSE_LIBGNOMEVFS && wxUSE_MIMETYPE diff --git a/Externals/wxWidgets3/src/gtk/hildon/notifmsg.cpp b/Externals/wxWidgets3/src/gtk/hildon/notifmsg.cpp deleted file mode 100644 index 50c5c4ece8..0000000000 --- a/Externals/wxWidgets3/src/gtk/hildon/notifmsg.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/gtk/hildon/notifmsg.cpp -// Purpose: Hildon implementation of wxNotificationMessage -// Author: Vadim Zeitlin -// Created: 2007-11-21 -// Copyright: (c) 2007 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_LIBHILDON || wxUSE_LIBHILDON2 - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/notifmsg.h" -#include "wx/toplevel.h" - -#if wxUSE_LIBHILDON - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 - #include -#endif // wxUSE_LIBHILDON2 - -// ============================================================================ -// wxNotificationMessage implementation -// ============================================================================ - -wxString wxNotificationMessage::HildonGetMarkup() const -{ - const wxString& message = GetMessage(), - title = GetTitle(); - - wxString text; - if ( message.empty() ) - { - text = title; - } - else // combine title with message in a single string - { - text << "" << title << "\n" - "\n" - << message; - } - - return text; -} - -GtkWidget *wxNotificationMessage::HildonGetWindow() const -{ - wxWindow *parent = GetParent(); - if ( parent ) - { - parent = wxGetTopLevelParent(parent); - if ( parent ) - { - wxTopLevelWindow * const - tlw = wxDynamicCast(parent, wxTopLevelWindow); - if ( tlw ) - return tlw->m_mainWidget; - } - } - - return NULL; -} - -bool wxNotificationMessage::Show(int timeout) -{ - if ( timeout == Timeout_Never ) - { - m_banner = hildon_banner_show_animation - ( - HildonGetWindow(), - NULL, - GetFullMessage() // markup not supported here - ); - if ( !m_banner ) - return false; - } - else // the message will time out - { - // we don't have any way to set the timeout interval so we just let it - // time out automatically - hildon_banner_show_information_with_markup - ( - HildonGetWindow(), - NULL, - HildonGetMarkup() - ); - } - - return true; -} - -bool wxNotificationMessage::Close() -{ - if ( !m_banner ) - { - // either we hadn't been shown or we are using an information banner - // which will disappear on its own, nothing we can do about it - return false; - } - - gtk_widget_destroy(m_banner); - m_banner = NULL; - - return true; -} - -wxNotificationMessage::~wxNotificationMessage() -{ - Close(); -} - -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 diff --git a/Externals/wxWidgets3/src/gtk/hyperlink.cpp b/Externals/wxWidgets3/src/gtk/hyperlink.cpp index f90589df14..aaead3dc88 100644 --- a/Externals/wxWidgets3/src/gtk/hyperlink.cpp +++ b/Externals/wxWidgets3/src/gtk/hyperlink.cpp @@ -32,6 +32,10 @@ #include #include "wx/gtk/private.h" +#ifdef __WXGTK3__ + #include "wx/gtk/private/object.h" +#endif + // ---------------------------------------------------------------------------- // local functions // ---------------------------------------------------------------------------- @@ -54,19 +58,81 @@ static inline bool UseNative() // "clicked" // ---------------------------------------------------------------------------- +#ifdef __WXGTK3__ extern "C" { -static void gtk_hyperlink_clicked_callback( GtkWidget *WXUNUSED(widget), - wxHyperlinkCtrl *linkCtrl ) +static gboolean activate_link(GtkWidget*, wxHyperlinkCtrl* win) { - // send the event - linkCtrl->SendEvent(); + win->SetVisited(true); + win->SendEvent(); + return true; } } +#else +static GSList* gs_hyperlinkctrl_list; +extern "C" { +static void clicked_hook(GtkLinkButton* button, const char*, void*) +{ + for (GSList* p = gs_hyperlinkctrl_list; p; p = p->next) + { + wxHyperlinkCtrl* win = static_cast(p->data); + if (win->m_widget == (GtkWidget*)button) + { + win->SetVisited(true); + win->SendEvent(); + return; + } + } + gtk_link_button_set_uri_hook(NULL, NULL, NULL); + GTK_BUTTON_GET_CLASS(button)->clicked(GTK_BUTTON(button)); + gtk_link_button_set_uri_hook(clicked_hook, NULL, NULL); +} +} +#endif + +#ifdef __WXGTK3__ + +// Used to store GtkCssProviders we need to change the link colours with GTK+3. +class wxHyperlinkCtrlColData +{ +public: + wxHyperlinkCtrlColData() : + m_normalLinkCssProvider(gtk_css_provider_new()), + m_visitedLinkCssProvider(gtk_css_provider_new()) + {} + + wxGtkObject m_normalLinkCssProvider; + wxGtkObject m_visitedLinkCssProvider; +}; + +#endif // __WXGTK3__ // ---------------------------------------------------------------------------- // wxHyperlinkCtrl // ---------------------------------------------------------------------------- +wxHyperlinkCtrl::wxHyperlinkCtrl() +{ +} + +wxHyperlinkCtrl::wxHyperlinkCtrl(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxString& url, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + (void)Create(parent, id, label, url, pos, size, style, name); +} + +wxHyperlinkCtrl::~wxHyperlinkCtrl() +{ +#ifndef __WXGTK3__ + gs_hyperlinkctrl_list = g_slist_remove(gs_hyperlinkctrl_list, this); +#endif +} + bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxString& url, const wxPoint& pos, const wxSize& size, long style, const wxString& name) @@ -92,16 +158,21 @@ bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, x_alignment = 0.0; else if (HasFlag(wxHL_ALIGN_RIGHT)) x_alignment = 1.0; + + wxGCC_WARNING_SUPPRESS(deprecated-declarations) gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, 0.5); + wxGCC_WARNING_RESTORE() // set to non empty strings both the url and the label SetURL(url.empty() ? label : url); SetLabel(label.empty() ? url : label); - // our signal handlers: - g_signal_connect_after (m_widget, "clicked", - G_CALLBACK (gtk_hyperlink_clicked_callback), - this); +#ifdef __WXGTK3__ + g_signal_connect(m_widget, "activate_link", G_CALLBACK(activate_link), this); +#else + gs_hyperlinkctrl_list = g_slist_prepend(gs_hyperlinkctrl_list, this); + gtk_link_button_set_uri_hook(clicked_hook, NULL, NULL); +#endif m_parent->DoAddChild( this ); @@ -163,12 +234,45 @@ wxString wxHyperlinkCtrl::GetURL() const return wxGenericHyperlinkCtrl::GetURL(); } +void wxHyperlinkCtrl::DoSetLinkColour(LinkKind linkKind, const wxColour& colour) +{ +#ifdef __WXGTK3__ + if ( !m_colData ) + m_colData.reset(new wxHyperlinkCtrlColData()); + + const char* cssProp = NULL; + GtkCssProvider* cssProvider = NULL; + switch ( linkKind ) + { + case Link_Normal: + cssProp = "link-color"; + cssProvider = m_colData->m_normalLinkCssProvider; + break; + + case Link_Visited: + cssProp = "visited-link-color"; + cssProvider = m_colData->m_visitedLinkCssProvider; + break; + } + + wxCHECK_RET( cssProvider, wxS("unknown link kind") ); + + const GdkRGBA *col = colour; + + wxGtkString + css(g_strdup_printf("* { %s: %s; }", cssProp, gdk_rgba_to_string(col))); + ApplyCssStyle(cssProvider, css); +#else // !__WXGTK3__ + // simply do nothing: GTK+ does not allow us to change it :( + wxUnusedVar(linkKind); + wxUnusedVar(colour); +#endif +} + void wxHyperlinkCtrl::SetNormalColour(const wxColour &colour) { if ( UseNative() ) - { - // simply do nothing: GTK+ does not allow us to change it :( - } + DoSetLinkColour(Link_Normal, colour); else wxGenericHyperlinkCtrl::SetNormalColour(colour); } @@ -178,13 +282,31 @@ wxColour wxHyperlinkCtrl::GetNormalColour() const wxColour ret; if ( UseNative() ) { - GdkColor *link_color = NULL; - - // convert GdkColor in wxColour +#ifdef __WXGTK3__ + GdkRGBA *link_color = NULL; gtk_widget_style_get(m_widget, "link-color", &link_color, NULL); - if (link_color) + + if ( link_color ) + { ret = wxColour(*link_color); - gdk_color_free (link_color); + gdk_rgba_free (link_color); + } +#else // !__WXGTK3__ + GdkColor* link_color; + GdkColor color = { 0, 0, 0, 0xeeee }; + + GtkWidget* widget = gtk_bin_get_child(GTK_BIN(m_widget)); + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + gtk_widget_ensure_style(widget); + gtk_widget_style_get(widget, "link-color", &link_color, NULL); + if (link_color) + { + color = *link_color; + gdk_color_free(link_color); + } + wxGCC_WARNING_RESTORE() + ret = wxColour(color); +#endif // __WXGTK3__/!__WXGTK3__ } else ret = wxGenericHyperlinkCtrl::GetNormalColour(); @@ -196,7 +318,7 @@ void wxHyperlinkCtrl::SetVisitedColour(const wxColour &colour) { if ( UseNative() ) { - // simply do nothing: GTK+ does not allow us to change it :( + DoSetLinkColour(Link_Visited, colour); } else wxGenericHyperlinkCtrl::SetVisitedColour(colour); @@ -207,20 +329,64 @@ wxColour wxHyperlinkCtrl::GetVisitedColour() const wxColour ret; if ( UseNative() ) { - GdkColor *link_color = NULL; - - // convert GdkColor in wxColour +#ifdef __WXGTK3__ + GdkRGBA *link_color = NULL; gtk_widget_style_get(m_widget, "visited-link-color", &link_color, NULL); - if (link_color) + + if ( link_color ) + { ret = wxColour(*link_color); - gdk_color_free (link_color); + gdk_rgba_free (link_color); + } +#else // !__WXGTK3__ + GdkColor* link_color; + GdkColor color = { 0, 0x5555, 0x1a1a, 0x8b8b }; + + GtkWidget* widget = gtk_bin_get_child(GTK_BIN(m_widget)); + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + gtk_widget_ensure_style(widget); + gtk_widget_style_get(widget, "visited-link-color", &link_color, NULL); + if (link_color) + { + color = *link_color; + gdk_color_free(link_color); + } + wxGCC_WARNING_RESTORE() + ret = wxColour(color); +#endif // __WXGTK3__/!__WXGTK3__ } else - return wxGenericHyperlinkCtrl::GetVisitedColour(); + ret = base_type::GetVisitedColour(); return ret; } +void wxHyperlinkCtrl::SetVisited(bool visited) +{ + base_type::SetVisited(visited); +#if GTK_CHECK_VERSION(2,14,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,14,0) == NULL) +#endif + { + gtk_link_button_set_visited(GTK_LINK_BUTTON(m_widget), visited); + } +#endif +} + +bool wxHyperlinkCtrl::GetVisited() const +{ +#if GTK_CHECK_VERSION(2,14,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,14,0) == NULL) +#endif + { + return gtk_link_button_get_visited(GTK_LINK_BUTTON(m_widget)) != 0; + } +#endif + return base_type::GetVisited(); +} + void wxHyperlinkCtrl::SetHoverColour(const wxColour &colour) { if ( UseNative() ) diff --git a/Externals/wxWidgets3/src/gtk/infobar.cpp b/Externals/wxWidgets3/src/gtk/infobar.cpp index fb55f9b3a3..2f7ea108b2 100644 --- a/Externals/wxWidgets3/src/gtk/infobar.cpp +++ b/Externals/wxWidgets3/src/gtk/infobar.cpp @@ -223,6 +223,25 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label) return button; } +size_t wxInfoBar::GetButtonCount() const +{ + if ( !UseNative() ) + return wxInfoBarGeneric::GetButtonCount(); + + return m_impl->m_buttons.size(); +} + +wxWindowID wxInfoBar::GetButtonId(size_t idx) const +{ + if ( !UseNative() ) + return wxInfoBarGeneric::GetButtonId(idx); + + wxCHECK_MSG( idx < m_impl->m_buttons.size(), wxID_NONE, + "Invalid infobar button position" ); + + return m_impl->m_buttons[idx].id; +} + void wxInfoBar::AddButton(wxWindowID btnid, const wxString& label) { if ( !UseNative() ) @@ -244,6 +263,24 @@ void wxInfoBar::AddButton(wxWindowID btnid, const wxString& label) m_impl->m_buttons.push_back(wxInfoBarGTKImpl::Button(button, btnid)); } +bool wxInfoBar::HasButtonId(wxWindowID btnid) const +{ + if ( !UseNative() ) + return wxInfoBarGeneric::HasButtonId(btnid); + + // as in the generic version, look for the button starting from the end + const wxInfoBarGTKImpl::Buttons& buttons = m_impl->m_buttons; + for ( wxInfoBarGTKImpl::Buttons::const_reverse_iterator i = buttons.rbegin(); + i != buttons.rend(); + ++i ) + { + if ( i->id == btnid ) + return true; + } + + return false; +} + void wxInfoBar::RemoveButton(wxWindowID btnid) { if ( !UseNative() ) diff --git a/Externals/wxWidgets3/src/gtk/listbox.cpp b/Externals/wxWidgets3/src/gtk/listbox.cpp index ef4042412b..dbc8db0f71 100644 --- a/Externals/wxWidgets3/src/gtk/listbox.cpp +++ b/Externals/wxWidgets3/src/gtk/listbox.cpp @@ -30,9 +30,11 @@ #include #include "wx/gtk/private.h" +#include "wx/gtk/private/eventsdisabler.h" #include "wx/gtk/private/gtk2-compat.h" #include "wx/gtk/private/object.h" #include "wx/gtk/private/treeentry_gtk.h" +#include "wx/gtk/private/treeview.h" #include #ifdef __WXGTK3__ @@ -195,11 +197,10 @@ static void tree_entry_destroy_cb(wxTreeEntry* entry, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_listbox_sort_callback(GtkTreeModel * WXUNUSED(model), - GtkTreeIter *a, - GtkTreeIter *b, - wxListBox *listbox) +static int +sort_callback(GtkTreeModel*, GtkTreeIter* a, GtkTreeIter* b, void* data) { + wxListBox* listbox = static_cast(data); wxTreeEntry* entry1 = GetEntry(listbox->m_liststore, a, listbox); wxCHECK_MSG(entry1, 0, wxT("Could not get first entry")); @@ -218,18 +219,16 @@ static gint gtk_listbox_sort_callback(GtkTreeModel * WXUNUSED(model), //----------------------------------------------------------------------------- extern "C" { -static gboolean gtk_listbox_searchequal_callback(GtkTreeModel * WXUNUSED(model), - gint WXUNUSED(column), - const gchar* key, - GtkTreeIter* iter, - wxListBox* listbox) +static gboolean +search_callback(GtkTreeModel*, int, const char* key, GtkTreeIter* iter, void* data) { + wxListBox* listbox = static_cast(data); wxTreeEntry* entry = GetEntry(listbox->m_liststore, iter, listbox); - wxCHECK_MSG(entry, 0, wxT("Could not get entry")); + wxCHECK_MSG(entry, true, "could not get entry"); - wxGtkString keycollatekey(g_utf8_collate_key(key, -1)); + wxGtkString keyc(g_utf8_collate_key(key, -1)); - return strcmp(keycollatekey, wx_tree_entry_get_collate_key(entry)) != 0; + return strncmp(keyc, wx_tree_entry_get_collate_key(entry), strlen(keyc)); } } @@ -327,10 +326,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, // NB: If this is enabled a doubleclick event (activate) gets sent // on a successful search gtk_tree_view_set_search_column(m_treeview, WXLISTBOX_DATACOLUMN); - gtk_tree_view_set_search_equal_func(m_treeview, - (GtkTreeViewSearchEqualFunc) gtk_listbox_searchequal_callback, - this, - NULL); + gtk_tree_view_set_search_equal_func(m_treeview, search_callback, this, NULL); gtk_tree_view_set_enable_search(m_treeview, FALSE); @@ -365,7 +361,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, // Set the sort callback gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(m_liststore), WXLISTBOX_DATACOLUMN, - (GtkTreeIterCompareFunc) gtk_listbox_sort_callback, + sort_callback, this, //userdata NULL //"destroy notifier" ); @@ -466,9 +462,13 @@ int wxListBox::DoInsertOneItem(const wxString& item, unsigned int pos) #else int entryCol = 0; #endif - gtk_list_store_insert_with_values(m_liststore, NULL, pos, entryCol, entry, -1); + GtkTreeIter iter; + gtk_list_store_insert_with_values(m_liststore, &iter, pos, entryCol, entry, -1); g_object_unref(entry); + if (HasFlag(wxLB_SORT)) + pos = GTKGetIndexFor(iter); + return pos; } @@ -480,13 +480,13 @@ void wxListBox::DoClear() { wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); - GTKDisableEvents(); // just in case + { + wxGtkEventsDisabler noEvents(this); - InvalidateBestSize(); + InvalidateBestSize(); - gtk_list_store_clear( m_liststore ); /* well, THAT was easy :) */ - - GTKEnableEvents(); + gtk_list_store_clear( m_liststore ); /* well, THAT was easy :) */ + } UpdateOldSelections(); } @@ -497,7 +497,7 @@ void wxListBox::DoDeleteOneItem(unsigned int n) InvalidateBestSize(); - GTKDisableEvents(); // just in case + wxGtkEventsDisabler noEvents(this); GtkTreeIter iter; wxCHECK_RET( GTKGetIteratorFor(n, &iter), wxT("wrong listbox index") ); @@ -505,8 +505,6 @@ void wxListBox::DoDeleteOneItem(unsigned int n) // this returns false if iter is invalid (e.g. deleting item at end) but // since we don't use iter, we ignore the return value gtk_list_store_remove(m_liststore, &iter); - - GTKEnableEvents(); } // ---------------------------------------------------------------------------- @@ -527,18 +525,14 @@ bool wxListBox::GTKGetIteratorFor(unsigned pos, GtkTreeIter *iter) const int wxListBox::GTKGetIndexFor(GtkTreeIter& iter) const { - GtkTreePath *path = - gtk_tree_model_get_path(GTK_TREE_MODEL(m_liststore), &iter); + wxGtkTreePath path( + gtk_tree_model_get_path(GTK_TREE_MODEL(m_liststore), &iter)); gint* pIntPath = gtk_tree_path_get_indices(path); wxCHECK_MSG( pIntPath, wxNOT_FOUND, wxT("failed to get iterator path") ); - int idx = pIntPath[0]; - - gtk_tree_path_free( path ); - - return idx; + return pIntPath[0]; } // get GtkTreeEntry from position (note: you need to g_unref it if valid) @@ -588,9 +582,8 @@ void wxListBox::SetString(unsigned int n, const wxString& label) // signal row changed GtkTreeModel* tree_model = GTK_TREE_MODEL(m_liststore); - GtkTreePath* path = gtk_tree_model_get_path(tree_model, &iter); + wxGtkTreePath path(gtk_tree_model_get_path(tree_model, &iter)); gtk_tree_model_row_changed(tree_model, path, &iter); - gtk_tree_path_free(path); } wxString wxListBox::GetString(unsigned int n) const @@ -646,7 +639,7 @@ void wxListBox::GTKOnSelectionChanged() else // single selection { const int item = GetSelection(); - if ( DoChangeSingleSelection(item) ) + if (item >= 0 && DoChangeSingleSelection(item)) SendEvent(wxEVT_LISTBOX, item, true); } } @@ -707,7 +700,7 @@ void wxListBox::DoSetSelection( int n, bool select ) { wxCHECK_RET( m_treeview != NULL, wxT("invalid listbox") ); - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); @@ -715,7 +708,6 @@ void wxListBox::DoSetSelection( int n, bool select ) if ( n == wxNOT_FOUND ) { gtk_tree_selection_unselect_all(selection); - GTKEnableEvents(); return; } @@ -730,14 +722,10 @@ void wxListBox::DoSetSelection( int n, bool select ) else gtk_tree_selection_unselect_iter(selection, &iter); - GtkTreePath* path = gtk_tree_model_get_path( - GTK_TREE_MODEL(m_liststore), &iter); + wxGtkTreePath path( + gtk_tree_model_get_path(GTK_TREE_MODEL(m_liststore), &iter)); gtk_tree_view_scroll_to_cell(m_treeview, path, NULL, FALSE, 0.0f, 0.0f); - - gtk_tree_path_free(path); - - GTKEnableEvents(); } void wxListBox::DoScrollToCell(int n, float alignY, float alignX) @@ -753,14 +741,12 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX) if ( !GTKGetIteratorFor(n, &iter) ) return; - GtkTreePath* path = gtk_tree_model_get_path( - GTK_TREE_MODEL(m_liststore), &iter); + wxGtkTreePath path( + gtk_tree_model_get_path(GTK_TREE_MODEL(m_liststore), &iter)); // Scroll to the desired cell (0.0 == topleft alignment) gtk_tree_view_scroll_to_cell(m_treeview, path, NULL, TRUE, alignY, alignX); - - gtk_tree_path_free(path); } void wxListBox::DoSetFirstItem(int n) @@ -773,6 +759,22 @@ void wxListBox::EnsureVisible(int n) DoScrollToCell(n, 0.5, 0); } +int wxListBox::GetTopItem() const +{ + int idx = wxNOT_FOUND; + + wxGtkTreePath start; + if ( gtk_tree_view_get_visible_range(m_treeview, start.ByRef(), NULL) ) + { + gint *ptr = gtk_tree_path_get_indices(start); + + if ( ptr ) + idx = *ptr; + } + + return idx; +} + // ---------------------------------------------------------------------------- // hittest // ---------------------------------------------------------------------------- @@ -789,13 +791,13 @@ int wxListBox::DoListHitTest(const wxPoint& point) const gdk_window_get_geometry(gtk_tree_view_get_bin_window(m_treeview), &binx, &biny, NULL, NULL); - GtkTreePath* path; + wxGtkTreePath path; if ( !gtk_tree_view_get_path_at_pos ( m_treeview, point.x - binx, point.y - biny, - &path, + path.ByRef(), NULL, // [out] column (always 0 here) NULL, // [out] x-coord relative to the cell (not interested) NULL // [out] y-coord relative to the cell @@ -804,10 +806,7 @@ int wxListBox::DoListHitTest(const wxPoint& point) const return wxNOT_FOUND; } - int index = gtk_tree_path_get_indices(path)[0]; - gtk_tree_path_free(path); - - return index; + return gtk_tree_path_get_indices(path)[0]; } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/gtk/mdi.cpp b/Externals/wxWidgets3/src/gtk/mdi.cpp index 3454d4f90b..4437030362 100644 --- a/Externals/wxWidgets3/src/gtk/mdi.cpp +++ b/Externals/wxWidgets3/src/gtk/mdi.cpp @@ -76,7 +76,7 @@ switch_page(GtkNotebook* widget, GtkNotebookPage*, guint page_num, wxMDIParentFr // wxMDIParentFrame //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame); void wxMDIParentFrame::Init() { @@ -256,12 +256,12 @@ void wxMDIParentFrame::ActivatePrevious() // wxMDIChildFrame //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame); -BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) EVT_ACTIVATE(wxMDIChildFrame::OnActivate) EVT_MENU_HIGHLIGHT_ALL(wxMDIChildFrame::OnMenuHighlight) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxMDIChildFrame::Init() { @@ -375,7 +375,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title ) // wxMDIClientWindow //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow); wxMDIClientWindow::~wxMDIClientWindow() { diff --git a/Externals/wxWidgets3/src/gtk/menu.cpp b/Externals/wxWidgets3/src/gtk/menu.cpp index f5194b89f0..7a5d008ab1 100644 --- a/Externals/wxWidgets3/src/gtk/menu.cpp +++ b/Externals/wxWidgets3/src/gtk/menu.cpp @@ -36,12 +36,6 @@ extern int wxOpenModalDialogsCount; // we use normal item but with a special id for the menu title static const int wxGTK_TITLE_ID = -3; -// forward declare it as it's used by wxMenuBar too when using Hildon -extern "C" -{ - static void menuitem_activate(GtkWidget*, wxMenuItem* item); -} - #if wxUSE_ACCEL static void wxGetGtkAccel(const wxMenuItem*, guint*, GdkModifierType*); #endif @@ -74,16 +68,37 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event) if ( !IsMenuEventAllowed(menu) ) return; - event.SetEventObject( menu ); + wxMenu::ProcessMenuEvent(menu, event, menu->GetWindow()); +} - wxEvtHandler* handler = menu->GetEventHandler(); - if (handler && handler->SafelyProcessEvent(event)) - return; +// Return the top level menu containing this menu (possibly this menu itself). +static wxMenu* GetRootParentMenu(wxMenu* menu) +{ + while ( menu->GetParent() ) + menu = menu->GetParent(); - wxWindow *win = menu->GetWindow(); - wxCHECK_RET( win, "event for a menu without associated window?" ); + return menu; +} - win->HandleWindowEvent( event ); +// Call SetGtkLabel() to update the labels of all the items in this items sub +// menu, recursively. +static void UpdateSubMenuItemLabels(wxMenuItem* itemMenu) +{ + wxMenu* const menu = itemMenu->GetSubMenu(); + wxCHECK_RET( menu, "should only be called for sub menus" ); + + const wxMenuItemList& items = menu->GetMenuItems(); + for ( wxMenuItemList::const_iterator + it = items.begin(); it != items.end(); ++it ) + { + wxMenuItem* const item = *it; + if ( !item->IsSeparator() ) + { + item->SetGtkLabel(); + if ( item->IsSubMenu() ) + UpdateSubMenuItemLabels(item); + } + } } //----------------------------------------------------------------------------- @@ -96,12 +111,6 @@ wxMenuBar::~wxMenuBar() void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style) { -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // Hildon window uses a single menu instead of a menu bar, so wxMenuBar is - // the same as menu in this case - m_widget = - m_menubar = gtk_menu_new(); -#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) || !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) { @@ -123,7 +132,6 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st } PostCreation(); -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 g_object_ref_sink(m_widget); @@ -157,10 +165,8 @@ namespace void EnsureNoGrab(GtkWidget* widget) { -#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 gtk_widget_hide(widget); gtk_grab_remove(widget); -#endif // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 } void @@ -292,30 +298,6 @@ void wxMenuBar::GtkAppend(wxMenu* menu, const wxString& title, int pos) { menu->SetLayoutDirection(GetLayoutDirection()); -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // if the menu has only one item, append it directly to the top level menu - // instead of inserting a useless submenu - if ( menu->GetMenuItemCount() == 1 ) - { - wxMenuItem * const item = menu->FindItemByPosition(0); - - // remove both mnemonics and accelerator: neither is useful under Maemo - const wxString str(wxStripMenuCodes(item->GetItemLabel())); - - if ( item->IsSubMenu() ) - { - GtkAppend(item->GetSubMenu(), str, pos); - return; - } - - menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) ); - - g_signal_connect(menu->m_owner, "activate", - G_CALLBACK(menuitem_activate), item); - item->SetMenuItem(menu->m_owner); - } - else -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 { // This doesn't have much effect right now. menu->SetTitle( title ); @@ -658,7 +640,7 @@ void wxMenuItem::SetItemLabel( const wxString& str ) if (accel_key) { gtk_widget_remove_accelerator( - m_menuItem, m_parentMenu->m_accel, accel_key, accel_mods); + m_menuItem, GetRootParentMenu(m_parentMenu)->m_accel, accel_key, accel_mods); } } #endif // wxUSE_ACCEL @@ -679,7 +661,7 @@ void wxMenuItem::SetGtkLabel() if (accel_key) { gtk_widget_add_accelerator( - m_menuItem, "activate", m_parentMenu->m_accel, + m_menuItem, "activate", GetRootParentMenu(m_parentMenu)->m_accel, accel_key, accel_mods, GTK_ACCEL_VISIBLE); } #endif // wxUSE_ACCEL @@ -702,12 +684,16 @@ void wxMenuItem::Check( bool check ) if (check == m_isChecked) return; - wxMenuItemBase::Check( check ); - switch ( GetKind() ) { - case wxITEM_CHECK: case wxITEM_RADIO: + // It doesn't make sense to uncheck a radio item. + if ( !check ) + return; + + wxFALLTHROUGH; + case wxITEM_CHECK: + wxMenuItemBase::Check( check ); gtk_check_menu_item_set_active( (GtkCheckMenuItem*)m_menuItem, (gint)check ); break; @@ -824,7 +810,7 @@ wxMenu::~wxMenu() g_object_unref(m_accel); } -void wxMenu::SetLayoutDirection(const wxLayoutDirection dir) +void wxMenu::SetLayoutDirection(wxLayoutDirection dir) { if ( m_owner ) wxWindow::GTKSetLayout(m_owner, dir); @@ -931,6 +917,9 @@ void wxMenu::GtkAppend(wxMenuItem* mitem, int pos) if ( !mitem->IsSeparator() ) { mitem->SetGtkLabel(); + if ( mitem->IsSubMenu() ) + UpdateSubMenuItemLabels(mitem); + g_signal_connect (menuItem, "select", G_CALLBACK(menuitem_select), mitem); g_signal_connect (menuItem, "deselect", diff --git a/Externals/wxWidgets3/src/gtk/minifram.cpp b/Externals/wxWidgets3/src/gtk/minifram.cpp index 24c32acaa6..11e0e971c5 100644 --- a/Externals/wxWidgets3/src/gtk/minifram.cpp +++ b/Externals/wxWidgets3/src/gtk/minifram.cpp @@ -16,7 +16,6 @@ #ifndef WX_PRECOMP #include "wx/settings.h" #include "wx/dcclient.h" - #include "wx/image.h" #endif #ifdef __WXGTK3__ @@ -27,6 +26,7 @@ #include #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/gtk3-compat.h" //----------------------------------------------------------------------------- // data @@ -39,28 +39,6 @@ extern bool g_blockEventsOnScroll; // "expose_event" of m_mainWidget //----------------------------------------------------------------------------- -// StepColour() it a utility function that simply darkens -// or lightens a color, based on the specified percentage -static wxColor StepColour(const wxColor& c, int percent) -{ - int r = c.Red(), g = c.Green(), b = c.Blue(); - return wxColour((unsigned char)wxMin((r*percent)/100,255), - (unsigned char)wxMin((g*percent)/100,255), - (unsigned char)wxMin((b*percent)/100,255)); -} - -static wxColor LightContrastColour(const wxColour& c) -{ - int amount = 120; - - // if the color is especially dark, then - // make the contrast even lighter - if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128) - amount = 160; - - return StepColour(c, amount); -} - extern "C" { #ifdef __WXGTK3__ static gboolean draw(GtkWidget* widget, cairo_t* cr, wxMiniFrame* win) @@ -78,7 +56,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin gtk_render_frame(sc, cr, 0, 0, win->m_width, win->m_height); gtk_style_context_restore(sc); - wxGTKCairoDC dc(cr); + wxGTKCairoDC dc(cr, win); #else if (gdk_event->count > 0 || gdk_event->window != gtk_widget_get_window(widget)) @@ -114,7 +92,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin { dc.SetFont( *wxSMALL_FONT ); - wxBrush brush( LightContrastColour( wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT) ) ); + wxBrush brush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); dc.SetBrush( brush ); dc.SetPen( *wxTRANSPARENT_PEN ); dc.DrawRectangle( win->m_miniEdge-1, @@ -122,11 +100,15 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin win->m_width - (2*(win->m_miniEdge-1)), 15 ); - dc.SetTextForeground( *wxWHITE ); + const wxColour textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + dc.SetTextForeground(textColor); dc.DrawText( win->GetTitle(), 6, 4 ); if (style & wxCLOSE_BOX) + { + dc.SetTextBackground(textColor); dc.DrawBitmap( win->m_closeButton, win->m_width-18, 3, true ); + } } return false; @@ -243,8 +225,6 @@ gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, 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; - win->m_y = y; gtk_window_move( GTK_WINDOW(win->m_widget), x, y ); return TRUE; @@ -300,11 +280,22 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, { if (win->GetWindowStyle() & wxRESIZE_BORDER) { + GdkCursor* cursor = NULL; + GdkWindow* window = gtk_widget_get_window(widget); if ((x > win->m_width-14) && (y > win->m_height-14)) - gdk_window_set_cursor(gtk_widget_get_window(widget), gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER)); - else - gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); - win->GTKUpdateCursor(false); + { + GdkDisplay* display = gdk_window_get_display(window); + cursor = gdk_cursor_new_for_display(display, GDK_BOTTOM_RIGHT_CORNER); + } + gdk_window_set_cursor(window, cursor); + if (cursor) + { +#ifdef __WXGTK3__ + g_object_unref(cursor); +#else + gdk_cursor_unref(cursor); +#endif + } } return TRUE; } @@ -317,8 +308,6 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, 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; - win->m_y = y; gtk_window_move( GTK_WINDOW(win->m_widget), x, y ); return TRUE; @@ -335,7 +324,7 @@ static unsigned char close_bits[]={ 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame,wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame); wxMiniFrame::~wxMiniFrame() { @@ -381,6 +370,17 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); gtk_widget_show(eventbox); +#ifdef __WXGTK3__ + g_object_ref(m_mainWidget); + gtk_container_remove(GTK_CONTAINER(m_widget), m_mainWidget); + gtk_container_add(GTK_CONTAINER(eventbox), m_mainWidget); + g_object_unref(m_mainWidget); + + gtk_widget_set_margin_start(m_mainWidget, m_miniEdge); + gtk_widget_set_margin_end(m_mainWidget, m_miniEdge); + gtk_widget_set_margin_top(m_mainWidget, m_miniTitle + m_miniEdge); + gtk_widget_set_margin_bottom(m_mainWidget, m_miniEdge); +#else // Use a GtkAlignment to position m_mainWidget inside the decorations GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), @@ -389,6 +389,7 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title // The GtkEventBox and GtkAlignment go between m_widget and m_mainWidget gtk_widget_reparent(m_mainWidget, alignment); gtk_container_add(GTK_CONTAINER(eventbox), alignment); +#endif gtk_container_add(GTK_CONTAINER(m_widget), eventbox); m_gdkDecor = 0; @@ -407,10 +408,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title if (m_miniTitle && (style & wxCLOSE_BOX)) { - wxImage img = wxBitmap((const char*)close_bits, 16, 16).ConvertToImage(); - img.Replace(0,0,0,123,123,123); - img.SetMaskColour(123,123,123); - m_closeButton = wxBitmap( img ); + m_closeButton = wxBitmap((const char*)close_bits, 16, 16); + m_closeButton.SetMask(new wxMask(m_closeButton)); } /* these are called when the borders are drawn */ diff --git a/Externals/wxWidgets3/src/gtk/msgdlg.cpp b/Externals/wxWidgets3/src/gtk/msgdlg.cpp index 8bc0dae840..e9de535947 100644 --- a/Externals/wxWidgets3/src/gtk/msgdlg.cpp +++ b/Externals/wxWidgets3/src/gtk/msgdlg.cpp @@ -31,15 +31,7 @@ #include "wx/gtk/private/mnemonics.h" #include "wx/gtk/private/dialogcount.h" -#if wxUSE_LIBHILDON - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 - #include -#endif // wxUSE_LIBHILDON2 - -IMPLEMENT_CLASS(wxMessageDialog, wxDialog) +wxIMPLEMENT_CLASS(wxMessageDialog, wxDialog); wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, @@ -48,7 +40,7 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxPoint& WXUNUSED(pos)) : wxMessageDialogBase ( - GetParentForModalDialog(parent, style), + parent, message, caption, style @@ -99,43 +91,6 @@ void wxMessageDialog::GTKCreateMsgDialog() { GtkWindow * const parent = m_parent ? GTK_WINDOW(m_parent->m_widget) : NULL; -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - const char *stockIcon = ""; - - switch ( GetEffectiveIcon() ) - { - case wxICON_ERROR: - stockIcon = "qgn_note_gene_syserror"; - break; - - case wxICON_WARNING: - stockIcon = "qgn_note_gene_syswarning"; - break; - - case wxICON_QUESTION: - stockIcon = "qgn_note_confirm"; - break; - - case wxICON_INFORMATION: - stockIcon = "qgn_note_info"; - break; - } - - // there is no generic note creation function in public API so we have no - // choice but to use g_object_new() directly - m_widget = (GtkWidget *)g_object_new - ( - HILDON_TYPE_NOTE, -#if wxUSE_LIBHILDON - "note_type", HILDON_NOTE_CONFIRMATION_BUTTON_TYPE, -#else // wxUSE_LIBHILDON - "note_type", HILDON_NOTE_TYPE_CONFIRMATION_BUTTON, -#endif // wxUSE_LIBHILDON /wxUSE_LIBHILDON2 - "description", (const char *)GetFullMessage().utf8_str(), - "icon", stockIcon, - NULL - ); -#else // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 GtkMessageType type = GTK_MESSAGE_ERROR; GtkButtonsType buttons = GTK_BUTTONS_NONE; @@ -195,7 +150,6 @@ void wxMessageDialog::GTKCreateMsgDialog() (const char *)wxGTK_CONV(m_extendedMessage) ); } -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 g_object_ref(m_widget); @@ -210,14 +164,8 @@ void wxMessageDialog::GTKCreateMsgDialog() } // we need to add buttons manually if we use custom labels or always for - // Yes/No/Cancel dialog as GTK+ doesn't support it natively and when using - // Hildon we add all the buttons manually as it doesn't support too many of - // the combinations we may have -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - static const bool addButtons = true; -#else // !wxUSE_LIBHILDON + // Yes/No/Cancel dialog as GTK+ doesn't support it natively const bool addButtons = buttons == GTK_BUTTONS_NONE; -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON if ( addButtons ) @@ -277,12 +225,6 @@ int wxMessageDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); - // break the mouse capture as it would interfere with modal dialog (see - // wxDialog::ShowModal) - wxWindow * const win = wxWindow::GetCapture(); - if ( win ) - win->GTKReleaseMouseAndNotify(); - if ( !m_widget ) { GTKCreateMsgDialog(); @@ -290,6 +232,10 @@ int wxMessageDialog::ShowModal() wxT("failed to create GtkMessageDialog") ); } + // break the mouse capture as it would interfere with modal dialog (see + // wxDialog::ShowModal) + GTKReleaseMouseAndNotify(); + // This should be necessary, but otherwise the // parent TLW will disappear.. if (m_parent) diff --git a/Externals/wxWidgets3/src/gtk/nativewin.cpp b/Externals/wxWidgets3/src/gtk/nativewin.cpp index c40ed6d0d5..11f266c0a4 100644 --- a/Externals/wxWidgets3/src/gtk/nativewin.cpp +++ b/Externals/wxWidgets3/src/gtk/nativewin.cpp @@ -38,6 +38,48 @@ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxNativeWindow +// ---------------------------------------------------------------------------- + +bool +wxNativeWindow::Create(wxWindow* parent, + wxWindowID winid, + wxNativeWindowHandle widget) +{ + wxCHECK_MSG( widget, false, wxS("Invalid null GtkWidget") ); + + // Standard wxGTK controls use PreCreation() but we never have any size + // specified at this stage, so don't bother with it. + if ( !CreateBase(parent, winid) ) + return false; + + // Add a reference to the widget to match g_object_unref() in wxWindow dtor. + m_widget = widget; + g_object_ref(m_widget); + + parent->DoAddChild(this); + + PostCreation(); + + // Ensure that the best (and minimal) size is set to fully display the + // widget. + GtkRequisition req; + gtk_widget_get_preferred_size(widget, NULL, &req); + SetInitialSize(wxSize(req.width, req.height)); + + return true; +} + +void wxNativeWindow::DoDisown() +{ + g_object_unref(m_widget); +} + +// ---------------------------------------------------------------------------- +// wxNativeContainerWindow +// ---------------------------------------------------------------------------- + // TODO: we probably need equivalent code for other GDK platforms #ifdef GDK_WINDOWING_X11 diff --git a/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp b/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp index 2bd4cb9938..b23a76a0a1 100644 --- a/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp +++ b/Externals/wxWidgets3/src/gtk/nonownedwnd.cpp @@ -89,10 +89,10 @@ public: { } - virtual bool CanBeDeleted() const { return true; } + virtual bool CanBeDeleted() const wxOVERRIDE { return true; } private: - virtual bool DoSetShape(GdkWindow* window) + virtual bool DoSetShape(GdkWindow* window) wxOVERRIDE { gdk_window_shape_combine_region(window, NULL, 0, 0); @@ -110,10 +110,10 @@ public: { } - virtual bool CanBeDeleted() const { return true; } + virtual bool CanBeDeleted() const wxOVERRIDE { return true; } private: - virtual bool DoSetShape(GdkWindow* window) + virtual bool DoSetShape(GdkWindow* window) wxOVERRIDE { gdk_window_shape_combine_region(window, m_region.GetRegion(), 0, 0); @@ -157,7 +157,7 @@ public: // 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; } + virtual bool CanBeDeleted() const wxOVERRIDE { return false; } private: wxBitmap CreateShapeBitmap(const wxGraphicsPath& path) @@ -185,7 +185,7 @@ private: return bmp; } - virtual bool DoSetShape(GdkWindow *window) + virtual bool DoSetShape(GdkWindow *window) wxOVERRIDE { if (!m_mask) return false; diff --git a/Externals/wxWidgets3/src/gtk/notebook.cpp b/Externals/wxWidgets3/src/gtk/notebook.cpp index 71ebdcf3a9..8f75c84c25 100644 --- a/Externals/wxWidgets3/src/gtk/notebook.cpp +++ b/Externals/wxWidgets3/src/gtk/notebook.cpp @@ -127,9 +127,9 @@ void wxNotebook::AddChildGTK(wxWindowGTK* child) // wxNotebook //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxNotebook::Init() { @@ -429,7 +429,9 @@ bool wxNotebook::InsertPage( size_t position, pageData->m_imageIndex = imageId; pageData->m_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); +#ifndef __WXGTK3__ gtk_container_set_border_width(GTK_CONTAINER(pageData->m_box), 2); +#endif pageData->m_image = NULL; if (imageId != -1) @@ -594,7 +596,9 @@ GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const { windows.push_back(gtk_widget_get_window(m_widget)); #ifdef __WXGTK3__ - // no access to internal GdkWindows + GdkWindow* window = GTKFindWindow(m_widget); + if (window) + windows.push_back(window); #else windows.push_back(GTK_NOTEBOOK(m_widget)->event_window); #endif diff --git a/Externals/wxWidgets3/src/gtk/notifmsg.cpp b/Externals/wxWidgets3/src/gtk/notifmsg.cpp index 20bc1884ba..095c21465a 100644 --- a/Externals/wxWidgets3/src/gtk/notifmsg.cpp +++ b/Externals/wxWidgets3/src/gtk/notifmsg.cpp @@ -28,11 +28,14 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/icon.h" #endif // WX_PRECOMP #include #include "wx/module.h" +#include "wx/private/notifmsg.h" +#include // General note about error handling: as notifications are meant to be // non-intrusive, we use wxLogDebug() and not wxLogError() if anything goes @@ -48,13 +51,13 @@ class wxLibnotifyModule : public wxModule { public: - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { // We're initialized on demand. return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { if ( notify_is_initted() ) notify_uninit(); @@ -82,136 +85,290 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxLibnotifyModule, wxModule); // wxNotificationMessage implementation // ============================================================================ -bool wxNotificationMessage::GTKSetIconName(const wxString& name) -{ - m_iconName = name; +class wxLibNotifyMsgImpl; - return true; +void wxLibNotifyMsgImplActionCallback(NotifyNotification *notification, + char *action, + gpointer user_data); + +extern "C" { +static gboolean closed_notification(NotifyNotification *notification, + const char* WXUNUSED(data), void* user_data); } -bool wxNotificationMessage::Show(int timeout) +class wxLibNotifyMsgImpl : public wxNotificationMessageImpl { - if ( !wxLibnotifyModule::Initialize() ) - return false; - - // Determine the GTK+ icon to use from flags and also set the urgency - // appropriately. - const char* icon; - NotifyUrgency urgency; - switch ( GetFlags() ) +public: + wxLibNotifyMsgImpl(wxNotificationMessageBase* notification) : + wxNotificationMessageImpl(notification), + m_notification(NULL), + m_flags(wxICON_INFORMATION) { - case wxICON_INFORMATION: - icon = "dialog-information"; - urgency = NOTIFY_URGENCY_LOW; - break; + if ( !wxLibnotifyModule::Initialize() ) + wxLogError(_("Could not initalize libnotify.")); - case wxICON_WARNING: - icon = "dialog-warning"; - urgency = NOTIFY_URGENCY_NORMAL; - break; + } - case wxICON_ERROR: - icon = "dialog-error"; - urgency = NOTIFY_URGENCY_CRITICAL; - break; + virtual ~wxLibNotifyMsgImpl() + { + if ( m_notification ) + g_object_unref(m_notification); + } - default: - wxFAIL_MSG( "Unknown notification message flags." ); + bool CreateOrUpdateNotification() + { + if ( !wxLibnotifyModule::Initialize() ) return false; - } - // Explicitly specified icon name overrides the implicit one determined by - // the flags. - wxScopedCharBuffer buf; - if ( !m_iconName.empty() ) - { - buf = m_iconName.utf8_str(); - icon = buf; - } + // Determine the GTK+ icon to use from flags and also set the urgency + // appropriately. + const char* icon; + switch ( m_flags ) + { + case wxICON_INFORMATION: + icon = "dialog-information"; + break; - // Create the notification or update an existing one if we had already been - // shown before. - if ( !m_notification ) - { - m_notification = notify_notification_new - ( - GetTitle().utf8_str(), - GetMessage().utf8_str(), - icon -#if !wxUSE_LIBNOTIFY_0_7 - // There used to be an "associated window" - // parameter in this function but it has - // disappeared by 0.7, so use it for previous - // versions only. - , 0 -#endif // libnotify < 0.7 - ); + case wxICON_WARNING: + icon = "dialog-warning"; + break; + + case wxICON_ERROR: + icon = "dialog-error"; + break; + + default: + wxFAIL_MSG( "Unknown notification message flags." ); + return false; + } + + // Create the notification or update an existing one if we had already been + // shown before. if ( !m_notification ) { - wxLogDebug("Failed to creation notification."); + m_notification = notify_notification_new + ( + m_title.utf8_str(), + m_message.utf8_str(), + icon +#if !wxUSE_LIBNOTIFY_0_7 + // There used to be an "associated window" + // parameter in this function but it has + // disappeared by 0.7, so use it for previous + // versions only. + , 0 +#endif // libnotify < 0.7 + ); + if ( !m_notification ) + { + wxLogDebug("Failed to creation notification."); + + return false; + } + + + g_signal_connect(m_notification, "closed", G_CALLBACK(closed_notification), this); + + } + else + { + if ( !notify_notification_update + ( + m_notification, + m_title.utf8_str(), + m_message.utf8_str(), + icon + ) ) + { + wxLogDebug(wxS("notify_notification_update() unexpectedly failed.")); + } + } + + // Explicitly specified icon name overrides the implicit one determined by + // the flags. + if ( m_icon.IsOk() ) + { +#ifdef __WXGTK3__ + notify_notification_set_image_from_pixbuf( + m_notification, + m_icon.GetPixbufNoMask() + ); +#endif + } + + return true; + } + + virtual bool Show(int timeout) wxOVERRIDE + { + if ( !CreateOrUpdateNotification() ) + return false; + + // Set the notification parameters not specified during creation. + notify_notification_set_timeout + ( + m_notification, + timeout == wxNotificationMessage::Timeout_Auto ? NOTIFY_EXPIRES_DEFAULT + : timeout == wxNotificationMessage::Timeout_Never ? NOTIFY_EXPIRES_NEVER + : 1000*timeout + ); + + NotifyUrgency urgency; + switch ( m_flags ) + { + case wxICON_INFORMATION: + urgency = NOTIFY_URGENCY_LOW; + break; + + case wxICON_WARNING: + urgency = NOTIFY_URGENCY_NORMAL; + break; + + case wxICON_ERROR: + urgency = NOTIFY_URGENCY_CRITICAL; + break; + + default: + wxFAIL_MSG( "Unknown notification message flags." ); + return false; + } + notify_notification_set_urgency(m_notification, urgency); + + + // Finally do show the notification. + wxGtkError error; + if ( !notify_notification_show(m_notification, error.Out()) ) + { + wxLogDebug("Failed to shown notification: %s", error.GetMessage()); return false; } + + return true; } - else + + virtual bool Close() wxOVERRIDE { - if ( !notify_notification_update - ( - m_notification, - GetTitle().utf8_str(), - GetMessage().utf8_str(), - icon - ) ) + wxCHECK_MSG( m_notification, false, + wxS("Can't close not shown notification.") ); + + wxGtkError error; + if ( !notify_notification_close(m_notification, error.Out()) ) { - wxLogDebug(wxS("notify_notification_update() unexpectedly failed.")); + wxLogDebug("Failed to hide notification: %s", error.GetMessage()); + + return false; } + + return true; } - - // Set the notification parameters not specified during creation. - notify_notification_set_timeout - ( - m_notification, - timeout == Timeout_Auto ? NOTIFY_EXPIRES_DEFAULT - : timeout == Timeout_Never ? NOTIFY_EXPIRES_NEVER - : 1000*timeout - ); - - notify_notification_set_urgency(m_notification, urgency); - - - // Finally do show the notification. - wxGtkError error; - if ( !notify_notification_show(m_notification, error.Out()) ) + virtual void SetTitle(const wxString& title) wxOVERRIDE { - wxLogDebug("Failed to shown notification: %s", error.GetMessage()); - - return false; + m_title = title; } - return true; + virtual void SetMessage(const wxString& message) wxOVERRIDE + { + m_message = message; + } + + virtual void SetParent(wxWindow *WXUNUSED(parent)) wxOVERRIDE + { + } + + virtual void SetFlags(int flags) wxOVERRIDE + { + m_flags = flags; + } + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE + { + m_icon = icon; + CreateOrUpdateNotification(); + } + + virtual bool AddAction(wxWindowID actionid, const wxString &label) wxOVERRIDE + { + if ( !CreateOrUpdateNotification() ) + return false; + + wxString labelStr = label; + if ( labelStr.empty() ) + labelStr = wxGetStockLabel(actionid, wxSTOCK_NOFLAGS); + + notify_notification_add_action + ( + m_notification, + wxString::Format("%d", actionid).utf8_str(), + labelStr.utf8_str(), + &wxLibNotifyMsgImplActionCallback, + this, + NULL + ); + + return true; + } + + void NotifyClose(int closeReason) + { + // Values according to the OpenDesktop specification at: + // https://developer.gnome.org/notification-spec/ + + switch (closeReason) + { + case 1: // Expired + case 2: // The notification was dismissed by the user. + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + ProcessNotificationEvent(evt); + break; + } + } + + } + + void NotifyAction(wxWindowID actionid) + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_ACTION, actionid); + ProcessNotificationEvent(evt); + } + +private: + NotifyNotification* m_notification; + wxString m_title; + wxString m_message; + wxIcon m_icon; + int m_flags; +}; + +void wxLibNotifyMsgImplActionCallback(NotifyNotification *WXUNUSED(notification), + char *action, + gpointer user_data) +{ + wxLibNotifyMsgImpl* impl = (wxLibNotifyMsgImpl*) user_data; + + impl->NotifyAction(wxAtoi(action)); } -bool wxNotificationMessage::Close() +extern "C" { +static gboolean closed_notification(NotifyNotification *notification, + const char* WXUNUSED(data), void* user_data) { - wxCHECK_MSG( m_notification, false, - wxS("Can't close not shown notification.") ); - - wxGtkError error; - if ( !notify_notification_close(m_notification, error.Out()) ) - { - wxLogDebug("Failed to hide notification: %s", error.GetMessage()); - - return false; - } - + wxLibNotifyMsgImpl* impl = (wxLibNotifyMsgImpl*) user_data; + gint closeReason = notify_notification_get_closed_reason(notification); + impl->NotifyClose(closeReason); return true; } +} -wxNotificationMessage::~wxNotificationMessage() +// ---------------------------------------------------------------------------- +// wxNotificationMessage +// ---------------------------------------------------------------------------- + +void wxNotificationMessage::Init() { - if ( m_notification ) - g_object_unref(m_notification); + m_impl = new wxLibNotifyMsgImpl(this); } #endif // wxUSE_NOTIFICATION_MESSAGE && wxUSE_LIBNOTIFY diff --git a/Externals/wxWidgets3/src/gtk/pen.cpp b/Externals/wxWidgets3/src/gtk/pen.cpp index c08c36801c..c23c144c6b 100644 --- a/Externals/wxWidgets3/src/gtk/pen.cpp +++ b/Externals/wxWidgets3/src/gtk/pen.cpp @@ -85,7 +85,7 @@ public: #define M_PENDATA ((wxPenRefData *)m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style ) { @@ -95,7 +95,6 @@ wxPen::wxPen( const wxColour &colour, int width, wxPenStyle style ) M_PENDATA->m_colour = colour; } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxPen::wxPen(const wxColour& colour, int width, int style) { m_refData = new wxPenRefData(); @@ -103,7 +102,6 @@ wxPen::wxPen(const wxColour& colour, int width, int style) M_PENDATA->m_style = (wxPenStyle)style; M_PENDATA->m_colour = colour; } -#endif wxPen::~wxPen() { diff --git a/Externals/wxWidgets3/src/gtk/popupwin.cpp b/Externals/wxWidgets3/src/gtk/popupwin.cpp index 08a85ea1a5..18ded2d935 100644 --- a/Externals/wxWidgets3/src/gtk/popupwin.cpp +++ b/Externals/wxWidgets3/src/gtk/popupwin.cpp @@ -77,9 +77,9 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED //----------------------------------------------------------------------------- #ifdef __WXUNIVERSAL__ -BEGIN_EVENT_TABLE(wxPopupWindow,wxPopupWindowBase) +wxBEGIN_EVENT_TABLE(wxPopupWindow,wxPopupWindowBase) EVT_SIZE(wxPopupWindow::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #endif wxPopupWindow::~wxPopupWindow() @@ -113,18 +113,7 @@ bool wxPopupWindow::Create( wxWindow *parent, int style ) { GtkWidget *toplevel = gtk_widget_get_toplevel( parent->m_widget ); if (GTK_IS_WINDOW (toplevel)) - { -#if GTK_CHECK_VERSION(2,10,0) -#ifndef __WXGTK3__ - if (!gtk_check_version(2,10,0)) -#endif - { - gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), GTK_WINDOW (m_widget)); - } -#endif gtk_window_set_transient_for (GTK_WINDOW (m_widget), GTK_WINDOW (toplevel)); - } - gtk_window_set_screen (GTK_WINDOW (m_widget), gtk_widget_get_screen (GTK_WIDGET (parent->m_widget))); } gtk_window_set_resizable (GTK_WINDOW (m_widget), FALSE); @@ -176,12 +165,12 @@ void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlag ConstrainSize(); - if ((m_x != -1) || (m_y != -1)) + if (m_x != old_x || m_y != old_y) { - if ((m_x != old_x) || (m_y != old_y)) - { - gtk_window_move( GTK_WINDOW(m_widget), m_x, m_y ); - } + gtk_window_move(GTK_WINDOW(m_widget), m_x, m_y); + wxMoveEvent event(wxPoint(m_x, m_y), GetId()); + event.SetEventObject(this); + HandleWindowEvent(event); } if ((m_width != old_width) || (m_height != old_height)) diff --git a/Externals/wxWidgets3/src/gtk/print.cpp b/Externals/wxWidgets3/src/gtk/print.cpp index a7f75959e2..8616243e60 100644 --- a/Externals/wxWidgets3/src/gtk/print.cpp +++ b/Externals/wxWidgets3/src/gtk/print.cpp @@ -32,7 +32,6 @@ #include "wx/fontutil.h" #include "wx/dynlib.h" #include "wx/paper.h" -#include "wx/scopeguard.h" #include "wx/modalhook.h" #include @@ -43,20 +42,185 @@ #include #endif - -#if wxUSE_GRAPHICS_CONTEXT -#include "wx/graphics.h" -#endif - #include "wx/link.h" wxFORCE_LINK_THIS_MODULE(gtk_print) #include "wx/gtk/private/object.h" -// Useful to convert angles from/to Rad to/from Deg. -static const double RAD2DEG = 180.0 / M_PI; +// Useful to convert angles from degrees to radians. static const double DEG2RAD = M_PI / 180.0; +// Map wxPaperSize to GtkPaperSize names +// Ordering must be the same as wxPaperSize enum +static const char* const gs_paperList[] = { + NULL, // wxPAPER_NONE + "na_letter", // wxPAPER_LETTER + "na_legal", // wxPAPER_LEGAL + "iso_a4", // wxPAPER_A4 + "na_c", // wxPAPER_CSHEET + "na_d", // wxPAPER_DSHEET + "na_e", // wxPAPER_ESHEET + "na_letter", // wxPAPER_LETTERSMALL + "na_ledger", // wxPAPER_TABLOID + "na_ledger", // wxPAPER_LEDGER + "na_invoice", // wxPAPER_STATEMENT + "na_executive", // wxPAPER_EXECUTIVE + "iso_a3", // wxPAPER_A3 + "iso_a4", // wxPAPER_A4SMALL + "iso_a5", // wxPAPER_A5 + "jis_b4", // wxPAPER_B4 "B4 (JIS) 257 x 364 mm" + "jis_b5", // wxPAPER_B5 "B5 (JIS) 182 x 257 mm" + "om_folio", // wxPAPER_FOLIO + "na_quarto", // wxPAPER_QUARTO + "na_10x14", // wxPAPER_10X14 + "na_ledger", // wxPAPER_11X17 + "na_letter", // wxPAPER_NOTE + "na_number-9", // wxPAPER_ENV_9 + "na_number-10", // wxPAPER_ENV_10 + "na_number-11", // wxPAPER_ENV_11 + "na_number-12", // wxPAPER_ENV_12 + "na_number-14", // wxPAPER_ENV_14 + "iso_dl", // wxPAPER_ENV_DL + "iso_c5", // wxPAPER_ENV_C5 + "iso_c3", // wxPAPER_ENV_C3 + "iso_c4", // wxPAPER_ENV_C4 + "iso_c6", // wxPAPER_ENV_C6 + "iso_c6c5", // wxPAPER_ENV_C65 + "iso_b4", // wxPAPER_ENV_B4 + "iso_b5", // wxPAPER_ENV_B5 + "iso_b6", // wxPAPER_ENV_B6 + "om_italian", // wxPAPER_ENV_ITALY + "na_monarch", // wxPAPER_ENV_MONARCH + "na_personal", // wxPAPER_ENV_PERSONAL + "na_fanfold-us", // wxPAPER_FANFOLD_US + "na_fanfold-eur", // wxPAPER_FANFOLD_STD_GERMAN + "na_foolscap", // wxPAPER_FANFOLD_LGL_GERMAN + "iso_b4", // wxPAPER_ISO_B4 + "jpn_hagaki", // wxPAPER_JAPANESE_POSTCARD + "na_9x11", // wxPAPER_9X11 + "na_10x11", // wxPAPER_10X11 + "na_11x15", // wxPAPER_15X11 + "om_invite", // wxPAPER_ENV_INVITE + "na_letter-extra", // wxPAPER_LETTER_EXTRA + "na_legal-extra", // wxPAPER_LEGAL_EXTRA + "na_arch-b", // wxPAPER_TABLOID_EXTRA + "iso_a4-extra", // wxPAPER_A4_EXTRA + "na_letter", // wxPAPER_LETTER_TRANSVERSE + "iso_a4", // wxPAPER_A4_TRANSVERSE + "na_letter-extra", // wxPAPER_LETTER_EXTRA_TRANSVERSE + "na_super-a", // wxPAPER_A_PLUS + "na_super-b", // wxPAPER_B_PLUS + "na_letter-plus", // wxPAPER_LETTER_PLUS + "om_folio", // wxPAPER_A4_PLUS "A4 Plus 210 x 330 mm" (no A4 Plus in PWG standard) + "iso_a5", // wxPAPER_A5_TRANSVERSE + "jis_b5", // wxPAPER_B5_TRANSVERSE "B5 (JIS) Transverse 182 x 257 mm" + "iso_a3-extra", // wxPAPER_A3_EXTRA + "iso_a5-extra", // wxPAPER_A5_EXTRA + "iso_b5-extra", // wxPAPER_B5_EXTRA + "iso_a2", // wxPAPER_A2 + "iso_a3", // wxPAPER_A3_TRANSVERSE + "iso_a3-extra", // wxPAPER_A3_EXTRA_TRANSVERSE + "jpn_oufuku", // wxPAPER_DBL_JAPANESE_POSTCARD + "iso_a6", // wxPAPER_A6 + "jpn_kaku2", // wxPAPER_JENV_KAKU2 + "jpn_kaku3_216x277mm", // wxPAPER_JENV_KAKU3 + "jpn_chou3", // wxPAPER_JENV_CHOU3 + "jpn_chou4", // wxPAPER_JENV_CHOU4 + "na_letter", // wxPAPER_LETTER_ROTATED + "iso_a3", // wxPAPER_A3_ROTATED + "iso_a4", // wxPAPER_A4_ROTATED + "iso_a5", // wxPAPER_A5_ROTATED + "jis_b4", // wxPAPER_B4_JIS_ROTATED + "jis_b5", // wxPAPER_B5_JIS_ROTATED + "jpn_hagaki", // wxPAPER_JAPANESE_POSTCARD_ROTATED + "jpn_oufuku", // wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED + "iso_a6", // wxPAPER_A6_ROTATED + "jpn_kaku2", // wxPAPER_JENV_KAKU2_ROTATED + "jpn_kaku3_216x277mm", // wxPAPER_JENV_KAKU3_ROTATED + "jpn_chou3", // wxPAPER_JENV_CHOU3_ROTATED + "jpn_chou4", // wxPAPER_JENV_CHOU4_ROTATED + "jis_b6", // wxPAPER_B6_JIS + "jis_b6", // wxPAPER_B6_JIS_ROTATED + "na_11x12", // wxPAPER_12X11 + "jpn_you4", // wxPAPER_JENV_YOU4 + "jpn_you4", // wxPAPER_JENV_YOU4_ROTATED + "prc_16k", // wxPAPER_P16K + "prc_32k", // wxPAPER_P32K + "prc_32k", // wxPAPER_P32KBIG + "prc_1", // wxPAPER_PENV_1 + "prc_2", // wxPAPER_PENV_2 + "prc_3", // wxPAPER_PENV_3 + "prc_4", // wxPAPER_PENV_4 + "prc_5", // wxPAPER_PENV_5 + "prc_6", // wxPAPER_PENV_6 + "prc_7", // wxPAPER_PENV_7 + "prc_8", // wxPAPER_PENV_8 + "prc_9", // wxPAPER_PENV_9 + "prc_10", // wxPAPER_PENV_10 + "prc_16k", // wxPAPER_P16K_ROTATED + "prc_32k", // wxPAPER_P32K_ROTATED + "prc_32k", // wxPAPER_P32KBIG_ROTATED + "prc_1", // wxPAPER_PENV_1_ROTATED + "prc_2", // wxPAPER_PENV_2_ROTATED + "prc_3", // wxPAPER_PENV_3_ROTATED + "prc_4", // wxPAPER_PENV_4_ROTATED + "prc_5", // wxPAPER_PENV_5_ROTATED + "prc_6", // wxPAPER_PENV_6_ROTATED + "prc_7", // wxPAPER_PENV_7_ROTATED + "prc_8", // wxPAPER_PENV_8_ROTATED + "prc_9", // wxPAPER_PENV_9_ROTATED + "prc_10", // wxPAPER_PENV_10_ROTATED + "iso_a0", // wxPAPER_A0 + "iso_a1" // wxPAPER_A1 +}; + +static GtkPaperSize* wxGetGtkPaperSize(wxPaperSize paperId, const wxSize& size) +{ + // if wxPaperSize is valid, get corresponding GtkPaperSize + if (paperId > 0 && size_t(paperId) < WXSIZEOF(gs_paperList)) + return gtk_paper_size_new(gs_paperList[paperId]); + + // if size is not valid, use a default GtkPaperSize + if (size.x < 1 || size.y < 1) + return gtk_paper_size_new(gtk_paper_size_get_default()); + +#if GTK_CHECK_VERSION(2,12,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,12,0) == NULL) +#endif + { + // look for a size match in GTK's GtkPaperSize list + const double w = size.x; + const double h = size.y; + GtkPaperSize* paperSize = NULL; + GList* list = gtk_paper_size_get_paper_sizes(true); + for (GList* p = list; p; p = p->next) + { + GtkPaperSize* paperSize2 = static_cast(p->data); + if (paperSize == NULL && + fabs(w - gtk_paper_size_get_width(paperSize2, GTK_UNIT_MM)) < 1 && + fabs(h - gtk_paper_size_get_height(paperSize2, GTK_UNIT_MM)) < 1) + { + paperSize = paperSize2; + } + else + gtk_paper_size_free(paperSize2); + } + g_list_free(list); + + if (paperSize) + return paperSize; + } +#endif // GTK >= 2.12 + + // last resort, use a custom GtkPaperSize + const wxString title = _("Custom size"); + char name[40]; + g_snprintf(name, sizeof(name), "custom_%ux%u", size.x, size.y); + return gtk_paper_size_new_custom( + name, title.utf8_str(), size.x, size.y, GTK_UNIT_MM); +} + //---------------------------------------------------------------------------- // wxGtkPrintModule // Initialized when starting the app : if it successfully load the gtk-print framework, @@ -69,11 +233,11 @@ public: wxGtkPrintModule() { } - bool OnInit(); - void OnExit() {} + bool OnInit() wxOVERRIDE; + void OnExit() wxOVERRIDE {} private: - DECLARE_DYNAMIC_CLASS(wxGtkPrintModule) + wxDECLARE_DYNAMIC_CLASS(wxGtkPrintModule); }; bool wxGtkPrintModule::OnInit() @@ -87,7 +251,7 @@ bool wxGtkPrintModule::OnInit() return true; } -IMPLEMENT_DYNAMIC_CLASS(wxGtkPrintModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGtkPrintModule, wxModule); //---------------------------------------------------------------------------- // wxGtkPrintFactory @@ -221,7 +385,7 @@ extern "C" // wxGtkPrintNativeData //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGtkPrintNativeData, wxPrintNativeDataBase) +wxIMPLEMENT_CLASS(wxGtkPrintNativeData, wxPrintNativeDataBase); wxGtkPrintNativeData::wxGtkPrintNativeData() { @@ -263,7 +427,7 @@ bool wxGtkPrintNativeData::TransferTo( wxPrintData &data ) data.SetNoCopies(gtk_print_settings_get_n_copies(m_config)); - data.SetColour(gtk_print_settings_get_use_color(m_config)); + data.SetColour(gtk_print_settings_get_use_color(m_config) != 0); switch (gtk_print_settings_get_duplex(m_config)) { @@ -300,98 +464,38 @@ bool wxGtkPrintNativeData::TransferTo( wxPrintData &data ) data.SetOrientationReversed(true); } - data.SetCollate(gtk_print_settings_get_collate (m_config)); + data.SetCollate(gtk_print_settings_get_collate(m_config) != 0); - // Paper formats : these are the most common paper formats. + wxPaperSize paperId = wxPAPER_NONE; GtkPaperSize *paper_size = gtk_print_settings_get_paper_size (m_config); - if (!paper_size) - data.SetPaperId(wxPAPER_NONE); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_A3))) - data.SetPaperId(wxPAPER_A3); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_A4))) - data.SetPaperId(wxPAPER_A4); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_A5))) - data.SetPaperId(wxPAPER_A5); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_B5))) - data.SetPaperId(wxPAPER_B5); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_LETTER))) - data.SetPaperId(wxPAPER_LETTER); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_LEGAL))) - data.SetPaperId(wxPAPER_LEGAL); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new (GTK_PAPER_NAME_EXECUTIVE))) - data.SetPaperId(wxPAPER_EXECUTIVE); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"na_number-10"))) - data.SetPaperId(wxPAPER_ENV_10); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-c5"))) - data.SetPaperId(wxPAPER_ENV_C5); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-c6"))) - data.SetPaperId(wxPAPER_ENV_C6); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"jis-b5"))) - data.SetPaperId(wxPAPER_B5_TRANSVERSE); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-b5"))) - data.SetPaperId(wxPAPER_ENV_B5); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"na_monarch"))) - data.SetPaperId(wxPAPER_ENV_MONARCH); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"engineering-c"))) - data.SetPaperId( wxPAPER_CSHEET); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"engineering-d"))) - data.SetPaperId( wxPAPER_DSHEET); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"engineering-e"))) - data.SetPaperId( wxPAPER_ESHEET); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"letter"))) - data.SetPaperId( wxPAPER_LETTERSMALL); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"engineering-b"))) - data.SetPaperId( wxPAPER_TABLOID); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"ledger"))) - data.SetPaperId( wxPAPER_LEDGER); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"statement"))) - data.SetPaperId( wxPAPER_STATEMENT); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( GTK_PAPER_NAME_A4 ))) - data.SetPaperId( wxPAPER_A4SMALL); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-b4"))) - data.SetPaperId( wxPAPER_B4); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"folio"))) - data.SetPaperId( wxPAPER_FOLIO); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"quarto"))) - data.SetPaperId( wxPAPER_QUARTO); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"10x14"))) - data.SetPaperId( wxPAPER_10X14); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"ledger"))) - data.SetPaperId( wxPAPER_11X17); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"letter"))) - data.SetPaperId( wxPAPER_NOTE); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"na-number-9-envelope"))) - data.SetPaperId( wxPAPER_ENV_9); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"number-11"))) - data.SetPaperId( wxPAPER_ENV_11); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"number-12"))) - data.SetPaperId( wxPAPER_ENV_12); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"number-14"))) - data.SetPaperId( wxPAPER_ENV_14); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-designated"))) - data.SetPaperId( wxPAPER_ENV_DL); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-c3"))) - data.SetPaperId( wxPAPER_ENV_C3); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-c4"))) - data.SetPaperId( wxPAPER_ENV_C4); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"c6/c5"))) - data.SetPaperId( wxPAPER_ENV_C65); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-b4"))) - data.SetPaperId( wxPAPER_ENV_B4); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"iso-b6"))) - data.SetPaperId( wxPAPER_ENV_B6); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"Italian"))) - data.SetPaperId( wxPAPER_ENV_ITALY); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"personal"))) - data.SetPaperId( wxPAPER_ENV_PERSONAL); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"fanfold-us"))) - data.SetPaperId( wxPAPER_FANFOLD_US); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"fanfold-European"))) - data.SetPaperId( wxPAPER_FANFOLD_STD_GERMAN); - else if (gtk_paper_size_is_equal(paper_size,gtk_paper_size_new ( (const gchar*)"foolscap"))) - data.SetPaperId( wxPAPER_FANFOLD_LGL_GERMAN); - else - data.SetPaperId(wxPAPER_NONE); + if (paper_size) + { + const char* name = gtk_paper_size_get_name(paper_size); + for (size_t i = 1; i < WXSIZEOF(gs_paperList); i++) + { + if (strcmp(name, gs_paperList[i]) == 0) + { + paperId = static_cast(i); + break; + } + } + if (paperId == wxPAPER_NONE) + { + // look for a size match in wxThePrintPaperDatabase + const wxSize size( + int(10 * gtk_paper_size_get_width(paper_size, GTK_UNIT_MM)), + int(10 * gtk_paper_size_get_height(paper_size, GTK_UNIT_MM))); + + paperId = wxThePrintPaperDatabase->GetSize(size); + + // if no match, set custom size + if (paperId == wxPAPER_NONE) + data.SetPaperSize(size); + } + + gtk_paper_size_free(paper_size); + } + data.SetPaperId(paperId); data.SetPrinterName(gtk_print_settings_get_printer(m_config)); @@ -452,96 +556,9 @@ bool wxGtkPrintNativeData::TransferFrom( const wxPrintData &data ) gtk_print_settings_set_collate (m_config, data.GetCollate()); - // Paper formats: these are the most common paper formats. - switch (data.GetPaperId()) - { - case wxPAPER_A3: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_A3)); - break; - case wxPAPER_A4: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_A4)); - break; - case wxPAPER_A5: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_A5)); - break; - case wxPAPER_B5_TRANSVERSE: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "jis-b5")); - break; - case wxPAPER_B5: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_B5)); - break; - case wxPAPER_LETTER: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_LETTER)); - break; - case wxPAPER_LEGAL: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_LEGAL)); - break; - case wxPAPER_EXECUTIVE: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_EXECUTIVE)); - break; - case wxPAPER_ENV_10: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "na_number-10")); - break; - case wxPAPER_ENV_C5: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-c5")); - break; - case wxPAPER_ENV_C6: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-c6")); - break; - case wxPAPER_ENV_B5: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-c5b5")); - break; - case wxPAPER_ENV_MONARCH: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "na_monarch")); - break; - case wxPAPER_CSHEET: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "engineering-c")); - break; - case wxPAPER_DSHEET: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "engineering-d")); - break; - case wxPAPER_ESHEET: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "engineering-e")); - break; - case wxPAPER_LETTERSMALL: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "letter")); - break; - case wxPAPER_TABLOID: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "engineering-b")); - break; - case wxPAPER_LEDGER: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "ledger")); - break; - case wxPAPER_STATEMENT: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "statement")); - break; - case wxPAPER_A4SMALL: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new (GTK_PAPER_NAME_A4)); - break; - case wxPAPER_B4: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-b4")); - break; - case wxPAPER_FOLIO: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "folio")); - break; - case wxPAPER_QUARTO: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "quarto")); - break; - case wxPAPER_10X14: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "10x14")); - break; - case wxPAPER_11X17: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "ledger")); - break; - case wxPAPER_NOTE: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "letter")); - break; - case wxPAPER_ENV_9: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "na-number-9-envelope")); - break; - case wxPAPER_ENV_11: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "number-11")); - break; - case wxPAPER_ENV_12: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "number-12")); - break; - case wxPAPER_ENV_14: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "number-14")); - break; - case wxPAPER_ENV_DL: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-designated")); - break; - case wxPAPER_ENV_C3: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-c3")); - break; - case wxPAPER_ENV_C4: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-c4")); - break; - case wxPAPER_ENV_C65: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "c6/c5")); - break; - case wxPAPER_ENV_B4: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-b4")); - break; - case wxPAPER_ENV_B6: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "iso-b6")); - break; - case wxPAPER_ENV_ITALY: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "Italian")); - break; - case wxPAPER_ENV_PERSONAL: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "personal")); - break; - case wxPAPER_FANFOLD_US: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "fanfold-us")); - break; - case wxPAPER_FANFOLD_STD_GERMAN: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "fanfold-European")); - break; - case wxPAPER_FANFOLD_LGL_GERMAN: gtk_print_settings_set_paper_size(m_config, gtk_paper_size_new ((const gchar*) "foolscap")); - break; - case wxPAPER_NONE: - default: break; - } + GtkPaperSize* paperSize = wxGetGtkPaperSize(data.GetPaperId(), data.GetPaperSize()); + gtk_print_settings_set_paper_size(m_config, paperSize); + gtk_paper_size_free(paperSize); gtk_print_settings_set_printer(m_config, data.GetPrinterName().utf8_str()); @@ -562,7 +579,10 @@ GtkPageSetup* wxGtkPrintNativeData::GetPageSetupFromSettings(GtkPrintSettings* s GtkPaperSize *paper_size = gtk_print_settings_get_paper_size (settings); if (paper_size != NULL) + { gtk_page_setup_set_paper_size_and_default_margins (page_setup, paper_size); + gtk_paper_size_free(paper_size); + } return page_setup; } @@ -578,7 +598,7 @@ void wxGtkPrintNativeData::SetPageSetupToSettings(GtkPrintSettings* settings, Gt // wxGtkPrintDialog //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGtkPrintDialog, wxPrintDialogBase) +wxIMPLEMENT_CLASS(wxGtkPrintDialog, wxPrintDialogBase); wxGtkPrintDialog::wxGtkPrintDialog( wxWindow *parent, wxPrintDialogData *data ) : wxPrintDialogBase(parent, wxID_ANY, _("Print"), @@ -591,6 +611,11 @@ wxGtkPrintDialog::wxGtkPrintDialog( wxWindow *parent, wxPrintDialogData *data ) m_parent = parent; SetShowDialog(true); + + const wxPrintData& printData = m_printDialogData.GetPrintData(); + wxGtkPrintNativeData* native = + static_cast(printData.GetNativeData()); + native->SetPrintJob(gtk_print_operation_new()); } wxGtkPrintDialog::wxGtkPrintDialog( wxWindow *parent, wxPrintData *data ) @@ -604,11 +629,22 @@ wxGtkPrintDialog::wxGtkPrintDialog( wxWindow *parent, wxPrintData *data ) m_parent = parent; SetShowDialog(true); + + const wxPrintData& printData = m_printDialogData.GetPrintData(); + wxGtkPrintNativeData* native = + static_cast(printData.GetNativeData()); + native->SetPrintJob(gtk_print_operation_new()); } wxGtkPrintDialog::~wxGtkPrintDialog() { + const wxPrintData& printData = m_printDialogData.GetPrintData(); + wxGtkPrintNativeData* native = + static_cast(printData.GetNativeData()); + GtkPrintOperation* printOp = native->GetPrintJob(); + g_object_unref(printOp); + native->SetPrintJob(NULL); } // This is called even if we actually don't want the dialog to appear. @@ -633,11 +669,10 @@ int wxGtkPrintDialog::ShowModal() gtk_print_settings_set_print_pages(settings, GTK_PRINT_PAGES_ALL); else { gtk_print_settings_set_print_pages(settings, GTK_PRINT_PAGES_RANGES); - GtkPageRange *range; - range = g_new (GtkPageRange, 1); - range[0].start = fromPage-1; - range[0].end = (toPage >= fromPage) ? toPage-1 : fromPage-1; - gtk_print_settings_set_page_ranges (settings, range, 1); + GtkPageRange range; + range.start = fromPage - 1; + range.end = (toPage >= fromPage) ? toPage - 1 : fromPage - 1; + gtk_print_settings_set_page_ranges(settings, &range, 1); } GtkPrintOperation * const printOp = native->GetPrintJob(); @@ -701,6 +736,7 @@ int wxGtkPrintDialog::ShowModal() { m_printDialogData.SetFromPage( range[0].start ); m_printDialogData.SetToPage( range[0].end ); + g_free(range); } else { m_printDialogData.SetAllPages( true ); @@ -723,7 +759,7 @@ int wxGtkPrintDialog::ShowModal() // wxGtkPageSetupDialog //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGtkPageSetupDialog, wxPageSetupDialogBase) +wxIMPLEMENT_CLASS(wxGtkPageSetupDialog, wxPageSetupDialogBase); wxGtkPageSetupDialog::wxGtkPageSetupDialog( wxWindow *parent, wxPageSetupDialogData* data ) @@ -751,15 +787,15 @@ int wxGtkPageSetupDialog::ShowModal() GtkPageSetup* oldPageSetup = native->GetPageSetupFromSettings(nativeData); // If the user used a custom paper format the last time he printed, we have to restore it too. - if (m_pageDialogData.GetPrintData().GetPaperId() == wxPAPER_NONE) + wxPaperSize paperId = m_pageDialogData.GetPrintData().GetPaperId(); + if (paperId == wxPAPER_NONE) { wxSize customPaperSize = m_pageDialogData.GetPaperSize(); if (customPaperSize.GetWidth() > 0 && customPaperSize.GetHeight() > 0) { - wxString title = _("Custom size"); - GtkPaperSize* customSize = gtk_paper_size_new_custom ("custom", title.mb_str(), (gdouble) customPaperSize.GetWidth(), (gdouble) customPaperSize.GetHeight(), GTK_UNIT_MM); + GtkPaperSize* customSize = wxGetGtkPaperSize(paperId, customPaperSize); gtk_page_setup_set_paper_size_and_default_margins (oldPageSetup, customSize); - g_object_unref(customSize); + gtk_paper_size_free(customSize); } } @@ -845,12 +881,13 @@ int wxGtkPageSetupDialog::ShowModal() // wxGtkPrinter //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGtkPrinter, wxPrinterBase) +wxIMPLEMENT_CLASS(wxGtkPrinter, wxPrinterBase); wxGtkPrinter::wxGtkPrinter( wxPrintDialogData *data ) : wxPrinterBase( data ) { m_gpc = NULL; + m_dc = NULL; if (data) m_printDialogData = *data; @@ -899,10 +936,9 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) wxPrintData printdata = GetPrintDialogData().GetPrintData(); wxGtkPrintNativeData *native = (wxGtkPrintNativeData*) printdata.GetNativeData(); - wxGtkObject printOp(gtk_print_operation_new()); - native->SetPrintJob(printOp); - wxON_BLOCK_EXIT_OBJ1(*native, wxGtkPrintNativeData::SetPrintJob, - static_cast(NULL)); + // wxGtkPrintDialog needs to be created first as it creates the PrintOp + wxGtkPrintDialog dialog(parent, &m_printDialogData); + GtkPrintOperation* printOp = native->GetPrintJob(); wxPrinterToGtkData dataToSend; dataToSend.printer = this; @@ -915,7 +951,6 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) // This is used to setup the DC and // show the dialog if desired - wxGtkPrintDialog dialog( parent, &m_printDialogData ); dialog.SetPrintDC(m_dc); dialog.SetShowDialog(prompt); @@ -928,7 +963,6 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) if (ret == wxID_NO) { sm_lastError = wxPRINTER_ERROR; - wxFAIL_MSG(_("The print dialog returned an error.")); } return (sm_lastError == wxPRINTER_NO_ERROR); @@ -956,7 +990,7 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation if (sm_lastError != wxPRINTER_CANCELLED) { sm_lastError = wxPRINTER_ERROR; - wxFAIL_MSG(_("The wxGtkPrinterDC cannot be used.")); + wxFAIL_MSG("The wxGtkPrinterDC cannot be used."); } return; } @@ -984,7 +1018,7 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation if (maxPage == 0) { sm_lastError = wxPRINTER_ERROR; - wxFAIL_MSG(_("wxPrintout::GetPageInfo gives a null maxPage.")); + wxFAIL_MSG("wxPrintout::GetPageInfo gives a null maxPage."); return; } @@ -1016,7 +1050,11 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation if (range[i].start > maxPage-1) range[i].start = maxPage-1; numPages += range[i].end - range[i].start + 1; } - gtk_print_settings_set_page_ranges (settings, range, 1); + if (range) + { + gtk_print_settings_set_page_ranges(settings, range, 1); + g_free(range); + } break;} case GTK_PRINT_PAGES_ALL: default: @@ -1045,8 +1083,8 @@ void wxGtkPrinter::DrawPage(wxPrintout *printout, switch (gtk_print_settings_get_print_pages(settings)) { case GTK_PRINT_PAGES_CURRENT: - g_object_get_property((GObject*) operation, (const gchar *) "current-page", (GValue*) &startPage); - g_object_get_property((GObject*) operation, (const gchar *) "current-page", (GValue*) &endPage); + g_object_get(G_OBJECT(operation), "current-page", &startPage, NULL); + endPage = startPage; break; case GTK_PRINT_PAGES_RANGES: {gint num_ranges = 0; @@ -1057,6 +1095,7 @@ void wxGtkPrinter::DrawPage(wxPrintout *printout, { startPage = range[0].start + 1; endPage = range[0].end + 1; + g_free(range); } else { startPage = minPage; @@ -1111,7 +1150,6 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) if (ret == wxID_NO) { sm_lastError = wxPRINTER_ERROR; - wxFAIL_MSG(_("The print dialog returned an error.")); return NULL; } @@ -1148,7 +1186,7 @@ bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) ) #endif -IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterDCImpl, wxDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterDCImpl, wxDCImpl); wxGtkPrinterDCImpl::wxGtkPrinterDCImpl(wxPrinterDC *owner, const wxPrintData& data) : wxDCImpl( owner ) @@ -1182,6 +1220,7 @@ wxGtkPrinterDCImpl::wxGtkPrinterDCImpl(wxPrinterDC *owner, const wxPrintData& da m_currentRed = 0; m_currentBlue = 0; m_currentGreen = 0; + m_currentAlpha = 0; m_signX = 1; // default x-axis left to right. m_signY = 1; // default y-axis bottom up -> top down. @@ -1215,7 +1254,7 @@ bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1), { // We can't access the given coord as a Cairo context is scalable, ie a // coord doesn't mean anything in this context. - wxFAIL_MSG(_("not implemented")); + wxFAIL_MSG("not implemented"); return false; } @@ -1320,7 +1359,7 @@ bool wxGtkPrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour * WXUNUSED(col)) const { - wxFAIL_MSG(_("not implemented")); + wxFAIL_MSG("not implemented"); return false; } @@ -2007,7 +2046,7 @@ void wxGtkPrinterDCImpl::SetBrush( const wxBrush& brush ) cairo_line_to(cr, 5, 10); break; default: - wxFAIL_MSG(_("Couldn't get hatch style from wxBrush.")); + wxFAIL_MSG("Couldn't get hatch style from wxBrush."); } cairo_set_source_rgba(cr, redPS, greenPS, bluePS, alphaPS); @@ -2070,6 +2109,8 @@ void wxGtkPrinterDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width void wxGtkPrinterDCImpl::DestroyClippingRegion() { cairo_reset_clip(m_cairo); + + wxDCImpl::DestroyClippingRegion(); } bool wxGtkPrinterDCImpl::StartDoc(const wxString& WXUNUSED(message)) @@ -2243,7 +2284,7 @@ int wxGtkPrinterDCImpl::GetResolution() const // Print preview // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGtkPrintPreview, wxPrintPreviewBase) +wxIMPLEMENT_CLASS(wxGtkPrintPreview, wxPrintPreviewBase); void wxGtkPrintPreview::Init(wxPrintout * WXUNUSED(printout), wxPrintout * WXUNUSED(printoutForPrinting), diff --git a/Externals/wxWidgets3/src/gtk/private.cpp b/Externals/wxWidgets3/src/gtk/private.cpp index 4cf519ee87..e60d799ebc 100644 --- a/Externals/wxWidgets3/src/gtk/private.cpp +++ b/Externals/wxWidgets3/src/gtk/private.cpp @@ -262,12 +262,12 @@ GtkWidget *GetTreeWidget() class WidgetsCleanupModule : public wxModule { public: - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { if ( gs_container ) { @@ -276,10 +276,10 @@ public: } } - DECLARE_DYNAMIC_CLASS(WidgetsCleanupModule) + wxDECLARE_DYNAMIC_CLASS(WidgetsCleanupModule); }; -IMPLEMENT_DYNAMIC_CLASS(WidgetsCleanupModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(WidgetsCleanupModule, wxModule); static WidgetsCleanupModule gs_widgetsCleanupModule; diff --git a/Externals/wxWidgets3/src/gtk/radiobox.cpp b/Externals/wxWidgets3/src/gtk/radiobox.cpp index 1277b5f912..f68fd270f9 100644 --- a/Externals/wxWidgets3/src/gtk/radiobox.cpp +++ b/Externals/wxWidgets3/src/gtk/radiobox.cpp @@ -192,7 +192,7 @@ static void gtk_radiobutton_size_allocate( GtkWidget *widget, // wxRadioBox //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, diff --git a/Externals/wxWidgets3/src/gtk/region.cpp b/Externals/wxWidgets3/src/gtk/region.cpp index af0d73628e..054acd8e80 100644 --- a/Externals/wxWidgets3/src/gtk/region.cpp +++ b/Externals/wxWidgets3/src/gtk/region.cpp @@ -70,8 +70,8 @@ public: #define M_REGIONDATA static_cast(m_refData) #define M_REGIONDATA_OF(r) static_cast(r.m_refData) -IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject); // ---------------------------------------------------------------------------- // wxRegion construction diff --git a/Externals/wxWidgets3/src/gtk/renderer.cpp b/Externals/wxWidgets3/src/gtk/renderer.cpp index 98969dd3e5..a80ebb065b 100644 --- a/Externals/wxWidgets3/src/gtk/renderer.cpp +++ b/Externals/wxWidgets3/src/gtk/renderer.cpp @@ -41,6 +41,10 @@ #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" +#if defined(__WXGTK3__) && !GTK_CHECK_VERSION(3,14,0) + #define GTK_STATE_FLAG_CHECKED (1 << 11) +#endif + // ---------------------------------------------------------------------------- // wxRendererGTK: our wxRendererNative implementation // ---------------------------------------------------------------------------- @@ -54,80 +58,80 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL); + wxHeaderButtonParams* params = NULL) wxOVERRIDE; - virtual int GetHeaderButtonHeight(wxWindow *win); + virtual int GetHeaderButtonHeight(wxWindow *win) wxOVERRIDE; - virtual int GetHeaderButtonMargin(wxWindow *win); + virtual int GetHeaderButtonMargin(wxWindow *win) wxOVERRIDE; // draw the expanded/collapsed icon for a tree control item virtual void DrawTreeItemButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawSplitterBorder(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, wxCoord position, wxOrientation orient, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawComboBoxDropButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawDropArrow(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawCheckBox(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, - int flags=0); + int flags=0) wxOVERRIDE; virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, - int flags=0); + int flags=0) wxOVERRIDE; virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, - int flags=0); + int flags=0) wxOVERRIDE; virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, - int flags=0); + int flags=0) wxOVERRIDE; - virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) wxOVERRIDE; - virtual wxSize GetCheckBoxSize(wxWindow *win); + virtual wxSize GetCheckBoxSize(wxWindow *win) wxOVERRIDE; - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE; }; // ============================================================================ @@ -551,7 +555,11 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, { int stateFlags = GTK_STATE_FLAG_NORMAL; if (flags & wxCONTROL_CHECKED) + { stateFlags = GTK_STATE_FLAG_ACTIVE; + if (gtk_check_version(3,14,0) == NULL) + stateFlags = GTK_STATE_FLAG_CHECKED; + } if (flags & wxCONTROL_DISABLED) stateFlags |= GTK_STATE_FLAG_INSENSITIVE; if (flags & wxCONTROL_UNDETERMINED) @@ -866,7 +874,11 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, #ifdef __WXGTK3__ int state = GTK_STATE_FLAG_NORMAL; if (flags & wxCONTROL_CHECKED) + { state = GTK_STATE_FLAG_ACTIVE; + if (gtk_check_version(3,14,0) == NULL) + state = GTK_STATE_FLAG_CHECKED; + } else if (flags & wxCONTROL_UNDETERMINED) state = GTK_STATE_FLAG_INCONSISTENT; if (flags & wxCONTROL_DISABLED) diff --git a/Externals/wxWidgets3/src/gtk/scrolbar.cpp b/Externals/wxWidgets3/src/gtk/scrolbar.cpp index 83418b711c..071dc248e3 100644 --- a/Externals/wxWidgets3/src/gtk/scrolbar.cpp +++ b/Externals/wxWidgets3/src/gtk/scrolbar.cpp @@ -209,9 +209,14 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS } g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this); GtkRange* widget = GTK_RANGE(m_widget); - gtk_adjustment_set_page_size(gtk_range_get_adjustment(widget), thumbSize); + GtkAdjustment* adj = gtk_range_get_adjustment(widget); + + g_object_freeze_notify(G_OBJECT(adj)); gtk_range_set_increments(widget, 1, pageSize); + gtk_adjustment_set_page_size(adj, thumbSize); gtk_range_set_range(widget, 0, range); + g_object_thaw_notify(G_OBJECT(adj)); + 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); diff --git a/Externals/wxWidgets3/src/gtk/scrolwin.cpp b/Externals/wxWidgets3/src/gtk/scrolwin.cpp index 9b39077a3d..021c5243ce 100644 --- a/Externals/wxWidgets3/src/gtk/scrolwin.cpp +++ b/Externals/wxWidgets3/src/gtk/scrolwin.cpp @@ -68,9 +68,23 @@ void wxScrollHelper::DoAdjustScrollbar(GtkRange* range, *linesPerPage = 0; } - 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); + GtkAdjustment* adj = gtk_range_get_adjustment(range); + const double adj_upper = gtk_adjustment_get_upper(adj); + const double adj_page_size = gtk_adjustment_get_page_size(adj); + if (adj_upper != upper || adj_page_size != page_size) + { + const bool wasVisible = adj_upper > adj_page_size; + + g_object_freeze_notify(G_OBJECT(adj)); + gtk_range_set_increments(range, 1, page_size); + gtk_adjustment_set_page_size(adj, page_size); + gtk_range_set_range(range, 0, upper); + g_object_thaw_notify(G_OBJECT(adj)); + + const bool isVisible = gtk_adjustment_get_upper(adj) > gtk_adjustment_get_page_size(adj); + if (isVisible != wasVisible) + m_win->m_useCachedClientSize = false; + } // ensure that the scroll position is always in valid range if (*pos > *lines) @@ -81,6 +95,14 @@ void wxScrollHelper::AdjustScrollbars() { int vw, vh; m_targetWindow->GetVirtualSize(&vw, &vh); +#ifdef __WXGTK3__ + if (m_targetWindow != m_win) + { + // setting wxPizza preferred size keeps GtkScrolledWindow from causing + // an infinite sizing loop + gtk_widget_set_size_request(m_win->m_wxwindow, vw, vh); + } +#endif int w, h; const wxSize availSize = GetSizeAvailableForScrollTarget( diff --git a/Externals/wxWidgets3/src/gtk/settings.cpp b/Externals/wxWidgets3/src/gtk/settings.cpp index 98efe96766..8343c6ed09 100644 --- a/Externals/wxWidgets3/src/gtk/settings.cpp +++ b/Externals/wxWidgets3/src/gtk/settings.cpp @@ -152,20 +152,35 @@ static GtkWidget* ToolTipWidget() } #ifdef __WXGTK3__ -static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) +static void get_color(const char* name, GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { GtkStyleContext* sc = gtk_widget_get_style_context(widget); - gtk_style_context_get_background_color(sc, state, &gdkRGBA); + GdkRGBA* rgba; + gtk_style_context_set_state(sc, state); + gtk_style_context_get(sc, state, name, &rgba, NULL); + gdkRGBA = *rgba; + gdk_rgba_free(rgba); + if (gdkRGBA.alpha <= 0) + { + widget = gtk_widget_get_parent(GTK_WIDGET(ContainerWidget())); + sc = gtk_widget_get_style_context(widget); + gtk_style_context_set_state(sc, state); + gtk_style_context_get(sc, state, name, &rgba, NULL); + gdkRGBA = *rgba; + gdk_rgba_free(rgba); + } +} +static void bg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) +{ + get_color("background-color", widget, state, gdkRGBA); } static void fg(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { - GtkStyleContext* sc = gtk_widget_get_style_context(widget); - gtk_style_context_get_color(sc, state, &gdkRGBA); + get_color("color", widget, state, gdkRGBA); } static void border(GtkWidget* widget, GtkStateFlags state, GdkRGBA& gdkRGBA) { - GtkStyleContext* sc = gtk_widget_get_style_context(widget); - gtk_style_context_get_border_color(sc, state, &gdkRGBA); + get_color("border-color", widget, state, gdkRGBA); } wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) @@ -235,14 +250,21 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break; case wxSYS_COLOUR_ACTIVECAPTION: case wxSYS_COLOUR_MENUHILIGHT: - bg(MenuItemWidget(), GTK_STATE_FLAG_SELECTED, gdkRGBA); + bg(MenuItemWidget(), GTK_STATE_FLAG_PRELIGHT, gdkRGBA); break; case wxSYS_COLOUR_MENUTEXT: fg(MenuItemWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA); break; case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_WINDOW: - bg(TextCtrlWidget(), GTK_STATE_FLAG_NORMAL, gdkRGBA); + { + GtkWidget* widget = TextCtrlWidget(); + GtkStyleContext* sc = gtk_widget_get_style_context(widget); + gtk_style_context_save(sc); + gtk_style_context_add_class(sc, GTK_STYLE_CLASS_VIEW); + bg(widget, GTK_STATE_FLAG_NORMAL, gdkRGBA); + gtk_style_context_restore(sc); + } break; case wxSYS_COLOUR_CAPTIONTEXT: { @@ -428,6 +450,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) wxNativeFontInfo info; #ifdef __WXGTK3__ GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget()); + gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &info.description, NULL); #else diff --git a/Externals/wxWidgets3/src/gtk/slider.cpp b/Externals/wxWidgets3/src/gtk/slider.cpp index 17d8cf087c..69d994abc3 100644 --- a/Externals/wxWidgets3/src/gtk/slider.cpp +++ b/Externals/wxWidgets3/src/gtk/slider.cpp @@ -20,6 +20,7 @@ #include #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/eventsdisabler.h" //----------------------------------------------------------------------------- // data @@ -231,9 +232,8 @@ gtk_event_after(GtkRange* range, GdkEvent* event, wxSlider* win) ProcessScrollEvent(win, wxEVT_SCROLL_THUMBRELEASE); } // Keep slider at an integral position - win->GTKDisableEvents(); + wxGtkEventsDisabler noEvents(win); gtk_range_set_value(GTK_RANGE (win->m_scale), win->GetValue()); - win->GTKEnableEvents(); } } } @@ -422,21 +422,20 @@ void wxSlider::SetValue( int value ) void wxSlider::GTKSetValue(int value) { - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); + 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(); } void wxSlider::SetRange( int minValue, int maxValue ) { - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); if (minValue == maxValue) maxValue++; gtk_range_set_range(GTK_RANGE (m_scale), minValue, maxValue); gtk_range_set_increments(GTK_RANGE (m_scale), 1, (maxValue - minValue + 9) / 10); - GTKEnableEvents(); if (HasFlag(wxSL_MIN_MAX_LABELS)) { @@ -471,9 +470,8 @@ int wxSlider::GetMax() const void wxSlider::SetPageSize( int pageSize ) { - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); gtk_range_set_increments(GTK_RANGE (m_scale), GetLineSize(), pageSize); - GTKEnableEvents(); } int wxSlider::GetPageSize() const @@ -494,9 +492,8 @@ int wxSlider::GetThumbLength() const void wxSlider::SetLineSize( int lineSize ) { - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); gtk_range_set_increments(GTK_RANGE (m_scale), lineSize, GetPageSize()); - GTKEnableEvents(); } int wxSlider::GetLineSize() const @@ -508,8 +505,7 @@ int wxSlider::GetLineSize() const GdkWindow *wxSlider::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const { #ifdef __WXGTK3__ - // no access to internal GdkWindows - return NULL; + return GTKFindWindow(m_scale); #else return GTK_RANGE(m_scale)->event_window; #endif diff --git a/Externals/wxWidgets3/src/gtk/sockgtk.cpp b/Externals/wxWidgets3/src/gtk/sockgtk.cpp index dd786ce35a..834c85d383 100644 --- a/Externals/wxWidgets3/src/gtk/sockgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/sockgtk.cpp @@ -44,17 +44,20 @@ static gboolean wxSocket_Input(GIOChannel*, GIOCondition condition, gpointer dat class GTKFDIOManager : public wxFDIOManager { public: - virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) + virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d) wxOVERRIDE { - return g_io_add_watch( - g_io_channel_unix_new(fd), + GIOChannel* channel = g_io_channel_unix_new(fd); + unsigned id = g_io_add_watch( + channel, d == OUTPUT ? G_IO_OUT : G_IO_IN, wxSocket_Input, handler); + g_io_channel_unref(channel); + return id; } virtual void - RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d)) + RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d)) wxOVERRIDE { g_source_remove(fd); } diff --git a/Externals/wxWidgets3/src/gtk/spinbutt.cpp b/Externals/wxWidgets3/src/gtk/spinbutt.cpp index fd1ee2cb9d..6aaaf82d83 100644 --- a/Externals/wxWidgets3/src/gtk/spinbutt.cpp +++ b/Externals/wxWidgets3/src/gtk/spinbutt.cpp @@ -92,6 +92,10 @@ bool wxSpinButton::Create(wxWindow *parent, g_object_ref(m_widget); gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0); +#if GTK_CHECK_VERSION(3,12,0) + if (gtk_check_version(3,12,0) == NULL) + gtk_entry_set_max_width_chars(GTK_ENTRY(m_widget), 0); +#endif gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); @@ -174,10 +178,10 @@ void wxSpinButton::GtkEnableEvents() const (gpointer)gtk_value_changed, (void*) this); } -GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const +GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED_IN_GTK2(windows)) const { #ifdef __WXGTK3__ - // no access to internal GdkWindows + GTKFindWindow(m_widget, windows); return NULL; #else return GTK_SPIN_BUTTON(m_widget)->panel; @@ -190,7 +194,7 @@ wxSize wxSpinButton::DoGetBestSize() const #ifdef __WXGTK3__ GtkStyleContext* sc = gtk_widget_get_style_context(m_widget); GtkBorder pad = { 0, 0, 0, 0 }; - gtk_style_context_get_padding(sc, GtkStateFlags(0), &pad); + gtk_style_context_get_padding(sc, gtk_style_context_get_state(sc), &pad); best.x -= pad.left + pad.right; #else gtk_widget_ensure_style(m_widget); diff --git a/Externals/wxWidgets3/src/gtk/spinctrl.cpp b/Externals/wxWidgets3/src/gtk/spinctrl.cpp index b036e0bdb0..61c533a548 100644 --- a/Externals/wxWidgets3/src/gtk/spinctrl.cpp +++ b/Externals/wxWidgets3/src/gtk/spinctrl.cpp @@ -104,9 +104,9 @@ private: // wxSpinCtrlGTKBase //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxSpinCtrlGTKBase, wxSpinCtrlBase) +wxBEGIN_EVENT_TABLE(wxSpinCtrlGTKBase, wxSpinCtrlBase) EVT_CHAR(wxSpinCtrlGTKBase::OnChar) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxSpinCtrlGTKBase::Create(wxWindow *parent, wxWindowID id, const wxString& value, @@ -342,8 +342,7 @@ void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event ) GdkWindow *wxSpinCtrlGTKBase::GTKGetWindow(wxArrayGdkWindows& windows) const { #ifdef __WXGTK3__ - // no access to internal GdkWindows - wxUnusedVar(windows); + GTKFindWindow(m_widget, windows); #else GtkSpinButton* spinbutton = GTK_SPIN_BUTTON(m_widget); @@ -478,7 +477,7 @@ bool wxSpinCtrl::SetBase(int base) // wxSpinCtrlDouble //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGTKBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGTKBase); unsigned wxSpinCtrlDouble::GetDigits() const { diff --git a/Externals/wxWidgets3/src/gtk/statbmp.cpp b/Externals/wxWidgets3/src/gtk/statbmp.cpp index bfe5c1ef38..4a56efc6f1 100644 --- a/Externals/wxWidgets3/src/gtk/statbmp.cpp +++ b/Externals/wxWidgets3/src/gtk/statbmp.cpp @@ -59,15 +59,15 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) { m_bitmap = bitmap; + // always use pixbuf, because pixmap mask does not + // work with disabled images in some themes if (m_bitmap.IsOk()) - { - // always use pixbuf, because pixmap mask does not - // work with disabled images in some themes gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), m_bitmap.GetPixbuf()); + else + gtk_image_set_from_pixbuf(GTK_IMAGE(m_widget), NULL); - InvalidateBestSize(); - SetSize(GetBestSize()); - } + InvalidateBestSize(); + SetSize(GetBestSize()); } // static diff --git a/Externals/wxWidgets3/src/gtk/statbox.cpp b/Externals/wxWidgets3/src/gtk/statbox.cpp index 6d0a9b0db1..2a385b29d1 100644 --- a/Externals/wxWidgets3/src/gtk/statbox.cpp +++ b/Externals/wxWidgets3/src/gtk/statbox.cpp @@ -158,8 +158,22 @@ wxStaticBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const { - *borderTop = GetCharHeight(); - *borderOther = GetCharWidth()/2; + GtkAllocation alloc, child_alloc; + gtk_widget_get_allocation(m_widget, &alloc); + const int w_save = alloc.width; + const int h_save = alloc.height; + if (alloc.width < 50) alloc.width = 50; + if (alloc.height < 50) alloc.height = 50; + gtk_widget_set_allocation(m_widget, &alloc); + + GTK_FRAME_GET_CLASS(m_widget)->compute_child_allocation(GTK_FRAME(m_widget), &child_alloc); + + alloc.width = w_save; + alloc.height = h_save; + gtk_widget_set_allocation(m_widget, &alloc); + + *borderTop = child_alloc.y - alloc.y; + *borderOther = child_alloc.x - alloc.x; } #endif // wxUSE_STATBOX diff --git a/Externals/wxWidgets3/src/gtk/stattext.cpp b/Externals/wxWidgets3/src/gtk/stattext.cpp index 959c649f9a..5d9ffce8e3 100644 --- a/Externals/wxWidgets3/src/gtk/stattext.cpp +++ b/Externals/wxWidgets3/src/gtk/stattext.cpp @@ -55,11 +55,35 @@ bool wxStaticText::Create(wxWindow *parent, GtkJustification justify; if ( style & wxALIGN_CENTER_HORIZONTAL ) - justify = GTK_JUSTIFY_CENTER; + { +#ifndef __WXGTK3__ + // This looks like a bug in GTK+ and seems to be fixed in GTK+3, but + // using non-default justification with default ellipsize mode doesn't + // work: the justification is just ignored. In practice, alignment is + // more important, so turn on ellipsize mode even if it was not + // specified to make it work if necessary. + if ( !(style & wxST_ELLIPSIZE_MASK) ) + style |= wxST_ELLIPSIZE_MIDDLE; +#endif // GTK+ 2 + + justify = GTK_JUSTIFY_CENTER; + } else if ( style & wxALIGN_RIGHT ) - justify = GTK_JUSTIFY_RIGHT; - else - justify = GTK_JUSTIFY_LEFT; + { +#ifndef __WXGTK3__ + // As above, we need to use a non-default ellipsize mode for the + // alignment to have any effect. + if ( !(style & wxST_ELLIPSIZE_MASK) ) + style |= wxST_ELLIPSIZE_START; +#endif // GTK+ 2 + + justify = GTK_JUSTIFY_RIGHT; + } + else // must be wxALIGN_LEFT which is 0 + { + // No need to play games with wxST_ELLIPSIZE_XXX. + justify = GTK_JUSTIFY_LEFT; + } if (GetLayoutDirection() == wxLayout_RightToLeft) { @@ -94,6 +118,13 @@ bool wxStaticText::Create(wxWindow *parent, PostCreation(size); +#ifndef __WXGTK3__ + // GtkLabel does its layout based on its size-request, rather than its + // actual size. The size-request may not always get set, specifically if + // the initial size is fully specified. So make sure it's set here. + gtk_widget_set_size_request(m_widget, m_width, m_height); +#endif + return true; } @@ -205,11 +236,20 @@ wxSize wxStaticText::DoGetBestSize() const gtk_label_set_line_wrap(GTK_LABEL(m_widget), false); #else GTK_LABEL(m_widget)->wrap = FALSE; + + // Reset the ellipsize mode while computing the best size, otherwise it's + // going to be too small as the control knows that it can be shrunk to the + // bare minimum and just hide most of the text replacing it with ellipsis. + // This is especially important because we can enable ellipsization + // implicitly for GTK+ 2, see the code dealing with alignment in the ctor. + const PangoEllipsizeMode ellipsizeMode = gtk_label_get_ellipsize(GTK_LABEL(m_widget)); + gtk_label_set_ellipsize(GTK_LABEL(m_widget), PANGO_ELLIPSIZE_NONE); #endif wxSize size = wxStaticTextBase::DoGetBestSize(); #ifdef __WXGTK3__ gtk_label_set_line_wrap(GTK_LABEL(m_widget), true); #else + gtk_label_set_ellipsize(GTK_LABEL(m_widget), ellipsizeMode); GTK_LABEL(m_widget)->wrap = TRUE; // restore old value #endif diff --git a/Externals/wxWidgets3/src/gtk/taskbar.cpp b/Externals/wxWidgets3/src/gtk/taskbar.cpp index 599ef25377..0f1202f68e 100644 --- a/Externals/wxWidgets3/src/gtk/taskbar.cpp +++ b/Externals/wxWidgets3/src/gtk/taskbar.cpp @@ -284,7 +284,7 @@ void wxTaskBarIcon::Private::size_allocate(int width, int height) #endif //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType WXUNUSED(iconType)) { diff --git a/Externals/wxWidgets3/src/gtk/textctrl.cpp b/Externals/wxWidgets3/src/gtk/textctrl.cpp index bce644abf4..997316d524 100644 --- a/Externals/wxWidgets3/src/gtk/textctrl.cpp +++ b/Externals/wxWidgets3/src/gtk/textctrl.cpp @@ -583,11 +583,24 @@ static void mark_set(GtkTextBuffer*, GtkTextIter*, GtkTextMark* mark, GSList** m } } +#ifdef __WXGTK3__ +//----------------------------------------------------------------------------- +// "state_flags_changed" +//----------------------------------------------------------------------------- +extern "C" { +static void state_flags_changed(GtkWidget*, GtkStateFlags, wxTextCtrl* win) +{ + // restore non-default cursor, if any + win->GTKUpdateCursor(false, true); +} +} +#endif // __WXGTK3__ + //----------------------------------------------------------------------------- // wxTextCtrl //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) +wxBEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_CHAR(wxTextCtrl::OnChar) EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) @@ -611,7 +624,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_RIGHT_DOWN (wxTextCtrl::OnUrlMouseEvent) EVT_RIGHT_UP (wxTextCtrl::OnUrlMouseEvent) EVT_RIGHT_DCLICK(wxTextCtrl::OnUrlMouseEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxTextCtrl::Init() { @@ -682,6 +695,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gulong sig_id = g_signal_connect(m_buffer, "mark_set", G_CALLBACK(mark_set), &m_anonymousMarkList); // Create view m_text = gtk_text_view_new_with_buffer(m_buffer); + GTKConnectFreezeWidget(m_text); // gtk_text_view_set_buffer adds its own reference g_object_unref(m_buffer); g_signal_handler_disconnect(m_buffer, sig_id); @@ -820,10 +834,11 @@ bool wxTextCtrl::Create( wxWindow *parent, GTKConnectInsertTextSignal(GTK_ENTRY(m_text)); } - GTKConnectClipboardSignals(m_text); - m_cursor = wxCursor( wxCURSOR_IBEAM ); +#ifdef __WXGTK3__ + g_signal_connect(m_text, "state_flags_changed", G_CALLBACK(state_flags_changed), this); +#endif return true; } @@ -837,31 +852,32 @@ GtkEditable *wxTextCtrl::GetEditable() const GtkEntry *wxTextCtrl::GetEntry() const { - return GTK_ENTRY(m_text); + if (GTK_IS_ENTRY(m_text)) + return (GtkEntry*)m_text; + + return NULL; } int wxTextCtrl::GTKIMFilterKeypress(GdkEventKey* event) const { + if (IsSingleLine()) + return wxTextEntry::GTKIMFilterKeypress(event); + + int result; #if GTK_CHECK_VERSION(2, 22, 0) - if ( gtk_check_version(2, 12, 0) == 0 ) +#ifndef __WXGTK3__ + result = false; + if (gtk_check_version(2,22,0) == NULL) +#endif { - if ( IsSingleLine() ) - { - return wxTextEntry::GTKIMFilterKeypress(event); - } - else - { - return gtk_text_view_im_context_filter_keypress( - GTK_TEXT_VIEW(m_text), - event - ); - } + result = gtk_text_view_im_context_filter_keypress(GTK_TEXT_VIEW(m_text), event); } #else // GTK+ < 2.22 wxUnusedVar(event); + result = false; #endif // GTK+ 2.22+ - return FALSE; + return result; } // ---------------------------------------------------------------------------- @@ -974,6 +990,11 @@ wxString wxTextCtrl::GetValue() const { wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") ); + return wxTextEntry::GetValue(); +} + +wxString wxTextCtrl::DoGetValue() const +{ if ( IsMultiLine() ) { GtkTextIter start; @@ -986,7 +1007,7 @@ wxString wxTextCtrl::GetValue() const } else // single line { - return wxTextEntry::GetValue(); + return wxTextEntry::DoGetValue(); } } @@ -1088,6 +1109,11 @@ void wxTextCtrl::WriteText( const wxString &text ) // we're changing the text programmatically DontMarkDirtyOnNextChange(); + // avoid generating wxEVT_CHAR when called from wxEVT_CHAR handler + GdkEventKey* const imKeyEvent_save = m_imKeyEvent; + m_imKeyEvent = NULL; + wxON_BLOCK_EXIT_SET(m_imKeyEvent, imKeyEvent_save); + if ( !IsMultiLine() ) { wxTextEntry::WriteText(text); @@ -1331,7 +1357,6 @@ bool wxTextCtrl::Enable( bool enable ) } gtk_widget_set_sensitive( m_text, enable ); - SetCursor(enable ? wxCursor(wxCURSOR_IBEAM) : wxCursor()); return true; } @@ -1639,8 +1664,7 @@ GdkWindow *wxTextCtrl::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const else { #ifdef __WXGTK3__ - // no access to internal GdkWindows - return NULL; + return GTKFindWindow(m_text); #else return gtk_entry_get_text_window(GTK_ENTRY(m_text)); #endif @@ -1790,6 +1814,44 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) void wxTextCtrl::DoApplyWidgetStyle(GtkRcStyle *style) { +#ifdef __WXGTK3__ + // Preserve selection colors, otherwise the GTK_STATE_FLAG_NORMAL override + // will be used, and the selection is invisible + const GtkStateFlags selectedFocused = + GtkStateFlags(GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED); + // remove any previous override + gtk_widget_override_color(m_text, GTK_STATE_FLAG_NORMAL, NULL); + gtk_widget_override_color(m_text, selectedFocused, NULL); + gtk_widget_override_background_color(m_text, GTK_STATE_FLAG_NORMAL, NULL); + gtk_widget_override_background_color(m_text, selectedFocused, NULL); + const bool fg_ok = m_foregroundColour.IsOk(); + const bool bg_ok = m_backgroundColour.IsOk(); + if (fg_ok || bg_ok) + { + GdkRGBA *fg_orig, *bg_orig; + GtkStyleContext* context = gtk_widget_get_style_context(m_text); + if (IsMultiLine()) + { + gtk_style_context_save(context); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_VIEW); + } + gtk_style_context_set_state(context, selectedFocused); + gtk_style_context_get(context, selectedFocused, + "color", &fg_orig, "background-color", &bg_orig, + NULL); + if (IsMultiLine()) + gtk_style_context_restore(context); + + if (fg_ok) + gtk_widget_override_color(m_text, selectedFocused, fg_orig); + if (bg_ok) + gtk_widget_override_background_color(m_text, selectedFocused, bg_orig); + + gdk_rgba_free(fg_orig); + gdk_rgba_free(bg_orig); + } +#endif // __WXGTK3__ + GTKApplyStyle(m_text, style); } @@ -1919,6 +1981,8 @@ void wxTextCtrl::DoFreeze() wxCHECK_RET(m_text != NULL, wxT("invalid text ctrl")); GTKFreezeWidget(m_text); + if (m_widget != m_text) + GTKFreezeWidget(m_widget); if ( HasFlag(wxTE_MULTILINE) ) { @@ -1965,6 +2029,8 @@ void wxTextCtrl::DoThaw() } GTKThawWidget(m_text); + if (m_widget != m_text) + GTKThawWidget(m_widget); } // ---------------------------------------------------------------------------- @@ -1991,7 +2057,7 @@ void wxTextCtrl::OnUrlMouseEvent(wxMouseEvent& event) gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(m_text), &end, x, y); if (!gtk_text_iter_has_tag(&end, tag)) { - SetCursor(wxCursor(wxCURSOR_IBEAM)); + SetCursor(wxCursor()); return; } diff --git a/Externals/wxWidgets3/src/gtk/textentry.cpp b/Externals/wxWidgets3/src/gtk/textentry.cpp index 03a6867379..f031844925 100644 --- a/Externals/wxWidgets3/src/gtk/textentry.cpp +++ b/Externals/wxWidgets3/src/gtk/textentry.cpp @@ -33,6 +33,7 @@ #include #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/string.h" // ============================================================================ // signal handlers implementation @@ -43,8 +44,8 @@ extern "C" void wx_gtk_insert_text_callback(GtkEditable *editable, const gchar * new_text, - gint WXUNUSED(new_text_length), - gint * WXUNUSED(position), + gint new_text_length, + gint * position, wxTextEntry *text) { GtkEntry *entry = GTK_ENTRY (editable); @@ -78,6 +79,40 @@ wx_gtk_insert_text_callback(GtkEditable *editable, } } + // Check if we have to convert all input to upper-case + if ( !handled && text->GTKIsUpperCase() ) + { + const wxGtkString upper(g_utf8_strup(new_text, new_text_length)); + + // Use the converted text to generate events + if ( !text->GTKEntryOnInsertText(upper) ) + { + // Event not handled, so do insert the text: we have to do it + // ourselves to use the upper-case version of it + + // Prevent recursive call to this handler again + g_signal_handlers_block_by_func + ( + editable, + (gpointer)wx_gtk_insert_text_callback, + text + ); + + gtk_editable_insert_text(editable, upper, strlen(upper), position); + + g_signal_handlers_unblock_by_func + ( + editable, + (gpointer)wx_gtk_insert_text_callback, + text + ); + } + + // Don't call the default handler in any case, either the event was + // handled in the user code or we've already inserted the text. + handled = true; + } + if ( !handled && text->GTKEntryOnInsertText(new_text) ) { // If we already handled the new text insertion, don't do it again. @@ -173,9 +208,9 @@ void wxTextEntry::DoSetValue(const wxString& value, int flags) { if (value != DoGetValue()) { - // use Remove() rather than SelectAll() to avoid unnecessary clipboard + // Use Remove() rather than SelectAll() to avoid unnecessary clipboard // operations, and prevent triggering an apparent bug in GTK which - // causes the the subsequent WriteText() to append rather than overwrite + // causes the subsequent WriteText() to append rather than overwrite. { EventsSuppressor noevents(this); Remove(0, -1); @@ -386,7 +421,7 @@ void wxTextEntry::SetEditable(bool editable) } // ---------------------------------------------------------------------------- -// max text length +// input restrictions // ---------------------------------------------------------------------------- void wxTextEntry::SetMaxLength(unsigned long len) @@ -411,20 +446,37 @@ void wxTextEntry::SendMaxLenEvent() win->HandleWindowEvent(event); } +void wxTextEntry::ForceUpper() +{ + if ( !m_isUpperCase ) + { + ConvertToUpperCase(); + + m_isUpperCase = true; + } +} + // ---------------------------------------------------------------------------- // IM handling // ---------------------------------------------------------------------------- int wxTextEntry::GTKIMFilterKeypress(GdkEventKey* event) const { + int result; #if GTK_CHECK_VERSION(2, 22, 0) - if ( gtk_check_version(2, 12, 0) == 0 ) - return gtk_entry_im_context_filter_keypress(GetEntry(), event); +#ifndef __WXGTK3__ + result = false; + if (gtk_check_version(2,22,0) == NULL) +#endif + { + result = gtk_entry_im_context_filter_keypress(GetEntry(), event); + } #else // GTK+ < 2.22 wxUnusedVar(event); + result = false; #endif // GTK+ 2.22+ - return FALSE; + return result; } void wxTextEntry::GTKConnectInsertTextSignal(GtkEntry* entry) @@ -449,44 +501,35 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins) if ( !entry ) return false; +#ifndef __WXGTK3__ + if (gtk_check_version(2,10,0)) + return false; +#endif const GtkBorder* oldBorder = gtk_entry_get_inner_border(entry); - GtkBorder* newBorder; + GtkBorder newBorder; if ( oldBorder ) - { - newBorder = gtk_border_copy(oldBorder); - } + newBorder = *oldBorder; else { - #if GTK_CHECK_VERSION(2,14,0) - newBorder = gtk_border_new(); - #else - newBorder = g_slice_new0(GtkBorder); - #endif // Use some reasonable defaults for initial margins - newBorder->left = 2; - newBorder->right = 2; + newBorder.left = 2; + newBorder.right = 2; // These numbers seem to let the text remain vertically centered // in common use scenarios when margins.y == -1. - newBorder->top = 3; - newBorder->bottom = 3; + newBorder.top = 3; + newBorder.bottom = 3; } if ( margins.x != -1 ) - newBorder->left = (gint) margins.x; + newBorder.left = margins.x; if ( margins.y != -1 ) - newBorder->top = (gint) margins.y; + newBorder.top = margins.y; - gtk_entry_set_inner_border(entry, newBorder); - -#if GTK_CHECK_VERSION(2,14,0) - gtk_border_free(newBorder); -#else - g_slice_free(GtkBorder, newBorder); -#endif + gtk_entry_set_inner_border(entry, &newBorder); return true; #else @@ -497,21 +540,25 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins) wxPoint wxTextEntry::DoGetMargins() const { + wxPoint point(-1, -1); #if GTK_CHECK_VERSION(2,10,0) GtkEntry* entry = GetEntry(); - - if ( !entry ) - return wxPoint(-1, -1); - - const GtkBorder* border = gtk_entry_get_inner_border(entry); - - if ( !border ) - return wxPoint(-1, -1); - - return wxPoint((wxCoord) border->left, (wxCoord) border->top); -#else - return wxPoint(-1, -1); + if (entry) + { +#ifndef __WXGTK3__ + if (gtk_check_version(2,10,0) == NULL) #endif + { + const GtkBorder* border = gtk_entry_get_inner_border(entry); + if (border) + { + point.x = border->left; + point.y = border->top; + } + } + } +#endif + return point; } #ifdef __WXGTK3__ @@ -519,25 +566,23 @@ bool wxTextEntry::SetHint(const wxString& hint) { #if GTK_CHECK_VERSION(3,2,0) GtkEntry *entry = GetEntry(); - if ( entry ) + if (entry && gtk_check_version(3,2,0) == NULL) { gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint)); return true; } - else #endif - return wxTextEntryBase::SetHint(hint); + return wxTextEntryBase::SetHint(hint); } wxString wxTextEntry::GetHint() const { #if GTK_CHECK_VERSION(3,2,0) GtkEntry *entry = GetEntry(); - if ( entry ) + if (entry && gtk_check_version(3,2,0) == NULL) return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry)); - else #endif - return wxTextEntryBase::GetHint(); + return wxTextEntryBase::GetHint(); } #endif // __WXGTK3__ diff --git a/Externals/wxWidgets3/src/gtk/tglbtn.cpp b/Externals/wxWidgets3/src/gtk/tglbtn.cpp index ec811f0b0f..1b91146de5 100644 --- a/Externals/wxWidgets3/src/gtk/tglbtn.cpp +++ b/Externals/wxWidgets3/src/gtk/tglbtn.cpp @@ -22,6 +22,8 @@ #include #include "wx/gtk/private.h" +#include "wx/gtk/private/eventsdisabler.h" +#include "wx/gtk/private/list.h" extern bool g_blockEventsOnDrag; @@ -45,7 +47,7 @@ wxDEFINE_EVENT( wxEVT_TOGGLEBUTTON, wxCommandEvent ); // wxBitmapToggleButton // ------------------------------------------------------------------------ -IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton); bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos, @@ -74,7 +76,7 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, // wxToggleButton // ------------------------------------------------------------------------ -IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl); bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, @@ -144,11 +146,9 @@ void wxToggleButton::SetValue(bool state) if (state == GetValue()) return; - GTKDisableEvents(); + wxGtkEventsDisabler noEvents(this); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state); - - GTKEnableEvents(); } // bool GetValue() const @@ -213,7 +213,23 @@ GtkLabel *wxToggleButton::GTKGetLabel() const void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style) { GTKApplyStyle(m_widget, style); - GTKApplyStyle(gtk_bin_get_child(GTK_BIN(m_widget)), style); + GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget)); + GTKApplyStyle(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_get_child(GTK_BIN(child)); + if ( GTK_IS_BOX(box) ) + { + wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box))); + for (GList* item = list; item; item = item->next) + { + GTKApplyStyle(GTK_WIDGET(item->data), style); + } + } + } } // Get the "best" size for this control. diff --git a/Externals/wxWidgets3/src/gtk/toolbar.cpp b/Externals/wxWidgets3/src/gtk/toolbar.cpp index f19f11d5b2..ff5bcdefa4 100644 --- a/Externals/wxWidgets3/src/gtk/toolbar.cpp +++ b/Externals/wxWidgets3/src/gtk/toolbar.cpp @@ -24,7 +24,6 @@ // data extern bool g_blockEventsOnDrag; -extern wxCursor g_globalCursor; // ---------------------------------------------------------------------------- // wxToolBarTool @@ -65,7 +64,7 @@ public: // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl); // ============================================================================ // implementation @@ -188,13 +187,13 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool) // draw disabled bitmap ourselves, GtkImage has no way to specify it GtkAllocation alloc; gtk_widget_get_allocation(widget, &alloc); - GtkRequisition req; - gtk_widget_get_requisition(widget, &req); - const int x = alloc.x + (alloc.width - req.width) / 2; - const int y = alloc.y + (alloc.height - req.height) / 2; + int x = (alloc.width - bitmap.GetWidth()) / 2; + int y = (alloc.height - bitmap.GetHeight()) / 2; #ifdef __WXGTK3__ bitmap.Draw(cr, x, y); #else + x += alloc.x; + y += alloc.y; gdk_draw_pixbuf( gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(), 0, 0, x, y, @@ -280,7 +279,10 @@ void wxToolBarTool::CreateDropDown() GtkWidget* box = gtk_box_new(orient, 0); GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE); GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item)); - gtk_widget_reparent(tool_button, box); + g_object_ref(tool_button); + gtk_container_remove(GTK_CONTAINER(m_item), tool_button); + gtk_container_add(GTK_CONTAINER(box), tool_button); + g_object_unref(tool_button); GtkWidget* arrow_button = gtk_toggle_button_new(); gtk_button_set_relief(GTK_BUTTON(arrow_button), gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item))); @@ -531,8 +533,11 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) } if (!tool->GetLabel().empty()) { + wxString const + label = wxControl::RemoveMnemonics(tool->GetLabel()); + gtk_tool_button_set_label( - GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(tool->GetLabel())); + GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(label)); // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT gtk_tool_item_set_is_important(tool->m_item, true); } @@ -697,7 +702,7 @@ wxSize wxToolBar::DoGetBestSize() const wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const { - // VZ: GTK+ doesn't seem to have such thing + // TODO: implement this using gtk_toolbar_get_drop_index() wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") ); return NULL; diff --git a/Externals/wxWidgets3/src/gtk/tooltip.cpp b/Externals/wxWidgets3/src/gtk/tooltip.cpp index 338b9a150c..2ab3069e49 100644 --- a/Externals/wxWidgets3/src/gtk/tooltip.cpp +++ b/Externals/wxWidgets3/src/gtk/tooltip.cpp @@ -31,7 +31,7 @@ static GtkTooltips *gs_tooltips = NULL; // wxToolTip //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip( const wxString &tip ) : m_text(tip) diff --git a/Externals/wxWidgets3/src/gtk/toplevel.cpp b/Externals/wxWidgets3/src/gtk/toplevel.cpp index 19af5b8cf9..13dc40aa3a 100644 --- a/Externals/wxWidgets3/src/gtk/toplevel.cpp +++ b/Externals/wxWidgets3/src/gtk/toplevel.cpp @@ -27,7 +27,6 @@ #include "wx/frame.h" #include "wx/icon.h" #include "wx/log.h" - #include "wx/app.h" #endif #include "wx/evtloop.h" @@ -41,21 +40,23 @@ #endif #ifdef GDK_WINDOWING_WAYLAND #include + #define HAS_CLIENT_DECOR +#endif +#ifdef GDK_WINDOWING_MIR + extern "C" { + #include + } + #define HAS_CLIENT_DECOR +#endif +#ifdef GDK_WINDOWING_BROADWAY + #include + #define HAS_CLIENT_DECOR #endif #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" #include "wx/gtk/private/win_gtk.h" -#if wxUSE_LIBHILDON - #include - #include -#endif // wxUSE_LIBHILDON - -#if wxUSE_LIBHILDON2 - #include -#endif // wxUSE_LIBHILDON2 - // ---------------------------------------------------------------------------- // data // ---------------------------------------------------------------------------- @@ -66,13 +67,9 @@ int wxOpenModalDialogsCount = 0; // the frame that is currently active (i.e. its child has focus). It is // used to generate wxActivateEvents static wxTopLevelWindowGTK *g_activeFrame = NULL; -static wxTopLevelWindowGTK *g_lastActiveFrame = NULL; -// if we detect that the app has got/lost the focus, we set this variable to -// either TRUE or FALSE and an activate event will be sent during the next -// OnIdle() call and it is reset to -1: this value means that we shouldn't -// send any activate events at all -static int g_sendActivateEvent = -1; +extern wxCursor g_globalCursor; +extern wxCursor g_busyCursor; #ifdef GDK_WINDOWING_X11 // Whether _NET_REQUEST_FRAME_EXTENTS support is working @@ -83,6 +80,26 @@ static enum { static bool gs_decorCacheValid; #endif +#ifdef HAS_CLIENT_DECOR +static bool HasClientDecor(GtkWidget* widget) +{ + GdkDisplay* display = gtk_widget_get_display(widget); +#ifdef GDK_WINDOWING_WAYLAND + if (GDK_IS_WAYLAND_DISPLAY(display)) + return true; +#endif +#ifdef GDK_WINDOWING_MIR + if (GDK_IS_MIR_DISPLAY(display)) + return true; +#endif +#ifdef GDK_WINDOWING_BROADWAY + if (GDK_IS_BROADWAY_DISPLAY(display)) + return true; +#endif + return false; +} +#endif // HAS_CLIENT_DECOR + //----------------------------------------------------------------------------- // RequestUserAttention related functions //----------------------------------------------------------------------------- @@ -140,24 +157,7 @@ static gboolean gtk_frame_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { - switch ( g_sendActivateEvent ) - { - case -1: - // we've got focus from outside, synthetize wxActivateEvent - g_sendActivateEvent = 1; - break; - - case 0: - // another our window just lost focus, it was already ours before - // - don't send any wxActivateEvent - g_sendActivateEvent = -1; - break; - } - g_activeFrame = win; - g_lastActiveFrame = g_activeFrame; - - // wxPrintf( wxT("active: %s\n"), win->GetTitle().c_str() ); // MR: wxRequestUserAttention related block switch( win->m_urgency_hint ) @@ -173,7 +173,6 @@ static gboolean gtk_frame_focus_in_callback( GtkWidget *widget, case -2: break; } - wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); wxActivateEvent event(wxEVT_ACTIVATE, true, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->HandleWindowEvent(event); @@ -192,18 +191,8 @@ gboolean gtk_frame_focus_out_callback(GtkWidget * WXUNUSED(widget), GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK * WXUNUSED(win)) { - // if the focus goes out of our app altogether, OnIdle() will send - // wxActivateEvent, otherwise gtk_window_focus_in_callback() will reset - // g_sendActivateEvent to -1 - g_sendActivateEvent = 0; - - // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") ); - - // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() ); - if (g_activeFrame) { - wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame); wxActivateEvent event(wxEVT_ACTIVATE, false, g_activeFrame->GetId()); event.SetEventObject(g_activeFrame); g_activeFrame->HandleWindowEvent(event); @@ -264,8 +253,24 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win) GtkAllocation a; gtk_widget_get_allocation(win->m_widget, &a); wxSize size(a.width, a.height); - size.x += win->m_decorSize.left + win->m_decorSize.right; - size.y += win->m_decorSize.top + win->m_decorSize.bottom; +#ifdef HAS_CLIENT_DECOR + if (HasClientDecor(win->m_widget)) + { + GtkAllocation a2; + gtk_widget_get_allocation(win->m_mainWidget, &a2); + wxTopLevelWindowGTK::DecorSize decorSize; + decorSize.left = a2.x; + decorSize.right = a.width - a2.width - a2.x; + decorSize.top = a2.y; + decorSize.bottom = a.height - a2.height - a2.y; + win->GTKUpdateDecorSize(decorSize); + } + else +#endif + { + size.x += win->m_decorSize.left + win->m_decorSize.right; + size.y += win->m_decorSize.top + win->m_decorSize.bottom; + } win->m_width = size.x; win->m_height = size.y; @@ -351,16 +356,24 @@ void wxTopLevelWindowGTK::GTKHandleRealized() { 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); + GdkWindow* window = gtk_widget_get_window(m_widget); + + gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor); + gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc); const wxIconBundle& icons = GetIcons(); if (icons.GetIconCount()) SetIcons(icons); + GdkCursor* cursor = g_globalCursor.GetCursor(); + if (wxIsBusy() && !gtk_window_get_modal(GTK_WINDOW(m_widget))) + cursor = g_busyCursor.GetCursor(); + + if (cursor) + gdk_window_set_cursor(window, cursor); + #ifdef __WXGTK3__ + wxGCC_WARNING_SUPPRESS(deprecated-declarations) if (gtk_window_get_has_resize_grip(GTK_WINDOW(m_widget))) { // Grip window can end up obscured, probably due to deferred show. @@ -368,6 +381,7 @@ void wxTopLevelWindowGTK::GTKHandleRealized() gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), false); gtk_window_set_has_resize_grip(GTK_WINDOW(m_widget), true); } + wxGCC_WARNING_RESTORE() #endif } @@ -442,8 +456,12 @@ 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); GdkDisplay* display = gdk_window_get_display(window); + + if (!GDK_IS_X11_DISPLAY(display)) + return false; + + static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false); Atom xproperty = gdk_x11_atom_to_xatom_for_display(display, property); Atom type; int format; @@ -571,14 +589,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, // e.g. in wxTaskBarIconAreaGTK if (m_widget == NULL) { -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // we must create HildonWindow and not a normal GtkWindow as the latter - // doesn't look correctly in Maemo environment and it must also be - // registered with the main program object - m_widget = hildon_window_new(); - hildon_program_add_window(wxTheApp->GetHildonProgram(), - HILDON_WINDOW(m_widget)); -#else // !wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) { @@ -605,7 +615,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, style |= wxFRAME_NO_TASKBAR; } } -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 g_object_ref(m_widget); } @@ -788,15 +797,6 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() g_source_remove(m_netFrameExtentsTimerId); } -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - // it can also be a (standard) dialog - if ( HILDON_IS_WINDOW(m_widget) ) - { - hildon_program_remove_window(wxTheApp->GetHildonProgram(), - HILDON_WINDOW(m_widget)); - } -#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2 - if (m_grabbed) { wxFAIL_MSG(wxT("Window still grabbed")); @@ -813,8 +813,6 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() if (g_activeFrame == this) g_activeFrame = NULL; - if (g_lastActiveFrame == this) - g_lastActiveFrame = NULL; } bool wxTopLevelWindowGTK::EnableCloseButton( bool enable ) @@ -839,9 +837,18 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) m_fsIsShowing = show; #ifdef GDK_WINDOWING_X11 - Display* xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget)); - Window xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget)); - wxX11FullScreenMethod method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot); + GdkScreen* screen = gtk_widget_get_screen(m_widget); + GdkDisplay* display = gdk_screen_get_display(screen); + Display* xdpy = NULL; + Window xroot = None; + wxX11FullScreenMethod method = wxX11_FS_WMSPEC; + + if (GDK_IS_X11_DISPLAY(display)) + { + xdpy = GDK_DISPLAY_XDISPLAY(display); + xroot = GDK_WINDOW_XID(gdk_screen_get_root_window(screen)); + method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot); + } // NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions // to switch to fullscreen, which is not always available. We must @@ -856,7 +863,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) gtk_window_unfullscreen( GTK_WINDOW( m_widget ) ); } #ifdef GDK_WINDOWING_X11 - else + else if (xdpy != NULL) { GdkWindow* window = gtk_widget_get_window(m_widget); Window xid = GDK_WINDOW_XID(window); @@ -866,7 +873,6 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) GetPosition( &m_fsSaveFrame.x, &m_fsSaveFrame.y ); GetSize( &m_fsSaveFrame.width, &m_fsSaveFrame.height ); - GdkScreen* screen = gtk_widget_get_screen(m_widget); const int screen_width = gdk_screen_get_width(screen); const int screen_height = gdk_screen_get_height(screen); @@ -935,7 +941,7 @@ void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect bool wxTopLevelWindowGTK::Show( bool show ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + wxCHECK_MSG(m_widget, false, "invalid frame"); #ifdef GDK_WINDOWING_X11 bool deferShow = show && !m_isShown && m_deferShow; @@ -944,6 +950,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) deferShow = m_deferShowAllowed && gs_requestFrameExtentsStatus != RFE_STATUS_BROKEN && !gtk_widget_get_realized(m_widget) && + GDK_IS_X11_DISPLAY(gtk_widget_get_display(m_widget)) && g_signal_handler_find(m_widget, GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET), @@ -1028,6 +1035,10 @@ bool wxTopLevelWindowGTK::Show( bool show ) wxSizeEvent event(GetSize(), GetId()); event.SetEventObject(this); HandleWindowEvent(event); + +#ifdef __WXGTK3__ + GTKSizeRevalidate(); +#endif } bool change = base_type::Show(show); @@ -1069,29 +1080,17 @@ void wxTopLevelWindowGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXU void wxTopLevelWindowGTK::GTKDoGetSize(int *width, int *height) const { wxSize size(m_width, m_height); - size.x -= m_decorSize.left + m_decorSize.right; - size.y -= m_decorSize.top + m_decorSize.bottom; +#ifdef HAS_CLIENT_DECOR + if (!HasClientDecor(m_widget)) +#endif + { + size.x -= m_decorSize.left + m_decorSize.right; + size.y -= m_decorSize.top + m_decorSize.bottom; + } if (size.x < 0) size.x = 0; if (size.y < 0) size.y = 0; -#if wxUSE_LIBHILDON2 - if (width) { - if (size.x == 720) - *width = 696; - else - *width = size.x; - } - if (height) { - if (size.y == 420) - *height = 396; - else if (size.y == 270) - *height = 246; - else - *height = size.y; - } -#else // wxUSE_LIBHILDON2 if (width) *width = size.x; if (height) *height = size.y; -#endif // wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON2 } void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags ) @@ -1116,14 +1115,6 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si m_y = y; } - if ( m_x != old_x || m_y != old_y ) - { - gtk_window_move( GTK_WINDOW(m_widget), m_x, m_y ); - wxMoveEvent event(wxPoint(m_x, m_y), GetId()); - event.SetEventObject(this); - HandleWindowEvent(event); - } - const wxSize oldSize(m_width, m_height); if (width >= 0) m_width = width; @@ -1132,6 +1123,15 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si ConstrainSize(); if (m_width < 1) m_width = 1; if (m_height < 1) m_height = 1; + + if ( m_x != old_x || m_y != old_y ) + { + gtk_window_move( GTK_WINDOW(m_widget), m_x, m_y ); + wxMoveEvent event(wxPoint(m_x, m_y), GetId()); + event.SetEventObject(this); + HandleWindowEvent(event); + } + if (m_width != oldSize.x || m_height != oldSize.y) { m_deferShowAllowed = true; @@ -1150,6 +1150,14 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si } } +extern "C" { +static gboolean reset_size_request(void* data) +{ + gtk_widget_set_size_request(GTK_WIDGET(data), -1, -1); + return false; +} +} + void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) { base_type::DoSetClientSize(width, height); @@ -1158,11 +1166,30 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) // Has to be done after calling base because it calls SetSize, // which sets this true m_deferShowAllowed = false; + + if (m_wxwindow) + { + // If window is not resizable or not yet shown, set size request on + // client widget, to make it more likely window will get correct size + // even if our decorations size cache is incorrect (as it will be before + // showing first TLW). + if (!gtk_window_get_resizable(GTK_WINDOW(m_widget))) + { + gtk_widget_set_size_request(m_widget, -1, -1); + gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight); + } + else if (!IsShown()) + { + gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight); + // Cancel size request at next idle to allow resizing + g_idle_add_full(G_PRIORITY_LOW, reset_size_request, m_wxwindow, NULL); + } + } } void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { - wxASSERT_MSG(m_widget, wxT("invalid frame")); + wxCHECK_RET(m_widget, "invalid frame"); if ( IsIconized() ) { @@ -1177,7 +1204,12 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const base_type::DoGetClientSize(width, height); else { - GTKDoGetSize(width, height); + int w = m_width - (m_decorSize.left + m_decorSize.right); + int h = m_height - (m_decorSize.top + m_decorSize.bottom); + if (w < 0) w = 0; + if (h < 0) h = 0; + if (width) *width = w; + if (height) *height = h; } } @@ -1199,8 +1231,20 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, hints.min_height = 1; hints.max_width = INT_MAX; hints.max_height = INT_MAX; - const int decorSize_x = m_decorSize.left + m_decorSize.right; - const int decorSize_y = m_decorSize.top + m_decorSize.bottom; + int decorSize_x; + int decorSize_y; +#ifdef HAS_CLIENT_DECOR + if (HasClientDecor(m_widget)) + { + decorSize_x = 0; + decorSize_y = 0; + } + else +#endif + { + decorSize_x = m_decorSize.left + m_decorSize.right; + decorSize_y = m_decorSize.top + m_decorSize.bottom; + } if (minSize.x > decorSize_x) hints.min_width = minSize.x - decorSize_x; if (minSize.y > decorSize_y) @@ -1227,11 +1271,19 @@ void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, (GtkWindow*)m_widget, NULL, &hints, (GdkWindowHints)hints_mask); } -#ifdef GDK_WINDOWING_X11 void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize) { if (!IsMaximized() && !IsFullScreen()) GetCachedDecorSize() = decorSize; + +#ifdef HAS_CLIENT_DECOR + if (HasClientDecor(m_widget)) + { + m_decorSize = decorSize; + return; + } +#endif +#ifdef GDK_WINDOWING_X11 if (m_updateDecorSize && memcmp(&m_decorSize, &decorSize, sizeof(DecorSize))) { m_useCachedClientSize = false; @@ -1243,6 +1295,15 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize) if (m_minWidth > 0 || m_minHeight > 0 || m_maxWidth > 0 || m_maxHeight > 0) { // update size hints, they depend on m_decorSize + if (!m_deferShow) + { + // if size hints match old size, assume hints were set to + // maintain current client size, and adjust hints accordingly + if (m_minWidth == m_height) m_minWidth += diff.x; + if (m_maxWidth == m_height) m_maxWidth += diff.x; + if (m_minHeight == m_height) m_minHeight += diff.y; + if (m_maxHeight == m_height) m_maxHeight += diff.y; + } DoSetSizeHints(m_minWidth, m_minHeight, m_maxWidth, m_maxHeight, m_incWidth, m_incHeight); } if (m_deferShow) @@ -1280,14 +1341,17 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize) sizeEvent.SetEventObject(this); HandleWindowEvent(sizeEvent); +#ifdef __WXGTK3__ + GTKSizeRevalidate(); +#endif gtk_widget_show(m_widget); wxShowEvent showEvent(GetId(), true); showEvent.SetEventObject(this); HandleWindowEvent(showEvent); } -} #endif // GDK_WINDOWING_X11 +} wxTopLevelWindowGTK::DecorSize& wxTopLevelWindowGTK::GetCachedDecorSize() { @@ -1306,32 +1370,13 @@ wxTopLevelWindowGTK::DecorSize& wxTopLevelWindowGTK::GetCachedDecorSize() return size[index]; } -void wxTopLevelWindowGTK::OnInternalIdle() -{ - wxTopLevelWindowBase::OnInternalIdle(); - - // Synthetize activate events. - if ( g_sendActivateEvent != -1 ) - { - bool activate = g_sendActivateEvent != 0; - - // if (!activate) wxPrintf( wxT("de") ); - // wxPrintf( wxT("activate\n") ); - - // do it only once - g_sendActivateEvent = -1; - - wxTheApp->SetActive(activate, (wxWindow *)g_lastActiveFrame); - } -} - // ---------------------------------------------------------------------------- // frame title/icon // ---------------------------------------------------------------------------- void wxTopLevelWindowGTK::SetTitle( const wxString &title ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); + wxCHECK_RET(m_widget, "invalid frame"); if ( title == m_title ) return; @@ -1343,14 +1388,12 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title ) void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) { - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - base_type::SetIcons(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 + // another TLW is realized before this one, and it has this one as its // transient parent. The life demo exibits this problem. - if (gtk_widget_get_realized(m_widget)) + if (m_widget && gtk_widget_get_realized(m_widget)) { GList* list = NULL; for (size_t i = icons.GetIconCount(); i--;) @@ -1492,17 +1535,38 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style ) bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) { - GdkWindow* window = NULL; - if (m_widget) - window = gtk_widget_get_window(m_widget); + if (m_widget == NULL) + return false; +#if GTK_CHECK_VERSION(2,12,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,12,0) == NULL) +#endif + { +#if GTK_CHECK_VERSION(3,8,0) + if(gtk_check_version(3,8,0) == NULL) + { + gtk_widget_set_opacity(m_widget, alpha / 255.0); + } + else +#endif + { + // Can't avoid using this deprecated function with older GTK+. + wxGCC_WARNING_SUPPRESS(deprecated-declarations); + gtk_window_set_opacity(GTK_WINDOW(m_widget), alpha / 255.0); + wxGCC_WARNING_RESTORE(); + } + return true; + } +#endif // GTK_CHECK_VERSION(2,12,0) +#ifndef __WXGTK3__ +#ifdef GDK_WINDOWING_X11 + GdkWindow* window = gtk_widget_get_window(m_widget); if (window == NULL) return false; -#ifdef GDK_WINDOWING_X11 Display* dpy = GDK_WINDOW_XDISPLAY(window); Window win = GDK_WINDOW_XID(window); - // Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay if (alpha == 0xff) XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False)); else @@ -1517,6 +1581,7 @@ bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha) #else // !GDK_WINDOWING_X11 return false; #endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11 +#endif // !__WXGTK3__ } bool wxTopLevelWindowGTK::CanSetTransparent() diff --git a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp index 34a16108a3..a4e3895ffb 100644 --- a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp +++ b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp @@ -20,6 +20,7 @@ #include "wx/apptrait.h" #include "wx/process.h" #include "wx/sysopt.h" +#include "wx/vector.h" #include "wx/gtk/private/timer.h" #include "wx/evtloop.h" @@ -55,11 +56,7 @@ #include "wx/gtk/private/gtk2-compat.h" -//----------------------------------------------------------------------------- -// data -//----------------------------------------------------------------------------- - -extern GtkWidget *wxGetRootWindow(); +GdkWindow* wxGetTopLevelGDK(); //---------------------------------------------------------------------------- // misc. @@ -77,7 +74,7 @@ void wxBell() #ifdef GDK_WINDOWING_X11 void *wxGetDisplay() { - return GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(wxGetRootWindow())); + return GDK_DISPLAY_XDISPLAY(gdk_window_get_display(wxGetTopLevelGDK())); } #endif @@ -100,7 +97,7 @@ bool wxColourDisplay() int wxDisplayDepth() { - return gdk_visual_get_depth(gtk_widget_get_visual(wxGetRootWindow())); + return gdk_visual_get_depth(gdk_window_get_visual(wxGetTopLevelGDK())); } wxWindow* wxFindWindowAtPoint(const wxPoint& pt) @@ -186,12 +183,16 @@ const gchar *wx_pango_version_check (int major, int minor, int micro) // wxPlatformInfo-related // ---------------------------------------------------------------------------- -wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const +wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, + int *verMin, + int *verMicro) const { if ( verMaj ) *verMaj = gtk_major_version; if ( verMin ) *verMin = gtk_minor_version; + if ( verMicro ) + *verMicro = gtk_micro_version; return wxPORT_GTK; } @@ -258,30 +259,68 @@ class StackDump : public wxStackWalker public: StackDump(GtkAssertDialog *dlg) { m_dlg=dlg; } -protected: - virtual void OnStackFrame(const wxStackFrame& frame) + void ShowStackInDialog() { - wxString fncname = frame.GetName(); + ProcessFrames(0); - // append this stack frame's info in the dialog - if (!frame.GetFileName().empty() || !fncname.empty()) + for ( wxVector::const_iterator it = m_frames.begin(); + it != m_frames.end(); + ++it ) { gtk_assert_dialog_append_stack_frame(m_dlg, - fncname.utf8_str(), - frame.GetFileName().utf8_str(), - frame.GetLine()); + it->name.utf8_str(), + it->file.utf8_str(), + it->line); } + + m_frames.clear(); + } + +protected: + virtual void OnStackFrame(const wxStackFrame& frame) wxOVERRIDE + { + const wxString name = frame.GetName(); + if ( name.StartsWith("wxOnAssert") ) + { + // Ignore all frames until the wxOnAssert() one, just as we do in + // wxAppTraitsBase::GetAssertStackTrace(). + m_frames.clear(); + return; + } + + // Also ignore frames which don't have neither the function name nor + // the file name, showing them in the dialog wouldn't provide any + // useful information. + if ( name.empty() && frame.GetFileName().empty() ) + return; + + m_frames.push_back(Frame(frame)); } private: GtkAssertDialog *m_dlg; + + struct Frame + { + explicit Frame(const wxStackFrame& f) + : name(f.GetName()), + file(f.GetFileName()), + line(f.GetLine()) + { + } + + wxString name; + wxString file; + int line; + }; + + wxVector m_frames; }; static void get_stackframe_callback(void* p) { StackDump* dump = static_cast(p); - // skip over frames up to including wxOnAssert() - dump->ProcessFrames(6); + dump->ShowStackInDialog(); } #endif // wxDEBUG_LEVEL && wxUSE_STACKWALKER @@ -299,6 +338,15 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) GtkWidget *dialog = gtk_assert_dialog_new(); gtk_assert_dialog_set_message(GTK_ASSERT_DIALOG(dialog), msg.mb_str()); + GdkDisplay* display = gtk_widget_get_display(dialog); +#ifdef __WXGTK3__ + GdkDeviceManager* manager = gdk_display_get_device_manager(display); + GdkDevice* device = gdk_device_manager_get_client_pointer(manager); + gdk_device_ungrab(device, unsigned(GDK_CURRENT_TIME)); +#else + gdk_display_pointer_ungrab(display, unsigned(GDK_CURRENT_TIME)); +#endif + #if wxUSE_STACKWALKER // save the current stack ow... StackDump dump(GTK_ASSERT_DIALOG(dialog)); @@ -318,7 +366,13 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) switch (result) { case GTK_ASSERT_DIALOG_STOP: - wxTrap(); + // Don't call wxTrap() directly from here to avoid having the + // functions between the occurrence of the assert in the code + // and this function in the call stack. Instead, just set a + // flag so that inline expansion of the assert macro we are + // called from calls wxTrap() itself, like this the debugger + // would break exactly at the assert position. + wxTrapInAssert = true; break; case GTK_ASSERT_DIALOG_CONTINUE: // nothing to do @@ -342,7 +396,7 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) #endif // __UNIX__ -#if defined(__UNIX__) || defined(__OS2__) +#if defined(__UNIX__) wxString wxGUIAppTraits::GetDesktopEnvironment() const { @@ -362,7 +416,7 @@ wxString wxGUIAppTraits::GetDesktopEnvironment() const return de; } -#endif // __UNIX__ || __OS2__ +#endif // __UNIX__ #ifdef __UNIX__ diff --git a/Externals/wxWidgets3/src/gtk/webview_webkit.cpp b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp index d1f19f9065..d371ec75ff 100644 --- a/Externals/wxWidgets3/src/gtk/webview_webkit.cpp +++ b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp @@ -136,10 +136,10 @@ wxgtk_webview_webkit_navigation(WebKitWebView *, { wxString wxuri = uri; wxSharedPtr handler; - wxVector > hanlders = webKitCtrl->GetHandlers(); + wxVector > handlers = 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) + for(wxVector >::iterator it = handlers.begin(); + it != handlers.end(); ++it) { if(wxuri.substr(0, (*it)->GetName().length()) == (*it)->GetName()) { @@ -357,11 +357,11 @@ wxgtk_webview_webkit_resource_req(WebKitWebView *, wxString uri = webkit_network_request_get_uri(request); wxSharedPtr handler; - wxVector > hanlders = webKitCtrl->GetHandlers(); + wxVector > handlers = 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) + for(wxVector >::iterator it = handlers.begin(); + it != handlers.end(); ++it) { if(uri.substr(0, (*it)->GetName().length()) == (*it)->GetName()) { @@ -774,7 +774,7 @@ wxWebViewZoom wxWebViewWebKit::GetZoom() const } // to shut up compilers, this can never be reached logically - wxASSERT(false); + wxFAIL; return wxWEBVIEW_ZOOM_MEDIUM; } @@ -805,7 +805,7 @@ void wxWebViewWebKit::SetZoom(wxWebViewZoom zoom) break; default: - wxASSERT(false); + wxFAIL; } } @@ -1051,7 +1051,6 @@ long wxWebViewWebKit::Find(const wxString& text, int flags) ClearSelection(); return wxNOT_FOUND; } - wxLogMessage(wxString::Format("Returning %d", m_findPosition)); return newSearch ? m_findCount : m_findPosition; } diff --git a/Externals/wxWidgets3/src/gtk/win_gtk.cpp b/Externals/wxWidgets3/src/gtk/win_gtk.cpp index 538305505d..ab6ddd363f 100644 --- a/Externals/wxWidgets3/src/gtk/win_gtk.cpp +++ b/Externals/wxWidgets3/src/gtk/win_gtk.cpp @@ -115,7 +115,14 @@ static void pizza_size_allocate(GtkWidget* widget, GtkAllocation* alloc) child_alloc.height = child->height; if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL) child_alloc.x = w - child_alloc.x - child_alloc.width; - gtk_widget_size_allocate(child->widget, &child_alloc); + + // GTK+3 doesn't like allocating 0 size, so don't do it. +#ifdef __WXGTK3__ + if (child_alloc.width && child_alloc.height) +#endif + { + gtk_widget_size_allocate(child->widget, &child_alloc); + } } } } @@ -192,8 +199,24 @@ static void pizza_remove(GtkContainer* container, GtkWidget* widget) } #ifdef __WXGTK3__ +// Get preferred size of children, to avoid GTK+ warnings complaining +// that they were size-allocated without asking their preferred size +static void children_get_preferred_size(const GList* p) +{ + for (; p; p = p->next) + { + const wxPizzaChild* child = static_cast(p->data); + if (gtk_widget_get_visible(child->widget)) + { + GtkRequisition req; + gtk_widget_get_preferred_size(child->widget, &req, NULL); + } + } +} + static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natural) { + children_get_preferred_size(WX_PIZZA(widget)->m_children); *minimum = 0; gtk_widget_get_size_request(widget, natural, NULL); if (*natural < 0) @@ -202,6 +225,7 @@ static void pizza_get_preferred_width(GtkWidget* widget, int* minimum, int* natu static void pizza_get_preferred_height(GtkWidget* widget, int* minimum, int* natural) { + children_get_preferred_size(WX_PIZZA(widget)->m_children); *minimum = 0; gtk_widget_get_size_request(widget, NULL, natural); if (*natural < 0) @@ -238,9 +262,9 @@ g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure *closure, gpointer arg_1, gpointer arg_2, gpointer data2); - register GMarshalFunc_VOID__OBJECT_OBJECT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; + GMarshalFunc_VOID__OBJECT_OBJECT callback; + GCClosure *cc = (GCClosure*) closure; + gpointer data1, data2; g_return_if_fail (n_param_values == 3); @@ -380,11 +404,7 @@ void wxPizza::put(GtkWidget* widget, int x, int y, int width, int height) { // Re-parenting a TLW under a child window is possible at wx level but // using a TLW as child at GTK+ level results in problems, so don't do it. -#if GTK_CHECK_VERSION(2,19,3) if (!gtk_widget_is_toplevel(GTK_WIDGET(widget))) -#else - if (!GTK_WIDGET_TOPLEVEL(GTK_WIDGET(widget))) -#endif gtk_fixed_put(GTK_FIXED(this), widget, 0, 0); wxPizzaChild* child = new wxPizzaChild; @@ -456,6 +476,7 @@ void wxPizza::get_border(GtkBorder& border) else sc = gtk_widget_get_style_context(wxGTKPrivate::GetEntryWidget()); + gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL); gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); #else // !__WXGTK3__ GtkStyle* style; diff --git a/Externals/wxWidgets3/src/gtk/window.cpp b/Externals/wxWidgets3/src/gtk/window.cpp index a16743410f..711a930d5e 100644 --- a/Externals/wxWidgets3/src/gtk/window.cpp +++ b/Externals/wxWidgets3/src/gtk/window.cpp @@ -59,7 +59,7 @@ typedef guint KeySym; // 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) +#define wxGTK_HAS_COMPOSITING_SUPPORT (GTK_CHECK_VERSION(2,12,0) && wxUSE_CAIRO) //----------------------------------------------------------------------------- // documentation on internals @@ -197,7 +197,7 @@ typedef guint KeySym; bool g_blockEventsOnDrag; // Don't allow mouse event propagation during scroll bool g_blockEventsOnScroll; -extern wxCursor g_globalCursor; +extern wxCursor g_globalCursor; // mouse capture state: the window which has it and if the mouse is currently // inside it @@ -219,6 +219,10 @@ static wxWindowGTK *gs_deferredFocusOut = NULL; GdkEvent *g_lastMouseEvent = NULL; int g_lastButtonNumber = 0; +#ifdef __WXGTK3__ +static GList* gs_sizeRevalidateList; +#endif + //----------------------------------------------------------------------------- // debug //----------------------------------------------------------------------------- @@ -237,6 +241,76 @@ const char* wxDumpGtkWidget(GtkWidget* w) return s.c_str(); } +//----------------------------------------------------------------------------- +// global top level GtkWidget/GdkWindow +//----------------------------------------------------------------------------- + +static bool wxGetTopLevel(GtkWidget** widget, GdkWindow** window) +{ + wxWindowList::const_iterator i = wxTopLevelWindows.begin(); + for (; i != wxTopLevelWindows.end(); ++i) + { + const wxWindow* win = *i; + if (win->m_widget) + { + GdkWindow* gdkwin = gtk_widget_get_window(win->m_widget); + if (gdkwin) + { + if (widget) + *widget = win->m_widget; + if (window) + *window = gdkwin; + return true; + } + } + } + return false; +} + +GdkWindow* wxGetTopLevelGDK() +{ + GdkWindow* window; + if (!wxGetTopLevel(NULL, &window)) + window = gdk_get_default_root_window(); + return window; +} + +PangoContext* wxGetPangoContext() +{ + PangoContext* context = NULL; + GtkWidget* widget; + if (wxGetTopLevel(&widget, NULL)) + { + context = gtk_widget_get_pango_context(widget); + g_object_ref(context); + } + else + { + if ( GdkScreen *screen = gdk_screen_get_default() ) + { + context = gdk_pango_context_get_for_screen(screen); + } +#ifdef PANGO_VERSION_CHECK +#if PANGO_VERSION_CHECK(1,22,0) + else // No default screen. + { + // This may happen in console applications which didn't open the + // display, use the default font map for them -- it's better than + // nothing. + if (wx_pango_version_check(1,22,0) == 0) + { + context = pango_font_map_create_context( + pango_cairo_font_map_get_default ()); + } + //else: pango_font_map_create_context() not available + } +#endif // Pango 1.22+ +#endif // PANGO_VERSION_CHECK + } + + return context; +} + //----------------------------------------------------------------------------- // "expose_event"/"draw" from m_wxwindow //----------------------------------------------------------------------------- @@ -298,9 +372,11 @@ draw_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win) { #ifdef __WXGTK3__ GtkStyleContext* sc = gtk_widget_get_style_context(win->m_wxwindow); - GdkRGBA c; - gtk_style_context_get_border_color(sc, GTK_STATE_FLAG_NORMAL, &c); - gdk_cairo_set_source_rgba(cr, &c); + GdkRGBA* c; + gtk_style_context_set_state(sc, GTK_STATE_FLAG_NORMAL); + gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, "border-color", &c, NULL); + gdk_cairo_set_source_rgba(cr, c); + gdk_rgba_free(c); cairo_set_line_width(cr, 1); cairo_rectangle(cr, x + 0.5, y + 0.5, w - 1, h - 1); cairo_stroke(cr); @@ -652,6 +728,59 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar) case GDK_F12: key_code = WXK_F1 + keysym - GDK_F1; break; +#if GTK_CHECK_VERSION(2,18,0) + case GDK_Back: + key_code = WXK_BROWSER_BACK; + break; + case GDK_Forward: + key_code = WXK_BROWSER_FORWARD; + break; + case GDK_Refresh: + key_code = WXK_BROWSER_REFRESH; + break; + case GDK_Stop: + key_code = WXK_BROWSER_STOP; + break; + case GDK_Search: + key_code = WXK_BROWSER_SEARCH; + break; + case GDK_Favorites: + key_code = WXK_BROWSER_FAVORITES; + break; + case GDK_HomePage: + key_code = WXK_BROWSER_HOME; + break; + case GDK_AudioMute: + key_code = WXK_VOLUME_MUTE; + break; + case GDK_AudioLowerVolume: + key_code = WXK_VOLUME_DOWN; + break; + case GDK_AudioRaiseVolume: + key_code = WXK_VOLUME_UP; + break; + case GDK_AudioNext: + key_code = WXK_MEDIA_NEXT_TRACK; + break; + case GDK_AudioPrev: + key_code = WXK_MEDIA_PREV_TRACK; + break; + case GDK_AudioStop: + key_code = WXK_MEDIA_STOP; + break; + case GDK_AudioPlay: + key_code = WXK_MEDIA_PLAY_PAUSE; + break; + case GDK_Mail: + key_code = WXK_LAUNCH_MAIL; + break; + case GDK_LaunchA: + key_code = WXK_LAUNCH_APP1; + break; + case GDK_LaunchB: + key_code = WXK_LAUNCH_APP2; + break; +#endif // GTK_CHECK_VERSION(2,18,0) default: key_code = 0; @@ -775,28 +904,31 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event, } #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 - // Shift) should result in the same key code in OnKeyDown(): - // '5' (although OnChar() will get either '5' or '%'). - // - // to do it we first translate keysym to keycode (== scan code) - // and then back but always using the lower register - Display *dpy = (Display *)wxGetDisplay(); - KeyCode keycode = XKeysymToKeycode(dpy, keysym); + if (GDK_IS_X11_DISPLAY(gdk_window_get_display(gdk_event->window))) + { + // 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 + // Shift) should result in the same key code in OnKeyDown(): + // '5' (although OnChar() will get either '5' or '%'). + // + // to do it we first translate keysym to keycode (== scan code) + // and then back but always using the lower register + Display *dpy = (Display *)wxGetDisplay(); + KeyCode keycode = XKeysymToKeycode(dpy, keysym); - wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode); + wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode); #ifdef HAVE_X11_XKBLIB_H - KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0); + KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0); #else - KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0); + KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0); #endif - // use the normalized, i.e. lower register, keysym if we've - // got one - key_code = keysymNormalized ? keysymNormalized : keysym; + // use the normalized, i.e. lower register, keysym if we've + // got one + key_code = keysymNormalized ? keysymNormalized : keysym; + } #else key_code = keysym; #endif @@ -924,10 +1056,13 @@ void AdjustCharEventKeyCodes(wxKeyEvent& event) // navigation will work. #define wxPROCESS_EVENT_ONCE(EventType, event) \ static EventType eventPrev; \ - if (memcmp(&eventPrev, event, sizeof(EventType)) == 0) \ + if (!gs_isNewEvent && memcmp(&eventPrev, event, sizeof(EventType)) == 0) \ return false; \ + gs_isNewEvent = false; \ eventPrev = *event +static bool gs_isNewEvent; + extern "C" { static gboolean gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), @@ -974,7 +1109,7 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), break; } - if (ancestor->IsTopLevel()) + if (ancestor->IsTopNavigationDomain(wxWindow::Navigation_Accel)) break; ancestor = ancestor->GetParent(); } @@ -1521,11 +1656,45 @@ gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), event.SetEventObject( win ); event.SetId( win->GetId() ); - bool ret = win->GTKProcessEvent(event); + // We ignore the result of the event processing here as we don't really + // want to prevent the other handlers from running even if we did process + // this event ourselves, there is no real advantage in doing this and it + // could actually be harmful, see #16055. + (void)win->GTKProcessEvent(event); g_lastMouseEvent = NULL; - return ret; + return FALSE; +} + +//----------------------------------------------------------------------------- + +static void SendSetCursorEvent(wxWindowGTK* win, int x, int y) +{ + wxPoint posClient(x, y); + const wxPoint posScreen = win->ClientToScreen(posClient); + + wxWindowGTK* w = win; + for ( ;; ) + { + wxSetCursorEvent event(posClient.x, posClient.y); + if (w->GTKProcessEvent(event)) + { + win->GTKUpdateCursor(false, false, &event.GetCursor()); + win->m_needCursorReset = true; + return; + } + // this is how wxMSW works... + if (w->GetCursor().IsOk()) + break; + + w = w->GetParent(); + if ( !w ) + break; + posClient = w->ScreenToClient(posScreen); + } + if (win->m_needCursorReset) + win->GTKUpdateCursor(); } //----------------------------------------------------------------------------- @@ -1595,13 +1764,7 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget), } if ( !g_captureWindow ) - { - wxSetCursorEvent cevent( event.m_x, event.m_y ); - if (win->GTKProcessEvent( cevent )) - { - win->SetCursor( cevent.GetCursor() ); - } - } + SendSetCursorEvent(win, event.m_x, event.m_y); bool ret = win->GTKProcessEvent(event); @@ -1616,7 +1779,7 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget), static void AdjustRangeValue(GtkRange* range, double step) { - if (range && gtk_widget_get_visible(GTK_WIDGET(range))) + if (gtk_widget_get_visible(GTK_WIDGET(range))) { GtkAdjustment* adj = gtk_range_get_adjustment(range); double value = gtk_adjustment_get_value(adj); @@ -1680,21 +1843,30 @@ scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win) delta_x = 0; } } + bool handled = false; if (delta_x) { event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL; event.m_wheelRotation = int(event.m_wheelDelta * delta_x); - if (!win->GTKProcessEvent(event)) + handled = win->GTKProcessEvent(event); + if (!handled && range_h) + { AdjustRangeValue(range_h, event.m_columnsPerAction * delta_x); + handled = true; + } } if (delta_y) { event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL; event.m_wheelRotation = int(event.m_wheelDelta * -delta_y); - if (!win->GTKProcessEvent(event)) + handled = win->GTKProcessEvent(event); + if (!handled && range_v) + { AdjustRangeValue(range_v, event.m_linesPerAction * delta_y); + handled = true; + } } - return true; + return handled; #endif // GTK_CHECK_VERSION(3,4,0) } GtkRange *range; @@ -1809,13 +1981,7 @@ gtk_window_enter_callback( GtkWidget*, InitMouseEvent(win, event, gdk_event); if ( !g_captureWindow ) - { - wxSetCursorEvent cevent( event.m_x, event.m_y ); - if (win->GTKProcessEvent( cevent )) - { - win->SetCursor( cevent.GetCursor() ); - } - } + SendSetCursorEvent(win, event.m_x, event.m_y); return win->GTKProcessEvent(event); } @@ -1831,6 +1997,9 @@ gtk_window_leave_callback( GtkWidget*, { wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win); + if (win->m_needCursorReset) + win->GTKUpdateCursor(); + // Event was emitted after an ungrab if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE; @@ -1957,6 +2126,7 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxWindow* win) win->m_y = a.y; } win->m_useCachedClientSize = true; + win->m_isGtkPositionValid = true; if (win->m_clientWidth != w || win->m_clientHeight != h) { win->m_clientWidth = w; @@ -1975,7 +2145,7 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxWindow* win) } //----------------------------------------------------------------------------- -// "grab_broken" +// "grab_broken_event" //----------------------------------------------------------------------------- #if GTK_CHECK_VERSION(2, 8, 0) @@ -1987,9 +2157,7 @@ gtk_window_grab_broken( GtkWidget*, // Mouse capture has been lost involuntarily, notify the application if(!event->keyboard && wxWindow::GetCapture() == win) { - wxMouseCaptureLostEvent evt( win->GetId() ); - evt.SetEventObject( win ); - win->HandleWindowEvent( evt ); + wxWindowGTK::GTKHandleCaptureLost(); } return false; } @@ -2019,23 +2187,37 @@ static void unrealize(GtkWidget*, wxWindow* win) win->GTKHandleUnrealize(); } +#if GTK_CHECK_VERSION(3,8,0) +//----------------------------------------------------------------------------- +// "layout" from GdkFrameClock +//----------------------------------------------------------------------------- + +static void frame_clock_layout(GdkFrameClock*, wxWindow* win) +{ + win->GTKSizeRevalidate(); +} +#endif // GTK_CHECK_VERSION(3,8,0) + } // extern "C" void wxWindowGTK::GTKHandleRealized() { - if (IsFrozen()) - DoFreeze(); - GdkWindow* const window = GTKGetDrawingWindow(); - if (m_imContext) + if (m_wxwindow) { - gtk_im_context_set_client_window - ( - m_imContext, - window ? window - : gtk_widget_get_window(m_widget) - ); + if (m_imContext == NULL) + { + // Create input method handler + m_imContext = gtk_im_multicontext_new(); + + // Cannot handle drawing preedited text yet + gtk_im_context_set_use_preedit(m_imContext, false); + + g_signal_connect(m_imContext, + "commit", G_CALLBACK(gtk_wxwindow_commit_cb), this); + } + gtk_im_context_set_client_window(m_imContext, window); } // Use composited window if background is transparent, if supported. @@ -2064,13 +2246,26 @@ void wxWindowGTK::GTKHandleRealized() } #endif + const bool isTopLevel = IsTopLevel(); +#if GTK_CHECK_VERSION(3,8,0) + if (isTopLevel && gtk_check_version(3,8,0) == NULL) + { + GdkFrameClock* clock = gtk_widget_get_frame_clock(m_widget); + if (clock && + !g_signal_handler_find(clock, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, this)) + { + g_signal_connect(clock, "layout", G_CALLBACK(frame_clock_layout), this); + } + } +#endif + wxWindowCreateEvent event(static_cast(this)); event.SetEventObject( this ); GTKProcessEvent( event ); - GTKUpdateCursor(true, false); + GTKUpdateCursor(false, true); - if (m_wxwindow && IsTopLevel()) + if (m_wxwindow && isTopLevel) { // attaching to style changed signal after realization avoids initial // changes we don't care about @@ -2088,10 +2283,7 @@ void wxWindowGTK::GTKHandleRealized() void wxWindowGTK::GTKHandleUnrealize() { - // unrealizing a frozen window seems to have some lingering effect - // preventing updates to the affected area - if (IsFrozen()) - DoThaw(); + m_isGtkPositionValid = false; if (m_wxwindow) { @@ -2161,19 +2353,6 @@ bool wxGetKeyState(wxKeyCode WXUNUSED(key)) } #endif // __WINDOWS__ -static GdkDisplay* GetDisplay() -{ - 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(); - return display; -} - wxMouseState wxGetMouseState() { wxMouseState ms; @@ -2182,7 +2361,7 @@ wxMouseState wxGetMouseState() gint y; GdkModifierType mask; - GdkDisplay* display = GetDisplay(); + GdkDisplay* display = gdk_window_get_display(wxGetTopLevelGDK()); #ifdef __WXGTK3__ GdkDeviceManager* manager = gdk_display_get_device_manager(display); GdkDevice* device = gdk_device_manager_get_client_pointer(manager); @@ -2218,7 +2397,7 @@ wxMouseState wxGetMouseState() // in wxUniv/MSW this class is abstract because it doesn't have DoPopupMenu() // method #ifdef __WXUNIVERSAL__ - IMPLEMENT_ABSTRACT_CLASS(wxWindowGTK, wxWindowBase) + wxIMPLEMENT_ABSTRACT_CLASS(wxWindowGTK, wxWindowBase); #endif // __WXUNIVERSAL__ void wxWindowGTK::Init() @@ -2235,7 +2414,7 @@ void wxWindowGTK::Init() m_height = 0; m_showOnIdle = false; - + m_needCursorReset = false; m_noExpose = false; m_nativeSizeEvent = false; #ifdef __WXGTK3__ @@ -2256,11 +2435,10 @@ void wxWindowGTK::Init() m_clientWidth = m_clientHeight = 0; m_useCachedClientSize = false; + m_isGtkPositionValid = false; m_clipPaintRegion = false; - m_cursor = *wxSTANDARD_CURSOR; - m_imContext = NULL; m_imKeyEvent = NULL; @@ -2456,15 +2634,11 @@ wxWindowGTK::~wxWindowGTK() m_imContext = 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 - // gets painted again - while (IsFrozen()) - Thaw(); - #ifdef __WXGTK3__ if (m_styleProvider) g_object_unref(m_styleProvider); + + gs_sizeRevalidateList = g_list_remove(gs_sizeRevalidateList, this); #endif if (m_widget) @@ -2505,6 +2679,10 @@ void wxWindowGTK::PostCreation() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); + GTKConnectFreezeWidget(m_widget); + if (m_wxwindow && m_wxwindow != m_widget) + GTKConnectFreezeWidget(m_wxwindow); + #if wxGTK_HAS_COMPOSITING_SUPPORT // Set RGBA visual as soon as possible to minimize the possibility that // somebody uses the wrong one. @@ -2537,15 +2715,6 @@ void wxWindowGTK::PostCreation() if (GetLayoutDirection() == wxLayout_LeftToRight) gtk_widget_set_redraw_on_allocate(m_wxwindow, HasFlag(wxFULL_REPAINT_ON_RESIZE)); } - - // Create input method handler - m_imContext = gtk_im_multicontext_new(); - - // Cannot handle drawing preedited text yet - gtk_im_context_set_use_preedit( m_imContext, FALSE ); - - g_signal_connect (m_imContext, "commit", - G_CALLBACK (gtk_wxwindow_commit_cb), this); } // focus handling @@ -2637,7 +2806,7 @@ void wxWindowGTK::PostCreation() // unless the window was created initially hidden (i.e. Hide() had been // called before Create()), we should show it at GTK+ level as well - if ( IsShown() ) + if (m_isShown) gtk_widget_show( m_widget ); } @@ -2647,8 +2816,44 @@ wxWindowGTK::GTKConnectWidget(const char *signal, wxGTKCallback callback) return g_signal_connect(m_widget, signal, callback, this); } +// GSource callback functions for source used to detect new GDK events +extern "C" { +static gboolean source_prepare(GSource*, int*) +{ + return !gs_isNewEvent; +} + +static gboolean source_check(GSource*) +{ + // 'check' will only be called if 'prepare' returned false + return false; +} + +static gboolean source_dispatch(GSource*, GSourceFunc, void*) +{ + gs_isNewEvent = true; + // don't remove this source + return true; +} +} + void wxWindowGTK::ConnectWidget( GtkWidget *widget ) { + static bool isSourceAttached; + if (!isSourceAttached) + { + // attach GSource to detect new GDK events + isSourceAttached = true; + static GSourceFuncs funcs = { + source_prepare, source_check, source_dispatch, + NULL, NULL, NULL + }; + GSource* source = g_source_new(&funcs, sizeof(GSource)); + // priority slightly higher than GDK_PRIORITY_EVENTS + g_source_set_priority(source, GDK_PRIORITY_EVENTS - 1); + g_source_attach(source, NULL); + } + g_signal_connect (widget, "key_press_event", G_CALLBACK (gtk_window_key_press_callback), this); g_signal_connect (widget, "key_release_event", @@ -2773,11 +2978,14 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags height = m_height; const bool sizeChange = m_width != width || m_height != height; + const bool positionChange = m_x != x || m_y != y; if (sizeChange) m_useCachedClientSize = false; + if (positionChange) + m_isGtkPositionValid = false; - if (sizeChange || m_x != x || m_y != y) + if (sizeChange || positionChange) { m_x = x; m_y = y; @@ -2816,7 +3024,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags bool wxWindowGTK::GTKShowFromOnIdle() { - if (IsShown() && m_showOnIdle && !gtk_widget_get_visible (m_widget)) + if (m_isShown && m_showOnIdle && !gtk_widget_get_visible(m_widget)) { GtkAllocation alloc; alloc.x = m_x; @@ -2864,7 +3072,9 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) const wxSize size = GetSize(); const wxSize clientSize = GetClientSize(); - SetSize(width + (size.x - clientSize.x), height + (size.y - clientSize.y)); + // XXX: Dolphin: This is an internal call, it should never trigger the SetSize path in derived classes. + // This fixes wxAuiToolbar setting itself to 21 pixels wide regardless of content. + wxWindowGTK::DoSetSize(wxDefaultCoord, wxDefaultCoord, width + (size.x - clientSize.x), height + (size.y - clientSize.y), wxSIZE_USE_EXISTING); } void wxWindowGTK::DoGetClientSize( int *width, int *height ) const @@ -2911,6 +3121,9 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const // nor for the ones we have but don't current show switch ( policy[i] ) { +#if GTK_CHECK_VERSION(3,16,0) + case GTK_POLICY_EXTERNAL: +#endif case GTK_POLICY_NEVER: // never shown so doesn't take any place continue; @@ -3000,13 +3213,44 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (gtk_widget_get_window(m_widget) == NULL) return; - - GdkWindow *source = NULL; + GtkWidget* widget = m_widget; if (m_wxwindow) - source = gtk_widget_get_window(m_wxwindow); - else - source = gtk_widget_get_window(m_widget); + widget = m_wxwindow; + GdkWindow* source = gtk_widget_get_window(widget); + + if ((!m_isGtkPositionValid || source == NULL) && !IsTopLevel() && m_parent) + { + m_parent->DoClientToScreen(x, y); + int xx, yy; + DoGetPosition(&xx, &yy); + if (m_wxwindow) + { + GtkBorder border; + WX_PIZZA(m_wxwindow)->get_border(border); + xx += border.left; + yy += border.top; + } + if (y) *y += yy; + if (x) + { + if (GetLayoutDirection() != wxLayout_RightToLeft) + *x += xx; + else + { + int w; + // undo RTL conversion done by parent + static_cast(m_parent)->DoGetClientSize(&w, NULL); + *x = w - *x; + + DoGetClientSize(&w, NULL); + *x += xx; + *x = w - *x; + } + } + return; + } + + wxCHECK_RET(source, "ClientToScreen failed on unrealized window"); int org_x = 0; int org_y = 0; @@ -3039,13 +3283,44 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (!gtk_widget_get_realized(m_widget)) return; - - GdkWindow *source = NULL; + GtkWidget* widget = m_widget; if (m_wxwindow) - source = gtk_widget_get_window(m_wxwindow); - else - source = gtk_widget_get_window(m_widget); + widget = m_wxwindow; + GdkWindow* source = gtk_widget_get_window(widget); + + if ((!m_isGtkPositionValid || source == NULL) && !IsTopLevel() && m_parent) + { + m_parent->DoScreenToClient(x, y); + int xx, yy; + DoGetPosition(&xx, &yy); + if (m_wxwindow) + { + GtkBorder border; + WX_PIZZA(m_wxwindow)->get_border(border); + xx += border.left; + yy += border.top; + } + if (y) *y -= yy; + if (x) + { + if (GetLayoutDirection() != wxLayout_RightToLeft) + *x -= xx; + else + { + int w; + // undo RTL conversion done by parent + static_cast(m_parent)->DoGetClientSize(&w, NULL); + *x = w - *x; + + DoGetClientSize(&w, NULL); + *x -= xx; + *x = w - *x; + } + } + return; + } + + wxCHECK_RET(source, "ScreenToClient failed on unrealized window"); int org_x = 0; int org_y = 0; @@ -3111,6 +3386,12 @@ bool wxWindowGTK::Show( bool show ) return true; } +bool wxWindowGTK::IsShown() const +{ + // return false for non-selected wxNotebook pages + return m_isShown && (m_widget == NULL || gtk_widget_get_child_visible(m_widget)); +} + void wxWindowGTK::DoEnable( bool enable ) { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); @@ -3193,6 +3474,20 @@ void wxWindowGTK::DoGetTextExtent( const wxString& string, txm.GetTextExtent(string, x, y, descent, externalLeading); } +double wxWindowGTK::GetContentScaleFactor() const +{ + double scaleFactor = 1; +#if GTK_CHECK_VERSION(3,10,0) + if (m_widget && gtk_check_version(3,10,0) == NULL) + { + GdkWindow* window = gtk_widget_get_window(m_widget); + if (window) + scaleFactor = gdk_window_get_scale_factor(window); + } +#endif + return scaleFactor; +} + void wxWindowGTK::GTKDisableFocusOutEvent() { g_signal_handlers_block_by_func( m_focusWidget, @@ -3530,32 +3825,30 @@ wxWindowGTK::AdjustForLayoutDirection(wxCoord x, void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, WindowOrder move) { wxWindowBase::DoMoveInTabOrder(win, move); - m_dirtyTabOrder = true; - wxTheApp->WakeUpIdle(); + + // Update the TAB order at GTK+ level too, but do it slightly later in case + // we're changing the TAB order of several controls at once, as is common. + wxWindow* const parent = GetParent(); + if ( parent ) + { + parent->m_dirtyTabOrder = true; + wxTheApp->WakeUpIdle(); + } } bool wxWindowGTK::DoNavigateIn(int flags) { - if ( flags & wxNavigationKeyEvent::WinChange ) - { - wxFAIL_MSG( wxT("not implemented") ); + wxWindow *parent = wxGetTopLevelParent((wxWindow *)this); + wxCHECK_MSG( parent, false, wxT("every window must have a TLW parent") ); - return false; - } - else // navigate inside the container - { - wxWindow *parent = wxGetTopLevelParent((wxWindow *)this); - wxCHECK_MSG( parent, false, wxT("every window must have a TLW parent") ); + GtkDirectionType dir; + dir = flags & wxNavigationKeyEvent::IsForward ? GTK_DIR_TAB_FORWARD + : GTK_DIR_TAB_BACKWARD; - GtkDirectionType dir; - dir = flags & wxNavigationKeyEvent::IsForward ? GTK_DIR_TAB_FORWARD - : GTK_DIR_TAB_BACKWARD; + gboolean rc; + g_signal_emit_by_name(parent->m_widget, "focus", dir, &rc); - gboolean rc; - g_signal_emit_by_name(parent->m_widget, "focus", dir, &rc); - - return rc != 0; - } + return rc != 0; } bool wxWindowGTK::GTKWidgetNeedsMnemonic() const @@ -3663,7 +3956,7 @@ void wxWindowGTK::Lower() bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { - if ( !wxWindowBase::SetCursor(cursor.IsOk() ? cursor : *wxSTANDARD_CURSOR) ) + if (!wxWindowBase::SetCursor(cursor)) return false; GTKUpdateCursor(); @@ -3671,38 +3964,63 @@ bool wxWindowGTK::SetCursor( const wxCursor &cursor ) return true; } -void wxWindowGTK::GTKUpdateCursor(bool update_self /*=true*/, bool recurse /*=true*/) +void wxWindowGTK::GTKUpdateCursor(bool isBusyOrGlobalCursor, bool isRealize, const wxCursor* overrideCursor) { - if (update_self) + m_needCursorReset = false; + + if (m_widget == NULL || !gtk_widget_get_realized(m_widget)) + return; + + // if we don't already know there is a busy/global cursor, we have to check for one + if (!isBusyOrGlobalCursor) { - wxCursor cursor(g_globalCursor.IsOk() ? g_globalCursor : GetCursor()); - if ( cursor.IsOk() ) + if (g_globalCursor.IsOk()) + isBusyOrGlobalCursor = true; + else if (wxIsBusy()) { - wxArrayGdkWindows windowsThis; - GdkWindow* window = GTKGetWindow(windowsThis); - if (window) - gdk_window_set_cursor( window, cursor.GetCursor() ); - else + wxWindow* win = wxGetTopLevelParent(static_cast(this)); + if (win && win->m_widget && !gtk_window_get_modal(GTK_WINDOW(win->m_widget))) + isBusyOrGlobalCursor = true; + } + } + GdkCursor* cursor = NULL; + if (!isBusyOrGlobalCursor) + cursor = (overrideCursor ? *overrideCursor : m_cursor).GetCursor(); + + GdkWindow* window = NULL; + if (cursor || isBusyOrGlobalCursor || !isRealize) + { + wxArrayGdkWindows windows; + window = GTKGetWindow(windows); + if (window) + gdk_window_set_cursor(window, cursor); + else + { + for (size_t i = windows.size(); i--;) { - const size_t count = windowsThis.size(); - for ( size_t n = 0; n < count; n++ ) - { - GdkWindow *win = windowsThis[n]; - // It can be zero if the window has not been realized yet. - if ( win ) - { - gdk_window_set_cursor(win, cursor.GetCursor()); - } - } + window = windows[i]; + if (window) + gdk_window_set_cursor(window, cursor); } } } - - if (recurse) + if (window && cursor == NULL && m_wxwindow == NULL && !isBusyOrGlobalCursor && !isRealize) { - for (wxWindowList::iterator it = GetChildren().begin(); it != GetChildren().end(); ++it) + void* data; + gdk_window_get_user_data(window, &data); + if (data) { - (*it)->GTKUpdateCursor( true ); +#ifdef __WXGTK3__ + const char sig_name[] = "state-flags-changed"; + GtkStateFlags state = gtk_widget_get_state_flags(GTK_WIDGET(data)); +#else + const char sig_name[] = "state-changed"; + GtkStateType state = gtk_widget_get_state(GTK_WIDGET(data)); +#endif + static unsigned sig_id = g_signal_lookup(sig_name, GTK_TYPE_WIDGET); + + // encourage native widget to restore any non-default cursors + g_signal_emit(data, sig_id, 0, state); } } } @@ -3803,7 +4121,7 @@ void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), void wxWindowGTK::Update() { - if (m_widget && gtk_widget_get_mapped(m_widget)) + if (m_widget && gtk_widget_get_mapped(m_widget) && m_width > 0 && m_height > 0) { GdkDisplay* display = gtk_widget_get_display(m_widget); // Flush everything out to the server, and wait for it to finish. @@ -3907,7 +4225,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) case wxBG_STYLE_ERASE: { #ifdef __WXGTK3__ - wxGTKCairoDC dc(cr); + wxGTKCairoDC dc(cr, static_cast(this)); #else wxWindowDC dc( (wxWindow*)this ); dc.SetDeviceClippingRegion( m_updateRegion ); @@ -4110,7 +4428,21 @@ PangoContext *wxWindowGTK::GTKGetPangoDefaultContext() return gtk_widget_get_pango_context( m_widget ); } -#ifndef __WXGTK3__ +#ifdef __WXGTK3__ +void wxWindowGTK::ApplyCssStyle(GtkCssProvider* provider, const char* style) +{ + wxCHECK_RET(m_widget, "invalid window"); + + gtk_style_context_remove_provider(gtk_widget_get_style_context(m_widget), + GTK_STYLE_PROVIDER(provider)); + + gtk_css_provider_load_from_data(provider, style, -1, NULL); + + gtk_style_context_add_provider(gtk_widget_get_style_context(m_widget), + GTK_STYLE_PROVIDER(provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); +} +#else // GTK+ < 3 GtkRcStyle* wxWindowGTK::GTKCreateWidgetStyle() { GtkRcStyle *style = gtk_rc_style_new(); @@ -4202,9 +4534,6 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle) g_object_unref(style); #endif } - - // Style change may affect GTK+'s size calculation: - InvalidateBestSize(); } void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style) @@ -4235,7 +4564,7 @@ void wxWindowGTK::GTKApplyStyle(GtkWidget* widget, GtkRcStyle* WXUNUSED_IN_GTK3( #ifdef __WXGTK3__ const PangoFontDescription* pfd = NULL; if (m_font.IsOk()) - pfd = pango_font_description_copy(m_font.GetNativeFontInfo()->description); + pfd = m_font.GetNativeFontInfo()->description; gtk_widget_override_font(widget, pfd); gtk_widget_override_color(widget, GTK_STATE_FLAG_NORMAL, m_foregroundColour); gtk_widget_override_background_color(widget, GTK_STATE_FLAG_NORMAL, m_backgroundColour); @@ -4249,6 +4578,7 @@ void wxWindowGTK::GTKApplyStyle(GtkWidget* widget, GtkRcStyle* WXUNUSED_IN_GTK3( cairo_pattern_t* pattern = NULL; if (m_backgroundColour.IsOk()) { + gtk_style_context_set_state(context, GTK_STATE_FLAG_NORMAL); gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL, "background-image", &pattern, NULL); } @@ -4325,6 +4655,35 @@ bool wxWindowGTK::IsTransparentBackgroundSupported(wxString* reason) const #endif // wxGTK_HAS_COMPOSITING_SUPPORT/!wxGTK_HAS_COMPOSITING_SUPPORT } +#ifdef __WXGTK3__ +GdkWindow* wxWindowGTK::GTKFindWindow(GtkWidget* widget) +{ + GdkWindow* window = gtk_widget_get_window(widget); + for (const GList* p = gdk_window_peek_children(window); p; p = p->next) + { + window = GDK_WINDOW(p->data); + void* data; + gdk_window_get_user_data(window, &data); + if (data == widget) + return window; + } + return NULL; +} + +void wxWindowGTK::GTKFindWindow(GtkWidget* widget, wxArrayGdkWindows& windows) +{ + GdkWindow* window = gtk_widget_get_window(widget); + for (const GList* p = gdk_window_peek_children(window); p; p = p->next) + { + window = GDK_WINDOW(p->data); + void* data; + gdk_window_get_user_data(window, &data); + if (data == widget) + windows.push_back(window); + } +} +#endif // __WXGTK3__ + // ---------------------------------------------------------------------------- // Pop-up menu stuff // ---------------------------------------------------------------------------- @@ -4361,8 +4720,6 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); - menu->UpdateUI(); - wxPoint pos; gpointer userdata; GtkMenuPositionFunc posfunc; @@ -4447,6 +4804,32 @@ GdkWindow *wxWindowGTK::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const return m_wxwindow ? GTKGetDrawingWindow() : gtk_widget_get_window(m_widget); } +#ifdef __WXGTK3__ +void wxWindowGTK::GTKSizeRevalidate() +{ + GList* next; + for (GList* p = gs_sizeRevalidateList; p; p = next) + { + next = p->next; + wxWindow* win = static_cast(p->data); + if (wxGetTopLevelParent(win) == this) + { + win->InvalidateBestSize(); + gs_sizeRevalidateList = g_list_delete_link(gs_sizeRevalidateList, p); + } + } +} + +extern "C" { +static gboolean before_resize(void* data) +{ + wxWindow* win = static_cast(data); + win->InvalidateBestSize(); + return false; +} +} +#endif // __WXGTK3__ + bool wxWindowGTK::SetFont( const wxFont &font ) { if (!wxWindowBase::SetFont(font)) @@ -4457,8 +4840,27 @@ bool wxWindowGTK::SetFont( const wxFont &font ) // apply style change (forceStyle=true so that new style is applied // even if the font changed from valid to wxNullFont): GTKApplyWidgetStyle(true); + InvalidateBestSize(); } +#ifdef __WXGTK3__ + // Starting with GTK 3.6, style information is cached, and the cache is only + // updated before resizing, or when showing a TLW. If a different size font + // is set, our best size calculation will be wrong. All we can do is + // invalidate the best size right before the style cache is updated, so any + // subsequent best size requests use the correct font. + if (gtk_check_version(3,8,0) == NULL) + gs_sizeRevalidateList = g_list_append(gs_sizeRevalidateList, this); + else if (gtk_check_version(3,6,0) == NULL) + { + wxWindow* tlw = wxGetTopLevelParent(static_cast(this)); + if (tlw->m_widget && gtk_widget_get_visible(tlw->m_widget)) + g_idle_add_full(GTK_PRIORITY_RESIZE - 1, before_resize, this, NULL); + else + gs_sizeRevalidateList = g_list_append(gs_sizeRevalidateList, this); + } +#endif + return true; } @@ -4474,10 +4876,6 @@ void wxWindowGTK::DoCaptureMouse() wxCHECK_RET( window, wxT("CaptureMouse() failed") ); - const wxCursor* cursor = &m_cursor; - if (!cursor->IsOk()) - cursor = wxSTANDARD_CURSOR; - const GdkEventMask mask = GdkEventMask( GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | @@ -4489,12 +4887,12 @@ void wxWindowGTK::DoCaptureMouse() GdkDevice* device = gdk_device_manager_get_client_pointer(manager); gdk_device_grab( device, window, GDK_OWNERSHIP_NONE, false, mask, - cursor->GetCursor(), unsigned(GDK_CURRENT_TIME)); + NULL, unsigned(GDK_CURRENT_TIME)); #else gdk_pointer_grab( window, FALSE, mask, NULL, - cursor->GetCursor(), + NULL, (guint32)GDK_CURRENT_TIME ); #endif g_captureWindow = this; @@ -4530,10 +4928,22 @@ void wxWindowGTK::DoReleaseMouse() void wxWindowGTK::GTKReleaseMouseAndNotify() { - DoReleaseMouse(); - wxMouseCaptureLostEvent evt(GetId()); - evt.SetEventObject( this ); - HandleWindowEvent( evt ); + GdkDisplay* display = gtk_widget_get_display(m_widget); +#ifdef __WXGTK3__ + GdkDeviceManager* manager = gdk_display_get_device_manager(display); + GdkDevice* device = gdk_device_manager_get_client_pointer(manager); + gdk_device_ungrab(device, unsigned(GDK_CURRENT_TIME)); +#else + gdk_display_pointer_ungrab(display, unsigned(GDK_CURRENT_TIME)); +#endif + g_captureWindow = NULL; + NotifyCaptureLost(); +} + +void wxWindowGTK::GTKHandleCaptureLost() +{ + g_captureWindow = NULL; + NotifyCaptureLost(); } /* static */ @@ -4567,12 +4977,22 @@ void wxWindowGTK::SetScrollbar(int orient, g_signal_handlers_block_by_func( sb, (void*)gtk_scrollbar_value_changed, this); + GtkAdjustment* adj = gtk_range_get_adjustment(sb); + const bool wasVisible = gtk_adjustment_get_upper(adj) > gtk_adjustment_get_page_size(adj); + + g_object_freeze_notify(G_OBJECT(adj)); gtk_range_set_increments(sb, 1, thumbVisible); - gtk_adjustment_set_page_size(gtk_range_get_adjustment(sb), thumbVisible); + gtk_adjustment_set_page_size(adj, thumbVisible); gtk_range_set_range(sb, 0, range); + g_object_thaw_notify(G_OBJECT(adj)); + gtk_range_set_value(sb, pos); m_scrollPos[dir] = gtk_range_get_value(sb); + const bool isVisible = gtk_adjustment_get_upper(adj) > gtk_adjustment_get_page_size(adj); + if (isVisible != wasVisible) + m_useCachedClientSize = false; + g_signal_handlers_unblock_by_func( sb, (void*)gtk_scrollbar_value_changed, this); } @@ -4752,7 +5172,7 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt) // Get the current mouse position. void wxGetMousePosition(int* x, int* y) { - GdkDisplay* display = GetDisplay(); + GdkDisplay* display = gdk_window_get_display(wxGetTopLevelGDK()); #ifdef __WXGTK3__ GdkDeviceManager* manager = gdk_display_get_device_manager(display); GdkDevice* device = gdk_device_manager_get_client_pointer(manager); @@ -4781,38 +5201,49 @@ GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const // freeze/thaw // ---------------------------------------------------------------------------- +extern "C" { +static gboolean draw_freeze(GtkWidget*, void*, wxWindow*) +{ + // stop other handlers from being invoked + return true; +} +} + +void wxWindowGTK::GTKConnectFreezeWidget(GtkWidget* widget) +{ +#ifdef __WXGTK3__ + gulong id = g_signal_connect(widget, "draw", G_CALLBACK(draw_freeze), this); +#else + gulong id = g_signal_connect(widget, "expose-event", G_CALLBACK(draw_freeze), this); +#endif + g_signal_handler_block(widget, id); +} + void wxWindowGTK::GTKFreezeWidget(GtkWidget* widget) { - if (widget && gtk_widget_get_has_window(widget)) - { - GdkWindow* window = gtk_widget_get_window(widget); - if (window) - gdk_window_freeze_updates(window); - } + g_signal_handlers_unblock_by_func(widget, (void*)draw_freeze, this); } void wxWindowGTK::GTKThawWidget(GtkWidget* widget) { - if (widget && gtk_widget_get_has_window(widget)) - { - GdkWindow* window = gtk_widget_get_window(widget); - if (window) - gdk_window_thaw_updates(window); - } + g_signal_handlers_block_by_func(widget, (void*)draw_freeze, this); + gtk_widget_queue_draw(widget); } void wxWindowGTK::DoFreeze() { - GtkWidget* widget = m_wxwindow; - if (widget == NULL) - widget = m_widget; - GTKFreezeWidget(widget); + wxCHECK_RET(m_widget, "invalid window"); + + GTKFreezeWidget(m_widget); + if (m_wxwindow && m_wxwindow != m_widget) + GTKFreezeWidget(m_wxwindow); } void wxWindowGTK::DoThaw() { - GtkWidget* widget = m_wxwindow; - if (widget == NULL) - widget = m_widget; - GTKThawWidget(widget); + wxCHECK_RET(m_widget, "invalid window"); + + GTKThawWidget(m_widget); + if (m_wxwindow && m_wxwindow != m_widget) + GTKThawWidget(m_wxwindow); } diff --git a/Externals/wxWidgets3/src/msw/accel.cpp b/Externals/wxWidgets3/src/msw/accel.cpp index fbe5d7494f..db0884b7e2 100644 --- a/Externals/wxWidgets3/src/msw/accel.cpp +++ b/Externals/wxWidgets3/src/msw/accel.cpp @@ -34,7 +34,7 @@ #include "wx/msw/private.h" #include "wx/msw/private/keyboard.h" -IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject); // ---------------------------------------------------------------------------- // data defining wxAcceleratorTable diff --git a/Externals/wxWidgets3/src/msw/anybutton.cpp b/Externals/wxWidgets3/src/msw/anybutton.cpp index b99e2f66e4..f5767b089e 100644 --- a/Externals/wxWidgets3/src/msw/anybutton.cpp +++ b/Externals/wxWidgets3/src/msw/anybutton.cpp @@ -44,6 +44,7 @@ #include "wx/stockitem.h" #include "wx/msw/private/button.h" #include "wx/msw/private/dc.h" +#include "wx/msw/uxtheme.h" #include "wx/private/window.h" #if wxUSE_MARKUP @@ -53,8 +54,6 @@ using namespace wxMSWImpl; #if wxUSE_UXTHEME - #include "wx/msw/uxtheme.h" - // no need to include tmschema.h #ifndef BP_PUSHBUTTON #define BP_PUSHBUTTON 1 @@ -103,10 +102,6 @@ using namespace wxMSWImpl; #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 @@ -215,7 +210,8 @@ 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 */, + : m_iml(bitmap.GetWidth(), bitmap.GetHeight(), + !bitmap.HasAlpha() /* use mask only if no alpha */, wxAnyButton::State_Max + 1 /* see "pulse" comment below */), m_hwndBtn(GetHwndOf(btn)) { @@ -522,8 +518,9 @@ 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(); + // account for the bitmap size, including the user-specified margins + const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize() + + 2*m_imageData->GetBitmapMargins(); const wxDirection dirBmp = m_imageData->GetBitmapPosition(); if ( dirBmp == wxLEFT || dirBmp == wxRIGHT ) { @@ -538,9 +535,6 @@ void wxAnyButton::AdjustForBitmapSize(wxSize &size) const 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) @@ -675,6 +669,31 @@ wxBitmap wxAnyButton::DoGetBitmap(State which) const void wxAnyButton::DoSetBitmap(const wxBitmap& bitmap, State which) { + if ( !bitmap.IsOk() ) + { + if ( m_imageData ) + { + // Normal image is special: setting it enables images for the + // button and resetting it to nothing disables all of them. + if ( which == State_Normal ) + { + delete m_imageData; + m_imageData = NULL; + } + else + { + // Replace the removed bitmap with the normal one. + wxBitmap bmpNormal = m_imageData->GetBitmap(State_Normal); + m_imageData->SetBitmap(which == State_Disabled + ? bmpNormal.ConvertToDisabled() + : bmpNormal, + which); + } + } + + return; + } + #if wxUSE_UXTHEME wxXPButtonImageData *oldData = NULL; #endif // wxUSE_UXTHEME @@ -761,9 +780,8 @@ void wxAnyButton::DoSetBitmapMargins(wxCoord x, wxCoord y) void wxAnyButton::DoSetBitmapPosition(wxDirection dir) { - wxCHECK_RET( m_imageData, "SetBitmap() must be called first" ); - - m_imageData->SetBitmapPosition(dir); + if ( m_imageData ) + m_imageData->SetBitmapPosition(dir); InvalidateBestSize(); } @@ -811,7 +829,12 @@ wxAnyButton::State GetButtonState(wxAnyButton *btn, UINT state) if ( state & ODS_DISABLED ) return wxAnyButton::State_Disabled; - if ( state & ODS_SELECTED ) + // We need to check for the pressed state of the button itself before the + // other checks because even if it is selected or current, it it still + // pressed first and foremost. + const wxAnyButton::State btnState = btn->GetNormalState(); + + if ( btnState == wxAnyButton::State_Pressed || state & ODS_SELECTED ) return wxAnyButton::State_Pressed; if ( btn->HasCapture() || btn->IsMouseInWindow() ) @@ -820,7 +843,7 @@ wxAnyButton::State GetButtonState(wxAnyButton *btn, UINT state) if ( state & ODS_FOCUS ) return wxAnyButton::State_Focused; - return btn->GetNormalState(); + return btnState; } void DrawButtonText(HDC hdc, @@ -830,56 +853,137 @@ void DrawButtonText(HDC hdc, { const wxString text = btn->GetLabel(); - if ( text.find(wxT('\n')) != wxString::npos ) + // To get a native look for owner-drawn button in disabled state (without + // theming) we must use DrawState() to draw the text label. + if ( !wxUxThemeEngine::GetIfActive() && !btn->IsEnabled() ) { - // draw multiline label + // However using DrawState() has some drawbacks: + // 1. It generally doesn't support alignment flags (except right + // alignment), so we need to align the text on our own. + // 2. It doesn't support multliline texts and there is necessary to + // draw/align multiline text line by line. - // center text horizontally in any case - flags |= DT_CENTER; - - // first we need to compute its bounding rect + // Compute bounding rect for the whole text. RECT rc; - ::CopyRect(&rc, pRect); - ::DrawText(hdc, text.t_str(), text.length(), &rc, - DT_CENTER | DT_CALCRECT); + ::SetRectEmpty(&rc); + ::DrawText(hdc, text.t_str(), text.length(), &rc, 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.t_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) + // Based on wxButton flags determine bottom edge of the drawing rect + // inside the entire button area. + int y0; if ( btn->HasFlag(wxBU_BOTTOM) ) { - flags |= DT_BOTTOM; + y0 = pRect->bottom - h; } else if ( !btn->HasFlag(wxBU_TOP) ) { - flags |= DT_VCENTER; + // DT_VCENTER + y0 = pRect->top + (pRect->bottom - pRect->top)/2 - h/2; + } + else // DT_TOP is the default + { + y0 = pRect->top; } - //else: as above, DT_TOP is the default - // notice that we must have DT_SINGLELINE for vertical alignment flags - // to work - ::DrawText(hdc, text.t_str(), text.length(), pRect, - flags | DT_SINGLELINE ); + UINT dsFlags = DSS_DISABLED; + if( flags & DT_HIDEPREFIX ) + dsFlags |= (DSS_HIDEPREFIX | DST_PREFIXTEXT); + else + dsFlags |= DST_TEXT; + + const wxArrayString lines = wxSplit(text, '\n', '\0'); + const int hLine = h / lines.size(); + for ( size_t lineNum = 0; lineNum < lines.size(); lineNum++ ) + { + // Each line must be aligned in horizontal direction individually. + ::SetRectEmpty(&rc); + ::DrawText(hdc, lines[lineNum].t_str(), lines[lineNum].length(), + &rc, DT_CALCRECT); + const LONG w = rc.right - rc.left; + + // Based on wxButton flags set horizontal position of the rect + // inside the entire button area. Text is always centered for + // multiline label. + if ( (!btn->HasFlag(wxBU_LEFT) && !btn->HasFlag(wxBU_RIGHT)) || + lines.size() > 1 ) + { + // DT_CENTER + rc.left = pRect->left + (pRect->right - pRect->left)/2 - w/2; + rc.right = rc.left + w; + } + else if ( btn->HasFlag(wxBU_RIGHT) ) + { + rc.right = pRect->right; + rc.left = rc.right - w; + } + else // DT_LEFT is the default + { + rc.left = pRect->left; + rc.right = rc.left + w; + } + + ::OffsetRect(&rc, 0, y0 + lineNum * hLine); + + ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(lines[lineNum]), + lines[lineNum].length(), + rc.left, rc.top, rc.right, rc.bottom, dsFlags); + } + } + else // Button is enabled or using themes. + { + 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.t_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.t_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.t_str(), text.length(), pRect, + flags | DT_SINGLELINE ); + } } } @@ -1099,6 +1203,11 @@ bool wxAnyButton::SetForegroundColour(const wxColour &colour) return true; } +bool wxAnyButton::MSWIsPushed() const +{ + return (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; +} + bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) { LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)wxdis; @@ -1120,7 +1229,7 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) break; } - bool pushed = (SendMessage(GetHwnd(), BM_GETSTATE, 0, 0) & BST_PUSHED) != 0; + bool pushed = MSWIsPushed(); RECT rectBtn; CopyRect(&rectBtn, &lpDIS->rcItem); @@ -1174,7 +1283,13 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) } } } - + else + { + // clear the background (and erase any previous bitmap) + COLORREF colBg = wxColourToRGB(GetBackgroundColour()); + AutoHBRUSH hbrushBackground(colBg); + FillRect(hdc, &rectBtn, hbrushBackground); + } // draw the image, if any if ( m_imageData ) diff --git a/Externals/wxWidgets3/src/msw/app.cpp b/Externals/wxWidgets3/src/msw/app.cpp index 9d9b1ce161..e808d98e97 100644 --- a/Externals/wxWidgets3/src/msw/app.cpp +++ b/Externals/wxWidgets3/src/msw/app.cpp @@ -61,19 +61,6 @@ #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS -// OLE is used for drag-and-drop, clipboard, OLE Automation..., but some -// compilers don't support it (missing headers, libs, ...) -#if defined(__GNUWIN32_OLD__) || defined(__SYMANTEC__) - #undef wxUSE_OLE - - #define wxUSE_OLE 0 -#endif // broken compilers - -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - #include - #include -#endif - #if wxUSE_OLE #include #endif @@ -112,9 +99,7 @@ // global variables // --------------------------------------------------------------------------- -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) extern void wxSetKeyboardHook(bool doIt); -#endif // because of mingw32 4.3 bug this struct can't be inside the namespace below: // see http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/110282 @@ -233,54 +218,35 @@ bool wxGUIAppTraits::DoMessageFromThreadWait() return evtLoop->Dispatch(); } -DWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread, int flags) +WXDWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread, int flags) { // We only ever dispatch messages from the main thread and, additionally, // even from the main thread we shouldn't wait for the message if we don't // have a running event loop as we would never remove them from the message // queue then and so we would enter an infinite loop as // MsgWaitForMultipleObjects() keeps returning WAIT_OBJECT_0 + 1. - if ( flags == wxTHREAD_WAIT_BLOCK || - !wxIsMainThread() || - !wxEventLoop::GetActive() ) + if ( flags == wxTHREAD_WAIT_YIELD && wxIsMainThread() ) { - // Simple blocking wait. - return DoSimpleWaitForThread(hThread); + wxMSWEventLoopBase* const + evtLoop = static_cast(wxEventLoop::GetActive()); + if ( evtLoop ) + return evtLoop->MSWWaitForThread(hThread); } - return ::MsgWaitForMultipleObjects - ( - 1, // number of objects to wait for - (HANDLE *)&hThread, // the objects - false, // wait for any objects, not all - INFINITE, // no timeout - QS_ALLINPUT | // return as soon as there are any events - QS_ALLPOSTMESSAGE - ); + // Simple blocking wait. + return DoSimpleWaitForThread(hThread); } #endif // wxUSE_THREADS -wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const +wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, + int *minVer, + int *microVer) const { - OSVERSIONINFO info; - wxZeroMemory(info); - // on Windows, the toolkit version is the same of the OS version // as Windows integrates the OS kernel with the GUI toolkit. - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if ( ::GetVersionEx(&info) ) - { - if ( majVer ) - *majVer = info.dwMajorVersion; - if ( minVer ) - *minVer = info.dwMinorVersion; - } + wxGetOsVersion(majVer, minVer, microVer); -#if defined(__WXHANDHELD__) || defined(__WXWINCE__) - return wxPORT_WINCE; -#else return wxPORT_MSW; -#endif } #if wxUSE_TIMER @@ -301,8 +267,6 @@ wxEventLoopBase* wxGUIAppTraits::CreateEventLoop() // Stuff for using console from the GUI applications // --------------------------------------------------------------------------- -#ifndef __WXWINCE__ - #if wxUSE_DYNLIB_CLASS #include @@ -415,10 +379,7 @@ bool wxConsoleStderr::DoInit() if ( !m_dllKernel32.Load(wxT("kernel32.dll")) ) return false; - typedef BOOL (WINAPI *AttachConsole_t)(DWORD dwProcessId); - AttachConsole_t wxDL_INIT_FUNC(pfn, AttachConsole, m_dllKernel32); - - if ( !pfnAttachConsole || !pfnAttachConsole(ATTACH_PARENT_PROCESS) ) + if ( !::AttachConsole(ATTACH_PARENT_PROCESS) ) return false; // console attached, set m_hStderr now to ensure that we free it in the @@ -595,8 +556,6 @@ bool wxGUIAppTraits::WriteToStderr(const wxString& WXUNUSED(text)) #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS -#endif // !__WXWINCE__ - // =========================================================================== // wxApp implementation // =========================================================================== @@ -607,13 +566,13 @@ int wxApp::m_nCmdShow = SW_SHOWNORMAL; // wxWin macros // --------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler); -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxApp, wxEvtHandler) EVT_IDLE(wxApp::OnIdle) EVT_END_SESSION(wxApp::OnEndSession) EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // class to ensure that wxAppBase::CleanUp() is called if our Initialize() // fails @@ -630,27 +589,19 @@ private: }; //// Initialize -bool wxApp::Initialize(int& argc, wxChar **argv) +bool wxApp::Initialize(int& argc_, wxChar **argv_) { - if ( !wxAppBase::Initialize(argc, argv) ) + if ( !wxAppBase::Initialize(argc_, argv_) ) return false; // ensure that base cleanup is done if we return too early wxCallBaseCleanup callBaseCleanup(this); -#if !defined(__WXMICROWIN__) InitCommonControls(); -#endif // !defined(__WXMICROWIN__) - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - SHInitExtraControls(); -#endif wxOleInitialize(); -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(true); -#endif callBaseCleanup.Dismiss(); @@ -755,9 +706,7 @@ void wxApp::CleanUp() // class method first and only then do our clean up wxAppBase::CleanUp(); -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) wxSetKeyboardHook(false); -#endif wxOleUninitialize(); @@ -798,42 +747,20 @@ void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event)) void wxApp::WakeUpIdle() { - // Send the top window a dummy message so idle handler processing will - // start up again. Doing it this way ensures that the idle handler - // wakes up in the right thread (see also wxWakeUpMainThread() which does - // the same for the main app thread only) - wxWindow * const topWindow = wxTheApp->GetTopWindow(); - if ( topWindow ) + wxEventLoopBase * const evtLoop = wxEventLoop::GetActive(); + if ( !evtLoop ) { - HWND hwndTop = GetHwndOf(topWindow); - - // Do not post WM_NULL if there's already a pending WM_NULL to avoid - // overflowing the message queue. - // - // Notice that due to a limitation of PeekMessage() API (which handles - // 0,0 range specially), we have to check the range from 0-1 instead. - // This still makes it possible to overflow the queue with WM_NULLs by - // interspersing the calles to WakeUpIdle() with windows creation but - // it should be rather hard to do it accidentally. - MSG msg; - if ( !::PeekMessage(&msg, hwndTop, 0, 1, PM_NOREMOVE) || - ::PeekMessage(&msg, hwndTop, 1, 1, PM_NOREMOVE) ) - { - if ( !::PostMessage(hwndTop, WM_NULL, 0, 0) ) - { - // should never happen - wxLogLastError(wxT("PostMessage(WM_NULL)")); - } - } + // We can't wake up the event loop if there is none and there is just + // no need to do anything in this case, any pending events will be + // handled when the event loop starts. + return; } -#if wxUSE_THREADS - else - wxWakeUpMainThread(); -#endif // wxUSE_THREADS + + evtLoop->WakeUp(); } // ---------------------------------------------------------------------------- -// other wxApp event hanlders +// other wxApp event handlers // ---------------------------------------------------------------------------- void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) @@ -873,9 +800,6 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) // system DLL versions // ---------------------------------------------------------------------------- -// these functions have trivial inline implementations for CE -#ifndef __WXWINCE__ - #if wxUSE_DYNLIB_CLASS namespace @@ -967,37 +891,6 @@ int wxApp::GetComCtl32Version() return s_verComCtl32; } -/* static */ -int wxApp::GetShell32Version() -{ - static int s_verShell32 = -1; - if ( s_verShell32 == -1 ) - { - // we're prepared to handle the errors - wxLogNull noLog; - - wxDynamicLibrary dllShell32(wxT("shell32.dll"), wxDL_VERBATIM); - if ( dllShell32.IsLoaded() ) - { - s_verShell32 = CallDllGetVersion(dllShell32); - - if ( !s_verShell32 ) - { - // there doesn't seem to be any way to distinguish between 4.00 - // and 4.70 (starting from 4.71 we have DllGetVersion()) so - // just assume it is 4.0 - s_verShell32 = 400; - } - } - else // failed load the DLL? - { - s_verShell32 = 0; - } - } - - return s_verShell32; -} - #else // !wxUSE_DYNLIB_CLASS /* static */ @@ -1006,16 +899,8 @@ int wxApp::GetComCtl32Version() return 0; } -/* static */ -int wxApp::GetShell32Version() -{ - return 0; -} - #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS -#endif // !__WXWINCE__ - #if wxUSE_EXCEPTIONS // ---------------------------------------------------------------------------- @@ -1056,3 +941,34 @@ terminate the program,\r\n\ } #endif // wxUSE_EXCEPTIONS + +// ---------------------------------------------------------------------------- +// Layout direction +// ---------------------------------------------------------------------------- + +/* static */ +wxLayoutDirection wxApp::MSWGetDefaultLayout(wxWindow* parent) +{ + wxLayoutDirection dir = wxLayout_Default; + + if ( parent ) + dir = parent->GetLayoutDirection(); + + if ( dir == wxLayout_Default ) + { + if ( wxTheApp ) + dir = wxTheApp->GetLayoutDirection(); + } + + if ( dir == wxLayout_Default ) + { + DWORD dwLayout; + if ( ::GetProcessDefaultLayout(&dwLayout) ) + { + dir = dwLayout == LAYOUT_RTL ? wxLayout_RightToLeft + : wxLayout_LeftToRight; + } + } + + return dir; +} diff --git a/Externals/wxWidgets3/src/msw/appprogress.cpp b/Externals/wxWidgets3/src/msw/appprogress.cpp new file mode 100644 index 0000000000..9c753d1e71 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/appprogress.cpp @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/appprog.cpp +// Purpose: Implementation of wxAppProgressIndicator. +// Author: Chaobin Zhang +// Created: 2014-09-05 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TASKBARBUTTON + +#ifndef WX_PRECOMP + #include "wx/toplevel.h" +#endif + +#include "wx/appprogress.h" +#include "wx/msw/taskbarbutton.h" + +// ---------------------------------------------------------------------------- +// wxAppProgressIndicator Implementation. +// ---------------------------------------------------------------------------- +wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* parent, int maxValue) + : m_maxValue(maxValue) +{ + if ( parent == NULL ) + { + for ( wxWindowList::const_iterator it = wxTopLevelWindows.begin(); + it != wxTopLevelWindows.end(); + ++it ) + { + wxTaskBarButton* const button = wxTaskBarButton::New(*it); + if ( button ) + m_taskBarButtons.push_back(button); + } + } + else + { + wxTaskBarButton* const button = wxTaskBarButton::New(parent); + if ( button ) + m_taskBarButtons.push_back(button); + } + + Reset(); + SetRange(m_maxValue); +} + +wxAppProgressIndicator::~wxAppProgressIndicator() +{ + Reset(); + + for ( size_t i = 0; i < m_taskBarButtons.size(); ++i ) + { + delete m_taskBarButtons[i]; + } +} + +bool wxAppProgressIndicator::IsAvailable() const +{ + return !m_taskBarButtons.empty(); +} + +void wxAppProgressIndicator::SetValue(int value) +{ + wxASSERT_MSG( value <= m_maxValue, wxT("invalid progress value") ); + + for ( size_t i = 0; i < m_taskBarButtons.size(); ++i ) + { + m_taskBarButtons[i]->SetProgressValue(value); + } +} + +void wxAppProgressIndicator::SetRange(int range) +{ + m_maxValue = range; + + for ( size_t i = 0; i < m_taskBarButtons.size(); ++i ) + { + m_taskBarButtons[i]->SetProgressRange(range); + } +} + +void wxAppProgressIndicator::Pulse() +{ + for ( size_t i = 0; i < m_taskBarButtons.size(); ++i ) + { + m_taskBarButtons[i]->PulseProgress(); + } +} + +void wxAppProgressIndicator::Reset() +{ + for ( size_t i = 0; i < m_taskBarButtons.size(); ++i ) + { + m_taskBarButtons[i]->SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS); + } +} + +#endif // wxUSE_TASKBARBUTTON diff --git a/Externals/wxWidgets3/src/msw/artmsw.cpp b/Externals/wxWidgets3/src/msw/artmsw.cpp index 04885e3d6b..cb5a31884b 100644 --- a/Externals/wxWidgets3/src/msw/artmsw.cpp +++ b/Externals/wxWidgets3/src/msw/artmsw.cpp @@ -150,7 +150,6 @@ static wxBitmap CreateFromStdIcon(const char *iconName, wxBitmap bmp; bmp.CopyFromIcon(icon); -#if wxUSE_IMAGE // The standard native message box icons are in message box size (32x32). // If they are requested in any size other than the default or message // box size, they must be rescaled first. @@ -159,12 +158,9 @@ static wxBitmap CreateFromStdIcon(const char *iconName, const wxSize size = wxArtProvider::GetNativeSizeHint(client); if ( size != wxDefaultSize ) { - wxImage img = bmp.ConvertToImage(); - img.Rescale(size.x, size.y); - bmp = wxBitmap(img); + wxArtProvider::RescaleBitmap(bmp, size); } } -#endif // wxUSE_IMAGE return bmp; } @@ -197,11 +193,24 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, wxIcon icon; icon.CreateFromHICON( (WXHICON)sii.hIcon ); - wxBitmap bitmap( icon ); + bitmap = wxBitmap(icon); ::DestroyIcon(sii.hIcon); if ( bitmap.IsOk() ) + { + const wxSize + sizeNeeded = size.IsFullySpecified() + ? size + : wxArtProvider::GetNativeSizeHint(client); + + if ( sizeNeeded.IsFullySpecified() && + bitmap.GetSize() != sizeNeeded ) + { + wxArtProvider::RescaleBitmap(bitmap, sizeNeeded); + } + return bitmap; + } } } #endif // wxHAS_SHGetStockIconInfo diff --git a/Externals/wxWidgets3/src/msw/bitmap.cpp b/Externals/wxWidgets3/src/msw/bitmap.cpp index 61ad4d25f8..984ad61074 100644 --- a/Externals/wxWidgets3/src/msw/bitmap.cpp +++ b/Externals/wxWidgets3/src/msw/bitmap.cpp @@ -55,6 +55,9 @@ #define CLR_INVALID ((COLORREF)-1) #endif // no CLR_INVALID +// ROP which doesn't have standard name +#define DSTERASE 0x00220326 // dest = (NOT src) AND dest + // ---------------------------------------------------------------------------- // wxBitmapRefData // ---------------------------------------------------------------------------- @@ -68,8 +71,20 @@ public: virtual void Free(); +#if wxUSE_WXDIB + // Creates a new bitmap (DDB or DIB) from the contents of the given DIB. void CopyFromDIB(const wxDIB& dib); + // Takes ownership of the given DIB. + bool AssignDIB(wxDIB& dib); + + // Also takes ownership of the given DIB, but doesn't change any other + // fields (which are supposed to be already set), and just updates + // m_hasAlpha because 32 bit DIBs always do have it. + void Set32bppHDIB(HBITMAP hdib); +#endif // wxUSE_WXDIB + + // set the mask object to use as the mask, we take ownership of it void SetMask(wxMask *mask) { @@ -118,6 +133,15 @@ public: private: void Init(); +#if wxUSE_WXDIB + // Initialize using the given DIB but use (and take ownership of) the + // bitmap handle if it is valid, assuming it's a DDB. If it's not valid, + // use the DIB handle itself taking ownership of it (i.e. wxDIB will become + // invalid when this function returns even though we take it as const + // reference because this is how it's passed to us). + void InitFromDIB(const wxDIB& dib, HBITMAP hbitmap = NULL); +#endif // wxUSE_WXDIB + // optional mask for transparent drawing wxMask *m_bitmapMask; @@ -130,10 +154,10 @@ private: // macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject); -IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject); // ============================================================================ // implementation @@ -144,19 +168,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) // ---------------------------------------------------------------------------- // decide whether we should create a DIB or a DDB for the given parameters -// -// NB: we always use DIBs under Windows CE as this is much simpler (even if -// also less efficient...) and we obviously can't use them if there is no -// DIB support compiled in at all -#ifdef __WXWINCE__ - static inline bool wxShouldCreateDIB(int, int, int, WXHDC) { return true; } - - #define ALWAYS_USE_DIB -#elif !wxUSE_WXDIB - // no sense in defining wxShouldCreateDIB() as we can't compile code - // executed if it is true, so we have to use #if's anyhow - #define NEVER_USE_DIB -#else // wxUSE_WXDIB && !__WXWINCE__ +#if wxUSE_WXDIB static inline bool wxShouldCreateDIB(int w, int h, int d, WXHDC hdc) { // here is the logic: @@ -181,6 +193,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) } #define SOMETIMES_USE_DIB +#else // !wxUSE_WXDIB + // no sense in defining wxShouldCreateDIB() as we can't compile code + // executed if it is true, so we have to use #if's anyhow + #define NEVER_USE_DIB #endif // different DIB usage scenarious // ---------------------------------------------------------------------------- @@ -212,8 +228,10 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) if (data.m_bitmapMask) m_bitmapMask = new wxMask(*data.m_bitmapMask); +#if wxUSE_WXDIB wxASSERT_MSG( !data.m_dib, wxT("can't copy bitmap locked for raw access!") ); +#endif // wxUSE_WXDIB m_hasAlpha = data.m_hasAlpha; @@ -223,6 +241,28 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data) { wxDIB dib((HBITMAP)(data.m_hBitmap)); CopyFromDIB(dib); + BITMAP bm; + if ( ::GetObject(m_hBitmap, sizeof(bm), &bm) != sizeof(bm) ) + { + wxLogLastError(wxT("GetObject(hBitmap@wxBitmapRefData)")); + } + else if ( m_depth != bm.bmBitsPixel ) + { + // We got DDB with a different colour depth then we wanted, so we + // can't use it and need to continue using the DIB instead. + wxDIB dibDst(m_width, m_height, m_depth); + if ( dibDst.IsOk() ) + { + memcpy(dibDst.GetData(), dib.GetData(), + wxDIB::GetLineSize(m_width, m_depth)*m_height); + AssignDIB(dibDst); + } + else + { + // Nothing else left to do... + m_depth = bm.bmBitsPixel; + } + } } #endif // wxUSE_WXDIB } @@ -242,40 +282,85 @@ void wxBitmapRefData::Free() { wxLogLastError(wxT("DeleteObject(hbitmap)")); } + + m_hBitmap = 0; } wxDELETE(m_bitmapMask); } -void wxBitmapRefData::CopyFromDIB(const wxDIB& dib) +#if wxUSE_WXDIB + +void wxBitmapRefData::InitFromDIB(const wxDIB& dib, HBITMAP hbitmap) { - wxCHECK_RET( !IsOk(), "bitmap already initialized" ); - wxCHECK_RET( dib.IsOk(), wxT("invalid DIB in CopyFromDIB") ); - -#ifdef SOMETIMES_USE_DIB - HBITMAP hbitmap = dib.CreateDDB(); - if ( !hbitmap ) - return; - m_isDIB = false; -#else // ALWAYS_USE_DIB - HBITMAP hbitmap = const_cast(dib).Detach(); - m_isDIB = true; -#endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB - m_width = dib.GetWidth(); m_height = dib.GetHeight(); m_depth = dib.GetDepth(); - m_hBitmap = (WXHBITMAP)hbitmap; - #if wxUSE_PALETTE wxPalette *palette = dib.CreatePalette(); if ( palette ) m_bitmapPalette = *palette; delete palette; #endif // wxUSE_PALETTE + + if ( hbitmap ) + { + // We assume it's a DDB, otherwise there would be no point in passing + // it to us in addition to the DIB. + m_isDIB = false; + } + else // No valid DDB provided + { + // Just use DIB itself. + m_isDIB = true; + + // Notice that we must not try to use the DIB after calling Detach() on + // it, e.g. this must be done after calling CreatePalette() above. + hbitmap = const_cast(dib).Detach(); + } + + // In any case, take ownership of this bitmap. + m_hBitmap = (WXHBITMAP)hbitmap; } +void wxBitmapRefData::CopyFromDIB(const wxDIB& dib) +{ + wxCHECK_RET( !IsOk(), "bitmap already initialized" ); + wxCHECK_RET( dib.IsOk(), wxT("invalid DIB in CopyFromDIB") ); + + HBITMAP hbitmap; +#ifdef SOMETIMES_USE_DIB + hbitmap = dib.CreateDDB(); +#else // ALWAYS_USE_DIB + hbitmap = NULL; +#endif // SOMETIMES_USE_DIB/ALWAYS_USE_DIB + + InitFromDIB(dib, hbitmap); +} + +bool wxBitmapRefData::AssignDIB(wxDIB& dib) +{ + if ( !dib.IsOk() ) + return false; + + Free(); + InitFromDIB(dib); + + return true; +} + +void wxBitmapRefData::Set32bppHDIB(HBITMAP hdib) +{ + Free(); + + m_isDIB = true; + m_hasAlpha = true; + m_hBitmap = hdib; +} + +#endif // wxUSE_WXDIB + // ---------------------------------------------------------------------------- // wxBitmap creation // ---------------------------------------------------------------------------- @@ -290,20 +375,113 @@ wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const return new wxBitmapRefData(*static_cast(data)); } +#if wxUSE_WXDIB +// Premultiply the values of all RGBA pixels in the given range. +static void PremultiplyPixels(unsigned char* begin, unsigned char* end) +{ + for ( unsigned char* pixels = begin; pixels < end; pixels += 4 ) + { + const unsigned char a = pixels[3]; + + pixels[0] = ((pixels[0]*a) + 127)/255; + pixels[1] = ((pixels[1]*a) + 127)/255; + pixels[2] = ((pixels[2]*a) + 127)/255; + } +} + +// Helper which examines the alpha channel for any non-0 values and also +// possibly returns the DIB with premultiplied values if it does have alpha +// (i.e. this DIB is only filled if the function returns true). +// +// The function semantics is complicated but necessary to avoid converting to +// DIB twice, which is expensive for large bitmaps, yet avoid code duplication +// between CopyFromIconOrCursor() and MSWUpdateAlpha(). +static bool CheckAlpha(HBITMAP hbmp, HBITMAP* hdib = NULL) +{ + BITMAP bm; + if ( !::GetObject(hbmp, sizeof(bm), &bm) || (bm.bmBitsPixel != 32) ) + return false; + + wxDIB dib(hbmp); + if ( !dib.IsOk() ) + return false; + + unsigned char* pixels = dib.GetData(); + unsigned char* const end = pixels + 4*dib.GetWidth()*dib.GetHeight(); + for ( ; pixels < end; pixels += 4 ) + { + if ( pixels[3] != 0 ) + { + if ( hdib ) + { + // If we do have alpha, ensure we use premultiplied data for + // our pixels as this is what the bitmaps created in other ways + // do and this is necessary for e.g. AlphaBlend() to work with + // this bitmap. + PremultiplyPixels(dib.GetData(), end); + + *hdib = dib.Detach(); + } + + return true; + } + } + + return false; +} + +// Return HDIB containing premultiplied bitmap data if the original bitmap is +// not premultiplied, otherwise return NULL. +// +// Semantics is a bit weird here again because we want to avoid throwing the +// wxDIB we create here away if possible. +// +// Also notice that this function uses a heuristics for determining whether the +// original bitmap uses premultiplied alpha or not and can return NULL for some +// bitmaps not using premultiplied alpha. And while this should be relatively +// rare in practice, we really ought to allow the user to specify this +// explicitly. +static HBITMAP CreatePremultipliedDIBIfNeeded(HBITMAP hbmp) +{ + // Check if 32-bit bitmap realy has premultiplied RGB data + // and premuliply it if necessary. + + BITMAP bm; + if ( !::GetObject(hbmp, sizeof(bm), &bm) || (bm.bmBitsPixel != 32) ) + return NULL; + + wxDIB dib(hbmp); + if ( !dib.IsOk() ) + return NULL; + + unsigned char* pixels = dib.GetData(); + unsigned char* const end = pixels + 4*dib.GetWidth()*dib.GetHeight(); + for ( ; pixels < end; pixels += 4 ) + { + const unsigned char a = pixels[3]; + if ( a > 0 && (pixels[0] > a || pixels[1] > a || pixels[2] > a) ) + { + // Data is certainly not premultiplied by alpha if any of the + // values is smaller than the value of alpha itself. + PremultiplyPixels(dib.GetData(), end); + + return dib.Detach(); + } + } + + return NULL; +} +#endif // wxUSE_WXDIB + bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, wxBitmapTransparency transp) { -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) // it may be either HICON or HCURSOR HICON hicon = (HICON)icon.GetHandle(); - ICONINFO iconInfo; - if ( !::GetIconInfo(hicon, &iconInfo) ) - { - wxLogLastError(wxT("GetIconInfo")); - + AutoIconInfo iconInfo; + if ( !iconInfo.GetFrom(hicon) ) return false; - } wxBitmapRefData *refData = new wxBitmapRefData; m_refData = refData; @@ -311,11 +489,59 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, int w = icon.GetWidth(), h = icon.GetHeight(); - refData->m_width = w; - refData->m_height = h; - refData->m_depth = wxDisplayDepth(); + if ( iconInfo.hbmColor ) + { + refData->m_width = w; + refData->m_height = h; + refData->m_depth = wxDisplayDepth(); + refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor; - refData->m_hBitmap = (WXHBITMAP)iconInfo.hbmColor; + // Reset this field to prevent it from being destroyed by AutoIconInfo, + // we took ownership of it. + iconInfo.hbmColor = 0; + } + else // we only have monochrome icon/cursor + { + // For monochrome icons/cursor bitmap mask is of height 2*h + // and contains both AND and XOR masks. + // AND mask: 0 <= y <= h-1 + // XOR mask: h <= y <= 2*h-1 + // First we need to extract and store XOR mask from this bitmap. + HBITMAP hbmp = ::CreateBitmap(w, h, 1, wxDisplayDepth(), NULL); + if ( !hbmp ) + { + wxLogLastError(wxT("wxBitmap::CopyFromIconOrCursor - CreateBitmap")); + } + else + { + MemoryHDC dcSrc; + MemoryHDC dcDst; + SelectInHDC selSrc(dcSrc, iconInfo.hbmMask); + SelectInHDC selDst(dcDst, hbmp); + if ( !::BitBlt((HDC)dcDst, 0, 0, w, h, + (HDC)dcSrc, 0, h, + SRCCOPY) ) + { + wxLogLastError(wxT("wxBitmap::CopyFromIconOrCursor - BitBlt")); + } + // Prepare the AND mask to be compatible with wxBitmap mask + // by seting its bits to 0 wherever XOR mask (image) bits are set to 1. + // This is done in-place by applying the following ROP: + // dest = dest AND (NOT src) where dest=AND mask, src=XOR mask + // + // AND mask will be extracted later at creation of inverted mask. + if ( !::BitBlt((HDC)dcSrc, 0, 0, w, h, + (HDC)dcSrc, 0, h, + DSTERASE) ) + { + wxLogLastError(wxT("wxBitmap::CopyFromIconOrCursor - BitBlt")); + } + } + refData->m_width = w; + refData->m_height = h; + refData->m_depth = wxDisplayDepth(); + refData->m_hBitmap = hbmp; + } switch ( transp ) { @@ -330,49 +556,11 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, #if wxUSE_WXDIB // If the icon is 32 bits per pixel then it may have alpha channel // data, although there are some icons that are 32 bpp but have no - // alpha... So convert to a DIB and manually check the 4th byte for - // each pixel. + // alpha, so check for this. { - BITMAP bm; - if ( ::GetObject(iconInfo.hbmColor, sizeof(bm), &bm) && - (bm.bmBitsPixel == 32) ) - { - wxDIB dib(iconInfo.hbmColor); - if (dib.IsOk()) - { - unsigned char* const pixels = dib.GetData(); - int idx; - for ( idx = 0; idx < w*h*4; idx += 4 ) - { - if (pixels[idx+3] != 0) - { - // If there is an alpha byte that is non-zero - // then set the alpha flag and stop checking - refData->m_hasAlpha = true; - break; - } - } - - if ( refData->m_hasAlpha ) - { - // If we do have alpha, ensure we use premultiplied - // data for our pixels as this is what the bitmaps - // created in other ways do and this is necessary - // for e.g. AlphaBlend() to work with this bitmap. - for ( idx = 0; idx < w*h*4; idx += 4 ) - { - const unsigned char a = pixels[idx+3]; - - pixels[idx] = ((pixels[idx] *a) + 127)/255; - pixels[idx+1] = ((pixels[idx+1]*a) + 127)/255; - pixels[idx+2] = ((pixels[idx+2]*a) + 127)/255; - } - - ::DeleteObject(refData->m_hBitmap); - refData->m_hBitmap = dib.Detach(); - } - } - } + HBITMAP hdib = 0; + if ( CheckAlpha(refData->m_hBitmap, &hdib) ) + refData->Set32bppHDIB(hdib); } break; #endif // wxUSE_WXDIB @@ -389,16 +577,7 @@ bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon, refData->SetMask(wxInvertMask(iconInfo.hbmMask, w, h)); } - // delete the old one now as we don't need it any more - ::DeleteObject(iconInfo.hbmMask); - return true; -#else // __WXMICROWIN__ || __WXWINCE__ - wxUnusedVar(icon); - wxUnusedVar(transp); - - return false; -#endif // !__WXWINCE__/__WXWINCE__ } bool wxBitmap::CopyFromCursor(const wxCursor& cursor, wxBitmapTransparency transp) @@ -421,7 +600,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon, wxBitmapTransparency transp) return CopyFromIconOrCursor(icon, transp); } -#ifndef NEVER_USE_DIB +#if wxUSE_WXDIB bool wxBitmap::CopyFromDIB(const wxDIB& dib) { @@ -435,7 +614,27 @@ bool wxBitmap::CopyFromDIB(const wxDIB& dib) return true; } -#endif // NEVER_USE_DIB +bool wxBitmap::IsDIB() const +{ + return GetBitmapData() && GetBitmapData()->m_isDIB; +} + +bool wxBitmap::ConvertToDIB() +{ + if ( IsDIB() ) + return true; + + wxDIB dib(*this); + if ( !dib.IsOk() ) + return false; + + // It is important to reuse the current GetBitmapData() instead of creating + // a new one, as our object identity shouldn't change just because our + // internal representation did, but IsSameAs() compares data pointers. + return GetBitmapData()->AssignDIB(dib); +} + +#endif // wxUSE_WXDIB wxBitmap::~wxBitmap() { @@ -443,7 +642,6 @@ wxBitmap::~wxBitmap() wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) { -#ifndef __WXMICROWIN__ wxBitmapRefData *refData = new wxBitmapRefData; m_refData = refData; @@ -471,7 +669,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) unsigned char val = *src++; unsigned char reversed = 0; - for ( int bits = 0; bits < 8; bits++) + for ( int bit = 0; bit < 8; bit++) { reversed <<= 1; reversed |= (unsigned char)(val & 0x01); @@ -502,7 +700,6 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) } SetHBITMAP((WXHBITMAP)hbmp); -#endif } wxBitmap::wxBitmap(int w, int h, const wxDC& dc) @@ -541,6 +738,8 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) { UnRef(); + wxCHECK_MSG( w > 0 && h > 0, false, wxT("invalid bitmap size") ); + m_refData = new wxBitmapRefData; GetBitmapData()->m_width = w; @@ -571,7 +770,6 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) #endif // NEVER_USE_DIB { #ifndef ALWAYS_USE_DIB -#ifndef __WXMICROWIN__ if ( d > 0 ) { hbmp = ::CreateBitmap(w, h, 1, d, NULL); @@ -583,7 +781,6 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) GetBitmapData()->m_depth = d; } else // d == 0, create bitmap compatible with the screen -#endif // !__WXMICROWIN__ { ScreenHDC dc; hbmp = ::CreateCompatibleBitmap(dc, w, h); @@ -604,193 +801,6 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) #if wxUSE_IMAGE -// ---------------------------------------------------------------------------- -// wxImage to/from conversions for Microwin -// ---------------------------------------------------------------------------- - -// Microwin versions are so different from normal ones that it really doesn't -// make sense to use #ifdefs inside the function bodies -#ifdef __WXMICROWIN__ - -bool wxBitmap::CreateFromImage(const wxImage& image, int depth, const wxDC& dc) -{ - // Set this to 1 to experiment with mask code, - // which currently doesn't work - #define USE_MASKS 0 - - m_refData = new wxBitmapRefData(); - - // Initial attempt at a simple-minded implementation. - // The bitmap will always be created at the screen depth, - // so the 'depth' argument is ignored. - - HDC hScreenDC = ::GetDC(NULL); - int screenDepth = ::GetDeviceCaps(hScreenDC, BITSPIXEL); - - HBITMAP hBitmap = ::CreateCompatibleBitmap(hScreenDC, image.GetWidth(), image.GetHeight()); - HBITMAP hMaskBitmap = NULL; - HBITMAP hOldMaskBitmap = NULL; - HDC hMaskDC = NULL; - unsigned char maskR = 0; - unsigned char maskG = 0; - unsigned char maskB = 0; - - // printf("Created bitmap %d\n", (int) hBitmap); - if (hBitmap == NULL) - { - ::ReleaseDC(NULL, hScreenDC); - return false; - } - HDC hMemDC = ::CreateCompatibleDC(hScreenDC); - - HBITMAP hOldBitmap = ::SelectObject(hMemDC, hBitmap); - ::ReleaseDC(NULL, hScreenDC); - - // created an mono-bitmap for the possible mask - bool hasMask = image.HasMask(); - - if ( hasMask ) - { -#if USE_MASKS - // FIXME: we should be able to pass bpp = 1, but - // GdBlit can't handle a different depth -#if 0 - hMaskBitmap = ::CreateBitmap( (WORD)image.GetWidth(), (WORD)image.GetHeight(), 1, 1, NULL ); -#else - hMaskBitmap = ::CreateCompatibleBitmap( hMemDC, (WORD)image.GetWidth(), (WORD)image.GetHeight()); -#endif - maskR = image.GetMaskRed(); - maskG = image.GetMaskGreen(); - maskB = image.GetMaskBlue(); - - if (!hMaskBitmap) - { - hasMask = false; - } - else - { - hScreenDC = ::GetDC(NULL); - hMaskDC = ::CreateCompatibleDC(hScreenDC); - ::ReleaseDC(NULL, hScreenDC); - - hOldMaskBitmap = ::SelectObject( hMaskDC, hMaskBitmap); - } -#else - hasMask = false; -#endif - } - - int i, j; - for (i = 0; i < image.GetWidth(); i++) - { - for (j = 0; j < image.GetHeight(); j++) - { - unsigned char red = image.GetRed(i, j); - unsigned char green = image.GetGreen(i, j); - unsigned char blue = image.GetBlue(i, j); - - ::SetPixel(hMemDC, i, j, PALETTERGB(red, green, blue)); - - if (hasMask) - { - // scan the bitmap for the transparent colour and set the corresponding - // pixels in the mask to BLACK and the rest to WHITE - if (maskR == red && maskG == green && maskB == blue) - ::SetPixel(hMaskDC, i, j, PALETTERGB(0, 0, 0)); - else - ::SetPixel(hMaskDC, i, j, PALETTERGB(255, 255, 255)); - } - } - } - - ::SelectObject(hMemDC, hOldBitmap); - ::DeleteDC(hMemDC); - if (hasMask) - { - ::SelectObject(hMaskDC, hOldMaskBitmap); - ::DeleteDC(hMaskDC); - - ((wxBitmapRefData*)m_refData)->SetMask(hMaskBitmap); - } - - SetWidth(image.GetWidth()); - SetHeight(image.GetHeight()); - SetDepth(screenDepth); - SetHBITMAP( (WXHBITMAP) hBitmap ); - -#if wxUSE_PALETTE - // Copy the palette from the source image - SetPalette(image.GetPalette()); -#endif // wxUSE_PALETTE - - return true; -} - -wxImage wxBitmap::ConvertToImage() const -{ - // Initial attempt at a simple-minded implementation. - // The bitmap will always be created at the screen depth, - // so the 'depth' argument is ignored. - // TODO: transparency (create a mask image) - - if (!IsOk()) - { - wxFAIL_MSG( wxT("bitmap is invalid") ); - return wxNullImage; - } - - wxImage image; - - wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid bitmap") ); - - // create an wxImage object - int width = GetWidth(); - int height = GetHeight(); - image.Create( width, height ); - unsigned char *data = image.GetData(); - if( !data ) - { - wxFAIL_MSG( wxT("could not allocate data for image") ); - return wxNullImage; - } - - HDC hScreenDC = ::GetDC(NULL); - - HDC hMemDC = ::CreateCompatibleDC(hScreenDC); - ::ReleaseDC(NULL, hScreenDC); - - HBITMAP hBitmap = (HBITMAP) GetHBITMAP(); - - HBITMAP hOldBitmap = ::SelectObject(hMemDC, hBitmap); - - int i, j; - for (i = 0; i < GetWidth(); i++) - { - for (j = 0; j < GetHeight(); j++) - { - COLORREF color = ::GetPixel(hMemDC, i, j); - unsigned char red = GetRValue(color); - unsigned char green = GetGValue(color); - unsigned char blue = GetBValue(color); - - image.SetRGB(i, j, red, green, blue); - } - } - - ::SelectObject(hMemDC, hOldBitmap); - ::DeleteDC(hMemDC); - -#if wxUSE_PALETTE - // Copy the palette from the source image - if (GetPalette()) - image.SetPalette(* GetPalette()); -#endif // wxUSE_PALETTE - - return image; -} - -#endif // __WXMICROWIN__ - // ---------------------------------------------------------------------------- // wxImage to/from conversions // ---------------------------------------------------------------------------- @@ -922,7 +932,14 @@ wxImage wxBitmap::ConvertToImage() const } // and then DIB to our wxImage - wxImage image = dib.ConvertToImage(); + // By default, we autodetect the presence of alpha and consider unnecessary + // to create the alpha channel in wxImage if we don't have any effective + // alpha in the bitmap because its depth, on its own, is not an indicator + // that it uses alpha as it could be just the default screen depth. However + // if the user had explicitly called UseAlpha(), then we consider + // that the resulting image should really have the alpha channel too. + wxImage image = dib.ConvertToImage(HasAlpha() ? + wxDIB::Convert_AlphaAlwaysIf32bpp : wxDIB::Convert_AlphaAuto); if ( !image.IsOk() ) { return wxNullImage; @@ -1027,7 +1044,19 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type) { m_refData = new wxBitmapRefData; - return handler->LoadFile(this, filename, type, -1, -1); + if ( !handler->LoadFile(this, filename, type, -1, -1) ) + return false; + +#if wxUSE_WXDIB + // wxBitmap must contain premultiplied data, but external files are not + // always in this format, so try to detect whether this is the case and + // create a premultiplied DIB if it really is. + HBITMAP hdib = CreatePremultipliedDIBIfNeeded(GetHbitmap()); + if ( hdib ) + static_cast(m_refData)->Set32bppHDIB(hdib); +#endif // wxUSE_WXDIB + + return true; } #if wxUSE_IMAGE && wxUSE_WXDIB else // no bitmap handler found @@ -1109,7 +1138,6 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const wxBitmap ret( rect.width, rect.height, GetDepth() ); wxASSERT_MSG( ret.IsOk(), wxT("GetSubBitmap error") ); -#ifndef __WXMICROWIN__ // handle alpha channel, if any if (HasAlpha()) ret.UseAlpha(); @@ -1150,7 +1178,6 @@ wxBitmap wxBitmap::GetSubBitmapOfHDC( const wxRect& rect, WXHDC hdc ) const wxMask *mask = new wxMask((WXHBITMAP) hbmpMask); ret.SetMask(mask); } -#endif // !__WXMICROWIN__ return ret; } @@ -1181,10 +1208,16 @@ wxDC *wxBitmap::GetSelectedInto() const #endif } -void wxBitmap::UseAlpha() +void wxBitmap::UseAlpha(bool use) { if ( GetBitmapData() ) - GetBitmapData()->m_hasAlpha = true; + { + // Only 32bpp bitmaps can contain alpha channel. + if ( use && GetBitmapData()->m_depth < 32 ) + use = false; + + GetBitmapData()->m_hasAlpha = use; + } } bool wxBitmap::HasAlpha() const @@ -1192,6 +1225,16 @@ bool wxBitmap::HasAlpha() const return GetBitmapData() && GetBitmapData()->m_hasAlpha; } +void wxBitmap::MSWUpdateAlpha() +{ +#if wxUSE_WXDIB + if ( CheckAlpha(GetHbitmap()) ) + GetBitmapData()->m_hasAlpha = true; +#else // !wxUSE_WXDIB + GetBitmapData()->m_hasAlpha = false; +#endif // wxUSE_WXDIB/!wxUSE_WXDIB +} + // ---------------------------------------------------------------------------- // wxBitmap setters // ---------------------------------------------------------------------------- @@ -1329,7 +1372,8 @@ void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) wxDIB *dib = GetBitmapData()->m_dib; GetBitmapData()->m_dib = NULL; - // TODO: convert + GetBitmapData()->Free(); + GetBitmapData()->CopyFromDIB(*dib); delete dib; } @@ -1411,7 +1455,6 @@ wxMask::~wxMask() // Create a mask from a mono bitmap (copies the bitmap). bool wxMask::Create(const wxBitmap& bitmap) { -#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.IsOk() && bitmap.GetDepth() == 1, false, wxT("can't create mask from invalid or not monochrome bitmap") ); @@ -1436,10 +1479,6 @@ bool wxMask::Create(const wxBitmap& bitmap) SelectObject(destDC, 0); DeleteDC(destDC); return true; -#else - wxUnusedVar(bitmap); - return false; -#endif } // Create a mask from a bitmap and a palette index indicating @@ -1471,7 +1510,6 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) // the transparent area bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) { -#ifndef __WXMICROWIN__ wxCHECK_MSG( bitmap.IsOk(), false, wxT("invalid bitmap in wxMask::Create") ); if ( m_maskBitmap ) @@ -1532,17 +1570,45 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) ::DeleteDC(destDC); return ok; -#else // __WXMICROWIN__ - wxUnusedVar(bitmap); - wxUnusedVar(colour); - return false; -#endif // __WXMICROWIN__/!__WXMICROWIN__ } wxBitmap wxMask::GetBitmap() const { + // We have to do a deep copy of the mask bitmap + // and assign it to the resulting wxBitmap. + + // Create new bitmap with the same parameters as a mask bitmap. + BITMAP bm; + ::GetObject(m_maskBitmap, sizeof(bm), (LPVOID)&bm); + + HBITMAP hNewBitmap = ::CreateBitmapIndirect(&bm); + if ( !hNewBitmap ) + { + wxLogLastError(wxS("CreateBitmapIndirect")); + return wxNullBitmap; + } + + // Copy the bitmap. + HDC hdcSrc = ::CreateCompatibleDC((HDC)NULL); + HBITMAP hSrcOldBmp = (HBITMAP)::SelectObject(hdcSrc, m_maskBitmap); + + HDC hdcMem = ::CreateCompatibleDC((HDC)NULL); + HBITMAP hMemOldBmp = (HBITMAP)::SelectObject(hdcMem, hNewBitmap); + + ::BitBlt(hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY); + ::SelectObject(hdcMem, hMemOldBmp); + + // Clean up. + ::SelectObject(hdcSrc, hSrcOldBmp); + ::DeleteDC(hdcSrc); + ::DeleteDC(hdcMem); + + // Create and return a new wxBitmap. wxBitmap bmp; - bmp.SetHBITMAP(m_maskBitmap); + bmp.SetHBITMAP((WXHBITMAP)hNewBitmap); + bmp.SetSize(bm.bmWidth, bm.bmHeight); + bmp.SetDepth(bm.bmPlanes); + return bmp; } @@ -1720,7 +1786,6 @@ HCURSOR wxBitmapToHCURSOR(const wxBitmap& bmp, int hotSpotX, int hotSpotY) HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) { -#ifndef __WXMICROWIN__ wxCHECK_MSG( hbmpMask, 0, wxT("invalid bitmap in wxInvertMask") ); // get width/height from the bitmap if not given @@ -1762,7 +1827,4 @@ HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h) ::DeleteDC(hdcDst); return hbmpInvMask; -#else - return 0; -#endif } diff --git a/Externals/wxWidgets3/src/msw/bmpbuttn.cpp b/Externals/wxWidgets3/src/msw/bmpbuttn.cpp index 42eddf7fd4..cf16308670 100644 --- a/Externals/wxWidgets3/src/msw/bmpbuttn.cpp +++ b/Externals/wxWidgets3/src/msw/bmpbuttn.cpp @@ -53,9 +53,9 @@ // macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase) +wxBEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase) EVT_SYS_COLOUR_CHANGED(wxBitmapButton::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() /* TODO PROPERTIES : diff --git a/Externals/wxWidgets3/src/msw/bmpcbox.cpp b/Externals/wxWidgets3/src/msw/bmpcbox.cpp index f6d5950a02..124b9b78f1 100644 --- a/Externals/wxWidgets3/src/msw/bmpcbox.cpp +++ b/Externals/wxWidgets3/src/msw/bmpcbox.cpp @@ -47,12 +47,12 @@ // ============================================================================ -BEGIN_EVENT_TABLE(wxBitmapComboBox, wxComboBox) +wxBEGIN_EVENT_TABLE(wxBitmapComboBox, wxComboBox) EVT_SIZE(wxBitmapComboBox::OnSize) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxComboBox) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBox, wxComboBox); // ---------------------------------------------------------------------------- @@ -311,32 +311,96 @@ int wxBitmapComboBox::DoInsertItems(const wxArrayStringsAdapter & items, void **clientData, wxClientDataType type) { const unsigned int numItems = items.GetCount(); - const unsigned int countNew = GetCount() + numItems; - wxASSERT( numItems == 1 || !HasFlag(wxCB_SORT) ); // Sanity check - - m_bitmaps.Alloc(countNew); - - for ( unsigned int i = 0; i < numItems; i++ ) + int index; + if ( HasFlag(wxCB_SORT) ) { - m_bitmaps.Insert(new wxBitmap(wxNullBitmap), pos + i); + // Since we don't know at what positions new elements will be actually inserted + // we need to add them one by one, check for each one the position it was added at + // and reserve the slot for corresponding bitmap at the same postion in the bitmap array. + index = pos; + for ( unsigned int i = 0; i < numItems; i++ ) + { + if ( clientData ) + index = wxComboBox::DoInsertItems(items[i], pos+i, clientData+i, type); + else + index = wxComboBox::DoInsertItems(items[i], pos+i, NULL, wxClientData_None); + + wxASSERT_MSG( index != wxNOT_FOUND, wxS("Invalid wxBitmapComboBox state") ); + if ( index == wxNOT_FOUND ) + { + continue; + } + + // Update the bitmap array. + if ( GetCount() > m_bitmaps.Count() ) + { + wxASSERT_MSG( GetCount() == m_bitmaps.Count() + 1, + wxS("Invalid wxBitmapComboBox state") ); + // Control is in the normal state. + // New item has been just added. + // Insert bitmap at the given index into the array. + wxASSERT_MSG( (size_t)index <= m_bitmaps.Count(), + wxS("wxBitmapComboBox item index out of bound") ); + m_bitmaps.Insert(new wxBitmap(wxNullBitmap), index); + } + else + { + // No. of items after insertion <= No. bitmaps: + // (This can happen if control is e.g. recreated with RecreateControl). + // In this case existing bitmaps are reused. + // Required and actual indices should be the same to assure + // consistency between list of items and bitmap array. + wxASSERT_MSG( (size_t)index < m_bitmaps.Count(), + wxS("wxBitmapComboBox item index out of bound") ); + wxASSERT_MSG( (unsigned int)index == pos+i, + wxS("Invalid index for wxBitmapComboBox item") ); + } + } } - - const int index = wxComboBox::DoInsertItems(items, pos, - clientData, type); - - if ( index == wxNOT_FOUND ) + else { - for ( int i = numItems-1; i >= 0; i-- ) - BCBDoDeleteOneItem(pos + i); - } - else if ( ((unsigned int)index) != pos ) - { - // Move pre-inserted empty bitmap into correct position - // (usually happens when combo box has wxCB_SORT style) - wxBitmap* bmp = static_cast(m_bitmaps[pos]); - m_bitmaps.RemoveAt(pos); - m_bitmaps.Insert(bmp, index); + if ( GetCount() == m_bitmaps.Count() ) + { + // Control is in the normal state. + // Just insert new bitmaps into the array. + const unsigned int countNew = GetCount() + numItems; + m_bitmaps.Alloc(countNew); + + for ( unsigned int i = 0; i < numItems; i++ ) + { + m_bitmaps.Insert(new wxBitmap(wxNullBitmap), pos + i); + } + } + else + { + wxASSERT_MSG( GetCount() < m_bitmaps.Count(), + wxS("Invalid wxBitmapComboBox state") ); + // There are less items then bitmaps. + // (This can happen if control is e.g. recreated with RecreateControl). + // In this case existing bitmaps are reused. + // The whole block of inserted items should be within the range + // of indices of the existing bitmap array. + wxASSERT_MSG( pos + numItems <= m_bitmaps.Count(), + wxS("wxBitmapComboBox item index out of bound") ); + } + + index = wxComboBox::DoInsertItems(items, pos, + clientData, type); + // This returns index of the last item in the inserted block. + + if ( index == wxNOT_FOUND ) + { + for ( int i = numItems-1; i >= 0; i-- ) + BCBDoDeleteOneItem(pos + i); + } + else + { + // Index of the last inserted item should be consistent + // with required position and number of items. + wxASSERT_MSG( (unsigned int)index == pos+numItems-1, + wxS("Invalid index for wxBitmapComboBox item") ); + } } return index; @@ -409,7 +473,7 @@ bool wxBitmapComboBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) // Draw default for item -1, which means 'focus rect only' if ( pos == -1 ) - return FALSE; + return false; int flags = 0; if ( lpDrawItem->itemState & ODS_COMBOBOXEDIT ) @@ -417,22 +481,30 @@ bool wxBitmapComboBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) if ( lpDrawItem->itemState & ODS_SELECTED ) flags |= wxODCB_PAINTING_SELECTED; + wxPaintDCEx dc(this, lpDrawItem->hDC); + wxRect rect = wxRectFromRECT(lpDrawItem->rcItem); + wxBitmapComboBoxBase::DrawBackground(dc, rect, pos, flags); + wxString text; if ( flags & wxODCB_PAINTING_CONTROL ) { - text = GetValue(); + // Don't draw anything in the editable selection field. if ( !HasFlag(wxCB_READONLY) ) - text.clear(); + return true; + + pos = GetSelection(); + // Skip drawing if there is nothing selected. + if ( pos < 0 ) + return true; + + text = GetValue(); } else { text = GetString(pos); } - wxPaintDCEx dc(this, lpDrawItem->hDC); - wxRect rect = wxRectFromRECT(lpDrawItem->rcItem); - wxBitmapComboBoxBase::DrawBackground(dc, rect, pos, flags); wxBitmapComboBoxBase::DrawItem(dc, rect, pos, text, flags); // If the item has the focus, draw focus rectangle. @@ -441,7 +513,7 @@ bool wxBitmapComboBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) //if ( lpDrawItem->itemState & ODS_FOCUS ) // DrawFocusRect(lpDrawItem->hDC, &lpDrawItem->rcItem); - return TRUE; + return true; } bool wxBitmapComboBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) @@ -449,9 +521,14 @@ bool wxBitmapComboBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) LPMEASUREITEMSTRUCT lpMeasureItem = (LPMEASUREITEMSTRUCT) item; int pos = lpMeasureItem->itemID; - lpMeasureItem->itemHeight = wxBitmapComboBoxBase::MeasureItem(pos); + // Measure edit field height if item list is not empty, + // otherwise leave default system value. + if ( m_usedImgSize.y >= 0 || pos >= 0 ) + { + lpMeasureItem->itemHeight = wxBitmapComboBoxBase::MeasureItem(pos); + } - return TRUE; + return true; } #endif // wxUSE_BITMAPCOMBOBOX diff --git a/Externals/wxWidgets3/src/msw/brush.cpp b/Externals/wxWidgets3/src/msw/brush.cpp index f2c63c32b8..f47d6d4bd2 100644 --- a/Externals/wxWidgets3/src/msw/brush.cpp +++ b/Externals/wxWidgets3/src/msw/brush.cpp @@ -78,7 +78,7 @@ private: // wxBrushRefData implementation // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject); // ---------------------------------------------------------------------------- // wxBrushRefData ctors/dtor @@ -148,8 +148,6 @@ void wxBrushRefData::Free() } } -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - static int TranslateHatchStyle(int style) { switch ( style ) @@ -164,16 +162,12 @@ static int TranslateHatchStyle(int style) } } -#endif // !__WXMICROWIN__ && !__WXWINCE__ - HBRUSH wxBrushRefData::GetHBRUSH() { if ( !m_hBrush ) { -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) int hatchStyle = TranslateHatchStyle(m_style); if ( hatchStyle == -1 ) -#endif // !__WXMICROWIN__ && !__WXWINCE__ { switch ( m_style ) { @@ -199,12 +193,10 @@ HBRUSH wxBrushRefData::GetHBRUSH() break; } } -#ifndef __WXWINCE__ else // create a hatched brush { m_hBrush = ::CreateHatchBrush(hatchStyle, m_colour.GetPixel()); } -#endif if ( !m_hBrush ) { @@ -232,12 +224,10 @@ wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) m_refData = new wxBrushRefData(col, style); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxBrush::wxBrush(const wxColour& col, int style) { m_refData = new wxBrushRefData(col, (wxBrushStyle)style); } -#endif wxBrush::wxBrush(const wxBitmap& stipple) { diff --git a/Externals/wxWidgets3/src/msw/button.cpp b/Externals/wxWidgets3/src/msw/button.cpp index 33beb43256..40dfa1677d 100644 --- a/Externals/wxWidgets3/src/msw/button.cpp +++ b/Externals/wxWidgets3/src/msw/button.cpp @@ -61,9 +61,9 @@ // macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxButton, wxButtonBase) +wxBEGIN_EVENT_TABLE(wxButton, wxButtonBase) EVT_CHAR_HOOK(wxButton::OnCharHook) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -82,17 +82,21 @@ bool wxButton::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { - wxString label(lbl); - if (label.empty() && wxIsStockID(id)) + wxString label; + if ( !(style & wxBU_NOTEXT) ) { - // On Windows, some buttons aren't supposed to have mnemonics - label = wxGetStockLabel - ( - id, - id == wxID_OK || id == wxID_CANCEL || id == wxID_CLOSE - ? wxSTOCK_NOFLAGS - : wxSTOCK_WITH_MNEMONIC - ); + label = lbl; + if (label.empty() && wxIsStockID(id)) + { + // On Windows, some buttons aren't supposed to have mnemonics + label = wxGetStockLabel + ( + id, + id == wxID_OK || id == wxID_CANCEL || id == wxID_CLOSE + ? wxSTOCK_NOFLAGS + : wxSTOCK_WITH_MNEMONIC + ); + } } if ( !CreateControl(parent, id, pos, size, style, validator, name) ) @@ -148,11 +152,9 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const msStyle |= BS_TOP; if ( style & wxBU_BOTTOM ) msStyle |= BS_BOTTOM; -#ifndef __WXWINCE__ // flat 2d buttons if ( style & wxNO_BORDER ) msStyle |= BS_FLAT; -#endif // __WXWINCE__ return msStyle; } @@ -284,8 +286,11 @@ void wxButton::SetTmpDefault() wxWindow *winOldDefault = tlw->GetDefaultItem(); tlw->SetTmpDefaultItem(this); - SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); + // Notice that the order of these statements is important, the old button + // is not reset if we do it the other way round, probably because of + // something done by the default DM_SETDEFID handler. SetDefaultStyle(this, true); + SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false); } // unset this button as currently default, it may still stay permanent default @@ -299,8 +304,9 @@ void wxButton::UnsetTmpDefault() wxWindow *winOldDefault = tlw->GetDefaultItem(); - SetDefaultStyle(this, false); + // Just as in SetTmpDefault() above, the order is important here. SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), true); + SetDefaultStyle(this, false); } /* static */ diff --git a/Externals/wxWidgets3/src/msw/calctrl.cpp b/Externals/wxWidgets3/src/msw/calctrl.cpp index ac0d8bbd76..8b6f359fa5 100644 --- a/Externals/wxWidgets3/src/msw/calctrl.cpp +++ b/Externals/wxWidgets3/src/msw/calctrl.cpp @@ -108,7 +108,7 @@ wxCalendarCtrl::Create(wxWindow *parent, } const wxChar * const clsname = s_clsMonthCal.IsRegistered() - ? s_clsMonthCal.GetName().t_str() + ? static_cast(s_clsMonthCal.GetName().t_str()) : MONTHCAL_CLASS; if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) ) diff --git a/Externals/wxWidgets3/src/msw/checkbox.cpp b/Externals/wxWidgets3/src/msw/checkbox.cpp index b5601e72d8..05a7ccd500 100644 --- a/Externals/wxWidgets3/src/msw/checkbox.cpp +++ b/Externals/wxWidgets3/src/msw/checkbox.cpp @@ -34,7 +34,6 @@ #include "wx/settings.h" #endif -#include "wx/msw/dc.h" // for wxDCTemp #include "wx/renderer.h" #include "wx/msw/uxtheme.h" #include "wx/msw/private/button.h" @@ -85,8 +84,6 @@ enum void wxCheckBox::Init() { m_state = wxCHK_UNCHECKED; - m_isPressed = - m_isHot = false; } bool wxCheckBox::Create(wxWindow *parent, @@ -176,9 +173,6 @@ wxSize wxCheckBox::DoGetBestClientSize() const wCheckbox = s_checkSize; hCheckbox = s_checkSize; } -#ifdef __WXWINCE__ - hCheckbox += 1; -#endif wxSize best(wCheckbox, hCheckbox); CacheBestSize(best); @@ -270,233 +264,43 @@ bool wxCheckBox::MSWCommand(WXUINT cmd, WXWORD WXUNUSED(id)) } // ---------------------------------------------------------------------------- -// owner drawn checkboxes stuff +// owner drawn checkboxes support // ---------------------------------------------------------------------------- -bool wxCheckBox::SetForegroundColour(const wxColour& colour) +int wxCheckBox::MSWGetButtonStyle() const { - if ( !wxCheckBoxBase::SetForegroundColour(colour) ) - return false; - - // the only way to change the checkbox foreground colour under Windows XP - // is to owner draw it - if ( wxUxThemeEngine::GetIfActive() ) - MSWMakeOwnerDrawn(colour.IsOk()); - - return true; + return HasFlag(wxCHK_3STATE) ? BS_3STATE : BS_CHECKBOX; } -bool wxCheckBox::IsOwnerDrawn() const +void wxCheckBox::MSWOnButtonResetOwnerDrawn() { - return - (::GetWindowLong(GetHwnd(), GWL_STYLE) & BS_OWNERDRAW) == BS_OWNERDRAW; + // ensure that controls state is consistent with internal state + DoSet3StateValue(m_state); } -void wxCheckBox::MSWMakeOwnerDrawn(bool ownerDrawn) +int wxCheckBox::MSWGetButtonCheckedFlag() const { - long style = ::GetWindowLong(GetHwnd(), GWL_STYLE); - - // note that BS_CHECKBOX & BS_OWNERDRAW != 0 so we can't operate on - // them as on independent style bits - if ( ownerDrawn ) - { - style &= ~(BS_CHECKBOX | BS_3STATE); - style |= BS_OWNERDRAW; - - Connect(wxEVT_ENTER_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Connect(wxEVT_LEAVE_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Connect(wxEVT_LEFT_UP, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - } - else // reset to default colour - { - style &= ~BS_OWNERDRAW; - style |= HasFlag(wxCHK_3STATE) ? BS_3STATE : BS_CHECKBOX; - - Disconnect(wxEVT_ENTER_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Disconnect(wxEVT_LEAVE_WINDOW, - wxMouseEventHandler(wxCheckBox::OnMouseEnterOrLeave)); - Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(wxCheckBox::OnMouseLeft)); - Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(wxCheckBox::OnFocus)); - } - - ::SetWindowLong(GetHwnd(), GWL_STYLE, style); - - if ( !ownerDrawn ) - { - // ensure that controls state is consistent with internal state - DoSet3StateValue(m_state); - } -} - -void wxCheckBox::OnMouseEnterOrLeave(wxMouseEvent& event) -{ - m_isHot = event.GetEventType() == wxEVT_ENTER_WINDOW; - if ( !m_isHot ) - m_isPressed = false; - - Refresh(); - - event.Skip(); -} - -void wxCheckBox::OnMouseLeft(wxMouseEvent& event) -{ - // TODO: we should capture the mouse here to be notified about left up - // event but this interferes with BN_CLICKED generation so if we - // want to do this we'd need to generate them ourselves - m_isPressed = event.GetEventType() == wxEVT_LEFT_DOWN; - Refresh(); - - event.Skip(); -} - -void wxCheckBox::OnFocus(wxFocusEvent& event) -{ - Refresh(); - - event.Skip(); -} - -bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) -{ - DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)item; - - if ( !IsOwnerDrawn() || dis->CtlType != ODT_BUTTON ) - return wxCheckBoxBase::MSWOnDraw(item); - - // calculate the rectangles for the check mark itself and the label - HDC hdc = dis->hDC; - RECT& rect = dis->rcItem; - RECT rectCheck, - rectLabel; - rectLabel.top = rect.top + (rect.bottom - rect.top - GetBestSize().y) / 2; - rectLabel.bottom = rectLabel.top + GetBestSize().y; - const int MARGIN = 3; - const int CXMENUCHECK = ::GetSystemMetrics(SM_CXMENUCHECK); - // the space between the checkbox and the label is included in the - // check-mark bitmap - const int checkSize = wxMin(CXMENUCHECK - MARGIN, GetSize().y); - rectCheck.top = rect.top + (rect.bottom - rect.top - checkSize) / 2; - rectCheck.bottom = rectCheck.top + checkSize; - - const bool isRightAligned = HasFlag(wxALIGN_RIGHT); - if ( isRightAligned ) - { - rectLabel.right = rect.right - CXMENUCHECK; - rectLabel.left = rect.left; - - rectCheck.left = rectLabel.right + ( CXMENUCHECK + MARGIN - checkSize ) / 2; - rectCheck.right = rectCheck.left + checkSize; - } - else // normal, left-aligned checkbox - { - rectCheck.left = rect.left + ( CXMENUCHECK - MARGIN - checkSize ) / 2; - rectCheck.right = rectCheck.left + checkSize; - - rectLabel.left = rect.left + CXMENUCHECK; - rectLabel.right = rect.right; - } - - // shall we draw a focus rect? - const bool isFocused = m_isPressed || FindFocus() == this; - - - // draw the checkbox itself - wxDCTemp dc(hdc); - - int flags = 0; - if ( !IsEnabled() ) - flags |= wxCONTROL_DISABLED; switch ( Get3StateValue() ) { case wxCHK_CHECKED: - flags |= wxCONTROL_CHECKED; - break; + return wxCONTROL_CHECKED; case wxCHK_UNDETERMINED: - flags |= wxCONTROL_PRESSED; - break; - - default: - wxFAIL_MSG( wxT("unexpected Get3StateValue() return value") ); - // fall through + return wxCONTROL_PRESSED; case wxCHK_UNCHECKED: // no extra styles needed - break; + return 0; } - if ( wxFindWindowAtPoint(wxGetMousePosition()) == this ) - flags |= wxCONTROL_CURRENT; + wxFAIL_MSG( wxT("unexpected Get3StateValue() return value") ); - wxRendererNative::Get(). - DrawCheckBox(this, dc, wxRectFromRECT(rectCheck), flags); + return 0; +} - // draw the text - const wxString& label = GetLabel(); - - // first we need to measure it - UINT fmt = DT_NOCLIP; - - // drawing underlying doesn't look well with focus rect (and the native - // control doesn't do it) - if ( isFocused ) - fmt |= DT_HIDEPREFIX; - if ( isRightAligned ) - fmt |= DT_RIGHT; - // TODO: also use DT_HIDEPREFIX if the system is configured so - - // we need to get the label real size first if we have to draw a focus rect - // around it - if ( isFocused ) - { - RECT oldLabelRect = rectLabel; // needed if right aligned - - if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, - fmt | DT_CALCRECT) ) - { - wxLogLastError(wxT("DrawText(DT_CALCRECT)")); - } - - if ( isRightAligned ) - { - // move the label rect to the right - const int labelWidth = rectLabel.right - rectLabel.left; - rectLabel.right = oldLabelRect.right; - rectLabel.left = rectLabel.right - labelWidth; - } - } - - if ( !IsEnabled() ) - { - ::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT)); - } - - if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt) ) - { - wxLogLastError(wxT("DrawText()")); - } - - // finally draw the focus - if ( isFocused ) - { - rectLabel.left--; - rectLabel.right++; - if ( !::DrawFocusRect(hdc, &rectLabel) ) - { - wxLogLastError(wxT("DrawFocusRect()")); - } - } - - return true; +void wxCheckBox::MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) +{ + wxRendererNative::Get().DrawCheckBox(this, dc, rect, flags); } #endif // wxUSE_CHECKBOX diff --git a/Externals/wxWidgets3/src/msw/checklst.cpp b/Externals/wxWidgets3/src/msw/checklst.cpp index 36484a73a9..bd9efd6be4 100644 --- a/Externals/wxWidgets3/src/msw/checklst.cpp +++ b/Externals/wxWidgets3/src/msw/checklst.cpp @@ -168,10 +168,10 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, // define event table // ------------------ -BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox) +wxBEGIN_EVENT_TABLE(wxCheckListBox, wxListBox) EVT_KEY_DOWN(wxCheckListBox::OnKeyDown) EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // control creation // ---------------- diff --git a/Externals/wxWidgets3/src/msw/choice.cpp b/Externals/wxWidgets3/src/msw/choice.cpp index 6699e1e95b..804c4e26f0 100644 --- a/Externals/wxWidgets3/src/msw/choice.cpp +++ b/Externals/wxWidgets3/src/msw/choice.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_CHOICE && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) +#if wxUSE_CHOICE #include "wx/choice.h" @@ -199,28 +199,6 @@ wxChoice::~wxChoice() Clear(); } -bool wxChoice::MSWGetComboBoxInfo(tagCOMBOBOXINFO* info) const -{ - // TODO-Win9x: Get rid of this once we officially drop support for Win9x - // and just call the function directly. -#if wxUSE_DYNLIB_CLASS - typedef BOOL (WINAPI *GetComboBoxInfo_t)(HWND, tagCOMBOBOXINFO*); - static GetComboBoxInfo_t s_pfnGetComboBoxInfo = NULL; - static bool s_triedToLoad = false; - if ( !s_triedToLoad ) - { - s_triedToLoad = true; - wxLoadedDLL dllUser32("user32.dll"); - wxDL_INIT_FUNC(s_pfn, GetComboBoxInfo, dllUser32); - } - - if ( s_pfnGetComboBoxInfo ) - return (*s_pfnGetComboBoxInfo)(GetHwnd(), info) != 0; -#endif // wxUSE_DYNLIB_CLASS - - return false; -} - // ---------------------------------------------------------------------------- // adding/deleting items to/from the list // ---------------------------------------------------------------------------- @@ -322,19 +300,6 @@ unsigned int wxChoice::GetCount() const int wxChoice::FindString(const wxString& s, bool bCase) const { -#if defined(__WATCOMC__) && defined(__WIN386__) - // For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message. - // wxChoice::Do it the long way instead. - unsigned int count = GetCount(); - for ( unsigned int i = 0; i < count; i++ ) - { - // as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too - if (GetString(i).IsSameAs(s, bCase)) - return i; - } - - return wxNOT_FOUND; -#else // !Watcom //TODO: Evidently some MSW versions (all?) don't like empty strings //passed to SendMessage, so we have to do it ourselves in that case if ( s.empty() ) @@ -360,7 +325,6 @@ int wxChoice::FindString(const wxString& s, bool bCase) const return pos == LB_ERR ? wxNOT_FOUND : pos; } -#endif // Watcom/!Watcom } void wxChoice::SetString(unsigned int n, const wxString& s) @@ -533,15 +497,16 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - const int heightBest = GetBestSize().y; + // The height of the control itself, i.e. of its visible part. + int heightVisible = height; // we need the real height below so get the current one if it's not given if ( height == wxDefaultCoord ) { // height not specified, use the same as before - DoGetSize(NULL, &height); + DoGetSize(NULL, &heightVisible); } - else if ( height == heightBest ) + else if ( height == GetBestSize().y ) { // we don't need to manually manage our height, let the system use the // default one @@ -585,7 +550,7 @@ void wxChoice::DoSetSize(int x, int y, // 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); + heightWithItems = heightVisible + hItem*(nItems + 1); else heightWithItems = SetHeightSimpleComboBox(nItems); @@ -639,17 +604,13 @@ wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const // and its child part. I.e. arrow, separators, etc. wxSize tsize(xlen, 0); - // FIXME-VC6: Only VC6 needs this guard, see WINVER definition in - // include/wx/msw/wrapwin.h -#if defined(WINVER) && WINVER >= 0x0500 WinStruct info; - if ( MSWGetComboBoxInfo(&info) ) + if ( ::GetComboBoxInfo(GetHwnd(), &info) ) { tsize.x += info.rcItem.left + info.rcButton.right - info.rcItem.right + info.rcItem.left + 3; // right and extra margins } else // Just use some rough approximation. -#endif // WINVER >= 0x0500 { tsize.x += 4*cHeight; } @@ -838,4 +799,4 @@ WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) return wxChoiceBase::MSWControlColor(hDC, hWnd); } -#endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__) +#endif // wxUSE_CHOICE diff --git a/Externals/wxWidgets3/src/msw/clipbrd.cpp b/Externals/wxWidgets3/src/msw/clipbrd.cpp index a1726e3a6f..0989172123 100644 --- a/Externals/wxWidgets3/src/msw/clipbrd.cpp +++ b/Externals/wxWidgets3/src/msw/clipbrd.cpp @@ -57,7 +57,7 @@ // the functions using wxDataObject in wxClipboard //#define wxUSE_DATAOBJ wxUSE_DRAG_AND_DROP -#if wxUSE_OLE && !defined(__WXWINCE__) +#if wxUSE_OLE // use OLE clipboard #define wxUSE_OLE_CLIPBOARD 1 #else // !wxUSE_DATAOBJ @@ -156,7 +156,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) case CF_BITMAP: return ::IsClipboardFormatAvailable(CF_DIB) != 0; -#if wxUSE_ENH_METAFILE && !defined(__WXWINCE__) +#if wxUSE_ENH_METAFILE case CF_METAFILEPICT: return ::IsClipboardFormatAvailable(CF_ENHMETAFILE) != 0; #endif // wxUSE_ENH_METAFILE @@ -231,7 +231,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, // VZ: I'm told that this code works, but it doesn't seem to work for me // and, anyhow, I'd be highly surprised if it did. So I leave it here // but IMNSHO it is completely broken. -#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) && !defined(__WXWINCE__) +#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) case wxDF_METAFILE: { wxMetafile *wxMF = (wxMetafile *)data; @@ -250,7 +250,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, } #endif // wxUSE_METAFILE -#if wxUSE_ENH_METAFILE && !defined(__WXWINCE__) +#if wxUSE_ENH_METAFILE case wxDF_ENHMETAFILE: { wxEnhMetaFile *emf = (wxEnhMetaFile *)data; @@ -296,8 +296,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, handle = SetClipboardData(dataFormat, hGlobalMemory); break; } - // Only tested with Visual C++ 6.0 so far -#if defined(__VISUALC__) + case wxDF_HTML: { char* html = (char *)data; @@ -365,7 +364,6 @@ bool wxSetClipboardData(wxDataFormat dataFormat, delete [] buf; break; } -#endif } if ( handle == 0 ) @@ -384,7 +382,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) switch ( dataFormat ) { -#ifndef __WXWINCE__ case wxDF_BITMAP: { BITMAP bm; @@ -429,7 +426,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len) retval = wxBM; break; } -#endif case wxDF_METAFILE: case CF_SYLK: case CF_DIF: @@ -521,7 +517,7 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, // wxClipboard // --------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject); wxClipboard::wxClipboard() { @@ -835,7 +831,6 @@ bool wxClipboard::GetData( wxDataObject& data ) formatEtc.tymed = TYMED_GDI; break; -#ifndef __WXWINCE__ case CF_METAFILEPICT: formatEtc.tymed = TYMED_MFPICT; break; @@ -843,7 +838,6 @@ bool wxClipboard::GetData( wxDataObject& data ) case CF_ENHMETAFILE: formatEtc.tymed = TYMED_ENHMF; break; -#endif default: formatEtc.tymed = TYMED_HGLOBAL; diff --git a/Externals/wxWidgets3/src/msw/colordlg.cpp b/Externals/wxWidgets3/src/msw/colordlg.cpp index fca709586b..fb9c89d16c 100644 --- a/Externals/wxWidgets3/src/msw/colordlg.cpp +++ b/Externals/wxWidgets3/src/msw/colordlg.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_COLOURDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) +#if wxUSE_COLOURDLG #include "wx/colordlg.h" #include "wx/modalhook.h" @@ -55,7 +55,7 @@ static wxRect gs_rectDialog(0, 0, 222, 324); // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); // ============================================================================ // implementation @@ -116,6 +116,9 @@ int wxColourDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); + wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); + WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + // initialize the struct used by Windows CHOOSECOLOR chooseColorStruct; memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR)); @@ -133,8 +136,7 @@ int wxColourDialog::ShowModal() } chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR); - if ( m_parent ) - chooseColorStruct.hwndOwner = GetHwndOf(m_parent); + chooseColorStruct.hwndOwner = hWndParent; chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.GetColour()); chooseColorStruct.lpCustColors = custColours; @@ -275,4 +277,4 @@ void wxColourDialog::MSWOnInitDone(WXHWND hDlg) SetHWND(NULL); } -#endif // wxUSE_COLOURDLG && !(__SMARTPHONE__ && __WXWINCE__) +#endif // wxUSE_COLOURDLG diff --git a/Externals/wxWidgets3/src/msw/combo.cpp b/Externals/wxWidgets3/src/msw/combo.cpp index 3f9b3accbe..34ef696042 100644 --- a/Externals/wxWidgets3/src/msw/combo.cpp +++ b/Externals/wxWidgets3/src/msw/combo.cpp @@ -128,16 +128,16 @@ // ============================================================================ -BEGIN_EVENT_TABLE(wxComboCtrl, wxComboCtrlBase) +wxBEGIN_EVENT_TABLE(wxComboCtrl, wxComboCtrlBase) EVT_PAINT(wxComboCtrl::OnPaintEvent) EVT_MOUSE_EVENTS(wxComboCtrl::OnMouseEvent) #if wxUSE_COMBOCTRL_POPUP_ANIMATION EVT_TIMER(wxID_ANY, wxComboCtrl::OnTimerEvent) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxComboCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxComboCtrl, wxComboCtrlBase); void wxComboCtrl::Init() { @@ -227,7 +227,7 @@ void wxComboCtrl::OnResize() // Technically Classic Windows style combo has more narrow button, // but the native renderer doesn't paint it well like that. - int btnWidth = 17; + int btnWidth = FromDIP(17); CalculateAreas(btnWidth); // Position textctrl using standard routine @@ -237,7 +237,6 @@ void wxComboCtrl::OnResize() // Draws non-XP GUI dotted line around the focus area static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect ) { -#if !defined(__WXWINCE__) /* RECT mswRect; mswRect.left = rect.x; @@ -262,16 +261,6 @@ static void wxMSWDrawFocusRect( wxDC& dc, const wxRect& rect ) dc.DrawRectangle(rect); dc.SetLogicalFunction(wxCOPY); -#else - dc.SetLogicalFunction(wxINVERT); - - dc.SetPen(wxPen(*wxBLACK,1,wxDOT)); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - - dc.DrawRectangle(rect); - - dc.SetLogicalFunction(wxCOPY); -#endif } // draw focus background on area in a way typical on platform @@ -731,10 +720,14 @@ void wxComboCtrl::DoTimerEvent() } else { - wxLongLong t = ::wxGetLocalTimeMillis(); + wxMilliClock_t t = ::wxGetLocalTimeMillis(); const wxRect& rect = m_animRect; +#if wxUSE_LONGLONG int pos = (int) (t-m_animStart).GetLo(); +#else + int pos = (int) (t-m_animStart); +#endif if ( pos < COMBOBOX_ANIMATION_DURATION ) { int height = rect.height; diff --git a/Externals/wxWidgets3/src/msw/combobox.cpp b/Externals/wxWidgets3/src/msw/combobox.cpp index 692c546654..3f71aa2f26 100644 --- a/Externals/wxWidgets3/src/msw/combobox.cpp +++ b/Externals/wxWidgets3/src/msw/combobox.cpp @@ -53,7 +53,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxComboBox, wxControl) +wxBEGIN_EVENT_TABLE(wxComboBox, wxControl) EVT_MENU(wxID_CUT, wxComboBox::OnCut) EVT_MENU(wxID_COPY, wxComboBox::OnCopy) EVT_MENU(wxID_PASTE, wxComboBox::OnPaste) @@ -69,16 +69,14 @@ BEGIN_EVENT_TABLE(wxComboBox, wxControl) EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo) EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete) EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // function prototypes // ---------------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, - UINT message, - WPARAM wParam, - LPARAM lParam); +LRESULT APIENTRY +wxComboEditWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // --------------------------------------------------------------------------- // global vars @@ -125,10 +123,8 @@ bool ShouldForwardFromEditToCombo(UINT message) // wnd proc for subclassed edit control // ---------------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, - UINT message, - WPARAM wParam, - LPARAM lParam) +LRESULT APIENTRY +wxComboEditWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HWND hwndCombo = ::GetParent(hWnd); wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo); @@ -314,11 +310,9 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id) break; case CBN_SELENDOK: -#ifndef __SMARTPHONE__ // we need to reset this to prevent the selection from being undone // by wxChoice, see wxChoice::MSWCommand() and comments there m_lastAcceptedSelection = wxID_NONE; -#endif // set these variables so that they could be also fixed in // CBN_EDITCHANGE below @@ -389,13 +383,9 @@ bool wxComboBox::MSWShouldPreProcessMessage(WXMSG *pMsg) WXHWND wxComboBox::GetEditHWNDIfAvailable() const { - // FIXME-VC6: Only VC6 needs this guard, see WINVER definition in - // include/wx/msw/wrapwin.h -#if defined(WINVER) && WINVER >= 0x0500 WinStruct info; - if ( MSWGetComboBoxInfo(&info) ) + if ( ::GetComboBoxInfo(GetHwnd(), &info) ) return info.hwndItem; -#endif // WINVER >= 0x0500 if (HasFlag(wxCB_SIMPLE)) { @@ -508,10 +498,8 @@ WXDWORD wxComboBox::MSWGetStyle(long style, WXDWORD *exstyle) const if ( style & wxCB_READONLY ) msStyle |= CBS_DROPDOWNLIST; -#ifndef __WXWINCE__ else if ( style & wxCB_SIMPLE ) msStyle |= CBS_SIMPLE; // A list (shown always) and edit control -#endif else msStyle |= CBS_DROPDOWN; @@ -711,4 +699,39 @@ wxWindow *wxComboBox::MSWFindItem(long id, WXHWND hWnd) const return wxChoice::MSWFindItem(id, hWnd); } +void wxComboBox::SetLayoutDirection(wxLayoutDirection dir) +{ + // Edit field and drop-down list must be handled explicitly. + + // Edit field is a special EDIT control (e.g. it always returns null + // extended style flags), so its layout direction should be set using the + // same extended flag as for ordinary window but reset simply with + // alignment flags. + if ( !HasFlag(wxCB_READONLY) ) + { + if ( dir == wxLayout_RightToLeft ) + { + wxUpdateLayoutDirection(GetEditHWND(), dir); + } + else + { + LONG_PTR style = ::GetWindowLongPtr(GetEditHWND(), GWL_STYLE); + if ( !(style & ES_CENTER) ) + { + style &= ~ES_RIGHT; + ::SetWindowLongPtr(GetEditHWND(), GWL_STYLE, style); + } + } + } + + // Layout for the drop-down list also must be set explicitly. + WinStruct info; + if ( ::GetComboBoxInfo(GetHwnd(), &info) ) + { + wxUpdateLayoutDirection(info.hwndList, dir); + } + + wxChoice::SetLayoutDirection(dir); +} + #endif // wxUSE_COMBOBOX diff --git a/Externals/wxWidgets3/src/msw/control.cpp b/Externals/wxWidgets3/src/msw/control.cpp index 4bb6ae8423..daf7b06590 100644 --- a/Externals/wxWidgets3/src/msw/control.cpp +++ b/Externals/wxWidgets3/src/msw/control.cpp @@ -45,14 +45,22 @@ #include "wx/treectrl.h" #endif // wxUSE_TREECTRL +#include "wx/renderer.h" #include "wx/msw/private.h" #include "wx/msw/uxtheme.h" +#include "wx/msw/dc.h" // for wxDCTemp +#include "wx/msw/ownerdrawnbutton.h" + +// Missing from MinGW 4.8 SDK headers. +#ifndef BS_TYPEMASK +#define BS_TYPEMASK 0xf +#endif // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) +wxIMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow); // ============================================================================ // wxControl implementation @@ -245,7 +253,7 @@ wxSize wxControl::DoGetBestSize() const if (m_windowSizer) return wxControlBase::DoGetBestSize(); - return wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT); + return FromDIP(wxSize(DEFAULT_ITEM_WIDTH, DEFAULT_ITEM_HEIGHT)); } wxBorder wxControl::GetDefaultBorder() const @@ -253,37 +261,6 @@ wxBorder wxControl::GetDefaultBorder() const return wxControlBase::GetDefaultBorder(); } -// This is a helper for all wxControls made with UPDOWN native control. -// In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in -// WinCE of Smartphones this happens also for native wxTextCtrl, -// wxChoice and others. -wxSize wxControl::GetBestSpinnerSize(const bool is_vertical) const -{ - // take size according to layout - wxSize bestSize( -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - 0,GetCharHeight() -#else - ::GetSystemMetrics(is_vertical ? SM_CXVSCROLL : SM_CXHSCROLL), - ::GetSystemMetrics(is_vertical ? SM_CYVSCROLL : SM_CYHSCROLL) -#endif - ); - - // correct size as for undocumented MSW variants cases (WinCE and perhaps others) - if (bestSize.x==0) - bestSize.x = bestSize.y; - if (bestSize.y==0) - bestSize.y = bestSize.x; - - // double size according to layout - if (is_vertical) - bestSize.y *= 2; - else - bestSize.x *= 2; - - return bestSize; -} - /* static */ wxVisualAttributes wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) { @@ -372,14 +349,26 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) // If this HWND doesn't correspond to a wxWindow, it still might be // one of its children for which we need to set the background // brush, e.g. this is the case for the EDIT control that is part - // of wxComboBox. Check for this by asking the parent if it has it: - HWND parent = ::GetParent(hWnd); - if ( parent ) + // of wxComboBox but also e.g. of wxSlider label HWNDs which are + // logically part of it, but are siblings of the main control at + // Windows level. + // + // So check whether it's a sibling of this window which is part of + // the same wx object. + if ( ContainsHWND(hWnd) ) { - wxWindow *winParent = wxFindWinFromHandle( parent ); - if( winParent && winParent->ContainsHWND( hWnd ) ) - win = winParent; - } + win = this; + } + else // Or maybe a child sub-window of this one. + { + HWND parent = ::GetParent(hWnd); + if ( parent ) + { + wxWindow *winParent = wxFindWinFromHandle( parent ); + if( winParent && winParent->ContainsHWND( hWnd ) ) + win = winParent; + } + } } if ( win ) @@ -451,6 +440,243 @@ wxWindow* wxControl::MSWFindItem(long id, WXHWND hWnd) const return wxControlBase::MSWFindItem(id, hWnd); } +// ---------------------------------------------------------------------------- +// Owner drawn buttons support. +// ---------------------------------------------------------------------------- + +void +wxMSWOwnerDrawnButtonBase::MSWMakeOwnerDrawnIfNecessary(const wxColour& colFg) +{ + // The only way to change the checkbox foreground colour when using + // themes is to owner draw it. + if ( wxUxThemeEngine::GetIfActive() ) + MSWMakeOwnerDrawn(colFg.IsOk()); +} + +bool wxMSWOwnerDrawnButtonBase::MSWIsOwnerDrawn() const +{ + return + (::GetWindowLong(GetHwndOf(m_win), GWL_STYLE) & BS_OWNERDRAW) == BS_OWNERDRAW; +} + +void wxMSWOwnerDrawnButtonBase::MSWMakeOwnerDrawn(bool ownerDrawn) +{ + long style = ::GetWindowLong(GetHwndOf(m_win), GWL_STYLE); + + // note that BS_CHECKBOX & BS_OWNERDRAW != 0 so we can't operate on + // them as on independent style bits + if ( ownerDrawn ) + { + style &= ~BS_TYPEMASK; + style |= BS_OWNERDRAW; + + m_win->Bind(wxEVT_ENTER_WINDOW, + &wxMSWOwnerDrawnButtonBase::OnMouseEnterOrLeave, this); + m_win->Bind(wxEVT_LEAVE_WINDOW, + &wxMSWOwnerDrawnButtonBase::OnMouseEnterOrLeave, this); + + m_win->Bind(wxEVT_LEFT_DOWN, + &wxMSWOwnerDrawnButtonBase::OnMouseLeft, this); + m_win->Bind(wxEVT_LEFT_UP, + &wxMSWOwnerDrawnButtonBase::OnMouseLeft, this); + + m_win->Bind(wxEVT_SET_FOCUS, + &wxMSWOwnerDrawnButtonBase::OnFocus, this); + + m_win->Bind(wxEVT_KILL_FOCUS, + &wxMSWOwnerDrawnButtonBase::OnFocus, this); + } + else // reset to default colour + { + style &= ~BS_OWNERDRAW; + style |= MSWGetButtonStyle(); + + m_win->Unbind(wxEVT_ENTER_WINDOW, + &wxMSWOwnerDrawnButtonBase::OnMouseEnterOrLeave, this); + m_win->Unbind(wxEVT_LEAVE_WINDOW, + &wxMSWOwnerDrawnButtonBase::OnMouseEnterOrLeave, this); + + m_win->Unbind(wxEVT_LEFT_DOWN, + &wxMSWOwnerDrawnButtonBase::OnMouseLeft, this); + m_win->Unbind(wxEVT_LEFT_UP, + &wxMSWOwnerDrawnButtonBase::OnMouseLeft, this); + + m_win->Unbind(wxEVT_SET_FOCUS, + &wxMSWOwnerDrawnButtonBase::OnFocus, this); + m_win->Unbind(wxEVT_KILL_FOCUS, + &wxMSWOwnerDrawnButtonBase::OnFocus, this); + } + + ::SetWindowLong(GetHwndOf(m_win), GWL_STYLE, style); + + if ( !ownerDrawn ) + MSWOnButtonResetOwnerDrawn(); +} + +void wxMSWOwnerDrawnButtonBase::OnMouseEnterOrLeave(wxMouseEvent& event) +{ + if ( event.GetEventType() == wxEVT_LEAVE_WINDOW ) + m_isPressed = false; + + m_win->Refresh(); + + event.Skip(); +} + +void wxMSWOwnerDrawnButtonBase::OnMouseLeft(wxMouseEvent& event) +{ + // TODO: we should capture the mouse here to be notified about left up + // event but this interferes with BN_CLICKED generation so if we + // want to do this we'd need to generate them ourselves + m_isPressed = event.GetEventType() == wxEVT_LEFT_DOWN; + m_win->Refresh(); + + event.Skip(); +} + +void wxMSWOwnerDrawnButtonBase::OnFocus(wxFocusEvent& event) +{ + m_win->Refresh(); + + event.Skip(); +} + +bool wxMSWOwnerDrawnButtonBase::MSWDrawButton(WXDRAWITEMSTRUCT *item) +{ + DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)item; + + if ( !MSWIsOwnerDrawn() || dis->CtlType != ODT_BUTTON ) + return false; + + // shall we draw a focus rect? + const bool isFocused = m_isPressed || m_win->HasFocus(); + + int flags = MSWGetButtonCheckedFlag(); + + if ( dis->itemState & ODS_SELECTED ) + flags |= wxCONTROL_SELECTED | wxCONTROL_PRESSED; + + if ( !m_win->IsEnabled() ) + flags |= wxCONTROL_DISABLED; + + if ( m_isPressed ) + flags |= wxCONTROL_PRESSED; + + if ( wxFindWindowAtPoint(wxGetMousePosition()) == m_win ) + flags |= wxCONTROL_CURRENT; + + + // calculate the rectangles for the button itself and the label + HDC hdc = dis->hDC; + const RECT& rect = dis->rcItem; + + // calculate the rectangles for the button itself and the label + const wxSize bestSize = m_win->GetBestSize(); + RECT rectButton, + rectLabel; + rectLabel.top = rect.top + (rect.bottom - rect.top - bestSize.y) / 2; + rectLabel.bottom = rectLabel.top + bestSize.y; + + // choose the values consistent with those used for native, non + // owner-drawn, buttons + static const int MARGIN = 3; + int CXMENUCHECK = ::GetSystemMetrics(SM_CXMENUCHECK) + 1; + + // the buttons were even bigger under Windows XP + if ( wxGetWinVersion() < wxWinVersion_6 ) + CXMENUCHECK += 2; + + // The space between the button and the label + // is included in the button bitmap. + const int buttonSize = wxMin(CXMENUCHECK - MARGIN, m_win->GetSize().y); + rectButton.top = rect.top + (rect.bottom - rect.top - buttonSize) / 2; + rectButton.bottom = rectButton.top + buttonSize; + + const bool isRightAligned = m_win->HasFlag(wxALIGN_RIGHT); + if ( isRightAligned ) + { + rectLabel.right = rect.right - CXMENUCHECK; + rectLabel.left = rect.left; + + rectButton.left = rectLabel.right + ( CXMENUCHECK + MARGIN - buttonSize ) / 2; + rectButton.right = rectButton.left + buttonSize; + } + else // normal, left-aligned button + { + rectButton.left = rect.left + ( CXMENUCHECK - MARGIN - buttonSize ) / 2; + rectButton.right = rectButton.left + buttonSize; + + rectLabel.left = rect.left + CXMENUCHECK; + rectLabel.right = rect.right; + } + + // Erase the background. + ::FillRect(hdc, &rect, m_win->MSWGetBgBrush(hdc)); + + // draw the button itself + wxDCTemp dc(hdc); + + MSWDrawButtonBitmap(dc, wxRectFromRECT(rectButton), flags); + + // draw the text + const wxString& label = m_win->GetLabel(); + + // first we need to measure it + UINT fmt = DT_NOCLIP; + + // drawing underlying doesn't look well with focus rect (and the native + // control doesn't do it) + if ( isFocused ) + fmt |= DT_HIDEPREFIX; + if ( isRightAligned ) + fmt |= DT_RIGHT; + // TODO: also use DT_HIDEPREFIX if the system is configured so + + // we need to get the label real size first if we have to draw a focus rect + // around it + if ( isFocused ) + { + RECT oldLabelRect = rectLabel; // needed if right aligned + + if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, + fmt | DT_CALCRECT) ) + { + wxLogLastError(wxT("DrawText(DT_CALCRECT)")); + } + + if ( isRightAligned ) + { + // move the label rect to the right + const int labelWidth = rectLabel.right - rectLabel.left; + rectLabel.right = oldLabelRect.right; + rectLabel.left = rectLabel.right - labelWidth; + } + } + + if ( flags & wxCONTROL_DISABLED ) + { + ::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT)); + } + + if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt) ) + { + wxLogLastError(wxT("DrawText()")); + } + + // finally draw the focus + if ( isFocused ) + { + rectLabel.left--; + rectLabel.right++; + if ( !::DrawFocusRect(hdc, &rectLabel) ) + { + wxLogLastError(wxT("DrawFocusRect()")); + } + } + + return true; +} + // ---------------------------------------------------------------------------- // wxControlWithItems // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/crashrpt.cpp b/Externals/wxWidgets3/src/msw/crashrpt.cpp index 8f97402bc6..64bb5cd70d 100644 --- a/Externals/wxWidgets3/src/msw/crashrpt.cpp +++ b/Externals/wxWidgets3/src/msw/crashrpt.cpp @@ -200,9 +200,7 @@ bool wxCrashReportImpl::Generate(int flags, EXCEPTION_POINTERS *ep) // if we use the flags below, but the minidump is much more useful // as it contains the values of many (but not all) local variables dumpFlags = (MINIDUMP_TYPE)(MiniDumpScanMemory -#if _MSC_VER > 1300 |MiniDumpWithIndirectlyReferencedMemory -#endif ); } diff --git a/Externals/wxWidgets3/src/msw/cursor.cpp b/Externals/wxWidgets3/src/msw/cursor.cpp index de73d96368..d7714a46f4 100644 --- a/Externals/wxWidgets3/src/msw/cursor.cpp +++ b/Externals/wxWidgets3/src/msw/cursor.cpp @@ -39,12 +39,6 @@ #include "wx/msw/private.h" #include "wx/msw/missing.h" // IDC_HAND -// define functions missing in MicroWin -#ifdef __WXMICROWIN__ - static inline void DestroyCursor(HCURSOR) { } - static inline void SetCursor(HCURSOR) { } -#endif // __WXMICROWIN__ - // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -78,7 +72,7 @@ private: // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject); // ---------------------------------------------------------------------------- // globals @@ -151,10 +145,8 @@ void wxCursorRefData::Free() { if ( m_hCursor ) { -#ifndef __WXWINCE__ if ( m_destroyCursor ) ::DestroyCursor((HCURSOR)m_hCursor); -#endif m_hCursor = 0; } @@ -217,15 +209,6 @@ wxCursor::wxCursor(const wxImage& image) } #endif // wxUSE_IMAGE -// MicroWin doesn't have support needed for the other ctors -#ifdef __WXMICROWIN__ - -wxCursor::InitFromStock(wxStockCursor WXUNUSED(cursor_type)) -{ -} - -#else // !__WXMICROWIN__ - wxCursor::wxCursor(const wxString& filename, wxBitmapType kind, int hotSpotX, @@ -238,12 +221,10 @@ wxCursor::wxCursor(const wxString& filename, hcursor = ::LoadCursor(wxGetInstance(), filename.t_str()); break; -#ifndef __WXWINCE__ case wxBITMAP_TYPE_ANI: case wxBITMAP_TYPE_CUR: hcursor = ::LoadCursorFromFile(filename.t_str()); break; -#endif case wxBITMAP_TYPE_ICO: hcursor = wxBitmapToHCURSOR @@ -275,6 +256,18 @@ wxCursor::wxCursor(const wxString& filename, } } +wxPoint wxCursor::GetHotSpot() const +{ + if ( !GetGDIImageData() ) + return wxDefaultPosition; + + AutoIconInfo ii; + if ( !ii.GetFrom((HICON)GetGDIImageData()->m_hCursor) ) + return wxDefaultPosition; + + return wxPoint(ii.xHotspot, ii.yHotspot); +} + namespace { @@ -288,28 +281,20 @@ void ReverseBitmap(HBITMAP bitmap, int width, int height) HCURSOR CreateReverseCursor(HCURSOR cursor) { - ICONINFO info; - if ( !::GetIconInfo(cursor, &info) ) + AutoIconInfo info; + if ( !info.GetFrom(cursor) ) return NULL; - HCURSOR cursorRev = NULL; - BITMAP bmp; - if ( ::GetObject(info.hbmMask, sizeof(bmp), &bmp) ) - { - ReverseBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); - if ( info.hbmColor ) - ReverseBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); - info.xHotspot = (DWORD)bmp.bmWidth - 1 - info.xHotspot; + if ( !::GetObject(info.hbmMask, sizeof(bmp), &bmp) ) + return NULL; - cursorRev = ::CreateIconIndirect(&info); - } - - ::DeleteObject(info.hbmMask); + ReverseBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); if ( info.hbmColor ) - ::DeleteObject(info.hbmColor); + ReverseBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); + info.xHotspot = (DWORD)bmp.bmWidth - 1 - info.xHotspot; - return cursorRev; + return ::CreateIconIndirect(&info); } } // anonymous namespace @@ -407,8 +392,6 @@ void wxCursor::InitFromStock(wxStockCursor idCursor) } } -#endif // __WXMICROWIN__/!__WXMICROWIN__ - wxCursor::~wxCursor() { } diff --git a/Externals/wxWidgets3/src/msw/datecontrols.cpp b/Externals/wxWidgets3/src/msw/datecontrols.cpp index 501ff039fb..954e981f95 100644 --- a/Externals/wxWidgets3/src/msw/datecontrols.cpp +++ b/Externals/wxWidgets3/src/msw/datecontrols.cpp @@ -54,13 +54,6 @@ bool wxMSWDateControls::CheckInitialization() // it's enough to give the error only once s_initResult = false; - if ( wxApp::GetComCtl32Version() < 470 ) - { - wxLogError(_("This system doesn't support date controls, please upgrade your version of comctl32.dll")); - - return false; - } - #if wxUSE_DYNLIB_CLASS INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(icex); diff --git a/Externals/wxWidgets3/src/msw/datectrl.cpp b/Externals/wxWidgets3/src/msw/datectrl.cpp index 987edd1fd8..05beb336e0 100644 --- a/Externals/wxWidgets3/src/msw/datectrl.cpp +++ b/Externals/wxWidgets3/src/msw/datectrl.cpp @@ -37,7 +37,7 @@ #include "wx/datectrl.h" #include "wx/dateevt.h" -IMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxDatePickerCtrl, wxControl); // ============================================================================ // implementation @@ -70,9 +70,7 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const { WXDWORD styleMSW = wxDatePickerCtrlBase::MSWGetStyle(style, exstyle); - // although MSDN doesn't mention it, DTS_UPDOWN doesn't work with - // comctl32.dll 4.72 - if ( wxApp::GetComCtl32Version() > 472 && (style & wxDP_SPIN) ) + if ( style & wxDP_SPIN ) styleMSW |= DTS_UPDOWN; //else: drop down by default @@ -138,9 +136,8 @@ void wxDatePickerCtrl::SetValue(const wxDateTime& dt) m_date.ResetTime(); } -wxDateTime wxDatePickerCtrl::GetValue() const +wxDateTime wxDatePickerCtrl::MSWGetControlValue() const { -#if wxDEBUG_LEVEL wxDateTime dt; SYSTEMTIME st; if ( DateTime_GetSystemtime(GetHwnd(), &st) == GDT_VALID ) @@ -148,6 +145,14 @@ wxDateTime wxDatePickerCtrl::GetValue() const dt.SetFromMSWSysDate(st); } + return dt; +} + +wxDateTime wxDatePickerCtrl::GetValue() const +{ +#if wxDEBUG_LEVEL + const wxDateTime dt = MSWGetControlValue(); + wxASSERT_MSG( m_date.IsValid() == dt.IsValid() && (!dt.IsValid() || dt == m_date), wxT("bug in wxDateTimePickerCtrl: m_date not in sync") ); @@ -176,7 +181,12 @@ void wxDatePickerCtrl::SetRange(const wxDateTime& dt1, const wxDateTime& dt2) if ( !DateTime_SetRange(GetHwnd(), flags, st) ) { wxLogDebug(wxT("DateTime_SetRange() failed")); + return; } + + // Setting the range could have changed the current control value if the + // old one wasn't inside the new range, so update it. + m_date = MSWGetControlValue(); } bool wxDatePickerCtrl::GetRange(wxDateTime *dt1, wxDateTime *dt2) const diff --git a/Externals/wxWidgets3/src/msw/datetimectrl.cpp b/Externals/wxWidgets3/src/msw/datetimectrl.cpp index 408feab3eb..9b8fa66bdf 100644 --- a/Externals/wxWidgets3/src/msw/datetimectrl.cpp +++ b/Externals/wxWidgets3/src/msw/datetimectrl.cpp @@ -44,6 +44,10 @@ #define DateTime_SetSystemtime DateTime_SetSystemTime #endif +#ifndef DTM_GETIDEALSIZE + #define DTM_GETIDEALSIZE 0x100f +#endif + // ============================================================================ // wxDateTimePickerCtrl implementation // ============================================================================ @@ -108,34 +112,48 @@ wxDateTime wxDateTimePickerCtrl::GetValue() const wxSize wxDateTimePickerCtrl::DoGetBestSize() const { - wxClientDC dc(const_cast(this)); + // Since Vista, the control can compute its best size itself, just ask it. + wxSize size; + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + { + SIZE idealSize; + ::SendMessage(m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)&idealSize); - // Use the same native format as the underlying native control. + size = wxSize(idealSize.cx, idealSize.cy); + } + else // Windows XP + { + wxClientDC dc(const_cast(this)); + + // Use the same native format as the underlying native control. #if wxUSE_INTL - wxString s = wxDateTime::Now().Format(wxLocale::GetInfo(MSWGetFormat())); + wxString s = wxDateTime::Now().Format(wxLocale::GetOSInfo(MSWGetFormat())); #else // !wxUSE_INTL - wxString s("XXX-YYY-ZZZZ"); + wxString s("XXX-YYY-ZZZZ"); #endif // wxUSE_INTL/!wxUSE_INTL - // the best size for the control is bigger than just the string - // representation of the current value because the control must accommodate - // any date and while the widths of all digits are usually about the same, - // the width of the month string varies a lot, so try to account for it - s += wxT("WW"); + // the best size for the control is bigger than just the string + // representation of the current value because the control must accommodate + // any date and while the widths of all digits are usually about the same, + // the width of the month string varies a lot, so try to account for it + s += wxS("W"); - int x, y; - dc.GetTextExtent(s, &x, &y); + size = dc.GetTextExtent(s); - // account for the drop-down arrow or spin arrows - x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X); + // account for the drop-down arrow or spin arrows + size.x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X); + } - // and for the checkbox if we have it + // We need to account for the checkbox, if we have one, ourselves as + // DTM_GETIDEALSIZE doesn't seem to take it into account, at least under + // Windows 7. if ( MSWAllowsNone() ) - x += 3*GetCharWidth(); + size.x += 3*GetCharWidth(); - wxSize best(x, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y)); - CacheBestSize(best); - return best; + // In any case, adjust the height to be the same as for the text controls. + size.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(size.y); + + return size; } bool diff --git a/Externals/wxWidgets3/src/msw/dc.cpp b/Externals/wxWidgets3/src/msw/dc.cpp index 97a4da07fc..03f96e6955 100644 --- a/Externals/wxWidgets3/src/msw/dc.cpp +++ b/Externals/wxWidgets3/src/msw/dc.cpp @@ -41,7 +41,6 @@ #include "wx/msw/dc.h" #include "wx/sysopt.h" -#include "wx/dynlib.h" #ifdef wxHAS_RAW_BITMAP #include "wx/rawbmp.h" @@ -52,6 +51,32 @@ #include "wx/msw/private/dc.h" #include "wx/private/textmeasure.h" +#ifdef _MSC_VER + // In the previous versions of wxWidgets, AlphaBlend() was dynamically + // loaded from msimg32.dll during the run-time, so we didn't need to link + // with this library. Now that we use the function statically, we do need + // to link with it and we do it implicitly from here for MSVC users to + // avoid breaking the build of the existing projects which didn't link with + // this library before. + #pragma comment(lib, "msimg32") + + // Indicate that we should just use the functions from gdi32.dll and + // msimg32.dll directly. + #define USE_STATIC_GDI_FUNCS +#else // !_MSC_VER + // In other compilers, e.g. MinGW, we don't have anything similar to + // #pragma comment(lib) used above, so we continue loading AlphaBlend() + // dynamically, if possible. + // + // We also load some GDI functions not present in MinGW libraries + // dynamically. + #if wxUSE_DYNLIB_CLASS + #include "wx/dynlib.h" + + #define USE_DYNAMIC_GDI_FUNCS + #endif +#endif // _MSC_VER/!_MSC_VER + using namespace wxMSWImpl; #ifndef AC_SRC_ALPHA @@ -67,17 +92,7 @@ using namespace wxMSWImpl; #define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) #endif -// apparently with MicroWindows it is possible that HDC is 0 so we have to -// check for this ourselves -#ifdef __WXMICROWIN__ - #define WXMICROWIN_CHECK_HDC if ( !GetHDC() ) return; - #define WXMICROWIN_CHECK_HDC_RET(x) if ( !GetHDC() ) return x; -#else - #define WXMICROWIN_CHECK_HDC - #define WXMICROWIN_CHECK_HDC_RET(x) -#endif - -IMPLEMENT_ABSTRACT_CLASS(wxMSWDCImpl, wxDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxMSWDCImpl, wxDCImpl); // --------------------------------------------------------------------------- // constants @@ -102,134 +117,20 @@ static const int VIEWPORT_EXTENT = 134217727; coordinates used. */ -#ifdef __WXWINCE__ - #define XLOG2DEV(x) ((x-m_logicalOriginX)*m_signX) - #define YLOG2DEV(y) ((y-m_logicalOriginY)*m_signY) - #define XDEV2LOG(x) ((x)*m_signX+m_logicalOriginX) - #define YDEV2LOG(y) ((y)*m_signY+m_logicalOriginY) -#else - #define XLOG2DEV(x) (x) - #define YLOG2DEV(y) (y) - #define XDEV2LOG(x) (x) - #define YDEV2LOG(y) (y) -#endif +#define XLOG2DEV(x) (x) +#define YLOG2DEV(y) (y) +#define XDEV2LOG(x) (x) +#define YDEV2LOG(y) (y) // --------------------------------------------------------------------------- // private functions // --------------------------------------------------------------------------- -// convert degrees to radians -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } - -// call AlphaBlend() to blit contents of hdcSrc to hdcDst using alpha -// -// NB: bmpSrc is the bitmap selected in hdcSrc, it is not really needed -// to pass it to this function but as we already have it at the point -// of call anyhow we do -// -// return true if we could draw the bitmap in one way or the other, false -// otherwise -static bool AlphaBlt(HDC hdcDst, - int x, int y, int dstWidth, int dstHeight, - int srcX, int srcY, - int srcWidth, int srcHeight, - HDC hdcSrc, - const wxBitmap& bmp); - -#ifdef wxHAS_RAW_BITMAP - -// our (limited) AlphaBlend() replacement for Windows versions not providing it -static void -wxAlphaBlend(HDC hdcDst, int xDst, int yDst, - int dstWidth, int dstHeight, - int srcX, int srcY, - int srcWidth, int srcHeight, - const wxBitmap& bmpSrc); - -#endif // wxHAS_RAW_BITMAP +#ifdef USE_DYNAMIC_GDI_FUNCS namespace wxMSWImpl { -// Wrappers for the dynamically loaded {Set,Get}Layout() functions. They work -// in exactly the same way as the standard functions and return GDI_ERROR if -// they're not actually available. -DWORD GetLayout(HDC hdc); -DWORD SetLayout(HDC hdc, DWORD dwLayout); - -// Create a compatible HDC and copy the layout of the source DC to it. This is -// necessary in order to draw bitmaps (which are usually blitted from a -// temporary compatible memory DC to the real target DC) using the same layout. -HDC CreateCompatibleDCWithLayout(HDC hdc); - -} // namespace wxMSWImpl - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// instead of duplicating the same code which sets and then restores text -// colours in each wxDC method working with wxSTIPPLE_MASK_OPAQUE brushes, -// encapsulate this in a small helper class - -// wxBrushAttrsSetter: changes the text colours in the ctor if required and -// restores them in the dtor -class wxBrushAttrsSetter : private wxBkModeChanger, - private wxTextColoursChanger -{ -public: - wxBrushAttrsSetter(wxMSWDCImpl& dc); - -private: - wxDECLARE_NO_COPY_CLASS(wxBrushAttrsSetter); -}; - -#ifdef __WXWINCE__ - -#define SET_STRETCH_BLT_MODE(hdc) - -#else // !__WXWINCE__ - -// this class sets the stretch blit mode to COLORONCOLOR during its lifetime -// -// don't use it directly, use SET_STRETCH_BLT_MODE() macro instead as it -// expands to nothing under WinCE which doesn't have SetStretchBltMode() -class StretchBltModeChanger -{ -public: - StretchBltModeChanger(HDC hdc) - : m_hdc(hdc) - { - m_modeOld = ::SetStretchBltMode(m_hdc, COLORONCOLOR); - if ( !m_modeOld ) - { - wxLogLastError(wxT("SetStretchBltMode")); - } - } - - ~StretchBltModeChanger() - { - if ( !::SetStretchBltMode(m_hdc, m_modeOld) ) - { - wxLogLastError(wxT("SetStretchBltMode")); - } - } - -private: - const HDC m_hdc; - - int m_modeOld; - - wxDECLARE_NO_COPY_CLASS(StretchBltModeChanger); -}; - -#define SET_STRETCH_BLT_MODE(hdc) \ - StretchBltModeChanger wxMAKE_UNIQUE_NAME(stretchModeChanger)(hdc) - -#endif // __WXWINCE__/!__WXWINCE__ - -#if wxUSE_DYNLIB_CLASS - // helper class to cache dynamically loaded libraries and not attempt reloading // them if it fails class wxOnceOnlyDLLLoader @@ -241,7 +142,6 @@ public: { } - // return the symbol with the given name or NULL if the DLL not loaded // or symbol not present void *GetSymbol(const wxChar *name) @@ -275,6 +175,33 @@ private: }; static wxOnceOnlyDLLLoader wxMSIMG32DLL(wxT("msimg32")); +static wxOnceOnlyDLLLoader wxGDI32DLL(wxT("gdi32.dll")); + +// Note that originally these function pointers were local static members within +// functions, but we can't do that, because wxWidgets may be initialized, +// uninitialized, and reinitialized within the same program, and our dynamically +// loaded dll's may be unloaded and reloaded as part of that, almost certainly +// ending up at different base addresses due to address space layout +// randomization. +#ifdef USE_DYNAMIC_GDI_FUNCS +typedef BOOL (WINAPI *AlphaBlend_t)(HDC,int,int,int,int, + HDC,int,int,int,int, + BLENDFUNCTION); +static AlphaBlend_t gs_pfnAlphaBlend = NULL; +static bool gs_triedToLoadAlphaBlend = false; + +typedef BOOL (WINAPI *GradientFill_t)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); +static GradientFill_t gs_pfnGradientFill = NULL; +static bool gs_triedToLoadGradientFill = false; + +typedef DWORD (WINAPI *GetLayout_t)(HDC); +static GetLayout_t gs_pfnGetLayout = NULL; +static bool gs_triedToLoadGetLayout = false; + +typedef DWORD (WINAPI *SetLayout_t)(HDC, DWORD); +static SetLayout_t gs_pfnSetLayout = NULL; +static bool gs_triedToLoadSetLayout = false; +#endif // USE_DYNAMIC_GDI_FUNCS // we must ensure that DLLs are unloaded before the static objects cleanup time // because we may hit the notorious DllMain() dead lock in this case if wx is @@ -284,108 +211,249 @@ class wxGDIDLLsCleanupModule : public wxModule { public: virtual bool OnInit() { return true; } - virtual void OnExit() { wxMSIMG32DLL.Unload(); } + virtual void OnExit() + { + wxMSIMG32DLL.Unload(); + wxGDI32DLL.Unload(); +#ifdef USE_DYNAMIC_GDI_FUNCS + gs_pfnGetLayout = NULL; + gs_triedToLoadGetLayout = false; + + gs_pfnSetLayout = NULL; + gs_triedToLoadSetLayout = false; + + gs_pfnAlphaBlend = NULL; + gs_triedToLoadAlphaBlend = false; + + gs_pfnGradientFill = NULL; + gs_triedToLoadGradientFill = false; +#endif // USE_DYNAMIC_GDI_FUNCS + } private: - DECLARE_DYNAMIC_CLASS(wxGDIDLLsCleanupModule) + wxDECLARE_DYNAMIC_CLASS(wxGDIDLLsCleanupModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule); -namespace +} // namespace wxMSWImpl + +#endif // USE_DYNAMIC_GDI_FUNCS + +// Namespace for the wrapper functions, hopefully one day we'll be able to get +// rid of all of them and then it will be easy to find all occurrences of their +// use by just searching for this namespace name. +// +// All of the functions in this namespace must work *exactly* like the standard +// functions with the same name and just return an error if dynamically loading +// them failed. +namespace wxDynLoadWrappers { -#if wxUSE_DC_TRANSFORM_MATRIX +#ifdef USE_DYNAMIC_GDI_FUNCS -// Class used to dynamically load world transform related API functions. -class GdiWorldTransformFuncs +// This is unfortunately necessary because GetLayout() is missing in MinGW +// libgdi32.a import library (at least up to w32api 4.0.3). +DWORD GetLayout(HDC hdc) +{ + if ( !gs_triedToLoadGetLayout ) + { + gs_pfnGetLayout = (GetLayout_t)wxGDI32DLL.GetSymbol(wxT("GetLayout")); + gs_triedToLoadGetLayout = true; + } + + return gs_pfnGetLayout ? gs_pfnGetLayout(hdc) : GDI_ERROR; +} + +// SetLayout is present in newer w32api versions but in older one (e.g. the one +// used by mingw32 4.2 Debian package), so load it dynamically too while we're +// at it. +DWORD SetLayout(HDC hdc, DWORD dwLayout) +{ + if ( !gs_triedToLoadSetLayout ) + { + gs_pfnSetLayout = (SetLayout_t)wxGDI32DLL.GetSymbol(wxT("SetLayout")); + gs_triedToLoadSetLayout = true; + } + + return gs_pfnSetLayout ? gs_pfnSetLayout(hdc, dwLayout) : GDI_ERROR; +} + +// AlphaBlend() requires linking with libmsimg32.a and we want to avoid this as +// it would break all the existing make/project files. +BOOL AlphaBlend(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, + HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, + BLENDFUNCTION bf) +{ + if ( !gs_triedToLoadAlphaBlend ) + { + gs_pfnAlphaBlend = (AlphaBlend_t)wxMSIMG32DLL.GetSymbol(wxT("AlphaBlend")); + gs_triedToLoadAlphaBlend = true; + } + + if ( !gs_pfnAlphaBlend ) + return FALSE; + + return gs_pfnAlphaBlend(hdcDest, xDest, yDest, wDest, hDest, + hdcSrc, xSrc, ySrc, wSrc, hSrc, + bf); +} + +// Just as AlphaBlend(), this one lives in msimg32.dll. +BOOL GradientFill(HDC hdc, PTRIVERTEX pVert, ULONG numVert, + PVOID pMesh, ULONG numMesh, ULONG mode) +{ + if ( !gs_triedToLoadGradientFill ) + { + gs_pfnGradientFill = (GradientFill_t)wxMSIMG32DLL.GetSymbol(wxT("GradientFill")); + gs_triedToLoadGradientFill = true; + } + + if ( !gs_pfnGradientFill ) + return FALSE; + + return gs_pfnGradientFill(hdc, pVert, numVert, pMesh, numMesh, mode); +} + +#elif defined(USE_STATIC_GDI_FUNCS) + +inline +DWORD GetLayout(HDC hdc) +{ + return ::GetLayout(hdc); +} + +inline +DWORD SetLayout(HDC hdc, DWORD dwLayout) +{ + return ::SetLayout(hdc, dwLayout); +} + +inline +BOOL AlphaBlend(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, + HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, + BLENDFUNCTION bf) +{ + return ::AlphaBlend(hdcDest, xDest, yDest, wDest, hDest, + hdcSrc, xSrc, ySrc, wSrc, hSrc, + bf); +} + +inline +BOOL GradientFill(HDC hdc, PTRIVERTEX pVert, ULONG numVert, + PVOID pMesh, ULONG numMesh, ULONG mode) +{ + return ::GradientFill(hdc, pVert, numVert, pMesh, numMesh, mode); +} + +#else // Can't use the functions neither statically nor dynamically. + +inline +DWORD GetLayout(HDC WXUNUSED(hdc)) +{ + return GDI_ERROR; +} + +inline +DWORD SetLayout(HDC WXUNUSED(hdc), DWORD WXUNUSED(dwLayout)) +{ + return GDI_ERROR; +} + +inline +BOOL AlphaBlend(HDC,int,int,int,int, + HDC,int,int,int,int, + BLENDFUNCTION) +{ + return FALSE; +} + +inline +BOOL GradientFill(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG) +{ + return FALSE; +} + +#endif // USE_DYNAMIC_GDI_FUNCS/USE_STATIC_GDI_FUNCS + +} // namespace wxDynLoadWrappers + + +// call AlphaBlend() to blit contents of hdcSrc to dcDst using alpha +// +// NB: bmpSrc is the bitmap selected in hdcSrc, it is not really needed +// to pass it to this function but as we already have it at the point +// of call anyhow we do +// +// return true if we could draw the bitmap in one way or the other, false +// otherwise +static bool AlphaBlt(wxMSWDCImpl* dcSrc, + int x, int y, int dstWidth, int dstHeight, + int srcX, int srcY, + int srcWidth, int srcHeight, + HDC hdcSrc, + const wxBitmap& bmpSrc); + +namespace wxMSWImpl +{ + +// Create a compatible HDC and copy the layout of the source DC to it. This is +// necessary in order to draw bitmaps (which are usually blitted from a +// temporary compatible memory DC to the real target DC) using the same layout. +HDC CreateCompatibleDCWithLayout(HDC hdc); + +} // namespace wxMSWImpl + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// instead of duplicating the same code which sets and then restores text +// colours in each wxDC method working with wxSTIPPLE_MASK_OPAQUE brushes, +// encapsulate this in a small helper class + +// wxBrushAttrsSetter: changes the text colours in the ctor if required and +// restores them in the dtor +class wxBrushAttrsSetter : private wxBkModeChanger, + private wxTextColoursChanger { public: - static bool IsOk() - { - if ( !ms_worldTransformSymbolsLoaded ) - LoadWorldTransformSymbols(); + wxBrushAttrsSetter(wxMSWDCImpl& dc); - return ms_pfnSetGraphicsMode && - ms_pfnSetWorldTransform && - ms_pfnGetWorldTransform && - ms_pfnModifyWorldTransform; +private: + wxDECLARE_NO_COPY_CLASS(wxBrushAttrsSetter); +}; + +// this class sets the stretch blit mode to COLORONCOLOR during its lifetime +class StretchBltModeChanger +{ +public: + StretchBltModeChanger(HDC hdc) + : m_hdc(hdc) + { + m_modeOld = ::SetStretchBltMode(m_hdc, COLORONCOLOR); + if ( !m_modeOld ) + { + wxLogLastError(wxT("SetStretchBltMode")); + } } - typedef int (WINAPI *SetGraphicsMode_t)(HDC, int); - static SetGraphicsMode_t SetGraphicsMode() + ~StretchBltModeChanger() { - if ( !ms_worldTransformSymbolsLoaded ) - LoadWorldTransformSymbols(); - - return ms_pfnSetGraphicsMode; - } - - typedef BOOL (WINAPI *SetWorldTransform_t)(HDC, const XFORM *); - static SetWorldTransform_t SetWorldTransform() - { - if ( !ms_worldTransformSymbolsLoaded ) - LoadWorldTransformSymbols(); - - return ms_pfnSetWorldTransform; - } - - typedef BOOL (WINAPI *GetWorldTransform_t)(HDC, LPXFORM); - static GetWorldTransform_t GetWorldTransform() - { - if ( !ms_worldTransformSymbolsLoaded ) - LoadWorldTransformSymbols(); - - return ms_pfnGetWorldTransform; - } - - typedef BOOL (WINAPI *ModifyWorldTransform_t)(HDC, const XFORM *, DWORD); - static ModifyWorldTransform_t ModifyWorldTransform() - { - if ( !ms_worldTransformSymbolsLoaded ) - LoadWorldTransformSymbols(); - - return ms_pfnModifyWorldTransform; + if ( !::SetStretchBltMode(m_hdc, m_modeOld) ) + { + wxLogLastError(wxT("SetStretchBltMode")); + } } private: - static void LoadWorldTransformSymbols() - { - wxDynamicLibrary dll(wxT("gdi32.dll")); + const HDC m_hdc; - wxDL_INIT_FUNC(ms_pfn, SetGraphicsMode, dll); - wxDL_INIT_FUNC(ms_pfn, SetWorldTransform, dll); - wxDL_INIT_FUNC(ms_pfn, GetWorldTransform, dll); - wxDL_INIT_FUNC(ms_pfn, ModifyWorldTransform, dll); + int m_modeOld; - ms_worldTransformSymbolsLoaded = true; - } - - static SetGraphicsMode_t ms_pfnSetGraphicsMode; - static SetWorldTransform_t ms_pfnSetWorldTransform; - static GetWorldTransform_t ms_pfnGetWorldTransform; - static ModifyWorldTransform_t ms_pfnModifyWorldTransform; - - static bool ms_worldTransformSymbolsLoaded; + wxDECLARE_NO_COPY_CLASS(StretchBltModeChanger); }; -GdiWorldTransformFuncs::SetGraphicsMode_t - GdiWorldTransformFuncs::ms_pfnSetGraphicsMode = NULL; -GdiWorldTransformFuncs::SetWorldTransform_t - GdiWorldTransformFuncs::ms_pfnSetWorldTransform = NULL; -GdiWorldTransformFuncs::GetWorldTransform_t - GdiWorldTransformFuncs::ms_pfnGetWorldTransform = NULL; -GdiWorldTransformFuncs::ModifyWorldTransform_t - GdiWorldTransformFuncs::ms_pfnModifyWorldTransform = NULL; - -bool GdiWorldTransformFuncs::ms_worldTransformSymbolsLoaded = false; - -#endif // wxUSE_DC_TRANSFORM_MATRIX - -} // anonymous namespace - -#endif // wxUSE_DYNLIB_CLASS - // =========================================================================== // implementation // =========================================================================== @@ -515,8 +583,6 @@ void wxMSWDCImpl::SelectOldObjects(WXHDC dc) void wxMSWDCImpl::UpdateClipBox() { - WXMICROWIN_CHECK_HDC - RECT rect; ::GetClipBox(GetHdc(), &rect); @@ -549,41 +615,15 @@ void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn) { wxCHECK_RET( hrgn, wxT("invalid clipping region") ); - WXMICROWIN_CHECK_HDC - // note that we combine the new clipping region with the existing one: this // is compatible with what the other ports do and is the documented // behaviour now (starting with 2.3.3) -#if defined(__WXWINCE__) - RECT rectClip; - if ( !::GetClipBox(GetHdc(), &rectClip) ) - return; - - // GetClipBox returns logical coordinates, so transform to device - rectClip.left = LogicalToDeviceX(rectClip.left); - rectClip.top = LogicalToDeviceY(rectClip.top); - rectClip.right = LogicalToDeviceX(rectClip.right); - rectClip.bottom = LogicalToDeviceY(rectClip.bottom); - - HRGN hrgnDest = ::CreateRectRgn(0, 0, 0, 0); - HRGN hrgnClipOld = ::CreateRectRgn(rectClip.left, rectClip.top, - rectClip.right, rectClip.bottom); - - if ( ::CombineRgn(hrgnDest, hrgnClipOld, (HRGN)hrgn, RGN_AND) != ERROR ) - { - ::SelectClipRgn(GetHdc(), hrgnDest); - } - - ::DeleteObject(hrgnClipOld); - ::DeleteObject(hrgnDest); -#else // !WinCE if ( ::ExtSelectClipRgn(GetHdc(), (HRGN)hrgn, RGN_AND) == ERROR ) { wxLogLastError(wxT("ExtSelectClipRgn")); return; } -#endif // WinCE/!WinCE m_clipping = true; @@ -619,8 +659,6 @@ void wxMSWDCImpl::DoSetDeviceClippingRegion(const wxRegion& region) void wxMSWDCImpl::DestroyClippingRegion() { - WXMICROWIN_CHECK_HDC - if (m_clipping && m_hDC) { #if 1 @@ -655,21 +693,14 @@ bool wxMSWDCImpl::CanDrawBitmap() const bool wxMSWDCImpl::CanGetTextExtent() const { -#ifdef __WXMICROWIN__ - // TODO Extend MicroWindows' GetDeviceCaps function - return true; -#else // What sort of display is it? int technology = ::GetDeviceCaps(GetHdc(), TECHNOLOGY); return (technology == DT_RASDISPLAY) || (technology == DT_RASPRINTER); -#endif } int wxMSWDCImpl::GetDepth() const { - WXMICROWIN_CHECK_HDC_RET(16) - return (int)::GetDeviceCaps(GetHdc(), BITSPIXEL); } @@ -679,8 +710,6 @@ int wxMSWDCImpl::GetDepth() const void wxMSWDCImpl::Clear() { - WXMICROWIN_CHECK_HDC - RECT rect; if (m_window) { @@ -694,14 +723,14 @@ void wxMSWDCImpl::Clear() if (!m_selectedBitmap.IsOk()) return; - rect.left = -m_deviceOriginX; rect.top = -m_deviceOriginY; - rect.right = m_selectedBitmap.GetWidth()-m_deviceOriginX; - rect.bottom = m_selectedBitmap.GetHeight()-m_deviceOriginY; + rect.left = rect.top = 0; + rect.right = m_selectedBitmap.GetWidth(); + rect.bottom = m_selectedBitmap.GetHeight(); } -#ifndef __WXWINCE__ + ::OffsetRect(&rect, -m_deviceOriginX, -m_deviceOriginY); + (void) ::SetMapMode(GetHdc(), MM_TEXT); -#endif DWORD colour = ::GetBkColor(GetHdc()); HBRUSH brush = ::CreateSolidBrush(colour); @@ -711,16 +740,11 @@ void wxMSWDCImpl::Clear() RealizeScaleAndOrigin(); } -bool wxMSWDCImpl::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x), - wxCoord WXUNUSED_IN_WINCE(y), - const wxColour& WXUNUSED_IN_WINCE(col), - wxFloodFillStyle WXUNUSED_IN_WINCE(style)) +bool wxMSWDCImpl::DoFloodFill(wxCoord x, + wxCoord y, + const wxColour& col, + wxFloodFillStyle style) { -#ifdef __WXWINCE__ - return false; -#else - WXMICROWIN_CHECK_HDC_RET(false) - bool success = (0 != ::ExtFloodFill(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), col.GetPixel(), style == wxFLOOD_SURFACE ? FLOODFILLSURFACE @@ -745,13 +769,10 @@ bool wxMSWDCImpl::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x), CalcBoundingBox(x, y); return success; -#endif } bool wxMSWDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const { - WXMICROWIN_CHECK_HDC_RET(false) - wxCHECK_MSG( col, false, wxT("NULL colour parameter in wxMSWDCImpl::GetPixel") ); // get the color of the pixel @@ -764,8 +785,6 @@ bool wxMSWDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - wxCoord x1 = x-VIEWPORT_EXTENT; wxCoord y1 = y-VIEWPORT_EXTENT; wxCoord x2 = x+VIEWPORT_EXTENT; @@ -780,8 +799,6 @@ void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y) void wxMSWDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) { - WXMICROWIN_CHECK_HDC - wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2)); CalcBoundingBox(x1, y1); @@ -799,17 +816,6 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord r = (wxCoord)sqrt(dx*dx + dy*dy); -#ifdef __WXWINCE__ - // Slower emulation since WinCE doesn't support Pie and Arc - double sa = acos((x1-xc)/r)/M_PI*180; // between 0 and 180 - if( y1>yc ) - sa = -sa; // below center - double ea = atan2(yc-y2, x2-xc)/M_PI*180; - DoDrawEllipticArcRot( xc-r, yc-r, 2*r, 2*r, sa, ea ); -#else - - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // treat the special case of full circle separately @@ -850,16 +856,11 @@ void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, CalcBoundingBox(xc - r, yc - r); CalcBoundingBox(xc + r, yc + r); -#endif } void wxMSWDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height) { - // cases when we don't have DrawFrameControl() -#if defined(__SYMANTEC__) || defined(__WXMICROWIN__) - return wxDCBase::DoDrawCheckMark(x1, y1, width, height); -#else // normal case wxCoord x2 = x1 + width, y2 = y1 + height; @@ -869,21 +870,14 @@ void wxMSWDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, rect.right = x2; rect.bottom = y2; -#ifdef __WXWINCE__ - DrawFrameControl(GetHdc(), &rect, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED); -#else DrawFrameControl(GetHdc(), &rect, DFC_MENU, DFCS_MENUCHECK); -#endif CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); -#endif // Microwin/Normal } void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - COLORREF color = 0x00ffffff; if (m_pen.IsOk()) { @@ -899,10 +893,8 @@ void wxMSWDCImpl::DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, - wxPolygonFillMode WXUNUSED_IN_WINCE(fillStyle)) + wxPolygonFillMode fillStyle) { - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // Do things less efficiently if we have offsets @@ -917,13 +909,9 @@ void wxMSWDCImpl::DoDrawPolygon(int n, CalcBoundingBox(cpoints[i].x, cpoints[i].y); } -#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); -#endif (void)Polygon(GetHdc(), cpoints, n); -#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); -#endif delete[] cpoints; } else @@ -932,13 +920,9 @@ void wxMSWDCImpl::DoDrawPolygon(int n, for (i = 0; i < n; i++) CalcBoundingBox(points[i].x, points[i].y); -#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); -#endif (void)Polygon(GetHdc(), (POINT*) points, n); -#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); -#endif } } @@ -950,11 +934,6 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n, wxCoord yoffset, wxPolygonFillMode fillStyle) { -#ifdef __WXWINCE__ - wxDCImpl::DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); -#else - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling int i, cnt; for (i = cnt = 0; i < n; i++) @@ -971,13 +950,9 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n, CalcBoundingBox(cpoints[i].x, cpoints[i].y); } -#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); -#endif (void)PolyPolygon(GetHdc(), cpoints, count, n); -#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); -#endif delete[] cpoints; } else @@ -985,22 +960,14 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n, for (i = 0; i < cnt; i++) CalcBoundingBox(points[i].x, points[i].y); -#ifndef __WXWINCE__ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); -#endif (void)PolyPolygon(GetHdc(), (POINT*) points, count, n); -#ifndef __WXWINCE__ SetPolyFillMode(GetHdc(),prev); -#endif } -#endif - // __WXWINCE__ } void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset) { - WXMICROWIN_CHECK_HDC - // Do things less efficiently if we have offsets if (xoffset != 0 || yoffset != 0) { @@ -1028,28 +995,32 @@ void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wx void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling wxCoord x2 = x + width; wxCoord y2 = y + height; - wxCoord x2dev = XLOG2DEV(x2), + wxCoord x1dev = XLOG2DEV(x), + y1dev = YLOG2DEV(y), + x2dev = XLOG2DEV(x2), y2dev = YLOG2DEV(y2); - // Windows (but not Windows CE) draws the filled rectangles without outline + // Windows draws the filled rectangles without outline // (i.e. drawn with a transparent pen) one pixel smaller in both directions // and we want them to have the same size regardless of which pen is used -#ifndef __WXWINCE__ if ( m_pen.IsTransparent() ) { - x2dev++; + // Right edge to be extended is "displayed right edge" + // and hence its device coordinates depend + // on layout direction and can be either x1 or x2. + if ( GetLayoutDirection() == wxLayout_RightToLeft ) + x1dev--; + else + x2dev++; y2dev++; } -#endif // !__WXWINCE__ - (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), x2dev, y2dev); + (void)Rectangle(GetHdc(), x1dev, y1dev, x2dev, y2dev); CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); @@ -1057,8 +1028,6 @@ void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) { - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // Now, a negative radius value is interpreted to mean @@ -1091,8 +1060,6 @@ void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wx void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling // +1 below makes the ellipse more similar to other platforms. @@ -1109,7 +1076,7 @@ void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord hei CalcBoundingBox(x2, y2); } -#if wxUSE_SPLINES && !defined(__WXWINCE__) +#if wxUSE_SPLINES void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) { // quadratic b-spline to cubic bezier spline conversion @@ -1126,8 +1093,6 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) // B2 = (2*P1 + P2)/3 // B3 = P2 - WXMICROWIN_CHECK_HDC - wxASSERT_MSG( points, wxT("NULL pointer to spline points?") ); const size_t n_points = points->GetCount(); @@ -1206,12 +1171,6 @@ void wxMSWDCImpl::DoDrawSpline(const wxPointList *points) // Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) { -#ifdef __WXWINCE__ - DoDrawEllipticArcRot( x, y, w, h, sa, ea ); -#else - - WXMICROWIN_CHECK_HDC - wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling wxCoord x2 = x + w; @@ -1222,25 +1181,14 @@ void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,doub int rx2 = rx1; int ry2 = ry1; - sa = DegToRad(sa); - ea = DegToRad(ea); + sa = wxDegToRad(sa); + ea = wxDegToRad(ea); rx1 += (int)(100.0 * abs(w) * cos(sa)); ry1 -= (int)(100.0 * abs(h) * m_signY * sin(sa)); rx2 += (int)(100.0 * abs(w) * cos(ea)); ry2 -= (int)(100.0 * abs(h) * m_signY * sin(ea)); - // Swap start and end positions if the end angle is less than the start angle. - if (ea < sa) { - int temp; - temp = rx2; - rx2 = rx1; - rx1 = temp; - temp = ry2; - ry2 = ry1; - ry1 = temp; - } - // draw pie with NULL_PEN first and then outline otherwise a line is // drawn from the start and end points to the centre HPEN hpenOld = (HPEN) ::SelectObject(GetHdc(), (HPEN) ::GetStockObject(NULL_PEN)); @@ -1262,20 +1210,28 @@ void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,doub CalcBoundingBox(x, y); CalcBoundingBox(x2, y2); -#endif } void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - wxCHECK_RET( icon.IsOk(), wxT("invalid icon in DrawIcon") ); -#ifdef __WIN32__ - ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL); -#else - ::DrawIcon(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon)); -#endif + // Check if we are printing: notice that it's not enough to just check for + // DT_RASPRINTER as this is also the kind of print preview HDC, but its + // type is OBJ_ENHMETADC while the type of the "real" printer DC is OBJ_DC. + if ( ::GetDeviceCaps(GetHdc(), TECHNOLOGY) == DT_RASPRINTER && + ::GetObjectType(GetHdc()) == OBJ_DC ) + { + // DrawIcon API doesn't work for printer DCs (printer DC is write-only + // and DrawIcon requires DC supporting SRCINVERT ROP). + // We need to convert icon to bitmap and use alternative API calls. + wxBitmap bmp(icon); + DoDrawBitmap(bmp, x, y, !bmp.HasAlpha() /* use mask */); + } + else + { + ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL); + } CalcBoundingBox(x, y); CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight()); @@ -1283,8 +1239,6 @@ void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask ) { - WXMICROWIN_CHECK_HDC - wxCHECK_RET( bmp.IsOk(), wxT("invalid bitmap in wxMSWDCImpl::DrawBitmap") ); int width = bmp.GetWidth(), @@ -1301,11 +1255,15 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool MemoryHDC hdcMem; SelectInHDC select(hdcMem, GetHbitmapOf(bmp)); - if ( AlphaBlt(GetHdc(), x, y, width, height, 0, 0, width, height, hdcMem, bmp) ) + if ( AlphaBlt(this, x, y, width, height, 0, 0, width, height, hdcMem, bmp) ) + { + CalcBoundingBox(x, y); + CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); return; + } } - SET_STRETCH_BLT_MODE(GetHdc()); + StretchBltModeChanger stretchModeChanger(GetHdc()); if ( useMask ) { @@ -1322,7 +1280,6 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool } if ( useMask ) { -#ifdef __WIN32__ // use MaskBlt() with ROP which doesn't do anything to dst in the mask // points bool ok = false; @@ -1367,7 +1324,6 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool } if ( !ok ) -#endif // Win32 { // Rather than reproduce wxMSWDCImpl::Blit, let's do it at the wxWin API // level @@ -1409,6 +1365,9 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool ::SelectObject( memdc, hOldBitmap ); ::DeleteDC( memdc ); } + + CalcBoundingBox(x, y); + CalcBoundingBox(x + bmp.GetWidth(), y + bmp.GetHeight()); } void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) @@ -1425,7 +1384,10 @@ void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) return; } - WXMICROWIN_CHECK_HDC + // prepare for drawing the text + wxTextColoursChanger textCol(GetHdc(), *this); + + wxBkModeChanger bkMode(GetHdc(), m_backgroundMode); DrawAnyText(text, x, y); @@ -1439,13 +1401,6 @@ void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y) void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - - // prepare for drawing the text - wxTextColoursChanger textCol(GetHdc(), *this); - - wxBkModeChanger bkMode(GetHdc(), m_backgroundMode); - if ( ::ExtTextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), 0, NULL, text.c_str(), text.length(), NULL) == 0 ) { @@ -1457,8 +1412,6 @@ void wxMSWDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { - WXMICROWIN_CHECK_HDC - // we test that we have some font because otherwise we should still use the // "else" part below to avoid that DrawRotatedText(angle = 180) and // DrawRotatedText(angle = 0) use different fonts (we can't use the default @@ -1466,60 +1419,73 @@ void wxMSWDCImpl::DoDrawRotatedText(const wxString& text, if ( (angle == 0.0) && m_font.IsOk() ) { DoDrawText(text, x, y); + + // Bounding box already updated by DoDrawText(), no need to do it again. + return; } -#ifndef __WXMICROWIN__ - else + + // NB: don't take DEFAULT_GUI_FONT (a.k.a. wxSYS_DEFAULT_GUI_FONT) + // because it's not TrueType and so can't have non zero + // orientation/escapement under Win9x + wxFont font = m_font.IsOk() ? m_font : *wxSWISS_FONT; + LOGFONT lf; + if ( ::GetObject(GetHfontOf(font), sizeof(lf), &lf) == 0 ) { - // NB: don't take DEFAULT_GUI_FONT (a.k.a. wxSYS_DEFAULT_GUI_FONT) - // because it's not TrueType and so can't have non zero - // orientation/escapement under Win9x - wxFont font = m_font.IsOk() ? m_font : *wxSWISS_FONT; - HFONT hfont = (HFONT)font.GetResourceHandle(); - LOGFONT lf; - if ( ::GetObject(hfont, sizeof(lf), &lf) == 0 ) - { - wxLogLastError(wxT("GetObject(hfont)")); - } - - // GDI wants the angle in tenth of degree - long angle10 = (long)(angle * 10); - lf.lfEscapement = angle10; - lf. lfOrientation = angle10; - - hfont = ::CreateFontIndirect(&lf); - if ( !hfont ) - { - wxLogLastError(wxT("CreateFont")); - } - else - { - HFONT hfontOld = (HFONT)::SelectObject(GetHdc(), hfont); - - DrawAnyText(text, x, y); - - (void)::SelectObject(GetHdc(), hfontOld); - (void)::DeleteObject(hfont); - } - - // call the bounding box by adding all four vertices of the rectangle - // containing the text to it (simpler and probably not slower than - // determining which of them is really topmost/leftmost/...) - wxCoord w, h; - GetOwner()->GetTextExtent(text, &w, &h); - - double rad = DegToRad(angle); - - // "upper left" and "upper right" - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); - - // "bottom left" and "bottom right" - x += (wxCoord)(h*sin(rad)); - y += (wxCoord)(h*cos(rad)); - CalcBoundingBox(x, y); - CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + wxLogLastError(wxT("GetObject(hfont)")); } -#endif + + // GDI wants the angle in tenth of degree + long angle10 = (long)(angle * 10); + lf.lfEscapement = angle10; + lf.lfOrientation = angle10; + + AutoHFONT hfont(lf); + if ( !hfont ) + { + wxLogLastError(wxT("CreateFont")); + return; + } + + SelectInHDC selRotatedFont(GetHdc(), hfont); + + // Get extent of whole text. + wxCoord w, h, heightLine; + GetOwner()->GetMultiLineTextExtent(text, &w, &h, &heightLine); + + // Prepare for drawing the text + wxTextColoursChanger textCol(GetHdc(), *this); + wxBkModeChanger bkMode(GetHdc(), m_backgroundMode); + + // Compute the shift for the origin of the next line. + const double rad = wxDegToRad(angle); + const double dx = heightLine * sin(rad); + const double dy = heightLine * cos(rad); + + // Draw all text line by line + const wxArrayString lines = wxSplit(text, '\n', '\0'); + for ( size_t lineNum = 0; lineNum < lines.size(); lineNum++ ) + { + // Calculate origin for each line to avoid accumulation of + // rounding errors. + DrawAnyText(lines[lineNum], + x + wxRound(lineNum*dx), + y + wxRound(lineNum*dy)); + } + + + // call the bounding box by adding all four vertices of the rectangle + // containing the text to it (simpler and probably not slower than + // determining which of them is really topmost/leftmost/...) + + // "upper left" and "upper right" + CalcBoundingBox(x, y); + CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); + + // "bottom left" and "bottom right" + x += (wxCoord)(h*sin(rad)); + y += (wxCoord)(h*cos(rad)); + CalcBoundingBox(x, y); + CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad))); } // --------------------------------------------------------------------------- @@ -1530,8 +1496,6 @@ void wxMSWDCImpl::DoDrawRotatedText(const wxString& text, void wxMSWDCImpl::DoSelectPalette(bool realize) { - WXMICROWIN_CHECK_HDC - // Set the old object temporarily, in case the assignment deletes an object // that's not yet selected out. if (m_oldPalette) @@ -1583,13 +1547,8 @@ void wxMSWDCImpl::InitializePalette() #endif // wxUSE_PALETTE -// SetFont/Pen/Brush() really ask to be implemented as a single template -// function... but doing it is not worth breaking OpenWatcom build - void wxMSWDCImpl::SetFont(const wxFont& font) { - WXMICROWIN_CHECK_HDC - if ( font == m_font ) return; @@ -1626,8 +1585,6 @@ void wxMSWDCImpl::SetFont(const wxFont& font) void wxMSWDCImpl::SetPen(const wxPen& pen) { - WXMICROWIN_CHECK_HDC - if ( pen == m_pen ) return; @@ -1664,8 +1621,6 @@ void wxMSWDCImpl::SetPen(const wxPen& pen) void wxMSWDCImpl::SetBrush(const wxBrush& brush) { - WXMICROWIN_CHECK_HDC - if ( brush == m_brush ) return; @@ -1726,8 +1681,6 @@ void wxMSWDCImpl::SetBrush(const wxBrush& brush) void wxMSWDCImpl::SetBackground(const wxBrush& brush) { - WXMICROWIN_CHECK_HDC - m_backgroundBrush = brush; if ( m_backgroundBrush.IsOk() ) @@ -1738,8 +1691,6 @@ void wxMSWDCImpl::SetBackground(const wxBrush& brush) void wxMSWDCImpl::SetBackgroundMode(int mode) { - WXMICROWIN_CHECK_HDC - m_backgroundMode = mode; // SetBackgroundColour now only refers to text background @@ -1748,8 +1699,6 @@ void wxMSWDCImpl::SetBackgroundMode(int mode) void wxMSWDCImpl::SetLogicalFunction(wxRasterOperationMode function) { - WXMICROWIN_CHECK_HDC - m_logicalFunction = function; SetRop(m_hDC); @@ -1812,8 +1761,6 @@ void wxMSWDCImpl::EndPage() wxCoord wxMSWDCImpl::GetCharHeight() const { - WXMICROWIN_CHECK_HDC_RET(0) - TEXTMETRIC lpTextMetric; GetTextMetrics(GetHdc(), &lpTextMetric); @@ -1823,8 +1770,6 @@ wxCoord wxMSWDCImpl::GetCharHeight() const wxCoord wxMSWDCImpl::GetCharWidth() const { - WXMICROWIN_CHECK_HDC_RET(0) - TEXTMETRIC lpTextMetric; GetTextMetrics(GetHdc(), &lpTextMetric); @@ -1861,17 +1806,6 @@ void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y wxCoord *descent, wxCoord *externalLeading, const wxFont *font) const { -#ifdef __WXMICROWIN__ - if (!GetHDC()) - { - if (x) *x = 0; - if (y) *y = 0; - if (descent) *descent = 0; - if (externalLeading) *externalLeading = 0; - return; - } -#endif // __WXMICROWIN__ - wxASSERT_MSG( !font || font->IsOk(), wxT("invalid font in wxMSWDCImpl::GetTextExtent") ); wxTextMeasure txm(GetOwner(), font); @@ -1915,7 +1849,6 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() // although it may seem wasteful to always use MM_ANISOTROPIC here instead // of using MM_TEXT if there is no scaling, benchmarking doesn't detect any // noticeable difference between these mapping modes -#ifndef __WXWINCE__ ::SetMapMode(GetHdc(), MM_ANISOTROPIC); // wxWidgets API assumes that the coordinate space is "infinite" (i.e. only @@ -1928,18 +1861,25 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() ApplyEffectiveScale(m_scaleX, m_signX, &devExtX, &logExtX); ApplyEffectiveScale(m_scaleY, m_signY, &devExtY, &logExtY); + // In GDI anisotropic mode only devExt/logExt ratio is important + // so we can reduce the fractions to avoid large numbers + // which could cause arithmetic overflows inside Win API. + int gcd = wxGCD(abs(devExtX), abs(logExtX)); + devExtX /= gcd; + logExtX /= gcd; + gcd = wxGCD(abs(devExtY), abs(logExtY)); + devExtY /= gcd; + logExtY /= gcd; + ::SetViewportExtEx(GetHdc(), devExtX, devExtY, NULL); ::SetWindowExtEx(GetHdc(), logExtX, logExtY, NULL); ::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL); ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL); -#endif } void wxMSWDCImpl::SetMapMode(wxMappingMode mode) { - WXMICROWIN_CHECK_HDC - m_mappingMode = mode; if ( mode == wxMM_TEXT ) @@ -1997,8 +1937,6 @@ void wxMSWDCImpl::SetMapMode(wxMappingMode mode) void wxMSWDCImpl::SetUserScale(double x, double y) { - WXMICROWIN_CHECK_HDC - if ( x == m_userScaleX && y == m_userScaleY ) return; @@ -2010,8 +1948,6 @@ void wxMSWDCImpl::SetUserScale(double x, double y) void wxMSWDCImpl::SetAxisOrientation(bool xLeftRight, bool yBottomUp) { - WXMICROWIN_CHECK_HDC - int signX = xLeftRight ? 1 : -1, signY = yBottomUp ? -1 : 1; @@ -2025,8 +1961,6 @@ void wxMSWDCImpl::SetAxisOrientation(bool xLeftRight, void wxMSWDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - if ( x == m_logicalOriginX && y == m_logicalOriginY ) return; @@ -2038,15 +1972,13 @@ void wxMSWDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y) // For use by wxWidgets only, unless custom units are required. void wxMSWDCImpl::SetLogicalScale(double x, double y) { - WXMICROWIN_CHECK_HDC - wxDCImpl::SetLogicalScale(x,y); + + RealizeScaleAndOrigin(); } void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y) { - WXMICROWIN_CHECK_HDC - if ( x == m_deviceOriginX && y == m_deviceOriginY ) return; @@ -2063,21 +1995,18 @@ void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y) bool wxMSWDCImpl::CanUseTransformMatrix() const { - return GdiWorldTransformFuncs::IsOk(); + return true; } bool wxMSWDCImpl::SetTransformMatrix(const wxAffineMatrix2D &matrix) { - if ( !GdiWorldTransformFuncs::IsOk() ) - return false; - if ( matrix.IsIdentity() ) { ResetTransformMatrix(); return true; } - if ( !GdiWorldTransformFuncs::SetGraphicsMode()(GetHdc(), GM_ADVANCED) ) + if ( !::SetGraphicsMode(GetHdc(), GM_ADVANCED) ) { wxLogLastError(wxT("SetGraphicsMode")); return false; @@ -2095,7 +2024,7 @@ bool wxMSWDCImpl::SetTransformMatrix(const wxAffineMatrix2D &matrix) xform.eDx = tr.m_x; xform.eDy = tr.m_y; - if ( !GdiWorldTransformFuncs::SetWorldTransform()(GetHdc(), &xform) ) + if ( !::SetWorldTransform(GetHdc(), &xform) ) { wxLogLastError(wxT("SetWorldTransform")); return false; @@ -2108,11 +2037,8 @@ wxAffineMatrix2D wxMSWDCImpl::GetTransformMatrix() const { wxAffineMatrix2D transform; - if ( !GdiWorldTransformFuncs::IsOk() ) - return transform; - XFORM xform; - if ( !GdiWorldTransformFuncs::GetWorldTransform()(GetHdc(), &xform) ) + if ( !::GetWorldTransform(GetHdc(), &xform) ) { wxLogLastError(wxT("GetWorldTransform")); return transform; @@ -2127,11 +2053,8 @@ wxAffineMatrix2D wxMSWDCImpl::GetTransformMatrix() const void wxMSWDCImpl::ResetTransformMatrix() { - if ( GdiWorldTransformFuncs::IsOk() ) - { - GdiWorldTransformFuncs::ModifyWorldTransform()(GetHdc(), NULL, MWT_IDENTITY); - GdiWorldTransformFuncs::SetGraphicsMode()(GetHdc(), GM_COMPATIBLE); - } + ::ModifyWorldTransform(GetHdc(), NULL, MWT_IDENTITY); + ::SetGraphicsMode(GetHdc(), GM_COMPATIBLE); } #endif // wxUSE_DC_TRANSFORM_MATRIX @@ -2160,8 +2083,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, { wxCHECK_MSG( source, false, wxT("wxMSWDCImpl::Blit(): NULL wxDC pointer") ); - WXMICROWIN_CHECK_HDC_RET(false) - wxMSWDCImpl *implSrc = wxDynamicCast( source->GetImpl(), wxMSWDCImpl ); if ( !implSrc ) { @@ -2169,7 +2090,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, return false; } - const HDC hdcSrc = GetHdcOf(*implSrc); + HDC hdcSrc = GetHdcOf(*implSrc); // if either the source or destination has alpha channel, we must use // AlphaBlt() as other function don't handle it correctly @@ -2177,9 +2098,13 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, if ( bmpSrc.IsOk() && (bmpSrc.HasAlpha() || (m_selectedBitmap.IsOk() && m_selectedBitmap.HasAlpha())) ) { - if ( AlphaBlt(GetHdc(), xdest, ydest, dstWidth, dstHeight, + if ( AlphaBlt(this, xdest, ydest, dstWidth, dstHeight, xsrc, ysrc, srcWidth, srcHeight, hdcSrc, bmpSrc) ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); return true; + } } wxMask *mask = NULL; @@ -2226,11 +2151,20 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, return false; } + // Most of the operations involve the source or the pattern, but a few of + // them (and only those few, no other are possible) only use destination + // HDC. For them we must not give a valid source HDC to MaskBlt() as it + // still uses it, somehow, and the result is garbage. + if ( dwRop == BLACKNESS || dwRop == WHITENESS || + dwRop == DSTINVERT || dwRop == DSTCOPY ) + { + hdcSrc = NULL; + } + bool success = false; if (useMask) { -#ifdef __WIN32__ // we want the part of the image corresponding to the mask to be // transparent, so use "DSTCOPY" ROP for the mask points (the usual // meaning of fg and bg is inverted which corresponds to wxWin notion @@ -2260,7 +2194,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } if ( !success ) -#endif // Win32 { // Blit bitmap with mask HDC dc_mask ; @@ -2295,7 +2228,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, wxLogLastError(wxT("BitBlt")); } - SET_STRETCH_BLT_MODE(GetHdc()); + StretchBltModeChanger stretchModeChanger(GetHdc()); // copy src to buffer using selected raster op if ( !::StretchBlt(dc_buffer, 0, 0, dstWidth, dstHeight, @@ -2351,8 +2284,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, // if we already have a DIB, draw it using StretchDIBits(), otherwise // use StretchBlt() if available and finally fall back to BitBlt() - // FIXME: use appropriate WinCE functions -#ifndef __WXWINCE__ const int caps = ::GetDeviceCaps(GetHdc(), RASTERCAPS); if ( bmpSrc.IsOk() && (caps & RC_STRETCHDIB) ) { @@ -2363,7 +2294,7 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, sizeof(ds), &ds) == sizeof(ds) ) { - SET_STRETCH_BLT_MODE(GetHdc()); + StretchBltModeChanger stretchModeChanger(GetHdc()); // Unlike all the other functions used here (i.e. AlphaBlt(), // MaskBlt(), BitBlt() and StretchBlt()), StretchDIBits() does @@ -2410,10 +2341,8 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } if ( !success && (caps & RC_STRETCHBLT) ) -#endif - // __WXWINCE__ { - SET_STRETCH_BLT_MODE(GetHdc()); + StretchBltModeChanger stretchModeChanger(GetHdc()); if ( !::StretchBlt ( @@ -2446,13 +2375,17 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, } } + if ( success ) + { + CalcBoundingBox(xdest, ydest); + CalcBoundingBox(xdest + dstWidth, ydest + dstHeight); + } + return success; } void wxMSWDCImpl::GetDeviceSize(int *width, int *height) const { - WXMICROWIN_CHECK_HDC - if ( width ) *width = ::GetDeviceCaps(GetHdc(), HORZRES); if ( height ) @@ -2461,8 +2394,6 @@ void wxMSWDCImpl::GetDeviceSize(int *width, int *height) const void wxMSWDCImpl::DoGetSizeMM(int *w, int *h) const { - WXMICROWIN_CHECK_HDC - // if we implement it in terms of DoGetSize() instead of directly using the // results returned by GetDeviceCaps(HORZ/VERTSIZE) as was done before, it // will also work for wxWindowDC and wxClientDC even though their size is @@ -2491,8 +2422,6 @@ void wxMSWDCImpl::DoGetSizeMM(int *w, int *h) const wxSize wxMSWDCImpl::GetPPI() const { - WXMICROWIN_CHECK_HDC_RET(wxSize(0,0)) - int x = ::GetDeviceCaps(GetHdc(), LOGPIXELSX); int y = ::GetDeviceCaps(GetHdc(), LOGPIXELSY); @@ -2629,10 +2558,10 @@ public: virtual void OnExit() { wxMSWDCImpl::ClearCache(); } private: - DECLARE_DYNAMIC_CLASS(wxDCModule) + wxDECLARE_DYNAMIC_CLASS(wxDCModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule); #endif // wxUSE_DC_CACHEING @@ -2640,222 +2569,164 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) // alpha channel support // ---------------------------------------------------------------------------- -static bool AlphaBlt(HDC hdcDst, +static bool AlphaBlt(wxMSWDCImpl* dcDst, int x, int y, int dstWidth, int dstHeight, int srcX, int srcY, int srcWidth, int srcHeight, HDC hdcSrc, - const wxBitmap& bmp) + const wxBitmap& WXUNUSED_UNLESS_DEBUG(bmpSrc)) { - wxASSERT_MSG( bmp.IsOk() && bmp.HasAlpha(), wxT("AlphaBlt(): invalid bitmap") ); - wxASSERT_MSG( hdcDst && hdcSrc, wxT("AlphaBlt(): invalid HDC") ); + wxASSERT_MSG( bmpSrc.IsOk() && bmpSrc.HasAlpha(), + wxT("AlphaBlt(): invalid bitmap") ); + wxASSERT_MSG( dcDst && hdcSrc, wxT("AlphaBlt(): invalid HDC") ); - // do we have AlphaBlend() and company in the headers? -#if defined(AC_SRC_OVER) && wxUSE_DYNLIB_CLASS - // yes, now try to see if we have it during run-time - typedef BOOL (WINAPI *AlphaBlend_t)(HDC,int,int,int,int, - HDC,int,int,int,int, - BLENDFUNCTION); + BLENDFUNCTION bf; + bf.BlendOp = AC_SRC_OVER; + bf.BlendFlags = 0; + bf.SourceConstantAlpha = 0xff; + bf.AlphaFormat = AC_SRC_ALPHA; - static AlphaBlend_t - pfnAlphaBlend = (AlphaBlend_t)wxMSIMG32DLL.GetSymbol(wxT("AlphaBlend")); - if ( pfnAlphaBlend ) + if ( !wxDynLoadWrappers::AlphaBlend + ( + GetHdcOf(*dcDst), x, y, dstWidth, dstHeight, + hdcSrc, srcX, srcY, srcWidth, srcHeight, + bf + ) ) { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; - bf.BlendFlags = 0; - bf.SourceConstantAlpha = 0xff; - bf.AlphaFormat = AC_SRC_ALPHA; + wxLogLastError(wxT("AlphaBlend")); + return false; + } - if ( pfnAlphaBlend(hdcDst, x, y, dstWidth, dstHeight, - hdcSrc, srcX, srcY, srcWidth, srcHeight, - bf) ) + // There is an extra complication with drawing bitmaps with alpha + // on bitmaps without alpha: AlphaBlt() modifies the alpha + // component of the destination bitmap even if it hadn't had it + // before which is not only unexpected but corrupts the bitmap as + // all its pixels outside of the (x, y, dstWidth, dstHeight) area + // are now fully transparent: they already had 0 value of alpha + // before but it didn't count as long as all other pixels had 0 + // alpha as well, but now that some of them are not transparent any + // more, the rest of pixels with 0 alpha is transparent. So undo + // this to avoid "losing" the existing bitmap contents outside of + // the area affected by AlphaBlt(), see #14403. +#ifdef wxHAS_RAW_BITMAP + const wxBitmap& bmpDst = dcDst->GetSelectedBitmap(); + if ( bmpDst.IsOk() && !bmpDst.HasAlpha() && bmpDst.GetDepth() == 32 ) + { + // We need to deselect the bitmap from the memory DC it is + // currently selected into before modifying it. + wxBitmap bmpOld = bmpDst; + dcDst->DoSelect(wxNullBitmap); + + // Notice the extra block: we must destroy wxAlphaPixelData + // before selecting the bitmap into the DC again. { - // skip wxAlphaBlend() call below - return true; + // Since drawn bitmap can only partially overlap + // with destination bitmap we need to calculate + // efective drawing area location. + const wxRect rectDst(bmpOld.GetSize()); + const wxRect rectDrawn(x, y, dstWidth, dstHeight); + const wxRect r = rectDrawn.Intersect(rectDst); + + wxAlphaPixelData data(bmpOld); + if ( data ) + { + wxAlphaPixelData::Iterator p(data); + + p.Offset(data, r.GetLeft(), r.GetTop()); + for ( int old_y = 0; old_y < r.GetHeight(); old_y++ ) + { + wxAlphaPixelData::Iterator rowStart = p; + for ( int old_x = 0; old_x < r.GetWidth(); old_x++ ) + { + // We choose to use wxALPHA_TRANSPARENT instead + // of perhaps more logical wxALPHA_OPAQUE here + // to ensure that the bitmap remains the same + // as before, i.e. without any alpha at all. + p.Alpha() = wxALPHA_TRANSPARENT; + ++p; + } + + p = rowStart; + p.OffsetY(data, 1); + } + } } - wxLogLastError(wxT("AlphaBlend")); - } -#else - wxUnusedVar(hdcSrc); -#endif // defined(AC_SRC_OVER) + // Using wxAlphaPixelData sets the internal "has alpha" flag + // which is usually what we need, but in this particular case + // we use it to get rid of alpha, not set it, so reset it back. + bmpOld.ResetAlpha(); - // AlphaBlend() unavailable of failed: use our own (probably much slower) - // implementation -#ifdef wxHAS_RAW_BITMAP - wxAlphaBlend(hdcDst, x, y, dstWidth, dstHeight, srcX, srcY, srcWidth, srcHeight, bmp); + dcDst->DoSelect(bmpOld); + } +#endif // wxHAS_RAW_BITMAP return true; -#else // !wxHAS_RAW_BITMAP - // no wxAlphaBlend() neither, fall back to using simple BitBlt() (we lose - // alpha but at least something will be shown like this) - wxUnusedVar(bmp); - return false; -#endif // wxHAS_RAW_BITMAP/!wxHAS_RAW_BITMAP } -// wxAlphaBlend: our fallback if ::AlphaBlend() is unavailable -#ifdef wxHAS_RAW_BITMAP - -static void -wxAlphaBlend(HDC hdcDst, int xDst, int yDst, - int dstWidth, int dstHeight, - int srcX, int srcY, - int srcWidth, int srcHeight, - const wxBitmap& bmpSrc) -{ - // get the destination DC pixels - wxBitmap bmpDst(dstWidth, dstHeight, 32 /* force creating RGBA DIB */); - MemoryHDC hdcMem; - SelectInHDC select(hdcMem, GetHbitmapOf(bmpDst)); - - if ( !::BitBlt(hdcMem, 0, 0, dstWidth, dstHeight, hdcDst, xDst, yDst, SRCCOPY) ) - { - wxLogLastError(wxT("BitBlt")); - } - - // combine them with the source bitmap using alpha - wxAlphaPixelData dataDst(bmpDst), - dataSrc((wxBitmap &)bmpSrc); - - wxCHECK_RET( dataDst && dataSrc, - wxT("failed to get raw data in wxAlphaBlend") ); - - wxAlphaPixelData::Iterator pDst(dataDst), - pSrc(dataSrc); - - - for ( int y = 0; y < dstHeight; y++ ) - { - wxAlphaPixelData::Iterator pDstRowStart = pDst; - - for ( int x = 0; x < dstWidth; x++ ) - { - // source is point sampled, Alpha StretchBlit is ugly on Win95 - // (but does not impact performance) - pSrc.MoveTo(dataSrc, srcX + (srcWidth*x/dstWidth), srcY + (srcHeight*y/dstHeight)); - - // note that source bitmap uses premultiplied alpha (as required by - // the real AlphaBlend) - const unsigned beta = 255 - pSrc.Alpha(); - - pDst.Red() = pSrc.Red() + (beta * pDst.Red() + 127) / 255; - pDst.Blue() = pSrc.Blue() + (beta * pDst.Blue() + 127) / 255; - pDst.Green() = pSrc.Green() + (beta * pDst.Green() + 127) / 255; - - ++pDst; - } - - pDst = pDstRowStart; - pDst.OffsetY(dataDst, 1); - } - - // and finally blit them back to the destination DC - if ( !::BitBlt(hdcDst, xDst, yDst, dstWidth, dstHeight, hdcMem, 0, 0, SRCCOPY) ) - { - wxLogLastError(wxT("BitBlt")); - } -} - -#endif // wxHAS_RAW_BITMAP - void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection) { - // use native function if we have compile-time support it and can load it - // during run-time (linking to it statically would make the program - // unusable on earlier Windows versions) -#if defined(GRADIENT_FILL_RECT_H) && wxUSE_DYNLIB_CLASS - typedef BOOL - (WINAPI *GradientFill_t)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG); - static GradientFill_t pfnGradientFill = - (GradientFill_t)wxMSIMG32DLL.GetSymbol(wxT("GradientFill")); + GRADIENT_RECT grect; + grect.UpperLeft = 0; + grect.LowerRight = 1; - if ( pfnGradientFill ) + // invert colours direction if not filling from left-to-right or + // top-to-bottom + int firstVertex = nDirection == wxNORTH || nDirection == wxWEST ? 1 : 0; + + // one vertex for upper left and one for upper-right + TRIVERTEX vertices[2]; + + vertices[0].x = rect.GetLeft(); + vertices[0].y = rect.GetTop(); + vertices[1].x = rect.GetRight()+1; + vertices[1].y = rect.GetBottom()+1; + + vertices[firstVertex].Red = (COLOR16)(initialColour.Red() << 8); + vertices[firstVertex].Green = (COLOR16)(initialColour.Green() << 8); + vertices[firstVertex].Blue = (COLOR16)(initialColour.Blue() << 8); + vertices[firstVertex].Alpha = 0; + vertices[1 - firstVertex].Red = (COLOR16)(destColour.Red() << 8); + vertices[1 - firstVertex].Green = (COLOR16)(destColour.Green() << 8); + vertices[1 - firstVertex].Blue = (COLOR16)(destColour.Blue() << 8); + vertices[1 - firstVertex].Alpha = 0; + + if ( wxDynLoadWrappers::GradientFill + ( + GetHdc(), + vertices, + WXSIZEOF(vertices), + &grect, + 1, + nDirection == wxWEST || nDirection == wxEAST + ? GRADIENT_FILL_RECT_H + : GRADIENT_FILL_RECT_V + ) ) + { + CalcBoundingBox(rect.GetLeft(), rect.GetBottom()); + CalcBoundingBox(rect.GetRight(), rect.GetTop()); + } + else { - GRADIENT_RECT grect; - grect.UpperLeft = 0; - grect.LowerRight = 1; - - // invert colours direction if not filling from left-to-right or - // top-to-bottom - int firstVertex = nDirection == wxNORTH || nDirection == wxWEST ? 1 : 0; - - // one vertex for upper left and one for upper-right - TRIVERTEX vertices[2]; - - vertices[0].x = rect.GetLeft(); - vertices[0].y = rect.GetTop(); - vertices[1].x = rect.GetRight()+1; - vertices[1].y = rect.GetBottom()+1; - - vertices[firstVertex].Red = (COLOR16)(initialColour.Red() << 8); - vertices[firstVertex].Green = (COLOR16)(initialColour.Green() << 8); - vertices[firstVertex].Blue = (COLOR16)(initialColour.Blue() << 8); - vertices[firstVertex].Alpha = 0; - vertices[1 - firstVertex].Red = (COLOR16)(destColour.Red() << 8); - vertices[1 - firstVertex].Green = (COLOR16)(destColour.Green() << 8); - vertices[1 - firstVertex].Blue = (COLOR16)(destColour.Blue() << 8); - vertices[1 - firstVertex].Alpha = 0; - - if ( (*pfnGradientFill) - ( - GetHdc(), - vertices, - WXSIZEOF(vertices), - &grect, - 1, - nDirection == wxWEST || nDirection == wxEAST - ? GRADIENT_FILL_RECT_H - : GRADIENT_FILL_RECT_V - ) ) - { - // skip call of the base class version below - return; - } - wxLogLastError(wxT("GradientFill")); } -#endif // wxUSE_DYNLIB_CLASS - - wxDCImpl::DoGradientFillLinear(rect, initialColour, destColour, nDirection); } -#if wxUSE_DYNLIB_CLASS - namespace wxMSWImpl { -DWORD GetLayout(HDC hdc) -{ - typedef DWORD (WINAPI *GetLayout_t)(HDC); - static GetLayout_t - wxDL_INIT_FUNC(s_pfn, GetLayout, wxDynamicLibrary(wxT("gdi32.dll"))); - - return s_pfnGetLayout ? s_pfnGetLayout(hdc) : GDI_ERROR; -} - -DWORD SetLayout(HDC hdc, DWORD dwLayout) -{ - typedef DWORD (WINAPI *SetLayout_t)(HDC, DWORD); - static SetLayout_t - wxDL_INIT_FUNC(s_pfn, SetLayout, wxDynamicLibrary(wxT("gdi32.dll"))); - - return s_pfnSetLayout ? s_pfnSetLayout(hdc, dwLayout) : GDI_ERROR; -} - HDC CreateCompatibleDCWithLayout(HDC hdc) { HDC hdcNew = ::CreateCompatibleDC(hdc); if ( hdcNew ) { - DWORD dwLayout = wxMSWImpl::GetLayout(hdc); + DWORD dwLayout = wxDynLoadWrappers::GetLayout(hdc); if ( dwLayout != GDI_ERROR ) - wxMSWImpl::SetLayout(hdcNew, dwLayout); + wxDynLoadWrappers::SetLayout(hdcNew, dwLayout); } return hdcNew; @@ -2865,7 +2736,7 @@ HDC CreateCompatibleDCWithLayout(HDC hdc) wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const { - DWORD layout = wxMSWImpl::GetLayout(GetHdc()); + DWORD layout = wxDynLoadWrappers::GetLayout(GetHdc()); if ( layout == GDI_ERROR ) return wxLayout_Default; @@ -2877,12 +2748,12 @@ void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection dir) { if ( dir == wxLayout_Default ) { - dir = wxTheApp->GetLayoutDirection(); + dir = wxApp::MSWGetDefaultLayout(GetWindow()); if ( dir == wxLayout_Default ) return; } - DWORD layout = wxMSWImpl::GetLayout(GetHdc()); + DWORD layout = wxDynLoadWrappers::GetLayout(GetHdc()); if ( layout == GDI_ERROR ) return; @@ -2891,40 +2762,5 @@ void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection dir) else layout &= ~LAYOUT_RTL; - wxMSWImpl::SetLayout(GetHdc(), layout); + wxDynLoadWrappers::SetLayout(GetHdc(), layout); } - -#else // !wxUSE_DYNLIB_CLASS - -// Provide stubs to avoid ifdefs in the code using these functions. -namespace wxMSWImpl -{ - -DWORD GetLayout(HDC WXUNUSED(hdc)) -{ - return GDI_ERROR; -} - -DWORD SetLayout(HDC WXUNUSED(hdc), DWORD WXUNUSED(dwLayout)) -{ - return GDI_ERROR; -} - -HDC CreateCompatibleDCWithLayout(HDC hdc) -{ - return ::CreateCompatibleDC(hdc); -} - -} // namespace wxMSWImpl - -// we can't provide RTL support without dynamic loading, so stub it out -wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const -{ - return wxLayout_Default; -} - -void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) -{ -} - -#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS diff --git a/Externals/wxWidgets3/src/msw/dcclient.cpp b/Externals/wxWidgets3/src/msw/dcclient.cpp index f8486aa92a..b438082fcc 100644 --- a/Externals/wxWidgets3/src/msw/dcclient.cpp +++ b/Externals/wxWidgets3/src/msw/dcclient.cpp @@ -156,7 +156,7 @@ PaintDCInfos gs_PaintDCInfos; // wxMSWWindowDCImpl // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxMSWDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxMSWDCImpl); wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) : wxMSWDCImpl( owner ) @@ -199,7 +199,7 @@ void wxWindowDCImpl::DoGetSize(int *width, int *height) const // wxClientDCImpl // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl); wxClientDCImpl::wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) @@ -230,7 +230,7 @@ void wxClientDCImpl::InitDC() // we also need to take the menu/toolbar manually into account under // Windows CE because they're just another control there, not anything // special as usually under Windows -#if defined(__WXUNIVERSAL__) || defined(__WXWINCE__) +#if defined(__WXUNIVERSAL__) wxPoint ptOrigin = m_window->GetClientAreaOrigin(); if ( ptOrigin.x || ptOrigin.y ) { @@ -241,7 +241,7 @@ void wxClientDCImpl::InitDC() // clip the DC to avoid overwriting the non client area wxSize size = m_window->GetClientSize(); DoSetClippingRegion(0, 0, size.x, size.y); -#endif // __WXUNIVERSAL__ || __WXWINCE__ +#endif // __WXUNIVERSAL__ } wxClientDCImpl::~wxClientDCImpl() @@ -259,7 +259,7 @@ void wxClientDCImpl::DoGetSize(int *width, int *height) const // wxPaintDCImpl // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl); wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) @@ -363,7 +363,7 @@ public: }; -IMPLEMENT_ABSTRACT_CLASS(wxPaintDCEx,wxPaintDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxPaintDCEx, wxPaintDC); wxPaintDCEx::wxPaintDCEx(wxWindow *window, WXHDC dc) : wxPaintDC(new wxPaintDCExImpl(this, window, dc)) diff --git a/Externals/wxWidgets3/src/msw/dcmemory.cpp b/Externals/wxWidgets3/src/msw/dcmemory.cpp index 018c5fa8c5..d19e6acc16 100644 --- a/Externals/wxWidgets3/src/msw/dcmemory.cpp +++ b/Externals/wxWidgets3/src/msw/dcmemory.cpp @@ -37,7 +37,7 @@ // wxMemoryDCImpl // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxMSWDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxMSWDCImpl); wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxMSWDCImpl( owner ) diff --git a/Externals/wxWidgets3/src/msw/dcprint.cpp b/Externals/wxWidgets3/src/msw/dcprint.cpp index d5c6dbc830..3bce3361fc 100644 --- a/Externals/wxWidgets3/src/msw/dcprint.cpp +++ b/Externals/wxWidgets3/src/msw/dcprint.cpp @@ -46,10 +46,6 @@ #include "wx/printdlg.h" #include "wx/msw/printdlg.h" -#ifndef __WIN32__ - #include -#endif - // mingw32 defines GDI_ERROR incorrectly #if defined(__GNUWIN32__) || !defined(GDI_ERROR) #undef GDI_ERROR @@ -66,7 +62,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxMSWDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxMSWDCImpl); // ============================================================================ // implementation @@ -251,16 +247,8 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) LPTSTR lpszPortName; PRINTDLG pd; - - // Cygwin has trouble believing PRINTDLG is 66 bytes - thinks it is 68 -#ifdef __GNUWIN32__ - memset(&pd, 0, 66); - pd.lStructSize = 66; // sizeof(PRINTDLG); -#else memset(&pd, 0, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); -#endif - pd.hwndOwner = (HWND)NULL; pd.hDevMode = NULL; // Will be created by PrintDlg pd.hDevNames = NULL; // Ditto diff --git a/Externals/wxWidgets3/src/msw/dcscreen.cpp b/Externals/wxWidgets3/src/msw/dcscreen.cpp index 755a59263f..397a227641 100644 --- a/Externals/wxWidgets3/src/msw/dcscreen.cpp +++ b/Externals/wxWidgets3/src/msw/dcscreen.cpp @@ -24,7 +24,7 @@ #include "wx/msw/private.h" -IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxMSWDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxMSWDCImpl); // Create a DC representing the whole screen wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) : diff --git a/Externals/wxWidgets3/src/msw/dde.cpp b/Externals/wxWidgets3/src/msw/dde.cpp index f11a849208..caaf7ee366 100644 --- a/Externals/wxWidgets3/src/msw/dde.cpp +++ b/Externals/wxWidgets3/src/msw/dde.cpp @@ -46,12 +46,6 @@ // macros and constants // ---------------------------------------------------------------------------- -#ifdef __WIN32__ - #define _EXPORT -#else - #define _EXPORT _export -#endif - #if wxUSE_UNICODE #define DDE_CP CP_WINUNICODE #else @@ -71,14 +65,15 @@ static wxDDEConnection *DDEFindConnection(HCONV hConv); static void DDEDeleteConnection(HCONV hConv); static wxDDEServer *DDEFindServer(const wxString& s); -extern "C" HDDEDATA EXPENTRY _EXPORT _DDECallback(WORD wType, - WORD wFmt, - HCONV hConv, - HSZ hsz1, - HSZ hsz2, - HDDEDATA hData, - DWORD lData1, - DWORD lData2); +extern "C" HDDEDATA EXPENTRY +_DDECallback(WORD wType, + WORD wFmt, + HCONV hConv, + HSZ hsz1, + HSZ hsz2, + HDDEDATA hData, + DWORD lData1, + DWORD lData2); // Add topic name to atom table before using in conversations static HSZ DDEAddAtom(const wxString& string); @@ -129,17 +124,17 @@ public: void OnExit() { wxDDECleanUp(); } private: - DECLARE_DYNAMIC_CLASS(wxDDEModule) + wxDECLARE_DYNAMIC_CLASS(wxDDEModule); }; // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxServerBase) -IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxClientBase) -IMPLEMENT_DYNAMIC_CLASS(wxDDEConnection, wxConnectionBase) -IMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxServerBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxClientBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxDDEConnection, wxConnectionBase); +wxIMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule); // ============================================================================ // implementation @@ -777,7 +772,7 @@ bool wxDDEConnection::DoAdvise(const wxString& item, #define DDERETURN HDDEDATA -HDDEDATA EXPENTRY _EXPORT +HDDEDATA EXPENTRY _DDECallback(WORD wType, WORD wFmt, HCONV hConv, diff --git a/Externals/wxWidgets3/src/msw/debughlp.cpp b/Externals/wxWidgets3/src/msw/debughlp.cpp index 161a532933..592595d4a5 100644 --- a/Externals/wxWidgets3/src/msw/debughlp.cpp +++ b/Externals/wxWidgets3/src/msw/debughlp.cpp @@ -1,8 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/msw/debughlp.cpp // Purpose: various Win32 debug helpers -// Author: Vadim Zeitlin -// Modified by: +// Author: Vadim Zeitlin, Suzumizaki-kimitaka // Created: 2005-01-08 (extracted from crashrpt.cpp) // Copyright: (c) 2003-2005 Vadim Zeitlin // Licence: wxWindows licence @@ -26,6 +25,8 @@ #if wxUSE_DBGHELP && wxUSE_DYNLIB_CLASS +#include "wx/scopedarray.h" + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -34,6 +35,59 @@ // ourselves to that many levels of embedded fields inside structs static const unsigned MAX_DUMP_DEPTH = 20; +// ---------------------------------------------------------------------------- +// local helpers +// ---------------------------------------------------------------------------- + +namespace +{ + +// Automatically initialize SizeOfStruct field of debug help structs to the +// correct value. +template +struct SizedStruct : public T +{ + SizedStruct() + { + ::ZeroMemory(this, sizeof(T)); + this->SizeOfStruct = sizeof(T); + } +}; + +// This is used for working with variable-sized SYMBOL_INFO[W] structs that +// have a variable length array as their last field. +template +class VarSizedStruct +{ +public: + VarSizedStruct() + { + ::ZeroMemory(m_buffer, sizeof(T) + MAX_NAME_LEN); + + (*this)->SizeOfStruct = sizeof(T); + (*this)->MaxNameLen = MAX_NAME_LEN; + } + + operator T*() + { + return static_cast(static_cast(m_buffer)); + } + + T* operator->() + { + return *this; + } + +private: + // Currently this is just a constant, we could make it a template parameter + // if we wanted. + enum { MAX_NAME_LEN = 1024 }; + + BYTE m_buffer[sizeof(T) + MAX_NAME_LEN]; +}; + +} // anonymous namespace + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -62,7 +116,8 @@ wxDO_FOR_ALL_SYM_FUNCS(DEFINE_SYM_FUNCTION); // load all function we need from the DLL -static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp) +/* static */ +bool wxDbgHelpDLL::BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp) { #define LOAD_SYM_FUNCTION(func, name) \ wxDbgHelpDLL::func = (wxDbgHelpDLL::func ## _t) \ @@ -73,15 +128,27 @@ static bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp) return false; \ } - wxDO_FOR_ALL_SYM_FUNCS(LOAD_SYM_FUNCTION); + wxDO_FOR_ALL_SYM_FUNCS_REQUIRED(LOAD_SYM_FUNCTION); #undef LOAD_SYM_FUNCTION + #define LOAD_SYM_FUNCTION_OPTIONAL(func, name) \ + if ( dllDbgHelp.HasSymbol(wxT(#name)) ) \ + { \ + wxDbgHelpDLL::func = (wxDbgHelpDLL::func ## _t) \ + dllDbgHelp.GetSymbol(wxT(#name)); \ + } + + wxDO_FOR_ALL_SYM_FUNCS_OPTIONAL(LOAD_SYM_FUNCTION_OPTIONAL); + + #undef LOAD_SYM_FUNCTION_CAN_FAIL + return true; } // called by Init() if we hadn't done this before -static bool DoInit() +/* static */ +bool wxDbgHelpDLL::DoInit() { wxDynamicLibrary dllDbgHelp(wxT("dbghelp.dll"), wxDL_VERBATIM); if ( dllDbgHelp.IsLoaded() ) @@ -170,13 +237,13 @@ DoGetTypeInfo(DWORD64 base, ULONG ti, IMAGEHLP_SYMBOL_TYPE_INFO type, void *rc) static inline bool -DoGetTypeInfo(PSYMBOL_INFO pSym, IMAGEHLP_SYMBOL_TYPE_INFO type, void *rc) +DoGetTypeInfo(wxPSYMBOL_INFO pSym, IMAGEHLP_SYMBOL_TYPE_INFO type, void *rc) { return DoGetTypeInfo(pSym->ModBase, pSym->TypeIndex, type, rc); } static inline -wxDbgHelpDLL::BasicType GetBasicType(PSYMBOL_INFO pSym) +wxDbgHelpDLL::BasicType GetBasicType(wxPSYMBOL_INFO pSym) { wxDbgHelpDLL::BasicType bt; return DoGetTypeInfo(pSym, TI_GET_BASETYPE, &bt) @@ -185,7 +252,7 @@ wxDbgHelpDLL::BasicType GetBasicType(PSYMBOL_INFO pSym) } /* static */ -wxString wxDbgHelpDLL::GetSymbolName(PSYMBOL_INFO pSym) +wxString wxDbgHelpDLL::GetSymbolName(wxPSYMBOL_INFO pSym) { wxString s; @@ -289,7 +356,7 @@ wxDbgHelpDLL::DumpBaseType(BasicType bt, DWORD64 length, PVOID pAddress) } wxString -wxDbgHelpDLL::DumpField(PSYMBOL_INFO pSym, void *pVariable, unsigned level) +wxDbgHelpDLL::DumpField(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level) { wxString s; @@ -336,7 +403,7 @@ wxDbgHelpDLL::DumpField(PSYMBOL_INFO pSym, void *pVariable, unsigned level) // now pass to the type representing the type of this member - SYMBOL_INFO sym = *pSym; + wxSYMBOL_INFO sym = *pSym; if ( !DoGetTypeInfo(pSym, TI_GET_TYPEID, &sym.TypeIndex) ) break; @@ -387,7 +454,7 @@ wxDbgHelpDLL::DumpField(PSYMBOL_INFO pSym, void *pVariable, unsigned level) } /* static */ wxString -wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level) +wxDbgHelpDLL::DumpUDT(wxPSYMBOL_INFO pSym, void *pVariable, unsigned level) { wxString s; @@ -454,7 +521,7 @@ wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level) s << wxT(" {\n"); // Iterate through all children - SYMBOL_INFO sym; + wxSYMBOL_INFO sym; wxZeroMemory(sym); sym.ModBase = pSym->ModBase; for ( unsigned i = 0; i < dwChildrenCount; i++ ) @@ -486,7 +553,7 @@ wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level) /* static */ wxDbgHelpDLL::SymbolTag -wxDbgHelpDLL::DereferenceSymbol(PSYMBOL_INFO pSym, void **ppData) +wxDbgHelpDLL::DereferenceSymbol(wxPSYMBOL_INFO pSym, void **ppData) { SymbolTag tag = SYMBOL_TAG_NULL; for ( ;; ) @@ -523,10 +590,10 @@ wxDbgHelpDLL::DereferenceSymbol(PSYMBOL_INFO pSym, void **ppData) } /* static */ wxString -wxDbgHelpDLL::DumpSymbol(PSYMBOL_INFO pSym, void *pVariable) +wxDbgHelpDLL::DumpSymbol(wxPSYMBOL_INFO pSym, void *pVariable) { wxString s; - SYMBOL_INFO symDeref = *pSym; + wxSYMBOL_INFO symDeref = *pSym; switch ( DereferenceSymbol(&symDeref, &pVariable) ) { default: @@ -552,6 +619,322 @@ wxDbgHelpDLL::DumpSymbol(PSYMBOL_INFO pSym, void *pVariable) return s; } +// ---------------------------------------------------------------------------- +// Helpers for selecting the best available function on the current platform. +// ---------------------------------------------------------------------------- + +// Store the original callback and the data for it: objects of this type are +// used as bridges for the enumeration functions taking callbacks of different +// types. +struct wxEnumLoadedCallbackBridge +{ +public: + wxEnumLoadedCallbackBridge(wxPENUMLOADED_MODULES_CALLBACK ptr, PVOID content) + : m_callback(ptr), m_data(content) + { + } + + wxPENUMLOADED_MODULES_CALLBACK m_callback; + PVOID m_data; +}; + +// As mentioned near wxPENUMLOADED_MODULES_CALLBACK definition, until v11 of +// the API the parameters were non-const. +#if API_VERSION_NUMBER < 11 + #define wxHAS_NON_CONST_MODULE_NAME + + #define wxMODULE_NAMEA PSTR +#else + #define wxMODULE_NAMEA PCSTR +#endif + +#if defined(UNICODE) && defined(wxHAS_NON_CONST_MODULE_NAME) + +static BOOL CALLBACK +wxEnumLoadedW64Callback(PWSTR ModuleName, + DWORD64 ModuleBase, + ULONG ModuleSize, + PVOID UserContext) +{ + wxEnumLoadedCallbackBridge& + bridge = *static_cast(UserContext); + + return (*bridge.m_callback)(ModuleName, ModuleBase, ModuleSize, bridge.m_data); +} + +#endif // UNICODE && wxHAS_NON_CONST_MODULE_NAME + +static BOOL CALLBACK +wxEnumLoaded64Callback(wxMODULE_NAMEA ModuleName, + DWORD64 ModuleBase, + ULONG ModuleSize, + PVOID UserContext) +{ + wxEnumLoadedCallbackBridge& + bridge = *static_cast(UserContext); + + return (*bridge.m_callback) + ( +#ifdef UNICODE + wxConvLocal.cMB2WC(ModuleName), +#else // !UNICODE + ModuleName, +#endif // UNICODE + ModuleBase, ModuleSize, bridge.m_data + ); +} + +static BOOL CALLBACK +wxEnumLoadedCallback(wxMODULE_NAMEA ModuleName, + DWORD_PTR ModuleBase, + ULONG ModuleSize, + PVOID UserContext) +{ + wxEnumLoadedCallbackBridge& + bridge = *static_cast(UserContext); + + return (*bridge.m_callback) + ( +#ifdef UNICODE + wxConvLocal.cMB2WC(ModuleName), +#else // !UNICODE + ModuleName, +#endif // UNICODE + ModuleBase, ModuleSize, bridge.m_data + ); +} + +/* static */ +BOOL +wxDbgHelpDLL::CallEnumerateLoadedModules(HANDLE handle, + wxPENUMLOADED_MODULES_CALLBACK callback, + PVOID callbackParam) +{ +#ifdef UNICODE + if ( EnumerateLoadedModulesW64 ) + { +#ifdef wxHAS_NON_CONST_MODULE_NAME + // We need to pass by a bridge just to convert non-const module name to + // the const one taken by our callback. + wxEnumLoadedCallbackBridge br(callback, callbackParam); + if ( EnumerateLoadedModulesW64(handle, &wxEnumLoadedW64Callback, &br) ) + return TRUE; +#else // new SDK + // We can use our callback directly. + if ( EnumerateLoadedModulesW64(handle, callback, callbackParam) ) + return TRUE; +#endif // old/new SDK + } +#endif // UNICODE + + if ( EnumerateLoadedModules64 ) + { + // We need a bridge if we need to convert to Unicode or if we're using + // an older SDK with a non-const first argument, so just use it always + // to avoid having too many complicated preprocessor checks. + wxEnumLoadedCallbackBridge br(callback, callbackParam); + if ( EnumerateLoadedModules64(handle, &wxEnumLoaded64Callback, &br) ) + return TRUE; + } + + if ( EnumerateLoadedModules ) + { + // With this function we need a bridge in any case because the type of + // module base argument used by EnumerateLoadedModules() differs from + // that used by EnumerateLoadedModules[W]64(). + wxEnumLoadedCallbackBridge br(callback, callbackParam); + if ( EnumerateLoadedModules(handle, &wxEnumLoadedCallback, &br) ) + return TRUE; + } + + return FALSE; +} + +/* static */ +BOOL +wxDbgHelpDLL::CallSymInitialize(HANDLE hProcess, BOOL fInvadeProcess) +{ +#ifdef UNICODE + if ( SymInitializeW ) + { + if ( SymInitializeW(hProcess, NULL, fInvadeProcess) ) + return TRUE; + } +#endif // UNICODE + + if ( SymInitialize ) + { + if ( SymInitialize(hProcess, NULL, fInvadeProcess) ) + return TRUE; + } + + return FALSE; +} + +/* static */ +BOOL +wxDbgHelpDLL::CallSymFromAddr(HANDLE hProcess, + DWORD64 Address, + size_t* offset, + wxString* name) +{ + DWORD64 dwDisplacement; + +#ifdef UNICODE + if ( SymFromAddrW ) + { + VarSizedStruct infoW; + if ( SymFromAddrW(hProcess, Address, &dwDisplacement, infoW) ) + { + *offset = dwDisplacement; + *name = infoW->Name; + return TRUE; + } + } +#endif // UNICODE + + if ( SymFromAddr ) + { + VarSizedStruct info; + if ( SymFromAddr(hProcess, Address, &dwDisplacement, info) ) + { + *offset = dwDisplacement; + *name = info->Name; + return TRUE; + } + } + + return FALSE; +} + +/* static */ +BOOL +wxDbgHelpDLL::CallSymGetLineFromAddr(HANDLE hProcess, + DWORD64 dwAddr, + wxString* fileName, + size_t* line) +{ + DWORD dwDisplacement; + +#ifdef UNICODE + if ( SymGetLineFromAddrW64 ) + { + SizedStruct lineW64; + if ( SymGetLineFromAddrW64(hProcess, dwAddr, &dwDisplacement, &lineW64) ) + { + *fileName = lineW64.FileName; + *line = lineW64.LineNumber; + return TRUE; + } + } +#endif // UNICODE + + if ( SymGetLineFromAddr64 ) + { + SizedStruct line64; + if ( SymGetLineFromAddr64(hProcess, dwAddr, &dwDisplacement, &line64) ) + { + *fileName = line64.FileName; + *line = line64.LineNumber; + return TRUE; + } + } + + if ( SymGetLineFromAddr ) + { + SizedStruct line32; + if ( SymGetLineFromAddr(hProcess, dwAddr, &dwDisplacement, &line32) ) + { + *fileName = line32.FileName; + *line = line32.LineNumber; + return TRUE; + } + } + + return FALSE; +} + +#ifdef UNICODE + +// Allow to adapt callback supposed to be used with SymEnumSymbolsW() with +// SymEnumSymbols(). +struct wxEnumSymbolsCallbackBridge +{ +public: + wxEnumSymbolsCallbackBridge(PSYM_ENUMERATESYMBOLS_CALLBACKW ptr, PVOID content) + : m_callback(ptr), m_data(content) + { + } + + PSYM_ENUMERATESYMBOLS_CALLBACKW m_callback; + PVOID m_data; +}; + +static BOOL CALLBACK +wxEnumSymbolsCallback(PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext) +{ + wxEnumSymbolsCallbackBridge& + bridge = *static_cast(UserContext); + + const wxWCharBuffer buf = wxConvLocal.cMB2WC(pSymInfo->Name); + const size_t len = buf.length(); + + // Allocate enough space for the wide char version of the struct. + // + // Note that there is no +1 here because sizeof(SYMBOL_INFOW) already + // includes 1 byte of the name. + wxScopedArray symbolBuffer(sizeof(SYMBOL_INFOW) + len*sizeof(WCHAR)); + + SYMBOL_INFOW* const infoW = (SYMBOL_INFOW*)symbolBuffer.get(); + + // Copy the original struct contents except for the last byte, which is the + // first byte of its (narrow) name that we don't need. + CopyMemory(infoW, pSymInfo, sizeof(SYMBOL_INFO) - sizeof(CHAR)); + + // Size is different for narrow and wide variants of the struct, so fix it + // up now. + infoW->SizeOfStruct = sizeof(SYMBOL_INFOW); + + // Finally copy the converted name, which is the reason for doing all this. + wxStrncpy(infoW->Name, buf.data(), len); + + return (*bridge.m_callback)(infoW, SymbolSize, bridge.m_data); +} + +#endif // UNICODE + +/* static */ +BOOL +wxDbgHelpDLL::CallSymEnumSymbols(HANDLE hProcess, + ULONG64 baseOfDll, + wxPSYM_ENUMERATESYMBOLS_CALLBACK callback, + const PVOID callbackParam) +{ +#ifdef UNICODE + if ( SymEnumSymbolsW ) + { + if ( SymEnumSymbolsW(hProcess, baseOfDll, NULL, callback, callbackParam) ) + return TRUE; + } + + if ( SymEnumSymbols ) + { + wxEnumSymbolsCallbackBridge br(callback, callbackParam); + + if ( SymEnumSymbols(hProcess, baseOfDll, NULL, wxEnumSymbolsCallback, &br) ) + return TRUE; + } +#else // !UNICODE + if ( SymEnumSymbols ) + { + if ( SymEnumSymbols(hProcess, baseOfDll, NULL, callback, callbackParam) ) + return TRUE; + } +#endif // UNICODE/!UNICODE + + return FALSE; +} + // ---------------------------------------------------------------------------- // debugging helpers // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/dialog.cpp b/Externals/wxWidgets3/src/msw/dialog.cpp index d199ae278b..8a7c94945a 100644 --- a/Externals/wxWidgets3/src/msw/dialog.cpp +++ b/Externals/wxWidgets3/src/msw/dialog.cpp @@ -42,10 +42,6 @@ #include "wx/evtloop.h" #include "wx/scopedptr.h" -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - #include "wx/msw/wince/resources.h" -#endif // __SMARTPHONE__ && __WXWINCE__ - // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- @@ -89,12 +85,7 @@ void wxDialog::Init() { m_isShown = false; m_modalData = NULL; -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - m_dialogToolBar = NULL; -#endif -#if wxUSE_DIALOG_SIZEGRIP m_hGripper = 0; -#endif // wxUSE_DIALOG_SIZEGRIP } bool wxDialog::Create(wxWindow *parent, @@ -116,14 +107,6 @@ bool wxDialog::Create(wxWindow *parent, if ( !m_hasFont ) SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - SetLeftMenu(wxID_OK, _("OK")); -#endif -#if wxUSE_TOOLBAR && defined(__POCKETPC__) - CreateToolBar(); -#endif - -#if wxUSE_DIALOG_SIZEGRIP if ( HasFlag(wxRESIZE_BORDER) ) { CreateGripper(); @@ -131,7 +114,6 @@ bool wxDialog::Create(wxWindow *parent, Connect(wxEVT_CREATE, wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); } -#endif // wxUSE_DIALOG_SIZEGRIP return true; } @@ -141,9 +123,7 @@ wxDialog::~wxDialog() // this will also reenable all the other windows for a modal dialog Show(false); -#if wxUSE_DIALOG_SIZEGRIP DestroyGripper(); -#endif // wxUSE_DIALOG_SIZEGRIP } // ---------------------------------------------------------------------------- @@ -229,8 +209,6 @@ void wxDialog::EndModal(int retCode) // wxDialog gripper handling // ---------------------------------------------------------------------------- -#if wxUSE_DIALOG_SIZEGRIP - void wxDialog::SetWindowStyleFlag(long style) { wxDialogBase::SetWindowStyleFlag(style); @@ -319,49 +297,10 @@ void wxDialog::OnWindowCreate(wxWindowCreateEvent& event) event.Skip(); } -#endif // wxUSE_DIALOG_SIZEGRIP - // ---------------------------------------------------------------------------- // wxWin event handlers // ---------------------------------------------------------------------------- -#ifdef __POCKETPC__ -// Responds to the OK button in a PocketPC titlebar. This -// can be overridden, or you can change the id used for -// sending the event, by calling SetAffirmativeId. -bool wxDialog::DoOK() -{ - const int idOk = GetAffirmativeId(); - if ( EmulateButtonClickIfPresent(idOk) ) - return true; - - wxCommandEvent event(wxEVT_BUTTON, GetAffirmativeId()); - event.SetEventObject(this); - - return HandleWindowEvent(event); -} -#endif // __POCKETPC__ - -#if wxUSE_TOOLBAR && defined(__POCKETPC__) -// create main toolbar by calling OnCreateToolBar() -wxToolBar* wxDialog::CreateToolBar(long style, wxWindowID winid, const wxString& name) -{ - m_dialogToolBar = OnCreateToolBar(style, winid, name); - - return m_dialogToolBar; -} - -// return a new toolbar -wxToolBar *wxDialog::OnCreateToolBar(long style, - wxWindowID winid, - const wxString& name) -{ - return new wxToolMenuBar(this, winid, - wxDefaultPosition, wxDefaultSize, - style, name); -} -#endif - // --------------------------------------------------------------------------- // dialog Windows messages processing // --------------------------------------------------------------------------- @@ -373,28 +312,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar switch ( message ) { -#ifdef __WXWINCE__ - // react to pressing the OK button in the title - case WM_COMMAND: - { - switch ( LOWORD(wParam) ) - { -#ifdef __POCKETPC__ - case IDOK: - processed = DoOK(); - if (!processed) - processed = !Close(); -#endif -#ifdef __SMARTPHONE__ - case IDM_LEFT: - case IDM_RIGHT: - processed = HandleCommand( LOWORD(wParam) , 0 , NULL ); - break; -#endif // __SMARTPHONE__ - } - break; - } -#endif case WM_CLOSE: // if we can't close, tell the system that we processed the // message - otherwise it would close us @@ -402,7 +319,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar break; case WM_SIZE: -#if wxUSE_DIALOG_SIZEGRIP if ( m_hGripper ) { switch ( wParam ) @@ -415,7 +331,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar ShowGripper(true); } } -#endif // wxUSE_DIALOG_SIZEGRIP // the Windows dialogs unfortunately are not meant to be resizable // at all and their standard class doesn't include CS_[VH]REDRAW @@ -430,34 +345,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar ::InvalidateRect(GetHwnd(), NULL, false /* erase bg */); } break; - -#ifndef __WXMICROWIN__ - case WM_SETCURSOR: - // we want to override the busy cursor for modal dialogs: - // typically, wxBeginBusyCursor() is called and then a modal dialog - // is shown, but the modal dialog shouldn't have hourglass cursor - if ( IsModal() && wxIsBusy() ) - { - // set our cursor for all windows (but see below) - wxCursor cursor = m_cursor; - if ( !cursor.IsOk() ) - cursor = wxCURSOR_ARROW; - - ::SetCursor(GetHcursorOf(cursor)); - - // in any case, stop here and don't let wxWindow process this - // message (it would set the busy cursor) - processed = true; - - // but return false to tell the child window (if the event - // comes from one of them and not from ourselves) that it can - // set its own cursor if it has one: thus, standard controls - // (e.g. text ctrl) still have correct cursors in a dialog - // invoked while wxIsBusy() - rc = false; - } - break; -#endif // __WXMICROWIN__ } if ( !processed ) diff --git a/Externals/wxWidgets3/src/msw/dialup.cpp b/Externals/wxWidgets3/src/msw/dialup.cpp index 11dd018294..61988328a9 100644 --- a/Externals/wxWidgets3/src/msw/dialup.cpp +++ b/Externals/wxWidgets3/src/msw/dialup.cpp @@ -40,18 +40,17 @@ #include "wx/msw/private.h" #include "wx/msw/private/hiddenwin.h" +#include "wx/msw/private/event.h" #include "wx/dynlib.h" wxDEFINE_EVENT( wxEVT_DIALUP_CONNECTED, wxDialUpEvent ); wxDEFINE_EVENT( wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent ); -// Doesn't yet compile under VC++ 4, BC++, Watcom C++, +// Doesn't yet compile under BC++ // Wine: no wininet.h #if (!defined(__BORLANDC__) || (__BORLANDC__>=0x550)) && \ (!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION(0, 5)) && \ - !defined(__GNUWIN32_OLD__) && \ - !defined(__WINE__) && \ - (!defined(__VISUALC__) || (__VISUALC__ >= 1020)) + !defined(__WINE__) #include #include @@ -139,8 +138,6 @@ struct WXDLLEXPORT wxRasThreadData wxRasThreadData() { hWnd = 0; - hEventRas = - hEventQuit = 0; dialUpManager = NULL; } @@ -148,17 +145,11 @@ struct WXDLLEXPORT wxRasThreadData { if ( hWnd ) DestroyWindow(hWnd); - - if ( hEventQuit ) - CloseHandle(hEventQuit); - - if ( hEventRas ) - CloseHandle(hEventRas); } HWND hWnd; // window to send notifications to - HANDLE hEventRas, // automatic event which RAS signals when status changes - hEventQuit; // manual event which we signal when we terminate + wxWinAPI::Event hEventRas, // automatic event which RAS signals when status changes + hEventQuit; // manual event which we signal when we terminate class WXDLLIMPEXP_FWD_CORE wxDialUpManagerMSW *dialUpManager; // the owner }; @@ -310,10 +301,10 @@ public: } private: - DECLARE_DYNAMIC_CLASS(wxDialUpManagerModule) + wxDECLARE_DYNAMIC_CLASS(wxDialUpManagerModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxDialUpManagerModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxDialUpManagerModule, wxModule); // ---------------------------------------------------------------------------- // private functions @@ -577,12 +568,10 @@ void wxDialUpManagerMSW::CleanUpThreadData() { if ( m_hThread ) { - if ( !SetEvent(m_data->hEventQuit) ) - { - wxLogLastError(wxT("SetEvent(RasThreadQuit)")); - } - else // sent quit request to the background thread + if ( m_data->hEventQuit.Set() ) { + // sent quit request to the background thread + // the thread still needs m_data so we can't free it here, rather // let the thread do it itself m_data = NULL; @@ -1068,14 +1057,11 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) if ( ok ) { // first create an event to wait on - m_data->hEventRas = ::CreateEvent + if ( !m_data->hEventRas.Create ( - NULL, // security attribute (default) - FALSE, // manual reset (no, it is automatic) - FALSE, // initial state (not signaled) - NULL // name (no) - ); - if ( !m_data->hEventRas ) + wxWinAPI::Event::AutomaticReset, + wxWinAPI::Event::Nonsignaled + ) ) { wxLogLastError(wxT("CreateEvent(RasStatus)")); @@ -1089,14 +1075,11 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) // here avoids problems with missing the event if wxDialUpManagerMSW // is created and destroyed immediately, before wxRasStatusWindowProc // starts waiting on the event - m_data->hEventQuit = ::CreateEvent + if ( !m_data->hEventQuit.Create ( - NULL, // default security - TRUE, // manual event - FALSE, // initially non signalled - NULL // nameless - ); - if ( !m_data->hEventQuit ) + wxWinAPI::Event::ManualReset, + wxWinAPI::Event::Nonsignaled + ) ) { wxLogLastError(wxT("CreateEvent(RasThreadQuit)")); @@ -1149,6 +1132,8 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) wxLogLastError(wxT("CreateThread(RasStatusThread)")); CleanUpThreadData(); + + ok = false; } } diff --git a/Externals/wxWidgets3/src/msw/dib.cpp b/Externals/wxWidgets3/src/msw/dib.cpp index 5b0bd487d6..ad4b3e0369 100644 --- a/Externals/wxWidgets3/src/msw/dib.cpp +++ b/Externals/wxWidgets3/src/msw/dib.cpp @@ -48,10 +48,6 @@ #include "wx/msw/dib.h" -#ifdef __WXWINCE__ - #include // for SHLoadDIBitmap() -#endif - // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -177,52 +173,6 @@ bool wxDIB::Create(HBITMAP hbmp) return true; } -// Windows CE doesn't have GetDIBits() so use an alternative implementation -// for it -// -// in fact I'm not sure if GetDIBits() is really much better than using -// BitBlt() like this -- it should be faster but I didn't do any tests, if -// anybody has time to do them and by chance finds that GetDIBits() is not -// much faster than BitBlt(), we could always use the Win CE version here -#ifdef __WXWINCE__ - -bool wxDIB::CopyFromDDB(HBITMAP hbmp) -{ - MemoryHDC hdcSrc; - if ( !hdcSrc ) - return false; - - SelectInHDC selectSrc(hdcSrc, hbmp); - if ( !selectSrc ) - return false; - - MemoryHDC hdcDst; - if ( !hdcDst ) - return false; - - SelectInHDC selectDst(hdcDst, m_handle); - if ( !selectDst ) - return false; - - - if ( !::BitBlt( - hdcDst, - 0, 0, m_width, m_height, - hdcSrc, - 0, 0, - SRCCOPY - ) ) - { - wxLogLastError(wxT("BitBlt(DDB -> DIB)")); - - return false; - } - - return true; -} - -#else // !__WXWINCE__ - bool wxDIB::CopyFromDDB(HBITMAP hbmp) { DIBSECTION ds; @@ -253,17 +203,12 @@ bool wxDIB::CopyFromDDB(HBITMAP hbmp) return true; } -#endif // __WXWINCE__/!__WXWINCE__ - // ---------------------------------------------------------------------------- // Loading/saving the DIBs // ---------------------------------------------------------------------------- bool wxDIB::Load(const wxString& filename) { -#ifdef __WXWINCE__ - m_handle = SHLoadDIBitmap(filename); -#else // !__WXWINCE__ m_handle = (HBITMAP)::LoadImage ( wxGetInstance(), @@ -272,7 +217,6 @@ bool wxDIB::Load(const wxString& filename) 0, 0, // don't specify the size LR_CREATEDIBSECTION | LR_LOADFROMFILE ); -#endif // __WXWINCE__ if ( !m_handle ) { @@ -365,8 +309,6 @@ void wxDIB::DoGetObject() const // DDB <-> DIB conversions // ---------------------------------------------------------------------------- -#ifndef __WXWINCE__ - HBITMAP wxDIB::CreateDDB(HDC hdc) const { wxCHECK_MSG( m_handle, 0, wxT("wxDIB::CreateDDB(): invalid object") ); @@ -563,20 +505,14 @@ HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) return hDIB; } -#endif // __WXWINCE__ - // ---------------------------------------------------------------------------- // palette support // ---------------------------------------------------------------------------- -#if wxUSE_PALETTE +#if defined(__WXMSW__) && wxUSE_PALETTE wxPalette *wxDIB::CreatePalette() const { - // GetDIBColorTable not available in eVC3 -#if !defined(__WXMSW__) || defined(_WIN32_WCE) && _WIN32_WCE < 400 - return NULL; -#else wxCHECK_MSG( m_handle, NULL, wxT("wxDIB::CreatePalette(): invalid object") ); DIBSECTION ds; @@ -644,10 +580,9 @@ wxPalette *wxDIB::CreatePalette() const palette->SetHPALETTE((WXHPALETTE)hPalette); return palette; -#endif } -#endif // wxUSE_PALETTE +#endif // defined(__WXMSW__) && wxUSE_PALETTE // ---------------------------------------------------------------------------- // wxImage support @@ -741,7 +676,7 @@ bool wxDIB::Create(const wxImage& image, PixelFormat pf) return true; } -wxImage wxDIB::ConvertToImage() const +wxImage wxDIB::ConvertToImage(ConversionFlags flags) const { wxCHECK_MSG( IsOk(), wxNullImage, wxT("can't convert invalid DIB to wxImage") ); @@ -841,7 +776,7 @@ wxImage wxDIB::ConvertToImage() const if ( hasOpaque && hasTransparent ) hasAlpha = true; - if ( !hasAlpha && image.HasAlpha() ) + if ( !hasAlpha && image.HasAlpha() && flags == Convert_AlphaAuto ) image.ClearAlpha(); return image; diff --git a/Externals/wxWidgets3/src/msw/dir.cpp b/Externals/wxWidgets3/src/msw/dir.cpp index 0867811c70..04f2e83f5e 100644 --- a/Externals/wxWidgets3/src/msw/dir.cpp +++ b/Externals/wxWidgets3/src/msw/dir.cpp @@ -256,7 +256,6 @@ bool wxDirData::Read(wxString *filename) if ( !IsFindDataOk(m_finddata) ) { -#ifdef __WIN32__ DWORD err = ::GetLastError(); if ( err != ERROR_FILE_NOT_FOUND && err != ERROR_NO_MORE_FILES ) @@ -264,7 +263,6 @@ bool wxDirData::Read(wxString *filename) wxLogSysError(err, _("Cannot enumerate files in directory '%s'"), m_dirname.c_str()); } -#endif // __WIN32__ //else: not an error, just no (such) files return false; @@ -283,14 +281,12 @@ bool wxDirData::Read(wxString *filename) { if ( !FindNext(m_finddata, m_filespec, PTR_TO_FINDDATA) ) { -#ifdef __WIN32__ DWORD err = ::GetLastError(); if ( err != ERROR_NO_MORE_FILES ) { wxLogLastError(wxT("FindNext")); } -#endif // __WIN32__ //else: not an error, just no more (such) files return false; @@ -436,21 +432,13 @@ bool wxDir::GetNext(wxString *filename) const // wxGetDirectoryTimes: used by wxFileName::GetTimes() // ---------------------------------------------------------------------------- -#ifdef __WIN32__ - extern bool wxGetDirectoryTimes(const wxString& dirname, FILETIME *ftAccess, FILETIME *ftCreate, FILETIME *ftMod) { -#ifdef __WXWINCE__ - // FindFirst() is going to fail - wxASSERT_MSG( !dirname.empty(), - wxT("incorrect directory name format in wxGetDirectoryTimes") ); -#else // FindFirst() is going to fail wxASSERT_MSG( !dirname.empty() && dirname.Last() != wxT('\\'), wxT("incorrect directory name format in wxGetDirectoryTimes") ); -#endif FIND_STRUCT fs; FIND_DATA fd = FindFirst(dirname, wxEmptyString, &fs); @@ -467,6 +455,3 @@ wxGetDirectoryTimes(const wxString& dirname, return true; } - -#endif // __WIN32__ - diff --git a/Externals/wxWidgets3/src/msw/dirdlg.cpp b/Externals/wxWidgets3/src/msw/dirdlg.cpp index cec2c85b7a..a2bffb09ba 100644 --- a/Externals/wxWidgets3/src/msw/dirdlg.cpp +++ b/Externals/wxWidgets3/src/msw/dirdlg.cpp @@ -25,8 +25,7 @@ #if wxUSE_DIRDLG -#if wxUSE_OLE && !defined(__GNUWIN32_OLD__) && (!defined(__WXWINCE__) || \ - (defined(__HANDHELDPC__) && (_WIN32_WCE >= 500))) +#if wxUSE_OLE #include "wx/dirdlg.h" #include "wx/modalhook.h" @@ -47,7 +46,7 @@ // We can only use IFileDialog under desktop Windows and we need // wxDynamicLibrary for it. -#if wxUSE_DYNLIB_CLASS && !defined(__WXWINCE__) +#if wxUSE_DYNLIB_CLASS #define wxUSE_IFILEDIALOG 1 #else #define wxUSE_IFILEDIALOG 0 @@ -164,7 +163,7 @@ DEFINE_GUID(IID_IFileDialog, // wxWidgets macros // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxDirDialog, wxDialog) +wxIMPLEMENT_CLASS(wxDirDialog, wxDialog); // ---------------------------------------------------------------------------- // private functions prototypes @@ -222,13 +221,18 @@ int wxDirDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); - wxWindow* const parent = GetParent(); + wxWindow* const parent = GetParentForModalDialog(); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; // Use IFileDialog under new enough Windows, it's more user-friendly. int rc; #if wxUSE_IFILEDIALOG - if ( wxGetWinVersion() >= wxWinVersion_Vista ) + // While the new dialog is available under Vista, it may return a wrong + // path there (see http://support.microsoft.com/kb/969885/en-us), so we + // don't use it there by default. We could improve the version test to + // allow its use if the comdlg32.dll version is greater than 6.0.6002.22125 + // as this means that the hotfix correcting this bug is installed. + if ( wxGetWinVersion() > wxWinVersion_Vista ) { rc = ShowIFileDialog(hWndParent); } @@ -256,32 +260,21 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner) bi.hwndOwner = owner; bi.pidlRoot = NULL; bi.pszDisplayName = NULL; - // Please don't change this without checking it compiles - // with eVC++ first. -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - bi.lpszTitle = m_message.mb_str(); -#else bi.lpszTitle = m_message.c_str(); -#endif bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = BrowseCallbackProc; bi.lParam = wxMSW_CONV_LPARAM(m_path); // param for the callback static const int verComCtl32 = wxApp::GetComCtl32Version(); - // we always add the edit box (it doesn't hurt anybody, does it?) if it is - // supported by the system - if ( verComCtl32 >= 471 ) - { - bi.ulFlags |= BIF_EDITBOX; - } + // we always add the edit box (it doesn't hurt anybody, does it?) + bi.ulFlags |= BIF_EDITBOX; // to have the "New Folder" button we must use the "new" dialog style which // is also the only way to have a resizable dialog // - // "new" style is only available in the version 5.0+ of comctl32.dll const bool needNewDir = !HasFlag(wxDD_DIR_MUST_EXIST); - if ( (needNewDir || HasFlag(wxRESIZE_BORDER)) && (verComCtl32 >= 500) ) + if ( needNewDir || HasFlag(wxRESIZE_BORDER) ) { if (needNewDir) { @@ -381,17 +374,26 @@ int wxDirDialog::ShowIFileDialog(WXHWND owner) NULL, wxIID_PPV_ARGS(IShellItem, &folder)); - if ( FAILED(hr) ) - { - wxLogApiError(wxS("SHCreateItemFromParsingName"), hr); - return wxID_NONE; - } - hr = fileDialog->SetFolder(folder); + // Failing to parse the folder name is not really an error, we'll just + // ignore the initial directory in this case, but we should still show + // the dialog. if ( FAILED(hr) ) { - wxLogApiError(wxS("IFileDialog::SetFolder"), hr); - return wxID_NONE; + if ( hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ) + { + wxLogApiError(wxS("SHCreateItemFromParsingName"), hr); + return wxID_NONE; + } + } + else // The folder was parsed correctly. + { + hr = fileDialog->SetFolder(folder); + if ( FAILED(hr) ) + { + wxLogApiError(wxS("IFileDialog::SetFolder"), hr); + return wxID_NONE; + } } } diff --git a/Externals/wxWidgets3/src/msw/display.cpp b/Externals/wxWidgets3/src/msw/display.cpp index ddaec4504b..4f5f6970de 100644 --- a/Externals/wxWidgets3/src/msw/display.cpp +++ b/Externals/wxWidgets3/src/msw/display.cpp @@ -43,7 +43,6 @@ #include "wx/msw/private.h" #include "wx/msw/private/hiddenwin.h" -#ifndef __WXWINCE__ // Older versions of windef.h don't define HMONITOR. Unfortunately, we // can't directly test whether HMONITOR is defined or not in windef.h as // it's not a macro but a typedef, so we test for an unrelated symbol which @@ -68,42 +67,8 @@ #define MONITORINFOF_PRIMARY 0x00000001 #define HMONITOR_DECLARED #endif -#endif // !__WXWINCE__ -// display functions are found in different DLLs under WinCE and normal Win32 -#ifdef __WXWINCE__ -static const wxChar displayDllName[] = wxT("coredll.dll"); -#else static const wxChar displayDllName[] = wxT("user32.dll"); -#endif - -// ---------------------------------------------------------------------------- -// typedefs for dynamically loaded Windows functions -// ---------------------------------------------------------------------------- - -typedef LONG (WINAPI *ChangeDisplaySettingsEx_t)(LPCTSTR lpszDeviceName, - LPDEVMODE lpDevMode, - HWND hwnd, - DWORD dwFlags, - LPVOID lParam); - -typedef BOOL (WINAPI *EnumDisplayMonitors_t)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); -typedef HMONITOR (WINAPI *MonitorFromPoint_t)(POINT,DWORD); -typedef HMONITOR (WINAPI *MonitorFromWindow_t)(HWND,DWORD); -typedef BOOL (WINAPI *GetMonitorInfo_t)(HMONITOR,LPMONITORINFO); - -#ifndef __WXWINCE__ -// emulation of ChangeDisplaySettingsEx() for Win95 -LONG WINAPI ChangeDisplaySettingsExForWin95(LPCTSTR WXUNUSED(lpszDeviceName), - LPDEVMODE lpDevMode, - HWND WXUNUSED(hwnd), - DWORD dwFlags, - LPVOID WXUNUSED(lParam)) -{ - return ::ChangeDisplaySettings(lpDevMode, dwFlags); -} -#endif // !__WXWINCE__ - // ---------------------------------------------------------------------------- // wxDisplayMSW declaration @@ -157,12 +122,6 @@ private: WX_DEFINE_ARRAY(HMONITOR, wxMonitorHandleArray); -// functions dynamically bound by wxDisplayFactoryMSW ctor. -static MonitorFromPoint_t gs_MonitorFromPoint = NULL; -static MonitorFromWindow_t gs_MonitorFromWindow = NULL; -static GetMonitorInfo_t gs_GetMonitorInfo = NULL; -static EnumDisplayMonitors_t gs_EnumDisplayMonitors = NULL; - class wxDisplayFactoryMSW : public wxDisplayFactory { public: @@ -245,7 +204,7 @@ wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; bool wxDisplayMSW::GetMonInfo(MONITORINFOEX& monInfo) const { - if ( !gs_GetMonitorInfo(m_hmon, &monInfo) ) + if ( !::GetMonitorInfo(m_hmon, &monInfo) ) { wxLogLastError(wxT("GetMonitorInfo")); return false; @@ -395,40 +354,12 @@ bool wxDisplayMSW::ChangeMode(const wxVideoMode& mode) pDevMode = &dm; -#ifdef __WXWINCE__ - flags = 0; -#else // !__WXWINCE__ flags = CDS_FULLSCREEN; -#endif // __WXWINCE__/!__WXWINCE__ } - // get pointer to the function dynamically - // - // we're only called from the main thread, so it's ok to use static - // variable - static ChangeDisplaySettingsEx_t pfnChangeDisplaySettingsEx = NULL; - if ( !pfnChangeDisplaySettingsEx ) - { - wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM | wxDL_QUIET); - if ( dllDisplay.IsLoaded() ) - { - wxDL_INIT_FUNC_AW(pfn, ChangeDisplaySettingsEx, dllDisplay); - } - //else: huh, no this DLL must always be present, what's going on?? - -#ifndef __WXWINCE__ - if ( !pfnChangeDisplaySettingsEx ) - { - // we must be under Win95 and so there is no multiple monitors - // support anyhow - pfnChangeDisplaySettingsEx = ChangeDisplaySettingsExForWin95; - } -#endif // !__WXWINCE__ - } - // do change the mode - switch ( pfnChangeDisplaySettingsEx + switch ( ::ChangeDisplaySettingsEx ( GetName().t_str(), // display name pDevMode, // dev mode or NULL to reset @@ -493,25 +424,6 @@ wxDisplayFactoryMSW::wxDisplayFactoryMSW() m_hiddenHwnd = NULL; m_hiddenClass = NULL; - if ( gs_MonitorFromPoint==NULL || gs_MonitorFromWindow==NULL - || gs_GetMonitorInfo==NULL || gs_EnumDisplayMonitors==NULL ) - { - // First initialization, or last initialization failed. - wxDynamicLibrary dllDisplay(displayDllName, wxDL_VERBATIM | wxDL_QUIET); - - wxDL_INIT_FUNC(gs_, MonitorFromPoint, dllDisplay); - wxDL_INIT_FUNC(gs_, MonitorFromWindow, dllDisplay); - wxDL_INIT_FUNC_AW(gs_, GetMonitorInfo, dllDisplay); - wxDL_INIT_FUNC(gs_, EnumDisplayMonitors, dllDisplay); - - // we can safely let dllDisplay go out of scope, the DLL itself will - // still remain loaded as all programs link to it statically anyhow - } - - if ( gs_MonitorFromPoint==NULL || gs_MonitorFromWindow==NULL - || gs_GetMonitorInfo==NULL || gs_EnumDisplayMonitors==NULL ) - return; - DoRefreshMonitors(); // Also create a hidden window to listen for WM_SETTINGCHANGE that we @@ -550,7 +462,7 @@ void wxDisplayFactoryMSW::DoRefreshMonitors() { m_displays.Clear(); - if ( !gs_EnumDisplayMonitors(NULL, NULL, MultimonEnumProc, (LPARAM)this) ) + if ( !::EnumDisplayMonitors(NULL, NULL, MultimonEnumProc, (LPARAM)this) ) { wxLogLastError(wxT("EnumDisplayMonitors")); } @@ -601,14 +513,14 @@ int wxDisplayFactoryMSW::GetFromPoint(const wxPoint& pt) pt2.x = pt.x; pt2.y = pt.y; - return FindDisplayFromHMONITOR(gs_MonitorFromPoint(pt2, + return FindDisplayFromHMONITOR(::MonitorFromPoint(pt2, MONITOR_DEFAULTTONULL)); } int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window) { #ifdef __WXMSW__ - return FindDisplayFromHMONITOR(gs_MonitorFromWindow(GetHwndOf(window), + return FindDisplayFromHMONITOR(::MonitorFromWindow(GetHwndOf(window), MONITOR_DEFAULTTONULL)); #else const wxSize halfsize = window->GetSize() / 2; @@ -623,10 +535,6 @@ int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window) void wxClientDisplayRect(int *x, int *y, int *width, int *height) { -#if defined(__WXMICROWIN__) - *x = 0; *y = 0; - wxDisplaySize(width, height); -#else // Determine the desktop dimensions minus the taskbar and any other // special decorations... RECT r; @@ -636,5 +544,4 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) if (y) *y = r.top; if (width) *width = r.right - r.left; if (height) *height = r.bottom - r.top; -#endif } diff --git a/Externals/wxWidgets3/src/msw/dlmsw.cpp b/Externals/wxWidgets3/src/msw/dlmsw.cpp index a83e47788e..dedc04ce2a 100644 --- a/Externals/wxWidgets3/src/msw/dlmsw.cpp +++ b/Externals/wxWidgets3/src/msw/dlmsw.cpp @@ -28,44 +28,16 @@ #include "wx/msw/debughlp.h" #include "wx/filename.h" +// For MSVC we can link in the required library explicitly, for the other +// compilers (e.g. MinGW) this needs to be done at makefiles level. +#ifdef __VISUALC__ + #pragma comment(lib, "version") +#endif + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- -// wrap some functions from version.dll: load them dynamically and provide a -// clean interface -class wxVersionDLL -{ -public: - // load version.dll and bind to its functions - wxVersionDLL(); - - // return the file version as string, e.g. "x.y.z.w" - wxString GetFileVersion(const wxString& filename) const; - -private: - typedef DWORD (APIENTRY *GetFileVersionInfoSize_t)(PTSTR, PDWORD); - typedef BOOL (APIENTRY *GetFileVersionInfo_t)(PTSTR, DWORD, DWORD, PVOID); - typedef BOOL (APIENTRY *VerQueryValue_t)(const PVOID, PTSTR, PVOID *, PUINT); - - #define DO_FOR_ALL_VER_FUNCS(what) \ - what(GetFileVersionInfoSize); \ - what(GetFileVersionInfo); \ - what(VerQueryValue) - - #define DECLARE_VER_FUNCTION(func) func ## _t m_pfn ## func - - DO_FOR_ALL_VER_FUNCS(DECLARE_VER_FUNCTION); - - #undef DECLARE_VER_FUNCTION - - - wxDynamicLibrary m_dll; - - - wxDECLARE_NO_COPY_CLASS(wxVersionDLL); -}; - // class used to create wxDynamicLibraryDetails objects class WXDLLIMPEXP_BASE wxDynamicLibraryDetailsCreator { @@ -74,94 +46,44 @@ public: struct EnumModulesProcParams { wxDynamicLibraryDetailsArray *dlls; - wxVersionDLL *verDLL; }; - // TODO: fix EnumerateLoadedModules() to use EnumerateLoadedModules64() - #ifdef __WIN64__ - typedef DWORD64 DWORD_32_64; - #else - typedef DWORD DWORD_32_64; - #endif - static BOOL CALLBACK - EnumModulesProc(PCSTR name, DWORD_32_64 base, ULONG size, void *data); + EnumModulesProc(const wxChar* name, DWORD64 base, ULONG size, PVOID data); }; -// ============================================================================ -// wxVersionDLL implementation -// ============================================================================ - // ---------------------------------------------------------------------------- -// loading +// DLL version operations // ---------------------------------------------------------------------------- -wxVersionDLL::wxVersionDLL() -{ - // don't give errors if DLL can't be loaded or used, we're prepared to - // handle it - wxLogNull noLog; - - if ( m_dll.Load(wxT("version.dll"), wxDL_VERBATIM) ) - { - // the functions we load have either 'A' or 'W' suffix depending on - // whether we're in ANSI or Unicode build - #ifdef UNICODE - #define SUFFIX L"W" - #else // ANSI - #define SUFFIX "A" - #endif // UNICODE/ANSI - - #define LOAD_VER_FUNCTION(name) \ - m_pfn ## name = (name ## _t)m_dll.GetSymbol(wxT(#name SUFFIX)); \ - if ( !m_pfn ## name ) \ - { \ - m_dll.Unload(); \ - return; \ - } - - DO_FOR_ALL_VER_FUNCS(LOAD_VER_FUNCTION); - - #undef LOAD_VER_FUNCTION - } -} - -// ---------------------------------------------------------------------------- -// wxVersionDLL operations -// ---------------------------------------------------------------------------- - -wxString wxVersionDLL::GetFileVersion(const wxString& filename) const +static wxString GetFileVersion(const wxString& filename) { wxString ver; - if ( m_dll.IsLoaded() ) - { - wxChar *pc = const_cast((const wxChar*) filename.t_str()); + wxChar *pc = const_cast((const wxChar*) filename.t_str()); - DWORD dummy; - DWORD sizeVerInfo = m_pfnGetFileVersionInfoSize(pc, &dummy); - if ( sizeVerInfo ) + DWORD dummy; + DWORD sizeVerInfo = ::GetFileVersionInfoSize(pc, &dummy); + if ( sizeVerInfo ) + { + wxCharBuffer buf(sizeVerInfo); + if ( ::GetFileVersionInfo(pc, 0, sizeVerInfo, buf.data()) ) { - wxCharBuffer buf(sizeVerInfo); - if ( m_pfnGetFileVersionInfo(pc, 0, sizeVerInfo, buf.data()) ) + void *pVer; + UINT sizeInfo; + if ( ::VerQueryValue(buf.data(), + const_cast(wxT("\\")), + &pVer, + &sizeInfo) ) { - void *pVer; - UINT sizeInfo; - if ( m_pfnVerQueryValue(buf.data(), - const_cast(wxT("\\")), - &pVer, - &sizeInfo) ) - { - VS_FIXEDFILEINFO *info = (VS_FIXEDFILEINFO *)pVer; - ver.Printf(wxT("%d.%d.%d.%d"), - HIWORD(info->dwFileVersionMS), - LOWORD(info->dwFileVersionMS), - HIWORD(info->dwFileVersionLS), - LOWORD(info->dwFileVersionLS)); - } + VS_FIXEDFILEINFO *info = (VS_FIXEDFILEINFO *)pVer; + ver.Printf(wxT("%d.%d.%d.%d"), + HIWORD(info->dwFileVersionMS), + LOWORD(info->dwFileVersionMS), + HIWORD(info->dwFileVersionLS), + LOWORD(info->dwFileVersionLS)); } } } - //else: we failed to load DLL, can't retrieve version info return ver; } @@ -172,8 +94,8 @@ wxString wxVersionDLL::GetFileVersion(const wxString& filename) const /* static */ BOOL CALLBACK -wxDynamicLibraryDetailsCreator::EnumModulesProc(PCSTR name, - DWORD_32_64 base, +wxDynamicLibraryDetailsCreator::EnumModulesProc(const wxChar* name, + DWORD64 base, ULONG size, void *data) { @@ -198,7 +120,7 @@ wxDynamicLibraryDetailsCreator::EnumModulesProc(PCSTR name, if ( !fullname.empty() ) { details->m_path = fullname; - details->m_version = params->verDLL->GetFileVersion(fullname); + details->m_version = GetFileVersion(fullname); } } @@ -249,11 +171,7 @@ void wxDynamicLibrary::Unload(wxDllType handle) void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name) { return (void *)::GetProcAddress(handle, -#ifdef __WXWINCE__ - name.t_str() -#else name.ToAscii() -#endif // __WXWINCE__ ); } @@ -269,22 +187,12 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() #if wxUSE_DBGHELP if ( wxDbgHelpDLL::Init() ) { - // prepare to use functions for version info extraction - wxVersionDLL verDLL; - wxDynamicLibraryDetailsCreator::EnumModulesProcParams params; params.dlls = &dlls; - params.verDLL = &verDLL; - // Note that the cast of EnumModulesProc is needed because the type of - // PENUMLOADED_MODULES_CALLBACK changed: in old SDK versions its first - // argument was non-const PSTR while now it's PCSTR. By explicitly - // casting to whatever the currently used headers require we ensure - // that the code compilers in any case. - if ( !wxDbgHelpDLL::EnumerateLoadedModules + if ( !wxDbgHelpDLL::CallEnumerateLoadedModules ( ::GetCurrentProcess(), - (PENUMLOADED_MODULES_CALLBACK) wxDynamicLibraryDetailsCreator::EnumModulesProc, ¶ms ) ) @@ -297,6 +205,79 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() return dlls; } +// ---------------------------------------------------------------------------- +// Getting the module from an address inside it +// ---------------------------------------------------------------------------- + +namespace +{ + +// Tries to dynamically load GetModuleHandleEx() from kernel32.dll and call it +// to get the module handle from the given address. Returns NULL if it fails to +// either resolve the function (which can only happen on pre-Vista systems +// normally) or if the function itself failed. +HMODULE CallGetModuleHandleEx(const void* addr) +{ + typedef BOOL (WINAPI *GetModuleHandleEx_t)(DWORD, LPCTSTR, HMODULE *); + static const GetModuleHandleEx_t INVALID_FUNC_PTR = (GetModuleHandleEx_t)-1; + + static GetModuleHandleEx_t s_pfnGetModuleHandleEx = INVALID_FUNC_PTR; + if ( s_pfnGetModuleHandleEx == INVALID_FUNC_PTR ) + { + wxDynamicLibrary dll(wxT("kernel32.dll"), wxDL_VERBATIM); + + wxDL_INIT_FUNC_AW(s_pfn, GetModuleHandleEx, dll); + + // dll object can be destroyed, kernel32.dll won't be unloaded anyhow + } + + if ( !s_pfnGetModuleHandleEx ) + return NULL; + + // flags are GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | + // GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS + HMODULE hmod; + if ( !s_pfnGetModuleHandleEx(6, (LPCTSTR)addr, &hmod) ) + return NULL; + + return hmod; +} + +} // anonymous namespace + +/* static */ +void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) +{ + HMODULE hmod = CallGetModuleHandleEx(addr); + if ( !hmod ) + { + wxLogLastError(wxT("GetModuleHandleEx")); + return NULL; + } + + if ( path ) + { + TCHAR libname[MAX_PATH]; + if ( !::GetModuleFileName(hmod, libname, MAX_PATH) ) + { + // GetModuleFileName could also return extended-length paths (paths + // prepended with "//?/", maximum length is 32767 charachters) so, + // in principle, MAX_PATH could be unsufficient and we should try + // increasing the buffer size here. + wxLogLastError(wxT("GetModuleFromAddress")); + return NULL; + } + + libname[MAX_PATH-1] = wxT('\0'); + + *path = libname; + } + + // In Windows HMODULE is actually the base address of the module so we + // can just cast it to the address. + return reinterpret_cast(hmod); +} + /* static */ WXHMODULE wxDynamicLibrary::MSWGetModuleHandle(const wxString& name, void *addr) { @@ -304,33 +285,9 @@ WXHMODULE wxDynamicLibrary::MSWGetModuleHandle(const wxString& name, void *addr) // because the former works correctly for comctl32.dll while the latter // returns NULL when comctl32.dll version 6 is used under XP (note that // GetModuleHandleEx() is only available under XP and later, coincidence?) + HMODULE hmod = CallGetModuleHandleEx(addr); - // check if we can use GetModuleHandleEx - typedef BOOL (WINAPI *GetModuleHandleEx_t)(DWORD, LPCTSTR, HMODULE *); - - static const GetModuleHandleEx_t INVALID_FUNC_PTR = (GetModuleHandleEx_t)-1; - - static GetModuleHandleEx_t s_pfnGetModuleHandleEx = INVALID_FUNC_PTR; - if ( s_pfnGetModuleHandleEx == INVALID_FUNC_PTR ) - { - wxDynamicLibrary dll(wxT("kernel32.dll"), wxDL_VERBATIM); - s_pfnGetModuleHandleEx = - (GetModuleHandleEx_t)dll.GetSymbolAorW(wxT("GetModuleHandleEx")); - - // dll object can be destroyed, kernel32.dll won't be unloaded anyhow - } - - // get module handle from its address - if ( s_pfnGetModuleHandleEx ) - { - // flags are GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | - // GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS - HMODULE hmod; - if ( s_pfnGetModuleHandleEx(6, (LPCTSTR)addr, &hmod) && hmod ) - return hmod; - } - - return ::GetModuleHandle(name.t_str()); + return hmod ? hmod : ::GetModuleHandle(name.t_str()); } #endif // wxUSE_DYNLIB_CLASS diff --git a/Externals/wxWidgets3/src/msw/dragimag.cpp b/Externals/wxWidgets3/src/msw/dragimag.cpp index a5f6899b47..867ed0455b 100644 --- a/Externals/wxWidgets3/src/msw/dragimag.cpp +++ b/Externals/wxWidgets3/src/msw/dragimag.cpp @@ -44,10 +44,6 @@ #include "wx/msw/dragimag.h" #include "wx/msw/private.h" -#ifdef __WXWINCE__ // for SM_CXCURSOR and SM_CYCURSOR -#include "wx/msw/wince/missing.h" -#endif // __WXWINCE__ - // Wine doesn't have this yet #ifndef ListView_CreateDragImage #define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \ @@ -58,7 +54,7 @@ // macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxDragImage, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxDragImage, wxObject); #define GetHimageList() ((HIMAGELIST) m_hImageList) @@ -147,9 +143,6 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) ImageList_Destroy(GetHimageList()); m_hImageList = 0; -#ifdef __WXWINCE__ - UINT flags = ILC_COLOR; -#else UINT flags wxDUMMY_INITIALIZE(0) ; if (image.GetDepth() <= 4) flags = ILC_COLOR4; @@ -161,7 +154,6 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) flags = ILC_COLOR24; else flags = ILC_COLOR32; -#endif bool mask = (image.GetMask() != 0); @@ -204,9 +196,6 @@ bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) ImageList_Destroy(GetHimageList()); m_hImageList = 0; -#ifdef __WXWINCE__ - UINT flags = ILC_COLOR; -#else UINT flags wxDUMMY_INITIALIZE(0) ; if (image.GetDepth() <= 4) flags = ILC_COLOR4; @@ -218,7 +207,6 @@ bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) flags = ILC_COLOR24; else flags = ILC_COLOR32; -#endif flags |= ILC_MASK; @@ -460,12 +448,8 @@ bool wxDragImage::Move(const wxPoint& pt) rect.left = 0; rect.top = 0; rect.right = 0; rect.bottom = 0; DWORD style = ::GetWindowLong((HWND) m_window->GetHWND(), GWL_STYLE); -#ifdef __WIN32__ DWORD exStyle = ::GetWindowLong((HWND) m_window->GetHWND(), GWL_EXSTYLE); ::AdjustWindowRectEx(& rect, style, FALSE, exStyle); -#else - ::AdjustWindowRect(& rect, style, FALSE); -#endif // Subtract the (negative) values, i.e. add a small increment pt2.x -= rect.left; pt2.y -= rect.top; } diff --git a/Externals/wxWidgets3/src/msw/enhmeta.cpp b/Externals/wxWidgets3/src/msw/enhmeta.cpp index f7c0f7abb0..a0304693d0 100644 --- a/Externals/wxWidgets3/src/msw/enhmeta.cpp +++ b/Externals/wxWidgets3/src/msw/enhmeta.cpp @@ -43,7 +43,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject); // ---------------------------------------------------------------------------- // macros @@ -120,11 +120,12 @@ void wxEnhMetaFile::Assign(const wxEnhMetaFile& mf) } } -void wxEnhMetaFile::Free() +/* static */ +void wxEnhMetaFile::Free(WXHANDLE handle) { - if ( m_hMF ) + if ( handle ) { - if ( !::DeleteEnhMetaFile(GetEMF()) ) + if ( !::DeleteEnhMetaFile((HENHMETAFILE) handle) ) { wxLogLastError(wxT("DeleteEnhMetaFile")); } @@ -332,7 +333,7 @@ wxEnhMetaFileDCImpl::~wxEnhMetaFileDCImpl() // wxEnhMetaFileDC // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC) +wxIMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC); wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename, int width, int height, diff --git a/Externals/wxWidgets3/src/msw/evtloop.cpp b/Externals/wxWidgets3/src/msw/evtloop.cpp index 7c861c3fae..eb053cd33d 100644 --- a/Externals/wxWidgets3/src/msw/evtloop.cpp +++ b/Externals/wxWidgets3/src/msw/evtloop.cpp @@ -34,7 +34,6 @@ #include "wx/thread.h" #include "wx/except.h" #include "wx/msw/private.h" -#include "wx/scopeguard.h" #include "wx/tooltip.h" #if wxUSE_THREADS @@ -135,10 +134,8 @@ bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) if ( wnd->MSWTranslateMessage((WXMSG *)msg)) return true; - // stop at first top level window, i.e. don't try to process the key - // strokes originating in a dialog using the accelerators of the parent - // frame - this doesn't make much sense - if ( wnd->IsTopLevel() ) + // stop at top navigation domain, i.e. typically a top level window + if ( wnd->IsTopNavigationDomain(wxWindow::Navigation_Accel) ) break; } @@ -152,7 +149,7 @@ bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) // if we don't do this, pressing ESC on a modal dialog shown as child // of a modal dialog with wxID_CANCEL will cause the parent dialog to // be closed, for example - if ( wnd->IsTopLevel() ) + if ( wnd->IsTopNavigationDomain(wxWindow::Navigation_Accel) ) break; } @@ -251,11 +248,6 @@ void wxGUIEventLoop::OnNextIteration() #endif // wxUSE_THREADS } -void wxGUIEventLoop::WakeUp() -{ - ::PostMessage(NULL, WM_NULL, 0, 0); -} - // ---------------------------------------------------------------------------- // Yield to incoming messages @@ -264,23 +256,8 @@ void wxGUIEventLoop::WakeUp() #include WX_DEFINE_OBJARRAY(wxMSGArray); -bool wxGUIEventLoop::YieldFor(long eventsToProcess) +void wxGUIEventLoop::DoYieldFor(long eventsToProcess) { - // set the flag and don't forget to reset it before returning - m_isInsideYield = true; - m_eventsToProcessInsideYield = eventsToProcess; - - wxON_BLOCK_EXIT_SET(m_isInsideYield, false); - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); - - // ensure the logs will be flashed again when we exit - wxON_BLOCK_EXIT0(wxLog::Resume); -#endif // wxUSE_LOG - // we don't want to process WM_QUIT from here - it should be processed in // the main event loop in order to stop it MSG msg; @@ -326,7 +303,6 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) bool processNow; switch (msg.message) { -#if !defined(__WXWINCE__) case WM_NCMOUSEMOVE: case WM_NCLBUTTONDOWN: @@ -338,7 +314,6 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) case WM_NCMBUTTONDOWN: case WM_NCMBUTTONUP: case WM_NCMBUTTONDBLCLK: -#endif case WM_KEYDOWN: case WM_KEYUP: @@ -367,10 +342,8 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) case WM_IME_KEYDOWN: case WM_IME_KEYUP: -#if !defined(__WXWINCE__) case WM_MOUSEHOVER: case WM_MOUSELEAVE: -#endif #ifdef WM_NCMOUSELEAVE case WM_NCMOUSELEAVE: #endif @@ -434,9 +407,7 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) } } - // if there are pending events, we must process them. - if (wxTheApp) - wxTheApp->ProcessPendingEvents(); + wxEventLoopBase::DoYieldFor(eventsToProcess); // put back unprocessed events in the queue DWORD id = GetCurrentThreadId(); @@ -447,6 +418,4 @@ bool wxGUIEventLoop::YieldFor(long eventsToProcess) } m_arrMSG.Clear(); - - return true; } diff --git a/Externals/wxWidgets3/src/msw/evtloopconsole.cpp b/Externals/wxWidgets3/src/msw/evtloopconsole.cpp index 5421b86c43..c0ba2716fa 100644 --- a/Externals/wxWidgets3/src/msw/evtloopconsole.cpp +++ b/Externals/wxWidgets3/src/msw/evtloopconsole.cpp @@ -25,7 +25,7 @@ #ifndef WX_PRECOMP #include "wx/log.h" - #include "wx/msw/wrapwin.h" + #include "wx/msw/private.h" #endif //WX_PRECOMP #include "wx/evtloop.h" @@ -42,6 +42,17 @@ wxMSWEventLoopBase::wxMSWEventLoopBase() { m_shouldExit = false; m_exitcode = 0; + + // Create initially not signalled auto-reset event object. + m_heventWake = ::CreateEvent(NULL, FALSE, FALSE, NULL); + if ( !m_heventWake ) + wxLogLastError(wxS("CreateEvent(wake)")); +} + +wxMSWEventLoopBase::~wxMSWEventLoopBase() +{ + if ( m_heventWake && !::CloseHandle(m_heventWake) ) + wxLogLastError(wxS("CloseHandle(wake)")); } // ---------------------------------------------------------------------------- @@ -54,26 +65,36 @@ bool wxMSWEventLoopBase::Pending() const return ::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE) != 0; } +void wxMSWEventLoopBase::WakeUp() +{ + if ( !::SetEvent(m_heventWake) ) + wxLogLastError(wxS("SetEvent(wake)")); +} + +#if wxUSE_THREADS + +WXDWORD wxMSWEventLoopBase::MSWWaitForThread(WXHANDLE hThread) +{ + // The order is important here, the code using this function assumes that + // WAIT_OBJECT_0 indicates the thread termination and anything else -- the + // availability of an input event. So the thread handle must come first. + HANDLE handles[2] = { hThread, m_heventWake }; + return ::MsgWaitForMultipleObjects + ( + WXSIZEOF(handles), // number of objects to wait for + handles, // the objects + false, // wait for any objects, not all + INFINITE, // no timeout + QS_ALLINPUT | // return as soon as there are any events + QS_ALLPOSTMESSAGE + ); +} + +#endif // wxUSE_THREADS + bool wxMSWEventLoopBase::GetNextMessage(WXMSG* msg) { - const BOOL rc = ::GetMessage(msg, NULL, 0, 0); - - if ( rc == 0 ) - { - // got WM_QUIT - return false; - } - - if ( rc == -1 ) - { - // should never happen, but let's test for it nevertheless - wxLogLastError(wxT("GetMessage")); - - // still break from the loop - return false; - } - - return true; + return GetNextMessageTimeout(msg, INFINITE) == TRUE; } int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout) @@ -81,19 +102,14 @@ int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout) // MsgWaitForMultipleObjects() won't notice any input which was already // examined (e.g. using PeekMessage()) but not yet removed from the queue // so we need to remove any immediately messages manually - // - // NB: using MsgWaitForMultipleObjectsEx() could simplify the code here but - // it is not available in very old Windows versions - if ( !::PeekMessage(msg, 0, 0, 0, PM_REMOVE) ) + while ( !::PeekMessage(msg, 0, 0, 0, PM_REMOVE) ) { - // we use this function just in order to not block longer than the - // given timeout, so we don't pass any handles to it at all DWORD rc = ::MsgWaitForMultipleObjects ( - 0, NULL, + 1, &m_heventWake, FALSE, timeout, - QS_ALLINPUT + QS_ALLINPUT | QS_ALLPOSTMESSAGE ); switch ( rc ) @@ -107,13 +123,17 @@ int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout) return -1; case WAIT_OBJECT_0: - if ( !::PeekMessage(msg, 0, 0, 0, PM_REMOVE) ) - { - // somehow it may happen that MsgWaitForMultipleObjects() - // returns true but there are no messages -- just treat it - // the same as timeout then - return -1; - } + // We were woken up by a background thread, which means there + // is no actual input message available, but we should still + // return to the event loop, so pretend there was WM_NULL in + // the queue. + wxZeroMemory(*msg); + return TRUE; + + case WAIT_OBJECT_0 + 1: + // Some message is supposed to be available, but spurious + // wake ups are also possible, so just return to the loop: + // either we'll get the message or start waiting again. break; } } @@ -127,13 +147,6 @@ int wxMSWEventLoopBase::GetNextMessageTimeout(WXMSG *msg, unsigned long timeout) #if wxUSE_CONSOLE_EVENTLOOP -void wxConsoleEventLoop::WakeUp() -{ -#if wxUSE_THREADS - wxWakeUpMainThread(); -#endif -} - void wxConsoleEventLoop::ProcessMessage(WXMSG *msg) { ::DispatchMessage(msg); @@ -162,4 +175,9 @@ int wxConsoleEventLoop::DispatchTimeout(unsigned long timeout) return !m_shouldExit; } +void wxConsoleEventLoop::DoYieldFor(long eventsToProcess) +{ + wxEventLoopBase::DoYieldFor(eventsToProcess); +} + #endif // wxUSE_CONSOLE_EVENTLOOP diff --git a/Externals/wxWidgets3/src/msw/fdrepdlg.cpp b/Externals/wxWidgets3/src/msw/fdrepdlg.cpp index 924e7b3528..374c3342ab 100644 --- a/Externals/wxWidgets3/src/msw/fdrepdlg.cpp +++ b/Externals/wxWidgets3/src/msw/fdrepdlg.cpp @@ -33,8 +33,6 @@ #include "wx/fdrepdlg.h" -#include "wx/msw/mslu.h" - // ---------------------------------------------------------------------------- // functions prototypes // ---------------------------------------------------------------------------- @@ -48,7 +46,7 @@ UINT_PTR CALLBACK wxFindReplaceDialogHookProc(HWND hwnd, // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFindReplaceDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFindReplaceDialog, wxDialog); // ---------------------------------------------------------------------------- // wxFindReplaceDialogImpl: the internals of wxFindReplaceDialog @@ -199,33 +197,10 @@ wxFindReplaceDialogImpl::FindMessageHandler(wxWindow * WXUNUSED(win), WPARAM WXUNUSED(wParam), LPARAM lParam) { -#if wxUSE_UNICODE_MSLU - static unsigned long s_lastMsgFlags = 0; - - // This flag helps us to identify the bogus ANSI message - // sent by UNICOWS.DLL (see below) - // while we're sending our message to the dialog - // we ignore possible messages sent in between - static bool s_blockMsg = false; -#endif // wxUSE_UNICODE_MSLU - wxASSERT_MSG( nMsg == ms_msgFindDialog, wxT("unexpected message received") ); FINDREPLACE *pFR = (FINDREPLACE *)lParam; -#if wxUSE_UNICODE_MSLU - // This is a hack for a MSLU problem: Versions up to 1.0.4011 - // of UNICOWS.DLL send the correct UNICODE item after button press - // and a bogus ANSI mode item right after this, so let's ignore - // the second bogus message - if ( wxUsingUnicowsDll() && s_lastMsgFlags == pFR->Flags ) - { - s_lastMsgFlags = 0; - return 0; - } - s_lastMsgFlags = pFR->Flags; -#endif // wxUSE_UNICODE_MSLU - wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData; // map flags from Windows @@ -281,16 +256,8 @@ wxFindReplaceDialogImpl::FindMessageHandler(wxWindow * WXUNUSED(win), event.SetReplaceString(pFR->lpstrReplaceWith); } -#if wxUSE_UNICODE_MSLU - s_blockMsg = true; -#endif // wxUSE_UNICODE_MSLU - dialog->Send(event); -#if wxUSE_UNICODE_MSLU - s_blockMsg = false; -#endif // wxUSE_UNICODE_MSLU - return true; } diff --git a/Externals/wxWidgets3/src/msw/filedlg.cpp b/Externals/wxWidgets3/src/msw/filedlg.cpp index 7327c7bdd7..be2df982c6 100644 --- a/Externals/wxWidgets3/src/msw/filedlg.cpp +++ b/Externals/wxWidgets3/src/msw/filedlg.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_FILEDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) +#if wxUSE_FILEDLG #include "wx/filedlg.h" @@ -52,11 +52,7 @@ // constants // ---------------------------------------------------------------------------- -#ifdef __WIN32__ # define wxMAXPATH 65534 -#else -# define wxMAXPATH 1024 -#endif # define wxMAXFILE 1024 @@ -74,7 +70,7 @@ static wxRect gs_rectDialog(0, 0, 428, 266); // implementation // ============================================================================ -IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) +wxIMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase); // ---------------------------------------------------------------------------- @@ -160,7 +156,6 @@ wxFileDialogHookFunction(HWND hDlg, { switch ( iMsg ) { -#ifndef __WXWINCE__ case WM_INITDIALOG: { OPENFILENAME* ofn = reinterpret_cast(lParam); @@ -168,26 +163,29 @@ wxFileDialogHookFunction(HWND hDlg, ->MSWOnInitDialogHook((WXHWND)hDlg); } break; -#endif // __WXWINCE__ case WM_NOTIFY: { - OFNOTIFY* const - pNotifyCode = reinterpret_cast(lParam); - wxFileDialog* const - dialog = reinterpret_cast( - pNotifyCode->lpOFN->lCustData - ); - - switch ( pNotifyCode->hdr.code ) + NMHDR* const pNM = reinterpret_cast(lParam); + if ( pNM->code > CDN_LAST && pNM->code <= CDN_FIRST ) { - case CDN_INITDONE: - dialog->MSWOnInitDone((WXHWND)hDlg); - break; + OFNOTIFY* const + pNotifyCode = reinterpret_cast(lParam); + wxFileDialog* const + dialog = reinterpret_cast( + pNotifyCode->lpOFN->lCustData + ); - case CDN_SELCHANGE: - dialog->MSWOnSelChange((WXHWND)hDlg); - break; + switch ( pNotifyCode->hdr.code ) + { + case CDN_INITDONE: + dialog->MSWOnInitDone((WXHWND)hDlg); + break; + + case CDN_SELCHANGE: + dialog->MSWOnSelChange((WXHWND)hDlg); + break; + } } } break; @@ -366,14 +364,7 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err) if ( err ) { -#ifdef __WXWINCE__ - // according to MSDN, CommDlgExtendedError() should work under CE as - // well but apparently in practice it doesn't (anybody has more - // details?) - *err = GetLastError(); -#else *err = CommDlgExtendedError(); -#endif } return false; @@ -384,13 +375,13 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err) // V4 (smaller) one so we try to manually extend the struct in case it is the // old one. // -// We don't do this on Windows CE nor under Win64, however, as there are no +// We don't do this under Win64, however, as there are no // compilers with old headers for these architectures -#if defined(__WXWINCE__) || defined(__WIN64__) +#if defined(__WIN64__) typedef OPENFILENAME wxOPENFILENAME; static const DWORD gs_ofStructSize = sizeof(OPENFILENAME); -#else // !__WXWINCE__ || __WIN64__ +#else // __WIN64__ #define wxTRY_SMALLER_OPENFILENAME struct wxOPENFILENAME : public OPENFILENAME @@ -411,7 +402,7 @@ static bool DoShowCommFileDialog(OPENFILENAME *of, long style, DWORD *err) // always try the new one first static DWORD gs_ofStructSize = wxOPENFILENAME_V5_SIZE; -#endif // __WXWINCE__ || __WIN64__/!... +#endif // __WIN64__/!... static bool ShowCommFileDialog(OPENFILENAME *of, long style) { @@ -437,11 +428,7 @@ static bool ShowCommFileDialog(OPENFILENAME *of, long style) #endif // wxTRY_SMALLER_OPENFILENAME if ( !success && - // FNERR_INVALIDFILENAME is not defined under CE (besides we don't - // use CommDlgExtendedError() there anyhow) -#ifndef __WXWINCE__ errCode == FNERR_INVALIDFILENAME && -#endif // !__WXWINCE__ of->lpstrFile[0] ) { // this can happen if the default file name is invalid, try without it @@ -465,7 +452,6 @@ static bool ShowCommFileDialog(OPENFILENAME *of, long style) return true; } -#ifndef __WXWINCE__ void wxFileDialog::MSWOnInitDialogHook(WXHWND hwnd) { SetHWND(hwnd); @@ -474,16 +460,13 @@ void wxFileDialog::MSWOnInitDialogHook(WXHWND hwnd) SetHWND(NULL); } -#endif // __WXWINCE__ int wxFileDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); - HWND hWnd = 0; - if (m_parent) hWnd = (HWND) m_parent->GetHWND(); - if (!hWnd && wxTheApp->GetTopWindow()) - hWnd = (HWND) wxTheApp->GetTopWindow()->GetHWND(); + wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); + WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; static wxChar fileNameBuffer [ wxMAXPATH ]; // the file-name wxChar titleBuffer [ wxMAXFILE+1+wxMAXEXT ]; // the file-name, without path @@ -493,6 +476,9 @@ int wxFileDialog::ShowModal() long msw_flags = OFN_HIDEREADONLY; + if ( HasFdFlag(wxFD_NO_FOLLOW) ) + msw_flags |= OFN_NODEREFERENCELINKS; + if ( HasFdFlag(wxFD_FILE_MUST_EXIST) ) msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; /* @@ -507,9 +493,7 @@ int wxFileDialog::ShowModal() { ChangeExceptionPolicy(); msw_flags |= OFN_EXPLORER|OFN_ENABLEHOOK; -#ifndef __WXWINCE__ msw_flags |= OFN_ENABLESIZING; -#endif } wxON_BLOCK_EXIT0(RestoreExceptionPolicy); @@ -537,12 +521,11 @@ int wxFileDialog::ShowModal() wxZeroMemory(of); of.lStructSize = gs_ofStructSize; - of.hwndOwner = hWnd; + of.hwndOwner = hWndParent; of.lpstrTitle = m_message.t_str(); of.lpstrFileTitle = titleBuffer; of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT; -#ifndef __WXWINCE__ GlobalPtr hgbl; if ( HasExtraControlCreator() ) { @@ -570,7 +553,6 @@ int wxFileDialog::ShowModal() of.hInstance = (HINSTANCE)lpdt; } -#endif // __WXWINCE__ // Convert forward slashes to backslashes (file selector doesn't like // forward slashes) and also squeeze multiple consecutive slashes into one @@ -660,7 +642,7 @@ int wxFileDialog::ShowModal() const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; - for( int i = 0; i < maxFilter; i++ ) // get extension + for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; // use dummy name a to avoid assert in AppendExtension @@ -722,11 +704,11 @@ int wxFileDialog::ShowModal() m_fileNames.Add(toke.GetNextToken()); #endif // OFN_EXPLORER - wxString dir(m_dir); + m_path = m_dir; if ( m_dir.Last() != wxT('\\') ) - dir += wxT('\\'); + m_path += wxT('\\'); - m_path = dir + m_fileName; + m_path += m_fileName; m_filterIndex = (int)of.nFilterIndex - 1; } else @@ -742,7 +724,7 @@ int wxFileDialog::ShowModal() const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; - for( int i = 0; i < maxFilter; i++ ) // get extension + for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; m_fileName = AppendExtension(fileNameBuffer, extension); @@ -753,10 +735,10 @@ int wxFileDialog::ShowModal() m_fileName = wxFileNameFromPath(fileNameBuffer); m_fileNames.Add(m_fileName); m_dir = wxPathOnly(fileNameBuffer); - } + } return wxID_OK; } -#endif // wxUSE_FILEDLG && !(__SMARTPHONE__ && __WXWINCE__) +#endif // wxUSE_FILEDLG diff --git a/Externals/wxWidgets3/src/msw/font.cpp b/Externals/wxWidgets3/src/msw/font.cpp index bbf7d849a6..a5243d1181 100644 --- a/Externals/wxWidgets3/src/msw/font.cpp +++ b/Externals/wxWidgets3/src/msw/font.cpp @@ -37,9 +37,7 @@ #include "wx/fontutil.h" #include "wx/fontmap.h" -#ifndef __WXWINCE__ - #include "wx/sysopt.h" -#endif +#include "wx/sysopt.h" #include "wx/scopeguard.h" #include "wx/tokenzr.h" @@ -149,7 +147,8 @@ public: { // cache the face name, it shouldn't change unless the family // does and wxNativeFontInfo::SetFamily() resets the face name - const_cast(this)->SetFaceName(facename); + // Don't call this->SetFaceName(), because it deletes the HFONT. + const_cast(m_nativeFontInfo).SetFaceName(facename); } } @@ -359,7 +358,7 @@ void wxFontRefData::Init(int pointSize, if ( m_sizeUsingPixels ) SetPixelSize(pixelSize); else - SetPointSize(pointSize); + SetPointSize(pointSize == -1 ? wxNORMAL_FONT->GetPointSize() : pointSize); SetStyle(style); SetWeight(weight); @@ -385,7 +384,8 @@ void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont) m_hFont = (HFONT)hFont; m_nativeFontInfo = info; - // TODO: m_sizeUsingPixels? + // size of native fonts is expressed in pixels + m_sizeUsingPixels = true; } wxFontRefData::~wxFontRefData() @@ -430,13 +430,9 @@ void wxNativeFontInfo::Init() // DEFAULT_QUALITY but some fonts (e.g. "Terminal 6pt") are not available // then so we allow to set a global option to choose between quality and // wider font selection -#ifdef __WXWINCE__ - lf.lfQuality = CLEARTYPE_QUALITY; -#else lf.lfQuality = wxSystemOptions::GetOptionInt("msw.font.no-proof-quality") ? DEFAULT_QUALITY : PROOF_QUALITY; -#endif } int wxNativeFontInfo::GetPointSize() const @@ -840,7 +836,7 @@ bool wxFont::DoCreate(int pointSize, // wxDEFAULT is a valid value for the font size too so we must treat it // specially here (otherwise the size would be 70 == wxDEFAULT value) - if ( pointSize == wxDEFAULT || pointSize == -1 ) + if ( pointSize == wxDEFAULT ) { pointSize = wxNORMAL_FONT->GetPointSize(); } diff --git a/Externals/wxWidgets3/src/msw/fontdlg.cpp b/Externals/wxWidgets3/src/msw/fontdlg.cpp index 13c1dc1f69..749272eea6 100644 --- a/Externals/wxWidgets3/src/msw/fontdlg.cpp +++ b/Externals/wxWidgets3/src/msw/fontdlg.cpp @@ -43,7 +43,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); // ============================================================================ // implementation @@ -57,6 +57,8 @@ int wxFontDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); + wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); + WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; // It should be OK to always use GDI simulations DWORD flags = CF_SCREENFONTS /* | CF_NOSIMULATIONS */ ; @@ -66,8 +68,7 @@ int wxFontDialog::ShowModal() wxZeroMemory(chooseFontStruct); chooseFontStruct.lStructSize = sizeof(CHOOSEFONT); - if ( m_parent ) - chooseFontStruct.hwndOwner = GetHwndOf(m_parent); + chooseFontStruct.hwndOwner = hWndParent; chooseFontStruct.lpLogFont = &logFont; if ( m_fontData.m_initialFont.IsOk() ) diff --git a/Externals/wxWidgets3/src/msw/fontenum.cpp b/Externals/wxWidgets3/src/msw/fontenum.cpp index 9b505cb4f1..06e6480b9d 100644 --- a/Externals/wxWidgets3/src/msw/fontenum.cpp +++ b/Externals/wxWidgets3/src/msw/fontenum.cpp @@ -51,12 +51,12 @@ public: wxFontEnumeratorHelper(wxFontEnumerator *fontEnum); // control what exactly are we enumerating - // we enumerate fonts with given enocding + // we enumerate fonts with the given encoding bool SetEncoding(wxFontEncoding encoding); // we enumerate fixed-width fonts void SetFixedOnly(bool fixedOnly) { m_fixedOnly = fixedOnly; } - // we enumerate the encodings available in this family - void SetFamily(const wxString& family); + // we enumerate the encodings this font face is available in + void SetFaceName(const wxString& facename); // call to start enumeration void DoEnumerate(); @@ -74,9 +74,6 @@ private: // if not empty, enum only the fonts with this facename wxString m_facename; - // if not empty, enum only the fonts in this family - wxString m_family; - // if true, enum only fixed fonts bool m_fixedOnly; @@ -96,10 +93,8 @@ private: // private functions // ---------------------------------------------------------------------------- -#ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwStyle, LPARAM lParam); -#endif // ============================================================================ // implementation @@ -117,10 +112,10 @@ wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum) m_enumEncodings = false; } -void wxFontEnumeratorHelper::SetFamily(const wxString& family) +void wxFontEnumeratorHelper::SetFaceName(const wxString& facename) { m_enumEncodings = true; - m_family = family; + m_facename = facename; } bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) @@ -146,33 +141,18 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) return true; } -#if defined(__GNUWIN32__) && !defined(__CYGWIN10__) && !wxCHECK_W32API_VERSION( 1, 1 ) && !wxUSE_NORLANDER_HEADERS - #define wxFONTENUMPROC int(*)(ENUMLOGFONTEX *, NEWTEXTMETRICEX*, int, LPARAM) -#else - #define wxFONTENUMPROC FONTENUMPROC -#endif - void wxFontEnumeratorHelper::DoEnumerate() { -#ifndef __WXMICROWIN__ HDC hDC = ::GetDC(NULL); -#ifdef __WXWINCE__ - ::EnumFontFamilies(hDC, - m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename), - (wxFONTENUMPROC)wxFontEnumeratorProc, - (LPARAM)this) ; -#else // __WIN32__ LOGFONT lf; lf.lfCharSet = (BYTE)m_charset; wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName)); lf.lfPitchAndFamily = 0; - ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc, + ::EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this, 0 /* reserved */) ; -#endif // Win32/CE ::ReleaseDC(NULL, hDC); -#endif } bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, @@ -262,10 +242,10 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, return true; } -bool wxFontEnumerator::EnumerateEncodings(const wxString& family) +bool wxFontEnumerator::EnumerateEncodings(const wxString& facename) { wxFontEnumeratorHelper fe(this); - fe.SetFamily(family); + fe.SetFaceName(facename); fe.DoEnumerate(); return true; @@ -275,7 +255,6 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) // Windows callbacks // ---------------------------------------------------------------------------- -#ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD WXUNUSED(dwStyle), LPARAM lParam) { @@ -295,6 +274,5 @@ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, return fontEnum->OnFont(lplf, lptm); } -#endif #endif // wxUSE_FONTENUM diff --git a/Externals/wxWidgets3/src/msw/fontutil.cpp b/Externals/wxWidgets3/src/msw/fontutil.cpp index 010ce5dc84..97b9e7edbb 100644 --- a/Externals/wxWidgets3/src/msw/fontutil.cpp +++ b/Externals/wxWidgets3/src/msw/fontutil.cpp @@ -201,7 +201,6 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) fontEncoding = wxFONTENCODING_MAX; break; -#if defined(__WIN32__) && !defined(__WXMICROWIN__) case EASTEUROPE_CHARSET: fontEncoding = wxFONTENCODING_CP1250; break; @@ -258,7 +257,9 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) fontEncoding = wxFONTENCODING_CP1361; break; -#endif // Win32 + case MAC_CHARSET: + fontEncoding = wxFONTENCODING_MACROMAN; + break; case OEM_CHARSET: fontEncoding = wxFONTENCODING_CP437; diff --git a/Externals/wxWidgets3/src/msw/frame.cpp b/Externals/wxWidgets3/src/msw/frame.cpp index 8c1b178657..e7a6524fb1 100644 --- a/Externals/wxWidgets3/src/msw/frame.cpp +++ b/Externals/wxWidgets3/src/msw/frame.cpp @@ -43,12 +43,6 @@ #include "wx/msw/private.h" -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - #include - #include - #include "wx/msw/winundef.h" -#endif - #include "wx/generic/statusbr.h" #ifdef __WXUNIVERSAL__ @@ -56,6 +50,16 @@ #include "wx/univ/colschem.h" #endif // __WXUNIVERSAL__ +#if wxUSE_TASKBARBUTTON + #include "wx/msw/taskbarbutton.h" + #include "wx/dynlib.h" + + WXUINT wxMsgTaskbarButtonCreated = 0; + #define wxTHBN_CLICKED 0x1800 + #define wxMSGFLT_ADD 0x01 +#endif // wxUSE_TASKBARBUTTON + + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -68,9 +72,9 @@ // event tables // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) +wxBEGIN_EVENT_TABLE(wxFrame, wxFrameBase) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -96,6 +100,7 @@ void wxFrame::Init() { #if wxUSE_MENUS m_hMenu = NULL; + m_menuDepth = 0; #endif // wxUSE_MENUS #if wxUSE_TOOLTIPS @@ -103,6 +108,10 @@ void wxFrame::Init() #endif m_wasMinimized = false; + +#if wxUSE_TASKBARBUTTON + m_taskBarButton = NULL; +#endif } bool wxFrame::Create(wxWindow *parent, @@ -118,27 +127,44 @@ bool wxFrame::Create(wxWindow *parent, SetOwnBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); -#if defined(__SMARTPHONE__) - SetLeftMenu(wxID_EXIT, _("Done")); -#endif +#if wxUSE_TASKBARBUTTON + static bool s_taskbarButtonCreatedMsgRegistered = false; + if ( !s_taskbarButtonCreatedMsgRegistered ) + { + s_taskbarButtonCreatedMsgRegistered = true; + wxMsgTaskbarButtonCreated = + ::RegisterWindowMessage(wxT("TaskbarButtonCreated")); -#if wxUSE_ACCEL && defined(__POCKETPC__) - // The guidelines state that Ctrl+Q should quit the app. - // Let's define an accelerator table to send wxID_EXIT. - wxAcceleratorEntry entries[1]; - entries[0].Set(wxACCEL_CTRL, 'Q', wxID_EXIT); - wxAcceleratorTable accel(1, entries); - SetAcceleratorTable(accel); -#endif // wxUSE_ACCEL && __POCKETPC__ + // In case the application is run elevated, allow the + // TaskbarButtonCreated and WM_COMMAND messages through. +#if wxUSE_DYNLIB_CLASS + typedef BOOL (WINAPI *ChangeWindowMessageFilter_t)(UINT message, + DWORD dwFlag); + wxDynamicLibrary dllUser32(wxT("user32.dll")); + + ChangeWindowMessageFilter_t pfnChangeWindowMessageFilter = NULL; + wxDL_INIT_FUNC(pfn, ChangeWindowMessageFilter, dllUser32); + if ( pfnChangeWindowMessageFilter ) + { + pfnChangeWindowMessageFilter(wxMsgTaskbarButtonCreated, + wxMSGFLT_ADD); + pfnChangeWindowMessageFilter(WM_COMMAND, wxMSGFLT_ADD); + } +#else + ChangeWindowMessageFilter(wxMsgTaskbarButtonCreated, wxMSGFLT_ADD); + ChangeWindowMessageFilter(WM_COMMAND, wxMSGFLT_ADD); +#endif // wxUSE_DYNLIB_CLASS + } +#endif // wxUSE_TASKBARBUTTON return true; } wxFrame::~wxFrame() { - SendDestroyEvent(); - - DeleteAllBars(); +#if wxUSE_TASKBARBUTTON + delete m_taskBarButton; +#endif } // ---------------------------------------------------------------------------- @@ -286,9 +312,6 @@ void wxFrame::PositionStatusBar() int w, h; GetClientSize(&w, &h); - int sw, sh; - m_frameStatusBar->GetSize(&sw, &sh); - int x = 0; #if wxUSE_TOOLBAR wxToolBar * const toolbar = GetToolBar(); @@ -312,6 +335,16 @@ void wxFrame::PositionStatusBar() //else: no adjustments necessary for the toolbar on top #endif // wxUSE_TOOLBAR + // Resize the status bar to its default height, as it could have been set + // to a wrong value before by WM_SIZE sent during the frame creation and + // our status bars preserve their programmatically set size to avoid being + // resized by DefWindowProc() to the full window width, so if we didn't do + // this here, the status bar would retain the possibly wrong current height. + m_frameStatusBar->SetSize(x, h, w, wxDefaultCoord, wxSIZE_AUTO_HEIGHT); + + int sw, sh; + m_frameStatusBar->GetSize(&sw, &sh); + // Since we wish the status bar to be directly under the client area, // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. m_frameStatusBar->SetSize(x, h, w, sh); @@ -323,60 +356,6 @@ void wxFrame::PositionStatusBar() void wxFrame::AttachMenuBar(wxMenuBar *menubar) { -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - - wxMenu *autoMenu = NULL; - - if( menubar->GetMenuCount() == 1 ) - { - autoMenu = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(menubar->GetMenu(0)); - SetRightMenu(wxID_ANY, menubar->GetMenuLabel(0), autoMenu); - } - else - { - autoMenu = new wxMenu; - - for( size_t n = 0; n < menubar->GetMenuCount(); n++ ) - { - wxMenu *item = menubar->GetMenu(n); - wxString label = menubar->GetMenuLabel(n); - wxMenu *new_item = wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(item); - autoMenu->Append(wxID_ANY, label, new_item); - } - - SetRightMenu(wxID_ANY, _("Menu"), autoMenu); - } - -#elif defined(WINCE_WITHOUT_COMMANDBAR) - if (!GetToolBar()) - { - wxToolMenuBar* toolBar = new wxToolMenuBar(this, wxID_ANY, - wxDefaultPosition, wxDefaultSize, - wxBORDER_NONE | wxTB_HORIZONTAL, - wxToolBarNameStr, menubar); - SetToolBar(toolBar); - menubar->SetToolBar(toolBar); - } - - // When the main window is created using CW_USEDEFAULT the height of the - // menubar is not taken into account, so we resize it afterwards if a - // menubar is present - HWND hwndMenuBar = SHFindMenuBar(GetHwnd()); - if ( hwndMenuBar ) - { - RECT mbRect; - ::GetWindowRect(hwndMenuBar, &mbRect); - const int menuHeight = mbRect.bottom - mbRect.top; - - RECT rc; - ::GetWindowRect(GetHwnd(), &rc); - // adjust for menu / titlebar height - rc.bottom -= (2*menuHeight-1); - - ::MoveWindow(GetHwnd(), rc.left, rc.top, rc.right, rc.bottom, FALSE); - } -#endif - wxFrameBase::AttachMenuBar(menubar); if ( !menubar ) @@ -387,7 +366,6 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) } else // set new non NULL menu bar { -#if !defined(__WXWINCE__) || defined(WINCE_WITH_COMMANDBAR) // Can set a menubar several times. if ( menubar->GetHMenu() ) { @@ -403,31 +381,82 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) return; } } -#endif InternalSetMenuBar(); } } void wxFrame::InternalSetMenuBar() { -#if defined(__WXMICROWIN__) || defined(__WXWINCE__) - // Nothing -#else if ( !::SetMenu(GetHwnd(), (HMENU)m_hMenu) ) { wxLogLastError(wxT("SetMenu")); } -#endif } #endif // wxUSE_MENUS_NATIVE -#if wxUSE_MENUS +#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) +bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) +{ + // Unfortunately we need to ignore a message which is sent after + // closing the currently active submenu of the menu bar by pressing Escape: + // in this case we get WM_UNINITMENUPOPUP, from which we generate + // wxEVT_MENU_CLOSE, and _then_ we get WM_MENUSELECT for the top level menu + // from which we overwrite the help string just restored by OnMenuClose() + // handler in wxFrameBase. To prevent this from happening we discard these + // messages but only in the case it's really the top level menu as we still + // need to clear the help string when a submenu is selected in a menu. + if ( flags == (MF_POPUP | MF_HILITE) && !m_menuDepth ) + return false; + + return wxWindow::HandleMenuSelect(nItem, flags, hMenu); +} + +bool wxFrame::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu) +{ + // Update the menu depth when dealing with the top level menus. + if ( !menu || menu->IsAttached() ) + { + if ( evtType == wxEVT_MENU_OPEN ) + { + m_menuDepth++; + } + else if ( evtType == wxEVT_MENU_CLOSE ) + { + wxASSERT_MSG( m_menuDepth > 0, wxS("No open menus?") ); + + m_menuDepth--; + } + else + { + wxFAIL_MSG( wxS("Unexpected menu event type") ); + } + } + + return wxWindow::DoSendMenuOpenCloseEvent(evtType, menu); +} + wxMenu* wxFrame::MSWFindMenuFromHMENU(WXHMENU hMenu) { - return GetMenuBar() ? GetMenuBar()->MSWGetMenu(hMenu) : NULL; + if ( wxMenuBar* mbar = GetMenuBar() ) + { + if ( wxMenu* menu = mbar->MSWGetMenu(hMenu) ) + return menu; + } + + return wxFrameBase::MSWFindMenuFromHMENU(hMenu); } -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS && !defined(__WXUNIVERSAL__) + +#if wxUSE_TASKBARBUTTON +wxTaskBarButton* wxFrame::MSWGetTaskBarButton() +{ + if ( !m_taskBarButton ) + m_taskBarButton = wxTaskBarButton::New(this); + + return m_taskBarButton; +} +#endif // wxUSE_TASKBARBUTTON // Responds to colour changes, and passes event on to children. void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) @@ -455,16 +484,12 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) // Pass true to show full screen, false to restore. bool wxFrame::ShowFullScreen(bool show, long style) { - // TODO-CE: add support for CE -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) if ( IsFullScreen() == show ) return false; if (show) { // zap the toolbar, menubar, and statusbar if needed - // - // TODO: hide commandbar for WINCE_WITH_COMMANDBAR #if wxUSE_TOOLBAR wxToolBar *theToolBar = GetToolBar(); @@ -529,7 +554,6 @@ bool wxFrame::ShowFullScreen(bool show, long style) } #endif // wxUSE_STATUSBAR } -#endif // !defined(__WXMICROWIN__) && !defined(__WXWINCE__) return wxFrameBase::ShowFullScreen(show, style); } @@ -542,11 +566,6 @@ bool wxFrame::ShowFullScreen(bool show, long style) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { -#if defined(WINCE_WITHOUT_COMMANDBAR) - // We may already have a toolbar from calling SetMenuBar. - if (GetToolBar()) - return GetToolBar(); -#endif if ( wxFrameBase::CreateToolBar(style, id, name) ) { PositionToolBar(); @@ -557,10 +576,6 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam void wxFrame::PositionToolBar() { - // TODO: we want to do something different in WinCE, because the toolbar - // should be associated with the commandbar, instead of being - // independent window. -#if !defined(WINCE_WITHOUT_COMMANDBAR) wxToolBar *toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { @@ -598,16 +613,6 @@ void wxFrame::PositionToolBar() y = 0; } -#if defined(WINCE_WITH_COMMANDBAR) - // We're using a commandbar - so we have to allow for it. - if (GetMenuBar() && GetMenuBar()->GetCommandBar()) - { - RECT rect; - ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); - y = rect.bottom - rect.top; - } -#endif // WINCE_WITH_COMMANDBAR - if ( toolbar->HasFlag(wxTB_BOTTOM) ) { if ( ty < 0 && ( -ty == th ) ) @@ -649,7 +654,6 @@ void wxFrame::PositionToolBar() toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS); } -#endif // !WINCE_WITH_COMMANDBAR } #endif // wxUSE_TOOLBAR @@ -740,7 +744,6 @@ bool wxFrame::MSWDoTranslateMessage(wxFrame *frame, WXMSG *pMsg) bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) { -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) switch ( id ) { case SIZE_RESTORED: @@ -762,9 +765,6 @@ bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) IconizeChildFrames(true); break; } -#else - wxUnusedVar(id); -#endif // !__WXWINCE__ if ( !m_iconized ) { @@ -776,21 +776,6 @@ bool wxFrame::HandleSize(int WXUNUSED(x), int WXUNUSED(y), WXUINT id) PositionToolBar(); #endif // wxUSE_TOOLBAR -#if defined(WINCE_WITH_COMMANDBAR) - // Position the menu command bar - if (GetMenuBar() && GetMenuBar()->GetCommandBar()) - { - RECT rect; - ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); - wxSize clientSz = GetClientSize(); - - if ( !::MoveWindow((HWND) GetMenuBar()->GetCommandBar(), 0, 0, clientSz.x, rect.bottom - rect.top, true ) ) - { - wxLogLastError(wxT("MoveWindow")); - } - - } -#endif // WINCE_WITH_COMMANDBAR } // call the base class version to generate the appropriate events @@ -801,11 +786,6 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) { #if wxUSE_MENUS -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (GetToolBar() && GetToolBar()->FindById(id)) - return GetToolBar()->MSWCommand(cmd, id); -#endif - // we only need to handle the menu and accelerator commands from the items // of our menu bar, base wxWindow class already handles the rest if ( !control && (cmd == 0 /* menu */ || cmd == 1 /* accel */) ) @@ -821,6 +801,20 @@ bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) } #endif // wxUSE_MENUS +#if wxUSE_TASKBARBUTTON + if ( cmd == wxTHBN_CLICKED && m_taskBarButton ) + { + wxTaskBarButtonImpl * const + tbButton = reinterpret_cast(m_taskBarButton); + // we use the index as id when adding thumbnail toolbar button. + wxThumbBarButton * const + thumbBarButton = tbButton->GetThumbBarButtonByIndex(id); + wxCommandEvent event(wxEVT_BUTTON, thumbBarButton->GetID()); + event.SetEventObject(thumbBarButton); + return ProcessEvent(event); + } +#endif // wxUSE_TASKBARBUTTON + return wxFrameBase::HandleCommand(id, cmd, control);; } @@ -863,7 +857,22 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara } break; -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) + case WM_INITMENUPOPUP: + case WM_UNINITMENUPOPUP: + // We get these messages from the menu bar even if the menu is + // disabled, which is unexpected, so ignore them in this case. + if ( wxMenuBar* mbar = GetMenuBar() ) + { + const int pos = mbar->MSWGetTopMenuPos((WXHMENU)wParam); + if ( pos != wxNOT_FOUND && !mbar->IsEnabledTop(pos) ) + { + // This event comes from a disabled top level menu, don't + // handle it. + return MSWDefWindowProc(message, wParam, lParam); + } + } + break; + case WM_QUERYDRAGICON: { const wxIcon& icon = GetIcon(); @@ -873,8 +882,16 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara processed = rc != 0; } break; -#endif // !__WXMICROWIN__ } +#if wxUSE_TASKBARBUTTON + if ( message == wxMsgTaskbarButtonCreated ) + { + if ( m_taskBarButton ) + m_taskBarButton->Realize(); + + processed = true; + } +#endif if ( !processed ) rc = wxFrameBase::MSWWindowProc(message, wParam, lParam); @@ -893,8 +910,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const { wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); -#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \ - (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) +#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) wxToolBar * const toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { @@ -911,14 +927,5 @@ wxPoint wxFrame::GetClientAreaOrigin() const } #endif // wxUSE_TOOLBAR -#if defined(WINCE_WITH_COMMANDBAR) - if (GetMenuBar() && GetMenuBar()->GetCommandBar()) - { - RECT rect; - ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); - pt.y += (rect.bottom - rect.top); - } -#endif - return pt; } diff --git a/Externals/wxWidgets3/src/msw/fswatcher.cpp b/Externals/wxWidgets3/src/msw/fswatcher.cpp index d179f67155..b9803efc45 100644 --- a/Externals/wxWidgets3/src/msw/fswatcher.cpp +++ b/Externals/wxWidgets3/src/msw/fswatcher.cpp @@ -217,19 +217,39 @@ wxThread::ExitCode wxIOCPThread::Entry() } // wait for events to occur, read them and send to interested parties -// returns false it empty status was read, which means we whould exit +// returns false it empty status was read, which means we would exit // true otherwise bool wxIOCPThread::ReadEvents() { - unsigned long count = 0; + DWORD count = 0; wxFSWatchEntryMSW* watch = NULL; OVERLAPPED* overlapped = NULL; - if (!m_iocp->GetStatus(&count, &watch, &overlapped)) - return true; // error was logged already, we don't want to exit + switch ( m_iocp->GetStatus(&count, &watch, &overlapped) ) + { + case wxIOCPService::Status_OK: + break; // nothing special to do, continue normally - // this is our exit condition, so we return false - if (!count && !watch && !overlapped) - return false; + case wxIOCPService::Status_Error: + return true; // error was logged already, we don't want to exit + + case wxIOCPService::Status_Deleted: + { + wxFileSystemWatcherEvent + removeEvent(wxFSW_EVENT_DELETE, + watch->GetPath(), + wxFileName()); + SendEvent(removeEvent); + } + + // It isn't useful to continue watching this directory as it + // doesn't exist any more -- and even recreating a directory with + // the same name still wouldn't resume generating events for the + // existing wxIOCPService, so it's useless to continue. + return false; + + case wxIOCPService::Status_Exit: + return false; // stop reading events + } // if the thread got woken up but we got an empty packet it means that // there was an overflow, too many events and not all could fit in diff --git a/Externals/wxWidgets3/src/msw/gauge.cpp b/Externals/wxWidgets3/src/msw/gauge.cpp index 26ab8e9eb4..78d298ebc6 100644 --- a/Externals/wxWidgets3/src/msw/gauge.cpp +++ b/Externals/wxWidgets3/src/msw/gauge.cpp @@ -33,6 +33,7 @@ #include "wx/msw/wrapcctl.h" // include "properly" #endif +#include "wx/appprogress.h" #include "wx/msw/private.h" // ---------------------------------------------------------------------------- @@ -91,14 +92,20 @@ bool wxGauge::Create(wxWindow *parent, if ( !MSWCreateControl(PROGRESS_CLASS, wxEmptyString, pos, size) ) return false; - SetRange(range); - // in case we need to emulate indeterminate mode... m_nDirection = wxRIGHT; + SetRange(range); + + InitProgressIndicatorIfNeeded(); + return true; } +wxGauge::~wxGauge() +{ +} + WXDWORD wxGauge::MSWGetStyle(long style, WXDWORD *exstyle) const { WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle); @@ -138,7 +145,7 @@ void wxGauge::SetRange(int r) if ( IsInIndeterminateMode() ) SetDeterminateMode(); - m_rangeMax = r; + wxGaugeBase::SetRange(r); #ifdef PBM_SETRANGE32 ::SendMessage(GetHwnd(), PBM_SETRANGE32, 0, r); @@ -156,7 +163,7 @@ void wxGauge::SetValue(int pos) if ( GetValue() != pos ) { - m_gaugePos = pos; + wxGaugeBase::SetValue(pos); ::SendMessage(GetHwnd(), PBM_SETPOS, pos, 0); } @@ -216,6 +223,9 @@ void wxGauge::Pulse() SetIndeterminateMode(); SendMessage(GetHwnd(), PBM_STEPIT, 0, 0); + + if ( m_appProgressIndicator ) + m_appProgressIndicator->Pulse(); } else { diff --git a/Externals/wxWidgets3/src/msw/gdiimage.cpp b/Externals/wxWidgets3/src/msw/gdiimage.cpp index 439cc916a7..c8b16ef8be 100644 --- a/Externals/wxWidgets3/src/msw/gdiimage.cpp +++ b/Externals/wxWidgets3/src/msw/gdiimage.cpp @@ -50,11 +50,6 @@ #include "wx/utils.h" // For wxLoadUserResource() #endif -#ifdef __WXWINCE__ -#include -#include -#endif - #include "wx/file.h" #include "wx/listimpl.cpp" @@ -64,8 +59,6 @@ WX_DEFINE_LIST(wxGDIImageHandlerList) // private classes // ---------------------------------------------------------------------------- -#ifndef __WXMICROWIN__ - // all image handlers are declared/defined in this file because the outside // world doesn't have to know about them (but only about wxBITMAP_TYPE_XXX ids) @@ -85,7 +78,7 @@ public: const wxPalette *palette = NULL) const; private: - DECLARE_DYNAMIC_CLASS(wxBMPFileHandler) + wxDECLARE_DYNAMIC_CLASS(wxBMPFileHandler); }; class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler @@ -102,7 +95,7 @@ public: int desiredWidth, int desiredHeight); private: - DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler) + wxDECLARE_DYNAMIC_CLASS(wxBMPResourceHandler); }; class WXDLLEXPORT wxIconHandler : public wxGDIImageHandler @@ -163,7 +156,7 @@ protected: int desiredWidth = -1, int desiredHeight = -1); private: - DECLARE_DYNAMIC_CLASS(wxICOFileHandler) + wxDECLARE_DYNAMIC_CLASS(wxICOFileHandler); }; class WXDLLEXPORT wxICOResourceHandler: public wxIconHandler @@ -181,7 +174,7 @@ protected: int desiredWidth = -1, int desiredHeight = -1); private: - DECLARE_DYNAMIC_CLASS(wxICOResourceHandler) + wxDECLARE_DYNAMIC_CLASS(wxICOResourceHandler); }; #if wxUSE_PNG_RESOURCE_HANDLER @@ -209,20 +202,18 @@ private: // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler); +wxIMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler); +wxIMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxObject); #if wxUSE_PNG_RESOURCE_HANDLER -IMPLEMENT_DYNAMIC_CLASS(wxPNGResourceHandler, wxBitmapHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxPNGResourceHandler, wxBitmapHandler); #endif // wxUSE_PNG_RESOURCE_HANDLER // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- -#endif - // __MICROWIN__ // ============================================================================ // implementation @@ -338,7 +329,6 @@ void wxGDIImage::CleanUpHandlers() void wxGDIImage::InitStandardHandlers() { -#ifndef __WXMICROWIN__ AddHandler(new wxBMPResourceHandler); AddHandler(new wxBMPFileHandler); AddHandler(new wxICOFileHandler); @@ -346,11 +336,8 @@ void wxGDIImage::InitStandardHandlers() #if wxUSE_PNG_RESOURCE_HANDLER AddHandler(new wxPNGResourceHandler); #endif // wxUSE_PNG_RESOURCE_HANDLER -#endif } -#ifndef __WXMICROWIN__ - // ---------------------------------------------------------------------------- // wxBitmap handlers // ---------------------------------------------------------------------------- @@ -393,15 +380,28 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { -#if wxUSE_WXDIB wxCHECK_MSG( bitmap, false, wxT("NULL bitmap in LoadFile") ); +#if wxUSE_WXDIB + // Try loading using native Windows LoadImage() first. wxDIB dib(name); + if ( dib.IsOk() ) + return bitmap->CopyFromDIB(dib); +#endif // wxUSE_WXDIB + + // Some valid bitmap files are not supported by LoadImage(), e.g. those + // with negative height. Try to use our own bitmap loading code which does + // support them. +#if wxUSE_IMAGE + wxImage img(name, wxBITMAP_TYPE_BMP); + if ( img.IsOk() ) + { + *bitmap = wxBitmap(img); + return true; + } +#endif // wxUSE_IMAGE - return dib.IsOk() && bitmap->CopyFromDIB(dib); -#else return false; -#endif } bool wxBMPFileHandler::SaveFile(const wxBitmap *bitmap, @@ -495,13 +495,11 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon, } //else: not standard size, load below -#ifndef __WXWINCE__ if ( !hicon ) { // take any size icon from the file by index hicon = ::ExtractIcon(wxGetInstance(), nameReal.t_str(), iconIndex); } -#endif if ( !hicon ) { @@ -561,7 +559,6 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, } // next check if it's not a standard icon -#ifndef __WXWINCE__ if ( !hicon && !hasSize ) { static const struct @@ -585,7 +582,6 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon, } } } -#endif return icon->CreateFromHICON((WXHICON)hicon); } @@ -643,19 +639,14 @@ bool wxPNGResourceHandler::LoadFile(wxBitmap *bitmap, // private functions // ---------------------------------------------------------------------------- -wxSize wxGetHiconSize(HICON WXUNUSED_IN_WINCE(hicon)) +wxSize wxGetHiconSize(HICON hicon) { wxSize size; -#ifndef __WXWINCE__ if ( hicon ) { - ICONINFO info; - if ( !::GetIconInfo(hicon, &info) ) - { - wxLogLastError(wxT("GetIconInfo")); - } - else + AutoIconInfo info; + if ( info.GetFrom(hicon) ) { HBITMAP hbmp = info.hbmMask; if ( hbmp ) @@ -665,16 +656,11 @@ wxSize wxGetHiconSize(HICON WXUNUSED_IN_WINCE(hicon)) { size = wxSize(bm.bmWidth, bm.bmHeight); } - - ::DeleteObject(info.hbmMask); } - if ( info.hbmColor ) - ::DeleteObject(info.hbmColor); } } if ( !size.x ) -#endif // !__WXWINCE__ { // use default icon size on this hardware size.x = ::GetSystemMetrics(SM_CXICON); @@ -683,5 +669,3 @@ wxSize wxGetHiconSize(HICON WXUNUSED_IN_WINCE(hicon)) return size; } - -#endif // __WXMICROWIN__ diff --git a/Externals/wxWidgets3/src/msw/gdiplus.cpp b/Externals/wxWidgets3/src/msw/gdiplus.cpp index 97751b41bd..00897230cb 100644 --- a/Externals/wxWidgets3/src/msw/gdiplus.cpp +++ b/Externals/wxWidgets3/src/msw/gdiplus.cpp @@ -864,10 +864,10 @@ public: virtual bool OnInit() { return true; } virtual void OnExit() { wxGdiPlus::Terminate(); } - DECLARE_DYNAMIC_CLASS(wxGdiPlusModule) + wxDECLARE_DYNAMIC_CLASS(wxGdiPlusModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxGdiPlusModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGdiPlusModule, wxModule); // ============================================================================ // implementation of the functions themselves diff --git a/Externals/wxWidgets3/src/msw/glcanvas.cpp b/Externals/wxWidgets3/src/msw/glcanvas.cpp index 7beb05c47c..edc53bc677 100644 --- a/Externals/wxWidgets3/src/msw/glcanvas.cpp +++ b/Externals/wxWidgets3/src/msw/glcanvas.cpp @@ -35,8 +35,8 @@ #include "wx/glcanvas.h" // from src/msw/window.cpp -LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); +LRESULT WXDLLEXPORT APIENTRY +wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); #ifdef GL_EXT_vertex_array #define WXUNUSED_WITHOUT_GL_EXT_vertex_array(name) name @@ -45,22 +45,31 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, #endif // ---------------------------------------------------------------------------- -// define possibly missing WGL constants +// define possibly missing WGL constants and types // ---------------------------------------------------------------------------- #ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format #define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 #define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 #define WGL_NUMBER_OVERLAYS_ARB 0x2008 #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_SUPPORT_GDI_ARB 0x200F #define WGL_SUPPORT_OPENGL_ARB 0x2010 #define WGL_DOUBLE_BUFFER_ARB 0x2011 #define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 #define WGL_COLOR_BITS_ARB 0x2014 #define WGL_RED_BITS_ARB 0x2015 #define WGL_GREEN_BITS_ARB 0x2017 #define WGL_BLUE_BITS_ARB 0x2019 #define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ACCUM_BITS_ARB 0x201D #define WGL_ACCUM_RED_BITS_ARB 0x201E #define WGL_ACCUM_GREEN_BITS_ARB 0x201F #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 @@ -68,14 +77,79 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, #define WGL_DEPTH_BITS_ARB 0x2022 #define WGL_STENCIL_BITS_ARB 0x2023 #define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 #define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C #endif #ifndef WGL_ARB_multisample +#define WGL_ARB_multisample #define WGL_SAMPLE_BUFFERS_ARB 0x2041 #define WGL_SAMPLES_ARB 0x2042 #endif +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#endif + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#endif + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif + +#ifndef WGL_ARB_robustness_application_isolation +#define WGL_ARB_robustness_application_isolation +#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#endif +#ifndef WGL_ARB_robustness_share_group_isolation +#define WGL_ARB_robustness_share_group_isolation +#endif + +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef WGL_EXT_create_context_es_profile +#define WGL_EXT_create_context_es_profile +#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#endif + +typedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) + (HDC hDC, HGLRC hShareContext, const int *attribList); + // ---------------------------------------------------------------------------- // libraries // ---------------------------------------------------------------------------- @@ -102,30 +176,449 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, # pragma comment( lib, "glu32" ) #endif +//----------------------------------------------------------------------------- +// Documentation on internals +//----------------------------------------------------------------------------- + +// OpenGL has evolved not only adding new features, but also there are new +// ways of doing things. Among these new ways, we pay special attention to +// pixel format choosing and context creation. +// +// The old way of choosing a pixel format is to use a PIXELFORMATDESCRIPTOR +// struct for setting the wanted attributes and to call ChoosePixelFormat() +// with that struct. +// When new attributes came into scene, the MSW struct became inadequate, and +// a new method was implemented: wglChoosePixelFormatARB(). +// +// For rendering context creation wglCreateContext() was the function to call. +// Starting with OpenGL 3.0 (2009) there are several attributes for context, +// specially for wanted version and "core" or "compatibility" profiles. +// In order to use these new features, wglCreateContextAttribsARB() must be +// called instead of wglCreateContext(). +// +// wxWidgets handles this OpenGL evolution trying to use the new ways, and +// falling back to the old ways if neither the latter are available nor the +// user requires them. +// +// wxGLAttributes is used for pixel format attributes. +// wxGLContextAttrs is used for OpenGL rendering context attributes. +// wxWidgets does not handle all of OpenGL attributes. This is because some of +// them are platform-dependent, or perhaps too new for wx. To cope with these +// cases, these two objects allow the user to set his own attributes. +// +// To keep wxWidgets backwards compatibility, a list of mixed attributes is +// still allowed at wxGLCanvas constructor. + + +// ---------------------------------------------------------------------------- +// wxGLContextAttrs: OpenGL rendering context attributes +// ---------------------------------------------------------------------------- +// MSW specific values + +wxGLContextAttrs& wxGLContextAttrs::CoreProfile() +{ + AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, + WGL_CONTEXT_CORE_PROFILE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MajorVersion(int val) +{ + if ( val > 0 ) + { + AddAttribute(WGL_CONTEXT_MAJOR_VERSION_ARB); + AddAttribute(val); + if ( val >= 3 ) + SetNeedsARB(); + } + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MinorVersion(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_CONTEXT_MINOR_VERSION_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::CompatibilityProfile() +{ + AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, + WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ForwardCompatible() +{ + AddAttribBits(WGL_CONTEXT_FLAGS_ARB, + WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ES2() +{ + AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, + WGL_CONTEXT_ES2_PROFILE_BIT_EXT); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::DebugCtx() +{ + AddAttribBits(WGL_CONTEXT_FLAGS_ARB, + WGL_CONTEXT_DEBUG_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::Robust() +{ + AddAttribBits(WGL_CONTEXT_FLAGS_ARB, + WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::NoResetNotify() +{ + AddAttribute(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); + AddAttribute(WGL_NO_RESET_NOTIFICATION_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::LoseOnReset() +{ + AddAttribute(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); + AddAttribute(WGL_LOSE_CONTEXT_ON_RESET_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ResetIsolation() +{ + AddAttribBits(WGL_CONTEXT_FLAGS_ARB, + WGL_CONTEXT_RESET_ISOLATION_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ReleaseFlush(int val) +{ + AddAttribute(WGL_CONTEXT_RELEASE_BEHAVIOR_ARB); + if ( val == 1 ) + AddAttribute(WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); + else + AddAttribute(WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::PlatformDefaults() +{ + // No MSW specific defaults + return *this; +} + +void wxGLContextAttrs::EndList() +{ + AddAttribute(0); +} + +// ---------------------------------------------------------------------------- +// wxGLAttributes: pixel format attributes +// ---------------------------------------------------------------------------- +// MSW specific values + +wxGLAttributes& wxGLAttributes::RGBA() +{ + AddAttribute(WGL_PIXEL_TYPE_ARB); + AddAttribute(WGL_TYPE_RGBA_ARB); + AddAttribute(WGL_COLOR_BITS_ARB); + AddAttribute(24); + AddAttribute(WGL_ALPHA_BITS_ARB); + AddAttribute(8); + return *this; +} + +wxGLAttributes& wxGLAttributes::BufferSize(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_COLOR_BITS_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Level(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_NUMBER_OVERLAYS_ARB); + AddAttribute(val); + } + else if ( val < 0 ) + { + AddAttribute(WGL_NUMBER_UNDERLAYS_ARB); + AddAttribute(-val); + } + if ( val < -1 || val > 1 ) + { + SetNeedsARB(); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::DoubleBuffer() +{ + AddAttribute(WGL_DOUBLE_BUFFER_ARB); + AddAttribute(GL_TRUE); + return *this; +} + +wxGLAttributes& wxGLAttributes::Stereo() +{ + AddAttribute(WGL_STEREO_ARB); + AddAttribute(GL_TRUE); + return *this; +} + +wxGLAttributes& wxGLAttributes::AuxBuffers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_AUX_BUFFERS_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + int colorBits = 0; + if ( mRed >= 0) + { + AddAttribute(WGL_RED_BITS_ARB); + AddAttribute(mRed); + colorBits += mRed; + } + if ( mGreen >= 0) + { + AddAttribute(WGL_GREEN_BITS_ARB); + AddAttribute(mGreen); + colorBits += mGreen; + } + if ( mBlue >= 0) + { + AddAttribute(WGL_BLUE_BITS_ARB); + AddAttribute(mBlue); + colorBits += mBlue; + } + if ( mAlpha >= 0) + { + AddAttribute(WGL_ALPHA_BITS_ARB); + AddAttribute(mAlpha); + // doesn't count in colorBits + } + if ( colorBits ) + { + AddAttribute(WGL_COLOR_BITS_ARB); + AddAttribute(colorBits); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Depth(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_DEPTH_BITS_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Stencil(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_STENCIL_BITS_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + int acumBits = 0; + if ( mRed >= 0) + { + AddAttribute(WGL_ACCUM_RED_BITS_ARB); + AddAttribute(mRed); + acumBits += mRed; + } + if ( mGreen >= 0) + { + AddAttribute(WGL_ACCUM_GREEN_BITS_ARB); + AddAttribute(mGreen); + acumBits += mGreen; + } + if ( mBlue >= 0) + { + AddAttribute(WGL_ACCUM_BLUE_BITS_ARB); + AddAttribute(mBlue); + acumBits += mBlue; + } + if ( mAlpha >= 0) + { + AddAttribute(WGL_ACCUM_ALPHA_BITS_ARB); + AddAttribute(mAlpha); + acumBits += mAlpha; + } + if ( acumBits ) + { + AddAttribute(WGL_ACCUM_BITS_ARB); + AddAttribute(acumBits); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::SampleBuffers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_SAMPLE_BUFFERS_ARB); + AddAttribute(val); + SetNeedsARB(); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Samplers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WGL_SAMPLES_ARB); + AddAttribute(val); + SetNeedsARB(); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::FrameBuffersRGB() +{ + AddAttribute(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); + AddAttribute(GL_TRUE); + SetNeedsARB(); + return *this; +} + +void wxGLAttributes::EndList() +{ + AddAttribute(0); +} + +wxGLAttributes& wxGLAttributes::PlatformDefaults() +{ + AddAttribute(WGL_DRAW_TO_WINDOW_ARB); + AddAttribute(GL_TRUE); + AddAttribute(WGL_SUPPORT_OPENGL_ARB); + AddAttribute(GL_TRUE); + AddAttribute(WGL_ACCELERATION_ARB); + AddAttribute(WGL_FULL_ACCELERATION_ARB); + return *this; +} + +wxGLAttributes& wxGLAttributes::Defaults() +{ + RGBA().Depth(16).DoubleBuffer().SampleBuffers(1).Samplers(4); + SetNeedsARB(); + return *this; +} + // ---------------------------------------------------------------------------- // wxGLContext // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGLContext, wxObject) +wxIMPLEMENT_CLASS(wxGLContext, wxObject); -wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext* other) +wxGLContext::wxGLContext(wxGLCanvas *win, + const wxGLContext *other, + const wxGLContextAttrs *ctxAttrs) + : m_glContext(NULL) { - m_glContext = wglCreateContext(win->GetHDC()); - wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGL context") ); + const int* contextAttribs = NULL; + bool needsARB = false; - if ( other ) + if ( ctxAttrs ) { - if ( !wglShareLists(other->m_glContext, m_glContext) ) - { - wxLogLastError(wxT("wglShareLists")); - } + contextAttribs = ctxAttrs->GetGLAttrs(); + needsARB = ctxAttrs->NeedsARB(); } + else if ( win->GetGLCTXAttrs().GetGLAttrs() ) + { + // If OpenGL context parameters were set at wxGLCanvas ctor, get them now + contextAttribs = win->GetGLCTXAttrs().GetGLAttrs(); + needsARB = win->GetGLCTXAttrs().NeedsARB(); + } + // else use GPU driver defaults + + m_isOk = false; + + // We need to create a temporary context to get the pointer to + // wglCreateContextAttribsARB function + HGLRC tempContext = wglCreateContext(win->GetHDC()); + wxCHECK_RET( tempContext, "wglCreateContext failed!" ); + + wglMakeCurrent(win->GetHDC(), tempContext); + PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB + = (PFNWGLCREATECONTEXTATTRIBSARBPROC) + wglGetProcAddress("wglCreateContextAttribsARB"); + wglMakeCurrent(win->GetHDC(), NULL); + wglDeleteContext(tempContext); + + // The preferred way is using wglCreateContextAttribsARB, even for old context + if ( !wglCreateContextAttribsARB && needsARB ) // OpenGL 3 context creation + { + wxLogMessage(_("OpenGL 3.0 or later is not supported by the OpenGL driver.")); + return; + } + + if ( wglCreateContextAttribsARB ) + { + m_glContext = wglCreateContextAttribsARB(win->GetHDC(), + other ? other->m_glContext : 0, + contextAttribs); + } + else + { + // Create legacy context + m_glContext = wglCreateContext(win->GetHDC()); + // Set shared context + if ( other && !wglShareLists(other->m_glContext, m_glContext) ) + wxLogLastError("wglShareLists"); + } + + if ( !m_glContext ) + wxLogMessage(_("Couldn't create OpenGL context")); + else + m_isOk = true; } wxGLContext::~wxGLContext() { // note that it's ok to delete the context even if it's the current one - wglDeleteContext(m_glContext); + if ( m_glContext ) + { + wglDeleteContext(m_glContext); + } } bool wxGLContext::SetCurrent(const wxGLCanvas& win) const @@ -142,21 +635,19 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const // wxGLCanvas // ============================================================================ -IMPLEMENT_CLASS(wxGLCanvas, wxWindow) +wxIMPLEMENT_CLASS(wxGLCanvas, wxWindow); -BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) +wxBEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) #if wxUSE_PALETTE EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged) EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette) #endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxGLCanvas construction // ---------------------------------------------------------------------------- -static int ChoosePixelFormatARB(HDC hdc, const int *attribList); - void wxGLCanvas::Init() { #if WXWIN_COMPATIBILITY_2_8 @@ -165,6 +656,20 @@ void wxGLCanvas::Init() m_hDC = NULL; } +wxGLCanvas::wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) +{ + Init(); + + (void)Create(parent, dispAttrs, id, pos, size, style, name, palette); +} + wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, const int *attribList, @@ -229,59 +734,50 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxString& name, const int *attribList, const wxPalette& palette) +{ + // Separate 'pixel format' attributes. + // Also store context attributes for wxGLContext ctor + wxGLAttributes dispAttrs; + if ( ! ParseAttribList(attribList, dispAttrs, &m_GLCTXAttrs) ) + return false; + + return Create(parent, dispAttrs, id, pos, size, style, name, palette); +} + +bool wxGLCanvas::Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) { // Create the window first: we will either use it as is or use it to query // for multisampling support and recreate it later with another pixel format if ( !CreateWindow(parent, id, pos, size, style, name) ) return false; + // Choose a matching pixel format. + // Need a PIXELFORMATDESCRIPTOR for SetPixelFormat() PIXELFORMATDESCRIPTOR pfd; - const int setupVal = DoSetup(pfd, attribList); - if ( setupVal == 0 ) // PixelFormat error - return false; - - if ( setupVal == -1 ) // FSAA requested + int pixelFormat = FindMatchingPixelFormat(dispAttrs, &pfd); + if ( !pixelFormat ) { - // now that we have a valid OpenGL window, query it for FSAA support - int pixelFormat; - { - wxGLContext ctx(this); - ctx.SetCurrent(*this); - pixelFormat = ::ChoosePixelFormatARB(m_hDC, attribList); - } + wxFAIL_MSG("Can't find a pixel format for the requested attributes"); + return false; + } - if ( pixelFormat > 0 ) - { - // from http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx: - // - // Setting the pixel format of a window more than once can - // lead to significant complications for the Window Manager - // and for multithread applications, so it is not allowed. An - // application can only set the pixel format of a window one - // time. Once a window's pixel format is set, it cannot be - // changed. - // - // so we need to delete the old window and create the new one - - // destroy Window - ::ReleaseDC(GetHwnd(), m_hDC); - m_hDC = 0; - - parent->RemoveChild(this); - const HWND hwnd = GetHwnd(); - DissociateHandle(); // will do SetHWND(0); - ::DestroyWindow(hwnd); - - // now recreate with FSAA pixelFormat - if ( !CreateWindow(parent, id, pos, size, style, name) ) - return false; - - if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) ) - { - wxLogLastError(wxT("SetPixelFormat")); - return false; - } - } + // From SetPixelFormat() docs, relating pfd parameter: + // https://msdn.microsoft.com/en-us/library/dd369049%28v=vs.85%29.aspx + // "The system's metafile component uses this structure to record the + // logical pixel format specification." + // If anybody understands this sentence, please explain. + // Pass pfd just in case it's somehow needed. Passing NULL also works here. + if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) ) + { + wxLogLastError("SetPixelFormat"); + return false; } #if wxUSE_PALETTE @@ -310,10 +806,6 @@ bool wxGLCanvas::SwapBuffers() } -// ---------------------------------------------------------------------------- -// multi sample support -// ---------------------------------------------------------------------------- - // this macro defines a variable of type "name_t" called "name" and initializes // it with the pointer to WGL function "name" (which may be NULL) #define wxDEFINE_WGL_FUNC(name) \ @@ -351,12 +843,228 @@ bool wxGLCanvasBase::IsExtensionSupported(const char *extension) return s_extensionsList && IsExtensionInList(s_extensionsList, extension); } -// this is a wrapper around wglChoosePixelFormatARB(): returns the pixel format -// index matching the given attributes on success or 0 on failure -static int ChoosePixelFormatARB(HDC hdc, const int *attribList) +// ---------------------------------------------------------------------------- +// pixel format stuff +// ---------------------------------------------------------------------------- + +// A dummy window, needed at FindMatchingPixelFormat() +class WXDLLIMPEXP_GL wxGLdummyWin : public wxWindow { - if ( !wxGLCanvas::IsExtensionSupported("WGL_ARB_multisample") ) +public: + wxGLdummyWin() + { + hdc = 0; + CreateBase(NULL, wxID_ANY); + DWORD msflags = WS_CLIPSIBLINGS | WS_CLIPCHILDREN; + if( MSWCreate(wxApp::GetRegisteredClassName(wxT("wxGLCanvas"), -1, CS_OWNDC), + NULL, wxDefaultPosition, wxDefaultSize, msflags, 0) ) + { + hdc = ::GetDC(GetHwnd()); + } + } + ~wxGLdummyWin() + { + if ( hdc ) + ::ReleaseDC(GetHwnd(), hdc); + } + HDC hdc; +}; + +// Fills PIXELFORMATDESCRIPTOR struct +static void SetPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, const int* attrsListWGL) +{ + // Some defaults + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); + pfd.nVersion = 1; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; // For very early MSW OpenGL + + // We can meet some WGL_XX values not managed by wx. But the user + // may require them. Allow here those that are also used for pfd. + // Color shift and transparency are not handled. + for ( int arg = 0; attrsListWGL[arg]; ) + { + switch ( attrsListWGL[arg++] ) + { + case WGL_DRAW_TO_WINDOW_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_DRAW_TO_WINDOW; + break; + + case WGL_DRAW_TO_BITMAP_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_DRAW_TO_BITMAP; + break; + + case WGL_ACCELERATION_ARB: + if ( attrsListWGL[arg++] == WGL_GENERIC_ACCELERATION_ARB ) + pfd.dwFlags |= PFD_GENERIC_ACCELERATED; + break; + + case WGL_NEED_PALETTE_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_NEED_PALETTE; + break; + + case WGL_NEED_SYSTEM_PALETTE_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_NEED_SYSTEM_PALETTE; + break; + + case WGL_SWAP_LAYER_BUFFERS_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_SWAP_LAYER_BUFFERS; + break; + + case WGL_SWAP_METHOD_ARB: + if ( attrsListWGL[arg++] == WGL_SWAP_EXCHANGE_ARB ) + pfd.dwFlags |= PFD_SWAP_EXCHANGE; + else if ( attrsListWGL[arg] == WGL_SWAP_COPY_ARB ) + pfd.dwFlags |= PFD_SWAP_COPY; + break; + + case WGL_NUMBER_OVERLAYS_ARB: + pfd.bReserved &= 240; + pfd.bReserved |= attrsListWGL[arg++] & 15; + break; + + case WGL_NUMBER_UNDERLAYS_ARB: + pfd.bReserved &= 15; + pfd.bReserved |= attrsListWGL[arg++] & 240; + break; + + case WGL_SUPPORT_GDI_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_SUPPORT_GDI; + break; + + case WGL_SUPPORT_OPENGL_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_SUPPORT_OPENGL; + break; + + case WGL_DOUBLE_BUFFER_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_DOUBLEBUFFER; + break; + + case WGL_STEREO_ARB: + if ( attrsListWGL[arg++] ) + pfd.dwFlags |= PFD_STEREO; + break; + + case WGL_PIXEL_TYPE_ARB: + if ( attrsListWGL[arg++] == WGL_TYPE_RGBA_ARB ) + pfd.iPixelType = PFD_TYPE_RGBA; + else + pfd.iPixelType = PFD_TYPE_COLORINDEX; + break; + + case WGL_COLOR_BITS_ARB: + pfd.cColorBits = attrsListWGL[arg++]; + break; + + case WGL_RED_BITS_ARB: + pfd.cRedBits = attrsListWGL[arg++]; + break; + + case WGL_GREEN_BITS_ARB: + pfd.cGreenBits = attrsListWGL[arg++]; + break; + + case WGL_BLUE_BITS_ARB: + pfd.cBlueBits = attrsListWGL[arg++]; + break; + + case WGL_ALPHA_BITS_ARB: + pfd.cAlphaBits = attrsListWGL[arg++]; + break; + + case WGL_ACCUM_BITS_ARB: + pfd.cAccumBits = attrsListWGL[arg++]; + break; + + case WGL_ACCUM_RED_BITS_ARB: + pfd.cAccumRedBits = attrsListWGL[arg++]; + break; + + case WGL_ACCUM_GREEN_BITS_ARB: + pfd.cAccumGreenBits = attrsListWGL[arg++]; + break; + + case WGL_ACCUM_BLUE_BITS_ARB: + pfd.cAccumBlueBits = attrsListWGL[arg++]; + break; + + case WGL_ACCUM_ALPHA_BITS_ARB: + pfd.cAccumAlphaBits = attrsListWGL[arg++]; + break; + + case WGL_DEPTH_BITS_ARB: + pfd.cDepthBits = attrsListWGL[arg++]; + break; + + case WGL_STENCIL_BITS_ARB: + pfd.cStencilBits = attrsListWGL[arg++]; + break; + + case WGL_AUX_BUFFERS_ARB: + pfd.cAuxBuffers = attrsListWGL[arg++]; + break; + + default: + // ignore + break; + } + } +} + +/* static */ +int wxGLCanvas::FindMatchingPixelFormat(const wxGLAttributes& dispAttrs, + PIXELFORMATDESCRIPTOR* ppfd) +{ + // WGL_XX attributes + const int* attrsListWGL = dispAttrs.GetGLAttrs(); + if ( !attrsListWGL ) + { + wxFAIL_MSG("wxGLAttributes object is empty."); return 0; + } + + // The preferred way is using wglChoosePixelFormatARB. This is not a MSW + // function, we must ask the GPU driver for a pointer to it. We need a + // rendering context for this operation. Create a dummy one. + // Notice that we don't create a wxGLContext on purpose. + // We meet another issue: + // Before creating any context, we must set a pixel format for its hdc: + // https://msdn.microsoft.com/en-us/library/dd374379%28v=vs.85%29.aspx + // but we can't set a pixel format more than once: + // https://msdn.microsoft.com/en-us/library/dd369049%28v=vs.85%29.aspx + // To cope with this we need a dummy hidden window. + // + // Having this dummy window allows also calling IsDisplaySupported() + // without creating a wxGLCanvas. + wxGLdummyWin* dummyWin = new wxGLdummyWin(); + HDC dummyHDC = dummyWin->hdc; + if ( !dummyHDC ) + { + dummyWin->Destroy(); + wxFAIL_MSG("Can't create dummy window"); + return 0; + } + // Dummy context + PIXELFORMATDESCRIPTOR dpfd; //any one is valid + ::SetPixelFormat(dummyHDC, 1, &dpfd); // pixelformat=1, any one is valid + HGLRC dumctx = ::wglCreateContext(dummyHDC); + if ( !dumctx ) + { + dummyWin->Destroy(); + // A fatal error! + wxFAIL_MSG("wglCreateContext failed!"); + return 0; + } + + ::wglMakeCurrent(dummyHDC, dumctx); typedef BOOL (WINAPI * wglChoosePixelFormatARB_t) (HDC hdc, @@ -367,256 +1075,74 @@ static int ChoosePixelFormatARB(HDC hdc, const int *attribList) UINT *nNumFormats ); - wxDEFINE_WGL_FUNC(wglChoosePixelFormatARB); - if ( !wglChoosePixelFormatARB ) - return 0; // should not occur if extension is supported + wxDEFINE_WGL_FUNC(wglChoosePixelFormatARB); // get a pointer to it - int iAttributes[128]; - int dst = 0; // index in iAttributes array - - #define ADD_ATTR(attr, value) \ - iAttributes[dst++] = attr; iAttributes[dst++] = value - - ADD_ATTR( WGL_DRAW_TO_WINDOW_ARB, GL_TRUE ); - ADD_ATTR( WGL_SUPPORT_OPENGL_ARB, GL_TRUE ); - ADD_ATTR( WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB ); - - if ( !attribList ) + // If wglChoosePixelFormatARB is not supported but the attributes require + // it, then fail. + if ( !wglChoosePixelFormatARB && dispAttrs.NeedsARB() ) { - ADD_ATTR( WGL_COLOR_BITS_ARB, 24 ); - ADD_ATTR( WGL_ALPHA_BITS_ARB, 8 ); - ADD_ATTR( WGL_DEPTH_BITS_ARB, 16 ); - ADD_ATTR( WGL_STENCIL_BITS_ARB, 0 ); - ADD_ATTR( WGL_DOUBLE_BUFFER_ARB, GL_TRUE ); - ADD_ATTR( WGL_SAMPLE_BUFFERS_ARB, GL_TRUE ); - ADD_ATTR( WGL_SAMPLES_ARB, 4 ); - } - else // have custom attributes - { - #define ADD_ATTR_VALUE(attr) ADD_ATTR(attr, attribList[src++]) - - int src = 0; - while ( attribList[src] ) - { - switch ( attribList[src++] ) - { - case WX_GL_RGBA: - ADD_ATTR( WGL_COLOR_BITS_ARB, 24 ); - ADD_ATTR( WGL_ALPHA_BITS_ARB, 8 ); - break; - - case WX_GL_BUFFER_SIZE: - ADD_ATTR_VALUE( WGL_COLOR_BITS_ARB); - break; - - case WX_GL_LEVEL: - if ( attribList[src] > 0 ) - { - ADD_ATTR( WGL_NUMBER_OVERLAYS_ARB, 1 ); - } - else if ( attribList[src] <0 ) - { - ADD_ATTR( WGL_NUMBER_UNDERLAYS_ARB, 1 ); - } - //else: ignore it - - src++; // skip the value in any case - break; - - case WX_GL_DOUBLEBUFFER: - ADD_ATTR( WGL_DOUBLE_BUFFER_ARB, GL_TRUE ); - break; - - case WX_GL_STEREO: - ADD_ATTR( WGL_STEREO_ARB, GL_TRUE ); - break; - - case WX_GL_AUX_BUFFERS: - ADD_ATTR_VALUE( WGL_AUX_BUFFERS_ARB ); - break; - - case WX_GL_MIN_RED: - ADD_ATTR_VALUE( WGL_RED_BITS_ARB ); - break; - - case WX_GL_MIN_GREEN: - ADD_ATTR_VALUE( WGL_GREEN_BITS_ARB ); - break; - - case WX_GL_MIN_BLUE: - ADD_ATTR_VALUE( WGL_BLUE_BITS_ARB ); - break; - - case WX_GL_MIN_ALPHA: - ADD_ATTR_VALUE( WGL_ALPHA_BITS_ARB ); - break; - - case WX_GL_DEPTH_SIZE: - ADD_ATTR_VALUE( WGL_DEPTH_BITS_ARB ); - break; - - case WX_GL_STENCIL_SIZE: - ADD_ATTR_VALUE( WGL_STENCIL_BITS_ARB ); - break; - - case WX_GL_MIN_ACCUM_RED: - ADD_ATTR_VALUE( WGL_ACCUM_RED_BITS_ARB ); - break; - - case WX_GL_MIN_ACCUM_GREEN: - ADD_ATTR_VALUE( WGL_ACCUM_GREEN_BITS_ARB ); - break; - - case WX_GL_MIN_ACCUM_BLUE: - ADD_ATTR_VALUE( WGL_ACCUM_BLUE_BITS_ARB ); - break; - - case WX_GL_MIN_ACCUM_ALPHA: - ADD_ATTR_VALUE( WGL_ACCUM_ALPHA_BITS_ARB ); - break; - - case WX_GL_SAMPLE_BUFFERS: - ADD_ATTR_VALUE( WGL_SAMPLE_BUFFERS_ARB ); - break; - - case WX_GL_SAMPLES: - ADD_ATTR_VALUE( WGL_SAMPLES_ARB ); - break; - } - } - - #undef ADD_ATTR_VALUE - } - - #undef ADD_ATTR - - iAttributes[dst++] = 0; - - int pf; - UINT numFormats = 0; - - if ( !wglChoosePixelFormatARB(hdc, iAttributes, NULL, 1, &pf, &numFormats) ) - { - wxLogLastError(wxT("wglChoosePixelFormatARB")); + wxLogLastError("wglChoosePixelFormatARB unavailable"); + // Delete the dummy objects + ::wglMakeCurrent(NULL, NULL); + ::wglDeleteContext(dumctx); + dummyWin->Destroy(); return 0; } - // Although TRUE is returned if no matching formats are found (see - // http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt), pf is - // not initialized in this case so we need to check for numFormats being - // not 0 explicitly (however this is not an error so don't call - // wxLogLastError() here). - if ( !numFormats ) - pf = 0; + int pixelFormat = 0; - return pf; -} - -// ---------------------------------------------------------------------------- -// pixel format stuff -// ---------------------------------------------------------------------------- - -// returns true if pfd was adjusted accordingly to attributes provided, false -// if there is an error with attributes or -1 if the attributes indicate -// features not supported by ChoosePixelFormat() at all (currently only multi -// sampling) -static int -AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, const int *attribList) -{ - if ( !attribList ) - return 1; - - // remove default attributes - pfd.dwFlags &= ~PFD_DOUBLEBUFFER; - pfd.iPixelType = PFD_TYPE_COLORINDEX; - - bool requestFSAA = false; - for ( int arg = 0; attribList[arg]; ) + if ( !wglChoosePixelFormatARB && !dispAttrs.NeedsARB() ) { - switch ( attribList[arg++] ) + // Old way + if ( !ppfd ) { - case WX_GL_RGBA: - pfd.iPixelType = PFD_TYPE_RGBA; - break; - - case WX_GL_BUFFER_SIZE: - pfd.cColorBits = attribList[arg++]; - break; - - case WX_GL_LEVEL: - // this member looks like it may be obsolete - if ( attribList[arg] > 0 ) - pfd.iLayerType = PFD_OVERLAY_PLANE; - else if ( attribList[arg] < 0 ) - pfd.iLayerType = (BYTE)PFD_UNDERLAY_PLANE; - else - pfd.iLayerType = PFD_MAIN_PLANE; - arg++; - break; - - case WX_GL_DOUBLEBUFFER: - pfd.dwFlags |= PFD_DOUBLEBUFFER; - break; - - case WX_GL_STEREO: - pfd.dwFlags |= PFD_STEREO; - break; - - case WX_GL_AUX_BUFFERS: - pfd.cAuxBuffers = attribList[arg++]; - break; - - case WX_GL_MIN_RED: - pfd.cColorBits += (pfd.cRedBits = attribList[arg++]); - break; - - case WX_GL_MIN_GREEN: - pfd.cColorBits += (pfd.cGreenBits = attribList[arg++]); - break; - - case WX_GL_MIN_BLUE: - pfd.cColorBits += (pfd.cBlueBits = attribList[arg++]); - break; - - case WX_GL_MIN_ALPHA: - // doesn't count in cColorBits - pfd.cAlphaBits = attribList[arg++]; - break; - - case WX_GL_DEPTH_SIZE: - pfd.cDepthBits = attribList[arg++]; - break; - - case WX_GL_STENCIL_SIZE: - pfd.cStencilBits = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_RED: - pfd.cAccumBits += (pfd.cAccumRedBits = attribList[arg++]); - break; - - case WX_GL_MIN_ACCUM_GREEN: - pfd.cAccumBits += (pfd.cAccumGreenBits = attribList[arg++]); - break; - - case WX_GL_MIN_ACCUM_BLUE: - pfd.cAccumBits += (pfd.cAccumBlueBits = attribList[arg++]); - break; - - case WX_GL_MIN_ACCUM_ALPHA: - pfd.cAccumBits += (pfd.cAccumAlphaBits = attribList[arg++]); - break; - - case WX_GL_SAMPLE_BUFFERS: - case WX_GL_SAMPLES: - // There is no support for multisample when using PIXELFORMATDESCRIPTOR - requestFSAA = true; // Remember that multi sample is requested. - arg++; // will call ChoosePixelFormatARB() later - break; + // We have been called from IsDisplaySupported() + PIXELFORMATDESCRIPTOR pfd; + SetPFDForAttributes(pfd, attrsListWGL); + pixelFormat = ::ChoosePixelFormat(dummyHDC, &pfd); } + else + { + SetPFDForAttributes(*ppfd, attrsListWGL); + pixelFormat = ::ChoosePixelFormat(dummyHDC, ppfd); + } + // We should ensure that we have got what we have asked for. This can + // be done using DescribePixelFormat() and comparing attributes. + // Nevertheless wglChoosePixelFormatARB exists since 2001, so it's + // very unlikely that ChoosePixelFormat() is used. So, do nothing. + } + else + { + // New way, using wglChoosePixelFormatARB + // 'ppfd' is used at wxGLCanvas::Create(). See explanations there. + if ( ppfd ) + SetPFDForAttributes(*ppfd, attrsListWGL); + + UINT numFormats = 0; + + // Get the first good match + if ( !wglChoosePixelFormatARB(dummyHDC, attrsListWGL, NULL, + 1, &pixelFormat, &numFormats) ) + { + wxLogLastError("wglChoosePixelFormatARB. Is the list zero-terminated?"); + numFormats = 0; + } + + // Although TRUE is returned if no matching formats are found (see + // https://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt), + // pixelFormat is not initialized in this case so we need to check + // for numFormats being not 0 explicitly (however this is not an error + // so don't call wxLogLastError() here). + if ( !numFormats ) + pixelFormat = 0; } - return requestFSAA ? -1 : 1; + // Delete the dummy objects + ::wglMakeCurrent(NULL, NULL); + ::wglDeleteContext(dumctx); + dummyWin->Destroy(); + + return pixelFormat; } /* static */ @@ -625,54 +1151,16 @@ wxGLCanvas::ChooseMatchingPixelFormat(HDC hdc, const int *attribList, PIXELFORMATDESCRIPTOR *ppfd) { - // default neutral pixel format - PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), // size - 1, // version - PFD_SUPPORT_OPENGL | - PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER, // use double-buffering by default - PFD_TYPE_RGBA, // default pixel type - 0, // preferred color depth (don't care) - 0, 0, 0, 0, 0, 0, // color bits and shift bits (ignored) - 0, 0, // alpha bits and shift (ignored) - 0, // accumulation total bits - 0, 0, 0, 0, // accumulator RGBA bits (not used) - 16, // depth buffer - 0, // no stencil buffer - 0, // no auxiliary buffers - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0, // no layer, visible, damage masks - }; + wxGLAttributes dispAttrs; + ParseAttribList(attribList, dispAttrs); + wxUnusedVar(hdc); + return FindMatchingPixelFormat(dispAttrs, ppfd); +} - if ( !ppfd ) - ppfd = &pfd; - else - *ppfd = pfd; - - // adjust the PFD using the provided attributes and also check if we can - // use PIXELFORMATDESCRIPTOR at all: if multisampling is requested, we - // can't as it's not supported by ChoosePixelFormat() - switch ( AdjustPFDForAttributes(*ppfd, attribList) ) - { - case 1: - return ::ChoosePixelFormat(hdc, ppfd); - - default: - wxFAIL_MSG( "unexpected AdjustPFDForAttributes() return value" ); - // fall through - - case 0: - // error in attributes - return 0; - - case -1: - // requestFSAA == true, will continue as normal - // in order to query later for a FSAA pixelformat - return -1; - } +/* static */ +bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) +{ + return wxGLCanvas::FindMatchingPixelFormat(dispAttrs) > 0; } /* static */ @@ -680,30 +1168,16 @@ bool wxGLCanvasBase::IsDisplaySupported(const int *attribList) { // We need a device context to test the pixel format, so get one // for the root window. + // Not true anymore. Keep it just in case some body uses this undocumented function return wxGLCanvas::ChooseMatchingPixelFormat(ScreenHDC(), attribList) > 0; } int wxGLCanvas::DoSetup(PIXELFORMATDESCRIPTOR &pfd, const int *attribList) { - int pixelFormat = ChooseMatchingPixelFormat(m_hDC, attribList, &pfd); - - const bool requestFSAA = pixelFormat == -1; - if ( requestFSAA ) - pixelFormat = ::ChoosePixelFormat(m_hDC, &pfd); - - if ( !pixelFormat ) - { - wxLogLastError(wxT("ChoosePixelFormat")); - return 0; - } - - if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) ) - { - wxLogLastError(wxT("SetPixelFormat")); - return 0; - } - - return requestFSAA ? -1 : 1; + // Keep this member is case somebody is overriding it + wxUnusedVar(pfd); + wxUnusedVar(attribList); + return -1; } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/graphics.cpp b/Externals/wxWidgets3/src/msw/graphics.cpp index b8bc80a2e8..da9da365da 100644 --- a/Externals/wxWidgets3/src/msw/graphics.cpp +++ b/Externals/wxWidgets3/src/msw/graphics.cpp @@ -16,7 +16,7 @@ #include "wx/dc.h" -#if wxUSE_GRAPHICS_CONTEXT +#if wxUSE_GRAPHICS_GDIPLUS #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -28,6 +28,7 @@ #include "wx/bitmap.h" #include "wx/log.h" #include "wx/icon.h" + #include "wx/math.h" #include "wx/module.h" // include all dc types that are used as a param #include "wx/dc.h" @@ -45,22 +46,17 @@ #include "wx/msw/enhmeta.h" #endif #include "wx/dcgraph.h" +#include "wx/rawbmp.h" #include "wx/msw/private.h" // needs to be before #include -#if wxUSE_COMMON_DIALOGS && !defined(__WXMICROWIN__) +#if wxUSE_COMMON_DIALOGS #include #endif namespace { -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -const double RAD2DEG = 180.0 / M_PI; - //----------------------------------------------------------------------------- // Local functions //----------------------------------------------------------------------------- @@ -68,9 +64,6 @@ const double RAD2DEG = 180.0 / M_PI; inline double dmin(double a, double b) { return a < b ? a : b; } inline double dmax(double a, double b) { return a > b ? a : b; } -inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -inline double RadToDeg(double deg) { return (deg * 180.0) / M_PI; } - // translate a wxColour to a Color inline Color wxColourToColor(const wxColour& col) { @@ -289,7 +282,9 @@ protected: private: // common part of Create{Linear,Radial}GradientBrush() template - void SetGradientStops(T *brush, const wxGraphicsGradientStops& stops); + void SetGradientStops(T *brush, + const wxGraphicsGradientStops& stops, + bool reversed = false); Brush* m_brush; Image* m_brushImage; @@ -457,6 +452,11 @@ public: } virtual ~wxGDIPlusImageContext() + { + Flush(); + } + + virtual void Flush() wxOVERRIDE { m_image = m_bitmap.ConvertToImage(); } @@ -587,6 +587,9 @@ public : // create a subimage from a native image representation virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual wxString GetName() const wxOVERRIDE; + virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE; + protected : bool EnsureIsLoaded(); void Load(); @@ -597,7 +600,7 @@ private : int m_loaded; ULONG_PTR m_gditoken; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGDIPlusRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGDIPlusRenderer); } ; //----------------------------------------------------------------------------- @@ -785,7 +788,7 @@ wxGDIPlusBrushData::wxGDIPlusBrushData( wxGraphicsRenderer* renderer , const wxB : wxGraphicsObjectRefData(renderer) { Init(); - if ( brush.GetStyle() == wxSOLID) + if ( brush.GetStyle() == wxBRUSHSTYLE_SOLID) { m_brush = new SolidBrush(wxColourToColor( brush.GetColour())); } @@ -857,7 +860,8 @@ void wxGDIPlusBrushData::Init() template void wxGDIPlusBrushData::SetGradientStops(T *brush, - const wxGraphicsGradientStops& stops) + const wxGraphicsGradientStops& stops, + bool reversed) { const unsigned numStops = stops.GetCount(); if ( numStops <= 2 ) @@ -870,12 +874,25 @@ wxGDIPlusBrushData::SetGradientStops(T *brush, wxVector colors(numStops); wxVector positions(numStops); - for ( unsigned i = 0; i < numStops; i++ ) + if ( reversed ) { - wxGraphicsGradientStop stop = stops.Item(i); + for ( unsigned i = 0; i < numStops; i++ ) + { + wxGraphicsGradientStop stop = stops.Item(numStops - i - 1); - colors[i] = wxColourToColor(stop.GetColour()); - positions[i] = stop.GetPosition(); + colors[i] = wxColourToColor(stop.GetColour()); + positions[i] = 1.0 - stop.GetPosition(); + } + } + else + { + for ( unsigned i = 0; i < numStops; i++ ) + { + wxGraphicsGradientStop stop = stops.Item(i); + + colors[i] = wxColourToColor(stop.GetColour()); + positions[i] = stop.GetPosition(); + } } brush->SetInterpolationColors(&colors[0], &positions[0], numStops); @@ -914,7 +931,9 @@ wxGDIPlusBrushData::CreateRadialGradientBrush(wxDouble xo, wxDouble yo, int count = 1; brush->SetSurroundColors(&col, &count); - SetGradientStops(brush, stops); + // Because the GDI+ API draws radial gradients from outside towards the + // center we have to reverse the order of the gradient stops. + SetGradientStops(brush, stops, true); } //----------------------------------------------------------------------------- @@ -943,10 +962,14 @@ wxGDIPlusFontData::wxGDIPlusFontData( wxGraphicsRenderer* renderer, style |= FontStyleItalic; if ( font.GetUnderlined() ) style |= FontStyleUnderline; + if ( font.GetStrikethrough() ) + style |= FontStyleStrikeout; if ( font.GetWeight() == wxFONTWEIGHT_BOLD ) style |= FontStyleBold; - Init(font.GetFaceName(), font.GetPointSize(), style, col, UnitPoint); + // Create font which size is measured in logical units + // and let the system rescale it according to the target resolution. + Init(font.GetFaceName(), font.GetPixelSize().GetHeight(), style, col, UnitPixel); } wxGDIPlusFontData::wxGDIPlusFontData(wxGraphicsRenderer* renderer, @@ -1084,20 +1107,45 @@ wxGDIPlusBitmapData::wxGDIPlusBitmapData( wxGraphicsRenderer* renderer, wxImage wxGDIPlusBitmapData::ConvertToImage() const { - // We could use Bitmap::LockBits() and convert to wxImage directly but - // passing by wxBitmap is easier. It would be nice to measure performance - // of the two methods but for this the second one would need to be written - // first... - HBITMAP hbmp; - if ( m_bitmap->GetHBITMAP(Color(0xffffffff), &hbmp) != Gdiplus::Ok ) - return wxNullImage; + // We need to use Bitmap::LockBits() to convert bitmap to wxImage + // because this way we can retrieve also alpha channel data. + // Alternative way by retrieving bitmap handle with Bitmap::GetHBITMAP + // (to pass it to wxBitmap) doesn't preserve real alpha channel data. + const UINT w = m_bitmap->GetWidth(); + const UINT h = m_bitmap->GetHeight(); - wxBitmap bmp; - bmp.SetWidth(m_bitmap->GetWidth()); - bmp.SetHeight(m_bitmap->GetHeight()); - bmp.SetHBITMAP(hbmp); - bmp.SetDepth(IsAlphaPixelFormat(m_bitmap->GetPixelFormat()) ? 32 : 24); - return bmp.ConvertToImage(); + wxImage img(w, h); + // Set up wxImage buffer for alpha channel values + // only if bitmap contains alpha channel. + if ( IsAlphaPixelFormat(m_bitmap->GetPixelFormat()) ) + { + img.InitAlpha(); + } + + BitmapData bitmapData; + Rect rect(0, 0, w, h); + m_bitmap->LockBits(&rect, ImageLockModeRead, PixelFormat32bppARGB, &bitmapData); + + unsigned char *imgRGB = img.GetData(); // destination RGB buffer + unsigned char *imgAlpha = img.GetAlpha(); // destination alpha buffer + const BYTE* pixels = static_cast(bitmapData.Scan0); + for( UINT y = 0; y < h; y++ ) + { + for( UINT x = 0; x < w; x++ ) + { + ARGB c = reinterpret_cast(pixels)[x]; + *imgRGB++ = (c >> 16) & 0xFF; // R + *imgRGB++ = (c >> 8) & 0xFF; // G + *imgRGB++ = (c >> 0) & 0xFF; // B + if ( imgAlpha ) + *imgAlpha++ = (c >> 24) & 0xFF; + } + + pixels += bitmapData.Stride; + } + m_bitmap->UnlockBits(&bitmapData); + + return img; } #endif // wxUSE_IMAGE @@ -1190,7 +1238,7 @@ void wxGDIPlusPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, double start } } - m_path->AddArc((REAL) (x-r),(REAL) (y-r),(REAL) (2*r),(REAL) (2*r),RadToDeg(startAngle),RadToDeg(sweepAngle)); + m_path->AddArc((REAL) (x-r),(REAL) (y-r),(REAL) (2*r),(REAL) (2*r),wxRadToDeg(startAngle),wxRadToDeg(sweepAngle)); } void wxGDIPlusPathData::AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) @@ -1314,7 +1362,7 @@ void wxGDIPlusMatrixData::Scale( wxDouble xScale , wxDouble yScale ) // add the rotation to this matrix (radians) void wxGDIPlusMatrixData::Rotate( wxDouble angle ) { - m_matrix->Rotate( RadToDeg(angle) ); + m_matrix->Rotate( wxRadToDeg(angle) ); } // @@ -1419,7 +1467,7 @@ void wxGDIPlusContext::Init(Graphics* graphics, int width, int height) m_context->SetTextRenderingHint(TextRenderingHintSystemDefault); m_context->SetPixelOffsetMode(PixelOffsetModeHalf); m_context->SetSmoothingMode(SmoothingModeHighQuality); - m_context->SetInterpolationMode(InterpolationModeHighQuality); + m_state1 = m_context->Save(); m_state2 = m_context->Save(); } @@ -1484,11 +1532,11 @@ void wxGDIPlusContext::StrokeLines( size_t n, const wxPoint2DDouble *points) if ( !m_pen.IsNull() ) { wxGDIPlusOffsetHelper helper( m_context , ShouldOffset() ); - Point *cpoints = new Point[n]; + PointF *cpoints = new PointF[n]; for (size_t i = 0; i < n; i++) { - cpoints[i].X = (int)(points[i].m_x ); - cpoints[i].Y = (int)(points[i].m_y ); + cpoints[i].X = static_cast(points[i].m_x); + cpoints[i].Y = static_cast(points[i].m_y); } // for (size_t i = 0; i < n; i++) m_context->DrawLines( ((wxGDIPlusPenData*)m_pen.GetGraphicsData())->GetGDIPlusPen() , cpoints , n ) ; @@ -1502,11 +1550,11 @@ void wxGDIPlusContext::DrawLines( size_t n, const wxPoint2DDouble *points, wxPol return; wxGDIPlusOffsetHelper helper( m_context , ShouldOffset() ); - Point *cpoints = new Point[n]; + PointF *cpoints = new PointF[n]; for (size_t i = 0; i < n; i++) { - cpoints[i].X = (int)(points[i].m_x ); - cpoints[i].Y = (int)(points[i].m_y ); + cpoints[i].X = static_cast(points[i].m_x); + cpoints[i].Y = static_cast(points[i].m_y); } // for (int i = 0; i < n; i++) if ( !m_brush.IsNull() ) @@ -1547,21 +1595,31 @@ bool wxGDIPlusContext::SetAntialiasMode(wxAntialiasMode antialias) if (m_antialias == antialias) return true; - m_antialias = antialias; + // MinGW currently doesn't provide InterpolationModeInvalid in its headers, + // so use our own definition. + static const SmoothingMode + wxSmoothingModeInvalid = static_cast(-1); - SmoothingMode antialiasMode; + SmoothingMode antialiasMode = wxSmoothingModeInvalid; switch (antialias) { case wxANTIALIAS_DEFAULT: antialiasMode = SmoothingModeHighQuality; break; + case wxANTIALIAS_NONE: antialiasMode = SmoothingModeNone; break; - default: - return false; } - m_context->SetSmoothingMode(antialiasMode); + + wxCHECK_MSG( antialiasMode != wxSmoothingModeInvalid, false, + wxS("Unknown antialias mode") ); + + if ( m_context->SetSmoothingMode(antialiasMode) != Gdiplus::Ok ) + return false; + + m_antialias = antialias; + return true; } @@ -1570,7 +1628,12 @@ bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolat if (m_interpolation == interpolation) return true; - InterpolationMode interpolationMode = InterpolationModeDefault; + // MinGW currently doesn't provide InterpolationModeInvalid in its headers, + // so use our own definition. + static const InterpolationMode + wxInterpolationModeInvalid = static_cast(-1); + + InterpolationMode interpolationMode = wxInterpolationModeInvalid; switch (interpolation) { case wxINTERPOLATION_DEFAULT: @@ -1592,11 +1655,11 @@ bool wxGDIPlusContext::SetInterpolationQuality(wxInterpolationQuality interpolat case wxINTERPOLATION_BEST: interpolationMode = InterpolationModeHighQualityBicubic; break; - - default: - return false; } + wxCHECK_MSG( interpolationMode != wxInterpolationModeInvalid, false, + wxS("Unknown interpolation mode") ); + if ( m_context->SetInterpolationMode(interpolationMode) != Gdiplus::Ok ) return false; @@ -1644,7 +1707,7 @@ void wxGDIPlusContext::EndLayer() void wxGDIPlusContext::Rotate( wxDouble angle ) { - m_context->RotateTransform( RadToDeg(angle) ); + m_context->RotateTransform( wxRadToDeg(angle) ); } void wxGDIPlusContext::Translate( wxDouble dx , wxDouble dy ) @@ -1706,9 +1769,8 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD // the built-in conversion fails when there is alpha in the HICON (eg XP style icons), we can only // find out by looking at the bitmap data whether there really was alpha in it HICON hIcon = (HICON)icon.GetHICON(); - ICONINFO iconInfo ; - // IconInfo creates the bitmaps for color and mask, we must dispose of them after use - if (!GetIconInfo(hIcon,&iconInfo)) + AutoIconInfo iconInfo ; + if (!iconInfo.GetFrom(hIcon)) return; Bitmap interim(iconInfo.hbmColor,NULL); @@ -1732,11 +1794,11 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD interim.GetPixelFormat(),&data); bool hasAlpha = false; - for ( size_t y = 0 ; y < height && !hasAlpha ; ++y) + for ( size_t yy = 0 ; yy < height && !hasAlpha ; ++yy) { - for( size_t x = 0 ; x < width && !hasAlpha; ++x) + for( size_t xx = 0 ; xx < width && !hasAlpha; ++xx) { - ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*y + x*4); + ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*yy + xx*4); if ( ( *dest & Color::AlphaMask ) != 0 ) hasAlpha = true; } @@ -1758,8 +1820,6 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD m_context->DrawImage(image,(REAL) x,(REAL) y,(REAL) w,(REAL) h) ; delete image ; - DeleteObject(iconInfo.hbmColor); - DeleteObject(iconInfo.hbmMask); } void wxGDIPlusContext::DoDrawText(const wxString& str, @@ -1961,15 +2021,20 @@ wxGDIPlusPrintingContext::wxGDIPlusPrintingContext( wxGraphicsRenderer* renderer // wxGDIPlusRenderer implementation //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxGDIPlusRenderer,wxGraphicsRenderer) +wxIMPLEMENT_DYNAMIC_CLASS(wxGDIPlusRenderer, wxGraphicsRenderer); static wxGDIPlusRenderer gs_GDIPlusRenderer; -wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() +wxGraphicsRenderer* wxGraphicsRenderer::GetGDIPlusRenderer() { return &gs_GDIPlusRenderer; } +wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer() +{ + return wxGraphicsRenderer::GetGDIPlusRenderer(); +} + bool wxGDIPlusRenderer::EnsureIsLoaded() { // load gdiplus.dll if not yet loaded, but don't bother doing it again @@ -2045,6 +2110,61 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); +#if wxUSE_WXDIB + // It seems that GDI+ sets invalid values for alpha channel when used with + // a compatible bitmap (DDB). So we need to convert the currently selected + // bitmap to a DIB before using it with any GDI+ functions to ensure that + // we get the correct alpha channel values in it at the end. + + wxBitmap bmp = dc.GetSelectedBitmap(); + wxASSERT_MSG( bmp.IsOk(), "Should select a bitmap before creating wxGCDC" ); + + // We don't need to convert it if it can't have alpha at all (any depth but + // 32) or is already a DIB with alpha. + if ( bmp.GetDepth() == 32 && (!bmp.IsDIB() || !bmp.HasAlpha()) ) + { + // We need to temporarily deselect this bitmap from the memory DC + // before modifying it. + const_cast(dc).SelectObject(wxNullBitmap); + + bmp.ConvertToDIB(); // Does nothing if already a DIB. + + if( !bmp.HasAlpha() ) + { + // Initialize alpha channel, even if we don't have any alpha yet, + // we should have correct (opaque) alpha values in it for GDI+ + // functions to work correctly. + { + wxAlphaPixelData data(bmp); + if ( data ) + { + wxAlphaPixelData::Iterator p(data); + for ( int y = 0; y < data.GetHeight(); y++ ) + { + wxAlphaPixelData::Iterator rowStart = p; + + for ( int x = 0; x < data.GetWidth(); x++ ) + { + p.Alpha() = wxALPHA_OPAQUE; + ++p; + } + + p = rowStart; + p.OffsetY(data, 1); + } + } + } // End of block modifying the bitmap. + + // Using wxAlphaPixelData sets the internal "has alpha" flag but we + // don't really have any alpha yet, so reset it back for now. + bmp.ResetAlpha(); + } + + // Undo SelectObject() at the beginning of this block. + const_cast(dc).SelectObjectAsSource(bmp); + } +#endif // wxUSE_WXDIB + wxGDIPlusContext* context = new wxGDIPlusContext(this, dc); context->EnableOffset(true); return context; @@ -2114,7 +2234,7 @@ wxGraphicsMatrix wxGDIPlusRenderer::CreateMatrix( wxDouble a, wxDouble b, wxDoub wxGraphicsPen wxGDIPlusRenderer::CreatePen(const wxPen& pen) { ENSURE_LOADED_OR_RETURN(wxNullGraphicsPen); - if ( !pen.IsOk() || pen.GetStyle() == wxTRANSPARENT ) + if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) return wxNullGraphicsPen; else { @@ -2127,7 +2247,7 @@ wxGraphicsPen wxGDIPlusRenderer::CreatePen(const wxPen& pen) wxGraphicsBrush wxGDIPlusRenderer::CreateBrush(const wxBrush& brush ) { ENSURE_LOADED_OR_RETURN(wxNullGraphicsBrush); - if ( !brush.IsOk() || brush.GetStyle() == wxTRANSPARENT ) + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) return wxNullGraphicsBrush; else { @@ -2278,6 +2398,21 @@ wxGraphicsBitmap wxGDIPlusRenderer::CreateSubBitmap( const wxGraphicsBitmap &bit return wxNullGraphicsBitmap; } +wxString wxGDIPlusRenderer::GetName() const +{ + return "gdiplus"; +} + +void wxGDIPlusRenderer::GetVersion(int *major, int *minor, int *micro) const +{ + if ( major ) + *major = wxPlatformInfo::Get().GetOSMajorVersion(); + if ( minor ) + *minor = wxPlatformInfo::Get().GetOSMinorVersion(); + if ( micro ) + *micro = 0; +} + // Shutdown GDI+ at app exit, before possible dll unload class wxGDIPlusRendererModule : public wxModule { @@ -2297,10 +2432,10 @@ public: } private: - DECLARE_DYNAMIC_CLASS(wxGDIPlusRendererModule) + wxDECLARE_DYNAMIC_CLASS(wxGDIPlusRendererModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxGDIPlusRendererModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxGDIPlusRendererModule, wxModule); // ---------------------------------------------------------------------------- // wxMSW-specific parts of wxGCDC @@ -2346,4 +2481,4 @@ void wxGCDC::ReleaseHDC(WXHDC hdc) g->ReleaseHDC((HDC)hdc); } -#endif // wxUSE_GRAPHICS_CONTEXT +#endif // wxUSE_GRAPHICS_GDIPLUS diff --git a/Externals/wxWidgets3/src/msw/graphicsd2d.cpp b/Externals/wxWidgets3/src/msw/graphicsd2d.cpp new file mode 100644 index 0000000000..48b74c7c79 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/graphicsd2d.cpp @@ -0,0 +1,3907 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/graphicsd2d.cpp +// Purpose: Implementation of Direct2D Render Context +// Author: Pana Alexandru +// Created: 2014-05-20 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_GRAPHICS_DIRECT2D + +// Minimum supported client: Windows 8 and Platform Update for Windows 7 +#define wxD2D_DEVICE_CONTEXT_SUPPORTED 0 + +#include +#include +#include +#include + +// Ensure no previous defines interfere with the Direct2D API headers +#undef GetHwnd + +// We load these functions at runtime from the d2d1.dll. +// However, since they are also used inside the d2d1.h header we must provide +// implementations matching the exact declarations. These defines ensures we +// are not violating the ODR rule. +#define D2D1CreateFactory wxD2D1CreateFactory +#define D2D1MakeRotateMatrix wxD2D1MakeRotateMatrix +#define D2D1InvertMatrix wxD2D1InvertMatrix + +#include +#include +#include + +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +#include +#include +#include +#endif + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/graphics.h" +#include "wx/dc.h" +#include "wx/dcclient.h" +#include "wx/dcmemory.h" +#include "wx/dynlib.h" +#include "wx/image.h" +#include "wx/module.h" +#include "wx/msw/private/comptr.h" +#include "wx/private/graphics.h" +#include "wx/stack.h" +#include "wx/sharedptr.h" +#include "wx/window.h" + +// This must be the last header included to only affect the DEFINE_GUID() +// occurrences below but not any GUIDs declared in the standard files included +// above. +#include + +// Generic error message for a failed direct2d operation +#define wxFAILED_HRESULT_MSG(result) \ + wxString::Format("Direct2D failed with HRESULT %x", (result)) + +// Checks a HRESULT value for success, otherwise displays an error message and +// returns from the enclosing function. +#define wxCHECK_HRESULT_RET(result) \ + wxCHECK_RET(SUCCEEDED(result), wxFAILED_HRESULT_MSG(result)) + +#define wxCHECK2_HRESULT_RET(result, returnValue) \ + wxCHECK2_MSG(SUCCEEDED(result), return returnValue, \ + wxFAILED_HRESULT_MSG(result)) + +// Variation of wxCHECK_HRESULT_RET for functions which must return a pointer +#define wxCHECK_HRESULT_RET_PTR(result) wxCHECK2_HRESULT_RET(result, NULL) + +// Checks the precondition of wxManagedResourceHolder::AcquireResource, namely +// that it is bound to a manager. +#define wxCHECK_RESOURCE_HOLDER_PRE() \ + { \ + if (IsResourceAcquired()) return; \ + wxCHECK_RET(IsBound(), \ + "Cannot acquire a native resource without being bound to a manager"); \ + } + +// Checks the postcondition of wxManagedResourceHolder::AcquireResource, namely +// that it was successful in acquiring the native resource. +#define wxCHECK_RESOURCE_HOLDER_POST() \ + wxCHECK_RET(m_nativeResource != NULL, "Could not acquire native resource"); + + +// Helper class used to check for direct2d availability at runtime and to +// dynamically load the required symbols from d2d1.dll and dwrite.dll +class wxDirect2D +{ +public: + + enum wxD2DVersion + { + wxD2D_VERSION_1_0, + wxD2D_VERSION_1_1, + wxD2D_VERSION_NONE + }; + + static bool Initialize() + { + if (!m_initialized) + { + m_hasDirect2DSupport = LoadLibraries(); + m_initialized = true; + } + + return m_hasDirect2DSupport; + } + + static bool HasDirect2DSupport() + { + Initialize(); + + return m_hasDirect2DSupport; + } + + static wxD2DVersion GetDirect2DVersion() + { + return m_D2DRuntimeVersion; + } + +private: + static bool LoadLibraries() + { + if ( !m_dllDirect2d.Load(wxT("d2d1.dll"), wxDL_VERBATIM | wxDL_QUIET) ) + return false; + + if ( !m_dllDirectWrite.Load(wxT("dwrite.dll"), wxDL_VERBATIM | wxDL_QUIET) ) + return false; + + #define wxLOAD_FUNC(dll, name) \ + name = (name##_t)dll.RawGetSymbol(#name); \ + if ( !name ) \ + return false; + + wxLOAD_FUNC(m_dllDirect2d, D2D1CreateFactory); + wxLOAD_FUNC(m_dllDirect2d, D2D1MakeRotateMatrix); + wxLOAD_FUNC(m_dllDirect2d, D2D1InvertMatrix); + wxLOAD_FUNC(m_dllDirectWrite, DWriteCreateFactory); + + m_D2DRuntimeVersion = wxD2D_VERSION_1_0; + + return true; + } + +public: + typedef HRESULT (WINAPI *D2D1CreateFactory_t)(D2D1_FACTORY_TYPE, REFIID, CONST D2D1_FACTORY_OPTIONS*, void**); + static D2D1CreateFactory_t D2D1CreateFactory; + + typedef void (WINAPI *D2D1MakeRotateMatrix_t)(FLOAT, D2D1_POINT_2F, D2D1_MATRIX_3X2_F*); + static D2D1MakeRotateMatrix_t D2D1MakeRotateMatrix; + + typedef BOOL (WINAPI *D2D1InvertMatrix_t)(D2D1_MATRIX_3X2_F*); + static D2D1InvertMatrix_t D2D1InvertMatrix; + + typedef HRESULT (WINAPI *DWriteCreateFactory_t)(DWRITE_FACTORY_TYPE, REFIID, IUnknown**); + static DWriteCreateFactory_t DWriteCreateFactory; + +private: + static bool m_initialized; + static bool m_hasDirect2DSupport; + static wxD2DVersion m_D2DRuntimeVersion; + + static wxDynamicLibrary m_dllDirect2d; + static wxDynamicLibrary m_dllDirectWrite; +}; + +// define the members +bool wxDirect2D::m_initialized = false; +bool wxDirect2D::m_hasDirect2DSupport = false; +wxDirect2D::wxD2DVersion wxDirect2D::m_D2DRuntimeVersion = wxD2D_VERSION_NONE; + +wxDynamicLibrary wxDirect2D::m_dllDirect2d; +wxDynamicLibrary wxDirect2D::m_dllDirectWrite; + +// define the (not yet imported) functions +wxDirect2D::D2D1CreateFactory_t wxDirect2D::D2D1CreateFactory = NULL; +wxDirect2D::D2D1MakeRotateMatrix_t wxDirect2D::D2D1MakeRotateMatrix = NULL; +wxDirect2D::D2D1InvertMatrix_t wxDirect2D::D2D1InvertMatrix = NULL; +wxDirect2D::DWriteCreateFactory_t wxDirect2D::DWriteCreateFactory = NULL; + +// define the interface GUIDs +DEFINE_GUID(wxIID_IWICImagingFactory, + 0xec5ec8a9, 0xc395, 0x4314, 0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70); + +DEFINE_GUID(wxIID_IDWriteFactory, + 0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48); + +DEFINE_GUID(wxIID_IWICBitmapSource, + 0x00000120, 0xa8f2, 0x4877, 0xba, 0x0a, 0xfd, 0x2b, 0x66, 0x45, 0xfb, 0x94); + +// Implementation of the Direct2D functions +HRESULT WINAPI wxD2D1CreateFactory( + D2D1_FACTORY_TYPE factoryType, + REFIID riid, + CONST D2D1_FACTORY_OPTIONS *pFactoryOptions, + void **ppIFactory) +{ + if (!wxDirect2D::Initialize()) + return S_FALSE; + + return wxDirect2D::D2D1CreateFactory( + factoryType, + riid, + pFactoryOptions, + ppIFactory); +} + +void WINAPI wxD2D1MakeRotateMatrix( + FLOAT angle, + D2D1_POINT_2F center, + D2D1_MATRIX_3X2_F *matrix) +{ + if (!wxDirect2D::Initialize()) + return; + + wxDirect2D::D2D1MakeRotateMatrix(angle, center, matrix); +} + +BOOL WINAPI wxD2D1InvertMatrix( + D2D1_MATRIX_3X2_F *matrix) +{ + if (!wxDirect2D::Initialize()) + return FALSE; + + return wxDirect2D::D2D1InvertMatrix(matrix); +} + +static IWICImagingFactory* gs_WICImagingFactory = NULL; + +IWICImagingFactory* wxWICImagingFactory() +{ + if (gs_WICImagingFactory == NULL) { + HRESULT hr = CoCreateInstance( + CLSID_WICImagingFactory, + NULL, + CLSCTX_INPROC_SERVER, + wxIID_IWICImagingFactory, + (LPVOID*)&gs_WICImagingFactory); + wxCHECK_HRESULT_RET_PTR(hr); + } + return gs_WICImagingFactory; +} + +static IDWriteFactory* gs_IDWriteFactory = NULL; + +IDWriteFactory* wxDWriteFactory() +{ + if (!wxDirect2D::Initialize()) + return NULL; + + if (gs_IDWriteFactory == NULL) + { + wxDirect2D::DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + wxIID_IDWriteFactory, + reinterpret_cast(&gs_IDWriteFactory) + ); + } + return gs_IDWriteFactory; +} + +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsPen) wxNullGraphicsPen; +extern WXDLLIMPEXP_DATA_CORE(wxGraphicsBrush) wxNullGraphicsBrush; + +// We use the notion of a context supplier because the context +// needed to create Direct2D resources (namely the RenderTarget) +// is itself device-dependent and might change during the lifetime +// of the resources which were created from it. +template +class wxContextSupplier +{ +public: + typedef C ContextType; + + virtual C GetContext() = 0; +}; + +typedef wxContextSupplier wxD2DContextSupplier; + +// A resource holder manages a generic resource by acquiring +// and releasing it on demand. +class wxResourceHolder +{ +public: + // Acquires the managed resource if necessary (not already acquired) + virtual void AcquireResource() = 0; + + // Releases the managed resource + virtual void ReleaseResource() = 0; + + // Checks if the resources was previously acquired + virtual bool IsResourceAcquired() = 0; + + // Returns the managed resource or NULL if the resources + // was not previously acquired + virtual void* GetResource() = 0; + + virtual ~wxResourceHolder(){}; +}; + +class wxD2DResourceManager; + +class wxD2DManagedObject +{ +public: + virtual void Bind(wxD2DResourceManager* manager) = 0; + virtual void UnBind() = 0; + virtual bool IsBound() = 0; + virtual wxD2DResourceManager* GetManager() = 0; + + virtual ~wxD2DManagedObject() {}; +}; + +class wxManagedResourceHolder : public wxResourceHolder, public wxD2DManagedObject +{ +public: + virtual ~wxManagedResourceHolder() {}; +}; + +// A Direct2D resource manager handles the device-dependent +// resource holders attached to it by requesting them to +// release their resources when the API invalidates. +class wxD2DResourceManager: public wxD2DContextSupplier +{ +public: + typedef wxManagedResourceHolder* ElementType; + + // NOTE: We're using a list because we expect to have multiple + // insertions but very rarely a traversal (if ever). + typedef std::list ListType; + + void RegisterResourceHolder(ElementType resourceHolder) + { + m_resources.push_back(resourceHolder); + } + + void UnregisterResourceHolder(ElementType resourceHolder) + { + m_resources.remove(resourceHolder); + } + + void ReleaseResources() + { + ListType::iterator it; + for (it = m_resources.begin(); it != m_resources.end(); ++it) + { + (*it)->ReleaseResource(); + } + + // Check that all resources were released + for (it = m_resources.begin(); it != m_resources.end(); ++it) + { + wxCHECK_RET(!(*it)->IsResourceAcquired(), "One or more device-dependent resources failed to release"); + } + } + + virtual ~wxD2DResourceManager() + { + while (!m_resources.empty()) + { + m_resources.front()->ReleaseResource(); + m_resources.front()->UnBind(); + } + } + +private: + ListType m_resources; +}; + +// A Direct2D resource holder manages device dependent resources +// by storing any information necessary for acquiring the resource +// and releasing the resource when the API invalidates it. +template +class wxD2DResourceHolder: public wxManagedResourceHolder +{ +public: + wxD2DResourceHolder() : m_resourceManager(NULL) + { + } + + virtual ~wxD2DResourceHolder() + { + UnBind(); + ReleaseResource(); + } + + bool IsResourceAcquired() wxOVERRIDE + { + return m_nativeResource != NULL; + } + + void* GetResource() wxOVERRIDE + { + return GetD2DResource(); + } + + wxCOMPtr& GetD2DResource() + { + if (!IsResourceAcquired()) + { + AcquireResource(); + } + + return m_nativeResource; + } + + void AcquireResource() wxOVERRIDE + { + wxCHECK_RESOURCE_HOLDER_PRE(); + + DoAcquireResource(); + + wxCHECK_RESOURCE_HOLDER_POST(); + } + + void ReleaseResource() wxOVERRIDE + { + m_nativeResource.reset(); + } + + wxD2DContextSupplier::ContextType GetContext() + { + return m_resourceManager->GetContext(); + } + + void Bind(wxD2DResourceManager* manager) wxOVERRIDE + { + if (IsBound()) + return; + + m_resourceManager = manager; + m_resourceManager->RegisterResourceHolder(this); + } + + void UnBind() wxOVERRIDE + { + if (!IsBound()) + return; + + m_resourceManager->UnregisterResourceHolder(this); + m_resourceManager = NULL; + } + + bool IsBound() wxOVERRIDE + { + return m_resourceManager != NULL; + } + + wxD2DResourceManager* GetManager() wxOVERRIDE + { + return m_resourceManager; + } + +protected: + virtual void DoAcquireResource() = 0; + +private: + wxD2DResourceManager* m_resourceManager; + +protected: + wxCOMPtr m_nativeResource; +}; + +// Used as super class for graphics data objects +// to forward the bindings to their internal resource holder. +class wxD2DManagedGraphicsData : public wxD2DManagedObject +{ +public: + void Bind(wxD2DResourceManager* manager) wxOVERRIDE + { + GetManagedObject()->Bind(manager); + } + + void UnBind() wxOVERRIDE + { + GetManagedObject()->UnBind(); + } + + bool IsBound() wxOVERRIDE + { + return GetManagedObject()->IsBound(); + } + + wxD2DResourceManager* GetManager() wxOVERRIDE + { + return GetManagedObject()->GetManager(); + } + + virtual wxD2DManagedObject* GetManagedObject() = 0; + + ~wxD2DManagedGraphicsData() {}; +}; + +D2D1_CAP_STYLE wxD2DConvertPenCap(wxPenCap cap) +{ + switch (cap) + { + case wxCAP_ROUND: + return D2D1_CAP_STYLE_ROUND; + case wxCAP_PROJECTING: + return D2D1_CAP_STYLE_SQUARE; + case wxCAP_BUTT: + return D2D1_CAP_STYLE_FLAT; + case wxCAP_INVALID: + return D2D1_CAP_STYLE_FLAT; + } + + wxFAIL_MSG("unknown pen cap"); + return D2D1_CAP_STYLE_FLAT; +} + +D2D1_LINE_JOIN wxD2DConvertPenJoin(wxPenJoin join) +{ + switch (join) + { + case wxJOIN_BEVEL: + return D2D1_LINE_JOIN_BEVEL; + case wxJOIN_MITER: + return D2D1_LINE_JOIN_MITER; + case wxJOIN_ROUND: + return D2D1_LINE_JOIN_ROUND; + case wxJOIN_INVALID: + return D2D1_LINE_JOIN_MITER; + } + + wxFAIL_MSG("unknown pen join"); + return D2D1_LINE_JOIN_MITER; +} + +D2D1_DASH_STYLE wxD2DConvertPenStyle(wxPenStyle dashStyle) +{ + switch (dashStyle) + { + case wxPENSTYLE_SOLID: + return D2D1_DASH_STYLE_SOLID; + case wxPENSTYLE_DOT: + return D2D1_DASH_STYLE_DOT; + case wxPENSTYLE_LONG_DASH: + return D2D1_DASH_STYLE_DASH; + case wxPENSTYLE_SHORT_DASH: + return D2D1_DASH_STYLE_DASH; + case wxPENSTYLE_DOT_DASH: + return D2D1_DASH_STYLE_DASH_DOT; + case wxPENSTYLE_USER_DASH: + return D2D1_DASH_STYLE_CUSTOM; + + // NB: These styles cannot be converted to a D2D1_DASH_STYLE + // and must be handled separately. + case wxPENSTYLE_TRANSPARENT: + wxFALLTHROUGH; + case wxPENSTYLE_INVALID: + wxFALLTHROUGH; + case wxPENSTYLE_STIPPLE_MASK_OPAQUE: + wxFALLTHROUGH; + case wxPENSTYLE_STIPPLE_MASK: + wxFALLTHROUGH; + case wxPENSTYLE_STIPPLE: + wxFALLTHROUGH; + case wxPENSTYLE_BDIAGONAL_HATCH: + wxFALLTHROUGH; + case wxPENSTYLE_CROSSDIAG_HATCH: + wxFALLTHROUGH; + case wxPENSTYLE_FDIAGONAL_HATCH: + wxFALLTHROUGH; + case wxPENSTYLE_CROSS_HATCH: + wxFALLTHROUGH; + case wxPENSTYLE_HORIZONTAL_HATCH: + wxFALLTHROUGH; + case wxPENSTYLE_VERTICAL_HATCH: + return D2D1_DASH_STYLE_SOLID; + } + + wxFAIL_MSG("unknown pen style"); + return D2D1_DASH_STYLE_SOLID; +} + +D2D1_COLOR_F wxD2DConvertColour(wxColour colour) +{ + return D2D1::ColorF( + colour.Red() / 255.0f, + colour.Green() / 255.0f, + colour.Blue() / 255.0f, + colour.Alpha() / 255.0f); +} + +D2D1_ANTIALIAS_MODE wxD2DConvertAntialiasMode(wxAntialiasMode antialiasMode) +{ + switch (antialiasMode) + { + case wxANTIALIAS_NONE: + return D2D1_ANTIALIAS_MODE_ALIASED; + case wxANTIALIAS_DEFAULT: + return D2D1_ANTIALIAS_MODE_PER_PRIMITIVE; + } + + wxFAIL_MSG("unknown antialias mode"); + return D2D1_ANTIALIAS_MODE_ALIASED; +} + +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +bool wxD2DCompositionModeSupported(wxCompositionMode compositionMode) +{ + if (compositionMode == wxCOMPOSITION_CLEAR || compositionMode == wxCOMPOSITION_INVALID) + { + return false; + } + + return true; +} + +D2D1_COMPOSITE_MODE wxD2DConvertCompositionMode(wxCompositionMode compositionMode) +{ + switch (compositionMode) + { + case wxCOMPOSITION_SOURCE: + return D2D1_COMPOSITE_MODE_SOURCE_COPY; + case wxCOMPOSITION_OVER: + return D2D1_COMPOSITE_MODE_SOURCE_OVER; + case wxCOMPOSITION_IN: + return D2D1_COMPOSITE_MODE_SOURCE_IN; + case wxCOMPOSITION_OUT: + return D2D1_COMPOSITE_MODE_SOURCE_OUT; + case wxCOMPOSITION_ATOP: + return D2D1_COMPOSITE_MODE_SOURCE_ATOP; + case wxCOMPOSITION_DEST_OVER: + return D2D1_COMPOSITE_MODE_DESTINATION_OVER; + case wxCOMPOSITION_DEST_IN: + return D2D1_COMPOSITE_MODE_DESTINATION_IN; + case wxCOMPOSITION_DEST_OUT: + return D2D1_COMPOSITE_MODE_DESTINATION_OUT; + case wxCOMPOSITION_DEST_ATOP: + return D2D1_COMPOSITE_MODE_DESTINATION_ATOP; + case wxCOMPOSITION_XOR: + return D2D1_COMPOSITE_MODE_XOR; + case wxCOMPOSITION_ADD: + return D2D1_COMPOSITE_MODE_PLUS; + + // unsupported composition modes + case wxCOMPOSITION_DEST: + wxFALLTHROUGH; + case wxCOMPOSITION_CLEAR: + wxFALLTHROUGH; + case wxCOMPOSITION_INVALID: + return D2D1_COMPOSITE_MODE_SOURCE_COPY; + } + + wxFAIL_MSG("unknown composition mode"); + return D2D1_COMPOSITE_MODE_SOURCE_COPY; +} +#endif // wxD2D_DEVICE_CONTEXT_SUPPORTED + +// Direct2D 1.1 introduces a new enum for specifying the interpolation quality +// which is only used with the ID2D1DeviceContext::DrawImage method. +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +D2D1_INTERPOLATION_MODE wxD2DConvertInterpolationMode(wxInterpolationQuality interpolationQuality) +{ + switch (interpolationQuality) + { + case wxINTERPOLATION_DEFAULT: + wxFALLTHROUGH; + case wxINTERPOLATION_NONE: + wxFALLTHROUGH; + case wxINTERPOLATION_FAST: + return D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR; + case wxINTERPOLATION_GOOD: + return D2D1_INTERPOLATION_MODE_LINEAR; + case wxINTERPOLATION_BEST: + return D2D1_INTERPOLATION_MODE_CUBIC; + } + + wxFAIL_MSG("unknown interpolation quality"); + return D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR; +} +#endif // wxD2D_DEVICE_CONTEXT_SUPPORTED + +D2D1_BITMAP_INTERPOLATION_MODE wxD2DConvertBitmapInterpolationMode(wxInterpolationQuality interpolationQuality) +{ + switch (interpolationQuality) + { + case wxINTERPOLATION_DEFAULT: + wxFALLTHROUGH; + case wxINTERPOLATION_NONE: + wxFALLTHROUGH; + case wxINTERPOLATION_FAST: + wxFALLTHROUGH; + case wxINTERPOLATION_GOOD: + return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR; + case wxINTERPOLATION_BEST: + return D2D1_BITMAP_INTERPOLATION_MODE_LINEAR; + } + + wxFAIL_MSG("unknown interpolation quality"); + return D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR; +} + +D2D1_RECT_F wxD2DConvertRect(const wxRect& rect) +{ + return D2D1::RectF(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); +} + +wxCOMPtr wxD2DConvertRegionToGeometry(ID2D1Factory* direct2dFactory, const wxRegion& region) +{ + wxRegionIterator regionIterator(region); + + // Count the number of rectangles which compose the region + int rectCount = 0; + while(regionIterator++) + rectCount++; + + // Build the array of geometries + ID2D1Geometry** geometries = new ID2D1Geometry*[rectCount]; + regionIterator.Reset(region); + + int i = 0; + while(regionIterator) + { + geometries[i] = NULL; + + wxRect rect = regionIterator.GetRect(); + rect.SetWidth(rect.GetWidth() + 1); + rect.SetHeight(rect.GetHeight() + 1); + + direct2dFactory->CreateRectangleGeometry( + wxD2DConvertRect(rect), + (ID2D1RectangleGeometry**)(&geometries[i])); + + i++; regionIterator++; + } + + // Create a geometry group to hold all the rectangles + wxCOMPtr resultGeometry; + direct2dFactory->CreateGeometryGroup( + D2D1_FILL_MODE_WINDING, + geometries, + rectCount, + &resultGeometry); + + // Cleanup temporaries + for (i = 0; i < rectCount; ++i) + { + geometries[i]->Release(); + } + + delete[] geometries; + + return wxCOMPtr(resultGeometry); +} + +class wxD2DOffsetHelper +{ +public: + wxD2DOffsetHelper(wxGraphicsContext* g) : m_context(g) + { + if (m_context->ShouldOffset()) + { + m_context->Translate(0.5, 0.5); + } + } + + ~wxD2DOffsetHelper() + { + if (m_context->ShouldOffset()) + { + m_context->Translate(-0.5, -0.5); + } + } + +private: + wxGraphicsContext* m_context; +}; + +bool operator==(const D2D1::Matrix3x2F& lhs, const D2D1::Matrix3x2F& rhs) +{ + return + lhs._11 == rhs._11 && lhs._12 == rhs._12 && + lhs._21 == rhs._21 && lhs._22 == rhs._22 && + lhs._31 == rhs._31 && lhs._32 == rhs._32; +} + +//----------------------------------------------------------------------------- +// wxD2DMatrixData declaration +//----------------------------------------------------------------------------- + +class wxD2DMatrixData : public wxGraphicsMatrixData +{ +public: + wxD2DMatrixData(wxGraphicsRenderer* renderer); + wxD2DMatrixData(wxGraphicsRenderer* renderer, const D2D1::Matrix3x2F& matrix); + + void Concat(const wxGraphicsMatrixData* t) wxOVERRIDE; + + void Set(wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0, wxDouble d = 1.0, + wxDouble tx = 0.0, wxDouble ty = 0.0) wxOVERRIDE; + + void Get(wxDouble* a = NULL, wxDouble* b = NULL, wxDouble* c = NULL, + wxDouble* d = NULL, wxDouble* tx = NULL, wxDouble* ty = NULL) const wxOVERRIDE; + + void Invert() wxOVERRIDE; + + bool IsEqual(const wxGraphicsMatrixData* t) const wxOVERRIDE; + + bool IsIdentity() const wxOVERRIDE; + + void Translate(wxDouble dx, wxDouble dy) wxOVERRIDE; + + void Scale(wxDouble xScale, wxDouble yScale) wxOVERRIDE; + + void Rotate(wxDouble angle) wxOVERRIDE; + + void TransformPoint(wxDouble* x, wxDouble* y) const wxOVERRIDE; + + void TransformDistance(wxDouble* dx, wxDouble* dy) const wxOVERRIDE; + + void* GetNativeMatrix() const wxOVERRIDE; + + D2D1::Matrix3x2F GetMatrix3x2F() const; + +private: + D2D1::Matrix3x2F m_matrix; +}; + +//----------------------------------------------------------------------------- +// wxD2DMatrixData implementation +//----------------------------------------------------------------------------- + +wxD2DMatrixData::wxD2DMatrixData(wxGraphicsRenderer* renderer) : wxGraphicsMatrixData(renderer) +{ + m_matrix = D2D1::Matrix3x2F::Identity(); +} + +wxD2DMatrixData::wxD2DMatrixData(wxGraphicsRenderer* renderer, const D2D1::Matrix3x2F& matrix) : + wxGraphicsMatrixData(renderer), m_matrix(matrix) +{ +} + +void wxD2DMatrixData::Concat(const wxGraphicsMatrixData* t) +{ + m_matrix.SetProduct(m_matrix, static_cast(t)->m_matrix); +} + +void wxD2DMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, wxDouble tx, wxDouble ty) +{ + m_matrix._11 = a; + m_matrix._12 = b; + m_matrix._21 = c; + m_matrix._22 = d; + m_matrix._31 = tx; + m_matrix._32 = ty; +} + +void wxD2DMatrixData::Get(wxDouble* a, wxDouble* b, wxDouble* c, wxDouble* d, wxDouble* tx, wxDouble* ty) const +{ + *a = m_matrix._11; + *b = m_matrix._12; + *c = m_matrix._21; + *d = m_matrix._22; + *tx = m_matrix._31; + *ty = m_matrix._32; +} + +void wxD2DMatrixData::Invert() +{ + m_matrix.Invert(); +} + +bool wxD2DMatrixData::IsEqual(const wxGraphicsMatrixData* t) const +{ + return m_matrix == static_cast(t)->m_matrix; +} + +bool wxD2DMatrixData::IsIdentity() const +{ + return m_matrix.IsIdentity(); +} + +void wxD2DMatrixData::Translate(wxDouble dx, wxDouble dy) +{ + m_matrix = D2D1::Matrix3x2F::Translation(dx, dy) * m_matrix; +} + +void wxD2DMatrixData::Scale(wxDouble xScale, wxDouble yScale) +{ + m_matrix = D2D1::Matrix3x2F::Scale(xScale, yScale) * m_matrix; +} + +void wxD2DMatrixData::Rotate(wxDouble angle) +{ + m_matrix = D2D1::Matrix3x2F::Rotation(wxRadToDeg(angle)) * m_matrix; +} + +void wxD2DMatrixData::TransformPoint(wxDouble* x, wxDouble* y) const +{ + D2D1_POINT_2F result = m_matrix.TransformPoint(D2D1::Point2F(*x, *y)); + *x = result.x; + *y = result.y; +} + +void wxD2DMatrixData::TransformDistance(wxDouble* dx, wxDouble* dy) const +{ + D2D1::Matrix3x2F noTranslationMatrix = m_matrix; + noTranslationMatrix._31 = 0; + noTranslationMatrix._32 = 0; + D2D1_POINT_2F result = m_matrix.TransformPoint(D2D1::Point2F(*dx, *dy)); + *dx = result.x; + *dy = result.y; +} + +void* wxD2DMatrixData::GetNativeMatrix() const +{ + return (void*)&m_matrix; +} + +D2D1::Matrix3x2F wxD2DMatrixData::GetMatrix3x2F() const +{ + return m_matrix; +} + +const wxD2DMatrixData* wxGetD2DMatrixData(const wxGraphicsMatrix& matrix) +{ + return static_cast(matrix.GetMatrixData()); +} + +//----------------------------------------------------------------------------- +// wxD2DPathData declaration +//----------------------------------------------------------------------------- + +class wxD2DPathData : public wxGraphicsPathData +{ +public : + + // ID2D1PathGeometry objects are device-independent resources created + // from a ID2D1Factory. This means we can safely create the resource outside + // (the wxD2DRenderer handles this) and store it here since it never gets + // thrown away by the GPU. + wxD2DPathData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFactory); + + ~wxD2DPathData(); + + ID2D1PathGeometry* GetPathGeometry(); + + // This closes the geometry sink, ensuring all the figures are stored inside + // the ID2D1PathGeometry. Calling this method is required before any draw operation + // involving a path. + void Flush(); + + wxGraphicsObjectRefData* Clone() const wxOVERRIDE; + + // begins a new subpath at (x,y) + void MoveToPoint(wxDouble x, wxDouble y) wxOVERRIDE; + + // adds a straight line from the current point to (x,y) + void AddLineToPoint(wxDouble x, wxDouble y) wxOVERRIDE; + + // adds a cubic Bezier curve from the current point, using two control points and an end point + void AddCurveToPoint(wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y) wxOVERRIDE; + + // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle + void AddArc(wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise) wxOVERRIDE; + + // gets the last point of the current path, (0,0) if not yet set + void GetCurrentPoint(wxDouble* x, wxDouble* y) const wxOVERRIDE; + + // adds another path + void AddPath(const wxGraphicsPathData* path) wxOVERRIDE; + + // closes the current sub-path + void CloseSubpath() wxOVERRIDE; + + // returns the native path + void* GetNativePath() const wxOVERRIDE; + + // give the native path returned by GetNativePath() back (there might be some deallocations necessary) + void UnGetNativePath(void* WXUNUSED(p)) const wxOVERRIDE {}; + + // transforms each point of this path by the matrix + void Transform(const wxGraphicsMatrixData* matrix) wxOVERRIDE; + + // gets the bounding box enclosing all points (possibly including control points) + void GetBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble *h) const wxOVERRIDE; + + bool Contains(wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const wxOVERRIDE; + + // appends an ellipsis as a new closed subpath fitting the passed rectangle + void AddCircle(wxDouble x, wxDouble y, wxDouble r) wxOVERRIDE; + + // appends an ellipse + void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + +private: + void EnsureGeometryOpen(); + + void EnsureSinkOpen(); + + void EnsureFigureOpen(wxDouble x = 0, wxDouble y = 0); + +private : + wxCOMPtr m_pathGeometry; + + wxCOMPtr m_geometrySink; + + wxCOMPtr m_direct2dfactory; + + mutable wxCOMPtr m_transformedGeometry; + + D2D1_POINT_2F m_currentPoint; + + D2D1_MATRIX_3X2_F m_transformMatrix; + + bool m_figureOpened; + + bool m_geometryWritable; +}; + +//----------------------------------------------------------------------------- +// wxD2DPathData implementation +//----------------------------------------------------------------------------- + +wxD2DPathData::wxD2DPathData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFactory) : + wxGraphicsPathData(renderer), m_direct2dfactory(d2dFactory), + m_currentPoint(D2D1::Point2F(0.0f, 0.0f)), + m_transformMatrix(D2D1::Matrix3x2F::Identity()), + m_figureOpened(false), m_geometryWritable(true) +{ + m_direct2dfactory->CreatePathGeometry(&m_pathGeometry); + // To properly initialize path geometry there is also + // necessary to open at least once its geometry sink. + m_pathGeometry->Open(&m_geometrySink); +} + +wxD2DPathData::~wxD2DPathData() +{ + Flush(); +} + +ID2D1PathGeometry* wxD2DPathData::GetPathGeometry() +{ + return m_pathGeometry; +} + +wxD2DPathData::wxGraphicsObjectRefData* wxD2DPathData::Clone() const +{ + wxD2DPathData* newPathData = new wxD2DPathData(GetRenderer(), m_direct2dfactory); + + newPathData->EnsureGeometryOpen(); + m_pathGeometry->Stream(newPathData->m_geometrySink); + + return newPathData; +} + +void wxD2DPathData::Flush() +{ + if (m_geometrySink != NULL) + { + if (m_figureOpened) + { + m_geometrySink->EndFigure(D2D1_FIGURE_END_OPEN); + } + + m_figureOpened = false; + m_geometrySink->Close(); + + m_geometryWritable = false; + } +} + +void wxD2DPathData::EnsureGeometryOpen() +{ + if (!m_geometryWritable) { + wxCOMPtr newPathGeometry; + m_direct2dfactory->CreatePathGeometry(&newPathGeometry); + + m_geometrySink.reset(); + newPathGeometry->Open(&m_geometrySink); + + if (m_pathGeometry != NULL) + { + m_pathGeometry->Stream(m_geometrySink); + } + + m_pathGeometry = newPathGeometry; + m_geometryWritable = true; + } +} + +void wxD2DPathData::EnsureSinkOpen() +{ + EnsureGeometryOpen(); + + if (m_geometrySink == NULL) + { + m_geometrySink = NULL; + m_pathGeometry->Open(&m_geometrySink); + } +} + +void wxD2DPathData::EnsureFigureOpen(wxDouble x, wxDouble y) +{ + EnsureSinkOpen(); + + if (!m_figureOpened) + { + m_geometrySink->BeginFigure(D2D1::Point2F(x, y), D2D1_FIGURE_BEGIN_FILLED); + m_figureOpened = true; + m_currentPoint = D2D1::Point2F(x, y); + } +} + +void wxD2DPathData::MoveToPoint(wxDouble x, wxDouble y) +{ + if (m_figureOpened) + { + CloseSubpath(); + } + + EnsureFigureOpen(x, y); + + m_currentPoint = D2D1::Point2F(x, y); +} + +// adds a straight line from the current point to (x,y) +void wxD2DPathData::AddLineToPoint(wxDouble x, wxDouble y) +{ + EnsureFigureOpen(); + m_geometrySink->AddLine(D2D1::Point2F(x, y)); + + m_currentPoint = D2D1::Point2F(x, y); +} + +// adds a cubic Bezier curve from the current point, using two control points and an end point +void wxD2DPathData::AddCurveToPoint(wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y) +{ + EnsureFigureOpen(); + D2D1_BEZIER_SEGMENT bezierSegment = { + { (FLOAT)cx1, (FLOAT)cy1 }, + { (FLOAT)cx2, (FLOAT)cy2 }, + { (FLOAT)x, (FLOAT)y } }; + m_geometrySink->AddBezier(bezierSegment); + + m_currentPoint = D2D1::Point2F(x, y); +} + +// adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle +void wxD2DPathData::AddArc(wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise) +{ + wxPoint2DDouble center = wxPoint2DDouble(x, y); + wxPoint2DDouble start = wxPoint2DDouble(std::cos(startAngle) * r, std::sin(startAngle) * r); + wxPoint2DDouble end = wxPoint2DDouble(std::cos(endAngle) * r, std::sin(endAngle) * r); + + if (m_figureOpened) + { + AddLineToPoint(start.m_x + x, start.m_y + y); + } + else + { + MoveToPoint(start.m_x + x, start.m_y + y); + } + + double angle = (end.GetVectorAngle() - start.GetVectorAngle()); + + if (!clockwise) + { + angle = 360 - angle; + } + + while (abs(angle) > 360) + { + angle -= (angle / abs(angle)) * 360; + } + + if (angle == 360) + { + AddCircle(center.m_x, center.m_y, start.GetVectorLength()); + return; + } + + D2D1_SWEEP_DIRECTION sweepDirection = clockwise ? D2D1_SWEEP_DIRECTION_CLOCKWISE : D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE; + + D2D1_ARC_SIZE arcSize = angle > 180 ? D2D1_ARC_SIZE_LARGE : D2D1_ARC_SIZE_SMALL; + + D2D1_ARC_SEGMENT arcSegment = { + { (FLOAT)(end.m_x + x), (FLOAT)(end.m_y + y) }, // end point + { (FLOAT)r, (FLOAT) r }, // size + 0, // rotation + sweepDirection, // sweep direction + arcSize // arc size + }; + + m_geometrySink->AddArc(arcSegment); + + m_currentPoint = D2D1::Point2F(end.m_x + x, end.m_y + y); +} + +// appends an ellipsis as a new closed subpath fitting the passed rectangle +void wxD2DPathData::AddCircle(wxDouble x, wxDouble y, wxDouble r) +{ + AddEllipse(x - r, y - r, r * 2, r * 2); +} + +// appends an ellipse +void wxD2DPathData::AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + if ( w <= 0.0 || h <= 0.0 ) + return; + + // Calculate radii + const wxDouble rx = w / 2.0; + const wxDouble ry = h / 2.0; + + MoveToPoint(x, y + ry); + + D2D1_ARC_SEGMENT arcSegmentUpper = + { + D2D1::Point2((FLOAT)(x + w), (FLOAT)(y + ry)), // end point + D2D1::SizeF((FLOAT)(rx), (FLOAT)(ry)), // size + 0.0f, + D2D1_SWEEP_DIRECTION_CLOCKWISE, + D2D1_ARC_SIZE_SMALL + }; + m_geometrySink->AddArc(arcSegmentUpper); + + D2D1_ARC_SEGMENT arcSegmentLower = + { + D2D1::Point2((FLOAT)(x), (FLOAT)(y + ry)), // end point + D2D1::SizeF((FLOAT)(rx), (FLOAT)(ry)), // size + 0.0f, + D2D1_SWEEP_DIRECTION_CLOCKWISE, + D2D1_ARC_SIZE_SMALL + }; + m_geometrySink->AddArc(arcSegmentLower); +} + +// gets the last point of the current path, (0,0) if not yet set +void wxD2DPathData::GetCurrentPoint(wxDouble* x, wxDouble* y) const +{ + D2D1_POINT_2F transformedPoint = D2D1::Matrix3x2F::ReinterpretBaseType(&m_transformMatrix)->TransformPoint(m_currentPoint); + + if (x != NULL) *x = transformedPoint.x; + if (y != NULL) *y = transformedPoint.y; +} + +// adds another path +void wxD2DPathData::AddPath(const wxGraphicsPathData* path) +{ + const wxD2DPathData* d2dPath = static_cast(path); + + EnsureFigureOpen(); + + d2dPath->m_pathGeometry->Stream(m_geometrySink); +} + +// closes the current sub-path +void wxD2DPathData::CloseSubpath() +{ + if (m_figureOpened) + { + m_geometrySink->EndFigure(D2D1_FIGURE_END_CLOSED); + m_figureOpened = false; + } +} + +void* wxD2DPathData::GetNativePath() const +{ + m_transformedGeometry.reset(); + m_direct2dfactory->CreateTransformedGeometry(m_pathGeometry, m_transformMatrix, &m_transformedGeometry); + return m_transformedGeometry; +} + +void wxD2DPathData::Transform(const wxGraphicsMatrixData* matrix) +{ + m_transformMatrix = *((D2D1_MATRIX_3X2_F*)(matrix->GetNativeMatrix())); +} + +void wxD2DPathData::GetBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble *h) const +{ + D2D1_RECT_F bounds; + m_pathGeometry->GetBounds(D2D1::Matrix3x2F::Identity(), &bounds); + if (x != NULL) *x = bounds.left; + if (y != NULL) *y = bounds.top; + if (w != NULL) *w = bounds.right - bounds.left; + if (h != NULL) *h = bounds.bottom - bounds.top; +} + +bool wxD2DPathData::Contains(wxDouble x, wxDouble y, wxPolygonFillMode WXUNUSED(fillStyle)) const +{ + BOOL result; + m_pathGeometry->FillContainsPoint(D2D1::Point2F(x, y), D2D1::Matrix3x2F::Identity(), &result); + return result != 0; +} + +wxD2DPathData* wxGetD2DPathData(const wxGraphicsPath& path) +{ + return static_cast(path.GetGraphicsData()); +} + +// This utility class is used to read a color value with the format +// PBGRA from a byte stream and to write a color back to the stream. +// It's used in conjunction with the IWICBitmapSource or IWICBitmap +// pixel data to easily read and write color values. +struct wxPBGRAColor +{ + wxPBGRAColor(BYTE* stream) : + b(*stream), g(*(stream + 1)), r(*(stream + 2)), a(*(stream + 3)) + {} + + wxPBGRAColor(const wxColor& color) : + b(color.Blue()), g(color.Green()), r(color.Red()), a(color.Alpha()) + {} + + bool IsBlack() const { return r == 0 && g == 0 && b == 0; } + + void Write(BYTE* stream) const + { + *(stream + 0) = b; + *(stream + 1) = g; + *(stream + 2) = r; + *(stream + 3) = a; + } + + BYTE b, g, r, a; +}; + +wxCOMPtr wxCreateWICBitmap(const WXHBITMAP sourceBitmap, bool hasAlpha = false) +{ + HRESULT hr; + + wxCOMPtr wicBitmap; + hr = wxWICImagingFactory()->CreateBitmapFromHBITMAP(sourceBitmap, NULL, WICBitmapUseAlpha, &wicBitmap); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + + wxCOMPtr converter; + hr = wxWICImagingFactory()->CreateFormatConverter(&converter); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + + WICPixelFormatGUID pixelFormat = hasAlpha ? GUID_WICPixelFormat32bppPBGRA : GUID_WICPixelFormat32bppBGR; + + hr = converter->Initialize( + wicBitmap, + pixelFormat, + WICBitmapDitherTypeNone, NULL, 0.f, + WICBitmapPaletteTypeMedianCut); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + + return wxCOMPtr(converter); +} + +wxCOMPtr wxCreateWICBitmap(const wxBitmap& sourceBitmap, bool hasAlpha = false) +{ + return wxCreateWICBitmap(sourceBitmap.GetHBITMAP(), hasAlpha); +} + +// WIC Bitmap Source for creating hatch patterned bitmaps +class wxHatchBitmapSource : public IWICBitmapSource +{ +public: + wxHatchBitmapSource(wxBrushStyle brushStyle, const wxColor& color) : + m_brushStyle(brushStyle), m_color(color), m_refCount(0l) + { + } + + virtual ~wxHatchBitmapSource() {} + + HRESULT STDMETHODCALLTYPE GetSize(__RPC__out UINT *width, __RPC__out UINT *height) wxOVERRIDE + { + if (width != NULL) *width = 8; + if (height != NULL) *height = 8; + return S_OK; + } + + HRESULT STDMETHODCALLTYPE GetPixelFormat(__RPC__out WICPixelFormatGUID *pixelFormat) wxOVERRIDE + { + if (pixelFormat != NULL) *pixelFormat = GUID_WICPixelFormat32bppPBGRA; + return S_OK; + } + + HRESULT STDMETHODCALLTYPE GetResolution(__RPC__out double *dpiX, __RPC__out double *dpiY) wxOVERRIDE + { + if (dpiX != NULL) *dpiX = 96.0; + if (dpiY != NULL) *dpiY = 96.0; + return S_OK; + } + + HRESULT STDMETHODCALLTYPE CopyPalette(__RPC__in_opt IWICPalette* WXUNUSED(palette)) wxOVERRIDE + { + return WINCODEC_ERR_PALETTEUNAVAILABLE; + } + + HRESULT STDMETHODCALLTYPE CopyPixels( + const WICRect* WXUNUSED(prc), + UINT WXUNUSED(stride), + UINT WXUNUSED(bufferSize), + BYTE *buffer) wxOVERRIDE + { + // patterns are encoded in a bit map of size 8 x 8 + static const unsigned char BDIAGONAL_PATTERN[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; + static const unsigned char FDIAGONAL_PATTERN[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; + static const unsigned char CROSSDIAG_PATTERN[8] = { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 }; + static const unsigned char CROSS_PATTERN[8] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF }; + static const unsigned char HORIZONTAL_PATTERN[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF }; + static const unsigned char VERTICAL_PATTERN[8] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; + + switch (m_brushStyle) + { + case wxBRUSHSTYLE_BDIAGONAL_HATCH: + CopyPattern(buffer, BDIAGONAL_PATTERN); + break; + case wxBRUSHSTYLE_CROSSDIAG_HATCH: + CopyPattern(buffer, CROSSDIAG_PATTERN); + break; + case wxBRUSHSTYLE_FDIAGONAL_HATCH: + CopyPattern(buffer, FDIAGONAL_PATTERN); + break; + case wxBRUSHSTYLE_CROSS_HATCH: + CopyPattern(buffer, CROSS_PATTERN); + break; + case wxBRUSHSTYLE_HORIZONTAL_HATCH: + CopyPattern(buffer, HORIZONTAL_PATTERN); + break; + case wxBRUSHSTYLE_VERTICAL_HATCH: + CopyPattern(buffer, VERTICAL_PATTERN); + break; + default: + break; + } + + return S_OK; + } + + // Implementations adapted from: "Implementing IUnknown in C++" + // http://msdn.microsoft.com/en-us/library/office/cc839627%28v=office.15%29.aspx + + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID referenceId, void** object) wxOVERRIDE + { + if (!object) + { + return E_INVALIDARG; + } + + *object = NULL; + + if (referenceId == IID_IUnknown || referenceId == wxIID_IWICBitmapSource) + { + *object = (LPVOID)this; + AddRef(); + return NOERROR; + } + + return E_NOINTERFACE; + } + + ULONG STDMETHODCALLTYPE AddRef(void) wxOVERRIDE + { + InterlockedIncrement(&m_refCount); + return m_refCount; + } + + ULONG STDMETHODCALLTYPE Release(void) wxOVERRIDE + { + wxCHECK_MSG(m_refCount > 0, 0, "Unbalanced number of calls to Release"); + + ULONG refCount = InterlockedDecrement(&m_refCount); + if (m_refCount == 0) + { + delete this; + } + return refCount; + } + +private: + + // Copies an 8x8 bit pattern to a PBGRA byte buffer + void CopyPattern(BYTE* buffer, const unsigned char* pattern) const + { + static const wxPBGRAColor transparent(wxTransparentColour); + + int k = 0; + + for (int i = 0; i < 8; ++i) + { + for (int j = 7; j >= 0; --j) + { + bool isColorBit = (pattern[i] & (1 << j)) > 0; + (isColorBit ? m_color : transparent).Write(buffer + k); + k += 4; + } + } + } + +private: + // The hatch style produced by this bitmap source + const wxBrushStyle m_brushStyle; + + // The colour of the hatch + const wxPBGRAColor m_color; + + // Internally used to implement IUnknown's reference counting + ULONG m_refCount; +}; + +// RAII class hosting a WIC bitmap lock used for writing +// pixel data to a WICBitmap +class wxBitmapPixelWriteLock +{ +public: + wxBitmapPixelWriteLock(IWICBitmap* bitmap) + { + // Retrieve the size of the bitmap + UINT w, h; + bitmap->GetSize(&w, &h); + WICRect lockSize = {0, 0, (INT)w, (INT)h}; + + // Obtain a bitmap lock for exclusive write + bitmap->Lock(&lockSize, WICBitmapLockWrite, &m_pixelLock); + } + + IWICBitmapLock* GetLock() { return m_pixelLock; } + +private: + wxCOMPtr m_pixelLock; +}; + +class wxD2DBitmapResourceHolder : public wxD2DResourceHolder +{ +public: + wxD2DBitmapResourceHolder(const wxBitmap& sourceBitmap) : + m_sourceBitmap(sourceBitmap) + { + } + + const wxBitmap& GetSourceBitmap() const { return m_sourceBitmap; } + +protected: + void DoAcquireResource() wxOVERRIDE + { + ID2D1RenderTarget* renderTarget = GetContext(); + + HRESULT hr; + + if(m_sourceBitmap.GetMask()) + { + int w = m_sourceBitmap.GetWidth(); + int h = m_sourceBitmap.GetHeight(); + + wxCOMPtr colorBitmap = wxCreateWICBitmap(m_sourceBitmap); + wxCOMPtr maskBitmap = wxCreateWICBitmap(m_sourceBitmap.GetMask()->GetMaskBitmap()); + wxCOMPtr resultBitmap; + + wxWICImagingFactory()->CreateBitmap( + w, h, + GUID_WICPixelFormat32bppPBGRA, + WICBitmapCacheOnLoad, + &resultBitmap); + + BYTE* colorBuffer = new BYTE[4 * w * h]; + BYTE* maskBuffer = new BYTE[4 * w * h]; + BYTE* resultBuffer; + + hr = colorBitmap->CopyPixels(NULL, w * 4, 4 * w * h, colorBuffer); + hr = maskBitmap->CopyPixels(NULL, w * 4, 4 * w * h, maskBuffer); + + { + wxBitmapPixelWriteLock lock(resultBitmap); + + UINT bufferSize = 0; + hr = lock.GetLock()->GetDataPointer(&bufferSize, &resultBuffer); + + static const wxPBGRAColor transparentColor(wxTransparentColour); + + // Create the result bitmap + for (int i = 0; i < w * h * 4; i += 4) + { + wxPBGRAColor color(colorBuffer + i); + wxPBGRAColor mask(maskBuffer + i); + + if (mask.IsBlack()) + { + transparentColor.Write(resultBuffer + i); + } + else + { + color.a = 255; + color.Write(resultBuffer + i); + } + } + } + + hr = renderTarget->CreateBitmapFromWicBitmap(resultBitmap, 0, &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + + delete[] colorBuffer; + delete[] maskBuffer; + } + else + { + wxCOMPtr bitmapSource = wxCreateWICBitmap(m_sourceBitmap, m_sourceBitmap.HasAlpha()); + hr = renderTarget->CreateBitmapFromWicBitmap(bitmapSource, 0, &m_nativeResource); + } + } + +private: + const wxBitmap m_sourceBitmap; +}; + +//----------------------------------------------------------------------------- +// wxD2DBitmapData declaration +//----------------------------------------------------------------------------- + +class wxD2DBitmapData : public wxGraphicsBitmapData, public wxD2DManagedGraphicsData +{ +public: + typedef wxD2DBitmapResourceHolder NativeType; + + wxD2DBitmapData(wxGraphicsRenderer* renderer, const wxBitmap& bitmap) : + wxGraphicsBitmapData(renderer), m_bitmapHolder(bitmap) {} + + wxD2DBitmapData(wxGraphicsRenderer* renderer, const void* pseudoNativeBitmap) : + wxGraphicsBitmapData(renderer), m_bitmapHolder(*static_cast(pseudoNativeBitmap)) {}; + + // returns the native representation + void* GetNativeBitmap() const wxOVERRIDE; + + wxCOMPtr GetD2DBitmap(); + + wxD2DManagedObject* GetManagedObject() wxOVERRIDE + { + return &m_bitmapHolder; + } + +private: + NativeType m_bitmapHolder; +}; + +//----------------------------------------------------------------------------- +// wxD2DBitmapData implementation +//----------------------------------------------------------------------------- + +void* wxD2DBitmapData::GetNativeBitmap() const +{ + return (void*)&m_bitmapHolder; +} + +wxCOMPtr wxD2DBitmapData::GetD2DBitmap() +{ + return m_bitmapHolder.GetD2DResource(); +} + +wxD2DBitmapData* wxGetD2DBitmapData(const wxGraphicsBitmap& bitmap) +{ + return static_cast(bitmap.GetRefData()); +} + +// Helper class used to create and safely release a ID2D1GradientStopCollection from wxGraphicsGradientStops +class wxD2DGradientStopsHelper +{ +public: + wxD2DGradientStopsHelper(const wxGraphicsGradientStops& gradientStops, ID2D1RenderTarget* renderTarget) + { + int stopCount = gradientStops.GetCount(); + + D2D1_GRADIENT_STOP* gradientStopArray = new D2D1_GRADIENT_STOP[stopCount]; + + for (int i = 0; i < stopCount; ++i) + { + gradientStopArray[i].color = wxD2DConvertColour(gradientStops.Item(i).GetColour()); + gradientStopArray[i].position = gradientStops.Item(i).GetPosition(); + } + + renderTarget->CreateGradientStopCollection(gradientStopArray, stopCount, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, &m_gradientStopCollection); + + delete[] gradientStopArray; + } + + ID2D1GradientStopCollection* GetGradientStopCollection() + { + return m_gradientStopCollection; + } + +private: + wxCOMPtr m_gradientStopCollection; +}; + +template +class wxD2DBrushResourceHolder : public wxD2DResourceHolder +{ +public: + wxD2DBrushResourceHolder(const wxBrush& brush) : m_sourceBrush(brush) {}; + virtual ~wxD2DBrushResourceHolder() {}; +protected: + const wxBrush m_sourceBrush; +}; + +class wxD2DSolidBrushResourceHolder : public wxD2DBrushResourceHolder +{ +public: + wxD2DSolidBrushResourceHolder(const wxBrush& brush) : wxD2DBrushResourceHolder(brush) {} + +protected: + void DoAcquireResource() wxOVERRIDE + { + wxColour colour = m_sourceBrush.GetColour(); + HRESULT hr = GetContext()->CreateSolidColorBrush(wxD2DConvertColour(colour), &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + } +}; + +class wxD2DBitmapBrushResourceHolder : public wxD2DBrushResourceHolder +{ +public: + wxD2DBitmapBrushResourceHolder(const wxBrush& brush) : wxD2DBrushResourceHolder(brush) {} + +protected: + void DoAcquireResource() wxOVERRIDE + { + // TODO: cache this bitmap + wxD2DBitmapResourceHolder bitmap(*(m_sourceBrush.GetStipple())); + bitmap.Bind(GetManager()); + + HRESULT result = GetContext()->CreateBitmapBrush( + bitmap.GetD2DResource(), + D2D1::BitmapBrushProperties( + D2D1_EXTEND_MODE_WRAP, + D2D1_EXTEND_MODE_WRAP, + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR), + &m_nativeResource); + + wxCHECK_HRESULT_RET(result); + } +}; + +class wxD2DHatchBrushResourceHolder : public wxD2DBrushResourceHolder +{ +public: + wxD2DHatchBrushResourceHolder(const wxBrush& brush) : wxD2DBrushResourceHolder(brush) {} + +protected: + void DoAcquireResource() wxOVERRIDE + { + wxCOMPtr hatchBitmapSource(new wxHatchBitmapSource(m_sourceBrush.GetStyle(), m_sourceBrush.GetColour())); + + wxCOMPtr bitmap; + + HRESULT hr = GetContext()->CreateBitmapFromWicBitmap(hatchBitmapSource, &bitmap); + wxCHECK_HRESULT_RET(hr); + + hr = GetContext()->CreateBitmapBrush( + bitmap, + D2D1::BitmapBrushProperties( + D2D1_EXTEND_MODE_WRAP, + D2D1_EXTEND_MODE_WRAP, + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR), + &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + } +}; + +class wxD2DLinearGradientBrushResourceHolder : public wxD2DResourceHolder +{ +public: + struct LinearGradientInfo { + const wxRect direction; + const wxGraphicsGradientStops stops; + LinearGradientInfo(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops_) + : direction(x1, y1, x2, y2), stops(stops_) {} + }; + + wxD2DLinearGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops) + : m_linearGradientInfo(x1, y1, x2, y2, stops) {} + +protected: + void DoAcquireResource() wxOVERRIDE + { + wxD2DGradientStopsHelper helper(m_linearGradientInfo.stops, GetContext()); + + HRESULT hr = GetContext()->CreateLinearGradientBrush( + D2D1::LinearGradientBrushProperties( + D2D1::Point2F(m_linearGradientInfo.direction.GetX(), m_linearGradientInfo.direction.GetY()), + D2D1::Point2F(m_linearGradientInfo.direction.GetWidth(), m_linearGradientInfo.direction.GetHeight())), + helper.GetGradientStopCollection(), + &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + } +private: + const LinearGradientInfo m_linearGradientInfo; +}; + +class wxD2DRadialGradientBrushResourceHolder : public wxD2DResourceHolder +{ +public: + struct RadialGradientInfo { + const wxRect direction; + const wxDouble radius; + const wxGraphicsGradientStops stops; + + RadialGradientInfo(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, wxDouble r, const wxGraphicsGradientStops& stops_) + : direction(x1, y1, x2, y2), radius(r), stops(stops_) {} + }; + + wxD2DRadialGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, wxDouble& r, const wxGraphicsGradientStops& stops) + : m_radialGradientInfo(x1, y1, x2, y2, r, stops) {} + +protected: + void DoAcquireResource() wxOVERRIDE + { + wxD2DGradientStopsHelper helper(m_radialGradientInfo.stops, GetContext()); + + int xo = m_radialGradientInfo.direction.GetLeft() - m_radialGradientInfo.direction.GetWidth(); + int yo = m_radialGradientInfo.direction.GetTop() - m_radialGradientInfo.direction.GetHeight(); + + HRESULT hr = GetContext()->CreateRadialGradientBrush( + D2D1::RadialGradientBrushProperties( + D2D1::Point2F(m_radialGradientInfo.direction.GetLeft(), m_radialGradientInfo.direction.GetTop()), + D2D1::Point2F(xo, yo), + m_radialGradientInfo.radius, m_radialGradientInfo.radius), + helper.GetGradientStopCollection(), + &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + } + +private: + const RadialGradientInfo m_radialGradientInfo; +}; + +//----------------------------------------------------------------------------- +// wxD2DBrushData declaration +//----------------------------------------------------------------------------- + +class wxD2DBrushData : public wxGraphicsObjectRefData, public wxD2DManagedGraphicsData +{ +public: + wxD2DBrushData(wxGraphicsRenderer* renderer, const wxBrush brush); + + wxD2DBrushData(wxGraphicsRenderer* renderer); + + void CreateLinearGradientBrush(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxGraphicsGradientStops& stops); + + void CreateRadialGradientBrush(wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, const wxGraphicsGradientStops& stops); + + ID2D1Brush* GetBrush() const + { + return (ID2D1Brush*)(m_brushResourceHolder->GetResource()); + } + + wxD2DManagedObject* GetManagedObject() wxOVERRIDE + { + return m_brushResourceHolder.get(); + } + +private: + wxSharedPtr m_brushResourceHolder; +}; + +//----------------------------------------------------------------------------- +// wxD2DBrushData implementation +//----------------------------------------------------------------------------- + +wxD2DBrushData::wxD2DBrushData(wxGraphicsRenderer* renderer, const wxBrush brush) + : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(NULL) +{ + if (brush.GetStyle() == wxBRUSHSTYLE_SOLID) + { + m_brushResourceHolder = new wxD2DSolidBrushResourceHolder(brush); + } + else if (brush.IsHatch()) + { + m_brushResourceHolder = new wxD2DHatchBrushResourceHolder(brush); + } + else + { + m_brushResourceHolder = new wxD2DBitmapBrushResourceHolder(brush); + } +} + +wxD2DBrushData::wxD2DBrushData(wxGraphicsRenderer* renderer) + : wxGraphicsObjectRefData(renderer), m_brushResourceHolder(NULL) +{ +} + +void wxD2DBrushData::CreateLinearGradientBrush( + wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops) +{ + m_brushResourceHolder = new wxD2DLinearGradientBrushResourceHolder(x1, y1, x2, y2, stops); +} + +void wxD2DBrushData::CreateRadialGradientBrush( + wxDouble xo, wxDouble yo, + wxDouble xc, wxDouble yc, + wxDouble radius, + const wxGraphicsGradientStops& stops) +{ + m_brushResourceHolder = new wxD2DRadialGradientBrushResourceHolder(xo, yo, xc, yc, radius, stops); +} + +wxD2DBrushData* wxGetD2DBrushData(const wxGraphicsBrush& brush) +{ + return static_cast(brush.GetGraphicsData()); +} + +bool wxIsHatchPenStyle(wxPenStyle penStyle) +{ + return penStyle >= wxPENSTYLE_FIRST_HATCH && penStyle <= wxPENSTYLE_LAST_HATCH; +} + +wxBrushStyle wxConvertPenStyleToBrushStyle(wxPenStyle penStyle) +{ + switch(penStyle) + { + case wxPENSTYLE_BDIAGONAL_HATCH: + return wxBRUSHSTYLE_BDIAGONAL_HATCH; + case wxPENSTYLE_CROSSDIAG_HATCH: + return wxBRUSHSTYLE_CROSSDIAG_HATCH; + case wxPENSTYLE_FDIAGONAL_HATCH: + return wxBRUSHSTYLE_FDIAGONAL_HATCH; + case wxPENSTYLE_CROSS_HATCH: + return wxBRUSHSTYLE_CROSS_HATCH; + case wxPENSTYLE_HORIZONTAL_HATCH: + return wxBRUSHSTYLE_HORIZONTAL_HATCH; + case wxPENSTYLE_VERTICAL_HATCH: + return wxBRUSHSTYLE_VERTICAL_HATCH; + default: + break; + } + + return wxBRUSHSTYLE_SOLID; +} + +//----------------------------------------------------------------------------- +// wxD2DPenData declaration +//----------------------------------------------------------------------------- + +class wxD2DPenData : public wxGraphicsObjectRefData, public wxD2DManagedGraphicsData +{ +public: + wxD2DPenData(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, const wxPen& pen); + + void CreateStrokeStyle(ID2D1Factory* const direct2dfactory); + + ID2D1Brush* GetBrush(); + + FLOAT GetWidth(); + + ID2D1StrokeStyle* GetStrokeStyle(); + + wxD2DManagedObject* GetManagedObject() wxOVERRIDE + { + return m_stippleBrush->GetManagedObject(); + } + +private: + // We store the source pen for later when we need to recreate the + // device-dependent resources. + const wxPen m_sourcePen; + + // A stroke style is a device-independent resource. + // Describes the caps, miter limit, line join, and dash information. + wxCOMPtr m_strokeStyle; + + // Drawing outlines with Direct2D requires a brush for the color or stipple. + wxSharedPtr m_stippleBrush; + + // The width of the stroke + FLOAT m_width; +}; + +//----------------------------------------------------------------------------- +// wxD2DPenData implementation +//----------------------------------------------------------------------------- + +wxD2DPenData::wxD2DPenData( + wxGraphicsRenderer* renderer, + ID2D1Factory* direct2dFactory, + const wxPen& pen) + : wxGraphicsObjectRefData(renderer), m_sourcePen(pen), m_width(pen.GetWidth()) +{ + CreateStrokeStyle(direct2dFactory); + + wxBrush strokeBrush; + + if (m_sourcePen.GetStyle() == wxPENSTYLE_STIPPLE) + { + strokeBrush.SetStipple(*(m_sourcePen.GetStipple())); + strokeBrush.SetStyle(wxBRUSHSTYLE_STIPPLE); + } + else if(wxIsHatchPenStyle(m_sourcePen.GetStyle())) + { + strokeBrush.SetStyle(wxConvertPenStyleToBrushStyle(m_sourcePen.GetStyle())); + strokeBrush.SetColour(m_sourcePen.GetColour()); + } + else + { + strokeBrush.SetColour(m_sourcePen.GetColour()); + strokeBrush.SetStyle(wxBRUSHSTYLE_SOLID); + } + + m_stippleBrush = new wxD2DBrushData(renderer, strokeBrush); +} + +void wxD2DPenData::CreateStrokeStyle(ID2D1Factory* const direct2dfactory) +{ + D2D1_CAP_STYLE capStyle = wxD2DConvertPenCap(m_sourcePen.GetCap()); + D2D1_LINE_JOIN lineJoin = wxD2DConvertPenJoin(m_sourcePen.GetJoin()); + D2D1_DASH_STYLE dashStyle = wxD2DConvertPenStyle(m_sourcePen.GetStyle()); + + int dashCount = 0; + FLOAT* dashes = NULL; + + if (dashStyle == D2D1_DASH_STYLE_CUSTOM) + { + dashCount = m_sourcePen.GetDashCount(); + dashes = new FLOAT[dashCount]; + + for (int i = 0; i < dashCount; ++i) + { + dashes[i] = m_sourcePen.GetDash()[i]; + } + + } + + direct2dfactory->CreateStrokeStyle( + D2D1::StrokeStyleProperties(capStyle, capStyle, capStyle, lineJoin, 0, dashStyle, 0.0f), + dashes, dashCount, + &m_strokeStyle); + + delete[] dashes; +} + +ID2D1Brush* wxD2DPenData::GetBrush() +{ + return m_stippleBrush->GetBrush(); +} + +FLOAT wxD2DPenData::GetWidth() +{ + return m_width; +} + +ID2D1StrokeStyle* wxD2DPenData::GetStrokeStyle() +{ + return m_strokeStyle; +} + +wxD2DPenData* wxGetD2DPenData(const wxGraphicsPen& pen) +{ + return static_cast(pen.GetGraphicsData()); +} + +class wxD2DFontData : public wxGraphicsObjectRefData +{ +public: + wxD2DFontData(wxGraphicsRenderer* renderer, ID2D1Factory* d2d1Factory, const wxFont& font, const wxColor& color); + + wxCOMPtr CreateTextLayout(const wxString& text) const; + + wxD2DBrushData& GetBrushData() { return m_brushData; } + + wxCOMPtr GetTextFormat() const { return m_textFormat; } + + wxCOMPtr GetFont() { return m_font; }; + +private: + // The native, device-independent font object + wxCOMPtr m_font; + + // The native, device-independent font object + wxCOMPtr m_textFormat; + + // We use a color brush to render the font + wxD2DBrushData m_brushData; + + bool m_underlined; + + bool m_strikethrough; +}; + +wxD2DFontData::wxD2DFontData(wxGraphicsRenderer* renderer, ID2D1Factory* d2dFactory, const wxFont& font, const wxColor& color) : + wxGraphicsObjectRefData(renderer), m_brushData(renderer, wxBrush(color)), + m_underlined(font.GetUnderlined()), m_strikethrough(font.GetStrikethrough()) +{ + HRESULT hr; + + wxCOMPtr gdiInterop; + hr = wxDWriteFactory()->GetGdiInterop(&gdiInterop); + wxCHECK_HRESULT_RET(hr); + + LOGFONTW logfont; + GetObjectW(font.GetHFONT(), sizeof(logfont), &logfont); + + // Ensure the LOGFONT object contains the correct font face name + if (logfont.lfFaceName[0] == '\0') + { + for (unsigned int i = 0; i < font.GetFaceName().Length(); ++i) + { + logfont.lfFaceName[i] = font.GetFaceName().GetChar(i); + } + } + + hr = gdiInterop->CreateFontFromLOGFONT(&logfont, &m_font); + wxCHECK_HRESULT_RET(hr); + + wxCOMPtr fontFamily; + m_font->GetFontFamily(&fontFamily); + + wxCOMPtr familyNames; + fontFamily->GetFamilyNames(&familyNames); + + UINT32 length; + familyNames->GetStringLength(0, &length); + + wchar_t* name = new wchar_t[length+1]; + familyNames->GetString(0, name, length+1); + + FLOAT dpiX, dpiY; + d2dFactory->GetDesktopDpi(&dpiX, &dpiY); + + hr = wxDWriteFactory()->CreateTextFormat( + name, + NULL, + m_font->GetWeight(), + m_font->GetStyle(), + m_font->GetStretch(), + (FLOAT)(font.GetPixelSize().GetHeight()) / (dpiY / 96.0), + L"en-us", + &m_textFormat); + + delete[] name; + + wxCHECK_HRESULT_RET(hr); +} + +wxCOMPtr wxD2DFontData::CreateTextLayout(const wxString& text) const +{ + static const FLOAT MAX_WIDTH = FLT_MAX; + static const FLOAT MAX_HEIGHT = FLT_MAX; + + HRESULT hr; + + wxCOMPtr textLayout; + + hr = wxDWriteFactory()->CreateTextLayout( + text.c_str(), + text.length(), + m_textFormat, + MAX_WIDTH, + MAX_HEIGHT, + &textLayout); + wxCHECK2_HRESULT_RET(hr, wxCOMPtr(NULL)); + + DWRITE_TEXT_RANGE textRange = { 0, (UINT32) text.length() }; + + if (m_underlined) + { + textLayout->SetUnderline(true, textRange); + } + + if (m_strikethrough) + { + textLayout->SetStrikethrough(true, textRange); + } + + return textLayout; +} + +wxD2DFontData* wxGetD2DFontData(const wxGraphicsFont& font) +{ + return static_cast(font.GetGraphicsData()); +} + +// A render target resource holder exposes methods relevant +// for native render targets such as resize +class wxD2DRenderTargetResourceHolder : public wxD2DResourceHolder +{ +public: + // This method is called when an external event signals the underlying DC + // is resized (e.g. the resizing of a window). Some implementations can leave + // this method empty, while others must adjust the render target size to match + // the underlying DC. + virtual void Resize() + { + } + + // We use this method instead of the one provided by the native render target + // because Direct2D 1.0 render targets do not accept a composition mode + // parameter, while the device context in Direct2D 1.1 does. This way, we make + // best use of the capabilities of each render target. + // + // The default implementation works for all render targets, but the D2D 1.0 + // render target holders shouldn't need to override it, since none of the + // 1.0 render targets offer a better version of this method. + virtual void DrawBitmap(ID2D1Bitmap* bitmap, D2D1_POINT_2F offset, + D2D1_RECT_F imageRectangle, wxInterpolationQuality interpolationQuality, + wxCompositionMode WXUNUSED(compositionMode)) + { + D2D1_RECT_F destinationRectangle = D2D1::RectF(offset.x, offset.y, offset.x + imageRectangle.right, offset.y + imageRectangle.bottom); + m_nativeResource->DrawBitmap( + bitmap, + destinationRectangle, + 1.0f, + wxD2DConvertBitmapInterpolationMode(interpolationQuality), + imageRectangle); + } + + // We use this method instead of the one provided by the native render target + // because some contexts might require writing to a buffer (e.g. an image + // context), and some render targets might require additional operations to + // be executed (e.g. the device context must present the swap chain) + virtual HRESULT Flush() + { + return m_nativeResource->Flush(); + } + + // Composition is not supported at in D2D 1.0, and we only allow for: + // wxCOMPOSITION_DEST - which is essentially a no-op and is handled + // externally by preventing any draw calls. + // wxCOMPOSITION_OVER - which copies the source over the destination using + // alpha blending. This is the default way D2D 1.0 + // draws images. + virtual bool SetCompositionMode(wxCompositionMode compositionMode) + { + if (compositionMode == wxCOMPOSITION_DEST || + compositionMode == wxCOMPOSITION_OVER) + { + // There's nothing we can do but notify the caller the composition + // mode is supported + return true; + } + + return false; + } +}; + +#if wxUSE_IMAGE +class wxD2DImageRenderTargetResourceHolder : public wxD2DRenderTargetResourceHolder +{ +public: + wxD2DImageRenderTargetResourceHolder(wxImage* image, ID2D1Factory* factory) : + m_resultImage(image), m_factory(factory) + { + } + + HRESULT Flush() wxOVERRIDE + { + HRESULT hr = m_nativeResource->Flush(); + FlushRenderTargetToImage(); + return hr; + } + + ~wxD2DImageRenderTargetResourceHolder() + { + FlushRenderTargetToImage(); + } + +protected: + void DoAcquireResource() wxOVERRIDE + { + HRESULT hr; + + // Create a compatible WIC Bitmap + hr = wxWICImagingFactory()->CreateBitmap( + m_resultImage->GetWidth(), + m_resultImage->GetHeight(), + GUID_WICPixelFormat32bppPBGRA, + WICBitmapCacheOnDemand, + &m_wicBitmap); + wxCHECK_HRESULT_RET(hr); + + // Copy contents of source image to the WIC bitmap. + const int width = m_resultImage->GetWidth(); + const int height = m_resultImage->GetHeight(); + WICRect rcLock = { 0, 0, width, height }; + IWICBitmapLock *pLock = NULL; + hr = m_wicBitmap->Lock(&rcLock, WICBitmapLockWrite, &pLock); + wxCHECK_HRESULT_RET(hr); + + UINT rowStride = 0; + hr = pLock->GetStride(&rowStride); + if ( FAILED(hr) ) + { + pLock->Release(); + wxFAILED_HRESULT_MSG(hr); + return; + } + + UINT bufferSize = 0; + BYTE *pBmpBuffer = NULL; + hr = pLock->GetDataPointer(&bufferSize, &pBmpBuffer); + if ( FAILED(hr) ) + { + pLock->Release(); + wxFAILED_HRESULT_MSG(hr); + return; + } + + const unsigned char *imgRGB = m_resultImage->GetData(); // source RGB buffer + const unsigned char *imgAlpha = m_resultImage->GetAlpha(); // source alpha buffer + for( int y = 0; y < height; y++ ) + { + BYTE *pPixByte = pBmpBuffer; + for ( int x = 0; x < width; x++ ) + { + unsigned char r = *imgRGB++; + unsigned char g = *imgRGB++; + unsigned char b = *imgRGB++; + unsigned char a = imgAlpha ? *imgAlpha++ : 255; + // Premultiply RGB values + *pPixByte++ = (b * a + 127) / 255; + *pPixByte++ = (g * a + 127) / 255; + *pPixByte++ = (r * a + 127) / 255; + *pPixByte++ = a; + } + + pBmpBuffer += rowStride; + } + + pLock->Release(); + + // Create the render target + hr = m_factory->CreateWicBitmapRenderTarget( + m_wicBitmap, + D2D1::RenderTargetProperties( + D2D1_RENDER_TARGET_TYPE_SOFTWARE, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)), + &m_nativeResource); + wxCHECK_HRESULT_RET(hr); + } + +private: + void FlushRenderTargetToImage() + { + const int width = m_resultImage->GetWidth(); + const int height = m_resultImage->GetHeight(); + + WICRect rcLock = { 0, 0, width, height }; + IWICBitmapLock *pLock = NULL; + HRESULT hr = m_wicBitmap->Lock(&rcLock, WICBitmapLockRead, &pLock); + wxCHECK_HRESULT_RET(hr); + + UINT rowStride = 0; + hr = pLock->GetStride(&rowStride); + if ( FAILED(hr) ) + { + pLock->Release(); + wxFAILED_HRESULT_MSG(hr); + return; + } + + UINT bufferSize = 0; + BYTE *pBmpBuffer = NULL; + hr = pLock->GetDataPointer(&bufferSize, &pBmpBuffer); + if ( FAILED(hr) ) + { + pLock->Release(); + wxFAILED_HRESULT_MSG(hr); + return; + } + + WICPixelFormatGUID pixelFormat; + hr = pLock->GetPixelFormat(&pixelFormat); + if ( FAILED(hr) ) + { + pLock->Release(); + wxFAILED_HRESULT_MSG(hr); + return; + } + wxASSERT_MSG( pixelFormat == GUID_WICPixelFormat32bppPBGRA || + pixelFormat == GUID_WICPixelFormat32bppBGR, + wxS("Unsupported pixel format") ); + + // Only premultiplied ARGB bitmaps are supported. + const bool hasAlpha = pixelFormat == GUID_WICPixelFormat32bppPBGRA; + + unsigned char* destRGB = m_resultImage->GetData(); + unsigned char* destAlpha = m_resultImage->GetAlpha(); + for( int y = 0; y < height; y++ ) + { + BYTE *pPixByte = pBmpBuffer; + for ( int x = 0; x < width; x++ ) + { + wxPBGRAColor color = wxPBGRAColor(pPixByte); + unsigned char a = hasAlpha ? color.a : 255; + // Undo premultiplication for ARGB bitmap + *destRGB++ = (a > 0 && a < 255) ? ( color.r * 255 ) / a : color.r; + *destRGB++ = (a > 0 && a < 255) ? ( color.g * 255 ) / a : color.g; + *destRGB++ = (a > 0 && a < 255) ? ( color.b * 255 ) / a : color.b; + if ( destAlpha ) + *destAlpha++ = a; + + pPixByte += 4; + } + + pBmpBuffer += rowStride; + } + + pLock->Release(); + } + +private: + wxImage* m_resultImage; + wxCOMPtr m_wicBitmap; + + ID2D1Factory* m_factory; +}; +#endif // wxUSE_IMAGE + +class wxD2DHwndRenderTargetResourceHolder : public wxD2DRenderTargetResourceHolder +{ +public: + typedef ID2D1HwndRenderTarget* ImplementationType; + + wxD2DHwndRenderTargetResourceHolder(HWND hwnd, ID2D1Factory* factory) : + m_hwnd(hwnd), m_factory(factory) + { + } + + void Resize() wxOVERRIDE + { + RECT clientRect; + GetClientRect(m_hwnd, &clientRect); + + D2D1_SIZE_U hwndSize = D2D1::SizeU( + clientRect.right - clientRect.left, + clientRect.bottom - clientRect.top); + + D2D1_SIZE_U renderTargetSize = GetRenderTarget()->GetPixelSize(); + + if (hwndSize.width != renderTargetSize.width || hwndSize.height != renderTargetSize.height) + { + GetRenderTarget()->Resize(hwndSize); + } + } + +protected: + void DoAcquireResource() wxOVERRIDE + { + wxCOMPtr renderTarget; + + HRESULT result; + + RECT clientRect; + GetClientRect(m_hwnd, &clientRect); + + D2D1_SIZE_U size = D2D1::SizeU( + clientRect.right - clientRect.left, + clientRect.bottom - clientRect.top); + + result = m_factory->CreateHwndRenderTarget( + D2D1::RenderTargetProperties(), + D2D1::HwndRenderTargetProperties(m_hwnd, size), + &renderTarget); + + if (FAILED(result)) + { + wxFAIL_MSG("Could not create Direct2D render target"); + } + + renderTarget->SetTransform(D2D1::Matrix3x2F::Identity()); + + m_nativeResource = renderTarget; + } + +private: + // Converts the underlying resource pointer of type + // ID2D1RenderTarget* to the actual implementation type + ImplementationType GetRenderTarget() + { + return static_cast(GetD2DResource().get()); + } + +private: + HWND m_hwnd; + ID2D1Factory* m_factory; +}; + +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +class wxD2DDeviceContextResourceHolder : public wxD2DRenderTargetResourceHolder +{ +public: + wxD2DDeviceContextResourceHolder(ID2D1Factory* factory, HWND hwnd) : + m_factory(NULL), m_hwnd(hwnd) + { + HRESULT hr = factory->QueryInterface(IID_ID2D1Factory1, (void**)&m_factory); + wxCHECK_HRESULT_RET(hr); + } + + void DrawBitmap(ID2D1Image* image, D2D1_POINT_2F offset, + D2D1_RECT_F imageRectangle, wxInterpolationQuality interpolationQuality, + wxCompositionMode compositionMode) wxOVERRIDE + { + m_context->DrawImage(image, + offset, + imageRectangle, + wxD2DConvertInterpolationMode(interpolationQuality), + wxD2DConvertCompositionMode(compositionMode)); + } + + HRESULT Flush() wxOVERRIDE + { + HRESULT hr = m_nativeResource->Flush(); + DXGI_PRESENT_PARAMETERS params = { 0 }; + m_swapChain->Present1(1, 0, ¶ms); + return hr; + } + +protected: + + // Adapted from http://msdn.microsoft.com/en-us/library/windows/desktop/hh780339%28v=vs.85%29.aspx + void DoAcquireResource() wxOVERRIDE + { + HRESULT hr; + + // This flag adds support for surfaces with a different color channel ordering than the API default. + // You need it for compatibility with Direct2D. + UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; + + // This array defines the set of DirectX hardware feature levels this app supports. + // The ordering is important and you should preserve it. + // Don't forget to declare your app's minimum required feature level in its + // description. All apps are assumed to support 9.1 unless otherwise stated. + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + D3D_FEATURE_LEVEL_9_3, + D3D_FEATURE_LEVEL_9_2, + D3D_FEATURE_LEVEL_9_1 + }; + + // Create the DX11 API device object, and get a corresponding context. + wxCOMPtr device; + wxCOMPtr context; + + hr = D3D11CreateDevice( + NULL, // specify null to use the default adapter + D3D_DRIVER_TYPE_HARDWARE, + 0, + creationFlags, // optionally set debug and Direct2D compatibility flags + featureLevels, // list of feature levels this app can support + ARRAYSIZE(featureLevels), // number of possible feature levels + D3D11_SDK_VERSION, + &device, // returns the Direct3D device created + &m_featureLevel, // returns feature level of device created + &context); // returns the device immediate context + wxCHECK_HRESULT_RET(hr); + + // Obtain the underlying DXGI device of the Direct3D11 device. + hr = device->QueryInterface(IID_IDXGIDevice, (void**)&m_dxgiDevice); + wxCHECK_HRESULT_RET(hr); + + // Obtain the Direct2D device for 2-D rendering. + hr = m_factory->CreateDevice(m_dxgiDevice, &m_device); + wxCHECK_HRESULT_RET(hr); + + // Get Direct2D device's corresponding device context object. + hr = m_device->CreateDeviceContext( + D2D1_DEVICE_CONTEXT_OPTIONS_NONE, + &m_context); + wxCHECK_HRESULT_RET(hr); + + m_nativeResource = m_context; + + AttachSurface(); + } + +private: + void AttachSurface() + { + HRESULT hr; + + // Allocate a descriptor. + DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0}; + swapChainDesc.Width = 0; + swapChainDesc.Height = 0; + swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + swapChainDesc.Stereo = false; + swapChainDesc.SampleDesc.Count = 1; + swapChainDesc.SampleDesc.Quality = 0; + swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + swapChainDesc.BufferCount = 2; + swapChainDesc.Scaling = DXGI_SCALING_STRETCH; + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + swapChainDesc.Flags = 0; + + // Identify the physical adapter (GPU or card) this device is runs on. + wxCOMPtr dxgiAdapter; + hr = m_dxgiDevice->GetAdapter(&dxgiAdapter); + wxCHECK_HRESULT_RET(hr); + + // Get the factory object that created the DXGI device. + wxCOMPtr dxgiFactory; + hr = dxgiAdapter->GetParent(IID_PPV_ARGS(&dxgiFactory)); + wxCHECK_HRESULT_RET(hr); + + // Get the final swap chain for this window from the DXGI factory. + hr = dxgiFactory->CreateSwapChainForHwnd( + m_dxgiDevice, + m_hwnd, + &swapChainDesc, + NULL, // allow on all displays + NULL, + &m_swapChain); + wxCHECK_HRESULT_RET(hr); + + // Ensure that DXGI doesn't queue more than one frame at a time. + hr = m_dxgiDevice->SetMaximumFrameLatency(1); + wxCHECK_HRESULT_RET(hr); + + // Get the backbuffer for this window which is be the final 3D render target. + wxCOMPtr backBuffer; + hr = m_swapChain->GetBuffer(0, IID_PPV_ARGS(&backBuffer)); + wxCHECK_HRESULT_RET(hr); + + FLOAT dpiX, dpiY; + m_factory->GetDesktopDpi(&dpiX, &dpiY); + + // Now we set up the Direct2D render target bitmap linked to the swapchain. + // Whenever we render to this bitmap, it is directly rendered to the + // swap chain associated with the window. + D2D1_BITMAP_PROPERTIES1 bitmapProperties = D2D1::BitmapProperties1( + D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE), + dpiX, dpiY); + + // Direct2D needs the dxgi version of the backbuffer surface pointer. + wxCOMPtr dxgiBackBuffer; + hr = m_swapChain->GetBuffer(0, IID_PPV_ARGS(&dxgiBackBuffer)); + wxCHECK_HRESULT_RET(hr); + + // Get a D2D surface from the DXGI back buffer to use as the D2D render target. + hr = m_context->CreateBitmapFromDxgiSurface( + dxgiBackBuffer.get(), + &bitmapProperties, + &m_targetBitmap); + wxCHECK_HRESULT_RET(hr); + + // Now we can set the Direct2D render target. + m_context->SetTarget(m_targetBitmap); + } + + ~wxD2DDeviceContextResourceHolder() + { + DXGI_PRESENT_PARAMETERS params = { 0 }; + m_swapChain->Present1(1, 0, ¶ms); + } + +private: + ID2D1Factory1* m_factory; + + HWND m_hwnd; + + D3D_FEATURE_LEVEL m_featureLevel; + wxCOMPtr m_dxgiDevice; + wxCOMPtr m_device; + wxCOMPtr m_context; + wxCOMPtr m_targetBitmap; + wxCOMPtr m_swapChain; +}; +#endif + +class wxD2DDCRenderTargetResourceHolder : public wxD2DRenderTargetResourceHolder +{ +public: + wxD2DDCRenderTargetResourceHolder(ID2D1Factory* factory, HDC hdc, const wxSize dcSize) : + m_factory(factory), m_hdc(hdc) + { + m_dcSize.left = 0; + m_dcSize.top = 0; + m_dcSize.right = dcSize.GetWidth(); + m_dcSize.bottom = dcSize.GetHeight(); + } + +protected: + void DoAcquireResource() + { + wxCOMPtr renderTarget; + D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties = D2D1::RenderTargetProperties( + D2D1_RENDER_TARGET_TYPE_DEFAULT, + D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)); + + HRESULT hr = m_factory->CreateDCRenderTarget( + &renderTargetProperties, + &renderTarget); + wxCHECK_HRESULT_RET(hr); + + hr = renderTarget->BindDC(m_hdc, &m_dcSize); + wxCHECK_HRESULT_RET(hr); + + m_nativeResource = renderTarget; + } + +private: + ID2D1Factory* m_factory; + HDC m_hdc; + RECT m_dcSize; +}; + +// The null context has no state of its own and does nothing. +// It is only used as a base class for the lightweight +// measuring context. The measuring context cannot inherit from +// the default implementation wxD2DContext, because some methods +// from wxD2DContext require the presence of a "context" +// (render target) in order to acquire various device-dependent +// resources. Without a proper context, those methods would fail. +// The methods implemented in the null context are fundamentally no-ops. +class wxNullContext : public wxGraphicsContext +{ +public: + wxNullContext(wxGraphicsRenderer* renderer) : wxGraphicsContext(renderer) {} + void GetTextExtent(const wxString&, wxDouble*, wxDouble*, wxDouble*, wxDouble*) const wxOVERRIDE {} + void GetPartialTextExtents(const wxString&, wxArrayDouble&) const wxOVERRIDE {} + void Clip(const wxRegion&) wxOVERRIDE {} + void Clip(wxDouble, wxDouble, wxDouble, wxDouble) wxOVERRIDE {} + void ResetClip() wxOVERRIDE {} + void* GetNativeContext() wxOVERRIDE { return NULL; } + bool SetAntialiasMode(wxAntialiasMode) wxOVERRIDE { return false; } + bool SetInterpolationQuality(wxInterpolationQuality) wxOVERRIDE { return false; } + bool SetCompositionMode(wxCompositionMode) wxOVERRIDE { return false; } + void BeginLayer(wxDouble) wxOVERRIDE {} + void EndLayer() wxOVERRIDE {} + void Translate(wxDouble, wxDouble) wxOVERRIDE {} + void Scale(wxDouble, wxDouble) wxOVERRIDE {} + void Rotate(wxDouble) wxOVERRIDE {} + void ConcatTransform(const wxGraphicsMatrix&) wxOVERRIDE {} + void SetTransform(const wxGraphicsMatrix&) wxOVERRIDE {} + wxGraphicsMatrix GetTransform() const wxOVERRIDE { return wxNullGraphicsMatrix; } + void StrokePath(const wxGraphicsPath&) wxOVERRIDE {} + void FillPath(const wxGraphicsPath&, wxPolygonFillMode) wxOVERRIDE {} + void DrawBitmap(const wxGraphicsBitmap&, wxDouble, wxDouble, wxDouble, wxDouble) wxOVERRIDE {} + void DrawBitmap(const wxBitmap&, wxDouble, wxDouble, wxDouble, wxDouble) wxOVERRIDE {} + void DrawIcon(const wxIcon&, wxDouble, wxDouble, wxDouble, wxDouble) wxOVERRIDE {} + void PushState() wxOVERRIDE {} + void PopState() wxOVERRIDE {} + void Flush() wxOVERRIDE {} + +protected: + void DoDrawText(const wxString&, wxDouble, wxDouble) wxOVERRIDE {} +}; + +class wxD2DMeasuringContext : public wxNullContext +{ +public: + wxD2DMeasuringContext(wxGraphicsRenderer* renderer) : wxNullContext(renderer) {} + + void GetTextExtent(const wxString& str, wxDouble* width, wxDouble* height, wxDouble* descent, wxDouble* externalLeading) const wxOVERRIDE + { + GetTextExtent(wxGetD2DFontData(m_font), str, width, height, descent, externalLeading); + } + + void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const wxOVERRIDE + { + GetPartialTextExtents(wxGetD2DFontData(m_font), text, widths); + } + + static void GetPartialTextExtents(wxD2DFontData* fontData, const wxString& text, wxArrayDouble& widths) + { + for (unsigned int i = 0; i < text.Length(); ++i) + { + wxDouble width; + GetTextExtent(fontData, text.SubString(0, i), &width, NULL, NULL, NULL); + widths.push_back(width); + } + } + + static void GetTextExtent(wxD2DFontData* fontData, const wxString& str, wxDouble* width, wxDouble* height, wxDouble* descent, wxDouble* externalLeading) + { + wxCOMPtr textLayout = fontData->CreateTextLayout(str); + wxCOMPtr font = fontData->GetFont(); + + DWRITE_TEXT_METRICS textMetrics; + textLayout->GetMetrics(&textMetrics); + + DWRITE_FONT_METRICS fontMetrics; + font->GetMetrics(&fontMetrics); + + FLOAT ratio = fontData->GetTextFormat()->GetFontSize() / (FLOAT)fontMetrics.designUnitsPerEm; + + if (width != NULL) *width = textMetrics.widthIncludingTrailingWhitespace; + if (height != NULL) *height = textMetrics.height; + + if (descent != NULL) *descent = fontMetrics.descent * ratio; + if (externalLeading != NULL) *externalLeading = std::max(0.0f, (fontMetrics.ascent + fontMetrics.descent) * ratio - textMetrics.height); + } +}; + +//----------------------------------------------------------------------------- +// wxD2DContext declaration +//----------------------------------------------------------------------------- + +class wxD2DContext : public wxGraphicsContext, wxD2DResourceManager +{ +public: + wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HWND hwnd); + + wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HDC hdc, const wxSize& dcSize); + +#if wxUSE_IMAGE + wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, wxImage& image); +#endif // wxUSE_IMAGE + + wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, void* nativeContext); + + ~wxD2DContext(); + + void Clip(const wxRegion& region) wxOVERRIDE; + + void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void ResetClip() wxOVERRIDE; + + // The native context used by wxD2DContext is a Direct2D render target. + void* GetNativeContext() wxOVERRIDE; + + bool SetAntialiasMode(wxAntialiasMode antialias) wxOVERRIDE; + + bool SetInterpolationQuality(wxInterpolationQuality interpolation) wxOVERRIDE; + + bool SetCompositionMode(wxCompositionMode op) wxOVERRIDE; + + void BeginLayer(wxDouble opacity) wxOVERRIDE; + + void EndLayer() wxOVERRIDE; + + void Translate(wxDouble dx, wxDouble dy) wxOVERRIDE; + + void Scale(wxDouble xScale, wxDouble yScale) wxOVERRIDE; + + void Rotate(wxDouble angle) wxOVERRIDE; + + void ConcatTransform(const wxGraphicsMatrix& matrix) wxOVERRIDE; + + void SetTransform(const wxGraphicsMatrix& matrix) wxOVERRIDE; + + wxGraphicsMatrix GetTransform() const wxOVERRIDE; + + void StrokePath(const wxGraphicsPath& p) wxOVERRIDE; + + void FillPath(const wxGraphicsPath& p , wxPolygonFillMode fillStyle = wxODDEVEN_RULE) wxOVERRIDE; + + void DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius) wxOVERRIDE; + + void DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void DrawBitmap(const wxGraphicsBitmap& bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void DrawBitmap(const wxBitmap& bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + void PushState() wxOVERRIDE; + + void PopState() wxOVERRIDE; + + void GetTextExtent( + const wxString& str, + wxDouble* width, + wxDouble* height, + wxDouble* descent, + wxDouble* externalLeading) const wxOVERRIDE; + + void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const wxOVERRIDE; + + bool ShouldOffset() const wxOVERRIDE; + + void SetPen(const wxGraphicsPen& pen) wxOVERRIDE; + + void Flush() wxOVERRIDE; + + void GetDPI(wxDouble* dpiX, wxDouble* dpiY) wxOVERRIDE; + + wxD2DContextSupplier::ContextType GetContext() wxOVERRIDE + { + return GetRenderTarget(); + } + +private: + void Init(); + + void DoDrawText(const wxString& str, wxDouble x, wxDouble y) wxOVERRIDE; + + void EnsureInitialized(); + + HRESULT CreateRenderTarget(); + + void AdjustRenderTargetSize(); + + void ReleaseDeviceDependentResources(); + + ID2D1RenderTarget* GetRenderTarget() const; + +private: + enum ClipMode + { + CLIP_MODE_NONE, + CLIP_MODE_AXIS_ALIGNED_RECTANGLE, + CLIP_MODE_GEOMETRY + }; + +private: + ID2D1Factory* m_direct2dFactory; + + wxSharedPtr m_renderTargetHolder; + + // A ID2D1DrawingStateBlock represents the drawing state of a render target: + // the anti aliasing mode, transform, tags, and text-rendering options. + // The context owns these pointers and is responsible for releasing them. + wxStack > m_stateStack; + + ClipMode m_clipMode; + + bool m_clipLayerAcquired; + + // A direct2d layer is a device-dependent resource. + wxCOMPtr m_clipLayer; + + wxStack > m_layers; + + ID2D1RenderTarget* m_cachedRenderTarget; + +private: + wxDECLARE_NO_COPY_CLASS(wxD2DContext); +}; + +//----------------------------------------------------------------------------- +// wxD2DContext implementation +//----------------------------------------------------------------------------- + +wxD2DContext::wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HWND hwnd) : + wxGraphicsContext(renderer), m_direct2dFactory(direct2dFactory), +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + m_renderTargetHolder(new wxD2DDeviceContextResourceHolder(direct2dFactory, hwnd)) +#else + m_renderTargetHolder(new wxD2DHwndRenderTargetResourceHolder(hwnd, direct2dFactory)) +#endif +{ + Init(); +} + +wxD2DContext::wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, HDC hdc, const wxSize& dcSize) : + wxGraphicsContext(renderer), m_direct2dFactory(direct2dFactory), + m_renderTargetHolder(new wxD2DDCRenderTargetResourceHolder(direct2dFactory, hdc, dcSize)) +{ + Init(); +} + +#if wxUSE_IMAGE +wxD2DContext::wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, wxImage& image) : + wxGraphicsContext(renderer), m_direct2dFactory(direct2dFactory), + m_renderTargetHolder(new wxD2DImageRenderTargetResourceHolder(&image, direct2dFactory)) +{ + Init(); +} +#endif // wxUSE_IMAGE + +wxD2DContext::wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, void* nativeContext) : + wxGraphicsContext(renderer), m_direct2dFactory(direct2dFactory) +{ + m_renderTargetHolder = *((wxSharedPtr*)nativeContext); + Init(); +} + +void wxD2DContext::Init() +{ + m_cachedRenderTarget = NULL; + m_clipMode = CLIP_MODE_NONE; + m_composition = wxCOMPOSITION_OVER; + m_clipLayerAcquired = false; + m_renderTargetHolder->Bind(this); + m_enableOffset = true; + EnsureInitialized(); +} + +wxD2DContext::~wxD2DContext() +{ + ResetClip(); + + while (!m_layers.empty()) + { + EndLayer(); + } + + HRESULT result = GetRenderTarget()->EndDraw(); + wxCHECK_HRESULT_RET(result); + + ReleaseResources(); +} + +ID2D1RenderTarget* wxD2DContext::GetRenderTarget() const +{ + return m_cachedRenderTarget; +} + +void wxD2DContext::Clip(const wxRegion& region) +{ + GetRenderTarget()->Flush(); + ResetClip(); + + wxCOMPtr clipGeometry = wxD2DConvertRegionToGeometry(m_direct2dFactory, region); + + if (!m_clipLayerAcquired) + { + GetRenderTarget()->CreateLayer(&m_clipLayer); + m_clipLayerAcquired = true; + } + + GetRenderTarget()->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), clipGeometry), m_clipLayer); + + m_clipMode = CLIP_MODE_GEOMETRY; +} + +void wxD2DContext::Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + GetRenderTarget()->Flush(); + ResetClip(); + + GetRenderTarget()->PushAxisAlignedClip( + D2D1::RectF(x, y, x + w, y + h), + D2D1_ANTIALIAS_MODE_ALIASED); + + m_clipMode = CLIP_MODE_AXIS_ALIGNED_RECTANGLE; +} + +void wxD2DContext::ResetClip() +{ + if (m_clipMode == CLIP_MODE_AXIS_ALIGNED_RECTANGLE) + { + GetRenderTarget()->PopAxisAlignedClip(); + } + + if (m_clipMode == CLIP_MODE_GEOMETRY) + { + GetRenderTarget()->PopLayer(); + } + + m_clipMode = CLIP_MODE_NONE; +} + +void* wxD2DContext::GetNativeContext() +{ + return &m_renderTargetHolder; +} + +void wxD2DContext::StrokePath(const wxGraphicsPath& p) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DOffsetHelper helper(this); + + EnsureInitialized(); + AdjustRenderTargetSize(); + + wxD2DPathData* pathData = wxGetD2DPathData(p); + pathData->Flush(); + + if (!m_pen.IsNull()) + { + wxD2DPenData* penData = wxGetD2DPenData(m_pen); + penData->Bind(this); + ID2D1Brush* nativeBrush = penData->GetBrush(); + GetRenderTarget()->DrawGeometry((ID2D1Geometry*)pathData->GetNativePath(), nativeBrush, penData->GetWidth(), penData->GetStrokeStyle()); + } +} + +void wxD2DContext::FillPath(const wxGraphicsPath& p , wxPolygonFillMode WXUNUSED(fillStyle)) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + EnsureInitialized(); + AdjustRenderTargetSize(); + + wxD2DPathData* pathData = wxGetD2DPathData(p); + pathData->Flush(); + + if (!m_brush.IsNull()) + { + wxD2DBrushData* brushData = wxGetD2DBrushData(m_brush); + brushData->Bind(this); + GetRenderTarget()->FillGeometry((ID2D1Geometry*)pathData->GetNativePath(), brushData->GetBrush()); + } +} + +bool wxD2DContext::SetAntialiasMode(wxAntialiasMode antialias) +{ + if (m_antialias == antialias) + { + return true; + } + + GetRenderTarget()->SetAntialiasMode(wxD2DConvertAntialiasMode(antialias)); + + m_antialias = antialias; + return true; +} + +bool wxD2DContext::SetInterpolationQuality(wxInterpolationQuality interpolation) +{ + // Since different versions of Direct2D have different enumerations for + // interpolation quality, we deffer the conversion to the method which + // does the actual drawing. + + m_interpolation = interpolation; + return true; +} + +bool wxD2DContext::SetCompositionMode(wxCompositionMode compositionMode) +{ + if (m_composition == compositionMode) + return true; + + if (m_renderTargetHolder->SetCompositionMode(compositionMode)) + { + // the composition mode is supported by the render target + m_composition = compositionMode; + return true; + } + + return false; +} + +void wxD2DContext::BeginLayer(wxDouble opacity) +{ + wxCOMPtr layer; + GetRenderTarget()->CreateLayer(&layer); + m_layers.push(layer); + + GetRenderTarget()->PushLayer( + D2D1::LayerParameters(D2D1::InfiniteRect(), + NULL, + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + D2D1::IdentityMatrix(), opacity), + layer); +} + +void wxD2DContext::EndLayer() +{ + if (!m_layers.empty()) + { + wxCOMPtr topLayer = m_layers.top(); + + GetRenderTarget()->PopLayer(); + + HRESULT hr = GetRenderTarget()->Flush(); + wxCHECK_HRESULT_RET(hr); + + m_layers.pop(); + } +} + +void wxD2DContext::Translate(wxDouble dx, wxDouble dy) +{ + wxGraphicsMatrix translationMatrix = CreateMatrix(); + translationMatrix.Translate(dx, dy); + ConcatTransform(translationMatrix); +} + +void wxD2DContext::Scale(wxDouble xScale, wxDouble yScale) +{ + wxGraphicsMatrix scaleMatrix = CreateMatrix(); + scaleMatrix.Scale(xScale, yScale); + ConcatTransform(scaleMatrix); +} + +void wxD2DContext::Rotate(wxDouble angle) +{ + wxGraphicsMatrix rotationMatrix = CreateMatrix(); + rotationMatrix.Rotate(angle); + ConcatTransform(rotationMatrix); +} + +void wxD2DContext::ConcatTransform(const wxGraphicsMatrix& matrix) +{ + D2D1::Matrix3x2F localMatrix = wxGetD2DMatrixData(GetTransform())->GetMatrix3x2F(); + D2D1::Matrix3x2F concatMatrix = wxGetD2DMatrixData(matrix)->GetMatrix3x2F(); + + D2D1::Matrix3x2F resultMatrix; + resultMatrix.SetProduct(concatMatrix, localMatrix); + + wxGraphicsMatrix resultTransform; + resultTransform.SetRefData(new wxD2DMatrixData(GetRenderer(), resultMatrix)); + + SetTransform(resultTransform); +} + +void wxD2DContext::SetTransform(const wxGraphicsMatrix& matrix) +{ + EnsureInitialized(); + + GetRenderTarget()->SetTransform(wxGetD2DMatrixData(matrix)->GetMatrix3x2F()); +} + +wxGraphicsMatrix wxD2DContext::GetTransform() const +{ + D2D1::Matrix3x2F transformMatrix; + + if (GetRenderTarget() != NULL) + { + GetRenderTarget()->GetTransform(&transformMatrix); + } + else + { + transformMatrix = D2D1::Matrix3x2F::Identity(); + } + + wxD2DMatrixData* matrixData = new wxD2DMatrixData(GetRenderer(), transformMatrix); + + wxGraphicsMatrix matrix; + matrix.SetRefData(matrixData); + + return matrix; +} + +void wxD2DContext::DrawBitmap(const wxGraphicsBitmap& bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DBitmapData* bitmapData = wxGetD2DBitmapData(bmp); + bitmapData->Bind(this); + + m_renderTargetHolder->DrawBitmap( + bitmapData->GetD2DBitmap(), + D2D1::Point2F(x, y), + D2D1::RectF(0, 0, w, h), + GetInterpolationQuality(), + GetCompositionMode()); +} + +void wxD2DContext::DrawBitmap(const wxBitmap& bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + wxGraphicsBitmap graphicsBitmap = CreateBitmap(bmp); + DrawBitmap(graphicsBitmap, x, y, w, h); +} + +void wxD2DContext::DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + DrawBitmap(wxBitmap(icon), x, y, w, h); +} + +void wxD2DContext::PushState() +{ + ID2D1Factory* wxGetD2DFactory(wxGraphicsRenderer* renderer); + + wxCOMPtr drawStateBlock; + wxGetD2DFactory(GetRenderer())->CreateDrawingStateBlock(&drawStateBlock); + GetRenderTarget()->SaveDrawingState(drawStateBlock); + + m_stateStack.push(drawStateBlock); +} + +void wxD2DContext::PopState() +{ + wxCHECK_RET(!m_stateStack.empty(), wxT("No state to pop")); + + wxCOMPtr drawStateBlock = m_stateStack.top(); + m_stateStack.pop(); + + GetRenderTarget()->RestoreDrawingState(drawStateBlock); +} + +void wxD2DContext::GetTextExtent( + const wxString& str, + wxDouble* width, + wxDouble* height, + wxDouble* descent, + wxDouble* externalLeading) const +{ + wxD2DMeasuringContext::GetTextExtent( + wxGetD2DFontData(m_font), str, width, height, descent, externalLeading); +} + +void wxD2DContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const +{ + return wxD2DMeasuringContext::GetPartialTextExtents( + wxGetD2DFontData(m_font), text, widths); +} + +bool wxD2DContext::ShouldOffset() const +{ + if (!m_enableOffset) + { + return false; + } + + int penWidth = 0; + if (!m_pen.IsNull()) + { + penWidth = wxGetD2DPenData(m_pen)->GetWidth(); + penWidth = std::max(penWidth, 1); + } + + return (penWidth % 2) == 1; +} + +void wxD2DContext::DoDrawText(const wxString& str, wxDouble x, wxDouble y) +{ + wxCHECK_RET(!m_font.IsNull(), + wxT("wxGDIPlusContext::DrawText - no valid font set")); + + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DFontData* fontData = wxGetD2DFontData(m_font); + fontData->GetBrushData().Bind(this); + + wxCOMPtr textLayout = fontData->CreateTextLayout(str); + + // Render the text + GetRenderTarget()->DrawTextLayout( + D2D1::Point2F(x, y), + textLayout, + fontData->GetBrushData().GetBrush()); +} + +void wxD2DContext::EnsureInitialized() +{ + if (!m_renderTargetHolder->IsResourceAcquired()) + { + m_cachedRenderTarget = m_renderTargetHolder->GetD2DResource(); + GetRenderTarget()->SetTransform(D2D1::Matrix3x2F::Identity()); + GetRenderTarget()->BeginDraw(); + } + else + { + m_cachedRenderTarget = m_renderTargetHolder->GetD2DResource(); + } +} + +void wxD2DContext::SetPen(const wxGraphicsPen& pen) +{ + wxGraphicsContext::SetPen(pen); + + if (!m_pen.IsNull()) + { + EnsureInitialized(); + + wxD2DPenData* penData = wxGetD2DPenData(pen); + penData->Bind(this); + } +} + +void wxD2DContext::AdjustRenderTargetSize() +{ + m_renderTargetHolder->Resize(); + + // Currently GetSize() can only be called when using MSVC because gcc + // doesn't handle returning aggregates by value as done by D2D libraries, + // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64384. Not updating the + // size is not great, but it's better than crashing. +#ifdef __VISUALC__ + D2D1_SIZE_F renderTargetSize = m_renderTargetHolder->GetD2DResource()->GetSize(); + m_width = renderTargetSize.width; + m_height = renderTargetSize.height; +#endif // __VISUALC__ +} + +void wxD2DContext::ReleaseDeviceDependentResources() +{ + ReleaseResources(); + + m_clipLayer.reset(); + m_clipLayerAcquired = false; +} + +void wxD2DContext::DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DOffsetHelper helper(this); + + EnsureInitialized(); + AdjustRenderTargetSize(); + + D2D1_RECT_F rect = { (FLOAT)x, (FLOAT)y, (FLOAT)(x + w), (FLOAT)(y + h) }; + + + if (!m_brush.IsNull()) + { + wxD2DBrushData* brushData = wxGetD2DBrushData(m_brush); + brushData->Bind(this); + GetRenderTarget()->FillRectangle(rect, brushData->GetBrush()); + } + + if (!m_pen.IsNull()) + { + wxD2DPenData* penData = wxGetD2DPenData(m_pen); + penData->Bind(this); + GetRenderTarget()->DrawRectangle(rect, penData->GetBrush(), penData->GetWidth(), penData->GetStrokeStyle()); + } +} + +void wxD2DContext::DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DOffsetHelper helper(this); + + EnsureInitialized(); + AdjustRenderTargetSize(); + + D2D1_RECT_F rect = { (FLOAT)x, (FLOAT)y, (FLOAT)(x + w), (FLOAT)(y + h) }; + + D2D1_ROUNDED_RECT roundedRect = { rect, (FLOAT)radius, (FLOAT)radius }; + + if (!m_brush.IsNull()) + { + wxD2DBrushData* brushData = wxGetD2DBrushData(m_brush); + brushData->Bind(this); + GetRenderTarget()->FillRoundedRectangle(roundedRect, brushData->GetBrush()); + } + + if (!m_pen.IsNull()) + { + wxD2DPenData* penData = wxGetD2DPenData(m_pen); + penData->Bind(this); + GetRenderTarget()->DrawRoundedRectangle(roundedRect, penData->GetBrush(), penData->GetWidth(), penData->GetStrokeStyle()); + } +} + +void wxD2DContext::DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + if (m_composition == wxCOMPOSITION_DEST) + return; + + wxD2DOffsetHelper helper(this); + + EnsureInitialized(); + AdjustRenderTargetSize(); + + D2D1_ELLIPSE ellipse = { + { (FLOAT)(x + w / 2), (FLOAT)(y + h / 2) }, // center point + (FLOAT)(w / 2), // radius x + (FLOAT)(h / 2) // radius y + }; + + if (!m_brush.IsNull()) + { + wxD2DBrushData* brushData = wxGetD2DBrushData(m_brush); + brushData->Bind(this); + GetRenderTarget()->FillEllipse(ellipse, brushData->GetBrush()); + } + + if (!m_pen.IsNull()) + { + wxD2DPenData* penData = wxGetD2DPenData(m_pen); + penData->Bind(this); + GetRenderTarget()->DrawEllipse(ellipse, penData->GetBrush(), penData->GetWidth(), penData->GetStrokeStyle()); + } +} + +void wxD2DContext::Flush() +{ + HRESULT result = m_renderTargetHolder->Flush(); + + if (result == (HRESULT)D2DERR_RECREATE_TARGET) + { + ReleaseDeviceDependentResources(); + } +} + +void wxD2DContext::GetDPI(wxDouble* dpiX, wxDouble* dpiY) +{ + FLOAT x, y; + GetRenderTarget()->GetDpi(&x, &y); + if (dpiX != NULL) *dpiX = x; + if (dpiY != NULL) *dpiY = y; +} + +//----------------------------------------------------------------------------- +// wxD2DRenderer declaration +//----------------------------------------------------------------------------- + +class wxD2DRenderer : public wxGraphicsRenderer +{ +public : + wxD2DRenderer(); + + virtual ~wxD2DRenderer(); + + wxGraphicsContext* CreateContext(const wxWindowDC& dc) wxOVERRIDE; + + wxGraphicsContext* CreateContext(const wxMemoryDC& dc) wxOVERRIDE; + +#if wxUSE_PRINTING_ARCHITECTURE + wxGraphicsContext* CreateContext(const wxPrinterDC& dc) wxOVERRIDE; +#endif + +#if wxUSE_ENH_METAFILE + wxGraphicsContext* CreateContext(const wxEnhMetaFileDC& dc) wxOVERRIDE; +#endif + + wxGraphicsContext* CreateContextFromNativeContext(void* context) wxOVERRIDE; + + wxGraphicsContext* CreateContextFromNativeWindow(void* window) wxOVERRIDE; + + wxGraphicsContext* CreateContext(wxWindow* window) wxOVERRIDE; + +#if wxUSE_IMAGE + wxGraphicsContext* CreateContextFromImage(wxImage& image) wxOVERRIDE; +#endif // wxUSE_IMAGE + + wxGraphicsContext* CreateMeasuringContext() wxOVERRIDE; + + wxGraphicsPath CreatePath() wxOVERRIDE; + + wxGraphicsMatrix CreateMatrix( + wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0, wxDouble d = 1.0, + wxDouble tx = 0.0, wxDouble ty = 0.0) wxOVERRIDE; + + wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE; + + wxGraphicsBrush CreateBrush(const wxBrush& brush) wxOVERRIDE; + + wxGraphicsBrush CreateLinearGradientBrush( + wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops) wxOVERRIDE; + + wxGraphicsBrush CreateRadialGradientBrush( + wxDouble xo, wxDouble yo, + wxDouble xc, wxDouble yc, + wxDouble radius, + const wxGraphicsGradientStops& stops) wxOVERRIDE; + + // create a native bitmap representation + wxGraphicsBitmap CreateBitmap(const wxBitmap& bitmap) wxOVERRIDE; + +#if wxUSE_IMAGE + wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) wxOVERRIDE; + wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) wxOVERRIDE; +#endif + + wxGraphicsFont CreateFont(const wxFont& font, const wxColour& col) wxOVERRIDE; + + wxGraphicsFont CreateFont( + double size, const wxString& facename, + int flags = wxFONTFLAG_DEFAULT, + const wxColour& col = *wxBLACK) wxOVERRIDE; + + // create a graphics bitmap from a native bitmap + wxGraphicsBitmap CreateBitmapFromNativeBitmap(void* bitmap) wxOVERRIDE; + + // create a sub-image from a native image representation + wxGraphicsBitmap CreateSubBitmap(const wxGraphicsBitmap& bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; + + wxString GetName() const wxOVERRIDE; + void GetVersion(int* major, int* minor, int* micro) const wxOVERRIDE; + + ID2D1Factory* GetD2DFactory(); + +private: + wxCOMPtr m_direct2dFactory; + +private : + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxD2DRenderer); +}; + +//----------------------------------------------------------------------------- +// wxD2DRenderer implementation +//----------------------------------------------------------------------------- + +wxIMPLEMENT_DYNAMIC_CLASS(wxD2DRenderer,wxGraphicsRenderer); + +static wxD2DRenderer *gs_D2DRenderer = NULL; + +wxGraphicsRenderer* wxGraphicsRenderer::GetDirect2DRenderer() +{ + if (!wxDirect2D::Initialize()) + return NULL; + + if (!gs_D2DRenderer) + { + gs_D2DRenderer = new wxD2DRenderer(); + } + + return gs_D2DRenderer; +} + +wxD2DRenderer::wxD2DRenderer() +{ + + HRESULT result; + result = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_direct2dFactory); + + if (FAILED(result)) + { + wxFAIL_MSG("Could not create Direct2D Factory."); + } +} + +wxD2DRenderer::~wxD2DRenderer() +{ + m_direct2dFactory.reset(); +} + +wxGraphicsContext* wxD2DRenderer::CreateContext(const wxWindowDC& dc) +{ + int width, height; + dc.GetSize(&width, &height); + + return new wxD2DContext(this, m_direct2dFactory, dc.GetHDC(), wxSize(width, height)); +} + +wxGraphicsContext* wxD2DRenderer::CreateContext(const wxMemoryDC& dc) +{ + int width, height; + dc.GetSize(&width, &height); + + return new wxD2DContext(this, m_direct2dFactory, dc.GetHDC(), wxSize(width, height)); +} + +#if wxUSE_PRINTING_ARCHITECTURE +wxGraphicsContext* wxD2DRenderer::CreateContext(const wxPrinterDC& WXUNUSED(dc)) +{ + wxFAIL_MSG("not implemented"); + return NULL; +} +#endif + +#if wxUSE_ENH_METAFILE +wxGraphicsContext* wxD2DRenderer::CreateContext(const wxEnhMetaFileDC& WXUNUSED(dc)) +{ + wxFAIL_MSG("not implemented"); + return NULL; +} +#endif + +wxGraphicsContext* wxD2DRenderer::CreateContextFromNativeContext(void* nativeContext) +{ + return new wxD2DContext(this, m_direct2dFactory, nativeContext); +} + +wxGraphicsContext* wxD2DRenderer::CreateContextFromNativeWindow(void* window) +{ + return new wxD2DContext(this, m_direct2dFactory, (HWND)window); +} + +wxGraphicsContext* wxD2DRenderer::CreateContext(wxWindow* window) +{ + return new wxD2DContext(this, m_direct2dFactory, (HWND)window->GetHWND()); +} + +#if wxUSE_IMAGE +wxGraphicsContext* wxD2DRenderer::CreateContextFromImage(wxImage& image) +{ + return new wxD2DContext(this, m_direct2dFactory, image); +} +#endif // wxUSE_IMAGE + +wxGraphicsContext* wxD2DRenderer::CreateMeasuringContext() +{ + return new wxD2DMeasuringContext(this); +} + +wxGraphicsPath wxD2DRenderer::CreatePath() +{ + wxGraphicsPath p; + p.SetRefData(new wxD2DPathData(this, m_direct2dFactory)); + + return p; +} + +wxGraphicsMatrix wxD2DRenderer::CreateMatrix( + wxDouble a, wxDouble b, wxDouble c, wxDouble d, + wxDouble tx, wxDouble ty) +{ + wxD2DMatrixData* matrixData = new wxD2DMatrixData(this); + matrixData->Set(a, b, c, d, tx, ty); + + wxGraphicsMatrix matrix; + matrix.SetRefData(matrixData); + + return matrix; +} + +wxGraphicsPen wxD2DRenderer::CreatePen(const wxPen& pen) +{ + if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) + { + return wxNullGraphicsPen; + } + else + { + wxGraphicsPen p; + wxD2DPenData* penData = new wxD2DPenData(this, m_direct2dFactory, pen); + p.SetRefData(penData); + return p; + } +} + +wxGraphicsBrush wxD2DRenderer::CreateBrush(const wxBrush& brush) +{ + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) + { + return wxNullGraphicsBrush; + } + else + { + wxGraphicsBrush b; + b.SetRefData(new wxD2DBrushData(this, brush)); + return b; + } +} + +wxGraphicsBrush wxD2DRenderer::CreateLinearGradientBrush( + wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, + const wxGraphicsGradientStops& stops) +{ + wxD2DBrushData* brushData = new wxD2DBrushData(this); + brushData->CreateLinearGradientBrush(x1, y1, x2, y2, stops); + + wxGraphicsBrush brush; + brush.SetRefData(brushData); + + return brush; +} + +wxGraphicsBrush wxD2DRenderer::CreateRadialGradientBrush( + wxDouble xo, wxDouble yo, + wxDouble xc, wxDouble yc, + wxDouble radius, + const wxGraphicsGradientStops& stops) +{ + wxD2DBrushData* brushData = new wxD2DBrushData(this); + brushData->CreateRadialGradientBrush(xo, yo, xc, yc, radius, stops); + + wxGraphicsBrush brush; + brush.SetRefData(brushData); + + return brush; +} + +// create a native bitmap representation +wxGraphicsBitmap wxD2DRenderer::CreateBitmap(const wxBitmap& bitmap) +{ + wxD2DBitmapData* bitmapData = new wxD2DBitmapData(this, bitmap); + + wxGraphicsBitmap graphicsBitmap; + graphicsBitmap.SetRefData(bitmapData); + + return graphicsBitmap; +} + +// create a graphics bitmap from a native bitmap +wxGraphicsBitmap wxD2DRenderer::CreateBitmapFromNativeBitmap(void* bitmap) +{ + wxD2DBitmapData* bitmapData = new wxD2DBitmapData(this, bitmap); + + wxGraphicsBitmap graphicsBitmap; + graphicsBitmap.SetRefData(bitmapData); + + return graphicsBitmap; +} + +#if wxUSE_IMAGE +wxGraphicsBitmap wxD2DRenderer::CreateBitmapFromImage(const wxImage& image) +{ + return CreateBitmap(wxBitmap(image)); +} + +wxImage wxD2DRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp) +{ + return static_cast(bmp.GetNativeBitmap()) + ->GetSourceBitmap().ConvertToImage(); +} +#endif + +wxGraphicsFont wxD2DRenderer::CreateFont(const wxFont& font, const wxColour& col) +{ + wxD2DFontData* fontData = new wxD2DFontData(this, GetD2DFactory(), font, col); + + wxGraphicsFont graphicsFont; + graphicsFont.SetRefData(fontData); + + return graphicsFont; +} + +wxGraphicsFont wxD2DRenderer::CreateFont( + double size, const wxString& facename, + int flags, + const wxColour& col) +{ + return CreateFont( + wxFontInfo(size).AllFlags(flags).FaceName(facename), + col); +} + +// create a sub-image from a native image representation +wxGraphicsBitmap wxD2DRenderer::CreateSubBitmap(const wxGraphicsBitmap& bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h) +{ + typedef wxD2DBitmapData::NativeType* NativeBitmap; + wxBitmap sourceBitmap = static_cast(bitmap.GetNativeBitmap())->GetSourceBitmap(); + return CreateBitmap(sourceBitmap.GetSubBitmap(wxRect(x, y, w, h))); +} + +wxString wxD2DRenderer::GetName() const +{ + return "direct2d"; +} + +void wxD2DRenderer::GetVersion(int* major, int* minor, int* micro) const +{ + if (wxDirect2D::HasDirect2DSupport()) + { + if (major) + *major = 1; + + if (minor) + { + switch(wxDirect2D::GetDirect2DVersion()) + { + case wxDirect2D::wxD2D_VERSION_1_0: + *minor = 0; + break; + case wxDirect2D::wxD2D_VERSION_1_1: + *minor = 1; + break; + case wxDirect2D::wxD2D_VERSION_NONE: + // This is not supposed to happen, but we handle this value in + // the switch to ensure that we'll get warnings if any new + // values, not handled here, are added to the enum later. + *minor = -1; + break; + } + } + + if (micro) + *micro = 0; + } +} + +ID2D1Factory* wxD2DRenderer::GetD2DFactory() +{ + return m_direct2dFactory; +} + +ID2D1Factory* wxGetD2DFactory(wxGraphicsRenderer* renderer) +{ + return static_cast(renderer)->GetD2DFactory(); +} + +// ---------------------------------------------------------------------------- +// Module ensuring all global/singleton objects are destroyed on shutdown. +// ---------------------------------------------------------------------------- + +class wxDirect2DModule : public wxModule +{ +public: + wxDirect2DModule() + { + } + + virtual bool OnInit() wxOVERRIDE + { + HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + // RPC_E_CHANGED_MODE is not considered as an error + // - see remarks for wxOleInitialize(). + return SUCCEEDED(hr) || hr == RPC_E_CHANGED_MODE; + } + + virtual void OnExit() wxOVERRIDE + { + if ( gs_WICImagingFactory ) + { + gs_WICImagingFactory->Release(); + gs_WICImagingFactory = NULL; + } + + if ( gs_IDWriteFactory ) + { + gs_IDWriteFactory->Release(); + gs_IDWriteFactory = NULL; + } + + if ( gs_D2DRenderer ) + { + delete gs_D2DRenderer; + gs_D2DRenderer = NULL; + } + + ::CoUninitialize(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxDirect2DModule); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(wxDirect2DModule, wxModule); + + +#endif // wxUSE_GRAPHICS_DIRECT2D diff --git a/Externals/wxWidgets3/src/msw/headerctrl.cpp b/Externals/wxWidgets3/src/msw/headerctrl.cpp index 1fdebf74d8..359324b439 100644 --- a/Externals/wxWidgets3/src/msw/headerctrl.cpp +++ b/Externals/wxWidgets3/src/msw/headerctrl.cpp @@ -90,7 +90,7 @@ bool wxHeaderCtrl::Create(wxWindow *parent, // use 0 here but this starts to look ugly) if ( wxApp::GetComCtl32Version() >= 600 ) { - Header_SetBitmapMargin(GetHwnd(), ::GetSystemMetrics(SM_CXEDGE)); + (void)Header_SetBitmapMargin(GetHwnd(), ::GetSystemMetrics(SM_CXEDGE)); } return true; @@ -237,7 +237,8 @@ void wxHeaderCtrl::DoUpdate(unsigned int idx) if ( !m_isHidden[idx] ) { // but it wasn't hidden before, so remove it - Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)); + if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) + wxLogLastError(wxS("Header_DeleteItem()")); m_isHidden[idx] = true; } @@ -252,7 +253,8 @@ void wxHeaderCtrl::DoUpdate(unsigned int idx) else // and it was shown before as well { // we need to remove the old column - Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)); + if ( !Header_DeleteItem(GetHwnd(), MSWToNativeIdx(idx)) ) + wxLogLastError(wxS("Header_DeleteItem()")); } DoInsertItem(col, idx); diff --git a/Externals/wxWidgets3/src/msw/helpbest.cpp b/Externals/wxWidgets3/src/msw/helpbest.cpp index f9f811c6b9..0254261610 100644 --- a/Externals/wxWidgets3/src/msw/helpbest.cpp +++ b/Externals/wxWidgets3/src/msw/helpbest.cpp @@ -28,7 +28,7 @@ #include "wx/html/helpctrl.h" #include "wx/msw/helpbest.h" -IMPLEMENT_DYNAMIC_CLASS( wxBestHelpController, wxHelpControllerBase ) +wxIMPLEMENT_DYNAMIC_CLASS(wxBestHelpController, wxHelpControllerBase); bool wxBestHelpController::Initialize( const wxString& filename ) { diff --git a/Externals/wxWidgets3/src/msw/helpchm.cpp b/Externals/wxWidgets3/src/msw/helpchm.cpp index 8fa798a2a5..f948f56d51 100644 --- a/Externals/wxWidgets3/src/msw/helpchm.cpp +++ b/Externals/wxWidgets3/src/msw/helpchm.cpp @@ -36,10 +36,10 @@ // ---------------------------------------------------------------------------- #ifndef UNICODE - typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCSTR, UINT, DWORD ); + typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCSTR, UINT, ULONG_PTR ); #define HTMLHELP_NAME wxT("HtmlHelpA") #else // ANSI - typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCWSTR, UINT, DWORD ); + typedef HWND ( WINAPI * HTMLHELP )( HWND, LPCWSTR, UINT, ULONG_PTR ); #define HTMLHELP_NAME wxT("HtmlHelpW") #endif @@ -79,7 +79,7 @@ static HWND GetSuitableHWND(wxWindow *win) } -IMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase); bool wxCHMHelpController::Initialize(const wxString& filename) { diff --git a/Externals/wxWidgets3/src/msw/helpwin.cpp b/Externals/wxWidgets3/src/msw/helpwin.cpp index 766749edf4..9b177bbff3 100644 --- a/Externals/wxWidgets3/src/msw/helpwin.cpp +++ b/Externals/wxWidgets3/src/msw/helpwin.cpp @@ -41,7 +41,7 @@ static HWND GetSuitableHWND(wxWinHelpController* controller) return GetDesktopWindow(); } -IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase); bool wxWinHelpController::Initialize(const wxString& filename) { diff --git a/Externals/wxWidgets3/src/msw/icon.cpp b/Externals/wxWidgets3/src/msw/icon.cpp index 77e72efad4..078d2d1cfb 100644 --- a/Externals/wxWidgets3/src/msw/icon.cpp +++ b/Externals/wxWidgets3/src/msw/icon.cpp @@ -38,7 +38,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject); // ============================================================================ // implementation @@ -52,9 +52,7 @@ void wxIconRefData::Free() { if ( m_hIcon ) { -#ifndef __WXMICROWIN__ ::DestroyIcon((HICON) m_hIcon); -#endif m_hIcon = 0; } @@ -113,7 +111,6 @@ wxObjectRefData *wxIcon::CloneRefData(const wxObjectRefData *dataOrig) const void wxIcon::CopyFromBitmap(const wxBitmap& bmp) { -#ifndef __WXMICROWIN__ HICON hicon = wxBitmapToHICON(bmp); if ( !hicon ) { @@ -124,7 +121,6 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp) SetHICON((WXHICON)hicon); SetSize(bmp.GetWidth(), bmp.GetHeight()); } -#endif // __WXMICROWIN__ } void wxIcon::CreateIconFromXpm(const char* const* data) diff --git a/Externals/wxWidgets3/src/msw/imaglist.cpp b/Externals/wxWidgets3/src/msw/imaglist.cpp index 928a9f6b74..460de7f0c5 100644 --- a/Externals/wxWidgets3/src/msw/imaglist.cpp +++ b/Externals/wxWidgets3/src/msw/imaglist.cpp @@ -24,6 +24,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/msw/wrapcctl.h" // include "properly" #include "wx/window.h" #include "wx/icon.h" @@ -46,7 +47,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject); #define GetHImageList() ((HIMAGELIST)m_hImageList) @@ -69,11 +70,13 @@ static HBITMAP GetMaskForImage(const wxBitmap& bitmap, const wxBitmap& mask); wxImageList::wxImageList() { m_hImageList = 0; + m_size = wxSize(0,0); } // Creates an image list bool wxImageList::Create(int width, int height, bool mask, int initial) { + m_size = wxSize(width, height); UINT flags = 0; // as we want to be able to use 32bpp bitmaps in the image lists, we always @@ -81,13 +84,10 @@ bool wxImageList::Create(int width, int height, bool mask, int initial) // will make the best effort to show the bitmap if we do this resulting in // quite acceptable display while using a lower depth ILC_COLOR constant // (e.g. ILC_COLOR16) shows completely broken bitmaps -#ifdef __WXWINCE__ - flags |= ILC_COLOR; -#else flags |= ILC_COLOR32; -#endif - if ( mask ) + // For comctl32.dll < 6 always use masks as it doesn't support alpha. + if ( mask || wxApp::GetComCtl32Version() < 600 ) flags |= ILC_MASK; // Grow by 1, I guess this is reasonable behaviour most of the time @@ -140,6 +140,7 @@ bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) { HBITMAP hbmp; + bool useMask; #if wxUSE_WXDIB && wxUSE_IMAGE // wxBitmap normally stores alpha in pre-multiplied format but @@ -150,15 +151,35 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) AutoHBITMAP hbmpRelease; if ( bitmap.HasAlpha() ) { - hbmp = wxDIB(bitmap.ConvertToImage(), - wxDIB::PixelFormat_NotPreMultiplied).Detach(); + wxImage img = bitmap.ConvertToImage(); + + // For comctl32.dll < 6 remove alpha channel from image + // to prevent possible interferences with the mask. + if ( wxApp::GetComCtl32Version() < 600 ) + { + img.ClearAlpha(); + useMask = true; + } + else + { + useMask = false; + } + + hbmp = wxDIB(img, wxDIB::PixelFormat_NotPreMultiplied).Detach(); hbmpRelease.Init(hbmp); } else #endif // wxUSE_WXDIB && wxUSE_IMAGE + { hbmp = GetHbitmapOf(bitmap); + useMask = true; + } - AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask)); + // Use mask only if we don't have alpha, the bitmap isn't drawn correctly + // if we use both. + AutoHBITMAP hbmpMask; + if ( useMask ) + hbmpMask.Init(GetMaskForImage(bitmap, mask)); int index = ImageList_Add(GetHImageList(), hbmp, hbmpMask); if ( index == -1 ) @@ -181,8 +202,14 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) AutoHBITMAP hbmpRelease; if ( bitmap.HasAlpha() ) { - hbmp = wxDIB(bitmap.ConvertToImage(), - wxDIB::PixelFormat_NotPreMultiplied).Detach(); + wxImage img = bitmap.ConvertToImage(); + + if ( wxApp::GetComCtl32Version() < 600 ) + { + img.ClearAlpha(); + } + + hbmp = wxDIB(img, wxDIB::PixelFormat_NotPreMultiplied).Detach(); hbmpRelease.Init(hbmp); } else @@ -203,6 +230,19 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) // Adds a bitmap and mask from an icon. int wxImageList::Add(const wxIcon& icon) { + // ComCtl32 prior 6.0 doesn't support images with alpha + // channel so if we have 32-bit icon with transparency + // we need to add it as a wxBitmap via dedicated method + // where alpha channel will be converted to the mask. + if ( wxApp::GetComCtl32Version() < 600 ) + { + wxBitmap bmp(icon); + if ( bmp.HasAlpha() ) + { + return Add(bmp); + } + } + int index = ImageList_AddIcon(GetHImageList(), GetHiconOf(icon)); if ( index == -1 ) { @@ -220,21 +260,38 @@ bool wxImageList::Replace(int index, const wxBitmap& mask) { HBITMAP hbmp; + bool useMask; #if wxUSE_WXDIB && wxUSE_IMAGE // See the comment in Add() above. AutoHBITMAP hbmpRelease; if ( bitmap.HasAlpha() ) { - hbmp = wxDIB(bitmap.ConvertToImage(), - wxDIB::PixelFormat_NotPreMultiplied).Detach(); + wxImage img = bitmap.ConvertToImage(); + + if ( wxApp::GetComCtl32Version() < 600 ) + { + img.ClearAlpha(); + useMask = true; + } + else + { + useMask = false; + } + + hbmp = wxDIB(img, wxDIB::PixelFormat_NotPreMultiplied).Detach(); hbmpRelease.Init(hbmp); } else #endif // wxUSE_WXDIB && wxUSE_IMAGE + { hbmp = GetHbitmapOf(bitmap); + useMask = true; + } - AutoHBITMAP hbmpMask(GetMaskForImage(bitmap, mask)); + AutoHBITMAP hbmpMask; + if ( useMask ) + hbmpMask.Init(GetMaskForImage(bitmap, mask)); if ( !ImageList_Replace(GetHImageList(), index, hbmp, hbmpMask) ) { @@ -248,6 +305,19 @@ bool wxImageList::Replace(int index, // Replaces a bitmap and mask from an icon. bool wxImageList::Replace(int i, const wxIcon& icon) { + // ComCtl32 prior 6.0 doesn't support images with alpha + // channel so if we have 32-bit icon with transparency + // we need to replace it as a wxBitmap via dedicated method + // where alpha channel will be converted to the mask. + if ( wxApp::GetComCtl32Version() < 600 ) + { + wxBitmap bmp(icon); + if ( bmp.HasAlpha() ) + { + return Replace(i, bmp); + } + } + bool ok = ImageList_ReplaceIcon(GetHImageList(), i, GetHiconOf(icon)) != -1; if ( !ok ) { @@ -328,39 +398,58 @@ bool wxImageList::Draw(int index, // Get the bitmap wxBitmap wxImageList::GetBitmap(int index) const { -#if wxUSE_WXDIB && wxUSE_IMAGE int bmp_width = 0, bmp_height = 0; GetSize(index, bmp_width, bmp_height); wxBitmap bitmap(bmp_width, bmp_height); + +#if wxUSE_WXDIB && wxUSE_IMAGE wxMemoryDC dc; dc.SelectObject(bitmap); - // draw it the first time to find a suitable mask colour - ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); - dc.SelectObject(wxNullBitmap); + IMAGEINFO ii; + ImageList_GetImageInfo(GetHImageList(), index, &ii); + if ( ii.hbmMask ) + { + // draw it the first time to find a suitable mask colour + ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + dc.SelectObject(wxNullBitmap); - // find the suitable mask colour - wxImage image = bitmap.ConvertToImage(); - unsigned char r = 0, g = 0, b = 0; - image.FindFirstUnusedColour(&r, &g, &b); + // find the suitable mask colour + wxImage image = bitmap.ConvertToImage(); + unsigned char r = 0, g = 0, b = 0; + image.FindFirstUnusedColour(&r, &g, &b); - // redraw whole image and bitmap in the mask colour - image.Create(bmp_width, bmp_height); - image.Replace(0, 0, 0, r, g, b); - bitmap = wxBitmap(image); + // redraw whole image and bitmap in the mask colour + image.Create(bmp_width, bmp_height); + image.Replace(0, 0, 0, r, g, b); + bitmap = wxBitmap(image); - // redraw icon over the mask colour to actually draw it - dc.SelectObject(bitmap); - ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); - dc.SelectObject(wxNullBitmap); + // redraw icon over the mask colour to actually draw it + dc.SelectObject(bitmap); + ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + dc.SelectObject(wxNullBitmap); - // get the image, set the mask colour and convert back to get transparent bitmap - image = bitmap.ConvertToImage(); - image.SetMaskColour(r, g, b); - bitmap = wxBitmap(image); -#else - wxBitmap bitmap; + // get the image, set the mask colour and convert back to get transparent bitmap + image = bitmap.ConvertToImage(); + image.SetMaskColour(r, g, b); + bitmap = wxBitmap(image); + } + else // no mask + { + // Just draw it normally. + ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL); + dc.SelectObject(wxNullBitmap); + + // And adjust its alpha flag as the destination bitmap would get it if + // the source one had it. + // + // Note that perhaps we could just call UseAlpha() which would set the + // "has alpha" flag unconditionally as it doesn't seem to do any harm, + // but for now only do it if necessary, just to be on the safe side, + // even if it requires more work (and takes more time). + bitmap.MSWUpdateAlpha(); + } #endif return bitmap; } diff --git a/Externals/wxWidgets3/src/msw/iniconf.cpp b/Externals/wxWidgets3/src/msw/iniconf.cpp index 27d11305ec..34748ac826 100644 --- a/Externals/wxWidgets3/src/msw/iniconf.cpp +++ b/Externals/wxWidgets3/src/msw/iniconf.cpp @@ -47,7 +47,7 @@ // ---------------------------------------------------------------------------- // ctor & dtor // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxIniConfig, wxConfigBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxIniConfig, wxConfigBase); wxIniConfig::wxIniConfig(const wxString& strAppName, const wxString& strVendor, diff --git a/Externals/wxWidgets3/src/msw/joystick.cpp b/Externals/wxWidgets3/src/msw/joystick.cpp index 0ea52f7192..c21b41a426 100644 --- a/Externals/wxWidgets3/src/msw/joystick.cpp +++ b/Externals/wxWidgets3/src/msw/joystick.cpp @@ -26,12 +26,10 @@ #include "wx/msw/private.h" -#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) - #include -#endif +#include // Why doesn't BC++ have joyGetPosEx? -#if !defined(__WIN32__) || defined(__BORLANDC__) +#if defined(__BORLANDC__) #define NO_JOYGETPOSEX #endif @@ -39,7 +37,7 @@ #include -IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject); // Attributes //////////////////////////////////////////////////////////////////////////// @@ -410,41 +408,29 @@ int wxJoystick::GetNumberButtons() const int wxJoystick::GetNumberAxes() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wNumAxes; -#else - return 0; -#endif } int wxJoystick::GetMaxButtons() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wMaxButtons; -#else - return 0; -#endif } int wxJoystick::GetMaxAxes() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wMaxAxes; -#else - return 0; -#endif } int wxJoystick::GetPollingMin() const @@ -467,172 +453,120 @@ int wxJoystick::GetPollingMax() const int wxJoystick::GetRudderMin() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wRmin; -#else - return 0; -#endif } int wxJoystick::GetRudderMax() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wRmax; -#else - return 0; -#endif } int wxJoystick::GetUMin() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wUmin; -#else - return 0; -#endif } int wxJoystick::GetUMax() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wUmax; -#else - return 0; -#endif } int wxJoystick::GetVMin() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wVmin; -#else - return 0; -#endif } int wxJoystick::GetVMax() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; else return joyCaps.wVmax; -#else - return 0; -#endif } bool wxJoystick::HasRudder() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_HASR) == JOYCAPS_HASR); -#else - return false; -#endif } bool wxJoystick::HasZ() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_HASZ) == JOYCAPS_HASZ); -#else - return false; -#endif } bool wxJoystick::HasU() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_HASU) == JOYCAPS_HASU); -#else - return false; -#endif } bool wxJoystick::HasV() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_HASV) == JOYCAPS_HASV); -#else - return false; -#endif } bool wxJoystick::HasPOV() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_HASPOV) == JOYCAPS_HASPOV); -#else - return false; -#endif } bool wxJoystick::HasPOV4Dir() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_POV4DIR) == JOYCAPS_POV4DIR); -#else - return false; -#endif } bool wxJoystick::HasPOVCTS() const { -#if defined(__WIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return false; else return ((joyCaps.wCaps & JOYCAPS_POVCTS) == JOYCAPS_POVCTS); -#else - return false; -#endif } // Operations diff --git a/Externals/wxWidgets3/src/msw/listbox.cpp b/Externals/wxWidgets3/src/msw/listbox.cpp index 4a452a16bf..a99c1ff7e6 100644 --- a/Externals/wxWidgets3/src/msw/listbox.cpp +++ b/Externals/wxWidgets3/src/msw/listbox.cpp @@ -25,6 +25,7 @@ #include "wx/brush.h" #include "wx/font.h" #include "wx/dc.h" + #include "wx/dcclient.h" #include "wx/utils.h" #include "wx/log.h" #include "wx/window.h" @@ -37,7 +38,13 @@ #if wxUSE_OWNER_DRAWN #include "wx/ownerdrw.h" -#endif + + namespace + { + // space beneath/above each row in pixels + const int LISTBOX_EXTRA_SPACE = 1; + } // anonymous namespace +#endif // wxUSE_OWNER_DRAWN // ============================================================================ // list box item declaration and implementation @@ -170,7 +177,7 @@ WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const if ( m_windowStyle & wxLB_SORT ) msStyle |= LBS_SORT; -#if wxUSE_OWNER_DRAWN && !defined(__WXWINCE__) +#if wxUSE_OWNER_DRAWN if ( m_windowStyle & wxLB_OWNERDRAW ) { // we don't support LBS_OWNERDRAWVARIABLE yet and we also always put @@ -214,6 +221,54 @@ void wxListBox::MSWOnItemsChanged() // implementation of wxListBoxBase methods // ---------------------------------------------------------------------------- +void wxListBox::EnsureVisible(int n) +{ + wxCHECK_RET( IsValid(n), + wxT("invalid index in wxListBox::EnsureVisible") ); + + // when item is before the first visible item, make the item the first visible item + const int firstItem = SendMessage(GetHwnd(), LB_GETTOPINDEX, 0, 0); + if ( n <= firstItem ) + { + DoSetFirstItem(n); + return; + } + + // retrieve item height in order to compute last visible item and scroll amount + const int itemHeight = SendMessage(GetHwnd(), LB_GETITEMHEIGHT, 0, 0); + if ( itemHeight == LB_ERR || itemHeight == 0) + return; + + // compute the amount of fully visible items + int countVisible = GetClientSize().y / itemHeight; + if ( !countVisible ) + countVisible = 1; + + // when item is before the last fully visible item, it is already visible + const int lastItem = firstItem + countVisible - 1; + if ( n <= lastItem ) + return; + + // make the item the last visible item by setting the first visible item accordingly + DoSetFirstItem(n - countVisible + 1); +} + +int wxListBox::GetTopItem() const +{ + return SendMessage(GetHwnd(), LB_GETTOPINDEX, 0, 0); +} + +int wxListBox::GetCountPerPage() const +{ + const LRESULT lineHeight = SendMessage(GetHwnd(), LB_GETITEMHEIGHT, 0, 0); + if ( lineHeight == LB_ERR || lineHeight == 0 ) + return -1; + + const RECT r = wxGetClientRect(GetHwnd()); + + return (r.bottom - r.top) / lineHeight; +} + void wxListBox::DoSetFirstItem(int N) { wxCHECK_RET( IsValid(N), @@ -642,6 +697,13 @@ bool wxListBox::SetFont(const wxFont &font) const unsigned count = m_aItems.GetCount(); for ( unsigned i = 0; i < count; i++ ) m_aItems[i]->SetFont(font); + + // Non owner drawn list boxes update the item height on their own, but + // we need to do it manually in the owner drawn case. + wxClientDC dc(this); + dc.SetFont(font); + SendMessage(GetHwnd(), LB_SETITEMHEIGHT, 0, + dc.GetCharHeight() + 2 * LISTBOX_EXTRA_SPACE); } wxListBoxBase::SetFont(font); @@ -684,13 +746,6 @@ bool wxListBox::RefreshItem(size_t n) // drawing // ------- -namespace -{ - // space beneath/above each row in pixels - static const int LISTBOX_EXTRA_SPACE = 1; - -} // anonymous namespace - // the height is the same for all items // TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes @@ -703,11 +758,7 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; -#ifdef __WXWINCE__ - HDC hdc = GetDC(NULL); -#else HDC hdc = CreateIC(wxT("DISPLAY"), NULL, NULL, 0); -#endif { wxDCTemp dc((WXHDC)hdc); @@ -717,11 +768,7 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) pStruct->itemWidth = dc.GetCharWidth(); } -#ifdef __WXWINCE__ - ReleaseDC(NULL, hdc); -#else DeleteDC(hdc); -#endif return true; } @@ -738,7 +785,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) if ( pStruct->itemID == (UINT)-1 ) return false; - wxListBoxItem *pItem = (wxListBoxItem *)m_aItems[pStruct->itemID]; + wxOwnerDrawn *pItem = m_aItems[pStruct->itemID]; wxDCTemp dc((WXHDC)pStruct->hDC); diff --git a/Externals/wxWidgets3/src/msw/listctrl.cpp b/Externals/wxWidgets3/src/msw/listctrl.cpp index 0772db7a25..3c0675eb7b 100644 --- a/Externals/wxWidgets3/src/msw/listctrl.cpp +++ b/Externals/wxWidgets3/src/msw/listctrl.cpp @@ -44,24 +44,28 @@ #include "wx/msw/private.h" #include "wx/msw/private/keyboard.h" -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) - #include - #include - #if _WIN32_WCE < 400 - #include - #endif -#endif - -// Currently gcc and watcom don't define NMLVFINDITEM, and DMC only defines +// Currently gcc doesn't define NMLVFINDITEM, and DMC only defines // it by its old name NM_FINDTIEM. // #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(NMLVFINDITEM) #define HAVE_NMLVFINDITEM 1 -#elif defined(__DMC__) || defined(NM_FINDITEM) +#elif defined(NM_FINDITEM) #define HAVE_NMLVFINDITEM 1 #define NMLVFINDITEM NM_FINDITEM #endif +// MinGW headers lack casts to WPARAM inside several ListView_XXX() macros, so +// add them to suppress the warnings about implicit conversions/truncation. +// However do not add them for MSVC as it has casts not only to WPARAM but +// actually to int first, and then to WPARAM, and casting to WPARAM here would +// result in warnings when casting 64 bit WPARAM to 32 bit int inside the +// macros in Win64 builds. +#ifdef __MINGW32__ + #define NO_ITEM (static_cast(-1)) +#else + #define NO_ITEM (-1) +#endif + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -225,10 +229,10 @@ public: wxDECLARE_NO_COPY_CLASS(wxMSWListItemData); }; -BEGIN_EVENT_TABLE(wxListCtrl, wxListCtrlBase) +wxBEGIN_EVENT_TABLE(wxListCtrl, wxListCtrlBase) EVT_PAINT(wxListCtrl::OnPaint) EVT_CHAR_HOOK(wxListCtrl::OnCharHook) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -248,7 +252,6 @@ void wxListCtrl::Init() m_ownsImageListState = false; m_colCount = 0; - m_count = 0; m_textCtrl = NULL; m_hasAnyAttr = false; @@ -268,8 +271,10 @@ bool wxListCtrl::Create(wxWindow *parent, if ( !MSWCreateControl(WC_LISTVIEW, wxEmptyString, pos, size) ) return false; + EnableSystemTheme(); + // explicitly say that we want to use Unicode because otherwise we get ANSI - // versions of _some_ messages (notably LVN_GETDISPINFOA) in MSLU build + // versions of _some_ messages (notably LVN_GETDISPINFOA) wxSetCCUnicodeFormat(GetHwnd()); // We must set the default text colour to the system/theme color, otherwise @@ -284,26 +289,20 @@ bool wxListCtrl::Create(wxWindow *parent, void wxListCtrl::MSWSetExListStyles() { - // for comctl32.dll v 4.70+ we want to have some non default extended + // we want to have some non default extended // styles because it's prettier (and also because wxGTK does it like this) - if ( wxApp::GetComCtl32Version() >= 470 ) - { - ::SendMessage - ( - GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, - // LVS_EX_LABELTIP shouldn't be used under Windows CE where it's - // not defined in the SDK headers -#ifdef LVS_EX_LABELTIP - LVS_EX_LABELTIP | -#endif - LVS_EX_FULLROWSELECT | - LVS_EX_SUBITEMIMAGES | - // normally this should be governed by a style as it's probably not - // always appropriate, but we don't have any free styles left and - // it seems better to enable it by default than disable - LVS_EX_HEADERDRAGDROP - ); - } + ::SendMessage + ( + GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, + LVS_EX_LABELTIP | + LVS_EX_FULLROWSELECT | + LVS_EX_SUBITEMIMAGES | + LVS_EX_DOUBLEBUFFER | + // normally this should be governed by a style as it's probably not + // always appropriate, but we don't have any free styles left and + // it seems better to enable it by default than disable + LVS_EX_HEADERDRAGDROP + ); } WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const @@ -366,13 +365,6 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const #if !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) if ( style & wxLC_VIRTUAL ) { - int ver = wxApp::GetComCtl32Version(); - if ( ver < 470 ) - { - wxLogWarning(_("Please install a newer version of comctl32.dll\n(at least version 4.70 is required but you have %d.%02d)\nor this program won't operate correctly."), - ver / 100, ver % 100); - } - wstyle |= LVS_OWNERDATA; } #endif // ancient cygwin @@ -506,7 +498,7 @@ bool wxListCtrl::SetForegroundColour(const wxColour& col) if ( !wxWindow::SetForegroundColour(col) ) return false; - ListView_SetTextColor(GetHwnd(), wxColourToRGB(col)); + SetTextColour(col); return true; } @@ -520,8 +512,10 @@ bool wxListCtrl::SetBackgroundColour(const wxColour& col) // we set the same colour for both the "empty" background and the items // background COLORREF color = wxColourToRGB(col); - ListView_SetBkColor(GetHwnd(), color); - ListView_SetTextBkColor(GetHwnd(), color); + if ( !ListView_SetBkColor(GetHwnd(), color) ) + wxLogLastError(wxS("ListView_SetBkColor()")); + if ( !ListView_SetTextBkColor(GetHwnd(), color) ) + wxLogLastError(wxS("ListView_SetTextBkColor()")); return true; } @@ -620,7 +614,15 @@ bool wxListCtrl::SetColumnWidth(int col, int width) else if ( width == wxLIST_AUTOSIZE_USEHEADER) width = LVSCW_AUTOSIZE_USEHEADER; - return ListView_SetColumnWidth(GetHwnd(), col, width) != 0; + if ( !ListView_SetColumnWidth(GetHwnd(), col, width) ) + return false; + + // Failure to explicitly refresh the control with horizontal rules results + // in corrupted rules display. + if ( HasFlag(wxLC_HRULES) ) + Refresh(); + + return true; } // ---------------------------------------------------------------------------- @@ -727,7 +729,11 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.iItem = info.m_itemId; lvItem.iSubItem = info.m_col; - if ( info.m_mask & wxLIST_MASK_TEXT ) + // If no mask is specified, get everything: this is compatible with the + // generic version and conforms to the principle of least surprise. + const long mask = info.m_mask ? info.m_mask : -1; + + if ( mask & wxLIST_MASK_TEXT ) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = new wxChar[513]; @@ -738,13 +744,13 @@ bool wxListCtrl::GetItem(wxListItem& info) const lvItem.pszText = NULL; } - if (info.m_mask & wxLIST_MASK_DATA) + if ( mask & wxLIST_MASK_DATA ) lvItem.mask |= LVIF_PARAM; - if (info.m_mask & wxLIST_MASK_IMAGE) + if ( mask & wxLIST_MASK_IMAGE ) lvItem.mask |= LVIF_IMAGE; - if ( info.m_mask & wxLIST_MASK_STATE ) + if ( mask & wxLIST_MASK_STATE ) { lvItem.mask |= LVIF_STATE; wxConvertToMSWFlags(0, info.m_stateMask, lvItem); @@ -933,7 +939,7 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) // to, so do it explicitly if ( changingFocus && !HasFlag(wxLC_SINGLE_SEL) ) { - ListView_SetSelectionMark(GetHwnd(), item); + (void)ListView_SetSelectionMark(GetHwnd(), item); } return true; @@ -1141,7 +1147,7 @@ bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) // Gets the number of items in the list control int wxListCtrl::GetItemCount() const { - return m_count; + return GetHwnd() ? ListView_GetItemCount(GetHwnd()) : 0; } wxSize wxListCtrl::GetItemSpacing() const @@ -1151,15 +1157,6 @@ wxSize wxListCtrl::GetItemSpacing() const return wxSize(LOWORD(spacing), HIWORD(spacing)); } -#if WXWIN_COMPATIBILITY_2_6 - -int wxListCtrl::GetItemSpacing(bool isSmall) const -{ - return ListView_GetItemSpacing(GetHwnd(), (BOOL) isSmall); -} - -#endif // WXWIN_COMPATIBILITY_2_6 - void wxListCtrl::SetItemTextColour( long item, const wxColour &col ) { wxListItem info; @@ -1214,6 +1211,30 @@ wxFont wxListCtrl::GetItemFont( long item ) const return f; } +bool wxListCtrl::HasCheckboxes() const +{ + const DWORD currStyle = ListView_GetExtendedListViewStyle(GetHwnd()); + return (currStyle & LVS_EX_CHECKBOXES) != 0; +} + +bool wxListCtrl::EnableCheckboxes(bool enable) +{ + (void)ListView_SetExtendedListViewStyleEx(GetHwnd(), LVS_EX_CHECKBOXES, + enable ? LVS_EX_CHECKBOXES : 0); + + return true; +} + +void wxListCtrl::CheckItem(long item, bool state) +{ + ListView_SetCheckState(GetHwnd(), (UINT)item, (BOOL)state); +} + +bool wxListCtrl::IsItemChecked(long item) const +{ + return ListView_GetCheckState(GetHwnd(), (UINT)item) != 0; +} + // Gets the number of selected items in the list control int wxListCtrl::GetSelectedItemCount() const { @@ -1231,7 +1252,8 @@ wxColour wxListCtrl::GetTextColour() const // Sets the text colour of the listview void wxListCtrl::SetTextColour(const wxColour& col) { - ListView_SetTextColor(GetHwnd(), PALETTERGB(col.Red(), col.Green(), col.Blue())); + if ( !ListView_SetTextColor(GetHwnd(), wxColourToPalRGB(col)) ) + wxLogLastError(wxS("ListView_SetTextColor()")); } // Gets the index of the topmost visible item when in @@ -1319,6 +1341,18 @@ void wxListCtrl::SetImageList(wxImageList *imageList, int which) m_ownsImageListState = false; } (void) ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags); + + // For ComCtl32 prior 6.0 we need to re-assign all existing + // text labels in order to position them correctly. + if ( wxApp::GetComCtl32Version() < 600 ) + { + const int n = GetItemCount(); + for( int i = 0; i < n; i++ ) + { + wxString text = GetItemText(i); + SetItemText(i, text); + } + } } void wxListCtrl::AssignImageList(wxImageList *imageList, int which) @@ -1338,10 +1372,7 @@ void wxListCtrl::AssignImageList(wxImageList *imageList, int which) wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const { - // The cast is necessary to suppress a MinGW warning due to a missing cast - // to WPARAM in the definition of ListView_ApproximateViewRect() in its - // own headers (this was the case up to at least MinGW 4.8). - const DWORD rc = ListView_ApproximateViewRect(GetHwnd(), x, y, (WPARAM)-1); + const DWORD rc = ListView_ApproximateViewRect(GetHwnd(), x, y, NO_ITEM); wxSize size(LOWORD(rc), HIWORD(rc)); @@ -1355,7 +1386,10 @@ wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const if ( mswStyle & WS_VSCROLL ) size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - return size; + // OTOH we have to subtract the size of our borders because the base class + // public method already adds them, but ListView_ApproximateViewRect() + // already takes the borders into account, so this would be superfluous. + return size - DoGetBorderSize(); } // ---------------------------------------------------------------------------- @@ -1387,10 +1421,6 @@ bool wxListCtrl::DeleteItem(long item) return false; } - m_count--; - wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()), - wxT("m_count should match ListView_GetItemCount")); - // the virtual list control doesn't refresh itself correctly, help it if ( IsVirtual() ) { @@ -1421,7 +1451,18 @@ bool wxListCtrl::DeleteAllItems() { // Calling ListView_DeleteAllItems() will always generate an event but we // shouldn't do it if the control is empty - return !GetItemCount() || ListView_DeleteAllItems(GetHwnd()) != 0; + if ( !GetItemCount() ) + return true; + + if ( !ListView_DeleteAllItems(GetHwnd()) ) + return false; + + // Virtual controls don't refresh their scrollbar position automatically, + // do it for them when clearing them. + if ( IsVirtual() ) + Refresh(); + + return true; } // Deletes all items @@ -1627,7 +1668,7 @@ wxListCtrl::HitTest(const wxPoint& point, int& flags, long *ptrSubItem) const long item; #ifdef LVM_SUBITEMHITTEST - if ( ptrSubItem && wxApp::GetComCtl32Version() >= 470 ) + if ( ptrSubItem ) { item = ListView_SubItemHitTest(GetHwnd(), &hitTestInfo); *ptrSubItem = hitTestInfo.iSubItem; @@ -1716,16 +1757,7 @@ long wxListCtrl::InsertItem(const wxListItem& info) } } - const long rv = ListView_InsertItem(GetHwnd(), & item); - - // failing to insert the item is really unexpected - wxCHECK_MSG( rv != -1, rv, "failed to insert an item in wxListCtrl" ); - - m_count++; - wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()), - wxT("m_count should match ListView_GetItemCount")); - - return rv; + return ListView_InsertItem(GetHwnd(), &item); } long wxListCtrl::InsertItem(long index, const wxString& label) @@ -1917,16 +1949,7 @@ int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick) // notification message doesn't provide this info // where did the click occur? -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 - if ( nmhdr->code == GN_CONTEXTMENU ) - { - *ptClick = ((NMRGINFO*)nmhdr)->ptAction; - } - else -#endif //__WXWINCE__ - { - wxGetCursorPosMSW(ptClick); - } + wxGetCursorPosMSW(ptClick); // we need to use listctrl coordinates for the event point so this is what // we return in ptClick, but for comparison with Header_GetItemRect() @@ -2041,9 +2064,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_col = nmHDR->iItem; break; -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 - case GN_CONTEXTMENU: -#endif //__WXWINCE__ case NM_RCLICK: { POINT ptClick; @@ -2176,16 +2196,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; case LVN_DELETEITEM: - if ( m_count == 0 ) - { - // this should be prevented by the post-processing code - // below, but "just in case" - return false; - } - eventType = wxEVT_LIST_DELETE_ITEM; event.m_itemIndex = iItem; - break; case LVN_INSERTITEM: @@ -2240,6 +2252,31 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) ? wxEVT_LIST_ITEM_SELECTED : wxEVT_LIST_ITEM_DESELECTED; } + + if ( (stNew & LVIS_STATEIMAGEMASK) != (stOld & LVIS_STATEIMAGEMASK) ) + { + if ( stOld == INDEXTOSTATEIMAGEMASK(0) ) + { + // item does not yet have a state + // occurs when checkboxes are enabled and when a new item is added + eventType = wxEVT_NULL; + } + else if ( stNew == INDEXTOSTATEIMAGEMASK(1) ) + { + eventType = wxEVT_LIST_ITEM_UNCHECKED; + } + else if ( stNew == INDEXTOSTATEIMAGEMASK(2) ) + { + eventType = wxEVT_LIST_ITEM_CHECKED; + } + else + { + eventType = wxEVT_NULL; + wxLogDebug(wxS("Unknown LVIS_STATEIMAGE state: %u"), stNew); + } + + event.m_itemIndex = iItem; + } } if ( eventType == wxEVT_NULL ) @@ -2318,9 +2355,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.m_item.m_data = GetItemData(iItem); break; -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 - case GN_CONTEXTMENU: -#endif //__WXWINCE__ case NM_RCLICK: // if the user processes it in wxEVT_COMMAND_RIGHT_CLICK(), // don't do anything else @@ -2333,16 +2367,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) LV_HITTESTINFO lvhti; wxZeroMemory(lvhti); -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 - if ( nmhdr->code == GN_CONTEXTMENU ) - { - lvhti.pt = ((NMRGINFO*)nmhdr)->ptAction; - } - else -#endif //__WXWINCE__ - { - wxGetCursorPosMSW(&(lvhti.pt)); - } + wxGetCursorPosMSW(&(lvhti.pt)); ::ScreenToClient(GetHwnd(), &lvhti.pt); if ( ListView_HitTest(GetHwnd(), &lvhti) != -1 ) @@ -2581,9 +2606,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // the user should have access to it in OnDeleteAllItems() handler) FreeAllInternalData(); - // the control is empty now, synchronize the cached number of items - // with the real one - m_count = 0; return true; case LVN_DELETEITEM: @@ -2686,7 +2708,8 @@ bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont, int colCount) it.iSubItem = col; it.pszText = text; it.cchTextMax = WXSIZEOF(text); - ListView_GetItem(hwndList, &it); + if ( !ListView_GetItem(hwndList, &it) ) + return false; HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL); if ( himl && ImageList_GetImageCount(himl) ) @@ -2714,9 +2737,7 @@ bool HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont, int colCount) ::SetBkMode(hdc, TRANSPARENT); UINT fmt = DT_SINGLELINE | -#ifndef __WXWINCE__ DT_WORD_ELLIPSIS | -#endif // __WXWINCE__ DT_NOPREFIX | DT_VCENTER; @@ -2788,12 +2809,8 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) } // same thing for CDIS_FOCUS (except simpler as there is only one of them) - // - // NB: cast is needed to work around the bug in mingw32 headers which don't - // have it inside ListView_GetNextItem() itself (unlike SDK ones) if ( ::GetFocus() == hwndList && - ListView_GetNextItem( - hwndList, static_cast(-1), LVNI_FOCUSED) == item ) + ListView_GetNextItem(hwndList, NO_ITEM, LVNI_FOCUSED) == item ) { nmcd.uItemState |= CDIS_FOCUS; } @@ -3107,9 +3124,6 @@ void wxListCtrl::SetItemCount(long count) { wxLogLastError(wxT("ListView_SetItemCount")); } - m_count = count; - wxASSERT_MSG( m_count == ListView_GetItemCount(GetHwnd()), - wxT("m_count should match ListView_GetItemCount")); } void wxListCtrl::RefreshItem(long item) @@ -3119,7 +3133,8 @@ void wxListCtrl::RefreshItem(long item) void wxListCtrl::RefreshItems(long itemFrom, long itemTo) { - ListView_RedrawItems(GetHwnd(), itemFrom, itemTo); + if ( !ListView_RedrawItems(GetHwnd(), itemFrom, itemTo) ) + wxLogLastError(wxS("ListView_RedrawItems")); } // ---------------------------------------------------------------------------- @@ -3332,40 +3347,36 @@ static void wxConvertToMSWListCol(HWND hwndList, #ifdef NM_CUSTOMDRAW // _WIN32_IE >= 0x0300 if ( item.m_mask & wxLIST_MASK_IMAGE ) { - if ( wxApp::GetComCtl32Version() >= 470 ) + lvCol.mask |= LVCF_IMAGE; + + // we use LVCFMT_BITMAP_ON_RIGHT because the images on the right + // seem to be generally nicer than on the left and the generic + // version only draws them on the right (we don't have a flag to + // specify the image location anyhow) + // + // we don't use LVCFMT_COL_HAS_IMAGES because it doesn't seem to + // make any difference in my tests -- but maybe we should? + if ( item.m_image != -1 ) { - lvCol.mask |= LVCF_IMAGE; - - // we use LVCFMT_BITMAP_ON_RIGHT because the images on the right - // seem to be generally nicer than on the left and the generic - // version only draws them on the right (we don't have a flag to - // specify the image location anyhow) - // - // we don't use LVCFMT_COL_HAS_IMAGES because it doesn't seem to - // make any difference in my tests -- but maybe we should? - if ( item.m_image != -1 ) + // as we're going to overwrite the format field, get its + // current value first -- unless we want to overwrite it anyhow + if ( !(lvCol.mask & LVCF_FMT) ) { - // as we're going to overwrite the format field, get its - // current value first -- unless we want to overwrite it anyhow - if ( !(lvCol.mask & LVCF_FMT) ) + LV_COLUMN lvColOld; + wxZeroMemory(lvColOld); + lvColOld.mask = LVCF_FMT; + if ( ListView_GetColumn(hwndList, col, &lvColOld) ) { - LV_COLUMN lvColOld; - wxZeroMemory(lvColOld); - lvColOld.mask = LVCF_FMT; - if ( ListView_GetColumn(hwndList, col, &lvColOld) ) - { - lvCol.fmt = lvColOld.fmt; - } - - lvCol.mask |= LVCF_FMT; + lvCol.fmt = lvColOld.fmt; } - lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE; + lvCol.mask |= LVCF_FMT; } - lvCol.iImage = item.m_image; + lvCol.fmt |= LVCFMT_BITMAP_ON_RIGHT | LVCFMT_IMAGE; } - //else: it doesn't support item images anyhow + + lvCol.iImage = item.m_image; } #endif // _WIN32_IE >= 0x0300 } diff --git a/Externals/wxWidgets3/src/msw/main.cpp b/Externals/wxWidgets3/src/msw/main.cpp index 65b4fc1750..c2bda5e531 100644 --- a/Externals/wxWidgets3/src/msw/main.cpp +++ b/Externals/wxWidgets3/src/msw/main.cpp @@ -31,7 +31,6 @@ #include "wx/cmdline.h" #include "wx/dynlib.h" -#include "wx/scopeguard.h" #include "wx/msw/private.h" #include "wx/msw/seh.h" @@ -41,24 +40,12 @@ #include "wx/msw/crashrpt.h" #endif // wxUSE_ON_FATAL_EXCEPTION -#ifdef __WXWINCE__ - // there is no ExitProcess() under CE but exiting the main thread has the - // same effect - #ifndef ExitProcess - #define ExitProcess ExitThread - #endif -#endif // __WXWINCE__ - #ifdef __BORLANDC__ // BC++ has to be special: its run-time expects the DLL entry point to be // named DllEntryPoint instead of the (more) standard DllMain #define DllMain DllEntryPoint #endif // __BORLANDC__ -#if defined(__WXMICROWIN__) - #define HINSTANCE HANDLE -#endif - // defined in common/init.cpp extern int wxEntryReal(int& argc, wxChar **argv); extern int wxEntryCleanupReal(int& argc, wxChar **argv); @@ -163,10 +150,16 @@ bool wxHandleFatalExceptions(bool doit) // use PID and date to make the report file name more unique wxString name = wxString::Format ( +#if wxUSE_DATETIME wxT("%s_%s_%lu.dmp"), +#else + wxT("%s_%lu.dmp"), +#endif wxTheApp ? (const wxChar*)wxTheApp->GetAppDisplayName().c_str() : wxT("wxwindows"), +#if wxUSE_DATETIME wxDateTime::Now().Format(wxT("%Y%m%dT%H%M%S")).c_str(), +#endif ::GetCurrentProcessId() ); @@ -203,102 +196,6 @@ int wxEntry(int& argc, wxChar **argv) #if wxUSE_GUI -namespace -{ - -#if wxUSE_UNICODE && !defined(__WXWINCE__) - #define NEED_UNICODE_CHECK -#endif - -#ifdef NEED_UNICODE_CHECK - -// check whether Unicode is available -bool wxIsUnicodeAvailable() -{ - static const wchar_t *ERROR_STRING = L"wxWidgets Fatal Error"; - - if ( wxGetOsVersion() != wxOS_WINDOWS_NT ) - { - // we need to be built with MSLU support -#if !wxUSE_UNICODE_MSLU - // note that we can use MessageBoxW() as it's implemented even under - // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs - // used by wxLocale are not - ::MessageBox - ( - NULL, - L"This program uses Unicode and requires Windows NT/2000/XP.\n" - L"\n" - L"Program aborted.", - ERROR_STRING, - MB_ICONERROR | MB_OK - ); - - return false; -#else // wxUSE_UNICODE_MSLU - // and the MSLU DLL must also be available - HMODULE hmod = ::LoadLibraryA("unicows.dll"); - if ( !hmod ) - { - ::MessageBox - ( - NULL, - L"This program uses Unicode and requires unicows.dll to work " - L"under current operating system.\n" - L"\n" - L"Please install unicows.dll and relaunch the program.", - ERROR_STRING, - MB_ICONERROR | MB_OK - ); - return false; - } - - // this is not really necessary but be tidy - ::FreeLibrary(hmod); - - // finally do the last check: has unicows.lib initialized correctly? - hmod = ::LoadLibraryW(L"unicows.dll"); - if ( !hmod ) - { - ::MessageBox - ( - NULL, - L"This program uses Unicode but is not using unicows.dll\n" - L"correctly and so cannot work under current operating system.\n" - L"Please contact the program author for an updated version.\n" - L"\n" - L"Program aborted.", - ERROR_STRING, - MB_ICONERROR | MB_OK - ); - - return false; - } - - ::FreeLibrary(hmod); -#endif // !wxUSE_UNICODE_MSLU - } - - return true; -} - -#endif // NEED_UNICODE_CHECK - -void wxSetProcessDPIAware() -{ -#if wxUSE_DYNLIB_CLASS - typedef BOOL (WINAPI *SetProcessDPIAware_t)(void); - wxDynamicLibrary dllUser32(wxT("user32.dll")); - SetProcessDPIAware_t pfnSetProcessDPIAware = - (SetProcessDPIAware_t)dllUser32.RawGetSymbol(wxT("SetProcessDPIAware")); - - if ( pfnSetProcessDPIAware ) - pfnSetProcessDPIAware(); -#endif // wxUSE_DYNLIB_CLASS -} - -} //anonymous namespace - // ---------------------------------------------------------------------------- // Windows-specific wxEntry // ---------------------------------------------------------------------------- @@ -322,7 +219,7 @@ struct wxMSWCommandLineArguments argv[argc] = NULL; } - void Free() + ~wxMSWCommandLineArguments() { if ( !argc ) return; @@ -346,15 +243,6 @@ static wxMSWCommandLineArguments wxArgs; static bool wxMSWEntryCommon(HINSTANCE hInstance, int nCmdShow) { - // the first thing to do is to check if we're trying to run an Unicode - // program under Win9x w/o MSLU emulation layer - if so, abort right now - // as it has no chance to work and has all chances to crash -#ifdef NEED_UNICODE_CHECK - if ( !wxIsUnicodeAvailable() ) - return false; -#endif // NEED_UNICODE_CHECK - - // remember the parameters Windows gave us wxSetInstance(hInstance); #ifdef __WXMSW__ @@ -374,11 +262,6 @@ wxMSWEntryCommon(HINSTANCE hInstance, int nCmdShow) args = wxCmdLineParser::ConvertStringToArgs(cmdLine); } -#ifdef __WXWINCE__ - // WinCE doesn't insert the program itself, so do it ourselves. - args.Insert(wxGetFullModuleName(), 0); -#endif - wxArgs.Init(args); return true; @@ -400,18 +283,9 @@ WXDLLEXPORT int wxEntry(HINSTANCE hInstance, wxCmdLineArgType WXUNUSED(pCmdLine), int nCmdShow) { - // wxWidgets library doesn't have problems with non-default DPI settings, - // so we can mark the app as "DPI aware" for Vista/Win7 (see - // http://msdn.microsoft.com/en-us/library/dd464659%28VS.85%29.aspx). - // Note that we intentionally do it here and not in wxApp, so that it - // doesn't happen if wx code is hosted in another app (e.g. a plugin). - wxSetProcessDPIAware(); - if ( !wxMSWEntryCommon(hInstance, nCmdShow) ) return -1; - wxON_BLOCK_EXIT_OBJ0(wxArgs, wxMSWCommandLineArguments::Free); - return wxEntry(wxArgs.argc, wxArgs.argv); } diff --git a/Externals/wxWidgets3/src/msw/mdi.cpp b/Externals/wxWidgets3/src/msw/mdi.cpp index 5a1aae5373..514e4eedfe 100644 --- a/Externals/wxWidgets3/src/msw/mdi.cpp +++ b/Externals/wxWidgets3/src/msw/mdi.cpp @@ -38,6 +38,7 @@ #include "wx/settings.h" #include "wx/intl.h" #include "wx/log.h" + #include "wx/sizer.h" #include "wx/toolbar.h" #endif @@ -115,11 +116,12 @@ inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame) // wxWin macros // --------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame); +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame); +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow); -BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) + EVT_ACTIVATE(wxMDIParentFrame::OnActivate) EVT_SIZE(wxMDIParentFrame::OnSize) EVT_ICONIZE(wxMDIParentFrame::OnIconized) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) @@ -130,15 +132,15 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_MENU_RANGE(wxID_MDI_WINDOW_FIRST, wxID_MDI_WINDOW_LAST, wxMDIParentFrame::OnMDICommand) #endif // wxUSE_MENUS -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) EVT_IDLE(wxMDIChildFrame::OnIdle) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) +wxBEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) EVT_SCROLL(wxMDIClientWindow::OnScroll) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // =========================================================================== // wxMDIParentFrame: the frame which contains the client window which manages @@ -151,6 +153,8 @@ void wxMDIParentFrame::Init() // the default menu doesn't have any accelerators (even if we have it) m_accelWindowMenu = NULL; #endif // wxUSE_MENUS && wxUSE_ACCEL + + m_activationNotHandled = false; } bool wxMDIParentFrame::Create(wxWindow *parent, @@ -406,12 +410,11 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) wxMDIChildFrame *child = GetActiveChild(); if ( child ) { - wxEvtHandler* source = child->GetEventHandler(); wxMenuBar* bar = child->GetMenuBar(); if (menu) { - menu->UpdateUI(source); + menu->UpdateUI(); } else { @@ -419,7 +422,7 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) { int nCount = bar->GetMenuCount(); for (int n = 0; n < nCount; n++) - bar->GetMenu(n)->UpdateUI(source); + bar->GetMenu(n)->UpdateUI(); } } } @@ -446,6 +449,20 @@ wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const return item; } +wxMenu* wxMDIParentFrame::MSWFindMenuFromHMENU(WXHMENU hMenu) +{ + wxMenu* menu = GetActiveChild() + ? GetActiveChild()->MSWFindMenuFromHMENU(hMenu) + : NULL; + if ( !menu ) + menu = wxFrame::MSWFindMenuFromHMENU(hMenu); + + if ( !menu && m_windowMenu && GetHmenuOf(m_windowMenu) == hMenu ) + menu = m_windowMenu; + + return menu; +} + WXHMENU wxMDIParentFrame::MSWGetActiveMenu() const { wxMDIChildFrame * const child = GetActiveChild(); @@ -467,12 +484,17 @@ WXHMENU wxMDIParentFrame::MSWGetActiveMenu() const void wxMDIParentFrame::UpdateClientSize() { - if ( GetClientWindow() ) - { - int width, height; - GetClientSize(&width, &height); + int width, height; + GetClientSize(&width, &height); - GetClientWindow()->SetSize(0, 0, width, height); + if ( wxSizer* sizer = GetSizer() ) + { + sizer->SetDimension(0, 0, width, height); + } + else + { + if ( GetClientWindow() ) + GetClientWindow()->SetSize(0, 0, width, height); } } @@ -606,24 +628,52 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, return rc; } +void wxMDIParentFrame::OnActivate(wxActivateEvent& WXUNUSED(event)) +{ + // The base class version saves the current focus when we are being + // deactivated and restores it when the window is activated again, but this + // is not necessary here as DefWindowProc() for MDI parent frame already + // takes care of re-activating the MDI child that had been active the last + // time, and MDI children remember their own last focused child already, + // being subclasses of wxTLW. + // + // Moreover, in addition to being unnecessary, this can be actively harmful + // if we somehow don't have the focus any more at the moment of activation + // loss as happens when showing a standard file dialog under Windows 7, see + // #16635: in this case the base class just gives the focus to its first + // child, meaning that we can switch to a different MDI child, which is + // worse than losing focus inside the current child. + // + // So we don't let the base class have this event to prevent this from + // happening. But the event is not really processed, so we set a flag here + // which is used in HandleActivate() below to check if the event was really + // processed (and not skipped) in the user code or just reached this dummy + // handler. + m_activationNotHandled = true; +} + bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate) { bool processed = false; + // Set the flag before testing it to ensure the only way for it to be true + // is to be set in our OnActivate() -- and not just remain set from the + // last time. + m_activationNotHandled = false; + if ( wxWindow::HandleActivate(state, minimized, activate) ) { - // already processed - processed = true; + // already processed, unless we artificially marked the event as + // handled in our own handler without really processing it + processed = !m_activationNotHandled; } - // If this window is an MDI parent, we must also send an OnActivate message - // to the current child. - if ( GetActiveChild() && - ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) ) + // Also generate the (de)activation event for the current child, if any, to + // allow updating its state and, in particular, remembering or restoring + // its last focused window. + if ( GetActiveChild() ) { - wxActivateEvent event(wxEVT_ACTIVATE, true, GetActiveChild()->GetId()); - event.SetEventObject( GetActiveChild() ); - if ( GetActiveChild()->HandleWindowEvent(event) ) + if ( GetActiveChild()->HandleActivate(state, minimized, activate) ) processed = true; } @@ -757,7 +807,6 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) void wxMDIChildFrame::Init() { m_needsResize = true; - m_needsInitialShow = true; } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, @@ -861,7 +910,9 @@ wxMDIChildFrame::~wxMDIChildFrame() if ( !m_hWnd ) return; - GetMDIParent()->RemoveMDIChild(this); + wxMDIParentFrame * const parent = GetMDIParent(); + + parent->RemoveMDIChild(this); // will be destroyed by DestroyChildren() but reset them before calling it // to avoid using dangling pointers if a callback comes in the meanwhile @@ -876,13 +927,17 @@ wxMDIChildFrame::~wxMDIChildFrame() MDIRemoveWindowMenu(NULL, m_hMenu); + // MDIRemoveWindowMenu() doesn't update the MDI menu when called with NULL + // window, so do it ourselves. + MDISetMenu(parent->GetClientWindow(), + (HMENU)parent->MSWGetActiveMenu(), + GetMDIWindowMenu(parent)); + MSWDestroyWindow(); } bool wxMDIChildFrame::Show(bool show) { - m_needsInitialShow = false; - if (!wxFrame::Show(show)) return false; @@ -1015,9 +1070,28 @@ void wxMDIChildFrame::Maximize(bool maximize) wxMDIParentFrame * const parent = GetMDIParent(); if ( parent && parent->GetClientWindow() ) { + if ( !IsShown() ) + { + // Turn off redrawing in the MDI client window because otherwise + // maximizing it would also show it and we don't want this for + // hidden windows. + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_SETREDRAW, + FALSE, 0L); + } + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), maximize ? WM_MDIMAXIMIZE : WM_MDIRESTORE, (WPARAM)GetHwnd(), 0); + + if ( !IsShown() ) + { + // Hide back the child window shown by maximizing it. + ::ShowWindow(GetHwnd(), SW_HIDE); + + // Turn redrawing in the MDI client back on. + ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_SETREDRAW, + TRUE, 0L); + } } } @@ -1174,32 +1248,13 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) { - MINMAXINFO *info = (MINMAXINFO *)mmInfo; + // Get the window max size from DefMDIChildProc() as it calculates it + // correctly from the size of the MDI parent frame. + MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo); - // let the default window proc calculate the size of MDI children - // frames because it is based on the size of the MDI client window, - // not on the values specified in wxWindow m_max variables - bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo) != 0; - - int minWidth = GetMinWidth(), - minHeight = GetMinHeight(); - - // but allow GetSizeHints() to set the min size - if ( minWidth != wxDefaultCoord ) - { - info->ptMinTrackSize.x = minWidth; - - processed = true; - } - - if ( minHeight != wxDefaultCoord ) - { - info->ptMinTrackSize.y = minHeight; - - processed = true; - } - - return processed; + // But then handle the message as usual at the base class level to allow + // overriding min/max frame size as for the normal frames. + return false; } // --------------------------------------------------------------------------- @@ -1395,16 +1450,6 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF void wxMDIChildFrame::OnIdle(wxIdleEvent& event) { - // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted - // in flicker e.g. when the frame contained controls with non-trivial - // layout. Since 2.5.3, the frame is created hidden as all other top level - // windows. In order to maintain backward compatibility, the frame is shown - // in OnIdle, unless Show(false) was called by the programmer before. - if ( m_needsInitialShow ) - { - Show(true); - } - // MDI child frames get their WM_SIZE when they're constructed but at this // moment they don't have any children yet so all child windows will be // positioned incorrectly when they are added later - to fix this, we @@ -1430,13 +1475,18 @@ void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) { if ( hmenuFrame || hmenuWindow ) { + // Under XP, the last error seems to be not reset by this function, so + // ensure we don't report spurious errors below when setting the menu + // initially. + ::SetLastError(ERROR_SUCCESS); + if ( !::SendMessage(GetWinHwnd(win), WM_MDISETMENU, (WPARAM)hmenuFrame, (LPARAM)hmenuWindow) ) { - DWORD err = ::GetLastError(); - if ( err ) + const DWORD err = ::GetLastError(); + if ( err != ERROR_SUCCESS ) { wxLogApiError(wxT("SendMessage(WM_MDISETMENU)"), err); } @@ -1452,6 +1502,59 @@ void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) ::DrawMenuBar(GetWinHwnd(parent)); } +class MenuIterator +{ +public: + explicit MenuIterator(HMENU hmenu) + : m_hmenu(hmenu), + m_numItems(::GetMenuItemCount(hmenu)), + m_pos(-1) + { + m_mii.fMask = MIIM_STRING; + m_mii.dwTypeData = m_buf; + } + + bool GetNext(wxString& str) + { + // Loop until we get the label of the next menu item. + for ( m_pos++; m_pos < m_numItems; m_pos++ ) + { + // As cch field is updated by GetMenuItemInfo(), it's important to + // reset it to the size of the buffer before each call. + m_mii.cch = WXSIZEOF(m_buf); + + if ( !::GetMenuItemInfo(m_hmenu, m_pos, TRUE, &m_mii) ) + { + wxLogLastError(wxString::Format("GetMenuItemInfo(%d)", m_pos)); + continue; + } + + if ( !m_mii.cch ) + { + // This isn't a string menu at all. + continue; + } + + str = m_buf; + return true; + } + + return false; + } + + int GetPos() const { return m_pos; } + +private: + const HMENU m_hmenu; + const int m_numItems; + int m_pos; + + wxChar m_buf[1024]; + WinStruct m_mii; + + wxDECLARE_NO_COPY_CLASS(MenuIterator); +}; + void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin) { HMENU hmenu = (HMENU)hMenu; @@ -1459,23 +1562,17 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin) if ( menuWin ) { // Try to insert Window menu in front of Help, otherwise append it. - int N = GetMenuItemCount(hmenu); bool inserted = false; - for ( int i = 0; i < N; i++ ) + wxString buf; + MenuIterator it(hmenu); + while ( it.GetNext(buf) ) { - wxChar buf[256]; - if ( !::GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION) ) - { - wxLogLastError(wxT("GetMenuString")); - - continue; - } - const wxString label = wxStripMenuCodes(buf); if ( label == wxGetStockLabel(wxID_HELP, wxSTOCK_NOFLAGS) ) { inserted = true; - ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, + ::InsertMenu(hmenu, it.GetPos(), + MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)menuWin, wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str()); break; @@ -1499,26 +1596,13 @@ void MDIRemoveWindowMenu(wxWindow *win, WXHMENU hMenu) if ( hmenu ) { - wxChar buf[1024]; - - int N = ::GetMenuItemCount(hmenu); - for ( int i = 0; i < N; i++ ) + wxString buf; + MenuIterator it(hmenu); + while ( it.GetNext(buf) ) { - if ( !::GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION) ) - { - // Ignore successful read of menu string with length 0 which - // occurs, for example, for a maximized MDI child system menu - if ( ::GetLastError() != 0 ) - { - wxLogLastError(wxT("GetMenuString")); - } - - continue; - } - if ( wxStrcmp(buf, wxGetTranslation(WINDOW_MENU_LABEL)) == 0 ) { - if ( !::RemoveMenu(hmenu, i, MF_BYPOSITION) ) + if ( !::RemoveMenu(hmenu, it.GetPos(), MF_BYPOSITION) ) { wxLogLastError(wxT("RemoveMenu")); } diff --git a/Externals/wxWidgets3/src/msw/mediactrl_am.cpp b/Externals/wxWidgets3/src/msw/mediactrl_am.cpp index 39f07e8ab7..4721bb1455 100644 --- a/Externals/wxWidgets3/src/msw/mediactrl_am.cpp +++ b/Externals/wxWidgets3/src/msw/mediactrl_am.cpp @@ -49,12 +49,6 @@ #pragma hdrstop #endif -// disable "cast truncates constant value" for VARIANT_BOOL values -// passed as parameters in VC6 -#ifdef _MSC_VER -#pragma warning (disable:4310) -#endif - #if wxUSE_MEDIACTRL && wxUSE_ACTIVEX #include "wx/mediactrl.h" @@ -75,10 +69,6 @@ //--------------------------------------------------------------------------- #include "wx/msw/ole/activex.h" -// It may sound odd, but you can actually compile this with -// __WXWINCE__ enabled on non-CE windows -//#define __WXWINCE__ - //--------------------------------------------------------------------------- // IIDS - used by CoCreateInstance and IUnknown::QueryInterface // @@ -92,11 +82,10 @@ // ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open // "type libraries", open a specific type library (for quartz for example its // "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the -// idl using the midl compiler that comes with visual studio -// ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument -// to make it generate stubs (a .h & .c file), then clean up the generated -// interfaces I want with the STDMETHOD wrappers and then put them into -// mediactrl.cpp. +// idl using the midl compiler that comes with visual studio with the /h +// argument to make it generate stubs (a .h & .c file), then clean up the +// generated interfaces I want with the STDMETHOD wrappers and then put them +// into mediactrl.cpp. // // According to the MSDN docs, IMediaPlayer requires Windows 98 SE // or greater. NetShow is available on Windows 3.1 and I'm guessing @@ -120,10 +109,6 @@ const IID IID_IMediaPlayer = {0x22D6F311,0xB0F6,0x11D0,{0x94,0xAB,0x00, const IID IID_IMediaPlayer2 = {0x20D4F5E0,0x5475,0x11D2,{0x97,0x74,0x00,0x00,0xF8,0x08,0x55,0xE6}}; -#ifdef __WXWINCE__ -const IID IID_IWMP = {0x136B66EC,0xF30D,0x46A8,{0x88,0xDD,0xF2,0xD0,0x55,0x16,0x3E,0x49}}; -#endif - const CLSID CLSID_ActiveMovie = {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}}; const CLSID CLSID_MediaPlayer = {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}}; const CLSID CLSID_NSPlay = {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}}; @@ -590,7 +575,7 @@ struct IMediaPlayer2 : public IMediaPlayer { STDMETHOD(get_DVD)(struct IMediaPlayerDvd __RPC_FAR *__RPC_FAR *ppdispatch) PURE; STDMETHOD(GetMediaParameter)(long EntryNum, BSTR bstrParameterName, BSTR __RPC_FAR *pbstrParameterValue) PURE; - STDMETHOD(GetMediaParameterName(long EntryNum, long Index, BSTR __RPC_FAR *pbstrParameterName) PURE; + STDMETHOD(GetMediaParameterName)(long EntryNum, long Index, BSTR __RPC_FAR *pbstrParameterName) PURE; STDMETHOD(get_EntryCount)(long __RPC_FAR *pNumberEntries) PURE; STDMETHOD(GetCurrentEntry)(long __RPC_FAR *pEntryNumber) PURE; STDMETHOD(SetCurrentEntry)(long EntryNumber) PURE; @@ -733,7 +718,7 @@ struct INSPlay : public INSOPlay STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE; STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE; STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE; - STDMETHOD(AboutBox))(void) PURE; + STDMETHOD(AboutBox)(void) PURE; STDMETHOD(Cancel)(void) PURE; STDMETHOD(GetCodecInstalled)(long CodecNum, VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE; STDMETHOD(GetCodecDescription)(long CodecNum, BSTR __RPC_FAR *pbstrCodecDescription) PURE; @@ -747,570 +732,6 @@ struct INSPlay1 : public INSPlay STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE; }; -//--------------------------------------------------------------------------- -// IWMP (PocketPC 2000) COM INTERFACES (dumped from PlayerOCX.idl) -//--------------------------------------------------------------------------- - -#ifdef __WXWINCE__ - -struct IWMP : public IDispatch -{ -public: - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoSize( - /* [in] */ VARIANT_BOOL vbool) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoSize( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderStyle( - /* [in] */ long style) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderStyle( - /* [retval][out] */ long __RPC_FAR *pstyle) = 0; - - virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled( - /* [in] */ VARIANT_BOOL vbool) = 0; - - virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FileName( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_FileName( - /* [in] */ BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Mute( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Mute( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoStart( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoStart( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PlayCount( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowStatusBar( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowStatusBar( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowAudioControls( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowAudioControls( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowCaptioning( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowCaptioning( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowControls( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowControls( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowDisplay( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowDisplay( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowGotoBar( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowGotoBar( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowPositionControls( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowPositionControls( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowTracker( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowTracker( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Startup( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Shutdown( void) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bandwidth( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BaseURL( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BaseURL( - /* [in] */ BSTR pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingProgress( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingTime( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeek( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeekToMarkers( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelDescription( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelName( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelURL( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClientID( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionSpeed( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactAddress( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactEmail( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactPhone( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentMarker( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentMarker( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( - /* [in] */ double newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFrame( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DefaultFrame( - /* [in] */ BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EntryCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCode( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorDescription( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasError( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasMultipleItems( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceHeight( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceWidth( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InvokeURLs( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_InvokeURLs( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsBroadcast( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsDurationValid( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LostPackets( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MarkerCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OpenState( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayState( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PreviewMode( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PreviewMode( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReadyState( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceivedPackets( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceptionQuality( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RecoveredPackets( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIFileName( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIFileName( - /* [in] */ BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMILang( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMILang( - /* [in] */ BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIStyle( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIStyle( - /* [in] */ BSTR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionEnd( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionEnd( - /* [in] */ double newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionStart( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionStart( - /* [in] */ double newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendErrorEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendErrorEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendKeyboardEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendKeyboardEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseClickEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseClickEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseMoveEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseMoveEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendOpenStateChangeEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendOpenStateChangeEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendPlayStateChangeEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendPlayStateChangeEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendWarningEvents( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendWarningEvents( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceLink( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AboutBox( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Cancel( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecDescription( - /* [in] */ long nCodec, - /* [retval][out] */ BSTR __RPC_FAR *pDescription) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecInstalled( - /* [in] */ BSTR __RPC_FAR *pstrCodec, - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pIsInstalled) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentEntry( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerName( - /* [in] */ long nMarker, - /* [retval][out] */ BSTR __RPC_FAR *pMarkerName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerTime( - /* [in] */ long nMarker, - /* [retval][out] */ double __RPC_FAR *pMarkerTime) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaInfoString( - /* [in] */ long MPMediaInfoType, - /* [retval][out] */ BSTR __RPC_FAR *pstrMediaInfo) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Next( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Open( - BSTR pstrClip) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Previous( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Rate( - /* [retval][out] */ double __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Rate( - /* [in] */ double newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplaySize( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplaySize( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceProtocol( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCorrection( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FinalConstruct( void) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowChangeDisplaySize( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowChangeDisplaySize( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowScan( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowScan( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AnimationAtStart( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AnimationAtStart( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStream( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AudioStream( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoRewind( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoRewind( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Balance( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Balance( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanPreview( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanScan( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CaptioningID( - /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClickToPlay( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ClickToPlay( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CodecCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CreationDate( - /* [retval][out] */ DATE __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CursorType( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CursorType( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayBackColor( - /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayBackColor( - /* [in] */ VB_OLE_COLOR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayForeColor( - /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayForeColor( - /* [in] */ VB_OLE_COLOR newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayMode( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayMode( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableContextMenu( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableContextMenu( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableFullScreenControls( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableFullScreenControls( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnablePositionControls( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnablePositionControls( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableTracker( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableTracker( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Language( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamCount( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TransparentAtStart( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_TransparentAtStart( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorder3D( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorder3D( - /* [in] */ VARIANT_BOOL newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderColor( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderColor( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderWidth( - /* [retval][out] */ long __RPC_FAR *pVal) = 0; - - virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderWidth( - /* [in] */ long newVal) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastForward( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastReverse( void) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecURL( - /* [retval][out] */ BSTR __RPC_FAR *pstrCodecURL) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameter( - /* [in] */ long nParam, - BSTR szParameterName, - /* [retval][out] */ BSTR __RPC_FAR *pstrParameterValue) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameterName( - /* [in] */ long nParam, - long nIndex, - /* [retval][out] */ BSTR __RPC_FAR *pstrParameterName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMoreInfoURL( - /* [retval][out] */ BSTR __RPC_FAR *pstrMoreInfoURL) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamGroup( - /* [retval][out] */ BSTR __RPC_FAR *pstrStreamGroup) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamName( - /* [retval][out] */ BSTR __RPC_FAR *pstrStreamName) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamSelected( - /* [in] */ long nStream, - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsSelected) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsSoundCardEnabled( - /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsEnabled) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetCurrentEntry( - long nValue) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowDialog( - long nValue) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE StreamSelect( - long nSelect) = 0; - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnWindowMessage( - UINT msg, - WPARAM wParam, - LPARAM lParam, - LRESULT __RPC_FAR *plResult) = 0; - -}; - - -#endif // CE - //--------------------------------------------------------------------------- // MISC COM INTERFACES //--------------------------------------------------------------------------- @@ -1463,18 +884,11 @@ public: } wxActiveXContainer* m_pAX; // ActiveX host -#ifdef __WXWINCE__ - IWMP* m_pWMP; - - IWMP* GetMP() {return m_pWMP;} - IWMP* GetAM() {return m_pWMP;} -#else IActiveMovie* m_pAM; IMediaPlayer* m_pMP; IMediaPlayer* GetMP() {return m_pMP;} IActiveMovie* GetAM() {return m_pAM;} -#endif wxSize m_bestSize; // Cached size // Stuff for getting useful debugging strings @@ -1486,7 +900,7 @@ public: wxEvtHandler* m_evthandler; friend class wxAMMediaEvtHandler; - DECLARE_DYNAMIC_CLASS(wxAMMediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxAMMediaBackend); }; class WXDLLIMPEXP_MEDIA wxAMMediaEvtHandler : public wxEvtHandler @@ -1522,7 +936,7 @@ private: // //--------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend) +wxIMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend); //--------------------------------------------------------------------------- // Usual debugging macros @@ -1566,12 +980,8 @@ wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv) //--------------------------------------------------------------------------- wxAMMediaBackend::wxAMMediaBackend() :m_pAX(NULL), -#ifdef __WXWINCE__ - m_pWMP(NULL), -#else m_pAM(NULL), m_pMP(NULL), -#endif m_bestSize(wxDefaultSize) { m_evthandler = NULL; @@ -1586,9 +996,7 @@ wxAMMediaBackend::~wxAMMediaBackend() { m_pAX->DissociateHandle(); delete m_pAX; -#ifndef __WXWINCE__ m_pAM->Release(); -#endif if (GetMP()) GetMP()->Release(); @@ -1624,27 +1032,6 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, -#ifdef __WXWINCE__ - CLSID clsid; - - // Try progids first - *.WMP is PocketPC and Mediaplayer.1 is CE.NET - // later versions support straight creation from CLSID - if (CLSIDFromProgID(L"WPCEOCX.WMP", &clsid) != S_OK && - CLSIDFromProgID(L"MediaPlayer.MediaPlayer.1", &clsid) != S_OK) - { - clsid = CLSID_MediaPlayer; - } - - // While the CLSID is the same as CLSID_MediaPlayer - // CE only supports the IWMP interface - if ( ::CoCreateInstance(clsid, NULL, - CLSCTX_INPROC_SERVER, - IID_IWMP, (void**)&m_pWMP) != 0 ) - { - return false; - } - -#else // Now determine which (if any) media player interface is // available - IMediaPlayer or IActiveMovie if( ::CoCreateInstance(CLSID_MediaPlayer, NULL, @@ -1661,7 +1048,6 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, { m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM); } -#endif // // Create window @@ -1682,11 +1068,7 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, // m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); m_pAX = new wxActiveXContainer(ctrl, -#ifdef __WXWINCE__ - IID_IWMP, m_pWMP -#else m_pMP ? IID_IMediaPlayer : IID_IActiveMovie, m_pAM -#endif ); // Connect for events m_evthandler = new wxAMMediaEvtHandler(this); @@ -1699,19 +1081,15 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, if(GetMP()) { GetMP()->put_DisplaySize(mpFitToSize); -#ifndef __WXWINCE__ // Not in CE's IWMP // TODO: Unsure what actual effect this has // In DirectShow Windowless video results in less delay when // dragging, for example - but this doesn't appear to really do anything // in practice (it may be something different...)... GetMP()->put_WindowlessVideo(VARIANT_TRUE); -#endif } -#ifndef __WXWINCE__ // Not in CE's IWMP else GetAM()->put_MovieWindowSize(amvDoubleOriginalSize); -#endif // by default true GetAM()->put_AutoStart(VARIANT_FALSE); @@ -1863,11 +1241,7 @@ bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) bool wxAMMediaBackend::Play() { // Actually try to play the movie (will fail if not loaded completely) -#ifdef __WXWINCE__ - HRESULT hr = m_pWMP->Play(); -#else HRESULT hr = GetAM()->Run(); -#endif if(SUCCEEDED(hr)) { return true; @@ -2039,11 +1413,7 @@ wxLongLong wxAMMediaBackend::GetDuration() wxMediaState wxAMMediaBackend::GetState() { StateConstants nState; -#ifdef __WXWINCE__ - HRESULT hr = m_pWMP->get_PlayState((long*)&nState); -#else HRESULT hr = GetAM()->get_CurrentState(&nState); -#endif if(FAILED(hr)) { wxAMLOG(hr); @@ -2099,7 +1469,6 @@ bool wxAMMediaBackend::SetPlaybackRate(double dRate) void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, wxLongLong* pLoadTotal) { -#ifndef __WXWINCE__ IUnknown* pFG = NULL; HRESULT hr = m_pAM->get_FilterGraph(&pFG); @@ -2127,7 +1496,6 @@ void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress, } pFG->Release(); } -#endif // !__WXWINCE__ *pLoadProgress = 0; *pLoadTotal = 0; @@ -2181,12 +1549,8 @@ void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event) { switch(event.GetDispatchId()) { -#ifndef __WXWINCE__ case 0x00000001: // statechange in IActiveMovie case 0x00000bc4: // playstatechange in IMediaPlayer -#else - case 0x00000011: // 17 == playstatechange on IWMP -#endif if(event.ParamCount() >= 2) { switch (event[1].GetInteger()) @@ -2223,7 +1587,6 @@ void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event) event.Skip(); break; -#ifndef __WXWINCE__ case 0x00000032: // opencomplete in IActiveMovie if(!m_bLoadEventSent) { @@ -2232,9 +1595,6 @@ void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event) break; case 0xfffffd9f: // readystatechange in IActiveMovie2 and IMediaPlayer -#else - case 0x00000013: // 19 == readystatechange in IWMP -#endif if(event.ParamCount() >= 1) { if(event[0].GetInteger() == 0) diff --git a/Externals/wxWidgets3/src/msw/mediactrl_qt.cpp b/Externals/wxWidgets3/src/msw/mediactrl_qt.cpp index 9ba2a63902..9e30fc2856 100644 --- a/Externals/wxWidgets3/src/msw/mediactrl_qt.cpp +++ b/Externals/wxWidgets3/src/msw/mediactrl_qt.cpp @@ -45,8 +45,8 @@ extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void); extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName; -LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); +LRESULT WXDLLIMPEXP_CORE APIENTRY +wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); //--------------------------------------------------------------------------- // Killed MSVC warnings @@ -101,7 +101,7 @@ typedef struct ComponentInstanceRecord * ComponentInstance; #define MovieController ComponentInstance #ifndef URLDataHandlerSubType -#if defined(__WATCOMC__) || defined(__MINGW32__) +#if defined(__MINGW32__) // use magic numbers for compilers which complain about multicharacter integers const OSType URLDataHandlerSubType = 1970433056; const OSType VisualMediaCharacteristic = 1702454643; @@ -407,7 +407,7 @@ public: friend class wxQTMediaEvtHandler; - DECLARE_DYNAMIC_CLASS(wxQTMediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxQTMediaBackend); }; // helper to hijack background erasing for the QT window @@ -448,7 +448,7 @@ private: // with this backend are treated as playable anyway - not verified though. //--------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend) +wxIMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); // Time between timer calls - this is the Apple recommendation to the TCL // team I believe @@ -625,7 +625,7 @@ wxQTMediaBackend::~wxQTMediaBackend() //--------------------------------------------------------------------------- // wxQTMediaBackend::CreateControl // -// 1) Intializes QuickTime +// 1) Initializes QuickTime // 2) Creates the control window //--------------------------------------------------------------------------- bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, @@ -690,7 +690,7 @@ bool wxQTMediaBackend::Load(const wxString& fileName) if (m_movie) Cleanup(); - short movieResFile = 0; //= 0 because of annoying VC6 warning + short movieResFile wxDUMMY_INITIALIZE(0); FSSpec sfFile; OSErr err = m_lib.NativePathNameToFSSpec( @@ -838,7 +838,7 @@ void wxQTMediaBackend::FinishLoad() // get the real size of the movie Rect outRect; - memset(&outRect, 0, sizeof(Rect)); // suppress annoying VC6 warning + memset(&outRect, 0, sizeof(Rect)); m_lib.GetMovieNaturalBoundsRect (m_movie, &outRect); wxASSERT(m_lib.GetMoviesError() == noErr); diff --git a/Externals/wxWidgets3/src/msw/mediactrl_wmp10.cpp b/Externals/wxWidgets3/src/msw/mediactrl_wmp10.cpp index 0ce46ff704..55bdf2a934 100644 --- a/Externals/wxWidgets3/src/msw/mediactrl_wmp10.cpp +++ b/Externals/wxWidgets3/src/msw/mediactrl_wmp10.cpp @@ -82,12 +82,6 @@ // Other defines //--------------------------------------------------------------------------- -// disable "cast truncates constant value" for VARIANT_BOOL values -// passed as parameters in VC6 -#ifdef _MSC_VER -#pragma warning (disable:4310) -#endif - // error logger for HRESULTS (nothing really now) #define wxWMP10LOG(x) @@ -677,7 +671,7 @@ public: wxEvtHandler* m_evthandler; friend class wxWMP10MediaEvtHandler; - DECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend); }; #ifndef WXTEST_ATL @@ -713,7 +707,7 @@ private: // //--------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxWMP10MediaBackend, wxMediaBackend) +wxIMPLEMENT_DYNAMIC_CLASS(wxWMP10MediaBackend, wxMediaBackend); //--------------------------------------------------------------------------- // wxWMP10MediaBackend Constructor @@ -1461,64 +1455,4 @@ void wxWMP10MediaEvtHandler::OnActiveX(wxActiveXEvent& event) #include "wx/link.h" wxFORCE_LINK_THIS_MODULE(wxmediabackend_wmp10) -#if 0 // Windows Media Player Mobile 9 hacks - -//------------------WMP Mobile 9 hacks----------------------------------- -// It was mentioned in the introduction that while there was no official -// programming interface on WMP mobile 9 -// (SmartPhone/Pocket PC 2003 emulator etc.) -// there were some windows message hacks that are able to get -// you playing a file through WMP. -// -// Here are those hacks. They do indeed "work" as expected - just call -// SendMessage with one of those myterious values laid out in -// Peter Foot's Friday, May 21, 2004 Blog Post on the issue. -// (He says they are in a registery section entitled "Pendant Bus") -// -// How do you play a certain file? Simply calling "start [file]" or -// wxWinCEExecute([file]) should do the trick - -bool wxWinCEExecute(const wxString& path, int nShowStyle = SW_SHOWNORMAL) -{ - WinStruct sei; - sei.lpFile = path.c_str(); - sei.lpVerb = wxT("open"); - sei.nShow = nShowStyle; - - ::ShellExecuteEx(&sei); - - return ((int) sei.hInstApp) > 32; -} - -bool MyApp::OnInit() -{ - HWND hwnd = ::FindWindow(TEXT("WMP for Mobile Devices"), TEXT("Windows Media")); - if(!hwnd) - { - if( wxWinCEExecute(wxT("\\Windows\\wmplayer.exe"), SW_MINIMIZE) ) - { - hwnd = ::FindWindow(TEXT("WMP for Mobile Devices"), TEXT("Windows Media")); - } - } - - if(hwnd) - { - // hide wmp window - ::SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, - SWP_NOMOVE|SWP_NOSIZE|SWP_HIDEWINDOW); - - // Stop == 32970 - // Prev Track == 32971 - // Next Track == 32972 - // Shuffle == 32973 - // Repeat == 32974 - // Vol Up == 32975 - // Vol Down == 32976 - // Play == 32978 - ::SendMessage(hwnd, 32978, NULL, 0); - } -} - -#endif // WMP mobile 9 hacks - #endif // wxUSE_MEDIACTRL && wxUSE_ACTIVEX diff --git a/Externals/wxWidgets3/src/msw/menu.cpp b/Externals/wxWidgets3/src/msw/menu.cpp index 2b65c0142b..95d9585722 100644 --- a/Externals/wxWidgets3/src/msw/menu.cpp +++ b/Externals/wxWidgets3/src/msw/menu.cpp @@ -45,26 +45,10 @@ #include "wx/msw/private.h" #include "wx/msw/wrapcctl.h" // include "properly" -#ifdef __WXWINCE__ -#include -#include -#include -#include -#include -#if (_WIN32_WCE < 400) && !defined(__HANDHELDPC__) -#include -#endif - -#include "wx/msw/wince/missing.h" - -#endif - // other standard headers #include -#if wxUSE_OWNER_DRAWN - #include "wx/dynlib.h" -#endif +#include "wx/dynlib.h" #ifndef MNS_CHECKORBMP #define MNS_CHECKORBMP 0x04000000 @@ -169,6 +153,57 @@ public: return true; } + // Update the ranges of the existing radio groups after removing the menu + // item at the given position. + // + // The item being removed can be the item of any kind, not only the radio + // button belonging to the radio group, and this function checks for it + // and, as a side effect, returns true if this item was found inside an + // existing radio group. + bool UpdateOnRemoveItem(int pos) + { + bool inExistingGroup = false; + + // Pointer to (necessarily unique) empty group which could be left + // after removing the last radio button from it. + Ranges::iterator itEmptyGroup = m_ranges.end(); + + for ( Ranges::iterator it = m_ranges.begin(); + it != m_ranges.end(); + ++it ) + { + Range& r = *it; + + if ( pos < r.start ) + { + // Removed item was positioned before this range, update its + // indices. + r.start--; + r.end--; + } + else if ( pos <= r.end ) + { + // Removed item belongs to this radio group (it is a radio + // button), update index of its end. + r.end--; + + // Check if empty group left after removal. + // If so, it will be deleted later on. + if ( r.end < r.start ) + itEmptyGroup = it; + + inExistingGroup = true; + } + //else: Removed item was after this range, nothing to do for it. + } + + // Remove empty group from the list. + if ( itEmptyGroup != m_ranges.end() ) + m_ranges.erase(itEmptyGroup); + + return inExistingGroup; + } + private: // Contains the inclusive positions of the range start and end. struct Range @@ -185,10 +220,8 @@ namespace { // make the given menu item default -void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu), - UINT WXUNUSED_IN_WINCE(id)) +void SetDefaultMenuItem(HMENU hmenu, UINT id) { -#ifndef __WXWINCE__ WinStruct mii; mii.fMask = MIIM_STATE; mii.fState = MFS_DEFAULT; @@ -197,16 +230,14 @@ void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu), { wxLogLastError(wxT("SetMenuItemInfo")); } -#endif // !__WXWINCE__ } // make the given menu item owner-drawn -void SetOwnerDrawnMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu), - UINT WXUNUSED_IN_WINCE(id), - ULONG_PTR WXUNUSED_IN_WINCE(data), - BOOL WXUNUSED_IN_WINCE(byPositon = FALSE)) +void SetOwnerDrawnMenuItem(HMENU hmenu, + UINT id, + ULONG_PTR data, + BOOL byPositon = FALSE) { -#ifndef __WXWINCE__ WinStruct mii; mii.fMask = MIIM_FTYPE | MIIM_DATA; mii.fType = MFT_OWNERDRAW; @@ -219,27 +250,6 @@ void SetOwnerDrawnMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu), { wxLogLastError(wxT("SetMenuItemInfo")); } -#endif // !__WXWINCE__ -} - -#ifdef __WXWINCE__ -UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) -{ - WinStruct info; - info.fMask = MIIM_STATE; - // MF_BYCOMMAND is zero so test MF_BYPOSITION - if ( !::GetMenuItemInfo(hMenu, id, flags & MF_BYPOSITION ? TRUE : FALSE , & info) ) - { - wxLogLastError(wxT("GetMenuItemInfo")); - } - return info.fState; -} -#endif // __WXWINCE__ - -inline bool IsGreaterThanStdSize(const wxBitmap& bmp) -{ - return bmp.GetWidth() > ::GetSystemMetrics(SM_CXMENUCHECK) || - bmp.GetHeight() > ::GetSystemMetrics(SM_CYMENUCHECK); } } // anonymous namespace @@ -309,7 +319,7 @@ wxMenu::~wxMenu() // we should free Windows resources only if Windows doesn't do it for us // which happens if we're attached to a menubar or a submenu of another // menu - if ( !IsAttached() && !GetParent() ) + if ( m_hMenu && !IsAttached() && !GetParent() ) { if ( !::DestroyMenu(GetHmenu()) ) { @@ -412,49 +422,6 @@ void wxMenu::UpdateAccel(wxMenuItem *item) namespace { -// helper of DoInsertOrAppend(): returns the HBITMAP to use in MENUITEMINFO -HBITMAP GetHBitmapForMenu(wxMenuItem *pItem, bool checked = true) -{ - // Under versions of Windows older than Vista we can't pass HBITMAP - // directly as hbmpItem for 2 reasons: - // 1. We can't draw it with transparency then (this is not - // very important now but would be with themed menu bg) - // 2. Worse, Windows inverts the bitmap for the selected - // item and this looks downright ugly - // - // So we prefer to instead draw it ourselves in MSWOnDrawItem().by using - // HBMMENU_CALLBACK when inserting it - // - // However under Vista using HBMMENU_CALLBACK causes the entire menu to be - // drawn using the classic theme instead of the current one and it does - // handle transparency just fine so do use the real bitmap there -#if wxUSE_IMAGE - if ( wxGetWinVersion() >= wxWinVersion_Vista ) - { -#if wxUSE_OWNER_DRAWN - wxBitmap bmp = pItem->GetBitmap(checked); - if ( bmp.IsOk() ) - { - // we must use PARGB DIB for the menu bitmaps so ensure that we do - wxImage img(bmp.ConvertToImage()); - if ( !img.HasAlpha() ) - { - img.InitAlpha(); - pItem->SetBitmap(img, checked); - } - - return GetHbitmapOf(pItem->GetBitmap(checked)); - } -#endif // wxUSE_OWNER_DRAWN - //else: bitmap is not set - - return NULL; - } -#endif // wxUSE_IMAGE - - return HBMMENU_CALLBACK; -} - } // anonymous namespace bool wxMenu::MSWGetRadioGroupRange(int pos, int *start, int *end) const @@ -526,6 +493,15 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) checkInitially = true; } + // Also handle the case of check menu items that had been checked before + // being attached to the menu: we don't need to actually call Check() on + // them, so we don't use checkInitially in this case, but we do need to + // make them checked at Windows level too. Notice that we shouldn't ask + // Windows for the checked state here, as wxMenuItem::IsChecked() does, as + // the item is not attached yet, so explicitly call the base class version. + if ( pItem->IsCheck() && pItem->wxMenuItemBase::IsChecked() ) + flags |= MF_CHECKED; + // adjust position to account for the title of a popup menu, if any if ( !GetMenuBar() && !m_title.empty() ) pos += 2; // for the title itself and its separator @@ -538,47 +514,16 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // other items already are. if ( m_ownerDrawn ) pItem->SetOwnerDrawn(true); -#endif // wxUSE_OWNER_DRAWN // check if we have something more than a simple text item -#if wxUSE_OWNER_DRAWN bool makeItemOwnerDrawn = false; - if ( pItem->IsOwnerDrawn() ) - { -#ifndef __DMC__ +#endif // wxUSE_OWNER_DRAWN - if ( !m_ownerDrawn && !pItem->IsSeparator() ) - { - // MIIM_BITMAP only works under WinME/2000+ so we always use owner - // drawn item under the previous versions and we also have to use - // them in any case if the item has custom colours or font - static const wxWinVersion winver = wxGetWinVersion(); - bool mustUseOwnerDrawn = winver < wxWinVersion_98 || - pItem->GetTextColour().IsOk() || - pItem->GetBackgroundColour().IsOk() || - pItem->GetFont().IsOk(); - - // Windows XP or earlier don't display menu bitmaps bigger than - // standard size correctly (they're truncated), so we must use - // owner-drawn items to show them correctly there. OTOH Win7 - // doesn't seem to have any problems with even very large bitmaps - // so don't use owner-drawn items unnecessarily there (Vista wasn't - // actually tested but I assume it works as 7 rather than as XP). - if ( !mustUseOwnerDrawn && winver < wxWinVersion_Vista ) - { - const wxBitmap& bmpUnchecked = pItem->GetBitmap(false), - bmpChecked = pItem->GetBitmap(true); - - if ( (bmpUnchecked.IsOk() && IsGreaterThanStdSize(bmpUnchecked)) || - (bmpChecked.IsOk() && IsGreaterThanStdSize(bmpChecked)) ) - { - mustUseOwnerDrawn = true; - } - } - - // use InsertMenuItem() if possible as it's guaranteed to look - // correct while our owner-drawn code is not - if ( !mustUseOwnerDrawn ) + if ( +#if wxUSE_OWNER_DRAWN + !pItem->IsOwnerDrawn() && +#endif + !pItem->IsSeparator() ) { WinStruct mii; mii.fMask = MIIM_STRING | MIIM_DATA; @@ -588,13 +533,13 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( pItem->IsCheckable() ) { mii.fMask |= MIIM_CHECKMARKS; - mii.hbmpChecked = GetHBitmapForMenu(pItem, true); - mii.hbmpUnchecked = GetHBitmapForMenu(pItem, false); + mii.hbmpChecked = pItem->GetHBitmapForMenu(wxMenuItem::Checked); + mii.hbmpUnchecked = pItem->GetHBitmapForMenu(wxMenuItem::Unchecked); } else if ( pItem->GetBitmap().IsOk() ) { mii.fMask |= MIIM_BITMAP; - mii.hbmpItem = GetHBitmapForMenu(pItem); + mii.hbmpItem = pItem->GetHBitmapForMenu(wxMenuItem::Normal); } mii.cch = itemText.length(); @@ -611,12 +556,28 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) mii.wID = id; } + if ( flags & MF_GRAYED ) + { + mii.fMask |= MIIM_STATE; + mii.fState = MFS_GRAYED; + } + + if ( flags & MF_CHECKED ) + { + mii.fMask |= MIIM_STATE; + mii.fState = MFS_CHECKED; + } + mii.dwItemData = reinterpret_cast(pItem); ok = ::InsertMenuItem(GetHmenu(), pos, TRUE /* by pos */, &mii); if ( !ok ) { wxLogLastError(wxT("InsertMenuItem()")); +#if wxUSE_OWNER_DRAWN + // In case of failure switch new item to the owner-drawn mode. + makeItemOwnerDrawn = true; +#endif } else // InsertMenuItem() ok { @@ -625,32 +586,17 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // boxes are used together with bitmaps and this is not the // case in wx API WinStruct mi; - - // don't call SetMenuInfo() directly, this would prevent - // the app from starting up under Windows 95/NT 4 - typedef BOOL (WINAPI *SetMenuInfo_t)(HMENU, MENUINFO *); - - wxDynamicLibrary dllUser(wxT("user32")); - wxDYNLIB_FUNCTION(SetMenuInfo_t, SetMenuInfo, dllUser); - if ( pfnSetMenuInfo ) + mi.fMask = MIM_STYLE; + mi.dwStyle = MNS_CHECKORBMP; + if ( !::SetMenuInfo(GetHmenu(), &mi) ) { - mi.fMask = MIM_STYLE; - mi.dwStyle = MNS_CHECKORBMP; - if ( !(*pfnSetMenuInfo)(GetHmenu(), &mi) ) - { - wxLogLastError(wxT("SetMenuInfo(MNS_NOCHECK)")); - } + wxLogLastError(wxT("SetMenuInfo(MNS_NOCHECK)")); } - - // tell the item that it's not really owner-drawn but only - // needs to draw its bitmap, the rest is done by Windows - pItem->SetOwnerDrawn(false); } - } } -#endif // __DMC__ - if ( !ok ) +#if wxUSE_OWNER_DRAWN + if ( pItem->IsOwnerDrawn() || makeItemOwnerDrawn ) { // item draws itself, pass pointer to it in data parameter flags |= MF_OWNERDRAW; @@ -680,31 +626,37 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) { // we must use position in SetOwnerDrawnMenuItem because // all separators have the same id - int pos = 0; + int position = 0; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); while (node) { wxMenuItem* item = node->GetData(); - if ( !item->IsOwnerDrawn()) + // Current item is already added to the list of items + // but is not yet physically attached to the menu + // so we have to skip setting it as an owner drawn. + // It will be done later on when the item will be created. + if ( !item->IsOwnerDrawn() && item != pItem ) { item->SetOwnerDrawn(true); - SetOwnerDrawnMenuItem(GetHmenu(), pos, + SetOwnerDrawnMenuItem(GetHmenu(), position, reinterpret_cast(item), TRUE); } item->SetMarginWidth(m_maxBitmapWidth); node = node->GetNext(); - pos++; + // Current item is already added to the list of items + // but is not yet physically attached to the menu + // so it cannot be counted while determining position + // in the menu. + if ( item != pItem ) + position++; } // set menu as ownerdrawn m_ownerDrawn = true; - // also ensure that the new item itself is made owner drawn - makeItemOwnerDrawn = true; - ResetMaxAccelWidth(); } // only update our margin for equals alignment to other item @@ -713,19 +665,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) pItem->SetMarginWidth(m_maxBitmapWidth); } } - } - else #endif // wxUSE_OWNER_DRAWN - { - // item is just a normal string (passed in data parameter) - flags |= MF_STRING; - -#ifdef __WXWINCE__ - itemText = wxMenuItem::GetLabelText(itemText); -#endif - - pData = itemText.t_str(); - } // item might have already been inserted by InsertMenuItem() above if ( !ok ) @@ -740,6 +680,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) #if wxUSE_OWNER_DRAWN if ( makeItemOwnerDrawn ) { + pItem->SetOwnerDrawn(true); SetOwnerDrawnMenuItem(GetHmenu(), pos, reinterpret_cast(pItem), TRUE); } @@ -809,6 +750,17 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) //else: this item doesn't have an accel, nothing to do #endif // wxUSE_ACCEL + // Update indices of radio groups. + if ( m_radioData ) + { + if ( m_radioData->UpdateOnRemoveItem(pos) ) + { + wxASSERT_MSG( item->GetKind() == wxITEM_RADIO, + wxT("Removing non radio button from radio group?") ); + } + //else: item being removed is not in a radio group + } + // remove the item from the menu if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { @@ -847,7 +799,7 @@ size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const wxAcceleratorTable *wxMenu::CreateAccelTable() const { const size_t count = m_accels.size(); - wxScopedArray accels(new wxAcceleratorEntry[count]); + wxScopedArray accels(count); CopyAccels(accels.get()); return new wxAcceleratorTable(count, accels.get()); @@ -920,34 +872,20 @@ void wxMenu::SetTitle(const wxString& label) else { // modify the title -#ifdef __WXWINCE__ - WinStruct info; - info.fMask = MIIM_TYPE; - info.fType = MFT_STRING; - info.cch = m_title.length(); - info.dwTypeData = wxMSW_CONV_LPTSTR(m_title); - if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) ) - { - wxLogLastError(wxT("SetMenuItemInfo")); - } -#else if ( !ModifyMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING, (UINT_PTR)idMenuTitle, m_title.t_str()) ) { wxLogLastError(wxT("ModifyMenu")); } -#endif } } -#ifdef __WIN32__ // put the title string in bold face if ( !m_title.empty() ) { SetDefaultMenuItem(GetHmenu(), (UINT)idMenuTitle); } -#endif // Win32 } // --------------------------------------------------------------------------- @@ -966,17 +904,23 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_) // update the check item when it's clicked wxMenuItem * const item = FindItem(id); - if ( item && item->IsCheckable() ) + if ( item ) { - item->Toggle(); + if ( (item->GetKind() == wxITEM_RADIO) && item->IsChecked() ) + return true; - // Get the status of the menu item: note that it has been just changed - // by Toggle() above so here we already get the new state of the item. - // - // Also notice that we must pass unsigned id_ and not sign-extended id - // to ::GetMenuState() as this is what it expects. - UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND); - checked = (menuState & MF_CHECKED) != 0; + if ( item->IsCheckable() ) + { + item->Toggle(); + + // Get the status of the menu item: note that it has been just changed + // by Toggle() above so here we already get the new state of the item. + // + // Also notice that we must pass unsigned id_ and not sign-extended id + // to ::GetMenuState() as this is what it expects. + UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND); + checked = (menuState & MF_CHECKED) != 0; + } } SendEvent(id, checked); @@ -986,7 +930,6 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_) } // get the menu with given handle (recursively) -#if wxUSE_OWNER_DRAWN wxMenu* wxMenu::MSWGetMenu(WXHMENU hMenu) { // check self @@ -1009,7 +952,6 @@ wxMenu* wxMenu::MSWGetMenu(WXHMENU hMenu) // unknown hMenu return NULL; } -#endif // wxUSE_OWNER_DRAWN // --------------------------------------------------------------------------- // Menu Bar @@ -1019,16 +961,6 @@ void wxMenuBar::Init() { m_eventHandler = this; m_hMenu = 0; -#if wxUSE_TOOLBAR && defined(__WXWINCE__) - m_toolBar = NULL; -#endif - // Not using a combined wxToolBar/wxMenuBar? then use - // a commandbar in WinCE .NET just to implement the - // menubar. -#if defined(WINCE_WITH_COMMANDBAR) - m_commandBar = NULL; - m_adornmentsAdded = false; -#endif } wxMenuBar::wxMenuBar() @@ -1059,29 +991,13 @@ wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], lon wxMenuBar::~wxMenuBar() { - // In Windows CE (not .NET), the menubar is always associated - // with a toolbar, which destroys the menu implicitly. -#if defined(WINCE_WITHOUT_COMMANDBAR) && defined(__POCKETPC__) - if (GetToolBar()) - { - wxToolMenuBar* toolMenuBar = wxDynamicCast(GetToolBar(), wxToolMenuBar); - if (toolMenuBar) - toolMenuBar->SetMenuBar(NULL); - } -#else // we should free Windows resources only if Windows doesn't do it for us // which happens if we're attached to a frame if (m_hMenu && !IsAttached()) { -#if defined(WINCE_WITH_COMMANDBAR) - ::DestroyWindow((HWND) m_commandBar); - m_commandBar = (WXHWND) NULL; -#else ::DestroyMenu((HMENU)m_hMenu); -#endif m_hMenu = (WXHMENU)NULL; } -#endif } // --------------------------------------------------------------------------- @@ -1095,64 +1011,11 @@ void wxMenuBar::Refresh() wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") ); -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (GetToolBar()) - { - CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0); - } -#elif defined(WINCE_WITH_COMMANDBAR) - if (m_commandBar) - DrawMenuBar((HWND) m_commandBar); -#else DrawMenuBar(GetHwndOf(GetFrame())); -#endif } WXHMENU wxMenuBar::Create() { - // Note: this doesn't work at all on Smartphone, - // since you have to use resources. - // We'll have to find another way to add a menu - // by changing/adding menu items to an existing menu. -#if defined(WINCE_WITHOUT_COMMANDBAR) - if ( m_hMenu != 0 ) - return m_hMenu; - - wxToolMenuBar * const bar = static_cast(GetToolBar()); - if ( !bar ) - return NULL; - - HWND hCommandBar = GetHwndOf(bar); - - // notify comctl32.dll about the version of the headers we use before using - // any other TB_XXX messages - SendMessage(hCommandBar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - - TBBUTTON tbButton; - wxZeroMemory(tbButton); - tbButton.iBitmap = I_IMAGENONE; - tbButton.fsState = TBSTATE_ENABLED; - tbButton.fsStyle = TBSTYLE_DROPDOWN | - TBSTYLE_NO_DROPDOWN_ARROW | - TBSTYLE_AUTOSIZE; - - for ( unsigned i = 0; i < GetMenuCount(); i++ ) - { - HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu(); - tbButton.dwData = (DWORD)hPopupMenu; - wxString label = wxStripMenuCodes(GetMenuLabel(i)); - tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label); - - tbButton.idCommand = NewControlId(); - if ( !::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton) ) - { - wxLogLastError(wxT("TB_INSERTBUTTON")); - } - } - - m_hMenu = bar->GetHMenu(); - return m_hMenu; -#else // !__WXWINCE__ if ( m_hMenu != 0 ) return m_hMenu; @@ -1178,7 +1041,6 @@ WXHMENU wxMenuBar::Create() } return m_hMenu; -#endif // __WXWINCE__/!__WXWINCE__ } int wxMenuBar::MSWPositionForWxMenu(wxMenu *menu, int wxpos) @@ -1187,11 +1049,7 @@ int wxMenuBar::MSWPositionForWxMenu(wxMenu *menu, int wxpos) wxASSERT(menu->GetHMenu()); wxASSERT(m_hMenu); -#if defined(__WXWINCE__) - int totalMSWItems = GetMenuCount(); -#else int totalMSWItems = GetMenuItemCount((HMENU)m_hMenu); -#endif int i; // For old C++ compatibility for(i=wxpos; i info; - info.fMask = MIIM_TYPE; - info.fType = MFT_STRING; - info.cch = label.length(); - info.dwTypeData = wxMSW_CONV_LPTSTR(label); - if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, &info) ) - { - wxLogLastError(wxT("SetMenuItemInfo")); - } - -#else if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld, id, label.t_str()) == (int)0xFFFFFFFF ) { wxLogLastError(wxT("ModifyMenu")); } -#endif Refresh(); } @@ -1316,11 +1161,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) menu->wxMenuBase::SetTitle(title); -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (IsAttached()) -#else if (GetHmenu()) -#endif { int mswpos = MSWPositionForWxMenu(menuOld,pos); @@ -1358,11 +1199,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) // wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu. // If IsAttached() is false this won't be used anyway bool isAttached = -#if defined(WINCE_WITHOUT_COMMANDBAR) - IsAttached(); -#else (GetHmenu() != 0); -#endif if ( !wxMenuBarBase::Insert(pos, menu, title) ) return false; @@ -1371,27 +1208,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) if ( isAttached ) { -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (!GetToolBar()) - return false; - TBBUTTON tbButton; - memset(&tbButton, 0, sizeof(TBBUTTON)); - tbButton.iBitmap = I_IMAGENONE; - tbButton.fsState = TBSTATE_ENABLED; - tbButton.fsStyle = TBSTYLE_DROPDOWN | TBSTYLE_NO_DROPDOWN_ARROW | TBSTYLE_AUTOSIZE; - - HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; - tbButton.dwData = (DWORD)hPopupMenu; - wxString label = wxStripMenuCodes(title); - tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label); - - tbButton.idCommand = NewControlId(); - if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) - { - wxLogLastError(wxT("TB_INSERTBUTTON")); - return false; - } -#else // We have a problem with the index if there is an extra "Window" menu // in this menu bar, which is added by wxMDIParentFrame to it directly // using Windows API (so that it remains invisible to the user code), @@ -1423,7 +1239,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) { wxLogLastError(wxT("InsertMenu")); } -#endif #if wxUSE_ACCEL if ( menu->HasAccels() ) { @@ -1449,40 +1264,13 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) menu->wxMenuBase::SetTitle(title); -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (IsAttached()) -#else if (GetHmenu()) -#endif { -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (!GetToolBar()) - return false; - TBBUTTON tbButton; - memset(&tbButton, 0, sizeof(TBBUTTON)); - tbButton.iBitmap = I_IMAGENONE; - tbButton.fsState = TBSTATE_ENABLED; - tbButton.fsStyle = TBSTYLE_DROPDOWN | TBSTYLE_NO_DROPDOWN_ARROW | TBSTYLE_AUTOSIZE; - - size_t pos = GetMenuCount(); - HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; - tbButton.dwData = (DWORD)hPopupMenu; - wxString label = wxStripMenuCodes(title); - tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label); - - tbButton.idCommand = NewControlId(); - if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) - { - wxLogLastError(wxT("TB_INSERTBUTTON")); - return false; - } -#else if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, (UINT_PTR)submenu, title.t_str()) ) { wxLogLastError(wxT("AppendMenu")); } -#endif #if wxUSE_ACCEL if ( menu->HasAccels() ) @@ -1505,26 +1293,12 @@ wxMenu *wxMenuBar::Remove(size_t pos) if ( !menu ) return NULL; -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (IsAttached()) -#else if (GetHmenu()) -#endif { -#if defined(WINCE_WITHOUT_COMMANDBAR) - if (GetToolBar()) - { - if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0)) - { - wxLogLastError(wxT("TB_DELETEBUTTON")); - } - } -#else if ( !::RemoveMenu(GetHmenu(), (UINT)MSWPositionForWxMenu(menu,pos), MF_BYPOSITION) ) { wxLogLastError(wxT("RemoveMenu")); } -#endif #if wxUSE_ACCEL if ( menu->HasAccels() ) @@ -1580,61 +1354,35 @@ void wxMenuBar::Attach(wxFrame *frame) { wxMenuBarBase::Attach(frame); -#if defined(WINCE_WITH_COMMANDBAR) - if (!m_hMenu) - this->Create(); - if (!m_commandBar) - m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), (HWND) frame->GetHWND(), NewControlId()); - if (m_commandBar) - { - if (m_hMenu) - { - if (!CommandBar_InsertMenubarEx((HWND) m_commandBar, NULL, (LPTSTR) m_hMenu, 0)) - { - wxLogLastError(wxT("CommandBar_InsertMenubarEx")); - } - } - } -#endif - #if wxUSE_ACCEL RebuildAccelTable(); #endif // wxUSE_ACCEL } -#if defined(WINCE_WITH_COMMANDBAR) -bool wxMenuBar::AddAdornments(long style) -{ - if (m_adornmentsAdded || !m_commandBar) - return false; - - if (style & wxCLOSE_BOX) - { - if (!CommandBar_AddAdornments((HWND) m_commandBar, 0, 0)) - { - wxLogLastError(wxT("CommandBar_AddAdornments")); - } - else - { - return true; - } - } - return false; -} -#endif - void wxMenuBar::Detach() { wxMenuBarBase::Detach(); } -// get the menu with given handle (recursively) -wxMenu* wxMenuBar::MSWGetMenu(WXHMENU hMenu) +int wxMenuBar::MSWGetTopMenuPos(WXHMENU hMenu) const { - wxCHECK_MSG( GetHMenu() != hMenu, NULL, - wxT("wxMenuBar::MSWGetMenu(): menu handle is wxMenuBar, not wxMenu") ); + for ( size_t n = 0 ; n < GetMenuCount(); ++n ) + { + wxMenu* menu = GetMenu(n)->MSWGetMenu(hMenu); + if ( menu ) + return n; + } + + return wxNOT_FOUND; +} + +wxMenu* wxMenuBar::MSWGetMenu(WXHMENU hMenu) const +{ + // If we're called with the handle of the menu bar itself, we can return + // immediately as it certainly can't be the handle of one of our menus. + if ( hMenu == GetHMenu() ) + return NULL; -#if wxUSE_OWNER_DRAWN // query all menus for ( size_t n = 0 ; n < GetMenuCount(); ++n ) { @@ -1642,7 +1390,6 @@ wxMenu* wxMenuBar::MSWGetMenu(WXHMENU hMenu) if ( menu ) return menu; } -#endif // unknown hMenu return NULL; diff --git a/Externals/wxWidgets3/src/msw/menuitem.cpp b/Externals/wxWidgets3/src/msw/menuitem.cpp index de808b31e0..8082ec2113 100644 --- a/Externals/wxWidgets3/src/msw/menuitem.cpp +++ b/Externals/wxWidgets3/src/msw/menuitem.cpp @@ -47,15 +47,7 @@ #include "wx/msw/private.h" #include "wx/msw/dc.h" - -#ifdef __WXWINCE__ -// Implemented in menu.cpp -UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) ; -#endif - -#if wxUSE_UXTHEME - #include "wx/msw/uxtheme.h" -#endif +#include "wx/msw/uxtheme.h" // --------------------------------------------------------------------------- // macro @@ -134,6 +126,12 @@ private: int m_modeOld; }; +inline bool IsGreaterThanStdSize(const wxBitmap& bmp) +{ + return bmp.GetWidth() > ::GetSystemMetrics(SM_CXMENUCHECK) || + bmp.GetHeight() > ::GetSystemMetrics(SM_CYMENUCHECK); +} + } // anonymous namespace // ============================================================================ @@ -149,10 +147,6 @@ private: #define SPI_GETKEYBOARDCUES 0x100A #endif -#ifndef DSS_HIDEPREFIX -#define DSS_HIDEPREFIX 0x0200 -#endif - #if wxUSE_UXTHEME enum MENUPARTS @@ -561,11 +555,12 @@ void wxMenuItem::Enable(bool enable) if ( m_isEnabled == enable ) return; - if ( m_parentMenu ) + const int itemPos = MSGetMenuItemPos(); + if ( itemPos != -1 ) { long rc = EnableMenuItem(GetHMenuOf(m_parentMenu), - GetMSWId(), - MF_BYCOMMAND | + itemPos, + MF_BYPOSITION | (enable ? MF_ENABLED : MF_GRAYED)); if ( rc == -1 ) @@ -612,7 +607,6 @@ void wxMenuItem::Check(bool check) return; } -#ifdef __WIN32__ // calling CheckMenuRadioItem() with such parameters hangs my system // (NT4 SP6) and I suspect this could happen to the others as well, // so don't do it! @@ -627,7 +621,6 @@ void wxMenuItem::Check(bool check) { wxLogLastError(wxT("CheckMenuRadioItem")); } -#endif // __WIN32__ // also uncheck all the other items in this radio group wxMenuItemList::compatibility_iterator node = items.Item(start); @@ -675,28 +668,26 @@ void wxMenuItem::SetItemLabel(const wxString& txt) m_parentMenu->UpdateAccel(this); #endif // wxUSE_ACCEL - const UINT id = GetMSWId(); - HMENU hMenu = GetHMenuOf(m_parentMenu); - if ( !hMenu || ::GetMenuState(hMenu, id, MF_BYCOMMAND) == (UINT)-1 ) + const int itemPos = MSGetMenuItemPos(); + if ( itemPos == -1 ) return; + HMENU hMenu = GetHMenuOf(m_parentMenu); + // update the text of the native menu item WinStruct info; // surprisingly, calling SetMenuItemInfo() with just MIIM_STRING doesn't // work as it resets the menu bitmap, so we need to first get the old item // state and then modify it - const bool isLaterThanWin95 = wxGetWinVersion() > wxWinVersion_95; info.fMask = MIIM_STATE | MIIM_ID | MIIM_SUBMENU | MIIM_CHECKMARKS | - MIIM_DATA; - if ( isLaterThanWin95 ) - info.fMask |= MIIM_BITMAP | MIIM_FTYPE; - else - info.fMask |= MIIM_TYPE; - if ( !::GetMenuItemInfo(hMenu, id, FALSE, &info) ) + MIIM_DATA | + MIIM_BITMAP | + MIIM_FTYPE; + if ( !::GetMenuItemInfo(hMenu, itemPos, TRUE, &info) ) { wxLogLastError(wxT("GetMenuItemInfo")); return; @@ -712,17 +703,100 @@ void wxMenuItem::SetItemLabel(const wxString& txt) // items however as otherwise their size wouldn't be recalculated as // WM_MEASUREITEM wouldn't be sent and this could result in display // problems if the length of the menu item changed significantly. - if ( !IsOwnerDrawn() ) + // + // Also notice that we shouldn't use our IsOwnerDrawn() because it can be + // true because it was set by e.g. SetBitmap(), even if the item wasn't + // made owner drawn at Windows level. + if ( !(info.fState & MF_OWNERDRAW) ) #endif // wxUSE_OWNER_DRAWN { - if ( isLaterThanWin95 ) - info.fMask |= MIIM_STRING; - //else: MIIM_TYPE already specified + info.fMask |= MIIM_STRING; info.dwTypeData = wxMSW_CONV_LPTSTR(m_text); info.cch = m_text.length(); } - if ( !::SetMenuItemInfo(hMenu, id, FALSE, &info) ) + if ( !::SetMenuItemInfo(hMenu, itemPos, TRUE, &info) ) + { + wxLogLastError(wxT("SetMenuItemInfo")); + } +} + +void wxMenuItem::DoSetBitmap(const wxBitmap& bmpNew, bool bChecked) +{ + wxBitmap& bmp = bChecked ? m_bmpChecked : m_bmpUnchecked; + if ( bmp.IsSameAs(bmpNew) ) + return; + +#if wxUSE_IMAGE + if ( !bmpNew.HasAlpha() && wxGetWinVersion() >= wxWinVersion_Vista) + { + // we must use PARGB DIB for the menu bitmaps so ensure that we do + wxImage img(bmpNew.ConvertToImage()); + img.InitAlpha(); + bmp = wxBitmap(img); + } + else +#endif // wxUSE_IMAGE + { + bmp = bmpNew; + } + +#if wxUSE_OWNER_DRAWN + // already marked as owner-drawn, cannot be reverted + if ( IsOwnerDrawn() ) + return; + + if ( MSWMustUseOwnerDrawn() ) + { + SetOwnerDrawn(true); + + // Parent menu has to be rearranged/recalculated in this case + // (all other menu items have to be also set to owner-drawn mode). + if ( m_parentMenu ) + { + size_t pos; + wxMenuItem *item = m_parentMenu->FindChildItem(GetId(), &pos); + if ( item ) + { + wxCHECK_RET( item == this, wxS("Non unique menu item ID?") ); + + // Use a copied value of m_parentMenu because it is + // nullified by Remove. + wxMenu *menu = m_parentMenu; + menu->Remove(this); + menu->Insert(pos, this); + } + //else: the item hasn't been inserted into the parent menu yet + } + return; + } +#endif // wxUSE_OWNER_DRAWN + + const int itemPos = MSGetMenuItemPos(); + if ( itemPos == -1 ) + { + // The item is probably not attached to any menu yet. SetBitmap() is + // still valid to call in this case, just do nothing else here. + return; + } + + // update the bitmap of the native menu item + // don't set hbmpItem for the checkable items as it would + // be used for both checked and unchecked state + WinStruct mii; + if ( IsCheckable() ) + { + mii.fMask = MIIM_CHECKMARKS; + mii.hbmpChecked = GetHBitmapForMenu(Checked); + mii.hbmpUnchecked = GetHBitmapForMenu(Unchecked); + } + else + { + mii.fMask = MIIM_BITMAP; + mii.hbmpItem = GetHBitmapForMenu(Normal); + } + + if ( !::SetMenuItemInfo(GetHMenuOf(m_parentMenu), itemPos, TRUE, &mii) ) { wxLogLastError(wxT("SetMenuItemInfo")); } @@ -992,13 +1066,13 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, SIZE accelSize; ::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize); - int flags = DST_TEXT; + flags = DST_TEXT; // themes menu is using specified color for disabled labels if ( data->MenuLayout() == MenuDrawData::Classic && (stat & wxODDisabled) && !(stat & wxODSelected) ) flags |= DSS_DISABLED; - int x = rcText.right - data->ArrowMargin.GetTotalX() + x = rcText.right - data->ArrowMargin.GetTotalX() - data->ArrowSize.cx - data->ArrowBorder; @@ -1008,7 +1082,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, else x -= m_parentMenu->GetMaxAccelWidth(); - int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; + y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel), accel.length(), x, y, 0, 0, flags); @@ -1245,8 +1319,114 @@ void wxMenuItem::GetColourToUse(wxODStatus stat, wxColour& colText, wxColour& co wxOwnerDrawn::GetColourToUse(stat, colText, colBack); } } + +bool wxMenuItem::MSWMustUseOwnerDrawn() +{ + // MIIM_BITMAP only works under WinME/2000+ so we always use owner + // drawn item under the previous versions and we also have to use + // them in any case if the item has custom colours or font + static const wxWinVersion winver = wxGetWinVersion(); + bool mustUseOwnerDrawn = winver < wxWinVersion_98 || + GetTextColour().IsOk() || + GetBackgroundColour().IsOk() || + GetFont().IsOk(); + + // Windows XP or earlier don't display menu bitmaps bigger than + // standard size correctly (they're truncated) nor can + // checked bitmaps use HBMMENU_CALLBACK, so we must use + // owner-drawn items to show them correctly there. OTOH Win7 + // doesn't seem to have any problems with even very large bitmaps + // so don't use owner-drawn items unnecessarily there (Vista wasn't + // actually tested but I assume it works as 7 rather than as XP). + if ( !mustUseOwnerDrawn && winver < wxWinVersion_Vista ) + { + const wxBitmap& bmpUnchecked = GetBitmap(false), + bmpChecked = GetBitmap(true); + + if ( (bmpUnchecked.IsOk() && IsGreaterThanStdSize(bmpUnchecked)) || + (bmpChecked.IsOk() && IsGreaterThanStdSize(bmpChecked)) || + (bmpChecked.IsOk() && IsCheckable()) ) + { + mustUseOwnerDrawn = true; + } + } + + return mustUseOwnerDrawn; +} + #endif // wxUSE_OWNER_DRAWN +// returns the HBITMAP to use in MENUITEMINFO +HBITMAP wxMenuItem::GetHBitmapForMenu(BitmapKind kind) const +{ + // Under versions of Windows older than Vista we can't pass HBITMAP + // directly as hbmpItem for 2 reasons: + // 1. We can't draw it with transparency then (this is not + // very important now but would be with themed menu bg) + // 2. Worse, Windows inverts the bitmap for the selected + // item and this looks downright ugly + // + // So we prefer to instead draw it ourselves in MSWOnDrawItem() by using + // HBMMENU_CALLBACK for normal menu items when inserting it. And use + // NULL for checkable menu items as hbmpChecked/hBmpUnchecked does not + // support HBMMENU_CALLBACK. + // + // However under Vista using HBMMENU_CALLBACK causes the entire menu to be + // drawn using the classic theme instead of the current one and it does + // handle transparency just fine so do use the real bitmap there +#if wxUSE_IMAGE + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + { + bool checked = (kind != Unchecked); + wxBitmap bmp = GetBitmap(checked); + if ( bmp.IsOk() ) + { + return GetHbitmapOf(bmp); + } + //else: bitmap is not set + return NULL; + } +#endif // wxUSE_IMAGE + + return (kind == Normal) ? HBMMENU_CALLBACK : NULL; +} + +int wxMenuItem::MSGetMenuItemPos() const +{ + if ( !m_parentMenu ) + return -1; + + const HMENU hMenu = GetHMenuOf(m_parentMenu); + if ( !hMenu ) + return -1; + + const WXWPARAM id = GetMSWId(); + const int menuItems = ::GetMenuItemCount(hMenu); + for ( int i = 0; i < menuItems; i++ ) + { + const UINT state = ::GetMenuState(hMenu, i, MF_BYPOSITION); + if ( state == (UINT)-1 ) + { + // This indicates that the item at this position and is not + // supposed to happen here, but test for it just in case. + continue; + } + + if ( state & MF_POPUP ) + { + if ( ::GetSubMenu(hMenu, i) == (HMENU)id ) + return i; + } + else if ( !(state & MF_SEPARATOR) ) + { + if ( ::GetMenuItemID(hMenu, i) == id ) + return i; + } + } + + return -1; +} + // ---------------------------------------------------------------------------- // wxMenuItemBase // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/metafile.cpp b/Externals/wxWidgets3/src/msw/metafile.cpp index 15a2caf97c..5f88acdadd 100644 --- a/Externals/wxWidgets3/src/msw/metafile.cpp +++ b/Externals/wxWidgets3/src/msw/metafile.cpp @@ -43,8 +43,8 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC) +wxIMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC); // ============================================================================ // implementation @@ -236,7 +236,7 @@ void wxMetafileDCImpl::DoGetTextExtent(const wxString& string, SIZE sizeRect; TEXTMETRIC tm; - ::GetTextExtentPoint32(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); + ::GetTextExtentPoint32(dc, string.c_str(), string.length(), &sizeRect); ::GetTextMetrics(dc, &tm); if ( x ) @@ -326,7 +326,6 @@ void wxMetafileDCImpl::SetMapMode(wxMappingMode mode) // wxMakeMetafilePlaceable // ---------------------------------------------------------------------------- -#ifdef __WIN32__ struct RECT32 { short left; @@ -343,16 +342,6 @@ struct mfPLACEABLEHEADER { DWORD reserved; WORD checksum; }; -#else -struct mfPLACEABLEHEADER { - DWORD key; - HANDLE hmf; - RECT bbox; - WORD inch; - DWORD reserved; - WORD checksum; -}; -#endif /* * Pass filename of existing non-placeable metafile, and bounding box. diff --git a/Externals/wxWidgets3/src/msw/microwin.c b/Externals/wxWidgets3/src/msw/microwin.c deleted file mode 100644 index 3748c84531..0000000000 --- a/Externals/wxWidgets3/src/msw/microwin.c +++ /dev/null @@ -1,364 +0,0 @@ -/* -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/microwin.cpp -// Purpose: Extra implementation for MicroWindows -// Author: Julian Smart -// Created: 2001-05-31 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -*/ - -#include "mwtypes.h" -#include "windows.h" -#include "wintern.h" -#include "device.h" -#include "wx/msw/microwin.h" - -void GdMoveCursor(MWCOORD x, MWCOORD y); -void MwSetCursor(HWND wp, PMWCURSOR pcursor); - -BOOL SetCursorPos(int x, int y) -{ - GdMoveCursor(x, y); - return TRUE; -} - -HCURSOR SetCursor(HCURSOR hCursor) -{ - /* TODO */ - return 0; -} - -int GetScrollPosWX (HWND hWnd, int iSBar) -{ - int pos = 0; - if (GetScrollPos(hWnd, iSBar, & pos)) - return pos; - else - return 0; -} - -BOOL ScrollWindow(HWND hWnd, int xAmount, int yAmount, - CONST RECT* lpRect, CONST RECT* lpClipRect) -{ - /* TODO */ - return FALSE; -} - -HWND WindowFromPoint(POINT pt) -{ - /* TODO */ - return 0; -} - -SHORT GetKeyState(int nVirtKey) -{ - /* TODO */ - return 0; -} - -HWND SetParent(HWND hWndChild, HWND hWndNewParent) -{ - /* TODO */ - return 0; -} - -VOID DragAcceptFiles(HWND hWnd, BOOL b) -{ - /* TODO */ -} - -BOOL IsDialogMessage(HWND hWnd, MSG* msg) -{ - /* TODO */ - return FALSE; -} - -DWORD GetMessagePos(VOID) -{ - /* TODO */ - return 0; -} - -BOOL IsIconic(HWND hWnd) -{ - /* TODO */ - return FALSE; -} - -int SetMapMode(HDC hDC, wxMappingMode mode) -{ - return MM_TEXT; -} - -wxMappingMode GetMapMode(HDC hDC) -{ - return MM_TEXT; -} - -HCURSOR LoadCursor(HINSTANCE hInst, int cursor) -{ - /* TODO */ - return 0; -} - -DWORD GetModuleFileName(HINSTANCE hInst, LPSTR name, DWORD sz) -{ - /* TODO */ - name[0] = 0; - return 0; -} - -VOID DestroyIcon(HICON hIcon) -{ - /* TODO */ -} - -COLORREF GetTextColor(HDC hdc) -{ - if (!hdc) - return CLR_INVALID; - return hdc->textcolor ; -} - -COLORREF GetBkColor(HDC hdc) -{ - if (!hdc) - return CLR_INVALID; - return hdc->bkcolor ; -} - -HPALETTE SelectPalette(HDC hdc, HPALETTE hPalette, BOOL b) -{ - /* TODO */ - return 0; -} - -BOOL IntersectClipRect(HDC hdc, int x, int y, - int right, int bottom) -{ - /* TODO */ - HRGN rgn = CreateRectRgn(x, y, right, bottom); - - BOOL ret = (ExtSelectClipRgn(hdc, rgn, RGN_AND) != ERROR); - DeleteObject(rgn); - return ret; -} - -BOOL GetClipBox(HDC hdc, RECT* rect) -{ - MWCLIPREGION* r; - MWRECT mwrect; - - if (!hdc->region) - return FALSE; - - r = ((MWRGNOBJ*) hdc->region)->rgn; - GdGetRegionBox(r, & mwrect); - rect->left = mwrect.left; - rect->top = mwrect.top; - rect->right = mwrect.right; - rect->bottom = mwrect.bottom; - - return TRUE; -} - -BOOL DrawIconEx(HDC hdc, int x, int y, HICON hIcon, int w, int h, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags) -{ - /* TODO */ - return FALSE; -} - -BOOL SetViewportExtEx(HDC hdc, int x, int y, LPSIZE lpSize) -{ - /* TODO */ - return FALSE; -} - -BOOL SetViewportOrgEx(HDC hdc, int x, int y, LPPOINT lpPoint) -{ - /* TODO */ - return FALSE; -} - -BOOL SetWindowExtEx(HDC hdc, int x, int y, LPSIZE lpSize) -{ - /* TODO */ - return FALSE; -} - -BOOL SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lpSize) -{ - /* TODO */ - return FALSE; -} - -BOOL ExtFloodFill(HDC hdc, int x, int y, COLORREF col, UINT flags) -{ - /* TODO */ - return FALSE; -} - -int SetPolyFillMode(HDC hdc, int mode) -{ - /* TODO */ - return 0; -} - -BOOL RoundRect(HDC hdc, int left, int top, int right, int bottom, int r1, int r2) -{ - /* TODO */ - return Rectangle(hdc, left, top, right, bottom); -} - -BOOL MaskBlt(HDC hdc, int x, int y, int w, int h, - HDC hDCSource, int xSrc, int ySrc, HBITMAP hBitmapMask, int xMask, int yMask, DWORD rop) -{ - /* TODO */ - return FALSE; -} - -UINT RealizePalette(HDC hDC) -{ - /* TODO */ - return 0; -} - -BOOL SetBrushOrgEx(HDC hdc, int xOrigin, int yOrigin, LPPOINT lpPoint) -{ - /* TODO */ - return FALSE; -} - -int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj) -{ - if (sz == sizeof(LOGFONT)) - { - LOGFONT* logFont = (LOGFONT*) logObj; - MWFONTINFO fi; - HFONT hFont = (HFONT) hObj; - - GdGetFontInfo(((MWFONTOBJ*) hFont)->pfont, &fi); - - /* FIXME many items are guessed for the time being*/ - logFont->lfHeight = fi.height; - - /* reversed for kaffe port - logFont->tmAscent = fi.height - fi.baseline; - logFont->tmDescent= fi.baseline; - */ - - logFont->lfWidth = fi.widths['x']; - logFont->lfWeight = FW_NORMAL; - logFont->lfEscapement = 0; - logFont->lfOrientation = 0; - logFont->lfOutPrecision = OUT_OUTLINE_PRECIS; - logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS; - logFont->lfQuality = DEFAULT_QUALITY; - logFont->lfItalic = 0; - logFont->lfUnderline = 0; - logFont->lfStrikeOut = 0; - /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/ - logFont->lfPitchAndFamily = fi.fixed? - FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH); - logFont->lfCharSet = OEM_CHARSET; - /* TODO I don't know how to get the font name. May - * test for different font classes. - */ - logFont->lfFaceName[0] = 0; -#if 0 - strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName)); -#endif - return sz; - } - else - { - return 0; - } -} - -/* Not in wingdi.c in earlier versions of MicroWindows */ -#if 0 -HBITMAP WINAPI -CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight) -{ - MWBITMAPOBJ *hbitmap; - int size; - int linelen; - - if(!hdc) - return NULL; - - nWidth = MWMAX(nWidth, 1); - nHeight = MWMAX(nHeight, 1); - - /* calc memory allocation size and linelen from width and height*/ - if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen)) - return NULL; - - /* allocate gdi object*/ - hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size); - if(!hbitmap) - return NULL; - hbitmap->hdr.type = OBJ_BITMAP; - hbitmap->hdr.stockobj = FALSE; - hbitmap->width = nWidth; - hbitmap->height = nHeight; - - /* create compatible with hdc*/ - hbitmap->planes = hdc->psd->planes; - hbitmap->bpp = hdc->psd->bpp; - hbitmap->linelen = linelen; - hbitmap->size = size; - - return (HBRUSH)hbitmap; -} -#endif - -/* Attempt by JACS to create arbitrary bitmap - * TODO: make use of lpData - */ - -HBITMAP WINAPI -CreateBitmap( int nWidth, int nHeight, int nPlanes, int bPP, LPCVOID lpData) -{ - MWBITMAPOBJ *hbitmap; - int size; - int linelen; - - HDC hScreenDC; - - hScreenDC = GetDC(NULL); - - nWidth = MWMAX(nWidth, 1); - nHeight = MWMAX(nHeight, 1); - - /* calc memory allocation size and linelen from width and height*/ - if(!GdCalcMemGCAlloc(hScreenDC->psd, nWidth, nHeight, nPlanes, bPP, &size, &linelen)) - { - ReleaseDC(NULL, hScreenDC); - return NULL; - } - ReleaseDC(NULL, hScreenDC); - - /* allocate gdi object*/ - hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size); - if(!hbitmap) - return NULL; - hbitmap->hdr.type = OBJ_BITMAP; - hbitmap->hdr.stockobj = FALSE; - hbitmap->width = nWidth; - hbitmap->height = nHeight; - - /* create with specified parameters */ - hbitmap->planes = nPlanes; - hbitmap->bpp = bPP; - hbitmap->linelen = linelen; - hbitmap->size = size; - - /* TODO: copy data */ - - return (HBRUSH)hbitmap; -} diff --git a/Externals/wxWidgets3/src/msw/mimetype.cpp b/Externals/wxWidgets3/src/msw/mimetype.cpp index 9bd56ad436..380a2807ed 100644 --- a/Externals/wxWidgets3/src/msw/mimetype.cpp +++ b/Externals/wxWidgets3/src/msw/mimetype.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 23.09.98 // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence (part of wxExtra library) +// Licence: wxWidgets licence (part of base library) ///////////////////////////////////////////////////////////////////////////// // for compilers that support precompilation, includes "wx.h". @@ -34,12 +34,28 @@ #include "wx/file.h" #include "wx/iconloc.h" #include "wx/confbase.h" +#include "wx/dynlib.h" #ifdef __WINDOWS__ #include "wx/msw/registry.h" #include "wx/msw/private.h" + #include + #include + + // For MSVC we can link in the required library explicitly, for the other + // compilers (e.g. MinGW) this needs to be done at makefiles level. + #ifdef __VISUALC__ + #pragma comment(lib, "shlwapi") + #endif #endif // OS +// Unfortunately the corresponding SDK constants are absent from the headers +// shipped with some old MinGW versions (e.g. 4.2.1 from Debian) and we can't +// even test whether they're defined or not, as they're enum elements and not +// preprocessor constants. So we have to always use our own constants. +#define wxASSOCF_NOTRUNCATE (static_cast(0x20)) +#define wxASSOCSTR_DEFAULTICON (static_cast(15)) + // other standard headers #include @@ -66,6 +82,17 @@ class WXDLLIMPEXP_FWD_CORE wxIcon; // to open/print the file (the positional parameters are introduced by %1, // %2, ... in these strings, we change them to %s ourselves) +// Notice that HKCR can be used only when reading from the registry, when +// writing to it, we need to write to HKCU\Software\Classes instead as HKCR is +// a merged view of that location and HKLM\Software\Classes that we generally +// wouldn't have the write permissions to but writing to HKCR will try writing +// to the latter unless the key being written to already exists under the +// former, resulting in a "Permission denied" error without administrative +// permissions. So the right thing to do is to use HKCR when reading, to +// respect both per-user and machine-global associations, but only write under +// HKCU. +static const wxStringCharType *CLASSES_ROOT_KEY = wxS("Software\\Classes\\"); + // although I don't know of any official documentation which mentions this // location, uses it, so it isn't likely to change static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\"); @@ -120,6 +147,8 @@ void wxFileTypeImpl::Init(const wxString& strFileType, const wxString& ext) if ( !strFileType ) { m_strFileType = m_ext.AfterFirst('.') + wxT("_auto_file"); } + + m_suppressNotify = false; } wxString wxFileTypeImpl::GetVerbPath(const wxString& verb) const @@ -184,13 +213,24 @@ size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs, return count; } +void wxFileTypeImpl::MSWNotifyShell() +{ + if (!m_suppressNotify) + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL, NULL); +} + +void wxFileTypeImpl::MSWSuppressNotifications(bool supress) +{ + m_suppressNotify = supress; +} + // ---------------------------------------------------------------------------- // modify the registry database // ---------------------------------------------------------------------------- bool wxFileTypeImpl::EnsureExtKeyExists() { - wxRegKey rkey(wxRegKey::HKCR, m_ext); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_ext); if ( !rkey.Exists() ) { if ( !rkey.Create() || !rkey.SetValue(wxEmptyString, m_strFileType) ) @@ -208,152 +248,109 @@ bool wxFileTypeImpl::EnsureExtKeyExists() // get the command to use // ---------------------------------------------------------------------------- -static wxString wxFileTypeImplGetCurVer(const wxString& progId) +// Helper wrapping AssocQueryString() Win32 function: returns the value of the +// given associated string for the specified extension (which may or not have +// the leading period). +// +// Returns empty string if the association is not found. +static +wxString wxAssocQueryString(ASSOCSTR assoc, + wxString ext, + const wxString& verb = wxString()) { - wxRegKey key(wxRegKey::HKCR, progId + wxT("\\CurVer")); - if (key.Exists()) + DWORD dwSize = MAX_PATH; + TCHAR bufOut[MAX_PATH] = { 0 }; + + if ( ext.empty() || ext[0] != '.' ) + ext.Prepend('.'); + + HRESULT hr = ::AssocQueryString + ( + wxASSOCF_NOTRUNCATE,// Fail if buffer is too small. + assoc, // The association to retrieve. + ext.t_str(), // The extension to retrieve it for. + verb.empty() ? NULL + : static_cast(verb.t_str()), + bufOut, // The buffer for output value. + &dwSize // And its size + ); + + // Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned + // but would still be an error in this context. + if ( hr != S_OK ) { - wxString value; - if (key.QueryValue(wxEmptyString, value)) - return value; + // The only really expected error here is that no association is + // defined, anything else is not expected. The confusing thing is that + // different errors are returned for this expected error under + // different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7 + // returns ERROR_NO_ASSOCIATION. Just check for both to be sure. + if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) && + hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ) + { + wxLogApiError("AssocQueryString", hr); + } + + return wxString(); } - return progId; + + return wxString(bufOut); } + wxString wxFileTypeImpl::GetCommand(const wxString& verb) const { - // suppress possible error messages - wxLogNull nolog; - wxString strKey; - - // Since Windows Vista the association used by Explorer is different from - // the association information stored in the traditional part of the - // registry. Unfortunately the new schema doesn't seem to be documented - // anywhere so using it involves a bit of guesswork: - // - // The information is stored under Explorer-specific key whose path is - // below. The interesting part is UserChoice subkey which is the only one - // we use so far but there is also OpenWithProgids subkey which can exist - // even if UserChoice doesn't. However in practice there doesn't seem to be - // any cases when OpenWithProgids values for the given extension are - // different from those found directly under HKCR\.ext, so for now we don't - // bother to use this, apparently the programs registering their file type - // associations do it in both places. We do use UserChoice because when the - // association is manually changed by the user it's only recorded there and - // so must override whatever value was created under HKCR by the setup - // program. - - { - wxRegKey explorerKey - ( - wxRegKey::HKCU, - wxT("Software\\Microsoft\\Windows\\CurrentVersion\\") - wxT("Explorer\\FileExts\\") + - m_ext + - wxT("\\UserChoice") - ); - if ( explorerKey.Open(wxRegKey::Read) && - explorerKey.QueryValue(wxT("Progid"), strKey) ) - { - strKey = wxFileTypeImplGetCurVer(strKey); - } - } - - if (!strKey && wxRegKey(wxRegKey::HKCR, m_ext + wxT("\\shell")).Exists()) - strKey = m_ext; - - if ( !strKey && !m_strFileType.empty()) - { - wxString fileType = wxFileTypeImplGetCurVer(m_strFileType); - if (wxRegKey(wxRegKey::HKCR, fileType + wxT("\\shell")).Exists()) - strKey = fileType; - } - - if ( !strKey ) - { - // no info - return wxEmptyString; - } - - strKey << wxT("\\shell\\") << verb; - wxRegKey key(wxRegKey::HKCR, strKey + wxT("\\command")); - wxString command; - if ( key.Open(wxRegKey::Read) ) { - // it's the default value of the key - if ( key.QueryValue(wxEmptyString, command) ) { - bool foundFilename = CanonicalizeParams(command); + wxString command = wxAssocQueryString(ASSOCSTR_COMMAND, m_ext, verb); + bool foundFilename = CanonicalizeParams(command); #if wxUSE_IPC - // look whether we must issue some DDE requests to the application - // (and not just launch it) - strKey += wxT("\\DDEExec"); - wxRegKey keyDDE(wxRegKey::HKCR, strKey); - if ( keyDDE.Open(wxRegKey::Read) ) { - wxString ddeCommand, ddeServer, ddeTopic; - keyDDE.QueryValue(wxEmptyString, ddeCommand); + wxString ddeCommand = wxAssocQueryString(ASSOCSTR_DDECOMMAND, m_ext); + wxString ddeTopic = wxAssocQueryString(ASSOCSTR_DDETOPIC, m_ext); - // in some cases "DDEExec" subkey exists but has no value, we - // shouldn't use DDE in this case - if ( !ddeCommand.empty() ) { - ddeCommand.Replace(wxT("%1"), wxT("%s")); + if ( !ddeCommand.empty() && !ddeTopic.empty() ) + { + wxString ddeServer = wxAssocQueryString( ASSOCSTR_DDEAPPLICATION, m_ext ); - wxRegKey keyServer(wxRegKey::HKCR, strKey + wxT("\\Application")); - keyServer.QueryValue(wxEmptyString, ddeServer); - wxRegKey keyTopic(wxRegKey::HKCR, strKey + wxT("\\Topic")); - keyTopic.QueryValue(wxEmptyString, ddeTopic); + ddeCommand.Replace(wxT("%1"), wxT("%s")); - if (ddeTopic.empty()) - ddeTopic = wxT("System"); + if ( ddeTopic.empty() ) + ddeTopic = wxT("System"); - // HACK: we use a special feature of wxExecute which exists - // just because we need it here: it will establish DDE - // conversation with the program it just launched - command.Prepend(wxT("WX_DDE#")); - command << wxT('#') << ddeServer - << wxT('#') << ddeTopic - << wxT('#') << ddeCommand; - } - } - else -#endif // wxUSE_IPC - if ( !foundFilename ) - { - // we didn't find any '%1' - the application doesn't know which - // file to open (note that we only do it if there is no DDEExec - // subkey) - // - // HACK: append the filename at the end, hope that it will do - command << wxT(" %s"); - } - } + // HACK: we use a special feature of wxExecute which exists + // just because we need it here: it will establish DDE + // conversation with the program it just launched + command.Prepend(wxT("WX_DDE#")); + command << wxT('#') << ddeServer + << wxT('#') << ddeTopic + << wxT('#') << ddeCommand; + } + else +#endif // wxUSE_IPC + if ( !foundFilename && !command.empty() ) + { + // we didn't find any '%1' - the application doesn't know which + // file to open (note that we only do it if there is no DDEExec + // subkey) + // + // HACK: append the filename at the end, hope that it will do + command << wxT(" %s"); } - //else: no such file type or no value, will return empty string return command; } -bool -wxFileTypeImpl::GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) - const + +wxString +wxFileTypeImpl::GetExpandedCommand(const wxString & verb, + const wxFileType::MessageParameters& params) const { - wxString cmd = GetCommand(wxT("open")); + wxString cmd = GetCommand(verb); - *openCmd = wxFileType::ExpandCommand(cmd, params); + // Some viewers don't define the "open" verb but do define "show" one, try + // to use it as a fallback. + if ( cmd.empty() && (verb == wxT("open")) ) + cmd = GetCommand(wxT("show")); - return !openCmd->empty(); -} - -bool -wxFileTypeImpl::GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters& params) - const -{ - wxString cmd = GetCommand(wxT("print")); - - *printCmd = wxFileType::ExpandCommand(cmd, params); - - return !printCmd->empty(); + return wxFileType::ExpandCommand(cmd, params); } // ---------------------------------------------------------------------------- @@ -404,39 +401,34 @@ bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const { - wxString strIconKey; - strIconKey << m_strFileType << wxT("\\DefaultIcon"); + wxString strIcon = wxAssocQueryString(wxASSOCSTR_DEFAULTICON, m_ext); - // suppress possible error messages - wxLogNull nolog; - wxRegKey key(wxRegKey::HKCR, strIconKey); + if ( !strIcon.empty() ) + { + wxString strFullPath = strIcon.BeforeLast(wxT(',')), + strIndex = strIcon.AfterLast(wxT(',')); - if ( key.Open(wxRegKey::Read) ) { - wxString strIcon; - // it's the default value of the key - if ( key.QueryValue(wxEmptyString, strIcon) ) { - // the format is the following: , - // NB: icon index may be negative as well as positive and the full - // path may contain the environment variables inside '%' - wxString strFullPath = strIcon.BeforeLast(wxT(',')), - strIndex = strIcon.AfterLast(wxT(',')); - - // index may be omitted, in which case BeforeLast(',') is empty and - // AfterLast(',') is the whole string - if ( strFullPath.empty() ) { - strFullPath = strIndex; - strIndex = wxT("0"); - } - - if ( iconLoc ) - { - iconLoc->SetFileName(wxExpandEnvVars(strFullPath)); - - iconLoc->SetIndex(wxAtoi(strIndex)); - } - - return true; + // index may be omitted, in which case BeforeLast(',') is empty and + // AfterLast(',') is the whole string + if ( strFullPath.empty() ) { + strFullPath = strIndex; + strIndex = wxT("0"); } + + // if the path contains spaces, it can be enclosed in quotes but we + // must not pass a filename in that format to any file system function, + // so remove them here. + if ( strFullPath.StartsWith('"') && strFullPath.EndsWith('"') ) + strFullPath = strFullPath.substr(1, strFullPath.length() - 2); + + if ( iconLoc ) + { + iconLoc->SetFileName(wxExpandEnvVars(strFullPath)); + + iconLoc->SetIndex(wxAtoi(strIndex)); + } + + return true; } // no such file type or no value or incorrect icon entry @@ -509,20 +501,6 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) return CreateFileType(wxEmptyString, ext); } -/* -wxFileType * -wxMimeTypesManagerImpl::GetOrAllocateFileTypeFromExtension(const wxString& ext) -{ - wxFileType *fileType = GetFileTypeFromExtension(ext); - if ( !fileType ) - { - fileType = CreateFileType(wxEmptyString, ext); - } - - return fileType; -} -*/ - // MIME type -> extension -> file type wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) @@ -586,11 +564,11 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) extWithDot = wxT('.'); extWithDot += ext; - // start by setting the HKCR\\.ext entries + // start by setting the entries under ".ext" // default is filetype; content type is mimetype const wxString& filetypeOrig = ftInfo.GetShortDesc(); - wxRegKey key(wxRegKey::HKCR, extWithDot); + wxRegKey key(wxRegKey::HKCU, CLASSES_ROOT_KEY + extWithDot); if ( !key.Exists() ) { // create the mapping from the extension to the filetype @@ -638,7 +616,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) // create the MIME key wxString strKey = MIME_DATABASE_KEY; strKey << mimetype; - wxRegKey keyMIME(wxRegKey::HKCR, strKey); + wxRegKey keyMIME(wxRegKey::HKCU, CLASSES_ROOT_KEY + strKey); ok = keyMIME.Create(); if ( ok ) @@ -659,7 +637,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) extWithDot = wxT('.'); extWithDot += ext; - wxRegKey key2(wxRegKey::HKCR, extWithDot); + wxRegKey key2(wxRegKey::HKCU, CLASSES_ROOT_KEY + extWithDot); if ( !key2.Exists() ) key2.Create(); key2.SetValue(wxEmptyString, filetype); @@ -676,7 +654,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) // create the MIME key wxString strKey = MIME_DATABASE_KEY; strKey << mimetype2; - wxRegKey keyMIME(wxRegKey::HKCR, strKey); + wxRegKey keyMIME(wxRegKey::HKCU, CLASSES_ROOT_KEY + strKey); ok = keyMIME.Create(); if ( ok ) @@ -687,23 +665,26 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) } } - } // end of for loop; all extensions now point to HKCR\.ext\Default + } // end of for loop; all extensions now point to .ext\Default // create the filetype key itself (it will be empty for now, but // SetCommand(), SetDefaultIcon() &c will use it later) - wxRegKey keyFT(wxRegKey::HKCR, filetype); + wxRegKey keyFT(wxRegKey::HKCU, CLASSES_ROOT_KEY + filetype); keyFT.Create(); wxFileType *ft = CreateFileType(filetype, extWithDot); if (ft) { + ft->m_impl->MSWSuppressNotifications(true); if (! ftInfo.GetOpenCommand ().empty() ) ft->SetCommand (ftInfo.GetOpenCommand (), wxT("open" ) ); if (! ftInfo.GetPrintCommand().empty() ) ft->SetCommand (ftInfo.GetPrintCommand(), wxT("print" ) ); // chris: I don't like the ->m_impl-> here FIX this ?? if (! ftInfo.GetDescription ().empty() ) ft->m_impl->SetDescription (ftInfo.GetDescription ()) ; if (! ftInfo.GetIconFile().empty() ) ft->SetDefaultIcon (ftInfo.GetIconFile(), ftInfo.GetIconIndex() ); + ft->m_impl->MSWSuppressNotifications(false); + ft->m_impl->MSWNotifyShell(); } return ft; @@ -719,66 +700,19 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd, if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); -#if 0 - if ( rkey.Exists() && overwriteprompt ) - { -#if wxUSE_GUI - wxString old; - rkey.QueryValue(wxEmptyString, old); - if ( wxMessageBox - ( - wxString::Format( - _("Do you want to overwrite the command used to %s " - "files with extension \"%s\" ?\nCurrent value is \n%s, " - "\nNew value is \n%s %1"), // bug here FIX need %1 ?? - verb.c_str(), - m_ext.c_str(), - old.c_str(), - cmd.c_str()), - _("Confirm registry update"), - wxYES_NO | wxICON_QUESTION - ) != wxYES ) -#endif // wxUSE_GUI - { - // cancelled by user - return false; - } - } -#endif + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + GetVerbPath(verb)); + // TODO: // 1. translate '%s' to '%1' instead of always adding it // 2. create DDEExec value if needed (undo GetCommand) - return rkey.Create() && rkey.SetValue(wxEmptyString, cmd + wxT(" \"%1\"") ); + bool result = rkey.Create() && rkey.SetValue(wxEmptyString, cmd + wxT(" \"%1\"") ); + + if ( result ) + MSWNotifyShell(); + + return result; } -/* // no longer used -bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig) -{ - wxCHECK_MSG( !m_ext.empty(), false, wxT("SetMimeType() needs extension") ); - - if ( !EnsureExtKeyExists() ) - return false; - - // VZ: is this really useful? (FIXME) - wxString mimeType; - if ( !mimeTypeOrig ) - { - // make up a default value for it - wxString cmd; - wxFileName::SplitPath(GetCommand(wxT("open")), NULL, &cmd, NULL); - mimeType << wxT("application/x-") << cmd; - } - else - { - mimeType = mimeTypeOrig; - } - - wxRegKey rkey(wxRegKey::HKCR, m_ext); - return rkey.Create() && rkey.SetValue(wxT("Content Type"), mimeType); -} -*/ - bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) { wxCHECK_MSG( !m_ext.empty(), false, wxT("SetDefaultIcon() needs extension") ); @@ -789,11 +723,17 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, m_strFileType + wxT("\\DefaultIcon")); + wxRegKey rkey(wxRegKey::HKCU, + CLASSES_ROOT_KEY + m_strFileType + wxT("\\DefaultIcon")); - return rkey.Create() && + bool result = rkey.Create() && rkey.SetValue(wxEmptyString, wxString::Format(wxT("%s,%d"), cmd.c_str(), index)); + + if ( result ) + MSWNotifyShell(); + + return result; } bool wxFileTypeImpl::SetDescription (const wxString& desc) @@ -804,7 +744,7 @@ bool wxFileTypeImpl::SetDescription (const wxString& desc) if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, m_strFileType ); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_strFileType ); return rkey.Create() && rkey.SetValue(wxEmptyString, desc); @@ -816,6 +756,7 @@ bool wxFileTypeImpl::SetDescription (const wxString& desc) bool wxFileTypeImpl::Unassociate() { + MSWSuppressNotifications(true); bool result = true; if ( !RemoveOpenCommand() ) result = false; @@ -826,16 +767,9 @@ bool wxFileTypeImpl::Unassociate() if ( !RemoveDescription() ) result = false; -/* - //this might hold other keys, eg some have CSLID keys - if ( result ) - { - // delete the root key - wxRegKey key(wxRegKey::HKCR, m_ext); - if ( key.Exists() ) - result = key.DeleteSelf(); - } -*/ + MSWSuppressNotifications(false); + MSWNotifyShell(); + return result; } @@ -849,17 +783,22 @@ bool wxFileTypeImpl::RemoveCommand(const wxString& verb) wxCHECK_MSG( !m_ext.empty() && !verb.empty(), false, wxT("RemoveCommand() needs an extension and a verb") ); - wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + GetVerbPath(verb)); // if the key already doesn't exist, it's a success - return !rkey.Exists() || rkey.DeleteSelf(); + bool result = !rkey.Exists() || rkey.DeleteSelf(); + + if ( result ) + MSWNotifyShell(); + + return result; } bool wxFileTypeImpl::RemoveMimeType() { wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveMimeType() needs extension") ); - wxRegKey rkey(wxRegKey::HKCR, m_ext); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_ext); return !rkey.Exists() || rkey.DeleteSelf(); } @@ -868,8 +807,14 @@ bool wxFileTypeImpl::RemoveDefaultIcon() wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveDefaultIcon() needs extension") ); - wxRegKey rkey (wxRegKey::HKCR, m_strFileType + wxT("\\DefaultIcon")); - return !rkey.Exists() || rkey.DeleteSelf(); + wxRegKey rkey (wxRegKey::HKCU, + CLASSES_ROOT_KEY + m_strFileType + wxT("\\DefaultIcon")); + bool result = !rkey.Exists() || rkey.DeleteSelf(); + + if ( result ) + MSWNotifyShell(); + + return result; } bool wxFileTypeImpl::RemoveDescription() @@ -877,7 +822,7 @@ bool wxFileTypeImpl::RemoveDescription() wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveDescription() needs extension") ); - wxRegKey rkey (wxRegKey::HKCR, m_strFileType ); + wxRegKey rkey (wxRegKey::HKCU, CLASSES_ROOT_KEY + m_strFileType ); return !rkey.Exists() || rkey.DeleteSelf(); } diff --git a/Externals/wxWidgets3/src/msw/minifram.cpp b/Externals/wxWidgets3/src/msw/minifram.cpp index 482ae71d86..fc7e9c8568 100644 --- a/Externals/wxWidgets3/src/msw/minifram.cpp +++ b/Externals/wxWidgets3/src/msw/minifram.cpp @@ -19,6 +19,6 @@ #include "wx/minifram.h" -IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame); #endif // wxUSE_MINIFRAME diff --git a/Externals/wxWidgets3/src/msw/msgdlg.cpp b/Externals/wxWidgets3/src/msw/msgdlg.cpp index 02da8a94d8..f45dc0abf2 100644 --- a/Externals/wxWidgets3/src/msw/msgdlg.cpp +++ b/Externals/wxWidgets3/src/msw/msgdlg.cpp @@ -17,23 +17,13 @@ #if wxUSE_MSGDLG -// there is no hook support under CE so we can't use the code for message box -// positioning there -#ifndef __WXWINCE__ - #define wxUSE_MSGBOX_HOOK 1 -#else - #define wxUSE_MSGBOX_HOOK 0 -#endif - #ifndef WX_PRECOMP #include "wx/msgdlg.h" #include "wx/app.h" #include "wx/intl.h" #include "wx/utils.h" #include "wx/msw/private.h" - #if wxUSE_MSGBOX_HOOK - #include "wx/hashmap.h" - #endif + #include "wx/hashmap.h" #endif #include "wx/ptr_scpd.h" @@ -43,16 +33,8 @@ #include "wx/msw/private/msgdlg.h" #include "wx/modalhook.h" #include "wx/fontutil.h" - -#if wxUSE_MSGBOX_HOOK - #include "wx/textbuf.h" - #include "wx/display.h" -#endif - -// For MB_TASKMODAL -#ifdef __WXWINCE__ - #include "wx/msw/wince/missing.h" -#endif +#include "wx/textbuf.h" +#include "wx/display.h" // Interestingly, this symbol currently seems to be absent from Platform SDK // headers but it is documented at MSDN. @@ -62,9 +44,7 @@ using namespace wxMSWMessageDialog; -IMPLEMENT_CLASS(wxMessageDialog, wxDialog) - -#if wxUSE_MSGBOX_HOOK +wxIMPLEMENT_CLASS(wxMessageDialog, wxDialog); // there can potentially be one message box per thread so we use a hash map // with thread ids as keys and (currently shown) message boxes as values @@ -132,19 +112,6 @@ void MoveWindowToScreenRect(HWND hwnd, RECT rc) SetWindowRect(hwnd, rc); } -// helper of AdjustButtonLabels(): move the given window by dx -// -// works for both child and top level windows -void OffsetWindow(HWND hwnd, int dx) -{ - RECT rc = wxGetWindowRect(hwnd); - - rc.left += dx; - rc.right += dx; - - MoveWindowToScreenRect(hwnd, rc); -} - } // anonymous namespace /* static */ @@ -313,7 +280,7 @@ void wxMessageDialog::ReplaceStaticWithEdit() if ( !hwndBtn ) continue; // it's ok, not all buttons are always present - RECT rc = wxGetWindowRect(hwndBtn); + rc = wxGetWindowRect(hwndBtn); rc.top -= dh; rc.bottom -= dh; rc.left += dw/2; @@ -432,8 +399,6 @@ void wxMessageDialog::AdjustButtonLabels() } } -#endif // wxUSE_MSGBOX_HOOK - /* static */ wxFont wxMessageDialog::GetMessageFont() { @@ -443,7 +408,7 @@ wxFont wxMessageDialog::GetMessageFont() int wxMessageDialog::ShowMessageBox() { - if ( !wxTheApp->GetTopWindow() ) + if ( wxTheApp && !wxTheApp->GetTopWindow() ) { // when the message box is shown from wxApp::OnInit() (i.e. before the // message loop is entered), this must be done or the next message box @@ -495,11 +460,9 @@ int wxMessageDialog::ShowMessageBox() const long wxStyle = GetMessageDialogStyle(); if ( wxStyle & wxYES_NO ) { -#if !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) - if (wxStyle & wxCANCEL) + if ( wxStyle & wxCANCEL ) msStyle = MB_YESNOCANCEL; else -#endif // !(__SMARTPHONE__ && __WXWINCE__) msStyle = MB_YESNO; if ( wxStyle & wxNO_DEFAULT ) @@ -550,30 +513,14 @@ int wxMessageDialog::ShowMessageBox() if ( wxStyle & wxSTAY_ON_TOP ) msStyle |= MB_TOPMOST; -#ifndef __WXWINCE__ - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( wxApp::MSWGetDefaultLayout(m_parent) == wxLayout_RightToLeft ) msStyle |= MB_RTLREADING | MB_RIGHT; -#endif if (hWnd) msStyle |= MB_APPLMODAL; else msStyle |= MB_TASKMODAL; - // per MSDN documentation for MessageBox() we can prefix the message with 2 - // right-to-left mark characters to tell the function to use RTL layout - // (unfortunately this only works in Unicode builds) - wxString message = GetFullMessage(); -#if wxUSE_UNICODE - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) - { - // NB: not all compilers support \u escapes - static const wchar_t wchRLM = 0x200f; - message.Prepend(wxString(wchRLM, 2)); - } -#endif // wxUSE_UNICODE - -#if wxUSE_MSGBOX_HOOK // install the hook in any case as we don't know in advance if the message // box is not going to be too big (requiring the replacement of the static // control with an edit one) @@ -581,10 +528,15 @@ int wxMessageDialog::ShowMessageBox() m_hook = ::SetWindowsHookEx(WH_CBT, &wxMessageDialog::HookFunction, NULL, tid); HookMap()[tid] = this; -#endif // wxUSE_MSGBOX_HOOK // do show the dialog - int msAns = MessageBox(hWnd, message.t_str(), m_caption.t_str(), msStyle); + const int msAns = MessageBox + ( + hWnd, + GetFullMessage().t_str(), + m_caption.t_str(), + msStyle + ); return MSWTranslateReturnCode(msAns); } @@ -715,7 +667,7 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc) // use the top level window as parent if none specified tdc.hwndParent = parent ? GetHwndOf(parent) : NULL; - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( wxApp::MSWGetDefaultLayout(parent) == wxLayout_RightToLeft ) tdc.dwFlags |= TDF_RTL_LAYOUT; // If we have both the main and extended messages, just use them as diff --git a/Externals/wxWidgets3/src/msw/mslu.cpp b/Externals/wxWidgets3/src/msw/mslu.cpp deleted file mode 100644 index eb6cf1bd6e..0000000000 --- a/Externals/wxWidgets3/src/msw/mslu.cpp +++ /dev/null @@ -1,236 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/mslu.cpp -// Purpose: Fixes for bugs in MSLU -// Author: Vaclav Slavik -// Modified by: -// Created: 2002/02/17 -// Copyright: (c) 2002 Vaclav Slavik -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop - #include -#endif - -#ifndef WX_PRECOMP - #include "wx/utils.h" -#endif - -#define wxHAS_HUGE_FILES - -//------------------------------------------------------------------------ -// Check for use of MSLU -//------------------------------------------------------------------------ - -#if wxUSE_BASE - -bool WXDLLIMPEXP_BASE wxUsingUnicowsDll() -{ -#if wxUSE_UNICODE_MSLU - return (wxGetOsVersion() == wxOS_WINDOWS_9X); -#else - return false; -#endif -} - -#endif // wxUSE_BASE - - -#if wxUSE_UNICODE_MSLU - -//------------------------------------------------------------------------ -// -// NB: MSLU only covers Win32 API, it doesn't provide Unicode implementation of -// libc functions. Unfortunately, some of MSVCRT wchar_t functions -// (e.g. _wopen) don't work on Windows 9x, so we have to workaround it -// by calling the char version. We still want to use wchar_t version on -// NT/2000/XP, though, because they allow for Unicode file names. -// -// Moreover, there are bugs in unicows.dll, of course. We have to -// workaround them, too. -// -//------------------------------------------------------------------------ - -#include "wx/msw/private.h" -#include "wx/msw/mslu.h" - -#include -#include -#include - -#ifdef __VISUALC__ - #include -#endif - -// Undef redirection macros defined in wx/msw/wrapwin.h: -#undef DrawStateW -#undef GetOpenFileNameW -#undef GetSaveFileNameW - -//------------------------------------------------------------------------ -// Wrongly implemented functions from unicows.dll -//------------------------------------------------------------------------ - -#if wxUSE_GUI - -WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, - WXLPARAM lData, WXWPARAM wData, - int x, int y, int cx, int cy, - unsigned int flags) -{ - // VS: There's yet another bug in MSLU: DrawStateW behaves like if it was - // expecting char*, not wchar_t* input. We have to use DrawStateA - // explicitly. - - if ( wxUsingUnicowsDll() ) - { - return DrawStateA((HDC)dc, (HBRUSH)br, (DRAWSTATEPROC)outputFunc, - (LPARAM)(const char*) - wxConvLocal.cWX2MB((const wxChar*)lData), - wData, x, y, cx, cy, flags); - } - else - { - return DrawStateW((HDC)dc, (HBRUSH)br, (DRAWSTATEPROC)outputFunc, - lData, wData, x, y, cx, cy, flags); - } -} - -static void wxFixOPENFILENAME(LPOPENFILENAME ofn) -{ -#ifdef OFN_EXPLORER - // VS: there's a bug in unicows.dll - when multiple files are selected, - // of.nFileOffset doesn't point to the first filename but rather to - // the last component of directory name. This bug is known to MSLU - // developers, but they are not going to fix it: "this is a true - // limitation, that we have decided to live with" and "working - // harder on this case just did not seem worth the effort"... - // - // Our only option is to try to fix it ourselves: - - if ( (ofn->Flags & OFN_ALLOWMULTISELECT) && - ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') ) - { - if ( wxDirExists(ofn->lpstrFile) ) - { - // 1st component is dir => multiple files selected - ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1; - } - } -#endif // OFN_EXPLORER -} - -WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn) -{ - int ret = GetOpenFileName((LPOPENFILENAME)ofn); - if ( wxUsingUnicowsDll() && ret != 0 ) - wxFixOPENFILENAME((LPOPENFILENAME)ofn); - return ret; -} - -WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn) -{ - int ret = GetSaveFileName((LPOPENFILENAME)ofn); - if ( wxUsingUnicowsDll() && ret != 0 ) - wxFixOPENFILENAME((LPOPENFILENAME)ofn); - return ret; -} - -#endif // wxUSE_GUI - -//------------------------------------------------------------------------ -// Missing libc file manipulation functions in Win9x -//------------------------------------------------------------------------ - -#if wxUSE_BASE - -WXDLLIMPEXP_BASE int wxMSLU__wrename(const wchar_t *oldname, - const wchar_t *newname) -{ - if ( wxUsingUnicowsDll() ) - return rename(wxConvFile.cWX2MB(oldname), wxConvFile.cWX2MB(newname)); - else - return _wrename(oldname, newname); -} - -WXDLLIMPEXP_BASE int wxMSLU__wremove(const wchar_t *name) -{ - if ( wxUsingUnicowsDll() ) - return remove(wxConvFile.cWX2MB(name)); - else - return _wremove(name); -} - -WXDLLIMPEXP_BASE FILE* wxMSLU__wfopen(const wchar_t *name,const wchar_t* mode) -{ - if ( wxUsingUnicowsDll() ) - return fopen(wxConvFile.cWX2MB(name),wxConvFile.cWX2MB(mode)); - else - return _wfopen(name,mode); -} - -WXDLLIMPEXP_BASE FILE* wxMSLU__wfreopen(const wchar_t *name, - const wchar_t* mode, - FILE *stream) -{ - if ( wxUsingUnicowsDll() ) - return freopen(wxConvFile.cWX2MB(name), wxConvFile.cWX2MB(mode), stream); - else - return _wfreopen(name, mode, stream); -} - -WXDLLIMPEXP_BASE int wxMSLU__wopen(const wchar_t *name, int flags, int mode) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_OpenA(wxConvFile.cWX2MB(name), flags, mode); - else - return wxCRT_OpenW(name, flags, mode); -} - -WXDLLIMPEXP_BASE int wxMSLU__waccess(const wchar_t *name, int mode) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_AccessA(wxConvFile.cWX2MB(name), mode); - else - return wxCRT_AccessW(name, mode); -} - -WXDLLIMPEXP_BASE int wxMSLU__wchmod(const wchar_t *name, int mode) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_ChmodA(wxConvFile.cWX2MB(name), mode); - else - return wxCRT_ChmodW(name, mode); -} - -WXDLLIMPEXP_BASE int wxMSLU__wmkdir(const wchar_t *name) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_MkDirA(wxConvFile.cWX2MB(name)); - else - return wxCRT_MkDirW(name); -} - -WXDLLIMPEXP_BASE int wxMSLU__wrmdir(const wchar_t *name) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_RmDirA(wxConvFile.cWX2MB(name)); - else - return wxCRT_RmDirW(name); -} - -WXDLLIMPEXP_BASE int wxMSLU__wstat(const wchar_t *name, wxStructStat *buffer) -{ - if ( wxUsingUnicowsDll() ) - return wxCRT_StatA((const char*)wxConvFile.cWX2MB(name), buffer); - else - return wxCRT_StatW(name, buffer); -} - -#endif // wxUSE_BASE - -#endif // wxUSE_UNICODE_MSLU diff --git a/Externals/wxWidgets3/src/msw/nativdlg.cpp b/Externals/wxWidgets3/src/msw/nativdlg.cpp index d71c3b13e4..d11a4dd2b9 100644 --- a/Externals/wxWidgets3/src/msw/nativdlg.cpp +++ b/Externals/wxWidgets3/src/msw/nativdlg.cpp @@ -36,14 +36,14 @@ // global functions // --------------------------------------------------------------------------- -extern LONG APIENTRY _EXPORT wxDlgProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); +extern LONG APIENTRY +wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // =========================================================================== // implementation // =========================================================================== -bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) +bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID id) { m_windowId = id; @@ -190,7 +190,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) else #endif #if wxUSE_BMPBUTTON -#if defined(__WIN32__) && defined(BS_BITMAP) if (style & BS_BITMAP) { // TODO: how to find the bitmap? @@ -198,7 +197,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) wxLogError(wxT("Have not yet implemented bitmap button as BS_BITMAP button.")); } else -#endif if (style1 == BS_OWNERDRAW) { // TODO: how to find the bitmap? @@ -279,13 +277,10 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) int style1 = (style & 0xFF); if ((style1 == SS_LEFT) || (style1 == SS_RIGHT) -#ifndef __WXWINCE__ || (style1 == SS_SIMPLE) -#endif ) win = new wxStaticText; #if wxUSE_STATBMP -#if defined(__WIN32__) && defined(BS_BITMAP) else if (style1 == SS_BITMAP) { win = new wxStaticBitmap; @@ -293,7 +288,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) // Help! this doesn't correspond with the wxWin implementation. wxLogError(wxT("Please make SS_BITMAP statics into owner-draw buttons.")); } -#endif #endif /* wxUSE_STATBMP */ } #endif diff --git a/Externals/wxWidgets3/src/msw/nativewin.cpp b/Externals/wxWidgets3/src/msw/nativewin.cpp index 13b8a77efa..eb799345f6 100644 --- a/Externals/wxWidgets3/src/msw/nativewin.cpp +++ b/Externals/wxWidgets3/src/msw/nativewin.cpp @@ -32,6 +32,70 @@ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxNativeWindow +// ---------------------------------------------------------------------------- + +bool +wxNativeWindow::Create(wxWindow* parent, + wxWindowID winid, + wxNativeWindowHandle hwnd) +{ + wxCHECK_MSG( hwnd, false, wxS("Invalid null HWND") ); + wxCHECK_MSG( parent, false, wxS("Must have a valid parent") ); + wxASSERT_MSG( ::GetParent(hwnd) == GetHwndOf(parent), + wxS("The native window has incorrect parent") ); + + const wxRect r = wxRectFromRECT(wxGetWindowRect(hwnd)); + + // Skip wxWindow::Create() which would try to create a new HWND, we don't + // want this as we already have one. + if ( !CreateBase(parent, winid, + r.GetPosition(), r.GetSize(), + 0, wxDefaultValidator, wxS("nativewindow")) ) + return false; + + parent->AddChild(this); + + SubclassWin(hwnd); + + if ( winid == wxID_ANY ) + { + // We allocated a new ID to the control, use it at Windows level as + // well because we assume that our and MSW IDs are the same in many + // places and it seems prudent to avoid breaking this assumption. + SetId(GetId()); + } + else // We used a fixed ID. + { + // For the same reason as above, check that it's the same as the one + // used by the native HWND. + wxASSERT_MSG( ::GetWindowLong(hwnd, GWL_ID) == winid, + wxS("Mismatch between wx and native IDs") ); + } + + InheritAttributes(); + + return true; +} + +void wxNativeWindow::DoDisown() +{ + // We don't do anything here, clearing m_ownedByUser flag is enough. +} + +wxNativeWindow::~wxNativeWindow() +{ + // Restore the original window proc and reset HWND to 0 to prevent it from + // being destroyed in the base class dtor if it's owned by user code. + if ( m_ownedByUser ) + UnsubclassWin(); +} + +// ---------------------------------------------------------------------------- +// wxNativeContainerWindow +// ---------------------------------------------------------------------------- + bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle hwnd) { if ( !::IsWindow(hwnd) ) @@ -69,11 +133,24 @@ WXLRESULT wxNativeContainerWindow::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - if ( nMsg == WM_DESTROY ) + switch ( nMsg ) { - OnNativeDestroyed(); + case WM_CLOSE: + // wxWindow itself, unlike wxFrame, doesn't react to WM_CLOSE and + // just ignores it without even passing it to DefWindowProc(), + // which means that the original WM_CLOSE handler wouldn't be + // called if we didn't explicitly do it here. + return MSWDefWindowProc(nMsg, wParam, lParam); - return 0; + case WM_DESTROY: + // Send it to the original handler which may have some cleanup to + // do as well. Notice that we must do it before calling + // OnNativeDestroyed() as we can't use this object after doing it. + MSWDefWindowProc(nMsg, wParam, lParam); + + OnNativeDestroyed(); + + return 0; } return wxTopLevelWindow::MSWWindowProc(nMsg, wParam, lParam); diff --git a/Externals/wxWidgets3/src/msw/nonownedwnd.cpp b/Externals/wxWidgets3/src/msw/nonownedwnd.cpp index fca7bfe879..ce0449e6cc 100644 --- a/Externals/wxWidgets3/src/msw/nonownedwnd.cpp +++ b/Externals/wxWidgets3/src/msw/nonownedwnd.cpp @@ -22,9 +22,6 @@ #pragma hdrstop #endif -// This class can't be implemented and hence is not used under Win CE. -#ifndef __WXWINCE__ - #ifndef WX_PRECOMP #include "wx/dcclient.h" #include "wx/frame.h" // Only for wxFRAME_SHAPED. @@ -179,5 +176,3 @@ wxNonOwnedWindow::~wxNonOwnedWindow() } #endif // wxUSE_GRAPHICS_CONTEXT/!wxUSE_GRAPHICS_CONTEXT - -#endif // !__WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/notebook.cpp b/Externals/wxWidgets3/src/msw/notebook.cpp index 7b7848b100..67e5fa2f7f 100644 --- a/Externals/wxWidgets3/src/msw/notebook.cpp +++ b/Externals/wxWidgets3/src/msw/notebook.cpp @@ -55,12 +55,7 @@ // you can set USE_NOTEBOOK_ANTIFLICKER to 0 for desktop Windows versions too // to disable code whih results in flicker-less notebook redrawing at the // expense of some extra GDI resource consumption -#ifdef __WXWINCE__ - // notebooks are never resized under CE anyhow - #define USE_NOTEBOOK_ANTIFLICKER 0 -#else - #define USE_NOTEBOOK_ANTIFLICKER 1 -#endif +#define USE_NOTEBOOK_ANTIFLICKER 1 // ---------------------------------------------------------------------------- // constants @@ -91,10 +86,8 @@ static WXFARPROC gs_wndprocNotebookSpinBtn = (WXFARPROC)NULL; // the pointer to standard tab control wnd proc static WXFARPROC gs_wndprocNotebook = (WXFARPROC)NULL; -LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam); +LRESULT APIENTRY +wxNotebookWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); #endif // USE_NOTEBOOK_ANTIFLICKER @@ -116,7 +109,7 @@ static bool HasTroubleWithNonTopTabs() // event table // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) +wxBEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_SIZE(wxNotebook::OnSize) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) @@ -124,7 +117,7 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_ERASE_BACKGROUND(wxNotebook::OnEraseBackground) EVT_PAINT(wxNotebook::OnPaint) #endif // USE_NOTEBOOK_ANTIFLICKER -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -143,7 +136,6 @@ void wxNotebook::Init() #if USE_NOTEBOOK_ANTIFLICKER m_hasSubclassedUpdown = false; - m_doneUpdateHack = false; #endif // USE_NOTEBOOK_ANTIFLICKER } @@ -176,20 +168,9 @@ bool wxNotebook::Create(wxWindow *parent, { if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) { -#if defined(__POCKETPC__) - style |= wxBK_BOTTOM | wxNB_FLAT; -#else style |= wxBK_TOP; -#endif } -#ifdef __WXWINCE__ - // Not sure why, but without this style, there is no border - // around the notebook tabs. - if (style & wxNB_FLAT) - style |= wxBORDER_SUNKEN; -#endif - #if !wxUSE_UXTHEME // ComCtl32 notebook tabs simply don't work unless they're on top if we // have uxtheme, we can work around it later (after control creation), but @@ -289,18 +270,6 @@ bool wxNotebook::Create(wxWindow *parent, } #endif // wxUSE_UXTHEME - // Undocumented hack to get flat notebook style - // In fact, we should probably only do this in some - // curcumstances, i.e. if we know we will have a border - // at the bottom (the tab control doesn't draw it itself) -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - if (HasFlag(wxNB_FLAT)) - { - SendMessage(GetHwnd(), CCM_SETVERSION, COMCTL32_VERSION, 0); - if (!m_hasBgCol) - SetBackgroundColour(*wxWHITE); - } -#endif return true; } @@ -363,7 +332,7 @@ int wxNotebook::SetSelection(size_t nPage) UpdateSelection(nPage); - TabCtrl_SetCurSel(GetHwnd(), nPage); + (void)TabCtrl_SetCurSel(GetHwnd(), nPage); SendPageChangedEvent(selectionOld, nPage); } @@ -409,7 +378,7 @@ int wxNotebook::ChangeSelection(size_t nPage) if ( m_selection == wxNOT_FOUND || nPage != (size_t)m_selection ) { - TabCtrl_SetCurSel(GetHwnd(), nPage); + (void)TabCtrl_SetCurSel(GetHwnd(), nPage); UpdateSelection(nPage); } @@ -511,7 +480,7 @@ wxRect wxNotebook::GetPageSize() const // The value of 20 is chosen arbitrarily but seems to work if ( rc.right > 20 && rc.bottom > 20 ) { - TabCtrl_AdjustRect(GetHwnd(), false, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), false, &rc); wxCopyRECTToRect(rc, r); } @@ -528,7 +497,7 @@ void wxNotebook::SetPageSize(const wxSize& size) rc.right = size.x; rc.bottom = size.y; - TabCtrl_AdjustRect(GetHwnd(), true, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), true, &rc); // and now set it SetSize(rc.right - rc.left, rc.bottom - rc.top); @@ -555,9 +524,11 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const if ( GetPageCount() > 0 ) { RECT rect; - TabCtrl_GetItemRect(GetHwnd(), 0, &rect); - tabSize.x = rect.right - rect.left; - tabSize.y = rect.bottom - rect.top; + if ( TabCtrl_GetItemRect(GetHwnd(), 0, &rect) ) + { + tabSize.x = rect.right - rect.left; + tabSize.y = rect.bottom - rect.top; + } } const int rows = GetRowCount(); @@ -604,7 +575,8 @@ wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage) // selected page is visible and others are hidden: pageRemoved->Show(false); - TabCtrl_DeleteItem(GetHwnd(), nPage); + if ( !TabCtrl_DeleteItem(GetHwnd(), nPage) ) + wxLogLastError(wxS("TabCtrl_DeleteItem()")); if ( m_pages.IsEmpty() ) { @@ -657,7 +629,8 @@ bool wxNotebook::DeleteAllPages() m_pages.Clear(); - TabCtrl_DeleteAllItems(GetHwnd()); + if ( !TabCtrl_DeleteAllItems(GetHwnd()) ) + wxLogLastError(wxS("TabCtrl_DeleteAllItems()")); m_selection = wxNOT_FOUND; @@ -702,11 +675,6 @@ bool wxNotebook::InsertPage(size_t nPage, // hide the page: unless it is selected, it shouldn't be shown (and if it // is selected it will be shown later) - HWND hwnd = GetWinHwnd(pPage); - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE); - - // this updates internal flag too -- otherwise it would get out of sync - // with the real state pPage->Show(false); @@ -782,15 +750,18 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const *flags = 0; if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE) + { + wxASSERT( item == wxNOT_FOUND ); *flags |= wxBK_HITTEST_NOWHERE; - if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM) + if ( GetPageSize().Contains(pt) ) + *flags |= wxBK_HITTEST_ONPAGE; + } + else if ((hitTestInfo.flags & TCHT_ONITEM) == TCHT_ONITEM) *flags |= wxBK_HITTEST_ONITEM; - if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) + else if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON) *flags |= wxBK_HITTEST_ONICON; - if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) + else if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL) *flags |= wxBK_HITTEST_ONLABEL; - if ( item == wxNOT_FOUND && GetPageSize().Contains(pt) ) - *flags |= wxBK_HITTEST_ONPAGE; } return item; @@ -803,10 +774,8 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const #if USE_NOTEBOOK_ANTIFLICKER // wnd proc for the spin button -LRESULT APIENTRY _EXPORT wxNotebookSpinBtnWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) +LRESULT APIENTRY +wxNotebookSpinBtnWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if ( message == WM_ERASEBKGND ) return 0; @@ -815,10 +784,8 @@ LRESULT APIENTRY _EXPORT wxNotebookSpinBtnWndProc(HWND hwnd, hwnd, message, wParam, lParam); } -LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) +LRESULT APIENTRY +wxNotebookWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { return ::CallWindowProc(CASTWNDPROC gs_wndprocNotebook, hwnd, message, wParam, lParam); @@ -931,7 +898,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) event.Skip(); return; } -#ifndef __WXWINCE__ else { // Without this, we can sometimes get droppings at the edges @@ -954,7 +920,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) rect = wxRect(0, 0, 4, sz.y); RefreshRect(rect); } -#endif // !__WXWINCE__ // fit all the notebook pages to the tab control's display area @@ -998,7 +963,7 @@ void wxNotebook::OnSize(wxSizeEvent& event) UpdateBgBrush(); #endif // wxUSE_UXTHEME - TabCtrl_AdjustRect(GetHwnd(), false, &rc); + (void)TabCtrl_AdjustRect(GetHwnd(), false, &rc); int width = rc.right - rc.left, height = rc.bottom - rc.top; @@ -1047,21 +1012,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) } } } - - // Probably because of the games we play above to avoid flicker sometimes - // the text controls inside notebook pages are not shown correctly (they - // don't have their borders) when the notebook is shown for the first time. - // It's not really clear why does this happen and maybe the bug is in - // wxTextCtrl itself and not here but updating the page when it's about to - // be shown doesn't cost much and works around the problem so do it here - // for now. - if ( !m_doneUpdateHack && IsShownOnScreen() ) - { - m_doneUpdateHack = true; - wxWindow* const page = GetCurrentPage(); - if ( page ) - page->Update(); - } #endif // USE_NOTEBOOK_ANTIFLICKER event.Skip(); @@ -1316,8 +1266,8 @@ wxColour wxNotebook::GetThemeBackgroundColour() const WCHAR szwThemeColor[256]; if (S_OK == wxUxThemeEngine::Get()->GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0)) { - wxString themeFile(szwThemeFile), themeColor(szwThemeColor); - if (themeFile.Find(wxT("Aero")) != -1 && themeColor == wxT("NormalColor")) + wxString themeFile(szwThemeFile); + if (themeFile.Find(wxT("Aero")) != -1 && wxString(szwThemeColor) == wxT("NormalColor")) s_AeroStatus = 1; else s_AeroStatus = 0; diff --git a/Externals/wxWidgets3/src/msw/notifmsg.cpp b/Externals/wxWidgets3/src/msw/notifmsg.cpp index aeef3a3974..be170bf254 100644 --- a/Externals/wxWidgets3/src/msw/notifmsg.cpp +++ b/Externals/wxWidgets3/src/msw/notifmsg.cpp @@ -33,9 +33,11 @@ #include "wx/toplevel.h" #include "wx/app.h" #include "wx/string.h" + #include "wx/app.h" #endif // WX_PRECOMP -#include "wx/generic/notifmsg.h" +#include "wx/private/notifmsg.h" +#include "wx/msw/rt/private/notifmsg.h" #include "wx/taskbar.h" @@ -43,69 +45,62 @@ // different implementations used by wxNotificationMessage // ---------------------------------------------------------------------------- -// base class for all available implementations -class wxNotifMsgImpl -{ -public: - wxNotifMsgImpl() { } - virtual ~wxNotifMsgImpl() { } - - virtual bool DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags) = 0; - virtual bool DoClose() = 0; - -private: - wxDECLARE_NO_COPY_CLASS(wxNotifMsgImpl); -}; - -// implementation which is simply a bridge to wxGenericNotificationMessage -class wxGenericNotifMsgImpl : public wxNotifMsgImpl -{ -public: - wxGenericNotifMsgImpl() : m_notif(new wxGenericNotificationMessage) { } - virtual ~wxGenericNotifMsgImpl() { delete m_notif; } - - virtual bool DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags) - { - m_notif->SetTitle(title); - m_notif->SetMessage(message); - m_notif->SetFlags(flags); - return m_notif->Show(timeout); - } - - virtual bool DoClose() - { - return m_notif->Close(); - } - -private: - wxGenericNotificationMessage * const m_notif; -}; - -// common base class for implementations using a taskbar icon and balloons -class wxBalloonNotifMsgImpl : public wxNotifMsgImpl +// implementations using a taskbar icon and balloons +class wxBalloonNotifMsgImpl : public wxNotificationMessageImpl { public: // Ctor creates the associated taskbar icon (using the icon of the top // level parent of the given window) unless UseTaskBarIcon() had been // previously called which can be used to show an attached balloon later // by the derived classes. - wxBalloonNotifMsgImpl(wxWindow *win) { SetUpIcon(win); } + wxBalloonNotifMsgImpl(wxNotificationMessageBase* notification) : + wxNotificationMessageImpl(notification), + m_flags(wxICON_INFORMATION), + m_parent(NULL) + { + + } + + virtual ~wxBalloonNotifMsgImpl(); + + virtual bool Show(int timeout) wxOVERRIDE; + + virtual bool Close() wxOVERRIDE; + + virtual void SetTitle(const wxString& title) wxOVERRIDE + { + m_title = title; + } + + virtual void SetMessage(const wxString& message) wxOVERRIDE + { + m_message = message; + } + + virtual void SetParent(wxWindow *parent) wxOVERRIDE + { + m_parent = parent; + } + + virtual void SetFlags(int flags) wxOVERRIDE + { + m_flags = flags; + } + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE + { + m_icon = icon; + } + + virtual bool AddAction(wxWindowID WXUNUSED(actionid), const wxString &WXUNUSED(label)) + { + // Actions are not supported in balloon notifications + return false; + } // implementation of wxNotificationMessage method with the same name static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon); - virtual bool DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags); - - // Returns true if we're using our own icon or false if we're hitching a // ride on the application icon provided to us via UseTaskBarIcon(). static bool IsUsingOwnIcon() @@ -124,7 +119,7 @@ public: wxASSERT_MSG( ms_refCountIcon != -1, wxS("Must not be called when not using own icon") ); - if ( !--ms_refCountIcon ) + if ( ms_refCountIcon > 0 && !--ms_refCountIcon ) { delete ms_icon; ms_icon = NULL; @@ -152,117 +147,25 @@ protected: // the icon is only destroyed when it reaches 0. static wxTaskBarIcon *ms_icon; static int ms_refCountIcon; -}; - -// implementation for automatically hidden notifications -class wxAutoNotifMsgImpl : public wxBalloonNotifMsgImpl -{ -public: - wxAutoNotifMsgImpl(wxWindow *win); - - virtual bool DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags); - - // can't close automatic notification [currently] - virtual bool DoClose() { return false; } -}; - -// implementation for manually closed notifications -class wxManualNotifMsgImpl : public wxBalloonNotifMsgImpl -{ -public: - wxManualNotifMsgImpl(wxWindow *win); - virtual ~wxManualNotifMsgImpl(); - - virtual bool DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags); - virtual bool DoClose(); - private: - // store ctor parameter as we need it to recreate the icon later if we're - // closed and shown again - wxWindow * const m_win; -}; + wxString m_title; + wxString m_message; + int m_flags; + wxIcon m_icon; + wxWindow* m_parent; -// ---------------------------------------------------------------------------- -// custom event handler for task bar icons -// ---------------------------------------------------------------------------- - -// normally we'd just use a custom taskbar icon class but this is impossible -// because we can be asked to attach the notifications to an existing icon -// which we didn't create, hence we install a special event handler allowing us -// to get the events we need (and, crucially, to delete the icon when it's not -// needed any more) in any case - -class wxNotificationIconEvtHandler : public wxEvtHandler -{ -public: - wxNotificationIconEvtHandler(wxTaskBarIcon *icon); - -private: void OnTimeout(wxTaskBarIconEvent& event); void OnClick(wxTaskBarIconEvent& event); void OnIconHidden(); - - - wxTaskBarIcon * const m_icon; - - wxDECLARE_NO_COPY_CLASS(wxNotificationIconEvtHandler); }; +// ---------------------------------------------------------------------------- + // ============================================================================ // implementation // ============================================================================ -// ---------------------------------------------------------------------------- -// wxNotificationIconEvtHandler -// ---------------------------------------------------------------------------- - -wxNotificationIconEvtHandler::wxNotificationIconEvtHandler(wxTaskBarIcon *icon) - : m_icon(icon) -{ - m_icon->Connect - ( - wxEVT_TASKBAR_BALLOON_TIMEOUT, - wxTaskBarIconEventHandler(wxNotificationIconEvtHandler::OnTimeout), - NULL, - this - ); - - m_icon->Connect - ( - wxEVT_TASKBAR_BALLOON_CLICK, - wxTaskBarIconEventHandler(wxNotificationIconEvtHandler::OnClick), - NULL, - this - ); -} - -void wxNotificationIconEvtHandler::OnIconHidden() -{ - wxBalloonNotifMsgImpl::ReleaseIcon(); - - delete this; -} - -void -wxNotificationIconEvtHandler::OnTimeout(wxTaskBarIconEvent& WXUNUSED(event)) -{ - OnIconHidden(); -} - -void wxNotificationIconEvtHandler::OnClick(wxTaskBarIconEvent& WXUNUSED(event)) -{ - // TODO: generate an event notifying the user code? - - OnIconHidden(); -} - // ---------------------------------------------------------------------------- // wxBalloonNotifMsgImpl // ---------------------------------------------------------------------------- @@ -282,6 +185,39 @@ wxTaskBarIcon *wxBalloonNotifMsgImpl::UseTaskBarIcon(wxTaskBarIcon *icon) return iconOld; } +wxBalloonNotifMsgImpl::~wxBalloonNotifMsgImpl() +{ +} + +void wxBalloonNotifMsgImpl::OnIconHidden() +{ + SetActive(false); + if ( ms_icon ) + { + ms_icon->Unbind(wxEVT_TASKBAR_BALLOON_CLICK, &wxBalloonNotifMsgImpl::OnClick, this); + ms_icon->Unbind(wxEVT_TASKBAR_BALLOON_TIMEOUT, &wxBalloonNotifMsgImpl::OnTimeout, this); + } + + if ( IsUsingOwnIcon() ) + wxBalloonNotifMsgImpl::ReleaseIcon(); +} + +void wxBalloonNotifMsgImpl::OnTimeout(wxTaskBarIconEvent& WXUNUSED(event)) +{ + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + ProcessNotificationEvent(evt); + + OnIconHidden(); +} + +void wxBalloonNotifMsgImpl::OnClick(wxTaskBarIconEvent& WXUNUSED(event)) +{ + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_CLICK); + ProcessNotificationEvent(evt); + + OnIconHidden(); +} + void wxBalloonNotifMsgImpl::SetUpIcon(wxWindow *win) { if ( ms_icon ) @@ -323,11 +259,14 @@ void wxBalloonNotifMsgImpl::SetUpIcon(wxWindow *win) } bool -wxBalloonNotifMsgImpl::DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags) +wxBalloonNotifMsgImpl::Show(int timeout) { + // timout active event + wxTaskBarIconEvent event(wxEVT_TASKBAR_BALLOON_TIMEOUT, ms_icon); + OnTimeout(event); + + SetUpIcon(m_parent); + if ( !ms_icon->IsIconInstalled() ) { // If we failed to install the icon (which does happen sometimes, @@ -341,58 +280,45 @@ wxBalloonNotifMsgImpl::DoShow(const wxString& title, // first place. delete ms_icon; ms_icon = NULL; + ms_refCountIcon = 0; return false; } + // Since Windows Vista timeout is ignored so this values are only for XP + if ( timeout == wxNotificationMessage::Timeout_Auto ) + { + // choose a value more or less in the middle of the allowed range + timeout = 1; + } + else if ( timeout == wxNotificationMessage::Timeout_Never ) + { + // use maximal (in Windows XP) timeout (but it will still + // disappear on its own) + timeout = 30; + } + timeout *= 1000; // Windows expresses timeout in milliseconds - return ms_icon->ShowBalloon(title, message, timeout, flags); -} - -// ---------------------------------------------------------------------------- -// wxManualNotifMsgImpl -// ---------------------------------------------------------------------------- - -wxManualNotifMsgImpl::wxManualNotifMsgImpl(wxWindow *win) - : wxBalloonNotifMsgImpl(win), - m_win(win) -{ -} - -wxManualNotifMsgImpl::~wxManualNotifMsgImpl() -{ - if ( ms_icon ) - DoClose(); -} - -bool -wxManualNotifMsgImpl::DoShow(const wxString& title, - const wxString& message, - int WXUNUSED_UNLESS_DEBUG(timeout), - int flags) -{ - wxASSERT_MSG( timeout == wxNotificationMessage::Timeout_Never, - wxT("shouldn't be used") ); - - // base class creates the icon for us initially but we could have destroyed - // it in DoClose(), recreate it if this was the case - if ( !ms_icon ) - SetUpIcon(m_win); - - // use maximal (in current Windows versions) timeout (but it will still - // disappear on its own) - return wxBalloonNotifMsgImpl::DoShow(title, message, 30, flags); -} - -bool wxManualNotifMsgImpl::DoClose() -{ - if ( IsUsingOwnIcon() ) + bool res = ms_icon->ShowBalloon(m_title, m_message, timeout, m_flags, m_icon); + if ( res ) { - // we don't need the icon any more - ReleaseIcon(); + ms_icon->Bind(wxEVT_TASKBAR_BALLOON_CLICK, &wxBalloonNotifMsgImpl::OnClick, this); + ms_icon->Bind(wxEVT_TASKBAR_BALLOON_TIMEOUT, &wxBalloonNotifMsgImpl::OnTimeout, this); + SetActive(true); } - else // using an existing icon + + return res; +} + +bool wxBalloonNotifMsgImpl::Close() +{ + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + ProcessNotificationEvent(evt); + + OnIconHidden(); + + if ( !IsUsingOwnIcon() && ms_icon ) { // just hide the balloon ms_icon->ShowBalloon("", ""); @@ -401,84 +327,29 @@ bool wxManualNotifMsgImpl::DoClose() return true; } -// ---------------------------------------------------------------------------- -// wxAutoNotifMsgImpl -// ---------------------------------------------------------------------------- - -wxAutoNotifMsgImpl::wxAutoNotifMsgImpl(wxWindow *win) - : wxBalloonNotifMsgImpl(win) -{ - if ( ms_refCountIcon != -1 ) - { - // This object will self-destruct and decrease the ref count of the - // icon when the notification is hidden. - new wxNotificationIconEvtHandler(ms_icon); - } -} - -bool -wxAutoNotifMsgImpl::DoShow(const wxString& title, - const wxString& message, - int timeout, - int flags) -{ - wxASSERT_MSG( timeout != wxNotificationMessage::Timeout_Never, - wxT("shouldn't be used") ); - - if ( timeout == wxNotificationMessage::Timeout_Auto ) - { - // choose a value more or less in the middle of the allowed range - timeout = 1; - } - - return wxBalloonNotifMsgImpl::DoShow(title, message, timeout, flags); -} - // ---------------------------------------------------------------------------- // wxNotificationMessage // ---------------------------------------------------------------------------- -/* static */ -bool wxNotificationMessage::ms_alwaysUseGeneric = false; - /* static */ wxTaskBarIcon *wxNotificationMessage::UseTaskBarIcon(wxTaskBarIcon *icon) { return wxBalloonNotifMsgImpl::UseTaskBarIcon(icon); } -bool wxNotificationMessage::Show(int timeout) +bool wxNotificationMessage::MSWUseToasts( + const wxString& shortcutPath, + const wxString& appId) { - if ( !m_impl ) - { - if ( !ms_alwaysUseGeneric && wxTheApp->GetShell32Version() >= 500 ) - { - if ( timeout == Timeout_Never ) - m_impl = new wxManualNotifMsgImpl(GetParent()); - else - m_impl = new wxAutoNotifMsgImpl(GetParent()); - } - else // no support for balloon tooltips - { - m_impl = new wxGenericNotifMsgImpl; - } - } - //else: reuse the same implementation for the subsequent calls, it would - // be too confusing if it changed - - return m_impl->DoShow(GetTitle(), GetMessage(), timeout, GetFlags()); + return wxToastNotificationHelper::UseToasts(shortcutPath, appId); } -bool wxNotificationMessage::Close() +void wxNotificationMessage::Init() { - wxCHECK_MSG( m_impl, false, "must show the notification first" ); - - return m_impl->DoClose(); -} - -wxNotificationMessage::~wxNotificationMessage() -{ - delete m_impl; + if ( wxToastNotificationHelper::IsEnabled() ) + m_impl = wxToastNotificationHelper::CreateInstance(this); + else + m_impl = new wxBalloonNotifMsgImpl(this); } #endif // wxUSE_NOTIFICATION_MESSAGE && wxUSE_TASKBARICON diff --git a/Externals/wxWidgets3/src/msw/ole/access.cpp b/Externals/wxWidgets3/src/msw/ole/access.cpp index cab33c206c..00a5ac1002 100644 --- a/Externals/wxWidgets3/src/msw/ole/access.cpp +++ b/Externals/wxWidgets3/src/msw/ole/access.cpp @@ -33,11 +33,6 @@ #include "wx/log.h" #endif -// for some compilers, the entire ole2.h must be included, not only oleauto.h -#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) - #include -#endif - #include #include diff --git a/Externals/wxWidgets3/src/msw/ole/activex.cpp b/Externals/wxWidgets3/src/msw/ole/activex.cpp index 654fe80c3a..f90b33ddff 100644 --- a/Externals/wxWidgets3/src/msw/ole/activex.cpp +++ b/Externals/wxWidgets3/src/msw/ole/activex.cpp @@ -444,17 +444,7 @@ public: //*************************IOleInPlaceSiteEx*********************** HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx(BOOL * pfNoRedraw, DWORD) { -#ifdef __WXWINCE__ - IRunnableObject* runnable = NULL; - HRESULT hr = QueryInterface( - IID_IRunnableObject, (void**)(& runnable)); - if (SUCCEEDED(hr)) - { - runnable->LockRunning(TRUE, FALSE); - } -#else OleLockRunning(m_window->m_ActiveX, TRUE, FALSE); -#endif if (pfNoRedraw) (*pfNoRedraw) = FALSE; return S_OK; @@ -462,17 +452,7 @@ public: HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx(BOOL) { -#ifdef __WXWINCE__ - IRunnableObject* runnable = NULL; - HRESULT hr = QueryInterface( - IID_IRunnableObject, (void**)(& runnable)); - if (SUCCEEDED(hr)) - { - runnable->LockRunning(FALSE, FALSE); - } -#else OleLockRunning(m_window->m_ActiveX, FALSE, FALSE); -#endif return S_OK; } STDMETHOD(RequestUIActivate)(){ return S_OK;} @@ -526,9 +506,7 @@ public: HRESULT STDMETHODCALLTYPE LockContainer(BOOL){return S_OK;} //********************IOleItemContainer*************************** HRESULT STDMETHODCALLTYPE - #if 0 // defined(__WXWINCE__) && __VISUALC__ < 1400 - GetObject - #elif defined(_UNICODE) + #if defined(_UNICODE) GetObjectW #else GetObjectA @@ -1007,13 +985,13 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) // wxAutoOleInterface<> assumes a ref has already been added // TYPEATTR - TYPEATTR *ta = NULL; - hret = ti->GetTypeAttr(&ta); + TYPEATTR *ta2 = NULL; + hret = ti->GetTypeAttr(&ta2); CHECK_HR(hret); - if (ta->typekind == TKIND_DISPATCH) + if (ta2->typekind == TKIND_DISPATCH) { - // WXOLE_TRACEOUT("GUID = " << GetIIDName(ta->guid).c_str()); + // WXOLE_TRACEOUT("GUID = " << GetIIDName(ta2->guid).c_str()); if (defEventSink) { wxAutoIConnectionPoint cp; @@ -1022,8 +1000,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) wxAutoIConnectionPointContainer cpContainer(IID_IConnectionPointContainer, m_ActiveX); wxASSERT( cpContainer.IsOk()); - HRESULT hret = - cpContainer->FindConnectionPoint(ta->guid, cp.GetRef()); + hret = cpContainer->FindConnectionPoint(ta2->guid, cp.GetRef()); // Notice that the return value of CONNECT_E_NOCONNECTION is // expected if the interface doesn't support connection points. @@ -1035,7 +1012,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) if ( cp ) { wxActiveXEvents * const - events = new wxActiveXEvents(this, ta->guid); + events = new wxActiveXEvents(this, ta2->guid); hret = cp->Advise(events, &adviseCookie); // We don't need this object any more and cp will keep a @@ -1048,7 +1025,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) } } - ti->ReleaseTypeAttr(ta); + ti->ReleaseTypeAttr(ta2); } // free @@ -1225,11 +1202,7 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event)) posRect.right = w; posRect.bottom = h; -#if !(defined(_WIN32_WCE) && _WIN32_WCE < 400) ::RedrawWindow(m_oleObjectHWND, NULL, NULL, RDW_INTERNALPAINT); -#else - ::InvalidateRect(m_oleObjectHWND, NULL, false); -#endif RECTL *prcBounds = (RECTL *) &posRect; wxMSWDCImpl *msw = wxDynamicCast( dc.GetImpl() , wxMSWDCImpl ); m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, diff --git a/Externals/wxWidgets3/src/msw/ole/automtn.cpp b/Externals/wxWidgets3/src/msw/ole/automtn.cpp index 1c3bd0a2b9..fdbd9f4d4b 100644 --- a/Externals/wxWidgets3/src/msw/ole/automtn.cpp +++ b/Externals/wxWidgets3/src/msw/ole/automtn.cpp @@ -26,16 +26,15 @@ #include "wx/math.h" #endif -#define _FORCENAMELESSUNION +#ifndef _FORCENAMELESSUNION + #define _FORCENAMELESSUNION +#endif + #include "wx/msw/private.h" #include "wx/msw/ole/oleutils.h" #include "wx/msw/ole/automtn.h" -#ifdef __WXWINCE__ -#include "wx/msw/wince/time.h" -#else #include -#endif #include #include @@ -43,9 +42,7 @@ #include #define _huge -#ifndef __WXWINCE__ #include -#endif #include @@ -600,12 +597,12 @@ bool wxAutomationObject::CreateInstance(const wxString& progId) const return m_dispatchPtr != NULL; } -LCID wxAutomationObject::GetLCID() const +WXLCID wxAutomationObject::GetLCID() const { return m_lcid; } -void wxAutomationObject::SetLCID(LCID lcid) +void wxAutomationObject::SetLCID(WXLCID lcid) { m_lcid = lcid; } diff --git a/Externals/wxWidgets3/src/msw/ole/dataobj.cpp b/Externals/wxWidgets3/src/msw/ole/dataobj.cpp index 2055a0a0de..06b4440bbd 100644 --- a/Externals/wxWidgets3/src/msw/ole/dataobj.cpp +++ b/Externals/wxWidgets3/src/msw/ole/dataobj.cpp @@ -32,21 +32,12 @@ #include "wx/dataobj.h" -#if wxUSE_OLE && defined(__WIN32__) && !defined(__GNUWIN32_OLD__) +#if wxUSE_OLE #include "wx/scopedarray.h" #include "wx/vector.h" #include "wx/msw/private.h" // includes -#ifdef __WXWINCE__ -#include -#endif - -// for some compilers, the entire ole2.h must be included, not only oleauto.h -#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) || defined(__WXWINCE__) - #include -#endif - #include #include @@ -233,8 +224,8 @@ private: { public: // Ctor takes ownership of the pointers. - SystemDataEntry(FORMATETC *pformatetc, STGMEDIUM *pmedium) - : pformatetc(pformatetc), pmedium(pmedium) + SystemDataEntry(FORMATETC *pformatetc_, STGMEDIUM *pmedium_) + : pformatetc(pformatetc_), pmedium(pmedium_) { } @@ -552,7 +543,6 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) pmedium->tymed = TYMED_ENHMF; break; -#ifndef __WXWINCE__ case wxDF_METAFILE: pmedium->hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(METAFILEPICT)); @@ -562,7 +552,6 @@ STDMETHODIMP wxIDataObject::GetData(FORMATETC *pformatetcIn, STGMEDIUM *pmedium) } pmedium->tymed = TYMED_MFPICT; break; -#endif default: // alloc memory size_t size = m_pDataObject->GetDataSize(format); @@ -734,13 +723,11 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, break; #endif case CF_BITMAP: -#ifndef __WXWINCE__ case CF_HDROP: // these formats don't use size at all, anyhow (but // pass data by handle, which is always a single DWORD) size = 0; break; -#endif case CF_DIB: // the handler will calculate size itself (it's too @@ -748,11 +735,9 @@ STDMETHODIMP wxIDataObject::SetData(FORMATETC *pformatetc, size = 0; break; -#ifndef __WXWINCE__ case CF_METAFILEPICT: size = sizeof(METAFILEPICT); break; -#endif default: pBuf = m_pDataObject-> GetSizeFromBuffer(pBuf, &size, format); @@ -894,7 +879,7 @@ STDMETHODIMP wxIDataObject::EnumFormatEtc(DWORD dwDir, nFormatCount = wx_truncate_cast(ULONG, ourFormatCount + sysFormatCount); // fill format array with formats ... - wxScopedArray formats(new wxDataFormat[nFormatCount]); + wxScopedArray formats(nFormatCount); // ... from content data (supported formats) m_pDataObject->GetAllFormats(formats.get(), dir); @@ -1022,12 +1007,10 @@ const wxChar *wxDataObject::GetFormatName(wxDataFormat format) case CF_RIFF: return wxT("CF_RIFF"); case CF_WAVE: return wxT("CF_WAVE"); case CF_UNICODETEXT: return wxT("CF_UNICODETEXT"); -#ifndef __WXWINCE__ case CF_METAFILEPICT: return wxT("CF_METAFILEPICT"); case CF_ENHMETAFILE: return wxT("CF_ENHMETAFILE"); case CF_LOCALE: return wxT("CF_LOCALE"); case CF_HDROP: return wxT("CF_HDROP"); -#endif default: if ( !::GetClipboardFormatName(format, s_szBuf, WXSIZEOF(s_szBuf)) ) @@ -1050,11 +1033,9 @@ const wxChar *wxDataObject::GetFormatName(wxDataFormat format) // wxBitmapDataObject supports CF_DIB format // ---------------------------------------------------------------------------- -// TODO: support CF_DIB under Windows CE as well - size_t wxBitmapDataObject::GetDataSize() const { -#if wxUSE_WXDIB && !defined(__WXWINCE__) +#if wxUSE_WXDIB return wxDIB::ConvertFromBitmap(NULL, GetHbitmapOf(GetBitmap())); #else return 0; @@ -1063,7 +1044,7 @@ size_t wxBitmapDataObject::GetDataSize() const bool wxBitmapDataObject::GetDataHere(void *buf) const { -#if wxUSE_WXDIB && !defined(__WXWINCE__) +#if wxUSE_WXDIB BITMAPINFO * const pbi = (BITMAPINFO *)buf; return wxDIB::ConvertFromBitmap(pbi, GetHbitmapOf(GetBitmap())) != 0; @@ -1075,7 +1056,7 @@ bool wxBitmapDataObject::GetDataHere(void *buf) const bool wxBitmapDataObject::SetData(size_t WXUNUSED(len), const void *buf) { -#if wxUSE_WXDIB && !defined(__WXWINCE__) +#if wxUSE_WXDIB const BITMAPINFO * const pbmi = (const BITMAPINFO *)buf; HBITMAP hbmp = wxDIB::ConvertToBitmap(pbmi); @@ -1269,9 +1250,8 @@ bool wxBitmapDataObject::SetData(const wxDataFormat& format, // ---------------------------------------------------------------------------- bool wxFileDataObject::SetData(size_t WXUNUSED(size), - const void *WXUNUSED_IN_WINCE(pData)) + const void *pData) { -#ifndef __WXWINCE__ m_filenames.Empty(); // the documentation states that the first member of DROPFILES structure is @@ -1304,9 +1284,6 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), } return true; -#else - return false; -#endif } void wxFileDataObject::AddFile(const wxString& file) @@ -1319,7 +1296,6 @@ void wxFileDataObject::AddFile(const wxString& file) size_t wxFileDataObject::GetDataSize() const { -#ifndef __WXWINCE__ // size returned will be the size of the DROPFILES structure, plus the list // of filesnames (null byte separated), plus a double null at the end @@ -1327,20 +1303,7 @@ size_t wxFileDataObject::GetDataSize() const if ( m_filenames.empty() ) return 0; -#if wxUSE_UNICODE_MSLU - size_t sizeOfChar; - if ( wxGetOsVersion() == wxOS_WINDOWS_9X ) - { - // Win9x always uses ANSI file names and MSLU doesn't help with this - sizeOfChar = 1; - } - else - { - sizeOfChar = sizeof(wxChar); - } -#else // !wxUSE_UNICODE_MSLU static const size_t sizeOfChar = sizeof(wxChar); -#endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU // initial size of DROPFILES struct + null byte size_t sz = sizeof(DROPFILES) + sizeOfChar; @@ -1349,26 +1312,16 @@ size_t wxFileDataObject::GetDataSize() const for ( size_t i = 0; i < count; i++ ) { // add filename length plus null byte - size_t len; -#if wxUSE_UNICODE_MSLU - if ( sizeOfChar == 1 ) - len = strlen(m_filenames[i].mb_str(*wxConvFileName)); - else -#endif // wxUSE_UNICODE_MSLU - len = m_filenames[i].length(); + size_t len = m_filenames[i].length(); sz += (len + 1) * sizeOfChar; } return sz; -#else - return 0; -#endif } -bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const +bool wxFileDataObject::GetDataHere(void *pData) const { -#ifndef __WXWINCE__ // pData points to an externally allocated memory block // created using the size returned by GetDataSize() @@ -1382,11 +1335,7 @@ bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const // initialize DROPFILES struct pDrop->pFiles = sizeof(DROPFILES); pDrop->fNC = FALSE; // not non-client coords -#if wxUSE_UNICODE_MSLU - pDrop->fWide = wxGetOsVersion() != wxOS_WINDOWS_9X ? TRUE : FALSE; -#else pDrop->fWide = wxUSE_UNICODE; -#endif const size_t sizeOfChar = pDrop->fWide ? sizeof(wchar_t) : 1; @@ -1397,20 +1346,8 @@ bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const for ( size_t i = 0; i < count; i++ ) { // copy filename to pbuf and add null terminator - size_t len; -#if wxUSE_UNICODE_MSLU - if ( sizeOfChar == 1 ) - { - wxCharBuffer buf(m_filenames[i].mb_str(*wxConvFileName)); - len = strlen(buf); - memcpy(pbuf, buf, len*sizeOfChar); - } - else -#endif // wxUSE_UNICODE_MSLU - { - len = m_filenames[i].length(); - memcpy(pbuf, m_filenames[i].t_str(), len*sizeOfChar); - } + size_t len = m_filenames[i].length(); + memcpy(pbuf, m_filenames[i].t_str(), len*sizeOfChar); pbuf += len*sizeOfChar; @@ -1422,9 +1359,6 @@ bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const memset(pbuf, 0, sizeOfChar); return true; -#else - return false; -#endif } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/ole/dropsrc.cpp b/Externals/wxWidgets3/src/msw/ole/dropsrc.cpp index 698c829c5d..e5b556d2ca 100644 --- a/Externals/wxWidgets3/src/msw/ole/dropsrc.cpp +++ b/Externals/wxWidgets3/src/msw/ole/dropsrc.cpp @@ -34,11 +34,6 @@ #include "wx/msw/private.h" -// for some compilers, the entire ole2.h must be included, not only oleauto.h -#if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__) || defined(__WXWINCE__) - #include -#endif - #include #include "wx/msw/ole/oleutils.h" @@ -179,7 +174,7 @@ wxDropSource::~wxDropSource() // Name : DoDragDrop // Purpose : start drag and drop operation // Returns : wxDragResult - the code of performed operation -// Params : [in] int flags: specifies if moving is allowe (or only copying) +// Params : [in] int flags: specifies if moving is allowed (or only copying) // Notes : you must call SetData() before if you had used def ctor wxDragResult wxDropSource::DoDragDrop(int flags) { diff --git a/Externals/wxWidgets3/src/msw/ole/droptgt.cpp b/Externals/wxWidgets3/src/msw/ole/droptgt.cpp index 182ae4e3d0..170254b9ab 100644 --- a/Externals/wxWidgets3/src/msw/ole/droptgt.cpp +++ b/Externals/wxWidgets3/src/msw/ole/droptgt.cpp @@ -32,18 +32,7 @@ #include "wx/msw/private.h" -#ifdef __WXWINCE__ - #include - #include -#endif - -#ifdef __WIN32__ - #if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS - #include // for DROPFILES structure - #endif -#else - #include -#endif +#include // for DROPFILES structure #include "wx/dnd.h" @@ -218,6 +207,16 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource, } #endif // 0 + if ( !m_pTarget->MSWIsAcceptedData(pIDataSource) ) { + // we don't accept this kind of data + *pdwEffect = DROPEFFECT_NONE; + + // Don't do anything else if we don't support this format at all, notably + // don't call our OnEnter() below which would show misleading cursor to + // the user. + return S_OK; + } + // for use in OnEnter and OnDrag calls m_pTarget->MSWSetDataSource(pIDataSource); @@ -225,26 +224,19 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource, m_pIDataObject = pIDataSource; m_pIDataObject->AddRef(); - if ( !m_pTarget->MSWIsAcceptedData(pIDataSource) ) { - // we don't accept this kind of data - *pdwEffect = DROPEFFECT_NONE; - } - else + // we need client coordinates to pass to wxWin functions + if ( !ScreenToClient(m_hwnd, (POINT *)&pt) ) { - // we need client coordinates to pass to wxWin functions - if ( !ScreenToClient(m_hwnd, (POINT *)&pt) ) - { - wxLogLastError(wxT("ScreenToClient")); - } - - // give some visual feedback - *pdwEffect = ConvertDragResultToEffect( - m_pTarget->OnEnter(pt.x, pt.y, ConvertDragEffectToResult( - GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction(), *pdwEffect)) - ) - ); + wxLogLastError(wxT("ScreenToClient")); } + // give some visual feedback + *pdwEffect = ConvertDragResultToEffect( + m_pTarget->OnEnter(pt.x, pt.y, ConvertDragEffectToResult( + GetDropEffect(grfKeyState, m_pTarget->GetDefaultAction(), *pdwEffect)) + ) + ); + // update drag image const wxDragResult res = ConvertDragEffectToResult(*pdwEffect); m_pTarget->MSWUpdateDragImageOnEnter(pt.x, pt.y, res); @@ -409,31 +401,17 @@ wxDropTarget::~wxDropTarget() bool wxDropTarget::Register(WXHWND hwnd) { - // FIXME - // RegisterDragDrop not available on Windows CE >= 400? - // Or maybe we can dynamically load them from ceshell.dll - // or similar. -#if defined(__WXWINCE__) && _WIN32_WCE >= 400 - wxUnusedVar(hwnd); - return false; -#else HRESULT hr; - // May exist in later WinCE versions -#ifndef __WXWINCE__ hr = ::CoLockObjectExternal(m_pIDropTarget, TRUE, FALSE); if ( FAILED(hr) ) { wxLogApiError(wxT("CoLockObjectExternal"), hr); return false; } -#endif hr = ::RegisterDragDrop((HWND) hwnd, m_pIDropTarget); if ( FAILED(hr) ) { - // May exist in later WinCE versions -#ifndef __WXWINCE__ ::CoLockObjectExternal(m_pIDropTarget, FALSE, FALSE); -#endif wxLogApiError(wxT("RegisterDragDrop"), hr); return false; } @@ -444,31 +422,22 @@ bool wxDropTarget::Register(WXHWND hwnd) MSWInitDragImageSupport(); return true; -#endif } void wxDropTarget::Revoke(WXHWND hwnd) { -#if defined(__WXWINCE__) && _WIN32_WCE >= 400 - // Not available, see note above - wxUnusedVar(hwnd); -#else HRESULT hr = ::RevokeDragDrop((HWND) hwnd); if ( FAILED(hr) ) { wxLogApiError(wxT("RevokeDragDrop"), hr); } - // May exist in later WinCE versions -#ifndef __WXWINCE__ ::CoLockObjectExternal(m_pIDropTarget, FALSE, TRUE); -#endif MSWEndDragImageSupport(); // remove window reference m_pIDropTarget->SetHwnd(0); -#endif } // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/ole/oleutils.cpp b/Externals/wxWidgets3/src/msw/ole/oleutils.cpp index ab4122e0aa..c0a173a639 100644 --- a/Externals/wxWidgets3/src/msw/ole/oleutils.cpp +++ b/Externals/wxWidgets3/src/msw/ole/oleutils.cpp @@ -33,23 +33,13 @@ #include "wx/msw/private.h" -#ifdef __WXWINCE__ - #include - #include - - #define GUID_DEFINED - #define UUID_DEFINED -#endif - // OLE -#ifndef __WXWINCE__ #include "wx/msw/ole/uuid.h" -#endif #include "wx/msw/ole/oleutils.h" #include "wx/msw/ole/safearray.h" -#if defined(__VISUALC__) && (__VISUALC__ > 1000) +#if defined(__VISUALC__) #include #endif @@ -146,7 +136,7 @@ bool wxVariantDataCurrency::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataCurrency::VariantDataFactory(const wxAny& any) { - return new wxVariantDataCurrency(wxANY_AS(any, CURRENCY)); + return new wxVariantDataCurrency(any.As()); } REGISTER_WXANY_CONVERSION(CURRENCY, wxVariantDataCurrency) @@ -199,7 +189,7 @@ bool wxVariantDataErrorCode::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataErrorCode::VariantDataFactory(const wxAny& any) { - return new wxVariantDataErrorCode(wxANY_AS(any, SCODE)); + return new wxVariantDataErrorCode(any.As()); } REGISTER_WXANY_CONVERSION(SCODE, wxVariantDataErrorCode) @@ -247,7 +237,7 @@ bool wxVariantDataSafeArray::GetAsAny(wxAny* any) const wxVariantData* wxVariantDataSafeArray::VariantDataFactory(const wxAny& any) { - return new wxVariantDataSafeArray(wxANY_AS(any, SAFEARRAY*)); + return new wxVariantDataSafeArray(any.As()); } REGISTER_WXANY_CONVERSION(SAFEARRAY*, wxVariantDataSafeArray) @@ -331,13 +321,7 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole oleVariant.vt = VT_I4; oleVariant.lVal = variant.GetLong() ; } - // Original VC6 came with SDK too old to contain VARIANT::llVal declaration - // and there doesn't seem to be any way to test for it as Microsoft simply - // added it to the later version of oaidl.h without changing anything else. - // So assume it's not present for VC6, even though it might be if an - // updated SDK is used. In this case the user would need to disable this - // check himself. -#if wxUSE_LONGLONG && !defined(__VISUALC6__) +#if wxUSE_LONGLONG else if (type == wxT("longlong")) { oleVariant.vt = VT_I8; @@ -513,8 +497,7 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long fla #endif // wxUSE_DATETIME break; - // See the comment before the __VISUALC6__ test above. -#if wxUSE_LONGLONG && !defined(__VISUALC6__) +#if wxUSE_LONGLONG case VT_I8: variant = wxLongLong(oleVariant.llVal); break; @@ -545,12 +528,10 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long fla break; case VT_NULL: + case VT_EMPTY: variant.MakeNull(); break; - case VT_EMPTY: - break; // Ignore Empty Variant, used only during destruction of objects - default: wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: Unknown variant value type %X -> %X"), oleVariant.vt,oleVariant.vt&VT_TYPEMASK); @@ -570,7 +551,7 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long fla #if wxUSE_DATAOBJ -#if wxDEBUG_LEVEL && (( defined(__VISUALC__) && (__VISUALC__ > 1000) )) +#if wxDEBUG_LEVEL && defined(__VISUALC__) static wxString GetIidName(REFIID riid) { // an association between symbolic name and numeric value of an IID @@ -673,13 +654,9 @@ static wxString GetIidName(REFIID riid) } } -#ifndef __WXWINCE__ // unknown IID, just transform to string Uuid uuid(riid); return wxString((const wxChar *)uuid); -#else - return wxEmptyString; -#endif } WXDLLEXPORT void wxLogQueryInterface(const wxChar *szInterface, REFIID riid) diff --git a/Externals/wxWidgets3/src/msw/ole/safearray.cpp b/Externals/wxWidgets3/src/msw/ole/safearray.cpp index db62ad2fd9..276c906565 100644 --- a/Externals/wxWidgets3/src/msw/ole/safearray.cpp +++ b/Externals/wxWidgets3/src/msw/ole/safearray.cpp @@ -74,7 +74,7 @@ bool wxSafeArrayBase::GetLBound(size_t dim, long& bound) const wxCHECK_MSG( m_array, false, wxS("Uninitialized safe array") ); wxCHECK_MSG( dim > 0, false, wxS("Invalid dimension index") ); - HRESULT hr = SafeArrayGetLBound(m_array, dim, &bound); + HRESULT hr = SafeArrayGetLBound(m_array, dim, (LONG*)&bound); if ( FAILED(hr) ) { wxLogApiError(wxS("SafeArrayGetLBound()"), hr); @@ -88,7 +88,7 @@ bool wxSafeArrayBase::GetUBound(size_t dim, long& bound) const wxCHECK_MSG( m_array, false, wxS("Uninitialized safe array") ); wxCHECK_MSG( dim > 0, false, wxS("Invalid dimension index") ); - HRESULT hr = SafeArrayGetUBound(m_array, dim, &bound); + HRESULT hr = SafeArrayGetUBound(m_array, dim, (LONG*)&bound); if ( FAILED(hr) ) { wxLogApiError(wxS("SafeArrayGetUBound()"), hr); diff --git a/Externals/wxWidgets3/src/msw/ownerdrw.cpp b/Externals/wxWidgets3/src/msw/ownerdrw.cpp index de70ac8588..166e84542d 100644 --- a/Externals/wxWidgets3/src/msw/ownerdrw.cpp +++ b/Externals/wxWidgets3/src/msw/ownerdrw.cpp @@ -23,10 +23,6 @@ #include "wx/msw/private/dc.h" #include "wx/msw/wrapcctl.h" // for HIMAGELIST -#ifndef DSS_HIDEPREFIX -#define DSS_HIDEPREFIX 0x0200 -#endif - // ---------------------------------------------------------------------------- // constants for base class // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/palette.cpp b/Externals/wxWidgets3/src/msw/palette.cpp index faa896b019..a18c6fa139 100644 --- a/Externals/wxWidgets3/src/msw/palette.cpp +++ b/Externals/wxWidgets3/src/msw/palette.cpp @@ -111,7 +111,7 @@ private: // wxPalette // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject); #define M_PALETTEDATA ((wxPaletteRefData *)m_refData) diff --git a/Externals/wxWidgets3/src/msw/pen.cpp b/Externals/wxWidgets3/src/msw/pen.cpp index 87eb674613..1e1dac1d7e 100644 --- a/Externals/wxWidgets3/src/msw/pen.cpp +++ b/Externals/wxWidgets3/src/msw/pen.cpp @@ -34,11 +34,6 @@ #define M_PENDATA ((wxPenRefData*)m_refData) -// Win32 has ExtCreatePen() but WinCE doesn't -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - #define wxHAVE_EXT_CREATE_PEN -#endif - // ---------------------------------------------------------------------------- // wxPenRefData: contains information about an HPEN and its handle // ---------------------------------------------------------------------------- @@ -220,7 +215,6 @@ static int ConvertPenStyle(wxPenStyle style) wxFAIL_MSG( wxT("unknown pen style") ); // fall through -#ifdef wxHAVE_EXT_CREATE_PEN case wxPENSTYLE_DOT: return PS_DOT; @@ -238,14 +232,11 @@ static int ConvertPenStyle(wxPenStyle style) case wxPENSTYLE_HORIZONTAL_HATCH: case wxPENSTYLE_VERTICAL_HATCH: case wxPENSTYLE_SOLID: -#endif // wxHAVE_EXT_CREATE_PEN return PS_SOLID; } } -#ifdef wxHAVE_EXT_CREATE_PEN - static int ConvertJoinStyle(wxPenJoin join) { switch( join ) @@ -284,8 +275,6 @@ static int ConvertCapStyle(wxPenCap cap) } } -#endif // wxHAVE_EXT_CREATE_PEN - bool wxPenRefData::Alloc() { if ( m_hPen ) @@ -299,20 +288,6 @@ bool wxPenRefData::Alloc() const COLORREF col = m_colour.GetPixel(); -#ifdef wxHAVE_EXT_CREATE_PEN - // Only NT can display dashed or dotted lines with width > 1 - static const int os = wxGetOsVersion(); - if ( os != wxOS_WINDOWS_NT && - (m_style == wxPENSTYLE_DOT || - m_style == wxPENSTYLE_LONG_DASH || - m_style == wxPENSTYLE_SHORT_DASH || - m_style == wxPENSTYLE_DOT_DASH || - m_style == wxPENSTYLE_USER_DASH) && - m_width > 1 ) - { - m_width = 1; - } - // check if it's a standard kind of pen which can be created with just // CreatePen() if ( m_join == wxJOIN_ROUND && @@ -320,11 +295,9 @@ bool wxPenRefData::Alloc() m_style != wxPENSTYLE_USER_DASH && m_style != wxPENSTYLE_STIPPLE && (m_width <= 1 || m_style == wxPENSTYLE_SOLID) ) -#endif // !wxHAVE_EXT_CREATE_PEN { m_hPen = ::CreatePen(ConvertPenStyle(m_style), m_width, col); } -#ifdef wxHAVE_EXT_CREATE_PEN else // need to use ExtCreatePen() { DWORD styleMSW = PS_GEOMETRIC | @@ -397,7 +370,6 @@ bool wxPenRefData::Alloc() delete [] dash; } -#endif // wxHAVE_EXT_CREATE_PEN return m_hPen != 0; } @@ -425,19 +397,17 @@ WXHPEN wxPenRefData::GetHPEN() const // wxPen // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); wxPen::wxPen(const wxColour& col, int width, wxPenStyle style) { m_refData = new wxPenRefData(col, width, style); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxPen::wxPen(const wxColour& colour, int width, int style) { m_refData = new wxPenRefData(colour, width, (wxPenStyle)style); } -#endif wxPen::wxPen(const wxBitmap& stipple, int width) { diff --git a/Externals/wxWidgets3/src/msw/penwin.cpp b/Externals/wxWidgets3/src/msw/penwin.cpp deleted file mode 100644 index 399e8c0046..0000000000 --- a/Externals/wxWidgets3/src/msw/penwin.cpp +++ /dev/null @@ -1,113 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/penwin.cpp -// Purpose: PenWindows code -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/window.h" -#endif - -#include "wx/msw/private.h" - -#if wxUSE_PENWINDOWS - -#ifdef __BORLANDC__ -#define RPA_DEFAULT 1 -#else -#include -#endif - -HANDLE g_hPenWin = (HANDLE)NULL; -typedef void (CALLBACK * PENREGPROC)(WORD,BOOL); - -// The routine below allows Windows applications (binaries) to -// support Pen input when running under Microsoft Windows for -// Pen Computing 1.0 without need of the PenPalete. -// -// Should masked edit functions be added to wxWidgets we would -// be a new class of functions to support BEDIT controls. -// -// (The function is a NOOP for native Windows-NT) -#ifndef __WIN32__ -static void (CALLBACK * RegPenApp) (WORD, BOOL) = NULL; -#endif - -// Where is this called?? -void wxEnablePenAppHooks (bool hook) -{ -#ifndef __WIN32__ - if (hook) - { - if (g_hPenWin) - return; - - /////////////////////////////////////////////////////////////////////// - // If running on a Pen Windows system, register this app so all - // EDIT controls in dialogs are replaced by HEDIT controls. - if ((g_hPenWin = (HANDLE)::GetSystemMetrics (SM_PENWINDOWS)) != (HANDLE) NULL) - { - // We do this fancy GetProcAddress simply because we don't - // know if we're running Pen Windows. - if ((RegPenApp = (PENREGPROC)GetProcAddress (g_hPenWin, "RegisterPenApp")) != NULL) - (*RegPenApp) (RPA_DEFAULT, TRUE); - } - } - else - { - /////////////////////////////////////////////////////////////////////// - // If running on a Pen Windows system, unregister - if (g_hPenWin) - { - // Unregister this app - if (RegPenApp != NULL) - (*RegPenApp) (RPA_DEFAULT, FALSE); - g_hPenWin = (HANDLE) NULL; - } - } -#endif /* ! Windows-NT */ -} - -#endif - // End wxUSE_PENWINDOWS - -void wxRegisterPenWin(void) -{ -#if wxUSE_PENWINDOWS -/////////////////////////////////////////////////////////////////////// -// If running on a Pen Windows system, register this app so all -// EDIT controls in dialogs are replaced by HEDIT controls. -// (Notice the CONTROL statement in the RC file is "EDIT", -// RegisterPenApp will automatically change that control to -// an HEDIT. - if ((g_hPenWin = (HANDLE)::GetSystemMetrics(SM_PENWINDOWS)) != (HANDLE)NULL) { - // We do this fancy GetProcAddress simply because we don't - // know if we're running Pen Windows. - if ( (RegPenApp = (void (CALLBACK *)(WORD, BOOL))GetProcAddress(g_hPenWin, "RegisterPenApp"))!= NULL) - (*RegPenApp)(RPA_DEFAULT, TRUE); - } -/////////////////////////////////////////////////////////////////////// -#endif -} - -void wxCleanUpPenWin(void) -{ -#if wxUSE_PENWINDOWS - if (g_hPenWin) { - // Unregister this app - if (RegPenApp != NULL) - (*RegPenApp)(RPA_DEFAULT, FALSE); - } -#endif -} diff --git a/Externals/wxWidgets3/src/msw/popupwin.cpp b/Externals/wxWidgets3/src/msw/popupwin.cpp index fbcf9961e6..f1ed6258ba 100644 --- a/Externals/wxWidgets3/src/msw/popupwin.cpp +++ b/Externals/wxWidgets3/src/msw/popupwin.cpp @@ -47,16 +47,6 @@ bool wxPopupWindow::Create(wxWindow *parent, int flags) flags | wxPOPUP_WINDOW); } -void wxPopupWindow::DoGetPosition(int *x, int *y) const -{ - // the position of a "top level" window such as this should be in - // screen coordinates, not in the client ones which MSW gives us - // (because we are a child window) - wxPopupWindowBase::DoGetPosition(x, y); - - GetParent()->ClientToScreen(x, y); -} - WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const { // we only honour the border flags, the others don't make sense for us @@ -80,13 +70,7 @@ WXHWND wxPopupWindow::MSWGetParent() const // WS_CHILD but then showing a popup would deactivate the parent which // is ugly and working around this, although possible, is even more // ugly - // GetDesktopWindow() is not always supported on WinCE, and if - // it is, it often returns NULL. -#ifdef __WXWINCE__ - return 0; -#else return (WXHWND)::GetDesktopWindow(); -#endif } void wxPopupWindow::SetFocus() diff --git a/Externals/wxWidgets3/src/msw/power.cpp b/Externals/wxWidgets3/src/msw/power.cpp index fa74db73aa..af74be0d88 100644 --- a/Externals/wxWidgets3/src/msw/power.cpp +++ b/Externals/wxWidgets3/src/msw/power.cpp @@ -27,17 +27,87 @@ #endif //WX_PRECOMP #include "wx/power.h" +#include "wx/atomic.h" #include "wx/msw/private.h" -#if !defined(__WINCE_STANDARDSDK__) +// ---------------------------------------------------------------------------- +// wxPowerResource +// ---------------------------------------------------------------------------- -#ifdef __WXWINCE__ - typedef SYSTEM_POWER_STATUS_EX SYSTEM_POWER_STATUS; - BOOL GetSystemPowerStatus(SYSTEM_POWER_STATUS *status) +namespace +{ + +wxAtomicInt g_powerResourceScreenRefCount = 0; +wxAtomicInt g_powerResourceSystemRefCount = 0; + +bool UpdatePowerResourceExecutionState() +{ + EXECUTION_STATE executionState = ES_CONTINUOUS; + if ( g_powerResourceScreenRefCount > 0 ) + executionState |= ES_DISPLAY_REQUIRED; + + if ( g_powerResourceSystemRefCount > 0 ) + executionState |= ES_SYSTEM_REQUIRED; + + if ( ::SetThreadExecutionState(executionState) == 0 ) { - return GetSystemPowerStatusEx(status, TRUE); + wxLogLastError(wxT("SetThreadExecutionState()")); + return false; } -#endif + + return true; +} + +} // anonymous namespace + +bool +wxPowerResource::Acquire(wxPowerResourceKind kind, + const wxString& WXUNUSED(reason)) +{ + switch ( kind ) + { + case wxPOWER_RESOURCE_SCREEN: + wxAtomicInc(g_powerResourceScreenRefCount); + break; + + case wxPOWER_RESOURCE_SYSTEM: + wxAtomicInc(g_powerResourceSystemRefCount); + break; + } + + return UpdatePowerResourceExecutionState(); +} + +void wxPowerResource::Release(wxPowerResourceKind kind) +{ + switch ( kind ) + { + case wxPOWER_RESOURCE_SCREEN: + if ( g_powerResourceScreenRefCount > 0 ) + { + wxAtomicDec(g_powerResourceScreenRefCount); + } + else + { + wxFAIL_MSG( "Screen power resource was not acquired" ); + } + break; + + case wxPOWER_RESOURCE_SYSTEM: + if ( g_powerResourceSystemRefCount > 0 ) + { + wxAtomicDec(g_powerResourceSystemRefCount); + } + else + { + wxFAIL_MSG( "System power resource was not acquired" ); + } + break; + } + + UpdatePowerResourceExecutionState(); +} + // ---------------------------------------------------------------------------- // helper functions @@ -54,15 +124,12 @@ static inline bool wxGetPowerStatus(SYSTEM_POWER_STATUS *sps) return true; } -#endif - // ============================================================================ // implementation // ============================================================================ wxPowerType wxGetPowerType() { -#if !defined(__WINCE_STANDARDSDK__) SYSTEM_POWER_STATUS sps; if ( wxGetPowerStatus(&sps) ) { @@ -80,14 +147,12 @@ wxPowerType wxGetPowerType() break; } } -#endif return wxPOWER_UNKNOWN; } wxBatteryState wxGetBatteryState() { -#if !defined(__WINCE_STANDARDSDK__) SYSTEM_POWER_STATUS sps; if ( wxGetPowerStatus(&sps) ) { @@ -105,7 +170,6 @@ wxBatteryState wxGetBatteryState() return wxBATTERY_CRITICAL_STATE; } } -#endif return wxBATTERY_UNKNOWN_STATE; } diff --git a/Externals/wxWidgets3/src/msw/printdlg.cpp b/Externals/wxWidgets3/src/msw/printdlg.cpp index 63826efb51..53de22d010 100644 --- a/Externals/wxWidgets3/src/msw/printdlg.cpp +++ b/Externals/wxWidgets3/src/msw/printdlg.cpp @@ -167,7 +167,7 @@ wxCreateDevNames(const wxString& driverName, return hDev; } -IMPLEMENT_CLASS(wxWindowsPrintNativeData, wxPrintNativeDataBase) +wxIMPLEMENT_CLASS(wxWindowsPrintNativeData, wxPrintNativeDataBase); wxWindowsPrintNativeData::wxWindowsPrintNativeData() { @@ -413,6 +413,13 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi NULL, // these are not used. 0 ); // Zero returns buffer size. + // Some buggy printer drivers (see #16274 which claims that Kyocera + // PCL6 driver does this) seem to return a too small value from + // DocumentProperties(), resulting in a crash because when we call + // it with DM_OUT_BUFFER below, memory beyond the allocated buffer + // is overwritten. So add a bit of extra memory to work around this. + dwNeeded += 1024; + LPDEVMODE tempDevMode = static_cast( GlobalAlloc( GMEM_FIXED | GMEM_ZEROINIT, dwNeeded ) ); // Step 2: @@ -444,11 +451,7 @@ void wxWindowsPrintNativeData::InitializeDevMode(const wxString& printerName, Wi PRINTDLG pd; memset(&pd, 0, sizeof(PRINTDLG)); -#ifdef __WXWINCE__ - pd.cbStruct = sizeof(PRINTDLG); -#else pd.lStructSize = sizeof(PRINTDLG); -#endif pd.hwndOwner = NULL; pd.hDevMode = NULL; // Will be created by PrintDlg @@ -693,7 +696,7 @@ bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data ) // wxPrintDialog // --------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxWindowsPrintDialog, wxPrintDialogBase) +wxIMPLEMENT_CLASS(wxWindowsPrintDialog, wxPrintDialogBase); wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintDialogData* data) { @@ -740,16 +743,14 @@ int wxWindowsPrintDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); + wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle()); + WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; + ConvertToNative( m_printDialogData ); PRINTDLG *pd = (PRINTDLG*) m_printDlg; - if (m_dialogParent) - pd->hwndOwner = (HWND) m_dialogParent->GetHWND(); - else if (wxTheApp->GetTopWindow()) - pd->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND(); - else - pd->hwndOwner = 0; + pd->hwndOwner = hWndParent; bool ret = (PrintDlg( pd ) != 0); @@ -922,7 +923,7 @@ bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data ) // wxWidnowsPageSetupDialog // --------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxWindowsPageSetupDialog, wxPageSetupDialogBase) +wxIMPLEMENT_CLASS(wxWindowsPageSetupDialog, wxPageSetupDialogBase); wxWindowsPageSetupDialog::wxWindowsPageSetupDialog() { diff --git a/Externals/wxWidgets3/src/msw/printwin.cpp b/Externals/wxWidgets3/src/msw/printwin.cpp index 6929bbfe39..6d1e9c40c7 100644 --- a/Externals/wxWidgets3/src/msw/printwin.cpp +++ b/Externals/wxWidgets3/src/msw/printwin.cpp @@ -63,8 +63,8 @@ BOOL CALLBACK wxAbortProc(HDC hdc, int error); // wxWin macros // --------------------------------------------------------------------------- - IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase) - IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase) + wxIMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase); + wxIMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase); // =========================================================================== // implementation @@ -189,7 +189,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt int minPageNum = minPage, maxPageNum = maxPage; - if ( !m_printDialogData.GetAllPages() ) + if ( !(m_printDialogData.GetAllPages() || m_printDialogData.GetSelection()) ) { minPageNum = m_printDialogData.GetFromPage(); maxPageNum = m_printDialogData.GetToPage(); @@ -356,13 +356,13 @@ void wxWindowsPrintPreview::DetermineScaling() if ( printerDC.IsOk() ) { wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl(); - HDC dc = GetHdcOf(*impl); - printerWidthMM = ::GetDeviceCaps(dc, HORZSIZE); - printerHeightMM = ::GetDeviceCaps(dc, VERTSIZE); - printerXRes = ::GetDeviceCaps(dc, HORZRES); - printerYRes = ::GetDeviceCaps(dc, VERTRES); - logPPIPrinterX = ::GetDeviceCaps(dc, LOGPIXELSX); - logPPIPrinterY = ::GetDeviceCaps(dc, LOGPIXELSY); + HDC hdc = GetHdcOf(*impl); + printerWidthMM = ::GetDeviceCaps(hdc, HORZSIZE); + printerHeightMM = ::GetDeviceCaps(hdc, VERTSIZE); + printerXRes = ::GetDeviceCaps(hdc, HORZRES); + printerYRes = ::GetDeviceCaps(hdc, VERTRES); + logPPIPrinterX = ::GetDeviceCaps(hdc, LOGPIXELSX); + logPPIPrinterY = ::GetDeviceCaps(hdc, LOGPIXELSY); paperRect = printerDC.GetPaperRect(); diff --git a/Externals/wxWidgets3/src/msw/progdlg.cpp b/Externals/wxWidgets3/src/msw/progdlg.cpp index 3f9adea6e8..f44c17ba68 100644 --- a/Externals/wxWidgets3/src/msw/progdlg.cpp +++ b/Externals/wxWidgets3/src/msw/progdlg.cpp @@ -22,7 +22,7 @@ #pragma hdrstop #endif -#if wxUSE_PROGRESSDLG && wxUSE_THREADS +#if wxUSE_PROGRESSDLG && wxUSE_THREADS && wxUSE_NATIVE_PROGRESSDLG #include "wx/progdlg.h" diff --git a/Externals/wxWidgets3/src/msw/radiobox.cpp b/Externals/wxWidgets3/src/msw/radiobox.cpp index 053da03797..0088024f51 100644 --- a/Externals/wxWidgets3/src/msw/radiobox.cpp +++ b/Externals/wxWidgets3/src/msw/radiobox.cpp @@ -77,7 +77,7 @@ wxBEGIN_FLAGS( wxRadioBoxStyle ) wxFLAGS_MEMBER(wxRA_SPECIFY_ROWS) wxEND_FLAGS( wxRadioBoxStyle ) -IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl,"wx/radiobox.h") +wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl, "wx/radiobox.h"); wxBEGIN_PROPERTIES_TABLE(wxRadioBox) wxEVENT_PROPERTY( Select , wxEVT_RADIOBOX , wxCommandEvent ) @@ -85,7 +85,7 @@ wxBEGIN_PROPERTIES_TABLE(wxRadioBox) wxEND_PROPERTIES_TABLE() #else -IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); #endif /* @@ -101,10 +101,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) // --------------------------------------------------------------------------- // wnd proc for radio buttons -LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hWnd, - UINT message, - WPARAM wParam, - LPARAM lParam); +LRESULT APIENTRY +wxRadioBtnWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // --------------------------------------------------------------------------- // global vars @@ -239,13 +237,10 @@ bool wxRadioBox::Create(wxWindow *parent, m_radioButtons->SetFont(GetFont()); -#ifdef __WXWINCE__ - // Set the z-order correctly - SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); -#endif - SetMajorDim(majorDim == 0 ? n : majorDim, style); - SetSelection(0); + // Select the first radio button if we have any buttons at all. + if ( n > 0 ) + SetSelection(0); SetSize(pos.x, pos.y, size.x, size.y); // Now that we have items determine what is the best size and set it. @@ -543,10 +538,6 @@ bool wxRadioBox::Reparent(wxWindowBase *newParent) { ::SetParent((*m_radioButtons)[item], hwndParent); } -#ifdef __WXWINCE__ - // put static box under the buttons in the Z-order - SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); -#endif return true; } @@ -571,7 +562,7 @@ wxSize wxRadioBox::GetMaxButtonSize() const // adjust the size to take into account the radio box itself // FIXME this is totally bogus! - width += RADIO_SIZE; + width += FromDIP(RADIO_SIZE); height *= 3; height /= 2; } @@ -608,7 +599,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const // and also wide enough for its label int widthLabel; GetTextExtent(GetLabelText(), &widthLabel, NULL); - widthLabel += RADIO_SIZE; // FIXME this is bogus too + widthLabel += FromDIP(RADIO_SIZE); // FIXME this is bogus too if ( widthLabel > width ) width = widthLabel; @@ -782,8 +773,6 @@ int wxRadioBox::GetItemFromPoint(const wxPoint& pt) const // radio box drawing // ---------------------------------------------------------------------------- -#ifndef __WXWINCE__ - WXHRGN wxRadioBox::MSWGetRegionWithoutChildren() { RECT rc; @@ -805,16 +794,12 @@ WXHRGN wxRadioBox::MSWGetRegionWithoutChildren() return (WXHRGN)hrgn; } -#endif // __WXWINCE__ - // --------------------------------------------------------------------------- // window proc for radio buttons // --------------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) +LRESULT APIENTRY +wxRadioBtnWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { wxRadioBox * const radiobox = wxRadioBox::GetFromRadioButtonHWND(hwnd); @@ -901,7 +886,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, } break; -#ifndef __WXWINCE__ case WM_HELP: { bool processed = false; @@ -938,7 +922,6 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, return 0; } break; -#endif // !__WXWINCE__ } return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, message, wParam, lParam); diff --git a/Externals/wxWidgets3/src/msw/radiobut.cpp b/Externals/wxWidgets3/src/msw/radiobut.cpp index 17323a9c1f..ab0e84563e 100644 --- a/Externals/wxWidgets3/src/msw/radiobut.cpp +++ b/Externals/wxWidgets3/src/msw/radiobut.cpp @@ -34,6 +34,8 @@ #endif #include "wx/msw/private.h" +#include "wx/renderer.h" +#include "wx/msw/uxtheme.h" // ============================================================================ // wxRadioButton implementation @@ -82,11 +84,14 @@ bool wxRadioButton::Create(wxWindow *parent, void wxRadioButton::SetValue(bool value) { - ::SendMessage(GetHwnd(), BM_SETCHECK, - value ? BST_CHECKED : BST_UNCHECKED, 0); - m_isChecked = value; + if ( !IsOwnerDrawn() ) + ::SendMessage(GetHwnd(), BM_SETCHECK, + value ? BST_CHECKED : BST_UNCHECKED, 0); + else // owner drawn buttons don't react to this message + Refresh(); + if ( !value ) return; @@ -188,9 +193,12 @@ void wxRadioButton::SetValue(bool value) bool wxRadioButton::GetValue() const { - wxASSERT_MSG( m_isChecked == - (::SendMessage(GetHwnd(), BM_GETCHECK, 0, 0L) != 0), - wxT("wxRadioButton::m_isChecked is out of sync?") ); + if ( !IsOwnerDrawn() ) + { + wxASSERT_MSG( m_isChecked == + (::SendMessage(GetHwnd(), BM_GETCHECK, 0, 0L) != 0), + wxT("wxRadioButton::m_isChecked is out of sync?") ); + } return m_isChecked; } @@ -240,13 +248,6 @@ wxSize wxRadioButton::DoGetBestSize() const dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); s_radioSize = dc.GetCharHeight(); - - // radio button bitmap size under CE is bigger than the font height, - // adding just one pixel seems to work fine for the default font but it - // would be nice to find some better way to find the correct height -#ifdef __WXWINCE__ - s_radioSize++; -#endif // __WXWINCE__ } wxString str = GetLabel(); @@ -296,4 +297,30 @@ WXDWORD wxRadioButton::MSWGetStyle(long style, WXDWORD *exstyle) const return msStyle; } +// ---------------------------------------------------------------------------- +// owner drawn radio button stuff +// ---------------------------------------------------------------------------- + +int wxRadioButton::MSWGetButtonStyle() const +{ + return BS_RADIOBUTTON; +} + +void wxRadioButton::MSWOnButtonResetOwnerDrawn() +{ + // ensure that controls state is consistent with internal state + ::SendMessage(GetHwnd(), BM_SETCHECK, + m_isChecked ? BST_CHECKED : BST_UNCHECKED, 0); +} + +int wxRadioButton::MSWGetButtonCheckedFlag() const +{ + return m_isChecked ? wxCONTROL_CHECKED : wxCONTROL_NONE; +} + +void wxRadioButton::MSWDrawButtonBitmap(wxDC& dc, const wxRect& rect, int flags) +{ + wxRendererNative::Get().DrawRadioBitmap(this, dc, rect, flags); +} + #endif // wxUSE_RADIOBTN diff --git a/Externals/wxWidgets3/src/msw/regconf.cpp b/Externals/wxWidgets3/src/msw/regconf.cpp index 3cfe6583b7..90f977f577 100644 --- a/Externals/wxWidgets3/src/msw/regconf.cpp +++ b/Externals/wxWidgets3/src/msw/regconf.cpp @@ -64,7 +64,7 @@ bool TryGetValue(const wxRegKey& key, const wxString& str, wxMemoryBuffer &plVal // ---------------------------------------------------------------------------- // ctor/dtor // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxRegConfig, wxConfigBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxRegConfig, wxConfigBase); // create the config object which stores its data under HKCU\vendor\app and, if // style & wxCONFIG_USE_GLOBAL_FILE, under HKLM\vendor\app diff --git a/Externals/wxWidgets3/src/msw/region.cpp b/Externals/wxWidgets3/src/msw/region.cpp index 846fff1e85..425ba91965 100644 --- a/Externals/wxWidgets3/src/msw/region.cpp +++ b/Externals/wxWidgets3/src/msw/region.cpp @@ -31,8 +31,8 @@ #include "wx/msw/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject); // ---------------------------------------------------------------------------- // wxRegionRefData implementation @@ -48,17 +48,11 @@ public: wxRegionRefData(const wxRegionRefData& data) : wxGDIRefData() { -#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL); RGNDATA *rgnData = (RGNDATA*) new char[noBytes]; ::GetRegionData(data.m_region, noBytes, rgnData); m_region = ::ExtCreateRegion(NULL, noBytes, rgnData); delete[] (char*) rgnData; -#else - RECT rect; - ::GetRgnBox(data.m_region, &rect); - m_region = ::CreateRectRgnIndirect(&rect); -#endif } virtual ~wxRegionRefData() @@ -120,13 +114,6 @@ wxRegion::wxRegion(const wxRect& rect) wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle) { -#if defined(__WXMICROWIN__) || defined(__WXWINCE__) - wxUnusedVar(n); - wxUnusedVar(points); - wxUnusedVar(fillStyle); - m_refData = NULL; - M_REGION = NULL; -#else m_refData = new wxRegionRefData; M_REGION = ::CreatePolygonRgn ( @@ -134,7 +121,6 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle) n, fillStyle == wxODDEVEN_RULE ? ALTERNATE : WINDING ); -#endif } wxRegion::~wxRegion() diff --git a/Externals/wxWidgets3/src/msw/registry.cpp b/Externals/wxWidgets3/src/msw/registry.cpp index e67bed9375..34b7b3f83d 100644 --- a/Externals/wxWidgets3/src/msw/registry.cpp +++ b/Externals/wxWidgets3/src/msw/registry.cpp @@ -34,12 +34,6 @@ #include "wx/wfstream.h" #include "wx/msw/private.h" -// Windows headers -#ifdef __WXWINCE__ -#include -#include -#endif - // other std headers #include // for _MAX_PATH @@ -142,6 +136,33 @@ static wxString GetFullName(const wxRegKey *pKey, const wxString& szValue); // to NULL static inline const wxChar *RegValueStr(const wxString& szValue); +// Return the user-readable name of the given REG_XXX type constant. +static wxString GetTypeString(DWORD dwType) +{ +#define REG_TYPE_TO_STR(type) case REG_ ## type: return wxS(#type) + + switch ( dwType ) + { + REG_TYPE_TO_STR(NONE); + REG_TYPE_TO_STR(SZ); + REG_TYPE_TO_STR(EXPAND_SZ); + REG_TYPE_TO_STR(BINARY); + REG_TYPE_TO_STR(DWORD); + // REG_TYPE_TO_STR(DWORD_LITTLE_ENDIAN); -- same as REG_DWORD + REG_TYPE_TO_STR(DWORD_BIG_ENDIAN); + REG_TYPE_TO_STR(LINK); + REG_TYPE_TO_STR(MULTI_SZ); + REG_TYPE_TO_STR(RESOURCE_LIST); + REG_TYPE_TO_STR(FULL_RESOURCE_DESCRIPTOR); + REG_TYPE_TO_STR(RESOURCE_REQUIREMENTS_LIST); + REG_TYPE_TO_STR(QWORD); + // REG_TYPE_TO_STR(QWORD_LITTLE_ENDIAN); -- same as REG_QWORD + + default: + return wxString::Format(_("unknown (%lu)"), dwType); + } +} + // ============================================================================ // implementation of wxRegKey class // ============================================================================ @@ -372,14 +393,7 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys, #define REG_PARAM(name) &dw##name #else // Win32 - // Old gcc headers incorrectly prototype RegQueryInfoKey() as taking - // size_t but normally we need a cast, even when sizeof(size_t) is the same - // as sizeof(DWORD). - #if defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__) - #define REG_PARAM(name) pn##name - #else - #define REG_PARAM(name) (LPDWORD)(pn##name) - #endif + #define REG_PARAM(name) (LPDWORD)(pn##name) #endif @@ -546,9 +560,10 @@ bool wxRegKey::CopyValue(const wxString& szValue, switch ( GetValueType(szValue) ) { case Type_String: + case Type_Expand_String: { wxString strVal; - return QueryValue(szValue, strVal) && + return QueryRawValue(szValue, strVal) && keyDst.SetValue(valueNew, strVal); } @@ -572,7 +587,6 @@ bool wxRegKey::CopyValue(const wxString& szValue, // occur among the application keys (supposedly created with // this class) case Type_None: - case Type_Expand_String: case Type_Dword_big_endian: case Type_Link: case Type_Multi_String: @@ -910,13 +924,15 @@ bool wxRegKey::QueryValue(const wxString& szValue, long *plValue) const GetName().c_str()); return false; } - else { - // check that we read the value of right type - wxASSERT_MSG( IsNumericValue(szValue), - wxT("Type mismatch in wxRegKey::QueryValue().") ); - return true; + // check that we read the value of right type + if ( dwType != REG_DWORD_LITTLE_ENDIAN && dwType != REG_DWORD_BIG_ENDIAN ) { + wxLogError(_("Registry value \"%s\" is not numeric (but of type %s)"), + GetFullName(this, szValue), GetTypeString(dwType)); + return false; } + + return true; } else return false; @@ -952,6 +968,12 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxMemoryBuffer& buffer) const &dwType, NULL, &dwSize); if ( m_dwLastError == ERROR_SUCCESS ) { + if ( dwType != REG_BINARY ) { + wxLogError(_("Registry value \"%s\" is not binary (but of type %s)"), + GetFullName(this, szValue), GetTypeString(dwType)); + return false; + } + if ( dwSize ) { const RegBinary pBuf = (RegBinary)buffer.GetWriteBuf(dwSize); m_dwLastError = RegQueryValueEx((HKEY) m_hKey, @@ -981,7 +1003,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxMemoryBuffer& buffer) const bool wxRegKey::QueryValue(const wxString& szValue, wxString& strValue, - bool WXUNUSED_IN_WINCE(raw)) const + bool raw) const { if ( CONST_CAST Open(Read) ) { @@ -994,7 +1016,16 @@ bool wxRegKey::QueryValue(const wxString& szValue, &dwType, NULL, &dwSize); if ( m_dwLastError == ERROR_SUCCESS ) { - if ( !dwSize ) + if ( dwType != REG_SZ && dwType != REG_EXPAND_SZ ) + { + wxLogError(_("Registry value \"%s\" is not text (but of type %s)"), + GetFullName(this, szValue), GetTypeString(dwType)); + return false; + } + + // We need length in characters, not bytes. + DWORD chars = dwSize / sizeof(wxChar); + if ( !chars ) { // must treat this case specially as GetWriteBuf() doesn't like // being called with 0 size @@ -1002,15 +1033,26 @@ bool wxRegKey::QueryValue(const wxString& szValue, } else { - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, - RegValueStr(szValue), - RESERVED, - &dwType, - (RegString)(wxChar*)wxStringBuffer(strValue, dwSize), - &dwSize); + // extra scope for wxStringBufferLength + { + wxStringBufferLength strBuf(strValue, chars); + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, + RegValueStr(szValue), + RESERVED, + &dwType, + (RegString)(wxChar*)strBuf, + &dwSize); + + // The returned string may or not be NUL-terminated, + // exclude the trailing NUL if it's there (which is + // typically the case but is not guaranteed to always be). + if ( strBuf[chars - 1] == '\0' ) + chars--; + + strBuf.SetLength(chars); + } // expand the var expansions in the string unless disabled -#ifndef __WXWINCE__ if ( (dwType == REG_EXPAND_SZ) && !raw ) { DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue.t_str(), NULL, 0); @@ -1030,18 +1072,10 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxLogLastError(wxT("ExpandEnvironmentStrings")); } } -#endif - // __WXWINCE__ } if ( m_dwLastError == ERROR_SUCCESS ) - { - // check that it was the right type - wxASSERT_MSG( !IsNumericValue(szValue), - wxT("Type mismatch in wxRegKey::QueryValue().") ); - return true; - } } } @@ -1144,13 +1178,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const wxChar szKeyName[_MAX_PATH + 1]; -#ifdef __WXWINCE__ - DWORD sizeName = WXSIZEOF(szKeyName); - m_dwLastError = RegEnumKeyEx((HKEY) m_hKey, lIndex++, szKeyName, & sizeName, - 0, NULL, NULL, NULL); -#else m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName)); -#endif if ( m_dwLastError != ERROR_SUCCESS ) { if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) { @@ -1296,9 +1324,10 @@ wxString wxRegKey::FormatValue(const wxString& name) const switch ( type ) { case Type_String: + case Type_Expand_String: { wxString value; - if ( !QueryValue(name, value) ) + if ( !QueryRawValue(name, value) ) break; // quotes and backslashes must be quoted, linefeeds are not @@ -1347,7 +1376,6 @@ wxString wxRegKey::FormatValue(const wxString& name) const } break; - case Type_Expand_String: case Type_Multi_String: { wxString value; diff --git a/Externals/wxWidgets3/src/msw/renderer.cpp b/Externals/wxWidgets3/src/msw/renderer.cpp index 81d205e81c..47087e4781 100644 --- a/Externals/wxWidgets3/src/msw/renderer.cpp +++ b/Externals/wxWidgets3/src/msw/renderer.cpp @@ -26,11 +26,13 @@ #ifndef WX_PRECOMP #include "wx/string.h" #include "wx/window.h" + #include "wx/control.h" // for wxControl::Ellipsize() #include "wx/dc.h" #include "wx/settings.h" #endif //WX_PRECOMP #include "wx/dcgraph.h" +#include "wx/math.h" #include "wx/scopeguard.h" #include "wx/splitter.h" #include "wx/renderer.h" @@ -98,15 +100,30 @@ #define WP_CLOSEBUTTON 18 #define WP_RESTOREBUTTON 21 #define WP_HELPBUTTON 23 -#endif -#if defined(__WXWINCE__) - #ifndef DFCS_FLAT - #define DFCS_FLAT 0 - #endif - #ifndef DFCS_MONO - #define DFCS_MONO 0 - #endif + #define PP_BAR 1 + #define PP_CHUNK 3 + + #define LISS_NORMAL 1 + #define LISS_HOT 2 + #define LISS_SELECTED 3 + #define LISS_DISABLED 4 + #define LISS_SELECTEDNOTFOCUS 5 + #define LISS_HOTSELECTED 6 + + #define LVP_LISTITEM 1 + + #define DTT_TEXTCOLOR (1UL << 0) // crText has been specified + #define DTT_STATEID (1UL << 8) // IStateId has been specified + + #define TDLG_EXPANDOBUTTON 13 + + #define TDLGEBS_NORMAL 1 + #define TDLGEBS_HOVER 2 + #define TDLGEBS_PRESSED 3 + #define TDLGEBS_EXPANDEDNORMAL 4 + #define TDLGEBS_EXPANDEDHOVER 5 + #define TDLGEBS_EXPANDEDPRESSED 6 #endif #ifndef DFCS_HOT @@ -148,11 +165,6 @@ public: wxDC& dc, const wxRect& rect, int flags = 0) = 0; - - virtual void DrawTextCtrl(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0) = 0; }; // ---------------------------------------------------------------------------- @@ -184,11 +196,6 @@ public: const wxRect& rect, int flags = 0); - virtual void DrawTextCtrl(wxWindow* win, - wxDC& dc, - const wxRect& rect, - int flags = 0); - virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, @@ -288,6 +295,18 @@ public: m_rendererNative.DrawPushButton(win, dc, rect, flags); } + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0); + + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc); + + virtual void DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0); + virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, @@ -308,6 +327,23 @@ public: wxTitleBarButton button, int flags = 0); + virtual wxSize GetCheckBoxSize(wxWindow *win); + + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0); + + virtual void DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align = wxALIGN_LEFT | wxALIGN_TOP, + int flags = 0, + wxEllipsizeMode ellipsizeMode = wxELLIPSIZE_END); + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); private: @@ -353,6 +389,12 @@ void wxRendererMSWBase::DrawItemSelectionRect(wxWindow *win, const wxRect& rect, int flags) { + if ( flags & wxCONTROL_CELL ) + { + m_rendererNative.DrawItemSelectionRect(win, dc, rect, flags); + return; + } + wxBrush brush; if ( flags & wxCONTROL_SELECTED ) { @@ -549,11 +591,11 @@ wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win)) ::GetSystemMetrics(SM_CYMENUCHECK)); } -int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) +int wxRendererMSW::GetHeaderButtonHeight(wxWindow * win) { // some "reasonable" value returned in case of error, it doesn't really // correspond to anything but it's better than returning 0 - static const int DEFAULT_HEIGHT = 20; + static const int DEFAULT_HEIGHT = wxWindow::FromDIP(20, win); // create a temporary header window just to get its geometry @@ -564,6 +606,14 @@ int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win)) wxON_BLOCK_EXIT1( ::DestroyWindow, hwndHeader ); + // Set the font, even if it's the default one, before measuring the window. + wxFont font; + if ( win ) + font = win->GetFont(); + if ( !font.IsOk() ) + wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + ::SendMessage(hwndHeader, WM_SETFONT, (WPARAM)GetHfontOf(font), 0); + // initialize the struct filled with the values by Header_Layout() RECT parentRect = { 0, 0, 100, 100 }; WINDOWPOS wp = { 0, 0, 0, 0, 0, 0, 0 }; @@ -577,31 +627,33 @@ int wxRendererMSW::GetHeaderButtonMargin(wxWindow *WXUNUSED(win)) return 10; } -// Uses the theme to draw the border and fill for something like a wxTextCtrl -void wxRendererMSW::DrawTextCtrl(wxWindow* WXUNUSED(win), - wxDC& dc, - const wxRect& rect, - int WXUNUSED(flags)) -{ - wxColour fill; - wxColour bdr; - { - fill = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - bdr = *wxBLACK; - } - - dc.SetPen(bdr); - dc.SetBrush(fill); - dc.DrawRectangle(rect); -} - - // ============================================================================ // wxRendererXP implementation // ============================================================================ #if wxUSE_UXTHEME +namespace +{ + +int GetListItemState(int flags) +{ + int itemState = (flags & wxCONTROL_CURRENT) ? LISS_HOT : LISS_NORMAL; + if ( flags & wxCONTROL_SELECTED ) + { + itemState = (flags & wxCONTROL_CURRENT) ? LISS_HOTSELECTED : LISS_SELECTED; + if ( !(flags & wxCONTROL_FOCUSED) ) + itemState = LISS_SELECTEDNOTFOCUS; + } + + if ( flags & wxCONTROL_DISABLED ) + itemState = LISS_DISABLED; + + return itemState; +} + +} // anonymous namespace + /* static */ wxRendererNative& wxRendererXP::Get() { @@ -852,6 +904,208 @@ wxRendererXP::DrawTitleBarBitmap(wxWindow *win, DoDrawButtonLike(hTheme, part, dc, rect, flags); } +wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win) +{ + wxUxThemeHandle hTheme(win, L"BUTTON"); + if (hTheme) + { + wxUxThemeEngine* const te = wxUxThemeEngine::Get(); + + if (te && te->IsThemePartDefined(hTheme, BP_CHECKBOX, 0)) + { + SIZE checkSize; + if (te->GetThemePartSize(hTheme, NULL, BP_CHECKBOX, CBS_UNCHECKEDNORMAL, NULL, TS_DRAW, &checkSize) == S_OK) + return wxSize(checkSize.cx, checkSize.cy); + } + } + return m_rendererNative.GetCheckBoxSize(win); +} + +void +wxRendererXP::DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags) +{ + wxUxThemeHandle hTheme(win, L"TASKDIALOG"); + wxUxThemeEngine* const te = wxUxThemeEngine::Get(); + + int state; + if (flags & wxCONTROL_PRESSED) + state = TDLGEBS_PRESSED; + else if (flags & wxCONTROL_CURRENT) + state = TDLGEBS_HOVER; + else + state = TDLGEBS_NORMAL; + + if ( flags & wxCONTROL_EXPANDED ) + state += 3; + + if ( te->IsThemePartDefined(hTheme, TDLG_EXPANDOBUTTON, 0) ) + { + if (flags & wxCONTROL_EXPANDED) + flags |= wxCONTROL_CHECKED; + + wxRect adjustedRect = dc.GetImpl()->MSWApplyGDIPlusTransform(rect); + + RECT r; + wxCopyRectToRECT(adjustedRect, r); + + te->DrawThemeBackground + ( + hTheme, + GetHdcOf(dc.GetTempHDC()), + TDLG_EXPANDOBUTTON, + state, + &r, + NULL + ); + } + else + m_rendererNative.DrawCollapseButton(win, dc, rect, flags); +} + +wxSize wxRendererXP::GetCollapseButtonSize(wxWindow *win, wxDC& dc) +{ + wxUxThemeHandle hTheme(win, L"TASKDIALOG"); + wxUxThemeEngine* const te = wxUxThemeEngine::Get(); + + // EXPANDOBUTTON scales ugly if not using the correct size, get size from theme + + if ( te->IsThemePartDefined(hTheme, TDLG_EXPANDOBUTTON, 0) ) + { + SIZE s; + te->GetThemePartSize(hTheme, + GetHdcOf(dc.GetTempHDC()), + TDLG_EXPANDOBUTTON, + TDLGEBS_NORMAL, + NULL, + TS_TRUE, + &s); + + return wxSize(s.cx, s.cy); + } + else + return m_rendererNative.GetCollapseButtonSize(win, dc); +} + +void +wxRendererXP::DrawItemSelectionRect(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags) +{ + wxUxThemeHandle hTheme(win, L"LISTVIEW"); + + const int itemState = GetListItemState(flags); + + wxUxThemeEngine* const te = wxUxThemeEngine::Get(); + if ( te->IsThemePartDefined(hTheme, LVP_LISTITEM, 0) ) + { + RECT rc; + wxCopyRectToRECT(rect, rc); + if ( te->IsThemeBackgroundPartiallyTransparent(hTheme, LVP_LISTITEM, itemState) ) + te->DrawThemeParentBackground(GetHwndOf(win), GetHdcOf(dc.GetTempHDC()), &rc); + + te->DrawThemeBackground(hTheme, GetHdcOf(dc.GetTempHDC()), LVP_LISTITEM, itemState, &rc, 0); + } + else + { + m_rendererNative.DrawItemSelectionRect(win, dc, rect, flags); + } +} + +void wxRendererXP::DrawItemText(wxWindow* win, + wxDC& dc, + const wxString& text, + const wxRect& rect, + int align, + int flags, + wxEllipsizeMode ellipsizeMode) +{ + wxUxThemeHandle hTheme(win, L"LISTVIEW"); + + const int itemState = GetListItemState(flags); + + wxUxThemeEngine* te = wxUxThemeEngine::Get(); + if ( te->DrawThemeTextEx && // Might be not available if we're under XP + te->IsThemePartDefined(hTheme, LVP_LISTITEM, 0) ) + { + RECT rc; + wxCopyRectToRECT(rect, rc); + + DTTOPTS textOpts; + textOpts.dwSize = sizeof(textOpts); + textOpts.dwFlags = DTT_STATEID; + textOpts.iStateId = itemState; + + wxColour textColour = dc.GetTextForeground(); + if (flags & wxCONTROL_SELECTED) + { + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); + } + else if (flags & wxCONTROL_DISABLED) + { + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); + } + + if (textColour.IsOk()) { + textOpts.dwFlags |= DTT_TEXTCOLOR; + textOpts.crText = textColour.GetPixel(); + } + + DWORD textFlags = DT_NOPREFIX; + if ( align & wxALIGN_CENTER_HORIZONTAL ) + textFlags |= DT_CENTER; + else if ( align & wxALIGN_RIGHT ) + { + textFlags |= DT_RIGHT; + rc.right--; // Alignment is inconsistent with DrawLabel otherwise + } + else + textFlags |= DT_LEFT; + + if ( align & wxALIGN_BOTTOM ) + textFlags |= DT_BOTTOM; + else if ( align & wxALIGN_CENTER_VERTICAL ) + textFlags |= DT_VCENTER; + else + textFlags |= DT_TOP; + + const wxString* drawText = &text; + wxString ellipsizedText; + switch ( ellipsizeMode ) + { + case wxELLIPSIZE_NONE: + // no flag required + break; + + case wxELLIPSIZE_START: + case wxELLIPSIZE_MIDDLE: + // no native support for this ellipsize modes, use wxWidgets + // implementation (may not be 100% accurate because per + // definition the theme defines the font but should be close + // enough with current windows themes) + drawText = &ellipsizedText; + ellipsizedText = wxControl::Ellipsize(text, dc, ellipsizeMode, + rect.width, + wxELLIPSIZE_FLAGS_NONE); + break; + + case wxELLIPSIZE_END: + textFlags |= DT_END_ELLIPSIS; + break; + } + + te->DrawThemeTextEx(hTheme, dc.GetHDC(), LVP_LISTITEM, itemState, + drawText->wchar_str(), -1, textFlags, &rc, &textOpts); + } + else + { + m_rendererNative.DrawItemText(win, dc, text, rect, align, flags, ellipsizeMode); + } +} + // Uses the theme to draw the border and fill for something like a wxTextCtrl void wxRendererXP::DrawTextCtrl(wxWindow* win, wxDC& dc, @@ -888,6 +1142,54 @@ void wxRendererXP::DrawTextCtrl(wxWindow* win, dc.DrawRectangle(rect); } +void wxRendererXP::DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags) +{ + wxUxThemeHandle hTheme(win, L"PROGRESS"); + if ( !hTheme ) + { + m_rendererNative.DrawGauge(win, dc, rect, value, max, flags); + return; + } + + RECT r; + wxCopyRectToRECT(rect, r); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + PP_BAR, + 0, + &r, + NULL); + + RECT contentRect; + wxUxThemeEngine::Get()->GetThemeBackgroundContentRect( + hTheme, + GetHdcOf(dc.GetTempHDC()), + PP_BAR, + 0, + &r, + &contentRect); + + contentRect.right = contentRect.left + + wxMulDivInt32(contentRect.right - contentRect.left, + value, + max); + + wxUxThemeEngine::Get()->DrawThemeBackground( + hTheme, + GetHdcOf(dc.GetTempHDC()), + PP_CHUNK, + 0, + &contentRect, + NULL); +} + // ---------------------------------------------------------------------------- // splitter drawing // ---------------------------------------------------------------------------- diff --git a/Externals/wxWidgets3/src/msw/richmsgdlg.cpp b/Externals/wxWidgets3/src/msw/richmsgdlg.cpp index 11ca12e0a2..5a97225887 100644 --- a/Externals/wxWidgets3/src/msw/richmsgdlg.cpp +++ b/Externals/wxWidgets3/src/msw/richmsgdlg.cpp @@ -73,6 +73,16 @@ int wxRichMessageDialog::ShowModal() } m_checkBoxValue = checkBoxChecked != FALSE; + // In case only an "OK" button was specified we actually created a + // "Cancel" button (see comment in MSWCommonTaskDialogInit). This + // results in msAns being IDCANCEL while we want IDOK (just like + // how the native MessageBox function does with only an "OK" button). + if ( (msAns == IDCANCEL) + && !(GetMessageDialogStyle() & (wxYES_NO|wxCANCEL)) ) + { + msAns = IDOK; + } + return MSWTranslateReturnCode( msAns ); } #endif // wxHAS_MSW_TASKDIALOG diff --git a/Externals/wxWidgets3/src/msw/rt/notifmsgrt.cpp b/Externals/wxWidgets3/src/msw/rt/notifmsgrt.cpp new file mode 100644 index 0000000000..66ef1ec622 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/rt/notifmsgrt.cpp @@ -0,0 +1,545 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/notifmsgrt.cpp +// Purpose: WinRT implementation of wxNotificationMessageImpl +// Author: Tobias Taschner +// Created: 2015-09-13 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" +#endif // WX_PRECOMP + +#include "wx/msw/rt/private/notifmsg.h" + +#if wxUSE_NOTIFICATION_MESSAGE && wxUSE_WINRT +#include "wx/notifmsg.h" +#include "wx/msw/rt/utils.h" +#include "wx/msw/private/comptr.h" +#include "wx/msw/wrapshl.h" +#include "wx/msw/ole/oleutils.h" + +#include "wx/filename.h" +#include "wx/stdpaths.h" + +#include +#include +#include +#include +#include + +using namespace ABI::Windows::UI::Notifications; +using namespace ABI::Windows::Data::Xml::Dom; + +namespace rt = wxWinRT; + +typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastActivatedEventHandler; +typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastDismissedEventHandler; +typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastFailedEventHandler; + +class wxToastNotifMsgImpl; + +class wxToastEventHandler : + public Microsoft::WRL::Implements +{ +public: + wxToastEventHandler(wxToastNotifMsgImpl* toastImpl) : + m_impl(toastImpl) + { + + } + + void Detach() + { + m_impl = NULL; + } + + // DesktopToastActivatedEventHandler + IFACEMETHODIMP Invoke(IToastNotification *sender, IInspectable* args); + + // DesktopToastDismissedEventHandler + IFACEMETHODIMP Invoke(IToastNotification *sender, IToastDismissedEventArgs *e); + + // DesktopToastFailedEventHandler + IFACEMETHODIMP Invoke(IToastNotification *sender, IToastFailedEventArgs *e); + + // IUnknown + IFACEMETHODIMP_(ULONG) AddRef() + { + return ++m_cRef; + } + + IFACEMETHODIMP_(ULONG) Release() + { + if ( --m_cRef == wxAutoULong(0) ) + { + delete this; + return 0; + } + else + return m_cRef; + } + + IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv) + { + if ( IsEqualIID(riid, IID_IUnknown) ) + *ppv = static_cast(static_cast(this)); + else if ( IsEqualIID(riid, __uuidof(DesktopToastActivatedEventHandler)) ) + *ppv = static_cast(this); + else if ( IsEqualIID(riid, __uuidof(DesktopToastDismissedEventHandler)) ) + *ppv = static_cast(this); + else if ( IsEqualIID(riid, __uuidof(DesktopToastFailedEventHandler)) ) + *ppv = static_cast(this); + else + *ppv = NULL; + + if ( *ppv ) + { + reinterpret_cast(*ppv)->AddRef(); + return S_OK; + } + + return E_NOINTERFACE; + } + +private: + wxAutoULong m_cRef; + + wxToastNotifMsgImpl* m_impl; +}; + +class wxToastNotifMsgImpl : public wxNotificationMessageImpl +{ +public: + wxToastNotifMsgImpl(wxNotificationMessageBase* notification) : + wxNotificationMessageImpl(notification), + m_toastEventHandler(NULL) + { + + } + + virtual ~wxToastNotifMsgImpl() + { + if ( m_toastEventHandler ) + m_toastEventHandler->Detach(); + } + + virtual bool Show(int WXUNUSED(timeout)) wxOVERRIDE + { + wxCOMPtr toastXml; + HRESULT hr = CreateToastXML(&toastXml); + if ( SUCCEEDED(hr) ) + { + hr = CreateToast(toastXml); + } + + return SUCCEEDED(hr); + } + + virtual bool Close() wxOVERRIDE + { + if ( m_notifier.get() && m_toast.get() ) + { + bool success = SUCCEEDED(m_notifier->Hide(m_toast)); + ReleaseToast(); + return success; + } + else + return false; + } + + virtual void SetTitle(const wxString& title) wxOVERRIDE + { + m_title = title; + } + + virtual void SetMessage(const wxString& message) wxOVERRIDE + { + m_message = message; + } + + virtual void SetParent(wxWindow *WXUNUSED(parent)) wxOVERRIDE + { + + } + + virtual void SetFlags(int WXUNUSED(flags)) wxOVERRIDE + { + + } + + virtual void SetIcon(const wxIcon& WXUNUSED(icon)) wxOVERRIDE + { + // Icon would have to be saved to disk (temporarily?) + // to be used as a file:// url in the notifications XML + } + + virtual bool AddAction(wxWindowID WXUNUSED(actionid), const wxString &WXUNUSED(label)) wxOVERRIDE + { + return false; + } + + void ReleaseToast() + { + if ( m_toastEventHandler ) + m_toastEventHandler->Detach(); + m_notifier = NULL; + m_toast = NULL; + } + + HRESULT CreateToast(IXmlDocument *xml) + { + HRESULT hr = ms_toastMgr->CreateToastNotifierWithId(rt::TempStringRef::Make(ms_appId), &m_notifier); + if ( SUCCEEDED(hr) ) + { + wxCOMPtr factory; + hr = rt::GetActivationFactory(RuntimeClass_Windows_UI_Notifications_ToastNotification, + IID_IToastNotificationFactory, reinterpret_cast(&factory)); + if ( SUCCEEDED(hr) ) + { + hr = factory->CreateToastNotification(xml, &m_toast); + if ( SUCCEEDED(hr) ) + { + // Register the event handlers + EventRegistrationToken activatedToken, dismissedToken, failedToken; + m_toastEventHandler = new wxToastEventHandler(this); + wxCOMPtr eventHandler(m_toastEventHandler); + + hr = m_toast->add_Activated(eventHandler, &activatedToken); + if ( SUCCEEDED(hr) ) + { + hr = m_toast->add_Dismissed(eventHandler, &dismissedToken); + if ( SUCCEEDED(hr) ) + { + hr = m_toast->add_Failed(eventHandler, &failedToken); + if ( SUCCEEDED(hr) ) + { + hr = m_notifier->Show(m_toast); + } + } + } + } + } + } + + if ( FAILED(hr) ) + ReleaseToast(); + + return hr; + } + + HRESULT CreateToastXML(IXmlDocument** toastXml) const + { + HRESULT hr = ms_toastMgr->GetTemplateContent(ToastTemplateType_ToastText02, toastXml); + if ( SUCCEEDED(hr) ) + { + wxCOMPtr nodeList; + hr = (*toastXml)->GetElementsByTagName(rt::TempStringRef::Make("text"), &nodeList); + if ( SUCCEEDED(hr) ) + { + hr = SetNodeListValueString(0, m_title, nodeList, *toastXml); + if ( SUCCEEDED(hr) ) + hr = SetNodeListValueString(1, m_message, nodeList, *toastXml); + } + } + + return hr; + } + + static HRESULT SetNodeListValueString(UINT32 index, const wxString& str, IXmlNodeList* nodeList, IXmlDocument *toastXml) + { + wxCOMPtr textNode; + // Set title node + HRESULT hr = nodeList->Item(index, &textNode); + if ( SUCCEEDED(hr) ) + { + hr = SetNodeValueString(str, textNode, toastXml); + } + + return hr; + } + + static HRESULT SetNodeValueString(const wxString& str, IXmlNode *node, IXmlDocument *xml) + { + wxCOMPtr inputText; + + HRESULT hr = xml->CreateTextNode(rt::TempStringRef::Make(str), &inputText); + if ( SUCCEEDED(hr) ) + { + wxCOMPtr inputTextNode; + + hr = inputText->QueryInterface(IID_IXmlNode, reinterpret_cast(&inputTextNode)); + if ( SUCCEEDED(hr) ) + { + wxCOMPtr pAppendedChild; + hr = node->AppendChild(inputTextNode, &pAppendedChild); + } + } + + return hr; + } + + static bool IsEnabled() + { + return ms_enabled; + } + + static wxString BuildAppId() + { + // Build a Application User Model IDs based on app info + wxString vendorId = wxTheApp->GetVendorName(); + if ( vendorId.empty() ) + vendorId = "wxWidgetsApp"; + wxString appId = vendorId + "." + wxTheApp->GetAppName(); + // Remove potential spaces + appId.Replace(" ", "", true); + return appId; + } + + static bool CheckShortcut(const wxFileName& filename) + { + // Prepare interfaces + wxCOMPtr shellLink; + if ( FAILED(CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + IID_IShellLinkW, reinterpret_cast(&shellLink))) ) + return false; + wxCOMPtr persistFile; + if ( FAILED(shellLink->QueryInterface(IID_IPersistFile, reinterpret_cast(&persistFile))) ) + return false; + wxCOMPtr propertyStore; + if ( FAILED(shellLink->QueryInterface(IID_IPropertyStore, reinterpret_cast(&propertyStore))) ) + return false; + + bool writeShortcut = false; + + if ( filename.Exists() ) + { + // Check existing shortcut for application id + if ( SUCCEEDED(persistFile->Load(filename.GetFullPath().wc_str(), 0)) ) + { + PROPVARIANT appIdPropVar; + if ( SUCCEEDED(propertyStore->GetValue(PKEY_AppUserModel_ID, &appIdPropVar)) ) + { + wxString appId; + if ( appIdPropVar.vt == VT_LPWSTR ) + appId = appIdPropVar.pwszVal; + if ( appId.empty() || (!ms_appId.empty() && ms_appId != appId) ) + { + // Update shortcut if app id does not match or is empty + writeShortcut = true; + } + else if ( ms_appId.empty() ) + { + // Use if no app id has been set + ms_appId = appId; + } + } + } + else + return false; + } + else + { + // Create new shortcut + if ( FAILED(shellLink->SetPath(wxStandardPaths::Get().GetExecutablePath().t_str())) ) + return false; + if ( FAILED(shellLink->SetArguments(wxT(""))) ) + return false; + + writeShortcut = true; + } + + if ( writeShortcut ) + { + if ( ms_appId.empty() ) + ms_appId = BuildAppId(); + + // Set application id in shortcut + PROPVARIANT appIdPropVar; + if ( FAILED(InitPropVariantFromString(ms_appId.wc_str(), &appIdPropVar)) ) + return false; + if ( FAILED(propertyStore->SetValue(PKEY_AppUserModel_ID, appIdPropVar)) ) + return false; + if ( FAILED(propertyStore->Commit()) ) + return false; + if ( FAILED(persistFile->Save(filename.GetFullPath().wc_str(), TRUE)) ) + return false; + } + + return true; + } + + static bool UseToasts( + const wxString& shortcutPath, + const wxString& appId) + { + ms_enabled = false; + + // WinRT runtime is required (available since Win8) + if ( !rt::IsAvailable() ) + return false; + + // Toast notification manager has to be available + if ( ms_toastStaticsInitialized == -1 ) + { + if ( SUCCEEDED(rt::GetActivationFactory(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager, + IID_IToastNotificationManagerStatics, reinterpret_cast(&ms_toastMgr))) ) + { + ms_toastStaticsInitialized = 1; + } + else + ms_toastStaticsInitialized = 0; + } + + if ( ms_toastStaticsInitialized != 1 ) + return false; + + // Build/complete shortcut path + wxFileName shortcutFilename(shortcutPath); + if ( !shortcutFilename.HasName() ) + shortcutFilename.SetName(wxTheApp->GetAppDisplayName()); + if ( !shortcutFilename.HasExt() ) + shortcutFilename.SetExt("lnk"); + if ( shortcutFilename.IsRelative() ) + shortcutFilename.MakeAbsolute(wxStandardPaths::MSWGetShellDir(CSIDL_STARTMENU)); + + ms_appId = appId; + + if ( CheckShortcut(shortcutFilename) ) + ms_enabled = true; + + return ms_enabled; + } + + static void Uninitalize() + { + if (ms_toastStaticsInitialized == 1) + { + ms_toastMgr = NULL; + ms_toastStaticsInitialized = -1; + } + } + +private: + wxString m_title; + wxString m_message; + wxCOMPtr m_notifier; + wxCOMPtr m_toast; + wxToastEventHandler* m_toastEventHandler; + + static bool ms_enabled; + static wxString ms_appId; + static int ms_toastStaticsInitialized; + static wxCOMPtr ms_toastMgr; + + friend class wxToastEventHandler; +}; + +bool wxToastNotifMsgImpl::ms_enabled = false; +int wxToastNotifMsgImpl::ms_toastStaticsInitialized = -1; +wxString wxToastNotifMsgImpl::ms_appId; +wxCOMPtr wxToastNotifMsgImpl::ms_toastMgr; + +HRESULT wxToastEventHandler::Invoke( + IToastNotification *WXUNUSED(sender), + IInspectable *WXUNUSED(args)) +{ + if ( m_impl ) + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_CLICK); + m_impl->ProcessNotificationEvent(evt); + } + + return S_OK; +} + +HRESULT wxToastEventHandler::Invoke( + IToastNotification *WXUNUSED(sender), + IToastDismissedEventArgs *WXUNUSED(e)) +{ + if ( m_impl ) + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + m_impl->ProcessNotificationEvent(evt); + } + + return S_OK; +} + +HRESULT wxToastEventHandler::Invoke(IToastNotification *WXUNUSED(sender), + IToastFailedEventArgs *WXUNUSED(e)) +{ + //TODO: Handle toast failed event + return S_OK; +} + +// +// wxToastNotifMsgModule +// + +class wxToastNotifMsgModule : public wxModule +{ +public: + wxToastNotifMsgModule() + { + } + + virtual bool OnInit() wxOVERRIDE + { + return true; + } + + virtual void OnExit() wxOVERRIDE + { + wxToastNotifMsgImpl::Uninitalize(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxToastNotifMsgModule); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(wxToastNotifMsgModule, wxModule); + +#endif // wxUSE_NOTIFICATION_MESSAGE && wxUSE_WINRT + +// +// wxToastNotificationHelper +// + +bool wxToastNotificationHelper::UseToasts(const wxString& shortcutPath, + const wxString& appId) +{ +#if wxUSE_NOTIFICATION_MESSAGE && wxUSE_WINRT + return wxToastNotifMsgImpl::UseToasts(shortcutPath, appId); +#else + wxUnusedVar(shortcutPath); + wxUnusedVar(appId); + return false; +#endif +} + +bool wxToastNotificationHelper::IsEnabled() +{ +#if wxUSE_NOTIFICATION_MESSAGE && wxUSE_WINRT + return wxToastNotifMsgImpl::IsEnabled(); +#else + return false; +#endif +} + +wxNotificationMessageImpl* wxToastNotificationHelper::CreateInstance(wxNotificationMessageBase* notification) +{ +#if wxUSE_NOTIFICATION_MESSAGE && wxUSE_WINRT + return new wxToastNotifMsgImpl(notification); +#else + wxUnusedVar(notification); + return NULL; +#endif +} diff --git a/Externals/wxWidgets3/src/msw/rt/utilsrt.cpp b/Externals/wxWidgets3/src/msw/rt/utilsrt.cpp new file mode 100644 index 0000000000..ecc12be979 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/rt/utilsrt.cpp @@ -0,0 +1,259 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/msw/rt/utilsrt.cpp +// Purpose: Windows Runtime Objects helper functions and objects +// Author: Tobias Taschner +// Created: 2015-09-05 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// Declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) +#pragma hdrstop +#endif + +#include "wx/msw/rt/utils.h" + +#if wxUSE_WINRT + +#include + +#include "wx/dynlib.h" +#include "wx/utils.h" +#include "wx/module.h" + +// Core function typedefs +typedef HRESULT (__stdcall *PFNWXROINITIALIZE)(RO_INIT_TYPE initType); +typedef void (__stdcall *PFNWXROUNINITIALIZE)(); +typedef HRESULT (__stdcall *PFNWXROGETACTIVATIONFACTORY)( + HSTRING activatableClassId, REFIID iid, void ** factory); + +// String function typedefs +typedef HRESULT (__stdcall *PFNWXWINDOWSCREATESTRINGREFERENCE)( + PCWSTR sourceString, + UINT32 length, + HSTRING_HEADER * hstringHeader, + HSTRING * string +); +typedef HRESULT (__stdcall *PFNWXWINDOWSDELETESTRING)(HSTRING string); + +namespace wxWinRT +{ + +// +// RTCore +// + +class RTCore +{ +public: + static RTCore& Get() + { + if ( ms_isAvailable == -1 ) + { + if ( !ms_rtcore.Initialize() ) + { + ms_isAvailable = 0; + } + else + ms_isAvailable = 1; + } + + return ms_rtcore; + } + + static bool IsAvailable() + { + if (ms_isAvailable == -1) + Get(); + + return (ms_isAvailable == 1); + } + + PFNWXROINITIALIZE RoInitialize; + PFNWXROUNINITIALIZE RoUninitialize; + PFNWXROGETACTIVATIONFACTORY RoGetActivationFactory; + PFNWXWINDOWSCREATESTRINGREFERENCE WindowsCreateStringReference; + PFNWXWINDOWSDELETESTRING WindowsDeleteString; + + bool Initialize() + { +#define RESOLVE_RT_FUNCTION(dll, type, funcname) \ + funcname = (type)dll.GetSymbol(wxT(#funcname)); \ + if ( !funcname ) \ + return false + +#define RESOLVE_RTCORE_FUNCTION(type, funcname) \ + RESOLVE_RT_FUNCTION(m_dllCore, type, funcname) + +#define RESOLVE_RTSTRING_FUNCTION(type, funcname) \ + RESOLVE_RT_FUNCTION(m_dllString, type, funcname) + + // WinRT is only available in Windows 8 or newer + if (!wxCheckOsVersion(6, 2)) + return false; + + // Initialize core functions + if (!m_dllCore.Load("api-ms-win-core-winrt-l1-1-0.dll")) + return false; + + RESOLVE_RTCORE_FUNCTION(PFNWXROINITIALIZE, RoInitialize); + RESOLVE_RTCORE_FUNCTION(PFNWXROUNINITIALIZE, RoUninitialize); + RESOLVE_RTCORE_FUNCTION(PFNWXROGETACTIVATIONFACTORY, RoGetActivationFactory); + + // Initialize string functions + if (!m_dllString.Load("api-ms-win-core-winrt-string-l1-1-0.dll")) + return false; + + RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSCREATESTRINGREFERENCE, WindowsCreateStringReference); + RESOLVE_RTSTRING_FUNCTION(PFNWXWINDOWSDELETESTRING, WindowsDeleteString); + + return true; + +#undef RESOLVE_RT_FUNCTION +#undef RESOLVE_RTCORE_FUNCTION +#undef RESOLVE_RTSTRING_FUNCTION + } + + void UnloadModules() + { + m_dllCore.Unload(); + m_dllString.Unload(); + } + + static void Uninitalize() + { + if (ms_isAvailable == 1) + { + Get().UnloadModules(); + ms_isAvailable = -1; + } + } + +private: + RTCore() + { + + } + + wxDynamicLibrary m_dllCore; + wxDynamicLibrary m_dllString; + + static RTCore ms_rtcore; + static int ms_isAvailable; + + wxDECLARE_NO_COPY_CLASS(RTCore); +}; + +RTCore RTCore::ms_rtcore; +int RTCore::ms_isAvailable = -1; + +// +// wxWinRT::TempStringRef +// + +const TempStringRef TempStringRef::Make(const wxString &str) +{ + return TempStringRef(str); +} + +TempStringRef::TempStringRef(const wxString &str) +{ + if ( !RTCore::IsAvailable() ) + wxLogDebug("Can not create string reference without WinRT"); + + // This creates a fast-pass string which must not be deleted using WindowsDeleteString + HRESULT hr = RTCore::Get().WindowsCreateStringReference( + str.wc_str(), str.length(), + &m_header, &m_hstring); + if ( FAILED(hr) ) + wxLogDebug("Could not create string reference %.8x", hr); +} + +// +// wrapper functions +// + +bool IsAvailable() +{ + return RTCore::IsAvailable(); +} + +bool Initialize() +{ + if ( !RTCore::IsAvailable() ) + return false; + + HRESULT hr = RTCore::Get().RoInitialize(RO_INIT_SINGLETHREADED); + if ( FAILED(hr) ) + { + wxLogDebug("RoInitialize failed %.8x", hr); + return false; + } + else + return true; +} + +void Uninitialize() +{ + if ( !RTCore::IsAvailable() ) + return; + + RTCore::Get().RoUninitialize(); +} + +bool GetActivationFactory(const wxString& activatableClassId, REFIID iid, void ** factory) +{ + if ( !RTCore::IsAvailable() ) + return false; + + HRESULT hr = RTCore::Get().RoGetActivationFactory(TempStringRef::Make(activatableClassId), iid, factory); + if ( FAILED(hr) ) + { + wxLogDebug("RoGetActivationFactory failed %.8x", hr); + return false; + } + else + return true; +} + +// ---------------------------------------------------------------------------- +// Module ensuring all global/singleton objects are destroyed on shutdown. +// ---------------------------------------------------------------------------- + +class RTModule : public wxModule +{ +public: + RTModule() + { + } + + virtual bool OnInit() wxOVERRIDE + { + return true; + } + + virtual void OnExit() wxOVERRIDE + { + RTCore::Uninitalize(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(RTModule); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(RTModule, wxModule); + +} // namespace wxWinRT + +#endif // wxUSE_WINRT diff --git a/Externals/wxWidgets3/src/msw/settings.cpp b/Externals/wxWidgets3/src/msw/settings.cpp index e7bdac2156..996c43e631 100644 --- a/Externals/wxWidgets3/src/msw/settings.cpp +++ b/Externals/wxWidgets3/src/msw/settings.cpp @@ -55,7 +55,7 @@ public: virtual void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule) + wxDECLARE_DYNAMIC_CLASS(wxSystemSettingsModule); }; // ---------------------------------------------------------------------------- @@ -81,7 +81,7 @@ static wxFont *gs_fontDefault = NULL; // wxSystemSettingsModule // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule); bool wxSystemSettingsModule::OnInit() { @@ -103,30 +103,6 @@ void wxSystemSettingsModule::OnExit() wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) { - // we use 0 as the default value just to avoid compiler warnings, as there - // is no invalid colour value we use hasCol as the real indicator of - // whether colSys was initialized or not - COLORREF colSys = 0; - bool hasCol = false; - - // the default colours for the entries after BTNHIGHLIGHT - static const COLORREF s_defaultSysColors[] = - { - 0x000000, // 3DDKSHADOW - 0xdfdfdf, // 3DLIGHT - 0x000000, // INFOTEXT - 0xe1ffff, // INFOBK - - 0, // filler - no std colour with this index - - // TODO: please fill in the standard values of those, I don't have them - 0, // HOTLIGHT - 0, // GRADIENTACTIVECAPTION - 0, // GRADIENTINACTIVECAPTION - 0, // MENU - 0, // MENUBAR (unused) - }; - if ( index == wxSYS_COLOUR_LISTBOXTEXT) { // there is no standard colour with this index, map to another one @@ -144,74 +120,19 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) } else if ( index > wxSYS_COLOUR_BTNHIGHLIGHT ) { - // the indices before BTNHIGHLIGHT are understood by GetSysColor() in - // all Windows version, for the other ones we have to check - bool useDefault; - - int verMaj, verMin; - wxGetOsVersion(&verMaj, &verMin); - if ( verMaj < 4 ) + // Determine if we are using flat menus, only then allow wxSYS_COLOUR_MENUBAR + if ( index == wxSYS_COLOUR_MENUBAR ) { - // NT 3.5 - useDefault = true; - } - else if ( verMaj == 4 ) - { - // Win95/NT 4.0 - useDefault = index > wxSYS_COLOUR_INFOBK; - } - else if ( verMaj == 5 && verMin == 0 ) - { - // Win98/Win2K - useDefault = index > wxSYS_COLOUR_GRADIENTINACTIVECAPTION; - } - else // >= 5.1 - { - // 5.1 is Windows XP - useDefault = false; - // Determine if we are using flat menus, only then allow wxSYS_COLOUR_MENUBAR - if ( index == wxSYS_COLOUR_MENUBAR ) + BOOL isFlat ; + if ( SystemParametersInfo( SPI_GETFLATMENU , 0 ,&isFlat, 0 ) ) { - BOOL isFlat ; - if ( SystemParametersInfo( SPI_GETFLATMENU , 0 ,&isFlat, 0 ) ) - { - if ( !isFlat ) - index = wxSYS_COLOUR_MENU ; - } - } - } - - if ( useDefault ) - { - // special handling for MENUBAR colour: we use this in wxToolBar - // and wxStatusBar to have correct bg colour under Windows XP - // (which uses COLOR_MENUBAR for them) but they should still look - // correctly under previous Windows versions as well - if ( index == wxSYS_COLOUR_MENUBAR ) - { - index = wxSYS_COLOUR_3DFACE; - } - else // replace with default colour - { - unsigned int n = index - wxSYS_COLOUR_BTNHIGHLIGHT; - - wxASSERT_MSG( n < WXSIZEOF(s_defaultSysColors), - wxT("forgot tp update the default colours array") ); - - colSys = s_defaultSysColors[n]; - hasCol = true; + if ( !isFlat ) + index = wxSYS_COLOUR_MENU ; } } } - if ( !hasCol ) - { -#ifdef __WXWINCE__ - colSys = ::GetSysColor(index|SYS_COLOR_INDEX_FLAG); -#else - colSys = ::GetSysColor(index); -#endif - } + COLORREF colSys = ::GetSysColor(index); wxColour ret = wxRGBToColour(colSys); wxASSERT(ret.IsOk()); @@ -234,14 +155,7 @@ wxFont wxCreateFontFromStockObject(int index) { wxNativeFontInfo info; info.lf = lf; - // Under MicroWindows we pass the HFONT as well - // because it's hard to convert HFONT -> LOGFONT -> HFONT - // It's OK to delete stock objects, the delete will be ignored. -#ifdef __WXMICROWIN__ - font.Create(info, (WXHFONT) hFont); -#else font.Create(info); -#endif } else { @@ -258,19 +172,6 @@ wxFont wxCreateFontFromStockObject(int index) wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) { -#ifdef __WXWINCE__ - // under CE only a single SYSTEM_FONT exists - index; - - if ( !gs_fontDefault ) - { - gs_fontDefault = new wxFont(wxCreateFontFromStockObject(SYSTEM_FONT)); - } - - wxASSERT(gs_fontDefault->IsOk() && - wxFontEnumerator::IsValidFacename(gs_fontDefault->GetFaceName())); - return *gs_fontDefault; -#else // !__WXWINCE__ // wxWindow ctor calls GetFont(wxSYS_DEFAULT_GUI_FONT) so we're // called fairly often -- this is why we cache this particular font if ( index == wxSYS_DEFAULT_GUI_FONT ) @@ -302,7 +203,6 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) #endif // wxUSE_FONTENUM return font; -#endif // __WXWINCE__/!__WXWINCE__ } // ---------------------------------------------------------------------------- @@ -319,11 +219,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) static const int gs_metricsMap[] = { -1, // wxSystemMetric enums start at 1, so give a dummy value for pos 0. -#if defined(__WIN32__) && !defined(__WXWINCE__) SM_CMOUSEBUTTONS, -#else - -1, -#endif SM_CXBORDER, SM_CYBORDER, @@ -335,7 +231,7 @@ static const int gs_metricsMap[] = #endif SM_CXDOUBLECLK, SM_CYDOUBLECLK, -#if defined(__WIN32__) && defined(SM_CXDRAG) +#if defined(SM_CXDRAG) SM_CXDRAG, SM_CYDRAG, SM_CXEDGE, @@ -363,7 +259,7 @@ static const int gs_metricsMap[] = SM_CXSCREEN, SM_CYSCREEN, -#if defined(__WIN32__) && defined(SM_CXSIZEFRAME) +#if defined(SM_CXSIZEFRAME) SM_CXSIZEFRAME, SM_CYSIZEFRAME, SM_CXSMICON, @@ -382,7 +278,7 @@ static const int gs_metricsMap[] = #endif SM_CYCAPTION, SM_CYMENU, -#if defined(__WIN32__) && defined(SM_NETWORK) +#if defined(SM_NETWORK) SM_NETWORK, #else -1, @@ -392,7 +288,7 @@ static const int gs_metricsMap[] = #else -1, #endif -#if defined(__WIN32__) && defined(SM_SHOWSOUNDS) +#if defined(SM_SHOWSOUNDS) SM_SHOWSOUNDS, #else -1, @@ -410,10 +306,6 @@ static const int gs_metricsMap[] = // Get a system metric, e.g. scrollbar size int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win)) { -#ifdef __WXMICROWIN__ - // TODO: probably use wxUniv themes functionality - return 0; -#else // !__WXMICROWIN__ wxCHECK_MSG( index > 0 && (size_t)index < WXSIZEOF(gs_metricsMap), 0, wxT("invalid metric") ); @@ -438,7 +330,6 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w } return rc; -#endif // __WXMICROWIN__/!__WXMICROWIN__ } bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) @@ -467,48 +358,24 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) extern wxFont wxGetCCDefaultFont() { -#ifndef __WXWINCE__ - // under the systems enumerated below (anything released after Win98), the - // default font used for the common controls seems to be the desktop font - // which is also used for the icon titles and not the stock default GUI - // font - bool useIconFont; - int verMaj, verMin; - switch ( wxGetOsVersion(&verMaj, &verMin) ) + // the default font used for the common controls seems to be the desktop + // font which is also used for the icon titles and not the stock default + // GUI font + LOGFONT lf; + if ( ::SystemParametersInfo + ( + SPI_GETICONTITLELOGFONT, + sizeof(lf), + &lf, + 0 + ) ) { - case wxOS_WINDOWS_9X: - // 4.10 is Win98 - useIconFont = verMaj == 4 && verMin >= 10; - break; - - case wxOS_WINDOWS_NT: - // 5.0 is Win2k - useIconFont = verMaj >= 5; - break; - - default: - useIconFont = false; + return wxFont(wxCreateFontFromLogFont(&lf)); } - - if ( useIconFont ) + else { - LOGFONT lf; - if ( ::SystemParametersInfo - ( - SPI_GETICONTITLELOGFONT, - sizeof(lf), - &lf, - 0 - ) ) - { - return wxFont(wxCreateFontFromLogFont(&lf)); - } - else - { - wxLogLastError(wxT("SystemParametersInfo(SPI_GETICONTITLELOGFONT")); - } + wxLogLastError(wxT("SystemParametersInfo(SPI_GETICONTITLELOGFONT")); } -#endif // __WXWINCE__ // fall back to the default font for the normal controls return wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); diff --git a/Externals/wxWidgets3/src/msw/slider.cpp b/Externals/wxWidgets3/src/msw/slider.cpp index 992497c498..d53a6ddcd5 100644 --- a/Externals/wxWidgets3/src/msw/slider.cpp +++ b/Externals/wxWidgets3/src/msw/slider.cpp @@ -74,6 +74,8 @@ void wxSlider::Init() { m_labels = NULL; + m_hBrushBg = NULL; + m_pageSize = 1; m_lineSize = 1; m_rangeMax = 0; @@ -429,6 +431,8 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height) labelOffset = longestLabelWidth + HGAP; } + int labelHeightUsed = 0 ; + if ( HasFlag(wxSL_MIN_MAX_LABELS) ) { if ( HasFlag(wxSL_INVERSE) ) @@ -444,6 +448,8 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height) holdBottomX, y + height - labelHeight, maxLabelWidth, labelHeight); + + labelHeightUsed = labelHeight ; } if ( HasFlag(wxSL_VALUE_LABEL) ) @@ -457,9 +463,9 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height) // position the slider itself along the left/right edge wxSliderBase::DoMoveWindow( x + labelOffset, - y + labelHeight, + y + labelHeightUsed, THUMB + tickOffset + HGAP, - height - (labelHeight * 2)); + height - (labelHeightUsed * 2)); } else // horizontal { @@ -471,6 +477,8 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height) (longestLabelWidth / 2); int ySlider = y; + int minLabelWidthUsed = 0 ; + int maxLabelWidthUsed = 0 ; if ( HasFlag(wxSL_VALUE_LABEL) ) { @@ -496,13 +504,16 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height) x + width - maxLabelWidth, yLabelMinMax, maxLabelWidth, labelHeight); + + minLabelWidthUsed = minLabelWidth + VGAP ; + maxLabelWidthUsed = maxLabelWidth + VGAP ; } // position the slider itself along the top/bottom edge wxSliderBase::DoMoveWindow( - x + minLabelWidth + VGAP, + x + minLabelWidthUsed, ySlider, - width - (minLabelWidth + maxLabelWidth + (VGAP*2)), + width - (minLabelWidthUsed + maxLabelWidthUsed), THUMB + tickOffset); } } @@ -544,10 +555,8 @@ wxSize wxSlider::DoGetBestSize() const { int labelSize = GetLabelsSize(); - // Min/max labels are compensated by the ticks so we don't need - // extra space for them if we're also showing ticks. - if ( HasFlag(wxSL_MIN_MAX_LABELS) && !HasFlag(wxSL_TICKS) ) - size.y += labelSize; + // Min/max labels are compensated by the thumb so we don't need + // extra space for them // The value label is always on top of the control and so does need // extra space in any case. @@ -567,6 +576,25 @@ wxSize wxSlider::DoGetBestSize() const return size; } +WXHBRUSH wxSlider::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) +{ + const WXHBRUSH hBrush = wxSliderBase::DoMSWControlColor(pDC, colBg, hWnd); + + // The native control doesn't repaint itself when it's invalidated, so we + // do it explicitly from here, as this is the only way to propagate the + // parent background colour to the slider when it changes. + if ( hWnd == GetHwnd() && hBrush != m_hBrushBg ) + { + m_hBrushBg = hBrush; + + // Anything really refreshing the slider would work here, we use a + // dummy WM_ENABLE but using TBM_SETPOS would work too, for example. + ::PostMessage(hWnd, WM_ENABLE, ::IsWindowEnabled(hWnd), 0); + } + + return hBrush; +} + // ---------------------------------------------------------------------------- // slider-specific methods // ---------------------------------------------------------------------------- @@ -601,6 +629,14 @@ void wxSlider::SetRange(int minValue, int maxValue) if ( m_labels ) { + Move(wxDefaultPosition); // Force a re-layout the labels. + + // Update the label with the value adjusted by the control as + // old value can be out of the new range. + if ( HasFlag(wxSL_VALUE_LABEL) ) + { + SetValue(GetValue()); + } ::SetWindowText((*m_labels)[SliderLabel_Min], Format(ValueInvertOrNot(m_rangeMin)).t_str()); ::SetWindowText((*m_labels)[SliderLabel_Max], diff --git a/Externals/wxWidgets3/src/msw/snglinst.cpp b/Externals/wxWidgets3/src/msw/snglinst.cpp index 9dd07ebeab..1d09799b89 100644 --- a/Externals/wxWidgets3/src/msw/snglinst.cpp +++ b/Externals/wxWidgets3/src/msw/snglinst.cpp @@ -24,7 +24,7 @@ #pragma hdrstop #endif -#if wxUSE_SNGLINST_CHECKER && defined(__WIN32__) +#if wxUSE_SNGLINST_CHECKER #ifndef WX_PRECOMP #include "wx/string.h" diff --git a/Externals/wxWidgets3/src/msw/sockmsw.cpp b/Externals/wxWidgets3/src/msw/sockmsw.cpp index 58557e4e6c..699b6664e0 100644 --- a/Externals/wxWidgets3/src/msw/sockmsw.cpp +++ b/Externals/wxWidgets3/src/msw/sockmsw.cpp @@ -35,25 +35,6 @@ #include "wx/dynlib.h" #include "wx/link.h" -#ifdef __WXWINCE__ -/* - * As WSAAsyncSelect is not present on WinCE, it now uses WSACreateEvent, - * WSAEventSelect, WSAWaitForMultipleEvents and WSAEnumNetworkEvents. When - * enabling eventhandling for a socket a new thread it created that keeps track - * of the events and posts a messageto the hidden window to use the standard - * message loop. - */ -#include "wx/msw/wince/net.h" -#include "wx/hashmap.h" -WX_DECLARE_HASH_MAP(int,bool,wxIntegerHash,wxIntegerEqual,SocketHash); - -#ifndef isdigit -#define isdigit(x) (x > 47 && x < 58) -#endif -#include "wx/msw/wince/net.h" - -#endif // __WXWINCE__ - #ifdef _MSC_VER # pragma warning(default:4115) /* named type definition in parentheses */ #endif @@ -72,20 +53,7 @@ WX_DECLARE_HASH_MAP(int,bool,wxIntegerHash,wxIntegerEqual,SocketHash); #error "MAXSOCKETS is too big!" #endif -#ifndef __WXWINCE__ typedef int (PASCAL *WSAAsyncSelect_t)(SOCKET,HWND,u_int,long); -#else -/* Typedef the needed function prototypes and the WSANETWORKEVENTS structure -*/ -typedef struct _WSANETWORKEVENTS { - long lNetworkEvents; - int iErrorCode[10]; -} WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS; -typedef HANDLE (PASCAL *WSACreateEvent_t)(); -typedef int (PASCAL *WSAEventSelect_t)(SOCKET,HANDLE,long); -typedef int (PASCAL *WSAWaitForMultipleEvents_t)(long,HANDLE,BOOL,long,BOOL); -typedef int (PASCAL *WSAEnumNetworkEvents_t)(SOCKET,HANDLE,LPWSANETWORKEVENTS); -#endif //__WXWINCE__ LRESULT CALLBACK wxSocket_Internal_WinProc(HWND, UINT, WPARAM, LPARAM); @@ -96,73 +64,7 @@ wxCRIT_SECT_DECLARE_MEMBER(gs_critical); static wxSocketImplMSW *socketList[MAXSOCKETS]; static int firstAvailable; -#ifndef __WXWINCE__ static WSAAsyncSelect_t gs_WSAAsyncSelect = NULL; -#else -static SocketHash socketHash; -static unsigned int currSocket; -HANDLE hThread[MAXSOCKETS]; -static WSACreateEvent_t gs_WSACreateEvent = NULL; -static WSAEventSelect_t gs_WSAEventSelect = NULL; -static WSAWaitForMultipleEvents_t gs_WSAWaitForMultipleEvents = NULL; -static WSAEnumNetworkEvents_t gs_WSAEnumNetworkEvents = NULL; -/* This structure will be used to pass data on to the thread that handles socket events. -*/ -typedef struct thread_data{ - HWND hEvtWin; - unsigned long msgnumber; - unsigned long fd; - unsigned long lEvent; -}thread_data; -#endif - -#ifdef __WXWINCE__ -/* This thread handles socket events on WinCE using WSAEventSelect() as - * WSAAsyncSelect is not supported. When an event occurs for the socket, it is - * checked what kind of event happened and the correct message gets posted so - * that the hidden window can handle it as it would in other MSW builds. -*/ -DWORD WINAPI SocketThread(LPVOID data) -{ - WSANETWORKEVENTS NetworkEvents; - thread_data* d = (thread_data *)data; - - HANDLE NetworkEvent = gs_WSACreateEvent(); - gs_WSAEventSelect(d->fd, NetworkEvent, d->lEvent); - - while(socketHash[d->fd] == true) - { - if ((gs_WSAWaitForMultipleEvents(1, &NetworkEvent, FALSE,INFINITE, FALSE)) == WAIT_FAILED) - { - printf("WSAWaitForMultipleEvents failed with error %d\n", WSAGetLastError()); - return 0; - } - if (gs_WSAEnumNetworkEvents(d->fd ,NetworkEvent, &NetworkEvents) == SOCKET_ERROR) - { - printf("WSAEnumNetworkEvents failed with error %d\n", WSAGetLastError()); - return 0; - } - - long flags = NetworkEvents.lNetworkEvents; - if (flags & FD_READ) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_READ); - if (flags & FD_WRITE) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_WRITE); - if (flags & FD_OOB) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_OOB); - if (flags & FD_ACCEPT) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_ACCEPT); - if (flags & FD_CONNECT) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_CONNECT); - if (flags & FD_CLOSE) - ::PostMessage(d->hEvtWin, d->msgnumber,d->fd, FD_CLOSE); - - } - gs_WSAEventSelect(d->fd, NetworkEvent, 0); - ExitThread(0); - return 0; -} -#endif // ---------------------------------------------------------------------------- // MSW implementation of wxSocketManager @@ -206,42 +108,18 @@ bool wxSocketMSWManager::OnInit() } firstAvailable = 0; - // we don't link with wsock32.dll (or ws2 in CE case) statically to avoid + // we don't link with wsock32.dll statically to avoid // dependencies on it for all the application using wx even if they don't use // sockets -#ifdef __WXWINCE__ - #define WINSOCK_DLL_NAME wxT("ws2.dll") -#else #define WINSOCK_DLL_NAME wxT("wsock32.dll") -#endif gs_wsock32dll.Load(WINSOCK_DLL_NAME, wxDL_VERBATIM | wxDL_QUIET); if ( !gs_wsock32dll.IsLoaded() ) return false; -#ifndef __WXWINCE__ wxDL_INIT_FUNC(gs_, WSAAsyncSelect, gs_wsock32dll); if ( !gs_WSAAsyncSelect ) return false; -#else - wxDL_INIT_FUNC(gs_, WSAEventSelect, gs_wsock32dll); - if ( !gs_WSAEventSelect ) - return false; - - wxDL_INIT_FUNC(gs_, WSACreateEvent, gs_wsock32dll); - if ( !gs_WSACreateEvent ) - return false; - - wxDL_INIT_FUNC(gs_, WSAWaitForMultipleEvents, gs_wsock32dll); - if ( !gs_WSAWaitForMultipleEvents ) - return false; - - wxDL_INIT_FUNC(gs_, WSAEnumNetworkEvents, gs_wsock32dll); - if ( !gs_WSAEnumNetworkEvents ) - return false; - - currSocket = 0; -#endif // !__WXWINCE__/__WXWINCE__ // finally initialize WinSock WSADATA wsaData; @@ -250,11 +128,6 @@ bool wxSocketMSWManager::OnInit() void wxSocketMSWManager::OnExit() { -#ifdef __WXWINCE__ -/* Delete the threads here */ - for(unsigned int i=0; i < currSocket; i++) - CloseHandle(hThread[i]); -#endif /* Destroy internal window */ DestroyWindow(hWin); UnregisterClass(CLASSNAME, wxGetInstance()); @@ -401,22 +274,7 @@ void wxSocketMSWManager::Install_Callback(wxSocketImpl *socket_, */ long lEvent = socket->m_server? FD_ACCEPT : (FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE); -#ifndef __WXWINCE__ gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, lEvent); -#else -/* -* WinCE creates a thread for socket event handling. -* All needed parameters get passed through the thread_data structure. -*/ - - thread_data* d = new thread_data; - d->lEvent = lEvent; - d->hEvtWin = hWin; - d->msgnumber = socket->m_msgnumber; - d->fd = socket->m_fd; - socketHash[socket->m_fd] = true; - hThread[currSocket++] = CreateThread(NULL, 0, &SocketThread,(LPVOID)d, 0, NULL); -#endif } } @@ -430,12 +288,7 @@ void wxSocketMSWManager::Uninstall_Callback(wxSocketImpl *socket_, if (socket->m_fd != INVALID_SOCKET) { -#ifndef __WXWINCE__ gs_WSAAsyncSelect(socket->m_fd, hWin, socket->m_msgnumber, 0); -#else - //Destroy the thread - socketHash[socket->m_fd] = false; -#endif } } diff --git a/Externals/wxWidgets3/src/msw/spinbutt.cpp b/Externals/wxWidgets3/src/msw/spinbutt.cpp index b5f99d3853..7ac8abfe1c 100644 --- a/Externals/wxWidgets3/src/msw/spinbutt.cpp +++ b/Externals/wxWidgets3/src/msw/spinbutt.cpp @@ -79,11 +79,11 @@ bool wxSpinButton::Create(wxWindow *parent, // get the right size for the control if ( width <= 0 || height <= 0 ) { - wxSize size = DoGetBestSize(); + wxSize bestSize = DoGetBestSize(); if ( width <= 0 ) - width = size.x; + width = bestSize.x; if ( height <= 0 ) - height = size.y; + height = bestSize.y; } if ( x < 0 ) @@ -147,7 +147,17 @@ wxSpinButton::~wxSpinButton() wxSize wxSpinButton::DoGetBestSize() const { - return GetBestSpinnerSize( (GetWindowStyle() & wxSP_VERTICAL) != 0 ); + const bool vert = HasFlag(wxSP_VERTICAL); + + wxSize bestSize(::GetSystemMetrics(vert ? SM_CXVSCROLL : SM_CXHSCROLL), + ::GetSystemMetrics(vert ? SM_CYVSCROLL : SM_CYHSCROLL)); + + if ( vert ) + bestSize.y *= 2; + else + bestSize.x *= 2; + + return bestSize; } // ---------------------------------------------------------------------------- @@ -158,17 +168,12 @@ int wxSpinButton::GetValue() const { int n; #ifdef UDM_GETPOS32 - if ( wxApp::GetComCtl32Version() >= 580 ) - { - // use the full 32 bit range if available - n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0); - } - else + // use the full 32 bit range if available + n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0); +#else + // we're limited to 16 bit + n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0)); #endif // UDM_GETPOS32 - { - // we're limited to 16 bit - n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0)); - } if (n < m_min) n = m_min; if (n > m_max) n = m_max; @@ -181,16 +186,11 @@ void wxSpinButton::SetValue(int val) // wxSpinButtonBase::SetValue(val); -- no, it is pure virtual #ifdef UDM_SETPOS32 - if ( wxApp::GetComCtl32Version() >= 580 ) - { - // use the full 32 bit range if available - ::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val); - } - else // we're limited to 16 bit + // use the full 32 bit range if available + ::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val); +#else + ::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0)); #endif // UDM_SETPOS32 - { - ::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0)); - } } void wxSpinButton::NormalizeValue() @@ -205,17 +205,13 @@ void wxSpinButton::SetRange(int minVal, int maxVal) wxSpinButtonBase::SetRange(minVal, maxVal); #ifdef UDM_SETRANGE32 - if ( wxApp::GetComCtl32Version() >= 471 ) - { - // use the full 32 bit range if available - ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal); - } - else // we're limited to 16 bit + // use the full 32 bit range if available + ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal); +#else + // we're limited to 16 bit + ::SendMessage(GetHwnd(), UDM_SETRANGE, 0, + (LPARAM) MAKELONG((short)maxVal, (short)minVal)); #endif // UDM_SETRANGE32 - { - ::SendMessage(GetHwnd(), UDM_SETRANGE, 0, - (LPARAM) MAKELONG((short)maxVal, (short)minVal)); - } // the current value might be out of the new range, force it to be in it NormalizeValue(); diff --git a/Externals/wxWidgets3/src/msw/spinctrl.cpp b/Externals/wxWidgets3/src/msw/spinctrl.cpp index 4610eef008..a59da9107f 100644 --- a/Externals/wxWidgets3/src/msw/spinctrl.cpp +++ b/Externals/wxWidgets3/src/msw/spinctrl.cpp @@ -47,11 +47,11 @@ // macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton) +wxBEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton) EVT_CHAR(wxSpinCtrl::OnChar) EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus) EVT_KILL_FOCUS(wxSpinCtrl::OnKillFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #define GetBuddyHwnd() (HWND)(m_hwndBuddy) @@ -90,10 +90,8 @@ SpinForTextCtrl gs_spinForTextCtrl; // wnd proc for the buddy text ctrl // ---------------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) +LRESULT APIENTRY +wxBuddyTextWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { wxSpinCtrl * const spin = wxSpinCtrl::GetSpinForTextCtrl(hwnd); @@ -196,12 +194,12 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event) { case WXK_RETURN: { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); - InitCommandEvent(event); + wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId); + InitCommandEvent(evt); wxString val = wxGetWindowText(m_hwndBuddy); - event.SetString(val); - event.SetInt(GetValue()); - if ( HandleWindowEvent(event) ) + evt.SetString(val); + evt.SetInt(GetValue()); + if ( HandleWindowEvent(evt) ) return; break; } @@ -286,11 +284,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, style |= wxSP_VERTICAL; if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) -#ifdef __WXWINCE__ - style |= wxBORDER_SIMPLE; -#else style |= wxBORDER_SUNKEN; -#endif SetWindowStyle(style); @@ -314,7 +308,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, if ( sizeText.x <= 0 ) { // DEFAULT_ITEM_WIDTH is the default width for the text control - sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; + sizeText.x = FromDIP(DEFAULT_ITEM_WIDTH) + MARGIN_BETWEEN + sizeBtn.x; } sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; @@ -521,6 +515,18 @@ void wxSpinCtrl::SetSelection(long from, long to) ::SendMessage(GetBuddyHwnd(), EM_SETSEL, (WPARAM)from, (LPARAM)to); } +void wxSpinCtrl::SetLayoutDirection(wxLayoutDirection dir) +{ + // Buddy text field is plain EDIT control so we need to set its layout + // direction in a specific way. + wxUpdateEditLayoutDirection(GetBuddyHwnd(), dir); + + wxSpinButton::SetLayoutDirection(dir); + + // Reposition the child windows according to the new layout. + SetSize(-1, -1, -1, -1, wxSIZE_AUTO | wxSIZE_FORCE); +} + // ---------------------------------------------------------------------------- // wxSpinButton methods // ---------------------------------------------------------------------------- @@ -530,10 +536,20 @@ void wxSpinCtrl::SetRange(int minVal, int maxVal) // Manually adjust the old value to avoid an event being sent from // NormalizeValue() called from inside the base class SetRange() as we're // not supposed to generate any events from here. - if ( m_oldValue < minVal ) - m_oldValue = minVal; - else if ( m_oldValue > maxVal ) - m_oldValue = maxVal; + if ( minVal <= maxVal ) + { + if ( m_oldValue < minVal ) + m_oldValue = minVal; + else if ( m_oldValue > maxVal ) + m_oldValue = maxVal; + } + else // reversed range + { + if ( m_oldValue > minVal ) + m_oldValue = minVal; + else if ( m_oldValue < maxVal ) + m_oldValue = maxVal; + } wxSpinButton::SetRange(minVal, maxVal); @@ -670,7 +686,7 @@ void wxSpinCtrl::DoSetToolTip(wxToolTip *tip) void wxSpinCtrl::SendSpinUpdate(int value) { - wxCommandEvent event(wxEVT_SPINCTRL, GetId()); + wxSpinEvent event(wxEVT_SPINCTRL, GetId()); event.SetEventObject(this); event.SetInt(value); @@ -759,13 +775,30 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) widthText = 0; } - // 1) The buddy window - DoMoveSibling(m_hwndBuddy, x, y, widthText, height); + // Because both subcontrols are positioned relatively + // to the parent which can have different layout direction + // then our control, we need to mirror their positions manually. + if ( GetParent()->GetLayoutDirection() == GetLayoutDirection() ) + { + // Logical positions: x(Text) < x(Button) + // 1) The buddy window + DoMoveSibling(m_hwndBuddy, x, y, widthText, height); - // 2) The button window - if ( widthText > 0 ) - x += widthText + MARGIN_BETWEEN; - wxSpinButton::DoMoveWindow(x, y, widthBtn, height); + // 2) The button window + if ( widthText > 0 ) + x += widthText + MARGIN_BETWEEN; + wxSpinButton::DoMoveWindow(x, y, widthBtn, height); + } + else + { + // Logical positions: x(Button) < x(Text) + // 1) The button window + wxSpinButton::DoMoveWindow(x, y, widthBtn, height); + + // 2) The buddy window + x += widthBtn + MARGIN_BETWEEN; + DoMoveSibling(m_hwndBuddy, x, y, widthText, height); + } } // get total size of the control @@ -797,13 +830,27 @@ void wxSpinCtrl::DoGetClientSize(int *x, int *y) const void wxSpinCtrl::DoGetPosition(int *x, int *y) const { + // Because both subcontrols are mirrored manually + // (for layout direction purposes, see note) + // and leftmost control can be either spin or buddy text + // we need to get positions for both controls + // and return this with lower horizonal value. + // Note: + // Logical positions in manual mirroring: + // our layout == parent layout => x(Text) < x(Button) + // our layout != parent layout => x(Button) < x(Text) + // hack: pretend that our HWND is the text control just for a moment + int xBuddy; WXHWND hWnd = GetHWND(); wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy; + wxSpinButton::DoGetPosition(&xBuddy, y); - wxSpinButton::DoGetPosition(x, y); - + int xText; wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd; + wxSpinButton::DoGetPosition(&xText, y); + + *x = wxMin(xBuddy, xText); } #endif // wxUSE_SPINCTRL diff --git a/Externals/wxWidgets3/src/msw/stackwalk.cpp b/Externals/wxWidgets3/src/msw/stackwalk.cpp index f9c8ca986e..4b59c4a381 100644 --- a/Externals/wxWidgets3/src/msw/stackwalk.cpp +++ b/Externals/wxWidgets3/src/msw/stackwalk.cpp @@ -50,29 +50,16 @@ void wxStackFrame::OnGetName() m_hasName = true; // get the name of the function for this stack frame entry - static const size_t MAX_NAME_LEN = 1024; - BYTE symbolBuffer[sizeof(SYMBOL_INFO) + MAX_NAME_LEN]; - wxZeroMemory(symbolBuffer); - - PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)symbolBuffer; - pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO); - pSymbol->MaxNameLen = MAX_NAME_LEN; - - DWORD64 symDisplacement = 0; - if ( !wxDbgHelpDLL::SymFromAddr + if ( !wxDbgHelpDLL::CallSymFromAddr ( ::GetCurrentProcess(), GetSymAddr(), - &symDisplacement, - pSymbol + &m_offset, + &m_name ) ) { wxDbgHelpDLL::LogError(wxT("SymFromAddr")); - return; } - - m_name = wxString::FromAscii(pSymbol->Name); - m_offset = symDisplacement; } void wxStackFrame::OnGetLocation() @@ -82,25 +69,11 @@ void wxStackFrame::OnGetLocation() m_hasLocation = true; - // get the source line for this stack frame entry - IMAGEHLP_LINE lineInfo = { sizeof(IMAGEHLP_LINE) }; - DWORD dwLineDisplacement; - if ( !wxDbgHelpDLL::SymGetLineFromAddr - ( - ::GetCurrentProcess(), - GetSymAddr(), - &dwLineDisplacement, - &lineInfo - ) ) - { - // it is normal that we don't have source info for some symbols, - // notably all the ones from the system DLLs... - //wxDbgHelpDLL::LogError(wxT("SymGetLineFromAddr")); - return; - } - - m_filename = wxString::FromAscii(lineInfo.FileName); - m_line = lineInfo.LineNumber; + // get the source line for this stack frame entry ignoring possible errors + // (it's normal that we don't have source info for some symbols, e.g. all + // those from the system DLLs) + wxDbgHelpDLL::CallSymGetLineFromAddr(::GetCurrentProcess(), GetSymAddr(), + &m_filename, &m_line); } bool @@ -125,11 +98,10 @@ wxStackFrame::GetParam(size_t n, return true; } -void wxStackFrame::OnParam(PSYMBOL_INFO pSymInfo) +void wxStackFrame::OnParam(wxSYMBOL_INFO *pSymInfo) { m_paramTypes.Add(wxEmptyString); - - m_paramNames.Add(wxString::FromAscii(pSymInfo->Name)); + m_paramNames.Add(pSymInfo->Name); // if symbol information is corrupted and we crash, the exception is going // to be ignored when we're called from WalkFromException() because of the @@ -158,7 +130,7 @@ void wxStackFrame::OnParam(PSYMBOL_INFO pSymInfo) } BOOL CALLBACK -EnumSymbolsProc(PSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data) +EnumSymbolsProc(wxPSYMBOL_INFO pSymInfo, ULONG WXUNUSED(SymSize), PVOID data) { wxStackFrame *frame = static_cast(data); @@ -195,11 +167,10 @@ void wxStackFrame::OnGetParam() return; } - if ( !wxDbgHelpDLL::SymEnumSymbols + if ( !wxDbgHelpDLL::CallSymEnumSymbols ( ::GetCurrentProcess(), NULL, // DLL base: use current context - NULL, // no mask, get all symbols EnumSymbolsProc, // callback this // data to pass to it ) ) @@ -232,10 +203,9 @@ void wxStackWalker::WalkFrom(const CONTEXT *pCtx, size_t skip, size_t maxDepth) // below which should be a real handle... so this is what we use const HANDLE hProcess = ::GetCurrentProcess(); - if ( !wxDbgHelpDLL::SymInitialize + if ( !wxDbgHelpDLL::CallSymInitialize ( hProcess, - NULL, // use default symbol search path TRUE // load symbols for all loaded modules ) ) { @@ -382,7 +352,7 @@ wxStackFrame::GetParam(size_t WXUNUSED(n), return false; } -void wxStackFrame::OnParam(_SYMBOL_INFO * WXUNUSED(pSymInfo)) +void wxStackFrame::OnParam(wxSYMBOL_INFO * WXUNUSED(pSymInfo)) { } diff --git a/Externals/wxWidgets3/src/msw/statbmp.cpp b/Externals/wxWidgets3/src/msw/statbmp.cpp index 496df705a8..bea1ddd561 100644 --- a/Externals/wxWidgets3/src/msw/statbmp.cpp +++ b/Externals/wxWidgets3/src/msw/statbmp.cpp @@ -35,6 +35,7 @@ #endif #include "wx/msw/private.h" +#include "wx/msw/dib.h" #include "wx/sysopt.h" @@ -123,7 +124,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, // painting manually is reported not to work under Windows CE (see #10093), // so don't do it there even if this probably means that alpha is not // supported there -- but at least bitmaps without alpha appear correctly -#ifndef __WXWINCE__ // Windows versions before XP (and even XP if the application has no // manifest and so the old comctl32.dll is used) don't draw correctly the // images with alpha channel so we need to draw them ourselves and it's @@ -133,7 +133,6 @@ bool wxStaticBitmap::Create(wxWindow *parent, { Connect(wxEVT_PAINT, wxPaintEventHandler(wxStaticBitmap::DoPaintManually)); } -#endif // !__WXWINCE__ return true; } @@ -187,8 +186,29 @@ wxBitmap wxStaticBitmap::GetBitmap() const } } +void wxStaticBitmap::Init() +{ + m_isIcon = true; + m_image = NULL; + m_currentHandle = 0; + m_ownsCurrentHandle = false; +} + +void wxStaticBitmap::DeleteCurrentHandleIfNeeded() +{ + if ( m_ownsCurrentHandle ) + { + ::DeleteObject(m_currentHandle); + m_ownsCurrentHandle = false; + } +} + void wxStaticBitmap::Free() { + MSWReplaceImageHandle(0); + + DeleteCurrentHandleIfNeeded(); + wxDELETE(m_image); } @@ -218,8 +238,6 @@ void wxStaticBitmap::WXHandleSize(wxSizeEvent& event) event.Skip(); } -#ifndef __WXWINCE__ - void wxStaticBitmap::DoPaintManually(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); @@ -242,14 +260,25 @@ void wxStaticBitmap::DoPaintManually(wxPaintEvent& WXUNUSED(event)) true /* use mask */); } -#endif // !__WXWINCE__ - void wxStaticBitmap::SetImage( const wxGDIImage* image ) { wxGDIImage* convertedImage = ConvertImage( *image ); SetImageNoCopy( convertedImage ); } +void wxStaticBitmap::MSWReplaceImageHandle(WXLPARAM handle) +{ + HGDIOBJ oldHandle = (HGDIOBJ)::SendMessage(GetHwnd(), STM_SETIMAGE, + m_isIcon ? IMAGE_ICON : IMAGE_BITMAP, (LPARAM)handle); + // detect if this is still the handle we passed before or + // if the static-control made a copy of the bitmap! + if (oldHandle != 0 && oldHandle != (HGDIOBJ) m_currentHandle) + { + // the static control made a copy and we are responsible for deleting it + ::DeleteObject((HGDIOBJ) oldHandle); + } +} + void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image) { Free(); @@ -264,22 +293,39 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image) GetPosition(&x, &y); GetSize(&w, &h); -#ifdef __WIN32__ - HANDLE handle = (HANDLE)m_image->GetHandle(); + // Normally we just use the handle of provided image but in some cases we + // create our own temporary bitmap, so the actual handle may end up being + // different from the original one. + const HANDLE handleOrig = (HANDLE)m_image->GetHandle(); + HANDLE handle = handleOrig; + +#if wxUSE_WXDIB + if ( !m_isIcon ) + { + // wxBitmap normally stores alpha in pre-multiplied format but + // apparently STM_SETIMAGE message handler does pre-multiplication + // internally so we need to undo the pre-multiplication here for a + // while (this is similar to what we do in ImageList::Add()). + const wxBitmap& bmp = static_cast(*image); + if ( bmp.HasAlpha() ) + { + // For bitmap with alpha channel create temporary DIB with + // not-premultiplied alpha values. + handle = wxDIB(bmp.ConvertToImage(), + wxDIB::PixelFormat_NotPreMultiplied).Detach(); + } + } +#endif // wxUSE_WXDIB LONG style = ::GetWindowLong( (HWND)GetHWND(), GWL_STYLE ) ; ::SetWindowLong( (HWND)GetHWND(), GWL_STYLE, ( style & ~( SS_BITMAP|SS_ICON ) ) | ( m_isIcon ? SS_ICON : SS_BITMAP ) ); - HGDIOBJ oldHandle = (HGDIOBJ)::SendMessage(GetHwnd(), STM_SETIMAGE, - m_isIcon ? IMAGE_ICON : IMAGE_BITMAP, (LPARAM)handle); - // detect if this is still the handle we passed before or - // if the static-control made a copy of the bitmap! - if (m_currentHandle != 0 && oldHandle != (HGDIOBJ) m_currentHandle) - { - // the static control made a copy and we are responsible for deleting it - DeleteObject((HGDIOBJ) oldHandle); - } + + MSWReplaceImageHandle((WXLPARAM)handle); + + DeleteCurrentHandleIfNeeded(); + m_currentHandle = (WXHANDLE)handle; -#endif // Win32 + m_ownsCurrentHandle = handle != handleOrig; if ( ImageIsOk() ) { diff --git a/Externals/wxWidgets3/src/msw/statbox.cpp b/Externals/wxWidgets3/src/msw/statbox.cpp index 678a2594cf..56fe236fac 100644 --- a/Externals/wxWidgets3/src/msw/statbox.cpp +++ b/Externals/wxWidgets3/src/msw/statbox.cpp @@ -76,10 +76,6 @@ bool wxStaticBox::Create(wxWindow *parent, if ( !MSWCreateControl(wxT("BUTTON"), label, pos, size) ) return false; - // Always use LTR layout. Otherwise, the label would be mirrored. - SetLayoutDirection(wxLayout_LeftToRight); - -#ifndef __WXWINCE__ if (!wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint"))) { Connect(wxEVT_PAINT, wxPaintEventHandler(wxStaticBox::OnPaint)); @@ -88,7 +84,6 @@ bool wxStaticBox::Create(wxWindow *parent, // WM_ERASEBKGND too to avoid flicker. SetBackgroundStyle(wxBG_STYLE_PAINT); } -#endif // !__WXWINCE__ return true; } @@ -103,7 +98,6 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const if ( exstyle ) { -#ifndef __WXWINCE__ // We may have children inside this static box, so use this style for // TAB navigation to work if we ever use IsDialogMessage() to implement // it (currently we don't because it's too buggy and implement TAB @@ -112,17 +106,10 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const if (wxSystemOptions::IsFalse(wxT("msw.staticbox.optimized-paint"))) *exstyle |= WS_EX_TRANSPARENT; -#endif } styleWin |= BS_GROUPBOX; - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) - { - // Make sure label is on the right - styleWin |= BS_RIGHT; - } - return styleWin; } @@ -164,9 +151,6 @@ void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const *borderTop += GetCharHeight()/3; } -// all the hacks below are not necessary for WinCE -#ifndef __WXWINCE__ - WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { if ( nMsg == WM_NCHITTEST ) @@ -277,11 +261,26 @@ void wxStaticBox::MSWGetRegionWithoutSelf(WXHRGN hRgn, int w, int h) SubtractRectFromRgn(hrgn, w - border, 0, w, h); } +namespace { +RECT AdjustRectForRtl(wxLayoutDirection dir, RECT const& childRect, RECT const& boxRect) { + RECT ret = childRect; + if( dir == wxLayout_RightToLeft ) { + // The clipping region too is mirrored in RTL layout. + // We need to mirror screen coordinates relative to static box window priot to + // intersecting with region. + ret.right = boxRect.right - childRect.left - boxRect.left; + ret.left = boxRect.right - childRect.right - boxRect.left; + } + + return ret; +} +} + WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() { - RECT rc; - ::GetWindowRect(GetHwnd(), &rc); - HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1); + RECT boxRc; + ::GetWindowRect(GetHwnd(), &boxRc); + HRGN hrgn = ::CreateRectRgn(boxRc.left, boxRc.top, boxRc.right + 1, boxRc.bottom + 1); bool foundThis = false; // Iterate over all sibling windows as in the old wxWidgets API the @@ -320,7 +319,9 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() continue; } + RECT rc; ::GetWindowRect(child, &rc); + rc = AdjustRectForRtl(GetLayoutDirection(), rc, boxRc ); if ( ::RectInRegion(hrgn, &rc) ) { // need to remove WS_CLIPSIBLINGS from all sibling windows @@ -355,7 +356,9 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() continue; } + RECT rc; ::GetWindowRect(child, &rc); + rc = AdjustRectForRtl(GetLayoutDirection(), rc, boxRc ); AutoHRGN hrgnChild(::CreateRectRgnIndirect(&rc)); ::CombineRgn(hrgn, hrgn, hrgnChild, RGN_DIFF); } @@ -391,7 +394,7 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc) ::FillRect(GetHdcOf(*impl), &rc, hbr); } -void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) +void wxStaticBox::PaintForeground(wxDC& dc, const RECT&) { wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); MSWDefWindowProc(WM_PAINT, (WPARAM)GetHdcOf(*impl), 0); @@ -407,10 +410,6 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) HDC hdc = GetHdcOf(*impl); ::SetTextColor(hdc, GetForegroundColour().GetPixel()); - const bool rtl = wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft; - if ( rtl ) - ::SetTextAlign(hdc, TA_RTLREADING | TA_RIGHT); - // Get dimensions of the label const wxString label = GetLabel(); @@ -458,18 +457,9 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) // FIXME: value of x is hardcoded as this is what it is on my system, // no idea if it's true everywhere RECT dimensions = {0, 0, 0, y}; - if ( !rtl ) - { - x = 9; - dimensions.left = x; - dimensions.right = x + width; - } - else - { - x = rc.right - 7; - dimensions.left = x - width; - dimensions.right = x; - } + x = 9; + dimensions.left = x; + dimensions.right = x + width; // need to adjust the rectangle to cover all the label background dimensions.left -= 2; @@ -482,8 +472,7 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) // the label: this is consistent with the behaviour under pre-XP // systems (i.e. without visual themes) and generally makes sense wxBrush brush = wxBrush(GetBackgroundColour()); - wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); - ::FillRect(GetHdcOf(*impl), &dimensions, GetHbrushOf(brush)); + ::FillRect(hdc, &dimensions, GetHbrushOf(brush)); } else // paint parent background { @@ -505,18 +494,9 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) } // now draw the text - if ( !rtl ) - { - RECT rc2 = { x, 0, x + width, y }; - ::DrawText(hdc, label.t_str(), label.length(), &rc2, - drawTextFlags); - } - else // RTL - { - RECT rc2 = { x, 0, x - width, y }; - ::DrawText(hdc, label.t_str(), label.length(), &rc2, - drawTextFlags | DT_RTLREADING); - } + RECT rc2 = { x, 0, x + width, y }; + ::DrawText(hdc, label.t_str(), label.length(), &rc2, + drawTextFlags); } #endif // wxUSE_UXTHEME } @@ -525,9 +505,15 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event)) { RECT rc; ::GetClientRect(GetHwnd(), &rc); + wxPaintDC dc(this); + + // No need to do anything if the client rectangle is empty and, worse, + // doing it would result in an assert when creating the bitmap below. + if ( !rc.right || !rc.bottom ) + return; // draw the entire box in a memory DC - wxMemoryDC memdc; + wxMemoryDC memdc(&dc); wxBitmap bitmap(rc.right, rc.bottom); memdc.SelectObject(bitmap); @@ -540,7 +526,6 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event)) // note that it seems to be faster to do 4 small blits here and then paint // directly into wxPaintDC than painting background in wxMemoryDC and then // blitting everything at once to wxPaintDC, this is why we do it like this - wxPaintDC dc(this); int borderTop, border; GetBordersForSizer(&borderTop, &border); @@ -575,6 +560,4 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event)) PaintBackground(dc, rc); } -#endif // !__WXWINCE__ - #endif // wxUSE_STATBOX diff --git a/Externals/wxWidgets3/src/msw/statline.cpp b/Externals/wxWidgets3/src/msw/statline.cpp index 105ecfbcd1..e23608dd91 100644 --- a/Externals/wxWidgets3/src/msw/statline.cpp +++ b/Externals/wxWidgets3/src/msw/statline.cpp @@ -64,9 +64,7 @@ WXDWORD wxStaticLine::MSWGetStyle(long style, WXDWORD *exstyle) const // add our default styles msStyle |= SS_SUNKEN | SS_NOTIFY | WS_CLIPSIBLINGS; -#ifndef __WXWINCE__ msStyle |= SS_GRAYRECT ; -#endif return msStyle ; } diff --git a/Externals/wxWidgets3/src/msw/stattext.cpp b/Externals/wxWidgets3/src/msw/stattext.cpp index 1eb8b24acd..1b532ce62a 100644 --- a/Externals/wxWidgets3/src/msw/stattext.cpp +++ b/Externals/wxWidgets3/src/msw/stattext.cpp @@ -49,7 +49,6 @@ bool wxStaticText::Create(wxWindow *parent, // as we didn't pass the correct label to MSWCreateControl(), it didn't set // the initial size correctly -- do it now - InvalidateBestSize(); SetInitialSize(size); // NOTE: if the label contains ampersand characters which are interpreted as @@ -68,7 +67,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const // // note that both wxALIGN_LEFT and SS_LEFT are equal to 0 so we shouldn't // test for them using & operator - if ( style & wxALIGN_CENTRE ) + if ( style & wxALIGN_CENTRE_HORIZONTAL ) msStyle |= SS_CENTER; else if ( style & wxALIGN_RIGHT ) msStyle |= SS_RIGHT; @@ -76,18 +75,14 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const msStyle |= SS_LEFT; #ifdef SS_ENDELLIPSIS - // this style is necessary to receive mouse events - // Win NT and later have the SS_ENDELLIPSIS style which is useful to us: - if (wxGetOsVersion() == wxOS_WINDOWS_NT) - { - // for now, add the SS_ENDELLIPSIS style if wxST_ELLIPSIZE_END is given; - // we may need to remove it later in ::SetLabel() if the given label - // has newlines - if ( style & wxST_ELLIPSIZE_END ) - msStyle |= SS_ENDELLIPSIS; - } + // for now, add the SS_ENDELLIPSIS style if wxST_ELLIPSIZE_END is given; + // we may need to remove it later in ::SetLabel() if the given label + // has newlines + if ( style & wxST_ELLIPSIZE_END ) + msStyle |= SS_ENDELLIPSIS; #endif // SS_ENDELLIPSIS + // this style is necessary to receive mouse events msStyle |= SS_NOTIFY; return msStyle; @@ -105,11 +100,6 @@ wxSize wxStaticText::DoGetBestClientSize() const wxCoord widthTextMax, heightTextTotal; dc.GetMultiLineTextExtent(GetLabelText(), &widthTextMax, &heightTextTotal); -#ifdef __WXWINCE__ - if ( widthTextMax ) - widthTextMax += 2; -#endif // __WXWINCE__ - // This extra pixel is a hack we use to ensure that a wxStaticText // vertically centered around the same position as a wxTextCtrl shows its // text on exactly the same baseline. It is not clear why is this needed @@ -154,8 +144,7 @@ void wxStaticText::SetLabel(const wxString& label) { #ifdef SS_ENDELLIPSIS long styleReal = ::GetWindowLong(GetHwnd(), GWL_STYLE); - if ( HasFlag(wxST_ELLIPSIZE_END) && - wxGetOsVersion() == wxOS_WINDOWS_NT ) + if ( HasFlag(wxST_ELLIPSIZE_END) ) { // adding SS_ENDELLIPSIS or SS_ENDELLIPSIS "disables" the correct // newline handling in static texts: the newlines in the labels are @@ -186,31 +175,22 @@ void wxStaticText::SetLabel(const wxString& label) #endif // SS_ENDELLIPSIS DoSetLabel(GetEllipsizedLabel()); - // adjust the size of the window to fit to the label unless autoresizing is - // disabled - if ( !HasFlag(wxST_NO_AUTORESIZE) && - !IsEllipsized() ) // if ellipsize is ON, then we don't want to get resized! + InvalidateBestSize(); + + if ( !IsEllipsized() ) // if ellipsize is ON, then we don't want to get resized! { - InvalidateBestSize(); - DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, - wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); + AutoResizeIfNecessary(); } } bool wxStaticText::SetFont(const wxFont& font) { - bool ret = wxControl::SetFont(font); + if ( !wxControl::SetFont(font) ) + return false; - // adjust the size of the window to fit to the label unless autoresizing is - // disabled - if ( !HasFlag(wxST_NO_AUTORESIZE) ) - { - InvalidateBestSize(); - DoSetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, - wxSIZE_AUTO_WIDTH | wxSIZE_AUTO_HEIGHT); - } + AutoResizeIfNecessary(); - return ret; + return true; } // for wxST_ELLIPSIZE_* support: diff --git a/Externals/wxWidgets3/src/msw/statusbar.cpp b/Externals/wxWidgets3/src/msw/statusbar.cpp index 0a33fdc2f5..c00698d3da 100644 --- a/Externals/wxWidgets3/src/msw/statusbar.cpp +++ b/Externals/wxWidgets3/src/msw/statusbar.cpp @@ -106,11 +106,9 @@ WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const } else { -#ifndef __WXWINCE__ // may be some versions of comctl32.dll do need it - anyhow, it won't // do any harm msStyle |= SBARS_SIZEGRIP; -#endif } return msStyle; @@ -518,9 +516,7 @@ void wxStatusBar::DoMoveWindow(int x, int y, int width, int height) // if other windows are size deferred ::SetWindowPos(GetHwnd(), NULL, x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE -#ifndef __WXWINCE__ | SWP_NOCOPYBITS | SWP_NOSENDCHANGING -#endif ); } @@ -574,7 +570,6 @@ void wxStatusBar::SetStatusStyles(int n, const int styles[]) WXLRESULT wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { -#ifndef __WXWINCE__ if ( nMsg == WM_WINDOWPOSCHANGING ) { WINDOWPOS *lpPos = (WINDOWPOS *)lParam; @@ -613,7 +608,6 @@ wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } } } -#endif if ( nMsg == WM_SIZE ) { diff --git a/Externals/wxWidgets3/src/msw/stdpaths.cpp b/Externals/wxWidgets3/src/msw/stdpaths.cpp index f8b05866b2..d3274701d1 100644 --- a/Externals/wxWidgets3/src/msw/stdpaths.cpp +++ b/Externals/wxWidgets3/src/msw/stdpaths.cpp @@ -36,13 +36,13 @@ #include "wx/msw/private.h" #include "wx/msw/wrapshl.h" +#include // ---------------------------------------------------------------------------- // types // ---------------------------------------------------------------------------- -typedef HRESULT (WINAPI *SHGetFolderPath_t)(HWND, int, HANDLE, DWORD, LPTSTR); -typedef HRESULT (WINAPI *SHGetSpecialFolderPath_t)(HWND, LPTSTR, int, BOOL); +typedef HRESULT (WINAPI *SHGetKnownFolderPath_t)(const GUID&, DWORD, HANDLE, PWSTR *); // ---------------------------------------------------------------------------- // constants @@ -86,17 +86,18 @@ typedef HRESULT (WINAPI *SHGetSpecialFolderPath_t)(HWND, LPTSTR, int, BOOL); namespace { +DEFINE_GUID(wxFOLDERID_Downloads, + 0x374de290, 0x123f, 0x4565, 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b); + struct ShellFunctions { ShellFunctions() { - pSHGetFolderPath = NULL; - pSHGetSpecialFolderPath = NULL; + pSHGetKnownFolderPath = NULL; initialized = false; } - SHGetFolderPath_t pSHGetFolderPath; - SHGetSpecialFolderPath_t pSHGetSpecialFolderPath; + SHGetKnownFolderPath_t pSHGetKnownFolderPath; bool initialized; }; @@ -115,12 +116,8 @@ void ResolveShellFunctions() #if wxUSE_DYNLIB_CLASS // start with the newest functions, fall back to the oldest ones -#ifdef __WXWINCE__ - wxString shellDllName(wxT("coredll")); -#else // first check for SHGetFolderPath (shell32.dll 5.0) wxString shellDllName(wxT("shell32")); -#endif wxDynamicLibrary dllShellFunctions( shellDllName ); if ( !dllShellFunctions.IsLoaded() ) @@ -132,30 +129,8 @@ void ResolveShellFunctions() // with this wxLogNull noLog; -#if wxUSE_UNICODE - #ifdef __WXWINCE__ - static const wchar_t UNICODE_SUFFIX = L''; // WinCE SH functions don't seem to have 'W' - #else - static const wchar_t UNICODE_SUFFIX = L'W'; - #endif -#else // !Unicode - static const char UNICODE_SUFFIX = 'A'; -#endif // Unicode/!Unicode - - wxString funcname(wxT("SHGetFolderPath")); - gs_shellFuncs.pSHGetFolderPath = - (SHGetFolderPath_t)dllShellFunctions.GetSymbol(funcname + UNICODE_SUFFIX); - - // then for SHGetSpecialFolderPath (shell32.dll 4.71) - if ( !gs_shellFuncs.pSHGetFolderPath ) - { - funcname = wxT("SHGetSpecialFolderPath"); - gs_shellFuncs.pSHGetSpecialFolderPath = (SHGetSpecialFolderPath_t) - dllShellFunctions.GetSymbol(funcname + UNICODE_SUFFIX); - } - - // finally we fall back on SHGetSpecialFolderLocation (shell32.dll 4.0), - // but we don't need to test for it -- it is available even under Win95 + gs_shellFuncs.pSHGetKnownFolderPath = (SHGetKnownFolderPath_t) + dllShellFunctions.GetSymbol("SHGetKnownFolderPath"); // shell32.dll is going to be unloaded, but it still remains in memory // because we also link to it statically, so it's ok @@ -177,79 +152,62 @@ void ResolveShellFunctions() /* static */ wxString wxStandardPaths::DoGetDirectory(int csidl) { - if ( !gs_shellFuncs.initialized ) - ResolveShellFunctions(); - wxString dir; HRESULT hr = E_FAIL; - // test whether the function is available during compile-time (it must be - // defined as either "SHGetFolderPathA" or "SHGetFolderPathW") -#ifdef SHGetFolderPath - // and now test whether we have it during run-time - if ( gs_shellFuncs.pSHGetFolderPath ) - { - hr = gs_shellFuncs.pSHGetFolderPath - ( - NULL, // parent window, not used - csidl, - NULL, // access token (current user) - SHGFP_TYPE_CURRENT, // current path, not just default value - wxStringBuffer(dir, MAX_PATH) - ); + hr = ::SHGetFolderPath + ( + NULL, // parent window, not used + csidl, + NULL, // access token (current user) + SHGFP_TYPE_CURRENT, // current path, not just default value + wxStringBuffer(dir, MAX_PATH) + ); - // somewhat incredibly, the error code in the Unicode version is - // different from the one in ASCII version for this function + // somewhat incredibly, the error code in the Unicode version is + // different from the one in ASCII version for this function #if wxUSE_UNICODE - if ( hr == E_FAIL ) + if ( hr == E_FAIL ) #else - if ( hr == S_FALSE ) + if ( hr == S_FALSE ) #endif - { - // directory doesn't exist, maybe we can get its default value? - hr = gs_shellFuncs.pSHGetFolderPath - ( - NULL, - csidl, - NULL, - SHGFP_TYPE_DEFAULT, - wxStringBuffer(dir, MAX_PATH) - ); - } - } -#endif // SHGetFolderPath - -#ifdef SHGetSpecialFolderPath - if ( FAILED(hr) && gs_shellFuncs.pSHGetSpecialFolderPath ) { - hr = gs_shellFuncs.pSHGetSpecialFolderPath - ( - NULL, // parent window - wxStringBuffer(dir, MAX_PATH), + // directory doesn't exist, maybe we can get its default value? + hr = ::SHGetFolderPath + ( + NULL, csidl, - FALSE // don't create if doesn't exist - ); + NULL, + SHGFP_TYPE_DEFAULT, + wxStringBuffer(dir, MAX_PATH) + ); } -#endif // SHGetSpecialFolderPath - // SHGetSpecialFolderLocation should be available with all compilers and - // under all Win32 systems, so don't test for it (and as it doesn't exist - // in "A" and "W" versions anyhow, testing would be more involved, too) - if ( FAILED(hr) ) + return dir; +} + +wxString wxStandardPaths::DoGetKnownFolder(const GUID& rfid) +{ + if (!gs_shellFuncs.initialized) + ResolveShellFunctions(); + + wxString dir; + + if ( gs_shellFuncs.pSHGetKnownFolderPath ) { - LPITEMIDLIST pidl; - hr = SHGetSpecialFolderLocation(NULL, csidl, &pidl); - + PWSTR pDir; + HRESULT hr = gs_shellFuncs.pSHGetKnownFolderPath(rfid, 0, 0, &pDir); if ( SUCCEEDED(hr) ) { - // creating this temp object has (nice) side effect of freeing pidl - dir = wxItemIdList(pidl).GetPath(); + dir = pDir; + CoTaskMemFree(pDir); } } return dir; } + wxString wxStandardPaths::GetAppDir() const { if ( m_appDir.empty() ) @@ -260,9 +218,38 @@ wxString wxStandardPaths::GetAppDir() const return m_appDir; } -wxString wxStandardPaths::GetDocumentsDir() const +wxString wxStandardPaths::GetUserDir(Dir userDir) const { - return DoGetDirectory(CSIDL_PERSONAL); + int csidl; + switch (userDir) + { + case Dir_Desktop: + csidl = CSIDL_DESKTOPDIRECTORY; + break; + case Dir_Downloads: + { + csidl = CSIDL_PERSONAL; + // Downloads folder is only available since Vista + wxString dir = DoGetKnownFolder(wxFOLDERID_Downloads); + if ( !dir.empty() ) + return dir; + break; + } + case Dir_Music: + csidl = CSIDL_MYMUSIC; + break; + case Dir_Pictures: + csidl = CSIDL_MYPICTURES; + break; + case Dir_Videos: + csidl = CSIDL_MYVIDEO; + break; + default: + csidl = CSIDL_PERSONAL; + break; + } + + return DoGetDirectory(csidl); } // ---------------------------------------------------------------------------- @@ -295,6 +282,14 @@ void wxStandardPaths::IgnoreAppBuildSubDirs() IgnoreAppSubDir("debug"); IgnoreAppSubDir("release"); + // there can also be an architecture-dependent parent directory, ignore it + // as well +#ifdef __WIN64__ + IgnoreAppSubDir("x64"); +#else // __WIN32__ + IgnoreAppSubDir("Win32"); +#endif // __WIN64__/__WIN32__ + wxString compilerPrefix; #ifdef __VISUALC__ compilerPrefix = "vc"; @@ -302,10 +297,6 @@ void wxStandardPaths::IgnoreAppBuildSubDirs() compilerPrefix = "gcc"; #elif defined(__BORLANDC__) compilerPrefix = "bcc"; -#elif defined(__DIGITALMARS__) - compilerPrefix = "dmc"; -#elif defined(__WATCOMC__) - compilerPrefix = "wat"; #else return; #endif @@ -384,15 +375,10 @@ wxString wxStandardPathsWin16::GetConfigDir() const // this is for compatibility with earlier wxFileConfig versions // which used the Windows directory for the global files wxString dir; -#ifndef __WXWINCE__ if ( !::GetWindowsDirectory(wxStringBuffer(dir, MAX_PATH), MAX_PATH) ) { wxLogLastError(wxT("GetWindowsDirectory")); } -#else - // TODO: use CSIDL_WINDOWS (eVC4, possibly not eVC3) - dir = wxT("\\Windows"); -#endif return dir; } diff --git a/Externals/wxWidgets3/src/msw/systhemectrl.cpp b/Externals/wxWidgets3/src/msw/systhemectrl.cpp new file mode 100644 index 0000000000..c705b05e00 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/systhemectrl.cpp @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/systhemectrl.cpp +// Purpose: wxMSW implementation of wxSystemThemedControl +// Author: Tobias Taschner +// Created: 2015-09-15 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/systhemectrl.h" + +#include "wx/msw/private.h" +#include "wx/msw/uxtheme.h" + +#ifdef wxHAS_SYSTEM_THEMED_CONTROL + +void wxSystemThemedControlBase::DoEnableSystemTheme(bool enable, wxWindow* window) +{ + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + { + if ( wxUxThemeEngine *te = wxUxThemeEngine::GetIfActive() ) + { + const wchar_t* const sysThemeId = enable ? L"EXPLORER" : NULL; + te->SetWindowTheme(GetHwndOf(window), sysThemeId, NULL); + } + } +} + +#endif // wxHAS_SYSTEM_THEMED_CONTROL diff --git a/Externals/wxWidgets3/src/msw/taskbar.cpp b/Externals/wxWidgets3/src/msw/taskbar.cpp index 537db33bfd..0ab0d242e2 100644 --- a/Externals/wxWidgets3/src/msw/taskbar.cpp +++ b/Externals/wxWidgets3/src/msw/taskbar.cpp @@ -30,8 +30,8 @@ #include #include "wx/taskbar.h" +#include "wx/platinfo.h" #include "wx/msw/private.h" -#include "wx/dynlib.h" #ifndef NIN_BALLOONTIMEOUT #define NIN_BALLOONTIMEOUT 0x0404 @@ -46,14 +46,6 @@ #define NIF_INFO 0x00000010 #endif -#ifndef NOTIFYICONDATA_V1_SIZE - #ifdef UNICODE - #define NOTIFYICONDATA_V1_SIZE 0x0098 - #else - #define NOTIFYICONDATA_V1_SIZE 0x0058 - #endif -#endif - #ifndef NOTIFYICONDATA_V2_SIZE #ifdef UNICODE #define NOTIFYICONDATA_V2_SIZE 0x03A8 @@ -67,44 +59,12 @@ static UINT gs_msgTaskbar = 0; static UINT gs_msgRestartTaskbar = 0; -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); // ============================================================================ // implementation // ============================================================================ -// wrapper around Shell_NotifyIcon(): this function is not present in Win95 -// shell32.dll so load it dynamically to allow programs using wxTaskBarIcon to -// start under this OS -static BOOL wxShellNotifyIcon(DWORD dwMessage, NOTIFYICONDATA *pData) -{ -#if wxUSE_DYNLIB_CLASS - typedef BOOL (WINAPI *Shell_NotifyIcon_t)(DWORD, NOTIFYICONDATA *); - - static Shell_NotifyIcon_t s_pfnShell_NotifyIcon = NULL; - static bool s_initialized = false; - if ( !s_initialized ) - { - s_initialized = true; - - wxLogNull noLog; - wxDynamicLibrary dllShell("shell32.dll"); - if ( dllShell.IsLoaded() ) - { - wxDL_INIT_FUNC_AW(s_pfn, Shell_NotifyIcon, dllShell); - } - - // NB: it's ok to destroy dllShell here, we link to shell32.dll - // implicitly so it won't be unloaded - } - - return s_pfnShell_NotifyIcon ? (*s_pfnShell_NotifyIcon)(dwMessage, pData) - : FALSE; -#else // !wxUSE_DYNLIB_CLASS - return Shell_NotifyIcon(dwMessage, pData); -#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS -} - // ---------------------------------------------------------------------------- // wxTaskBarIconWindow: helper window // ---------------------------------------------------------------------------- @@ -150,17 +110,12 @@ struct NotifyIconData : public NOTIFYICONDATA { memset(this, 0, sizeof(NOTIFYICONDATA)); - // Do _not_ use sizeof(NOTIFYICONDATA) here, it may be too big if we're - // compiled with newer headers but running on an older system and while - // we could do complicated tests for the exact system version it's - // easier to just use an old size which should be supported everywhere - // from Windows 2000 up and which is all we need as we don't use any - // newer features so far. But if we're running under a really ancient - // system (Win9x), fall back to even smaller size -- then the balloon - // related features won't be available but the rest will still work. - cbSize = wxTheApp->GetShell32Version() >= 500 - ? NOTIFYICONDATA_V2_SIZE - : NOTIFYICONDATA_V1_SIZE; + // Since Vista there is a new member hBalloonIcon which will be used + // if a user specified icon is specified in ShowBalloon(). For XP + // use the old size + cbSize = wxPlatformInfo::Get().CheckOSVersion(6, 0) + ? sizeof(NOTIFYICONDATA) + : NOTIFYICONDATA_V2_SIZE; hWnd = (HWND) hwnd; uCallbackMessage = gs_msgTaskbar; @@ -228,12 +183,12 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) wxStrlcpy(notifyData.szTip, tooltip.t_str(), WXSIZEOF(notifyData.szTip)); } - bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY + bool ok = Shell_NotifyIcon(m_iconAdded ? NIM_MODIFY : NIM_ADD, ¬ifyData) != 0; if ( !ok ) { - wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY/ADD)")); + wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY/ADD)")); } if ( !m_iconAdded && ok ) @@ -248,7 +203,8 @@ bool wxTaskBarIcon::ShowBalloon(const wxString& title, const wxString& text, unsigned msec, - int flags) + int flags, + const wxIcon& icon) { wxCHECK_MSG( m_iconAdded, false, wxT("can't be used before the icon is created") ); @@ -261,9 +217,9 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, notifyData.uFlags = 0; notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows 2000/XP */; - if ( !wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData) ) + if ( !Shell_NotifyIcon(NIM_SETVERSION, ¬ifyData) ) { - wxLogLastError(wxT("wxShellNotifyIcon(NIM_SETVERSION)")); + wxLogLastError(wxT("Shell_NotifyIcon(NIM_SETVERSION)")); } // do show the balloon now @@ -274,6 +230,17 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, wxStrlcpy(notifyData.szInfoTitle, title.t_str(), WXSIZEOF(notifyData.szInfoTitle)); + wxUnusedVar(icon); // It's only unused if not supported actually. + +#ifdef NIIF_LARGE_ICON + // User specified icon is only supported since Vista + if ( icon.IsOk() && wxPlatformInfo::Get().CheckOSVersion(6, 0) ) + { + notifyData.hBalloonIcon = GetHiconOf(icon); + notifyData.dwInfoFlags |= NIIF_USER | NIIF_LARGE_ICON; + } + else +#endif if ( flags & wxICON_INFORMATION ) notifyData.dwInfoFlags |= NIIF_INFO; else if ( flags & wxICON_WARNING ) @@ -281,10 +248,10 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, else if ( flags & wxICON_ERROR ) notifyData.dwInfoFlags |= NIIF_ERROR; - bool ok = wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0; + bool ok = Shell_NotifyIcon(NIM_MODIFY, ¬ifyData) != 0; if ( !ok ) { - wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY)")); + wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY)")); } return ok; @@ -301,10 +268,10 @@ bool wxTaskBarIcon::RemoveIcon() NotifyIconData notifyData(GetHwndOf(m_win)); - bool ok = wxShellNotifyIcon(NIM_DELETE, ¬ifyData) != 0; + bool ok = Shell_NotifyIcon(NIM_DELETE, ¬ifyData) != 0; if ( !ok ) { - wxLogLastError(wxT("wxShellNotifyIcon(NIM_DELETE)")); + wxLogLastError(wxT("Shell_NotifyIcon(NIM_DELETE)")); } return ok; diff --git a/Externals/wxWidgets3/src/msw/taskbarbutton.cpp b/Externals/wxWidgets3/src/msw/taskbarbutton.cpp new file mode 100644 index 0000000000..de4bc3a566 --- /dev/null +++ b/Externals/wxWidgets3/src/msw/taskbarbutton.cpp @@ -0,0 +1,1554 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/msw/taskbarbutton.cpp +// Purpose: Implements wxTaskBarButtonImpl class for manipulating buttons on +// the Windows taskbar. +// Author: Chaobin Zhang +// Created: 2014-06-01 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/icon.h" + #include "wx/toplevel.h" +#endif + +#if wxUSE_TASKBARBUTTON + +#ifdef _MSC_VER + #pragma comment( lib, "shlwapi" ) +#endif + +#include "wx/msw/private.h" +#include "wx/msw/taskbarbutton.h" +#include "wx/scopedptr.h" +#include "wx/msw/private/comptr.h" + +#include +#include + +#if wxUSE_DYNLIB_CLASS + #include "wx/dynlib.h" +#endif // wxUSE_DYNLIB_CLASS + +// ---------------------------------------------------------------------------- +// Redefine the interfaces: ITaskbarList3, IObjectCollection, +// ICustomDestinationList, IShellLink, IShellItem, IApplicationDocumentLists +// etc. +// ---------------------------------------------------------------------------- + +WINOLEAPI PropVariantClear(PROPVARIANT* pvar); + +#ifndef PropVariantInit +#define PropVariantInit(pvar) memset ( (pvar), 0, sizeof(PROPVARIANT) ) +#endif + +#ifndef INFOTIPSIZE +#define INFOTIPSIZE 1024 +#endif + +namespace { + +// The maximum number of thumbnail toolbar buttons allowed on windows is 7. +static const int MAX_BUTTON_COUNT = 7; + +DEFINE_GUID(wxCLSID_TaskbarList, + 0x56fdf344, 0xfd6d, 0x11d0, 0x95, 0x8a, 0x0, 0x60, 0x97, 0xc9, 0xa0, 0x90); +DEFINE_GUID(wxCLSID_DestinationList, + 0x77f10cf0, 0x3db5, 0x4966, 0xb5, 0x20, 0xb7, 0xc5, 0x4f, 0xd3,0x5e, 0xd6); +DEFINE_GUID(wxCLSID_EnumerableObjectCollection, + 0x2d3468c1, 0x36a7, 0x43b6, 0xac, 0x24, 0xd3, 0xf0, 0x2f, 0xd9, 0x60, 0x7a); +DEFINE_GUID(wxCLSID_ShellLink, + 0x00021401, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +DEFINE_GUID(wxIID_ICustomDestinationList, + 0x6332debf, 0x87b5, 0x4670, 0x90, 0xc0, 0x5e, 0x57, 0xb4, 0x08, 0xa4, 0x9e); +DEFINE_GUID(wxIID_ITaskbarList3, + 0xea1afb91, 0x9e28, 0x4b86, 0x90, 0xe9, 0x9e, 0x9f, 0x8a, 0x5e, 0xef, 0xaf); +DEFINE_GUID(wxIID_IPropertyStore, + 0x886d8eeb, 0x8cf2, 0x4446, 0x8d, 0x02, 0xcd, 0xba, 0x1d, 0xbd, 0xcf, 0x99); +DEFINE_GUID(wxIID_IObjectArray, + 0x92ca9dcd, 0x5622, 0x4bba, 0xa8, 0x05, 0x5e, 0x9f, 0x54, 0x1b, 0xd8, 0xc9); +DEFINE_GUID(wxIID_IObjectCollection, + 0x5632b1a4, 0xe38a, 0x400a, 0x92, 0x8a, 0xd4, 0xcd, 0x63, 0x23, 0x02, 0x95); +DEFINE_GUID(wxIID_IApplicationDocumentLists, + 0x3c594f9f, 0x9f30, 0x47a1, 0x97, 0x9a, 0xc9, 0xe8, 0x3d, 0x3d, 0x0a, 0x06); +DEFINE_GUID(wxCLSID_ApplicationDocumentLists, + 0x86bec222, 0x30f2, 0x47e0, 0x9f, 0x25, 0x60, 0xd1, 0x1c, 0xd7, 0x5c, 0x28); +DEFINE_GUID(wxIID_IUnknown, + 0x00000000, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +DEFINE_GUID(wxIID_IShellItem, + 0x43826d1e, 0xe718, 0x42ee, 0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe); + +typedef IUnknown *HIMAGELIST; + +typedef enum THUMBBUTTONFLAGS +{ + THBF_ENABLED = 0, + THBF_DISABLED = 0x1, + THBF_DISMISSONCLICK = 0x2, + THBF_NOBACKGROUND = 0x4, + THBF_HIDDEN = 0x8, + THBF_NONINTERACTIVE = 0x10 +} THUMBBUTTONFLAGS; + +typedef enum THUMBBUTTONMASK +{ + THB_BITMAP = 0x1, + THB_ICON = 0x2, + THB_TOOLTIP = 0x4, + THB_FLAGS = 0x8 +} THUMBBUTTONMASK; + +typedef struct THUMBBUTTON +{ + THUMBBUTTONMASK dwMask; + UINT iId; + UINT iBitmap; + HICON hIcon; + WCHAR szTip[260]; + THUMBBUTTONFLAGS dwFlags; +} THUMBBUTTON; + +typedef struct THUMBBUTTON *LPTHUMBBUTTON; + +typedef enum TBPFLAG +{ + TBPF_NOPROGRESS = 0, + TBPF_INDETERMINATE = 0x1, + TBPF_NORMAL = 0x2, + TBPF_ERROR = 0x4, + TBPF_PAUSED = 0x8 +} TBPFLAG; + +#ifndef PROPERTYKEY_DEFINED +typedef struct _tagpropertykey +{ + GUID fmtid; + DWORD pid; +} PROPERTYKEY; +#endif // !PROPERTYKEY_DEFINED + +#define REFPROPERTYKEY const PROPERTYKEY & + +#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) \ + const PROPERTYKEY name = \ + { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } + +DEFINE_PROPERTYKEY(PKEY_Title, + 0xf29f85e0, 0x4ff9, 0x1068, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9, 2); +DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDestListSeparator, + 0x9f4c2855, 0x9f79, 0x4b39, 0xa8, 0xd0, 0xe1, 0xd4, 0x2d, 0xe1, 0xd5, 0xf3, 6); +DEFINE_PROPERTYKEY(PKEY_Link_Arguments, + 0x436f2667, 0x14e2, 0x4feb, 0xb3, 0x0a, 0x14, 0x6c, 0x53, 0xb5, 0xb6, 0x74, 100); + +#ifdef wxUSE_UNICODE +#define IShellLink wxIShellLinkW + +DEFINE_GUID(wxIID_IShellLink, + 0x000214F9, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +#else +#define IShellLink wxIShellLinkA + +DEFINE_GUID(wxIID_IShellLink, + 0x000214EE, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +#endif // wxUSE_UNICODE + +typedef enum _SIGDN +{ + SIGDN_NORMALDISPLAY = 0, + SIGDN_PARENTRELATIVEPARSING = (int)0x80018001, + SIGDN_DESKTOPABSOLUTEPARSING = (int)0x80028000, + SIGDN_PARENTRELATIVEEDITING = (int)0x80031001, + SIGDN_DESKTOPABSOLUTEEDITING = (int)0x8004c000, + SIGDN_FILESYSPATH = (int)0x80058000, + SIGDN_URL = (int)0x80068000, + SIGDN_PARENTRELATIVEFORADDRESSBAR = (int)0x8007c001, + SIGDN_PARENTRELATIVE = (int)0x80080001 +} SIGDN; + +enum _SICHINTF +{ + SICHINT_DISPLAY = 0, + SICHINT_ALLFIELDS = (int)0x80000000, + SICHINT_CANONICAL = 0x10000000, + SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000 +}; + +typedef DWORD SICHINTF; +typedef ULONG SFGAOF; + +typedef enum KNOWNDESTCATEGORY +{ + KDC_FREQUENT = 1, + KDC_RECENT = ( KDC_FREQUENT + 1 ) +} KNOWNDESTCATEGORY; + +typedef enum APPDOCLISTTYPE +{ + ADLT_RECENT = 0, + ADLT_FREQUENT = ( ADLT_RECENT + 1 ) +} APPDOCLISTTYPE; + +} // anonymous namespace + +class wxITaskbarList : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL HrInit() = 0; + virtual HRESULT wxSTDCALL AddTab(HWND) = 0; + virtual HRESULT wxSTDCALL DeleteTab(HWND) = 0; + virtual HRESULT wxSTDCALL ActivateTab(HWND) = 0; + virtual HRESULT wxSTDCALL SetActiveAlt(HWND) = 0; +}; + +class wxITaskbarList2 : public wxITaskbarList +{ +public: + virtual HRESULT wxSTDCALL MarkFullscreenWindow(HWND, BOOL) = 0; +}; + +class wxIShellLinkA : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetPath(LPSTR, int, WIN32_FIND_DATAA*, DWORD) = 0; + virtual HRESULT wxSTDCALL GetIDList(LPITEMIDLIST *ppidl) = 0; + virtual HRESULT wxSTDCALL SetIDList(LPCITEMIDLIST pidl) = 0; + virtual HRESULT wxSTDCALL GetDescription(LPSTR, int) = 0; + virtual HRESULT wxSTDCALL SetDescription(LPCSTR) = 0; + virtual HRESULT wxSTDCALL GetWorkingDirectory(LPSTR, int) = 0; + virtual HRESULT wxSTDCALL SetWorkingDirectory(LPCSTR) = 0; + virtual HRESULT wxSTDCALL GetArguments(LPSTR, int) = 0; + virtual HRESULT wxSTDCALL SetArguments(LPCSTR) = 0; + virtual HRESULT wxSTDCALL GetHotkey(WORD*) = 0; + virtual HRESULT wxSTDCALL SetHotkey(WORD) = 0; + virtual HRESULT wxSTDCALL GetShowCmd(int*) = 0; + virtual HRESULT wxSTDCALL SetShowCmd(int) = 0; + virtual HRESULT wxSTDCALL GetIconLocation(LPSTR, int, int*) = 0; + virtual HRESULT wxSTDCALL SetIconLocation(LPCSTR, int) = 0; + virtual HRESULT wxSTDCALL SetRelativePath(LPCSTR, DWORD) = 0; + virtual HRESULT wxSTDCALL Resolve(HWND, DWORD) = 0; + virtual HRESULT wxSTDCALL SetPath(LPCSTR) = 0; +}; + +class wxIShellLinkW : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetPath(LPWSTR, int, WIN32_FIND_DATAW*, DWORD) = 0; + virtual HRESULT wxSTDCALL GetIDList(LPITEMIDLIST *ppidl) = 0; + virtual HRESULT wxSTDCALL SetIDList(LPCITEMIDLIST pidl) = 0; + virtual HRESULT wxSTDCALL GetDescription(LPWSTR, int) = 0; + virtual HRESULT wxSTDCALL SetDescription(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL GetWorkingDirectory(LPWSTR, int) = 0; + virtual HRESULT wxSTDCALL SetWorkingDirectory(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL GetArguments(LPWSTR, int) = 0; + virtual HRESULT wxSTDCALL SetArguments(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL GetHotkey(WORD*) = 0; + virtual HRESULT wxSTDCALL SetHotkey(WORD) = 0; + virtual HRESULT wxSTDCALL GetShowCmd(int*) = 0; + virtual HRESULT wxSTDCALL SetShowCmd(int) = 0; + virtual HRESULT wxSTDCALL GetIconLocation(LPWSTR, int, int*) = 0; + virtual HRESULT wxSTDCALL SetIconLocation(LPCWSTR, int) = 0; + virtual HRESULT wxSTDCALL SetRelativePath(LPCWSTR, DWORD) = 0; + virtual HRESULT wxSTDCALL Resolve(HWND, DWORD) = 0; + virtual HRESULT wxSTDCALL SetPath(LPCWSTR) = 0; +}; + +class IShellItem : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL BindToHandler(IBindCtx*, REFGUID, REFIID, void **) = 0; + virtual HRESULT wxSTDCALL GetParent(IShellItem **) = 0; + virtual HRESULT wxSTDCALL GetDisplayName(SIGDN, LPWSTR*) = 0; + virtual HRESULT wxSTDCALL GetAttributes(SFGAOF, SFGAOF*) = 0; + virtual HRESULT wxSTDCALL Compare(IShellItem *, SICHINTF, int *) = 0; +}; + +class IObjectArray : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetCount(UINT*) = 0; + virtual HRESULT wxSTDCALL GetAt(UINT, REFIID, void **) = 0; +}; + +class IObjectCollection : public IObjectArray +{ +public: + virtual HRESULT wxSTDCALL AddObject(IUnknown *) = 0; + virtual HRESULT wxSTDCALL AddFromArray(IObjectArray *) = 0; + virtual HRESULT wxSTDCALL RemoveObjectAt(UINT) = 0; + virtual HRESULT wxSTDCALL Clear() = 0; +}; + +class IPropertyStore : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL GetCount(DWORD *) = 0; + virtual HRESULT wxSTDCALL GetAt(DWORD, PROPERTYKEY *) = 0; + virtual HRESULT wxSTDCALL GetValue(REFPROPERTYKEY, PROPVARIANT *) = 0; + virtual HRESULT wxSTDCALL SetValue(REFPROPERTYKEY, const PROPVARIANT&) = 0; + virtual HRESULT wxSTDCALL Commit() = 0; +}; + +class ICustomDestinationList : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL SetAppID(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL BeginList(UINT*, REFIID, void**) = 0; + virtual HRESULT wxSTDCALL AppendCategory(LPCWSTR, IObjectArray *) = 0; + virtual HRESULT wxSTDCALL AppendKnownCategory(KNOWNDESTCATEGORY) = 0; + virtual HRESULT wxSTDCALL AddUserTasks(IObjectArray *) = 0; + virtual HRESULT wxSTDCALL CommitList() = 0; + virtual HRESULT wxSTDCALL GetRemovedDestinations(REFIID, void**) = 0; + virtual HRESULT wxSTDCALL DeleteList(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL AbortList() = 0; +}; + +class IApplicationDocumentLists : public IUnknown +{ +public: + virtual HRESULT wxSTDCALL SetAppID(LPCWSTR) = 0; + virtual HRESULT wxSTDCALL GetList(APPDOCLISTTYPE, UINT, REFIID, void**) = 0; +}; + +namespace +{ + +inline HRESULT InitPropVariantFromBoolean(BOOL fVal, PROPVARIANT *ppropvar) +{ + ppropvar->vt = VT_BOOL; + ppropvar->boolVal = fVal ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + +inline HRESULT InitPropVariantFromString(PCWSTR psz, PROPVARIANT *ppropvar) +{ + HRESULT hr = E_FAIL; + ppropvar->vt = VT_LPWSTR; + +#if wxUSE_DYNLIB_CLASS + typedef HRESULT (WINAPI *SHStrDupW_t)(LPCWSTR, LPWSTR*); + static SHStrDupW_t s_pfnSHStrDupW = NULL; + if ( !s_pfnSHStrDupW ) + { + wxDynamicLibrary dll(wxT("shlwapi.dll")); + if ( dll.IsLoaded() ) + { + s_pfnSHStrDupW = (SHStrDupW_t)dll.GetSymbol(wxT("SHStrDupW")); + } + } + + if ( s_pfnSHStrDupW ) + { + hr = s_pfnSHStrDupW(psz, &ppropvar->pwszVal); + } +#elif defined (_MSC_VER) + hr = SHStrDupW(psz, &ppropvar->pwszVal); +#else + wxUnusedVar(psz); +#endif + + if ( FAILED(hr) ) + { + PropVariantInit(ppropvar); + } + return hr; +} + +THUMBBUTTONFLAGS GetNativeThumbButtonFlags(const wxThumbBarButton& button) +{ + WXUINT flags = 0; + flags |= (button.IsEnable() ? THBF_ENABLED : THBF_DISABLED); + if ( button.IsDismissOnClick() ) + flags |= THBF_DISMISSONCLICK; + if ( !button.HasBackground() ) + flags |= THBF_NOBACKGROUND; + if ( !button.IsShown() ) + flags |= THBF_HIDDEN; + if ( !button.IsInteractive() ) + flags |= THBF_NONINTERACTIVE; + return static_cast(flags); +} + +bool AddShellLink(IObjectCollection *collection, + const wxTaskBarJumpListItem& item) +{ + wxCOMPtr shellLink; + wxCOMPtr propertyStore; + + HRESULT hr = CoCreateInstance + ( + wxCLSID_ShellLink, + NULL, + CLSCTX_INPROC_SERVER, + wxIID_IShellLink, + reinterpret_cast (&(shellLink)) + ); + if ( FAILED(hr) ) + { + wxLogApiError("CoCreateInstance(wxCLSID_ShellLink)", hr); + return false; + } + + if ( item.GetType() == wxTASKBAR_JUMP_LIST_TASK || + item.GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION ) + { + if ( !item.GetFilePath().IsEmpty() ) + shellLink->SetPath(item.GetFilePath().wc_str()); + if ( !item.GetArguments().IsEmpty() ) + shellLink->SetArguments(item.GetArguments().wc_str()); + if ( !item.GetIconPath().IsEmpty() ) + { + shellLink->SetIconLocation(item.GetIconPath().wc_str(), + item.GetIconIndex()); + } + if ( !item.GetTooltip().IsEmpty() ) + shellLink->SetDescription(item.GetTooltip().wc_str()); + } + + hr = shellLink->QueryInterface(wxIID_IPropertyStore, + reinterpret_cast(&(propertyStore))); + if ( FAILED(hr) ) + { + wxLogApiError("IShellLink(QueryInterface)", hr); + return false; + } + + PROPVARIANT pv; + if ( item.GetType() == wxTASKBAR_JUMP_LIST_TASK || + item.GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION ) + { + hr = InitPropVariantFromString(item.GetTitle().wc_str(), &pv); + if ( SUCCEEDED(hr) ) + { + hr = propertyStore->SetValue(PKEY_Title, pv); + } + } + else if ( item.GetType() == wxTASKBAR_JUMP_LIST_SEPARATOR ) + { + hr = InitPropVariantFromBoolean(TRUE, &pv); + if ( SUCCEEDED(hr) ) + { + hr = propertyStore->SetValue(PKEY_AppUserModel_IsDestListSeparator, + pv); + } + } + + // Save the changes we made to the property store. + propertyStore->Commit(); + PropVariantClear(&pv); + + // Add this IShellLink object to the given collection. + hr = collection->AddObject(shellLink); + + return SUCCEEDED(hr); +} + +wxTaskBarJumpListItem* GetItemFromIShellLink(IShellLink* link) +{ + if ( !link ) + return NULL; + + wxTaskBarJumpListItem* item = + new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTIONATION); + + wxCOMPtr linkProps; + HRESULT hr = link->QueryInterface + ( + wxIID_IPropertyStore, + reinterpret_cast(&linkProps) + ); + if ( FAILED(hr) ) + { + wxLogApiError("IShellLink::QueryInterface", hr); + return NULL; + } + + PROPVARIANT var; + linkProps->GetValue(PKEY_Link_Arguments, &var); + item->SetArguments(wxString(var.pwszVal)); + PropVariantClear(&var); + + const int bufferSize = 2048; + wchar_t buffer[bufferSize]; + + link->GetDescription(buffer, INFOTIPSIZE); + item->SetTooltip(wxString(buffer)); + + int dummyIndex; + link->GetIconLocation(buffer, bufferSize - 1, &dummyIndex); + item->SetIconPath(wxString(buffer)); + + link->GetPath(buffer, bufferSize - 1, NULL, 0x1); + item->SetFilePath(wxString(buffer)); + + return item; +} + +wxTaskBarJumpListItem* GetItemFromIShellItem(IShellItem *shellItem) +{ + if ( !shellItem ) + return NULL; + + wxTaskBarJumpListItem *item = + new wxTaskBarJumpListItem(NULL, wxTASKBAR_JUMP_LIST_DESTIONATION); + + wchar_t *name; + shellItem->GetDisplayName(SIGDN_FILESYSPATH, &name); + item->SetFilePath(wxString(name)); + CoTaskMemFree(name); + return item; +} + +IObjectCollection* CreateObjectCollection() +{ + IObjectCollection* collection; + + HRESULT hr; + hr = CoCreateInstance + ( + wxCLSID_EnumerableObjectCollection, + NULL, + CLSCTX_INPROC, + wxIID_IObjectCollection, + reinterpret_cast(&(collection)) + ); + if ( FAILED(hr) ) + { + wxLogApiError("CoCreateInstance(wxCLSID_EnumerableObjectCollection)", + hr); + return NULL; + } + + return collection; +} + +} // namespace + +class wxITaskbarList3 : public wxITaskbarList2 +{ +public: + virtual HRESULT wxSTDCALL SetProgressValue(HWND, ULONGLONG, ULONGLONG) = 0; + virtual HRESULT wxSTDCALL SetProgressState(HWND, TBPFLAG) = 0; + virtual HRESULT wxSTDCALL RegisterTab(HWND, HWND) = 0; + virtual HRESULT wxSTDCALL UnregisterTab(HWND) = 0; + virtual HRESULT wxSTDCALL SetTabOrder(HWND, HWND) = 0; + virtual HRESULT wxSTDCALL SetTabActive(HWND, HWND, DWORD) = 0; + virtual HRESULT wxSTDCALL ThumbBarAddButtons(HWND, UINT, LPTHUMBBUTTON) = 0; + virtual + HRESULT wxSTDCALL ThumbBarUpdateButtons(HWND, UINT, LPTHUMBBUTTON) = 0; + virtual HRESULT wxSTDCALL ThumbBarSetImageList(HWND, ::HIMAGELIST) = 0; + virtual HRESULT wxSTDCALL SetOverlayIcon(HWND, HICON, LPCWSTR) = 0; + virtual HRESULT wxSTDCALL SetThumbnailTooltip(HWND, LPCWSTR pszTip) = 0; + virtual HRESULT wxSTDCALL SetThumbnailClip(HWND, RECT *) = 0; +}; + +// ---------------------------------------------------------------------------- +// wxTaskBarJumpListImpl: definition of class for internal taskbar jump list +// implementation. +// ---------------------------------------------------------------------------- +class wxTaskBarJumpListImpl +{ +public: + wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList = NULL, + const wxString& appID = wxEmptyString); + virtual ~wxTaskBarJumpListImpl(); + void ShowRecentCategory(bool shown = true); + void HideRecentCategory(); + void ShowFrequentCategory(bool shown = true); + void HideFrequentCategory(); + + wxTaskBarJumpListCategory& GetTasks(); + const wxTaskBarJumpListCategory& GetFrequentCategory(); + const wxTaskBarJumpListCategory& GetRecentCategory(); + const wxTaskBarJumpListCategories& GetCustomCategories() const; + + void AddCustomCategory(wxTaskBarJumpListCategory* category); + wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title); + void DeleteCustomCategory(const wxString& title); + void Update(); + +private: + bool BeginUpdate(); + bool CommitUpdate(); + void AddTasksToDestinationList(); + void AddCustomCategoriesToDestionationList(); + void LoadKnownCategory(const wxString& title); + + wxTaskBarJumpList *m_jumpList; + + wxCOMPtr m_destinationList; + wxCOMPtr m_objectArray; + + wxScopedPtr m_tasks; + wxScopedPtr m_frequent; + wxScopedPtr m_recent; + wxTaskBarJumpListCategories m_customCategories; + bool m_recent_visible; + bool m_frequent_visible; + + // Application User Model ID. + wxString m_appID; +}; + +// ---------------------------------------------------------------------------- +// wxThumbBarButton Implementation. +// ---------------------------------------------------------------------------- +wxIMPLEMENT_DYNAMIC_CLASS(wxThumbBarButton, wxObject); + +wxThumbBarButton::wxThumbBarButton(int id, + const wxIcon& icon, + const wxString& tooltip, + bool enable, + bool dismissOnClick, + bool hasBackground, + bool shown, + bool interactive) + : m_id(id), + m_icon(icon), + m_tooltip(tooltip), + m_enable(enable), + m_dismissOnClick(dismissOnClick), + m_hasBackground(hasBackground), + m_shown(shown), + m_interactive(interactive), + m_taskBarButtonParent(NULL) +{ +} + +bool wxThumbBarButton::Create(int id, + const wxIcon& icon, + const wxString& tooltip, + bool enable, + bool dismissOnClick, + bool hasBackground, + bool shown, + bool interactive) +{ + m_id = id; + m_icon = icon; + m_tooltip = tooltip; + m_enable = enable; + m_dismissOnClick = dismissOnClick; + m_hasBackground = hasBackground; + m_shown = shown; + m_interactive = interactive; + return true; +} + +void wxThumbBarButton::Enable(bool enable) +{ + if ( m_enable != enable ) + { + m_enable = enable; + UpdateParentTaskBarButton(); + } +} + +void wxThumbBarButton::SetHasBackground(bool has) +{ + if ( m_hasBackground != has ) + { + m_hasBackground = has; + UpdateParentTaskBarButton(); + } +} + +void wxThumbBarButton::EnableDismissOnClick(bool enable) +{ + if ( m_dismissOnClick != enable ) + { + m_dismissOnClick = enable; + UpdateParentTaskBarButton(); + } +} + +void wxThumbBarButton::Show(bool shown) +{ + if ( m_shown != shown ) + { + m_shown = shown; + UpdateParentTaskBarButton(); + } +} + +void wxThumbBarButton::SetInteractive(bool interactive) +{ + if ( m_interactive != interactive ) + { + m_interactive = interactive; + UpdateParentTaskBarButton(); + } +} + +bool wxThumbBarButton::UpdateParentTaskBarButton() +{ + if ( !m_taskBarButtonParent ) + return false; + + return static_cast( + m_taskBarButtonParent)->InitOrUpdateThumbBarButtons(); +} + +// ---------------------------------------------------------------------------- +// wxTaskBarButtonImpl Implementation. +// ---------------------------------------------------------------------------- + +/* static */ +wxTaskBarButton* wxTaskBarButton::New(wxWindow* parent) +{ + wxITaskbarList3* taskbarList = NULL; + + HRESULT hr = CoCreateInstance + ( + wxCLSID_TaskbarList, + NULL, + CLSCTX_INPROC_SERVER, + wxIID_ITaskbarList3, + reinterpret_cast(&taskbarList) + ); + if ( FAILED(hr) ) + { + // Don't log this error, it may be normal when running under XP. + return NULL; + } + + hr = taskbarList->HrInit(); + if ( FAILED(hr) ) + { + // This is however unexpected. + wxLogApiError(wxT("ITaskbarList3::Init"), hr); + + taskbarList->Release(); + return NULL; + } + + return new wxTaskBarButtonImpl(taskbarList, parent); +} + +wxTaskBarButtonImpl::wxTaskBarButtonImpl(wxITaskbarList3* taskbarList, + wxWindow* parent) + : m_parent(parent), + m_taskbarList(taskbarList), + m_progressRange(0), + m_progressValue(0), + m_progressState(wxTASKBAR_BUTTON_NO_PROGRESS), + m_hasInitThumbnailToolbar(false) +{ +} + +wxTaskBarButtonImpl::~wxTaskBarButtonImpl() +{ + if ( m_taskbarList ) + m_taskbarList->Release(); + + for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); + iter != m_thumbBarButtons.end(); + ++iter) + { + delete (*iter); + } + m_thumbBarButtons.clear(); +} + +void wxTaskBarButtonImpl::Realize() +{ + // (Re-)apply all settings: this is needed if settings were made before the + // create message was sent, taskbar icon is hidden and shown again or + // explorer is restarted + SetProgressRange(m_progressRange); + SetProgressState(m_progressState); + if ( m_progressValue > 0 ) + SetProgressValue(m_progressValue); + SetThumbnailTooltip(m_thumbnailTooltip); + SetOverlayIcon(m_overlayIcon, m_overlayIconDescription); + if ( !m_thumbnailClipRect.IsEmpty() ) + SetThumbnailClip(m_thumbnailClipRect); + m_hasInitThumbnailToolbar = false; + InitOrUpdateThumbBarButtons(); +} + +void wxTaskBarButtonImpl::SetProgressRange(int range) +{ + m_progressRange = range; + if ( m_progressRange == 0 ) + SetProgressState(wxTASKBAR_BUTTON_NO_PROGRESS); +} + +void wxTaskBarButtonImpl::SetProgressValue(int value) +{ + m_progressValue = value; + m_taskbarList->SetProgressValue(m_parent->GetHWND(), value, m_progressRange); +} + +void wxTaskBarButtonImpl::PulseProgress() +{ + SetProgressState(wxTASKBAR_BUTTON_INDETERMINATE); +} + +void wxTaskBarButtonImpl::Show(bool show) +{ + if ( show ) + m_taskbarList->AddTab(m_parent->GetHWND()); + else + m_taskbarList->DeleteTab(m_parent->GetHWND()); +} + +void wxTaskBarButtonImpl::Hide() +{ + Show(false); +} + +void wxTaskBarButtonImpl::SetThumbnailTooltip(const wxString& tooltip) +{ + m_thumbnailTooltip = tooltip; + m_taskbarList->SetThumbnailTooltip(m_parent->GetHWND(), tooltip.wc_str()); +} + +void wxTaskBarButtonImpl::SetProgressState(wxTaskBarButtonState state) +{ + m_progressState = state; + m_taskbarList->SetProgressState(m_parent->GetHWND(), static_cast(state)); +} + +void wxTaskBarButtonImpl::SetOverlayIcon(const wxIcon& icon, + const wxString& description) +{ + m_overlayIcon = icon; + m_overlayIconDescription = description; + m_taskbarList->SetOverlayIcon(m_parent->GetHWND(), + GetHiconOf(icon), + description.wc_str()); +} + +void wxTaskBarButtonImpl::SetThumbnailClip(const wxRect& rect) +{ + m_thumbnailClipRect = rect; + RECT rc; + wxCopyRectToRECT(rect, rc); + m_taskbarList->SetThumbnailClip(m_parent->GetHWND(), rect.IsEmpty() ? NULL : &rc); +} + +void wxTaskBarButtonImpl::SetThumbnailContents(const wxWindow *child) +{ + SetThumbnailClip(child->GetRect()); +} + +bool wxTaskBarButtonImpl::AppendThumbBarButton(wxThumbBarButton *button) +{ + wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT, + "Number of ThumbBarButtons and separators is limited to 7" ); + + button->SetParent(this); + m_thumbBarButtons.push_back(button); + return InitOrUpdateThumbBarButtons(); +} + +bool wxTaskBarButtonImpl::AppendSeparatorInThumbBar() +{ + wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT, + "Number of ThumbBarButtons and separators is limited to 7" ); + + // Append a disable ThumbBarButton without background can simulate the + // behavior of appending a separator. + wxThumbBarButton *separator = new wxThumbBarButton(wxID_ANY, + wxNullIcon, + wxEmptyString, + false, + false, + false); + m_thumbBarButtons.push_back(separator); + return InitOrUpdateThumbBarButtons(); +} + +bool wxTaskBarButtonImpl::InsertThumbBarButton(size_t pos, + wxThumbBarButton *button) +{ + wxASSERT_MSG( m_thumbBarButtons.size() < MAX_BUTTON_COUNT, + "Number of ThumbBarButtons and separators is limited to 7" ); + wxASSERT_MSG( pos <= m_thumbBarButtons.size(), + "Invalid index when inserting the button" ); + + button->SetParent(this); + m_thumbBarButtons.insert(m_thumbBarButtons.begin() + pos, button); + return InitOrUpdateThumbBarButtons(); +} + +wxThumbBarButton* wxTaskBarButtonImpl::RemoveThumbBarButton( + wxThumbBarButton *button) +{ + for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); + iter != m_thumbBarButtons.end(); + ++iter ) + { + if ( button == *iter ) + { + m_thumbBarButtons.erase(iter); + button->SetParent(NULL); + InitOrUpdateThumbBarButtons(); + return *iter; + } + } + + return NULL; +} + +wxThumbBarButton* wxTaskBarButtonImpl::RemoveThumbBarButton(int id) +{ + for ( wxThumbBarButtons::iterator iter = m_thumbBarButtons.begin(); + iter != m_thumbBarButtons.end(); + ++iter ) + { + if ( id == (*iter)->GetID() ) + { + m_thumbBarButtons.erase(iter); + (*iter)->SetParent(NULL); + InitOrUpdateThumbBarButtons(); + return *iter; + } + } + + return NULL; +} + +bool wxTaskBarButtonImpl::InitOrUpdateThumbBarButtons() +{ + THUMBBUTTON buttons[MAX_BUTTON_COUNT]; + HRESULT hr; + + for ( size_t i = 0; i < MAX_BUTTON_COUNT; ++i ) + { + memset(&buttons[i], 0, sizeof buttons[i]); + buttons[i].iId = i; + buttons[i].dwFlags = THBF_HIDDEN; + buttons[i].dwMask = static_cast(THB_FLAGS); + } + + for ( size_t i = 0; i < m_thumbBarButtons.size(); ++i ) + { + buttons[i].hIcon = GetHiconOf(m_thumbBarButtons[i]->GetIcon()); + buttons[i].dwFlags = GetNativeThumbButtonFlags(*m_thumbBarButtons[i]); + buttons[i].dwMask = static_cast(THB_ICON | THB_FLAGS); + wxString tooltip = m_thumbBarButtons[i]->GetTooltip(); + if ( tooltip.empty() ) + continue; + + // Truncate the tooltip if its length longer than szTip(THUMBBUTTON) + // allowed length (260). + tooltip.Truncate(260); + wxStrlcpy(buttons[i].szTip, tooltip.wc_str(), tooltip.length()); + buttons[i].dwMask = + static_cast(buttons[i].dwMask | THB_TOOLTIP); + } + + if ( !m_hasInitThumbnailToolbar ) + { + hr = m_taskbarList->ThumbBarAddButtons(m_parent->GetHWND(), + MAX_BUTTON_COUNT, + buttons); + if ( FAILED(hr) ) + { + wxLogApiError(wxT("ITaskbarList3::ThumbBarAddButtons"), hr); + } + m_hasInitThumbnailToolbar = true; + } + else + { + hr = m_taskbarList->ThumbBarUpdateButtons(m_parent->GetHWND(), + MAX_BUTTON_COUNT, + buttons); + if ( FAILED(hr) ) + { + wxLogApiError(wxT("ITaskbarList3::ThumbBarUpdateButtons"), hr); + } + } + + return SUCCEEDED(hr); +} + +wxThumbBarButton* wxTaskBarButtonImpl::GetThumbBarButtonByIndex(size_t index) +{ + if ( index >= m_thumbBarButtons.size() ) + return NULL; + + return m_thumbBarButtons[index]; +} + +// ---------------------------------------------------------------------------- +// wxTaskBarJumpListItem Implementation. +// ---------------------------------------------------------------------------- +wxTaskBarJumpListItem::wxTaskBarJumpListItem(wxTaskBarJumpListCategory *parent, + wxTaskBarJumpListItemType type, + const wxString& title, + const wxString& filePath, + const wxString& arguments, + const wxString& tooltip, + const wxString& iconPath, + int iconIndex) + : m_parentCategory(parent), + m_type(type), + m_title(title), + m_filePath(filePath), + m_arguments(arguments), + m_tooltip(tooltip), + m_iconPath(iconPath), + m_iconIndex(iconIndex) +{ +} + +wxTaskBarJumpListItemType wxTaskBarJumpListItem::GetType() const +{ + return m_type; +} + +void wxTaskBarJumpListItem::SetType(wxTaskBarJumpListItemType type) +{ + m_type = type; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +const wxString& wxTaskBarJumpListItem::GetTitle() const +{ + return m_title; +} + +void wxTaskBarJumpListItem::SetTitle(const wxString& title) +{ + m_title = title; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +const wxString& wxTaskBarJumpListItem::GetFilePath() const +{ + return m_filePath; +} + +void wxTaskBarJumpListItem::SetFilePath(const wxString& filePath) +{ + m_filePath = filePath; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +const wxString& wxTaskBarJumpListItem::GetArguments() const +{ + return m_arguments; +} + +void wxTaskBarJumpListItem::SetArguments(const wxString& arguments) +{ + m_arguments = arguments; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +const wxString& wxTaskBarJumpListItem::GetTooltip() const +{ + return m_tooltip; +} + +void wxTaskBarJumpListItem::SetTooltip(const wxString& tooltip) +{ + m_tooltip = tooltip; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +const wxString& wxTaskBarJumpListItem::GetIconPath() const +{ + return m_iconPath; +} + +void wxTaskBarJumpListItem::SetIconPath(const wxString& iconPath) +{ + m_iconPath = iconPath; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +int wxTaskBarJumpListItem::GetIconIndex() const +{ + return m_iconIndex; +} + +void wxTaskBarJumpListItem::SetIconIndex(int iconIndex) +{ + m_iconIndex = iconIndex; + if ( m_parentCategory ) + m_parentCategory->Update(); +} + +wxTaskBarJumpListCategory* wxTaskBarJumpListItem::GetCategory() const +{ + return m_parentCategory; +} + +void wxTaskBarJumpListItem::SetCategory(wxTaskBarJumpListCategory *category) +{ + m_parentCategory = category; +} + +// ---------------------------------------------------------------------------- +// wxTaskBarJumpListCategory Implementation. +// ---------------------------------------------------------------------------- +wxTaskBarJumpListCategory::wxTaskBarJumpListCategory(wxTaskBarJumpList *parent, + const wxString& title) + : m_parent(parent), + m_title(title) +{ +} + +wxTaskBarJumpListCategory::~wxTaskBarJumpListCategory() +{ + for ( wxTaskBarJumpListItems::iterator it = m_items.begin(); + it != m_items.end(); + ++it ) + { + delete *it; + } +} + +wxTaskBarJumpListItem* +wxTaskBarJumpListCategory::Append(wxTaskBarJumpListItem *item) +{ + m_items.push_back(item); + item->SetCategory(this); + Update(); + + return item; +} + +void wxTaskBarJumpListCategory::Delete(wxTaskBarJumpListItem *item) +{ + item = Remove(item); + item->SetCategory(NULL); + Update(); + + if ( item ) + delete item; +} + +wxTaskBarJumpListItem* +wxTaskBarJumpListCategory::Remove(wxTaskBarJumpListItem *item) +{ + for (wxTaskBarJumpListItems::iterator it = m_items.begin(); + it != m_items.end(); + ++it) + { + if ( *it == item ) + { + m_items.erase(it); + item->SetCategory(NULL); + Update(); + return item; + } + } + + return NULL; +} + +wxTaskBarJumpListItem* +wxTaskBarJumpListCategory::FindItemByPosition(size_t pos) const +{ + wxASSERT_MSG( pos < m_items.size(), "invalid pos." ); + return m_items[pos]; +} + +wxTaskBarJumpListItem* +wxTaskBarJumpListCategory::Insert(size_t pos, wxTaskBarJumpListItem *item) +{ + wxASSERT_MSG( pos <= m_items.size(), "invalid pos." ); + m_items.insert(m_items.begin() + pos, item); + item->SetCategory(this); + Update(); + + return item; +} + +wxTaskBarJumpListItem* +wxTaskBarJumpListCategory::Prepend(wxTaskBarJumpListItem *item) +{ + return Insert(0, item); +} + +void wxTaskBarJumpListCategory::SetTitle(const wxString& title) +{ + m_title = title; + Update(); +} + +const wxString& wxTaskBarJumpListCategory::GetTitle() const +{ + return m_title; +} + +const wxTaskBarJumpListItems& wxTaskBarJumpListCategory::GetItems() const +{ + return m_items; +} + +void wxTaskBarJumpListCategory::Update() +{ + if ( m_parent ) + m_parent->Update(); +} + +// ---------------------------------------------------------------------------- +// wxTaskBarJumpList Implementation. +// ---------------------------------------------------------------------------- +wxTaskBarJumpList::wxTaskBarJumpList(const wxString& appID) + : m_jumpListImpl(new wxTaskBarJumpListImpl(this, appID)) +{ +} + +wxTaskBarJumpList::~wxTaskBarJumpList() +{ + delete m_jumpListImpl; +} + +wxTaskBarJumpListCategory& wxTaskBarJumpList::GetTasks() const +{ + return m_jumpListImpl->GetTasks(); +} + +void wxTaskBarJumpList::ShowRecentCategory(bool shown) +{ + m_jumpListImpl->ShowRecentCategory(shown); +} + +void wxTaskBarJumpList::HideRecentCategory() +{ + m_jumpListImpl->HideRecentCategory(); +} + +void wxTaskBarJumpList::ShowFrequentCategory(bool shown) +{ + m_jumpListImpl->ShowFrequentCategory(shown); +} + +void wxTaskBarJumpList::HideFrequentCategory() +{ + m_jumpListImpl->HideFrequentCategory(); +} + +const wxTaskBarJumpListCategory& wxTaskBarJumpList::GetFrequentCategory() const +{ + return m_jumpListImpl->GetFrequentCategory(); +} + +const wxTaskBarJumpListCategory& wxTaskBarJumpList::GetRecentCategory() const +{ + return m_jumpListImpl->GetRecentCategory(); +} + +const wxTaskBarJumpListCategories& +wxTaskBarJumpList::GetCustomCategories() const +{ + return m_jumpListImpl->GetCustomCategories(); +} + +void wxTaskBarJumpList::AddCustomCategory(wxTaskBarJumpListCategory* category) +{ + m_jumpListImpl->AddCustomCategory(category); +} + +wxTaskBarJumpListCategory* wxTaskBarJumpList::RemoveCustomCategory( + const wxString& title) +{ + return m_jumpListImpl->RemoveCustomCategory(title); +} + +void wxTaskBarJumpList::DeleteCustomCategory(const wxString& title) +{ + m_jumpListImpl->DeleteCustomCategory(title); +} + +void wxTaskBarJumpList::Update() +{ + m_jumpListImpl->Update(); +} + +// ---------------------------------------------------------------------------- +// wxTaskBarJumpListImpl Implementation. +// ---------------------------------------------------------------------------- +wxTaskBarJumpListImpl::wxTaskBarJumpListImpl(wxTaskBarJumpList *jumpList, + const wxString& appID) + : m_jumpList(jumpList), + m_destinationList(NULL) +{ + m_appID = appID; + HRESULT hr = CoCreateInstance + ( + wxCLSID_DestinationList, + NULL, + CLSCTX_INPROC_SERVER, + wxIID_ICustomDestinationList, + reinterpret_cast (&(m_destinationList)) + ); + if ( FAILED(hr) ) + { + wxLogApiError(wxT("CoCreateInstance(wxCLSID_DestinationList)"), hr); + return; + } +} + +wxTaskBarJumpListImpl::~wxTaskBarJumpListImpl() +{ + for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin(); + it != m_customCategories.end(); + ++it ) + { + delete *it; + } +} + +void wxTaskBarJumpListImpl::Update() +{ + if ( !BeginUpdate() ) + return; + + AddTasksToDestinationList(); + AddCustomCategoriesToDestionationList(); + if ( m_recent_visible ) + m_destinationList->AppendKnownCategory(KDC_RECENT); + if ( m_frequent_visible ) + m_destinationList->AppendKnownCategory(KDC_FREQUENT); + CommitUpdate(); +} + +wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetTasks() +{ + if ( m_tasks.get() == NULL ) + m_tasks.reset(new wxTaskBarJumpListCategory(m_jumpList, wxT("Tasks"))); + + return *(m_tasks.get()); +} + +void wxTaskBarJumpListImpl::ShowRecentCategory(bool shown) +{ + m_recent_visible = shown; +} + +void wxTaskBarJumpListImpl::HideRecentCategory() +{ + ShowRecentCategory(false); +} + +void wxTaskBarJumpListImpl::ShowFrequentCategory(bool shown) +{ + m_frequent_visible = shown; +} + +void wxTaskBarJumpListImpl::HideFrequentCategory() +{ + ShowFrequentCategory(false); +} + +const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetFrequentCategory() +{ + wxString title = wxT("Frequent"); + if ( m_frequent.get() == NULL ) + m_frequent.reset(new wxTaskBarJumpListCategory(m_jumpList, title)); + LoadKnownCategory(title); + + return *m_frequent.get(); +} + +const wxTaskBarJumpListCategory& wxTaskBarJumpListImpl::GetRecentCategory() +{ + wxString title = wxT("Recent"); + if ( m_recent.get() == NULL ) + m_recent.reset(new wxTaskBarJumpListCategory(m_jumpList, title)); + LoadKnownCategory(title); + + return *m_recent.get(); +} + +const wxTaskBarJumpListCategories& +wxTaskBarJumpListImpl::GetCustomCategories() const +{ + return m_customCategories; +} + +void +wxTaskBarJumpListImpl::AddCustomCategory(wxTaskBarJumpListCategory *category) +{ + wxASSERT_MSG( category != NULL, "Invalid category." ); + m_customCategories.push_back(category); +} + +wxTaskBarJumpListCategory* +wxTaskBarJumpListImpl::RemoveCustomCategory(const wxString& title) +{ + for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin(); + it != m_customCategories.end(); + ++it ) + { + if ( (*it)->GetTitle() == title ) + { + m_customCategories.erase(it); + return *it; + } + } + + return NULL; +} + +void wxTaskBarJumpListImpl::DeleteCustomCategory(const wxString& title) +{ + wxTaskBarJumpListCategory* category = RemoveCustomCategory(title); + if ( category ) + delete category; +} + +bool wxTaskBarJumpListImpl::BeginUpdate() +{ + if ( m_destinationList == NULL ) + return false; + + unsigned int max_count = 0; + m_objectArray = NULL; + HRESULT hr = m_destinationList->BeginList(&max_count, + wxIID_IObjectArray, reinterpret_cast(&m_objectArray)); + if ( !m_appID.empty() ) + m_destinationList->SetAppID(m_appID.wc_str()); + + return SUCCEEDED(hr); +} + +bool wxTaskBarJumpListImpl::CommitUpdate() +{ + return SUCCEEDED(m_destinationList->CommitList()); +} + +void wxTaskBarJumpListImpl::AddTasksToDestinationList() +{ + if ( !m_tasks.get() ) + return; + + wxCOMPtr collection(CreateObjectCollection()); + if ( !collection ) + return; + + const wxTaskBarJumpListItems& tasks = m_tasks->GetItems(); + for ( wxTaskBarJumpListItems::const_iterator it = tasks.begin(); + it != tasks.end(); + ++it ) + { + wxASSERT_MSG( ((*it)->GetType() == wxTASKBAR_JUMP_LIST_TASK || + (*it)->GetType() == wxTASKBAR_JUMP_LIST_SEPARATOR), + "Invalid task Item." ); + AddShellLink(collection, *(*it)); + } + m_destinationList->AddUserTasks(collection); +} + +void wxTaskBarJumpListImpl::AddCustomCategoriesToDestionationList() +{ + for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin(); + it != m_customCategories.end(); + ++it ) + { + wxCOMPtr collection(CreateObjectCollection()); + if ( !collection ) + continue; + + const wxTaskBarJumpListItems& tasks = (*it)->GetItems(); + for ( wxTaskBarJumpListItems::const_iterator iter = tasks.begin(); + iter != tasks.end(); + ++iter ) + { + wxASSERT_MSG( + (*iter)->GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION, + "Invalid category item." ); + AddShellLink(collection, *(*iter)); + } + m_destinationList->AppendCategory((*it)->GetTitle().wc_str(), + collection); + } +} + +void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title) +{ + wxCOMPtr docList; + HRESULT hr = CoCreateInstance + ( + wxCLSID_ApplicationDocumentLists, + NULL, + CLSCTX_INPROC_SERVER, + wxIID_IApplicationDocumentLists, + reinterpret_cast(&docList) + ); + if ( FAILED(hr) ) + { + wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr); + return; + } + if ( !m_appID.empty() ) + docList->SetAppID(m_appID.wc_str()); + + wxCOMPtr array; + wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." ); + hr = docList->GetList + ( + title == "Recent" ? ADLT_RECENT : ADLT_FREQUENT, + 0, + wxIID_IObjectArray, + reinterpret_cast(&array) + ); + if ( FAILED(hr) ) + { + wxLogApiError("IApplicationDocumentLists::GetList", hr); + return; + } + + UINT count = 0; + array->GetCount(&count); + for (UINT i = 0; i < count; ++i) + { + wxCOMPtr collectionItem; + hr = array->GetAt(i, wxIID_IUnknown, + reinterpret_cast(&collectionItem)); + if ( FAILED(hr) ) + { + wxLogApiError("IObjectArray::GetAt", hr); + continue; + } + + wxCOMPtr shellLink; + wxCOMPtr shellItem; + wxTaskBarJumpListItem* item = NULL; + + if ( SUCCEEDED(collectionItem->QueryInterface( + wxIID_IShellLink, reinterpret_cast(&shellLink))) ) + { + item = GetItemFromIShellLink(shellLink); + } + else if ( SUCCEEDED(collectionItem->QueryInterface( + wxIID_IShellItem, reinterpret_cast(&shellItem))) ) + { + item = GetItemFromIShellItem(shellItem); + } + else + { + wxLogError("Can not query interfaces: IShellLink or IShellItem."); + } + + if ( item ) + { + if ( title == wxT("Frequent") ) + m_frequent->Append(item); + else + m_recent->Append(item); + } + } +} + +#endif // wxUSE_TASKBARBUTTON diff --git a/Externals/wxWidgets3/src/msw/textctrl.cpp b/Externals/wxWidgets3/src/msw/textctrl.cpp index d2e448cc05..9b4124e9da 100644 --- a/Externals/wxWidgets3/src/msw/textctrl.cpp +++ b/Externals/wxWidgets3/src/msw/textctrl.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_TEXTCTRL && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) +#if wxUSE_TEXTCTRL #ifndef WX_PRECOMP #include "wx/textctrl.h" @@ -40,6 +40,8 @@ #include "wx/wxcrtvararg.h" #endif +#include "wx/scopedptr.h" +#include "wx/stack.h" #include "wx/sysopt.h" #if wxUSE_CLIPBOARD @@ -52,32 +54,24 @@ #include "wx/msw/private.h" #include "wx/msw/winundef.h" -#include "wx/msw/mslu.h" #include #include -#ifndef __WXWINCE__ #include -#endif #if wxUSE_RICHEDIT - -// old mingw32 has richedit stuff directly in windows.h and doesn't have -// richedit.h at all -#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) #include -#endif - + #include + #include "wx/msw/ole/oleutils.h" #endif // wxUSE_RICHEDIT -#include "wx/msw/missing.h" - -// FIXME-VC6: This seems to be only missing from VC6 headers. -#ifndef SPI_GETCARETWIDTH - #define SPI_GETCARETWIDTH 0x2006 +#if wxUSE_INKEDIT + #include #endif +#include "wx/msw/missing.h" + #if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT // dummy value used for m_dropTarget, different from any valid pointer value @@ -87,6 +81,25 @@ static wxDropTarget * #endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT +#if wxUSE_OLE +// This must be the last header included to only affect the DEFINE_GUID() +// occurrences below but not any GUIDs declared in the standard files included +// above. +#include + +namespace +{ + +// Normally the IRichEditOleCallback interface and its IID are defined in +// richole.h header file included in the platform SDK but MinGW doesn't +// have the IID symbol (but does have the interface). Work around it by +// defining it ourselves. +DEFINE_GUID(wxIID_IRichEditOleCallback, + 0x00020d03, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); + +} // anonymous namespace +#endif // wxUSE_OLE + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -125,7 +138,7 @@ private: static bool ms_inkEditLibLoadAttemped; #endif - DECLARE_DYNAMIC_CLASS(wxRichEditModule) + wxDECLARE_DYNAMIC_CLASS(wxRichEditModule); }; HINSTANCE wxRichEditModule::ms_hRichEdit[Version_Max] = { NULL, NULL, NULL }; @@ -135,7 +148,74 @@ wxDynamicLibrary wxRichEditModule::ms_inkEditLib; bool wxRichEditModule::ms_inkEditLibLoadAttemped = false; #endif -IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule); + +#if wxUSE_OLE + +extern wxMenu *wxCurrentPopupMenu; + +class wxTextCtrlOleCallback : public IRichEditOleCallback +{ +public: + wxTextCtrlOleCallback(wxTextCtrl *text) : m_textCtrl(text), m_menu(NULL) {} + virtual ~wxTextCtrlOleCallback() { DeleteContextMenuObject(); } + + STDMETHODIMP ContextSensitiveHelp(BOOL WXUNUSED(enterMode)) { return E_NOTIMPL; } + STDMETHODIMP DeleteObject(LPOLEOBJECT WXUNUSED(oleobj)) { return E_NOTIMPL; } + STDMETHODIMP GetClipboardData(CHARRANGE* WXUNUSED(chrg), DWORD WXUNUSED(reco), LPDATAOBJECT* WXUNUSED(dataobj)) { return E_NOTIMPL; } + STDMETHODIMP GetDragDropEffect(BOOL WXUNUSED(drag), DWORD WXUNUSED(grfKeyState), LPDWORD WXUNUSED(effect)) { return E_NOTIMPL; } + STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME* WXUNUSED(frame), LPOLEINPLACEUIWINDOW* WXUNUSED(doc), LPOLEINPLACEFRAMEINFO WXUNUSED(frameInfo)) { return E_NOTIMPL; } + STDMETHODIMP GetNewStorage(LPSTORAGE *WXUNUSED(stg)) { return E_NOTIMPL; } + STDMETHODIMP QueryAcceptData(LPDATAOBJECT WXUNUSED(dataobj), CLIPFORMAT* WXUNUSED(format), DWORD WXUNUSED(reco), BOOL WXUNUSED(really), HGLOBAL WXUNUSED(hMetaPict)) { return E_NOTIMPL; } + STDMETHODIMP QueryInsertObject(LPCLSID WXUNUSED(clsid), LPSTORAGE WXUNUSED(stg), LONG WXUNUSED(cp)) { return E_NOTIMPL; } + STDMETHODIMP ShowContainerUI(BOOL WXUNUSED(show)) { return E_NOTIMPL; } + + STDMETHODIMP GetContextMenu(WORD WXUNUSED(seltype), LPOLEOBJECT WXUNUSED(oleobj), CHARRANGE* WXUNUSED(chrg), HMENU *menu) + { + // 'menu' will be shown and destroyed by the caller. We need to keep + // its wx counterpart, the wxMenu instance, around until it is + // dismissed, though, so store it in m_menu and destroy sometime later. + DeleteContextMenuObject(); + m_menu = m_textCtrl->MSWCreateContextMenu(); + *menu = m_menu->GetHMenu(); + + // Make wx handle events from the popup menu correctly: + m_menu->SetInvokingWindow(m_textCtrl); + wxCurrentPopupMenu = m_menu; + + m_menu->UpdateUI(); + + return S_OK; + } + + DECLARE_IUNKNOWN_METHODS; + +private: + void DeleteContextMenuObject() + { + if ( m_menu ) + { + m_menu->MSWDetachHMENU(); + if ( wxCurrentPopupMenu == m_menu ) + wxCurrentPopupMenu = NULL; + wxDELETE(m_menu); + } + } + + wxTextCtrl *m_textCtrl; + wxMenu *m_menu; + + wxDECLARE_NO_COPY_CLASS(wxTextCtrlOleCallback); +}; + +BEGIN_IID_TABLE(wxTextCtrlOleCallback) + ADD_IID(Unknown) + ADD_RAW_IID(wxIID_IRichEditOleCallback) +END_IID_TABLE; + +IMPLEMENT_IUNKNOWN_METHODS(wxTextCtrlOleCallback) + +#endif // wxUSE_OLE #endif // wxUSE_RICHEDIT @@ -173,19 +253,30 @@ private: wxDECLARE_NO_COPY_CLASS(UpdatesCountFilter); }; +namespace +{ + +// This stack stores the length of the text being currently inserted into the +// current control. +// +// It is used to pass information from DoWriteText() to AdjustSpaceLimit() +// and is global as text can only be inserted into a few text controls at a +// time (but possibly more than into one, if wxEVT_TEXT event handler does +// something that results in another text control update), and we don't want to +// waste space in every wxTextCtrl object for this field unnecessarily. +wxStack gs_lenOfInsertedText; + +} // anonymous namespace + // ---------------------------------------------------------------------------- // event tables and other macros // ---------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) +wxBEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_CHAR(wxTextCtrl::OnChar) EVT_KEY_DOWN(wxTextCtrl::OnKeyDown) EVT_DROP_FILES(wxTextCtrl::OnDropFiles) -#if wxUSE_RICHEDIT - EVT_CONTEXT_MENU(wxTextCtrl::OnContextMenu) -#endif - EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy) EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste) @@ -203,7 +294,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll) EVT_SET_FOCUS(wxTextCtrl::OnSetFocus) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ============================================================================ // implementation @@ -277,12 +368,8 @@ bool wxTextCtrl::Create(wxWindow *parent, // returns true if the platform should explicitly apply a theme border bool wxTextCtrl::CanApplyThemeBorder() const { -#ifdef __WXWINCE__ - return false; -#else // Standard text control already handles theming return ((GetWindowStyle() & (wxTE_RICH|wxTE_RICH2)) != 0); -#endif } bool wxTextCtrl::MSWCreateText(const wxString& value, @@ -295,12 +382,6 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, // do create the control - either an EDIT or RICHEDIT wxString windowClass = wxT("EDIT"); -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - // A control that capitalizes the first letter - if ( HasFlag(wxTE_CAPITALIZE) ) - windowClass = wxT("CAPEDIT"); -#endif - #if wxUSE_RICHEDIT if ( m_windowStyle & wxTE_AUTO_URL ) { @@ -476,6 +557,26 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, } ::SendMessage(GetHwnd(), EM_SETEVENTMASK, 0, mask); + + bool contextMenuConnected = false; +#if wxUSE_OLE + if ( m_verRichEdit >= 4 ) + { + wxTextCtrlOleCallback *cb = new wxTextCtrlOleCallback(this); + if ( ::SendMessage(GetHwnd(), EM_SETOLECALLBACK, 0, (LPARAM)cb) ) + { + // If we succeeded in setting up the callback, we don't need to + // connect to wxEVT_CONTEXT_MENU to show the menu ourselves, + // but we do need to connect to wxEVT_RIGHT_UP to generate + // wxContextMenuEvent ourselves as we're not going to get it + // from the control which consumes it. + contextMenuConnected = true; + Bind(wxEVT_RIGHT_UP, &wxTextCtrl::OnRightUp, this); + } + } +#endif + if ( !contextMenuConnected ) + Connect(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(wxTextCtrl::OnContextMenu)); } else #endif // wxUSE_RICHEDIT @@ -492,7 +593,6 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, SetBackgroundColour(GetClassDefaultAttributes().colBg); } -#ifndef __WXWINCE__ // Without this, if we pass the size in the constructor and then don't change it, // the themed borders will be drawn incorrectly. SetWindowPos(GetHwnd(), NULL, 0, 0, 0, 0, @@ -528,7 +628,6 @@ bool wxTextCtrl::MSWCreateText(const wxString& value, ::SendMessage(GetHwnd(), EM_SETMARGINS, wParam, lParam); } -#endif // !__WXWINCE__ return true; } @@ -886,7 +985,7 @@ void wxTextCtrl::DoSetValue(const wxString& value, int flags) } } -#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) +#if wxUSE_RICHEDIT && !wxUSE_UNICODE // TODO: using memcpy() would improve performance a lot for big amounts of text @@ -948,20 +1047,11 @@ wxRichEditStreamOut(DWORD_PTR dwCookie, BYTE *buf, LONG cb, LONG *pcb) } -#if wxUSE_UNICODE_MSLU - #define UNUSED_IF_MSLU(param) -#else - #define UNUSED_IF_MSLU(param) param -#endif - bool wxTextCtrl::StreamIn(const wxString& value, - wxFontEncoding UNUSED_IF_MSLU(encoding), + wxFontEncoding encoding, bool selectionOnly) { -#if wxUSE_UNICODE_MSLU - const wchar_t *wpc = value.c_str(); -#else // !wxUSE_UNICODE_MSLU wxCSConv conv(encoding); const size_t len = conv.MB2WC(NULL, value.mb_str(), value.length()); @@ -973,7 +1063,6 @@ wxTextCtrl::StreamIn(const wxString& value, wchar_t *wpc = wchBuf.data(); conv.MB2WC(wpc, value.mb_str(), len + 1); -#endif // wxUSE_UNICODE_MSLU // finally, stream it in the control EDITSTREAM eds; @@ -1004,8 +1093,6 @@ wxTextCtrl::StreamIn(const wxString& value, return true; } -#if !wxUSE_UNICODE_MSLU - wxString wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const { @@ -1057,8 +1144,6 @@ wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const return out; } -#endif // !wxUSE_UNICODE_MSLU - #endif // wxUSE_RICHEDIT void wxTextCtrl::WriteText(const wxString& value) @@ -1088,15 +1173,6 @@ void wxTextCtrl::DoWriteText(const wxString& value, int flags) SetStyle(start, end, m_defaultStyle); } -#if wxUSE_UNICODE_MSLU - // RichEdit doesn't have Unicode version of EM_REPLACESEL on Win9x, - // but EM_STREAMIN works - if ( wxUsingUnicowsDll() && GetRichVersion() > 1 ) - { - done = StreamIn(valueDos, wxFONTENCODING_SYSTEM, selectionOnly); - } -#endif // wxUSE_UNICODE_MSLU - #if !wxUSE_UNICODE // next check if the text we're inserting must be shown in a non // default charset -- this only works for RichEdit > 1.0 @@ -1137,10 +1213,31 @@ void wxTextCtrl::DoWriteText(const wxString& value, int flags) UpdatesCountFilter ucf(m_updatesCount); + // Remember the length of the text we're inserting so that + // AdjustSpaceLimit() could adjust the limit to be big enough for it: + // and also signal us whether it did it by resetting it to 0. + gs_lenOfInsertedText.push(valueDos.length()); + ::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT, // EM_REPLACESEL takes 1 to indicate the operation should be redoable selectionOnly ? 1 : 0, wxMSW_CONV_LPARAM(valueDos)); + const int lenActuallyInserted = gs_lenOfInsertedText.top(); + gs_lenOfInsertedText.pop(); + + if ( lenActuallyInserted == -1 ) + { + // Text size limit has been hit and added text has been truncated. + // But the max length has been increased by the EN_MAXTEXT message + // handler, which also reset the top of the lengths stack to -1), + // so we should be able to set it successfully now if we try again. + if ( selectionOnly ) + Undo(); + + ::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT, + selectionOnly ? 1 : 0, wxMSW_CONV_LPARAM(valueDos)); + } + if ( !ucf.GotUpdate() && (flags & SetValue_SendEvent) ) { SendUpdateEvent(); @@ -1174,8 +1271,6 @@ void wxTextCtrl::Clear() } } -#ifdef __WIN32__ - bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event) { SetFocus(); @@ -1191,8 +1286,6 @@ bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event) return GetValue().length() != lenOld; } -#endif // __WIN32__ - // ---------------------------------------------------------------------------- // Accessors // ---------------------------------------------------------------------------- @@ -1342,23 +1435,6 @@ void wxTextCtrl::DoSetSelection(long from, long to, int flags) } } -// ---------------------------------------------------------------------------- -// Working with files -// ---------------------------------------------------------------------------- - -bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType) -{ - if ( wxTextCtrlBase::DoLoadFile(file, fileType) ) - { - // update the size limit if needed - AdjustSpaceLimit(); - - return true; - } - - return false; -} - // ---------------------------------------------------------------------------- // dirty status // ---------------------------------------------------------------------------- @@ -1712,6 +1788,37 @@ void wxTextCtrl::SetMaxLength(unsigned long len) } } +// ---------------------------------------------------------------------------- +// RTL support +// ---------------------------------------------------------------------------- + +void wxTextCtrl::SetLayoutDirection(wxLayoutDirection dir) +{ + // We only need to handle this specifically for plain EDIT controls, rich + // edit ones behave like any other window. + if ( IsRich() ) + { + wxTextCtrlBase::SetLayoutDirection(dir); + } + else + { + if ( wxUpdateEditLayoutDirection(GetHwnd(), dir) ) + { + // Update text layout by forcing the control to redo it, a simple + // Refresh() is not enough. + SendSizeEvent(); + Refresh(); + } + } +} + +wxLayoutDirection wxTextCtrl::GetLayoutDirection() const +{ + // Just as above, we need to handle plain EDIT controls specially. + return IsRich() ? wxTextCtrlBase::GetLayoutDirection() + : wxGetEditLayoutDirection(GetHwnd()); +} + // ---------------------------------------------------------------------------- // Undo/redo // ---------------------------------------------------------------------------- @@ -1862,13 +1969,13 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) { case WXK_RETURN: { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); - InitCommandEvent(event); - event.SetString(GetValue()); - if ( HandleWindowEvent(event) ) - if ( !HasFlag(wxTE_MULTILINE) ) - return; - //else: multiline controls need Enter for themselves + wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId); + InitCommandEvent(evt); + evt.SetString(GetValue()); + if ( HandleWindowEvent(evt) ) + if ( !HasFlag(wxTE_MULTILINE) ) + return; + //else: multiline controls need Enter for themselves } break; @@ -1951,14 +2058,48 @@ void wxTextCtrl::OnKeyDown(wxKeyEvent& event) event.Skip(); } -WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +bool +wxTextCtrl::MSWHandleMessage(WXLRESULT *rc, + WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) { - WXLRESULT lRc = wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam); + bool processed = wxTextCtrlBase::MSWHandleMessage(rc, nMsg, wParam, lParam); + + // Handle the special case of "Enter" key: the user code needs to specify + // wxTE_PROCESS_ENTER style to get it in the first place, but if this flag + // is used, then even if the wxEVT_TEXT_ENTER handler skips the event, the + // normal action of this key is not performed because IsDialogMessage() is + // not called and, also, an annoying beep is generated by EDIT default + // WndProc. + // + // Fix these problems by explicitly performing the default function of this + // key (which would be done by MSWProcessMessage() if we didn't have + // wxTE_PROCESS_ENTER) and preventing the default WndProc from getting it. + if ( nMsg == WM_CHAR && + !processed && + HasFlag(wxTE_PROCESS_ENTER) && + wParam == VK_RETURN && + !wxIsAnyModifierDown() ) + { + MSWClickButtonIfPossible(MSWGetDefaultButtonFor(this)); + + processed = true; + } switch ( nMsg ) { case WM_GETDLGCODE: { + // Ensure that the result value is initialized even if the base + // class didn't handle WM_GETDLGCODE but just update the value + // returned by it if it did handle it. + if ( !processed ) + { + *rc = MSWDefWindowProc(nMsg, wParam, lParam); + processed = true; + } + // we always want the chars and the arrows: the arrows for // navigation and the chars because we want Ctrl-C to work even // in a read only control @@ -1982,7 +2123,7 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara if ( HasFlag(wxTE_PROCESS_TAB) ) lDlgCode |= DLGC_WANTTAB; - lRc |= lDlgCode; + *rc |= lDlgCode; } else // !editable { @@ -1991,11 +2132,17 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara // including DLGC_WANTMESSAGE). This is strange (how // does it work in the native Win32 apps?) but for now // live with it. - lRc = lDlgCode; + *rc = lDlgCode; + } + + if ( IsMultiLine() ) + { + // The presence of this style, coming from the default EDIT + // WndProc, indicates that the control contents should be + // selected when it gets focus, but we don't want this to + // happen for the multiline controls, so clear it. + *rc &= ~DLGC_HASSETSEL; } - if (IsMultiLine()) - // Clear the DLGC_HASSETSEL bit from the return value - lRc &= ~DLGC_HASSETSEL; } break; @@ -2015,7 +2162,7 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara #endif // wxUSE_MENUS } - return lRc; + return processed; } // ---------------------------------------------------------------------------- @@ -2119,8 +2266,32 @@ bool wxTextCtrl::AdjustSpaceLimit() unsigned int len = ::GetWindowTextLength(GetHwnd()); if ( len >= limit ) { - // increment in 32Kb chunks - SetMaxLength(len + 0x8000); + unsigned long increaseBy; + + // We need to increase the size of the buffer and to avoid increasing + // it too many times make sure that we make it at least big enough to + // fit all the text we are currently inserting into the control, if + // we're inserting any, i.e. if we're called from DoWriteText(). + if ( !gs_lenOfInsertedText.empty() ) + { + increaseBy = gs_lenOfInsertedText.top(); + + // Indicate to the caller that we increased the limit. + gs_lenOfInsertedText.top() = -1; + } + else // Not inserting text, must be text actually typed by user. + { + increaseBy = 0; + } + + // But also increase it by at least 32KB chunks -- again, to avoid + // doing it too often -- and round it up to 32KB in any case. + if ( increaseBy < 0x8000 ) + increaseBy = 0x8000; + else + increaseBy = (increaseBy + 0x7fff) & ~0x7fff; + + SetMaxLength(len + increaseBy); } // we changed the limit @@ -2137,7 +2308,7 @@ bool wxTextCtrl::AcceptsFocusFromKeyboard() const wxSize wxTextCtrl::DoGetBestSize() const { - return DoGetSizeFromTextSize( DEFAULT_ITEM_WIDTH ); + return DoGetSizeFromTextSize( FromDIP(DEFAULT_ITEM_WIDTH) ); } wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const @@ -2269,32 +2440,6 @@ void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event) event.Enable( !IsEmpty() ); } -void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event) -{ -#if wxUSE_RICHEDIT - if (IsRich()) - { - if (!m_privateContextMenu) - { - m_privateContextMenu = new wxMenu; - m_privateContextMenu->Append(wxID_UNDO, _("&Undo")); - m_privateContextMenu->Append(wxID_REDO, _("&Redo")); - m_privateContextMenu->AppendSeparator(); - m_privateContextMenu->Append(wxID_CUT, _("Cu&t")); - m_privateContextMenu->Append(wxID_COPY, _("&Copy")); - m_privateContextMenu->Append(wxID_PASTE, _("&Paste")); - m_privateContextMenu->Append(wxID_CLEAR, _("&Delete")); - m_privateContextMenu->AppendSeparator(); - m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All")); - } - PopupMenu(m_privateContextMenu); - return; - } - else -#endif - event.Skip(); -} - void wxTextCtrl::OnSetFocus(wxFocusEvent& event) { // be sure the caret remains invisible if the user had hidden it @@ -2309,6 +2454,44 @@ void wxTextCtrl::OnSetFocus(wxFocusEvent& event) // the rest of the file only deals with the rich edit controls #if wxUSE_RICHEDIT +void wxTextCtrl::OnRightUp(wxMouseEvent& eventMouse) +{ + wxContextMenuEvent eventMenu(wxEVT_CONTEXT_MENU, + GetId(), + ClientToScreen(eventMouse.GetPosition())); + + if ( !ProcessWindowEvent(eventMenu) ) + eventMouse.Skip(); +} + +void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event) +{ + if (IsRich()) + { + if (!m_privateContextMenu) + m_privateContextMenu = MSWCreateContextMenu(); + PopupMenu(m_privateContextMenu); + return; + } + else + event.Skip(); +} + +wxMenu *wxTextCtrl::MSWCreateContextMenu() +{ + wxMenu *m = new wxMenu; + m->Append(wxID_UNDO, _("&Undo")); + m->Append(wxID_REDO, _("&Redo")); + m->AppendSeparator(); + m->Append(wxID_CUT, _("Cu&t")); + m->Append(wxID_COPY, _("&Copy")); + m->Append(wxID_PASTE, _("&Paste")); + m->Append(wxID_CLEAR, _("&Delete")); + m->AppendSeparator(); + m->Append(wxID_SELECTALL, _("Select &All")); + return m; +} + // ---------------------------------------------------------------------------- // EN_LINK processing // ---------------------------------------------------------------------------- @@ -2469,6 +2652,11 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour) bool wxTextCtrl::SetFont(const wxFont& font) { + // Native text control sends EN_CHANGE when the font changes, producing + // a wxEVT_TEXT event as if the user changed the value. This is not + // the case, so supress the event. + wxEventBlocker block(this, wxEVT_TEXT); + if ( !wxTextCtrlBase::SetFont(font) ) return false; @@ -2522,7 +2710,7 @@ bool wxTextCtrl::MSWSetCharFormat(const wxTextAttr& style, long start, long end) // but using it doesn't seem to hurt neither so leaving it for now cf.dwMask |= CFM_FACE | CFM_SIZE | CFM_CHARSET | - CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE; + CFM_ITALIC | CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT; // fill in data from LOGFONT but recalculate lfHeight because we need // the real height in twips and not the negative number which @@ -2555,8 +2743,10 @@ bool wxTextCtrl::MSWSetCharFormat(const wxTextAttr& style, long start, long end) { cf.dwEffects |= CFE_UNDERLINE; } - - // strikeout fonts are not supported by wxWidgets + if ( lf.lfStrikeOut ) + { + cf.dwEffects |= CFE_STRIKEOUT; + } } if ( style.HasTextColour() ) @@ -2664,10 +2854,28 @@ bool wxTextCtrl::MSWSetParaFormat(const wxTextAttr& style, long start, long end) } } +#if wxUSE_RICHEDIT2 + if ( style.HasParagraphSpacingAfter() ) + { + pf.dwMask |= PFM_SPACEAFTER; + + // Convert from 1/10 mm to TWIPS + pf.dySpaceAfter = (int) (((double) style.GetParagraphSpacingAfter()) * mm2twips / 10.0) ; + } + + if ( style.HasParagraphSpacingBefore() ) + { + pf.dwMask |= PFM_SPACEBEFORE; + + // Convert from 1/10 mm to TWIPS + pf.dySpaceBefore = (int) (((double) style.GetParagraphSpacingBefore()) * mm2twips / 10.0) ; + } +#endif // wxUSE_RICHEDIT2 + #if wxUSE_RICHEDIT2 if ( m_verRichEdit > 1 ) { - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( GetLayoutDirection() == wxLayout_RightToLeft ) { // Use RTL paragraphs in RTL mode to get proper layout pf.dwMask |= PFM_RTLPARA; @@ -2787,7 +2995,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) GetSelection(&startOld, &endOld); // but do we really have to change the selection? - bool changeSel = position != startOld || position != endOld; + const bool changeSel = position != startOld; if ( changeSel ) { @@ -2982,4 +3190,4 @@ bool wxRichEditModule::LoadInkEdit() #endif // wxUSE_RICHEDIT -#endif // wxUSE_TEXTCTRL && !(__SMARTPHONE__ && __WXWINCE__) +#endif // wxUSE_TEXTCTRL diff --git a/Externals/wxWidgets3/src/msw/textentry.cpp b/Externals/wxWidgets3/src/msw/textentry.cpp index d8a411ebc4..f0a4bbc4d3 100644 --- a/Externals/wxWidgets3/src/msw/textentry.cpp +++ b/Externals/wxWidgets3/src/msw/textentry.cpp @@ -39,14 +39,16 @@ #include "wx/msw/uxtheme.h" #endif +#include "wx/msw/wrapwin.h" +#include + #define GetEditHwnd() ((HWND)(GetEditHWND())) // ---------------------------------------------------------------------------- // Classes used by auto-completion implementation. // ---------------------------------------------------------------------------- -// standard VC6 SDK (WINVER == 0x0400) does not know about IAutoComplete -#if wxUSE_OLE && (WINVER >= 0x0500) +#if wxUSE_OLE #define HAS_AUTOCOMPLETE #endif @@ -55,7 +57,7 @@ #include "wx/msw/ole/oleutils.h" #include -#if defined(__MINGW32__) || defined (__WATCOMC__) || defined(__CYGWIN__) +#if defined(__MINGW32__) || defined(__CYGWIN__) // needed for IID_IAutoComplete, IID_IAutoComplete2 and ACO_AUTOSUGGEST #include @@ -81,9 +83,6 @@ // above. #include -namespace -{ - // Normally this interface and its IID are defined in shobjidl.h header file // included in the platform SDK but MinGW and Cygwin don't have it so redefine // the interface ourselves and, as long as we do it all, do it for all @@ -96,12 +95,19 @@ public: virtual HRESULT wxSTDCALL ResetEnumerator() = 0; }; +namespace +{ + DEFINE_GUID(wxIID_IAutoCompleteDropDown, 0x3cd141f4, 0x3c6a, 0x11d2, 0xbc, 0xaa, 0x00, 0xc0, 0x4f, 0xd9, 0x29, 0xdb); DEFINE_GUID(wxCLSID_AutoComplete, 0x00bb2763, 0x6a77, 0x11d0, 0xa5, 0x35, 0x00, 0xc0, 0x4f, 0xd7, 0xd0, 0x62); +#ifndef ACDD_VISIBLE + #define ACDD_VISIBLE 0x0001 +#endif + // Small helper class which can be used to ensure thread safety even when // wxUSE_THREADS==0 (and hence wxCriticalSection does nothing). class CSLock @@ -353,7 +359,7 @@ IMPLEMENT_IUNKNOWN_METHODS(wxIEnumString) // This class gathers the all auto-complete-related stuff we use. It is // allocated on demand by wxTextEntry when AutoComplete() is called. -class wxTextAutoCompleteData wxBIND_OR_CONNECT_HACK_ONLY_BASE_CLASS +class wxTextAutoCompleteData { public: // The constructor associates us with the given text entry. @@ -433,6 +439,8 @@ public: ACO_UPDOWNKEYDROPSLIST); pAutoComplete2->Release(); } + + m_win->Bind(wxEVT_CHAR_HOOK, &wxTextAutoCompleteData::OnCharHook, this); } ~wxTextAutoCompleteData() @@ -498,10 +506,8 @@ public: // neither as, due to our use of ACO_AUTOAPPEND, we get // EN_CHANGE notifications from the control every time // IAutoComplete auto-appends something to it. - wxBIND_OR_CONNECT_HACK(m_win, wxEVT_AFTER_CHAR, - wxKeyEventHandler, - wxTextAutoCompleteData::OnAfterChar, - this); + m_win->Bind(wxEVT_AFTER_CHAR, + &wxTextAutoCompleteData::OnAfterChar, this); } UpdateStringsFromCustomCompleter(); @@ -568,6 +574,28 @@ private: event.Skip(); } + void OnCharHook(wxKeyEvent& event) + { + // If the autocomplete drop-down list is currently displayed when the + // user presses Escape, we need to dismiss it manually from here as + // Escape could be eaten by something else (e.g. EVT_CHAR_HOOK in the + // dialog that this control is found in) otherwise. + if ( event.GetKeyCode() == WXK_ESCAPE ) + { + DWORD dwFlags = 0; + if ( SUCCEEDED(m_autoCompleteDropDown->GetDropDownStatus(&dwFlags, + NULL)) + && dwFlags == ACDD_VISIBLE ) + { + ::SendMessage(GetHwndOf(m_win), WM_KEYDOWN, WXK_ESCAPE, 0); + + // Do not skip the event in this case, we've already handled it. + return; + } + } + + event.Skip(); + } // The text entry we're associated with. wxTextEntry * const m_entry; @@ -750,24 +778,6 @@ void wxTextEntry::GetSelection(long *from, long *to) const bool wxTextEntry::DoAutoCompleteFileNames(int flags) { - typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); - static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1; - static wxDynamicLibrary s_dllShlwapi; - if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 ) - { - if ( !s_dllShlwapi.Load(wxT("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) ) - { - s_pfnSHAutoComplete = NULL; - } - else - { - wxDL_INIT_FUNC(s_pfn, SHAutoComplete, s_dllShlwapi); - } - } - - if ( !s_pfnSHAutoComplete ) - return false; - DWORD dwFlags = 0; if ( flags & wxFILE ) dwFlags |= SHACF_FILESYS_ONLY; @@ -779,7 +789,7 @@ bool wxTextEntry::DoAutoCompleteFileNames(int flags) return false; } - HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), dwFlags); + HRESULT hr = ::SHAutoComplete(GetEditHwnd(), dwFlags); if ( FAILED(hr) ) { wxLogApiError(wxT("SHAutoComplete()"), hr); @@ -888,7 +898,7 @@ void wxTextEntry::SetEditable(bool editable) } // ---------------------------------------------------------------------------- -// max length +// input restrictions // ---------------------------------------------------------------------------- void wxTextEntry::SetMaxLength(unsigned long len) @@ -903,6 +913,15 @@ void wxTextEntry::SetMaxLength(unsigned long len) ::SendMessage(GetEditHwnd(), EM_LIMITTEXT, len, 0); } +void wxTextEntry::ForceUpper() +{ + ConvertToUpperCase(); + + const HWND hwnd = GetEditHwnd(); + const LONG styleOld = ::GetWindowLong(hwnd, GWL_STYLE); + ::SetWindowLong(hwnd, GWL_STYLE, styleOld | ES_UPPERCASE); +} + // ---------------------------------------------------------------------------- // hints // ---------------------------------------------------------------------------- @@ -953,7 +972,6 @@ wxString wxTextEntry::GetHint() const bool wxTextEntry::DoSetMargins(const wxPoint& margins) { -#if !defined(__WXWINCE__) bool res = true; if ( margins.x != -1 ) @@ -972,22 +990,15 @@ bool wxTextEntry::DoSetMargins(const wxPoint& margins) } return res; -#else - return false; -#endif } wxPoint wxTextEntry::DoGetMargins() const { -#if !defined(__WXWINCE__) LRESULT lResult = ::SendMessage(GetEditHwnd(), EM_GETMARGINS, 0, 0); int left = LOWORD(lResult); int top = -1; return wxPoint(left, top); -#else - return wxPoint(-1, -1); -#endif } #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX diff --git a/Externals/wxWidgets3/src/msw/textmeasure.cpp b/Externals/wxWidgets3/src/msw/textmeasure.cpp index d03a5f369a..3b36bcf181 100644 --- a/Externals/wxWidgets3/src/msw/textmeasure.cpp +++ b/Externals/wxWidgets3/src/msw/textmeasure.cpp @@ -105,11 +105,9 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string, wxLogLastError(wxT("GetTextExtentPoint32()")); } -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) // the result computed by GetTextExtentPoint32() may be too small as it // accounts for under/overhang of the first/last character while we want // just the bounding rect for this string so adjust the width as needed - // (using API not available in 2002 SDKs of WinCE) if ( len > 0 ) { ABC widthABC; @@ -131,7 +129,6 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string, } //else: GetCharABCWidths() failed, not a TrueType font? } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) *width = sizeRect.cx; *height = sizeRect.cy; @@ -154,27 +151,12 @@ bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text, if ( !m_hdc ) return wxTextMeasureBase::DoGetPartialTextExtents(text, widths, scaleX); - static int maxLenText = -1; - static int maxWidth = -1; - - if (maxLenText == -1) - { - // Win9x and WinNT+ have different limits - int version = wxGetOsVersion(); - maxLenText = version == wxOS_WINDOWS_NT ? 65535 : 8192; - maxWidth = version == wxOS_WINDOWS_NT ? INT_MAX : 32767; - } - - int len = text.length(); - if ( len > maxLenText ) - len = maxLenText; - int fit = 0; SIZE sz = {0,0}; if ( !::GetTextExtentExPoint(m_hdc, text.t_str(), // string to check - len, - maxWidth, + text.length(), + INT_MAX, // max allowable width &fit, // [out] count of chars // that will fit &widths[0], // array to fill diff --git a/Externals/wxWidgets3/src/msw/tglbtn.cpp b/Externals/wxWidgets3/src/msw/tglbtn.cpp index f7380a3f66..7791e08c0e 100644 --- a/Externals/wxWidgets3/src/msw/tglbtn.cpp +++ b/Externals/wxWidgets3/src/msw/tglbtn.cpp @@ -54,7 +54,7 @@ wxDEFINE_EVENT( wxEVT_TOGGLEBUTTON, wxCommandEvent ); // wxBitmapToggleButton //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton); bool wxBitmapToggleButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap& label,const wxPoint& pos, const wxSize& size, long style, @@ -83,7 +83,7 @@ bool wxBitmapToggleButton::Create( wxWindow *parent, wxWindowID id, // wxToggleButton // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl); void wxToggleButton::Init() { @@ -135,6 +135,11 @@ WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const return msStyle; } +bool wxToggleButton::MSWIsPushed() const +{ + return GetValue(); +} + void wxToggleButton::SetValue(bool val) { m_state = val; @@ -144,7 +149,7 @@ void wxToggleButton::SetValue(bool val) } else { - ::SendMessage(GetHwnd(), BM_SETCHECK, val, 0); + ::SendMessage(GetHwnd(), BM_SETCHECK, val ? BST_CHECKED : BST_UNCHECKED, 0); } } @@ -185,12 +190,4 @@ bool wxToggleButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) return true; } -wxAnyButton::State wxToggleButton::GetNormalState() const -{ - if ( GetValue() ) - return State_Pressed; - else - return State_Normal; -} - #endif // wxUSE_TOGGLEBTN diff --git a/Externals/wxWidgets3/src/msw/thread.cpp b/Externals/wxWidgets3/src/msw/thread.cpp index 88e696ab34..154dbb740b 100644 --- a/Externals/wxWidgets3/src/msw/thread.cpp +++ b/Externals/wxWidgets3/src/msw/thread.cpp @@ -27,7 +27,9 @@ #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/app.h" + #include "wx/log.h" #include "wx/module.h" + #include "wx/msgout.h" #endif #include "wx/apptrait.h" @@ -39,8 +41,6 @@ #include "wx/except.h" -#include "wx/dynlib.h" - // must have this symbol defined to get _beginthread/_endthread declarations #ifndef _MT #define _MT @@ -62,13 +62,10 @@ // which should be used instead of Win32 ::CreateThread() if possible #if defined(__VISUALC__) || \ (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \ - (defined(__GNUG__) && defined(__MSVCRT__)) || \ - defined(__WATCOMC__) + (defined(__GNUG__) && defined(__MSVCRT__)) -#ifndef __WXWINCE__ #undef wxUSE_BEGIN_THREAD #define wxUSE_BEGIN_THREAD -#endif #endif @@ -166,21 +163,7 @@ void wxCriticalSection::Enter() bool wxCriticalSection::TryEnter() { -#if wxUSE_DYNLIB_CLASS - typedef BOOL - (WINAPI *TryEnterCriticalSection_t)(LPCRITICAL_SECTION lpCriticalSection); - - static TryEnterCriticalSection_t - pfnTryEnterCriticalSection = (TryEnterCriticalSection_t) - wxDynamicLibrary(wxT("kernel32.dll")). - GetSymbol(wxT("TryEnterCriticalSection")); - - return pfnTryEnterCriticalSection - ? (*pfnTryEnterCriticalSection)((CRITICAL_SECTION *)m_buffer) != 0 - : false; -#else - return false; -#endif + return ::TryEnterCriticalSection((CRITICAL_SECTION *)m_buffer) != 0; } void wxCriticalSection::Leave() @@ -353,7 +336,6 @@ private: wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) { -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300) if ( maxcount == 0 ) { // make it practically infinite @@ -367,7 +349,6 @@ wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) maxcount, NULL // no name ); -#endif if ( !m_semaphore ) { wxLogLastError(wxT("CreateSemaphore()")); @@ -406,7 +387,6 @@ wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds) wxSemaError wxSemaphoreInternal::Post() { -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300) if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) ) { if ( GetLastError() == ERROR_TOO_MANY_POSTS ) @@ -421,9 +401,6 @@ wxSemaError wxSemaphoreInternal::Post() } return wxSEMA_NO_ERROR; -#else - return wxSEMA_MISC_ERROR; -#endif } // ---------------------------------------------------------------------------- @@ -662,14 +639,6 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) // creation instead of Win32 API one because otherwise we will have memory // leaks if the thread uses C RTL (and most threads do) #ifdef wxUSE_BEGIN_THREAD - - // Watcom is reported to not like 0 stack size (which means "use default" - // for the other compilers and is also the default value for stackSize) -#ifdef __WATCOMC__ - if ( !stackSize ) - stackSize = 10240; -#endif // __WATCOMC__ - m_hThread = (HANDLE)_beginthreadex ( NULL, // default security @@ -794,6 +763,8 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, gs_waitingForThread = true; } + wxAppTraits& traits = wxApp::GetValidTraits(); + // we can't just wait for the thread to terminate because it might be // calling some GUI functions and so it will never terminate before we // process the Windows messages that result from these functions @@ -812,16 +783,9 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, } } - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( traits ) - { - result = traits->WaitForThread(m_hThread, waitMode); - } - else // can't wait for the thread - { - // so kill it below - result = 0xFFFFFFFF; - } + // Wait for the thread while still processing events in the GUI apps or + // just simply wait for it in the console ones. + result = traits.WaitForThread(m_hThread, waitMode); switch ( result ) { @@ -836,9 +800,10 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, break; case WAIT_OBJECT_0 + 1: - // new message arrived, process it -- but only if we're the - // main thread as we don't support processing messages in - // the other ones + case WAIT_OBJECT_0 + 2: + // Wake up has been signaled or a new message arrived, process + // it -- but only if we're the main thread as we don't support + // processing messages in the other ones // // NB: we still must include QS_ALLINPUT even when waiting // in a secondary thread because if it had created some @@ -846,7 +811,7 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, // the system might dead lock then if ( wxThread::IsMain() ) { - if ( traits && !traits->DoMessageFromThreadWait() ) + if ( !traits.DoMessageFromThreadWait() ) { // WM_QUIT received: kill the thread Kill(); @@ -975,11 +940,8 @@ unsigned long wxThread::GetCurrentId() return (unsigned long)::GetCurrentThreadId(); } -bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level)) +bool wxThread::SetConcurrency(size_t level) { -#ifdef __WXWINCE__ - return false; -#else wxASSERT_MSG( IsMain(), wxT("should only be called from the main thread") ); // ok only for the default one @@ -1035,35 +997,7 @@ bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level)) return false; } - // set it: we can't link to SetProcessAffinityMask() because it doesn't - // exist in Win9x, use RT binding instead - - typedef BOOL (WINAPI *SETPROCESSAFFINITYMASK)(HANDLE, DWORD_PTR); - - // can use static var because we're always in the main thread here - static SETPROCESSAFFINITYMASK pfnSetProcessAffinityMask = NULL; - - if ( !pfnSetProcessAffinityMask ) - { - HMODULE hModKernel = ::LoadLibrary(wxT("kernel32")); - if ( hModKernel ) - { - pfnSetProcessAffinityMask = (SETPROCESSAFFINITYMASK) - ::GetProcAddress(hModKernel, "SetProcessAffinityMask"); - } - - // we've discovered a MT version of Win9x! - wxASSERT_MSG( pfnSetProcessAffinityMask, - wxT("this system has several CPUs but no SetProcessAffinityMask function?") ); - } - - if ( !pfnSetProcessAffinityMask ) - { - // msg given above - do it only once - return false; - } - - if ( pfnSetProcessAffinityMask(hProcess, dwProcMask) == 0 ) + if ( ::SetProcessAffinityMask(hProcess, dwProcMask) == 0 ) { wxLogLastError(wxT("SetProcessAffinityMask")); @@ -1071,7 +1005,6 @@ bool wxThread::SetConcurrency(size_t WXUNUSED_IN_WINCE(level)) } return true; -#endif // __WXWINCE__/!__WXWINCE__ } // ctor and dtor @@ -1201,7 +1134,7 @@ void wxThread::Exit(ExitCode status) #ifdef wxUSE_BEGIN_THREAD _endthreadex(wxPtrToUInt(status)); #else // !VC++ - ::ExitThread((DWORD)status); + ::ExitThread(wxPtrToUInt(status)); #endif // VC++/!VC++ wxFAIL_MSG(wxT("Couldn't return from ExitThread()!")); @@ -1231,6 +1164,13 @@ unsigned long wxThread::GetId() const return (unsigned long)m_internal->GetId(); } +WXHANDLE wxThread::MSWGetHandle() const +{ + wxCriticalSectionLocker lock(const_cast(m_critsect)); + + return m_internal->GetHandle(); +} + bool wxThread::IsRunning() const { wxCriticalSectionLocker lock(const_cast(m_critsect)); @@ -1271,10 +1211,10 @@ public: virtual void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxThreadModule) + wxDECLARE_DYNAMIC_CLASS(wxThreadModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule); bool wxThreadModule::OnInit() { @@ -1422,8 +1362,17 @@ void WXDLLIMPEXP_BASE wxWakeUpMainThread() // sending any message would do - hopefully WM_NULL is harmless enough if ( !::PostThreadMessage(wxThread::GetMainId(), WM_NULL, 0, 0) ) { - // should never happen - wxLogLastError(wxT("PostThreadMessage(WM_NULL)")); + // should never happen, but log an error if it does, however do not use + // wxLog here as it would result in reentrancy because logging from a + // thread calls wxWakeUpIdle() which calls this function itself again + const unsigned long ec = wxSysErrorCode(); + wxMessageOutputDebug().Printf + ( + wxS("Failed to wake up main thread: PostThreadMessage(WM_NULL) ") + wxS("failed with error 0x%08lx (%s)."), + ec, + wxSysErrorMsg(ec) + ); } } diff --git a/Externals/wxWidgets3/src/msw/timectrl.cpp b/Externals/wxWidgets3/src/msw/timectrl.cpp index 1a39cb4cdf..7469e12c3c 100644 --- a/Externals/wxWidgets3/src/msw/timectrl.cpp +++ b/Externals/wxWidgets3/src/msw/timectrl.cpp @@ -30,7 +30,7 @@ #include "wx/timectrl.h" #include "wx/dateevt.h" -IMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimePickerCtrl, wxControl); // ============================================================================ // wxTimePickerCtrl implementation diff --git a/Externals/wxWidgets3/src/msw/timer.cpp b/Externals/wxWidgets3/src/msw/timer.cpp index ba7ed1cd9c..5ac8b2adb9 100644 --- a/Externals/wxWidgets3/src/msw/timer.cpp +++ b/Externals/wxWidgets3/src/msw/timer.cpp @@ -73,8 +73,8 @@ UINT_PTR GetNewTimerId(wxMSWTimerImpl *t) // private functions // ---------------------------------------------------------------------------- -LRESULT APIENTRY _EXPORT wxTimerWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); +LRESULT APIENTRY +wxTimerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // ---------------------------------------------------------------------------- // wxTimerHiddenWindowModule: used to manage the hidden window used for @@ -99,10 +99,10 @@ private: // the class used to create it static const wxChar *ms_className; - DECLARE_DYNAMIC_CLASS(wxTimerHiddenWindowModule) + wxDECLARE_DYNAMIC_CLASS(wxTimerHiddenWindowModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxTimerHiddenWindowModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimerHiddenWindowModule, wxModule); // ============================================================================ // implementation @@ -161,8 +161,8 @@ void wxProcessTimer(wxMSWTimerImpl& timer) } -LRESULT APIENTRY _EXPORT wxTimerWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam) +LRESULT APIENTRY +wxTimerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if ( message == WM_TIMER ) { diff --git a/Externals/wxWidgets3/src/msw/toolbar.cpp b/Externals/wxWidgets3/src/msw/toolbar.cpp index c292bb77de..f03386daee 100644 --- a/Externals/wxWidgets3/src/msw/toolbar.cpp +++ b/Externals/wxWidgets3/src/msw/toolbar.cpp @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__) +#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE #include "wx/toolbar.h" @@ -55,15 +55,6 @@ #include "wx/msw/uxtheme.h" #endif -// this define controls whether the code for button colours remapping (only -// useful for 16 or 256 colour images) is active at all, it's always turned off -// for CE where it doesn't compile (and is probably not needed anyhow) and may -// also be turned off for other systems if you always use 24bpp images and so -// never need it -#ifndef __WXWINCE__ - #define wxREMAP_BUTTON_COLOURS -#endif // !__WXWINCE__ - // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -102,7 +93,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl); /* TOOLBAR PROPERTIES @@ -123,11 +114,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) dontattachtoframe */ -BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) +wxBEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent) EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged) EVT_ERASE_BACKGROUND(wxToolBar::OnEraseBackground) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // private classes @@ -148,8 +139,8 @@ public: : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, clientData, shortHelp, longHelp) { - m_nSepCount = 0; m_staticText = NULL; + m_toBeDeleted = false; } wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) @@ -173,7 +164,7 @@ public: m_staticText = NULL; } - m_nSepCount = 1; + m_toBeDeleted = false; } virtual ~wxToolBarTool() @@ -205,11 +196,6 @@ public: return m_staticText; } - // set/get the number of separators which we use to cover the space used by - // a control in the toolbar - void SetSeparatorsCount(size_t count) { m_nSepCount = count; } - size_t GetSeparatorsCount() const { return m_nSepCount; } - // we need ids for the spacers which we want to modify later on, this // function will allocate a valid/unique id for a spacer if not done yet void AllocSpacerId() @@ -233,9 +219,12 @@ public: } } + void ToBeDeleted(bool toBeDeleted = true) { m_toBeDeleted = toBeDeleted; } + bool IsToBeDeleted() const { return m_toBeDeleted; } + private: - size_t m_nSepCount; wxStaticText *m_staticText; + bool m_toBeDeleted; wxDECLARE_NO_COPY_CLASS(wxToolBarTool); }; @@ -244,11 +233,12 @@ private: // helper functions // ---------------------------------------------------------------------------- -// return the rectangle of the item at the given index +// Return the rectangle of the item at the given index and, if specified, with +// the given id. // -// returns an empty (0, 0, 0, 0) rectangle if fails so the caller may compare -// r.right or r.bottom with 0 to check for this -static RECT wxGetTBItemRect(HWND hwnd, int index) +// Returns an empty (0, 0, 0, 0) rectangle if fails so the caller may compare +// r.right or r.bottom with 0 to check for this. +static RECT wxGetTBItemRect(HWND hwnd, int index, int id = wxID_NONE) { RECT r; @@ -256,17 +246,56 @@ static RECT wxGetTBItemRect(HWND hwnd, int index) // only appeared in v4.70 of comctl32.dll if ( !::SendMessage(hwnd, TB_GETITEMRECT, index, (LPARAM)&r) ) { - wxLogLastError(wxT("TB_GETITEMRECT")); + // This call can return false status even when there is no real error, + // e.g. for a hidden button, so check for this to avoid spurious logs. + const DWORD err = ::GetLastError(); + if ( err != ERROR_SUCCESS ) + { + bool reportError = true; - r.top = - r.left = - r.right = - r.bottom = 0; + if ( id != wxID_NONE ) + { + const LRESULT state = ::SendMessage(hwnd, TB_GETSTATE, id, 0); + if ( state != -1 && (state & TBSTATE_HIDDEN) ) + { + // There is no real error to report after all. + reportError = false; + } + else // It is not hidden. + { + // So it must have been a real error, report it with the + // original error code and not the one from TB_GETSTATE. + ::SetLastError(err); + } + } + + if ( reportError ) + wxLogLastError(wxT("TB_GETITEMRECT")); + } + + ::SetRectEmpty(&r); } return r; } +inline bool MSWShouldBeChecked(const wxToolBarToolBase *tool) +{ + // Apparently, "checked" state image overrides the "disabled" image + // so we need to enforce our custom "disabled" image (if there is any) + // to be drawn for checked and disabled button tool. + // Note: We believe this erroneous overriding is fixed in MSW 8. + if ( wxGetWinVersion() <= wxWinVersion_7 && + tool->GetKind() == wxITEM_CHECK && + tool->GetDisabledBitmap().IsOk() && + !tool->IsEnabled() ) + { + return false; + } + + return tool->IsToggled(); +} + // ============================================================================ // implementation // ============================================================================ @@ -348,6 +377,15 @@ bool wxToolBar::Create(wxWindow *parent, return true; } +void wxToolBar::MSWSetPadding(WXWORD padding) +{ + DWORD curPadding = ::SendMessage(GetHwnd(), TB_GETPADDING, 0, 0); + // Preserve orthogonal padding + DWORD newPadding = IsVertical() ? MAKELPARAM(LOWORD(curPadding), padding) + : MAKELPARAM(padding, HIWORD(curPadding)); + ::SendMessage(GetHwnd(), TB_SETPADDING, 0, newPadding); +} + bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) { if ( !MSWCreateControl(TOOLBARCLASSNAME, wxEmptyString, pos, size) ) @@ -357,10 +395,22 @@ bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); #ifdef TB_SETEXTENDEDSTYLE - if ( wxApp::GetComCtl32Version() >= 471 ) - ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); + ::SendMessage(GetHwnd(), TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS); #endif + // Retrieve or apply/restore tool packing value. + if ( m_toolPacking <= 0 ) + { + // Retrieve packing value if it hasn't been yet set with SetToolPacking. + DWORD padding = ::SendMessage(GetHwnd(), TB_GETPADDING, 0, 0); + m_toolPacking = IsVertical() ? HIWORD(padding) : LOWORD(padding); + } + else + { + // Apply packing value if it has been already set with SetToolPacking. + MSWSetPadding(m_toolPacking); + } + return true; } @@ -441,9 +491,7 @@ wxSize wxToolBar::DoGetBestSize() const // reverse horz and vertical components if necessary if ( IsVertical() ) { - int t = sizeBest.x; - sizeBest.x = sizeBest.y; - sizeBest.y = t; + wxSwap(sizeBest.x, sizeBest.y); } } else // TB_GETMAXSIZE succeeded @@ -468,6 +516,20 @@ wxSize wxToolBar::DoGetBestSize() const if ( !IsVertical() ) { + wxToolBarToolsList::compatibility_iterator node; + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + wxToolBarTool * const + tool = static_cast(node->GetData()); + if (tool->IsControl()) + { + int y = tool->GetControl()->GetSize().y; + // Approximate border size + if (y > (sizeBest.y - 4)) + sizeBest.y = y + 4; + } + } + // Without the extra height, DoGetBestSize can report a size that's // smaller than the actual window, causing windows to overlap slightly // in some circumstances, leading to missing borders (especially noticeable @@ -494,10 +556,10 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const if ( !(style & wxTB_NO_TOOLTIPS) ) msStyle |= TBSTYLE_TOOLTIPS; - if ( style & wxTB_FLAT && wxApp::GetComCtl32Version() > 400 ) + if ( style & wxTB_FLAT ) msStyle |= TBSTYLE_FLAT; - if ( style & wxTB_HORZ_LAYOUT && wxApp::GetComCtl32Version() >= 470 ) + if ( style & wxTB_HORZ_LAYOUT ) msStyle |= TBSTYLE_LIST; if ( style & wxTB_NODIVIDER ) @@ -532,8 +594,13 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const // ---------------------------------------------------------------------------- bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), - wxToolBarToolBase * WXUNUSED(tool)) + wxToolBarToolBase *tool) { + // We might be inserting back a tool previously removed from the toolbar, + // make sure to reset its "to be deleted" flag to ensure that we do take it + // into account during our layout even in this case. + static_cast(tool)->ToBeDeleted(false); + // nothing special to do here - we really create the toolbar buttons in // Realize() later InvalidateBestSize(); @@ -542,100 +609,43 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) { - // the main difficulty we have here is with the controls in the toolbars: - // as we (sometimes) use several separators to cover up the space used by - // them, the indices are not the same for us and the toolbar - - // first determine the position of the first button to delete: it may be - // different from pos if we use several separators to cover the space used - // by a control - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - wxToolBarToolBase *tool2 = node->GetData(); - if ( tool2 == tool ) - { - // let node point to the next node in the list - node = node->GetNext(); - - break; - } - - if ( tool2->IsControl() ) - pos += ((wxToolBarTool *)tool2)->GetSeparatorsCount() - 1; - } - - // now determine the number of buttons to delete and the area taken by them - size_t nButtonsToDelete = 1; - // get the size of the button we're going to delete const RECT r = wxGetTBItemRect(GetHwnd(), pos); int delta = IsVertical() ? r.bottom - r.top : r.right - r.left; - if ( tool->IsControl() ) - { - nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount(); - - if ( !IsVertical() ) - delta *= nButtonsToDelete; - } - m_totalFixedSize -= delta; - // do delete all buttons - m_nButtons -= nButtonsToDelete; - while ( nButtonsToDelete-- > 0 ) + // do delete the button + m_nButtons--; + if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) { - if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) - { - wxLogLastError(wxT("TB_DELETEBUTTON")); + wxLogLastError(wxT("TB_DELETEBUTTON")); - return false; + return false; + } + + static_cast(tool)->ToBeDeleted(); + + // and finally rearrange the tools: + + // by shifting left all controls on the right hand side + wxToolBarToolsList::compatibility_iterator node; + for ( node = m_tools.Find(tool); node; node = node->GetNext() ) + { + wxToolBarTool * const ctool = static_cast(node->GetData()); + + if ( ctool->IsToBeDeleted() ) + continue; + + if ( ctool->IsControl() ) + { + ctool->MoveBy(-delta); } } - // and finally rearrange the tools - - // search for any stretch spacers before the removed tool - bool hasPrecedingStrechables = false; - for ( wxToolBarToolsList::compatibility_iterator nodeStch = m_tools.GetFirst(); - nodeStch != node; nodeStch = nodeStch->GetNext() ) - { - if ( ((wxToolBarTool*)nodeStch->GetData())->IsStretchable() ) - { - hasPrecedingStrechables = true; - break; - } - } - - if ( hasPrecedingStrechables ) - { - // if the removed tool is preceded by stretch spacers - // just redistribute the space - UpdateStretchableSpacersSize(); - } - else - { - // reposition all the controls after this button but before any - // stretch spacer (the toolbar takes care of all normal items) - for ( /* node -> first after deleted */ ; node; node = node->GetNext() ) - { - wxToolBarTool *tool2 = (wxToolBarTool*)node->GetData(); - - if ( tool2->IsControl() ) - { - tool2->MoveBy(-delta); - } - - // if a stretch spacer is found just redistribute the available space - else if ( tool2->IsStretchable() ) - { - UpdateStretchableSpacersSize(); - break; - } - } - } + // by recalculating stretchable spacers, if there are any + UpdateStretchableSpacersSize(); InvalidateBestSize(); @@ -646,31 +656,27 @@ void wxToolBar::CreateDisabledImageList() { wxDELETE(m_disabledImgList); - // as we can't use disabled image list with older versions of comctl32.dll, - // don't even bother creating it - if ( wxApp::GetComCtl32Version() >= 470 ) + // search for the first disabled button img in the toolbar, if any + for ( wxToolBarToolsList::compatibility_iterator + node = m_tools.GetFirst(); node; node = node->GetNext() ) { - // search for the first disabled button img in the toolbar, if any - for ( wxToolBarToolsList::compatibility_iterator - node = m_tools.GetFirst(); node; node = node->GetNext() ) + wxToolBarToolBase *tool = node->GetData(); + wxBitmap bmpDisabled = tool->GetDisabledBitmap(); + if ( bmpDisabled.IsOk() ) { - wxToolBarToolBase *tool = node->GetData(); - wxBitmap bmpDisabled = tool->GetDisabledBitmap(); - if ( bmpDisabled.IsOk() ) - { - const wxSize sizeBitmap = bmpDisabled.GetSize(); - m_disabledImgList = new wxImageList - ( - sizeBitmap.x, - sizeBitmap.y, - bmpDisabled.GetMask() != NULL, - GetToolsCount() - ); - break; - } + const wxSize sizeBitmap = bmpDisabled.GetSize(); + m_disabledImgList = new wxImageList + ( + sizeBitmap.x, + sizeBitmap.y, + // Don't use mask if we have alpha + // (wxImageList will fall back to + // mask if alpha not supported) + !bmpDisabled.HasAlpha(), + GetToolsCount() + ); + break; } - - // we don't have any disabled bitmaps } } @@ -681,7 +687,6 @@ bool wxToolBar::Realize() const size_t nTools = GetToolsCount(); -#ifdef wxREMAP_BUTTON_COLOURS // don't change the values of these constants, they can be set from the // user code via wxSystemOptions enum @@ -701,7 +706,6 @@ bool wxToolBar::Realize() : wxDisplayDepth() <= 8 ? Remap_Buttons : Remap_None; -#endif // wxREMAP_BUTTON_COLOURS // delete all old buttons, if any for ( size_t pos = 0; pos < m_nButtons; pos++ ) @@ -733,25 +737,14 @@ bool wxToolBar::Realize() wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight); dcAllButtons.SelectObject(bitmap); -#ifdef wxREMAP_BUTTON_COLOURS if ( remapValue != Remap_TransparentBg ) -#endif // wxREMAP_BUTTON_COLOURS { - // VZ: why do we hardcode grey colour for CE? - dcAllButtons.SetBackground(wxBrush( -#ifdef __WXWINCE__ - wxColour(0xc0, 0xc0, 0xc0) -#else // !__WXWINCE__ - GetBackgroundColour() -#endif // __WXWINCE__/!__WXWINCE__ - )); + dcAllButtons.SetBackground(GetBackgroundColour()); dcAllButtons.Clear(); } - m_hBitmap = bitmap.GetHBITMAP(); - HBITMAP hBitmap = (HBITMAP)m_hBitmap; + HBITMAP hBitmap = GetHbitmapOf(bitmap); -#ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Bg ) { dcAllButtons.SelectObject(wxNullBitmap); @@ -763,7 +756,6 @@ bool wxToolBar::Realize() dcAllButtons.SelectObject(bitmap); } -#endif // wxREMAP_BUTTON_COLOURS // the button position wxCoord x = 0; @@ -784,11 +776,23 @@ bool wxToolBar::Realize() if ( bmp.IsOk() ) { + // By default bitmaps don't have alpha in wxMSW, but if we + // use a bitmap tool with alpha, we should use alpha for + // the combined bitmap as well. + if ( bmp.HasAlpha() ) + bitmap.UseAlpha(); + int xOffset = wxMax(0, (m_defaultWidth - w)/2); int yOffset = wxMax(0, (m_defaultHeight - h)/2); // notice the last parameter: do use mask dcAllButtons.DrawBitmap(bmp, x + xOffset, yOffset, true); + + // Handle of the bitmap could have changed inside + // DrawBitmap() call if it had to convert it from DDB to + // DIB internally, as is necessary if the bitmap being + // drawn had alpha channel. + hBitmap = GetHbitmapOf(bitmap); } else { @@ -808,33 +812,29 @@ bool wxToolBar::Realize() wxImage imgGreyed = bmp.ConvertToImage().ConvertToGreyscale(); -#ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) { // we need to have light grey background colour for // MapBitmap() to work correctly for ( int y = 0; y < h; y++ ) { - for ( int x = 0; x < w; x++ ) + for ( int xx = 0; xx < w; xx++ ) { - if ( imgGreyed.IsTransparent(x, y) ) - imgGreyed.SetRGB(x, y, + if ( imgGreyed.IsTransparent(xx, y) ) + imgGreyed.SetRGB(xx, y, wxLIGHT_GREY->Red(), wxLIGHT_GREY->Green(), wxLIGHT_GREY->Blue()); } } } -#endif // wxREMAP_BUTTON_COLOURS bmpDisabled = wxBitmap(imgGreyed); } #endif // wxUSE_IMAGE -#ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) MapBitmap(bmpDisabled.GetHBITMAP(), w, h); -#endif // wxREMAP_BUTTON_COLOURS m_disabledImgList->Add(bmpDisabled); } @@ -852,86 +852,77 @@ bool wxToolBar::Realize() // don't delete this HBITMAP! bitmap.SetHBITMAP(0); -#ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) { // Map to system colours hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap, totalBitmapWidth, totalBitmapHeight); } -#endif // wxREMAP_BUTTON_COLOURS + + m_hBitmap = hBitmap; bool addBitmap = true; if ( oldToolBarBitmap ) { #ifdef TB_REPLACEBITMAP - if ( wxApp::GetComCtl32Version() >= 400 ) + TBREPLACEBITMAP replaceBitmap; + replaceBitmap.hInstOld = NULL; + replaceBitmap.hInstNew = NULL; + replaceBitmap.nIDOld = (UINT_PTR)oldToolBarBitmap; + replaceBitmap.nIDNew = (UINT_PTR)hBitmap; + replaceBitmap.nButtons = nButtons; + if ( !::SendMessage(GetHwnd(), TB_REPLACEBITMAP, + 0, (LPARAM) &replaceBitmap) ) { - TBREPLACEBITMAP replaceBitmap; - replaceBitmap.hInstOld = NULL; - replaceBitmap.hInstNew = NULL; - replaceBitmap.nIDOld = (UINT_PTR)oldToolBarBitmap; - replaceBitmap.nIDNew = (UINT_PTR)hBitmap; - replaceBitmap.nButtons = nButtons; - if ( !::SendMessage(GetHwnd(), TB_REPLACEBITMAP, - 0, (LPARAM) &replaceBitmap) ) - { - wxFAIL_MSG(wxT("Could not replace the old bitmap")); - } - - ::DeleteObject(oldToolBarBitmap); - - // already done - addBitmap = false; + wxFAIL_MSG(wxT("Could not replace the old bitmap")); } - else + + ::DeleteObject(oldToolBarBitmap); + + // already done + addBitmap = false; +#else + // we can't replace the old bitmap, so we will add another one + // (awfully inefficient, but what else to do?) and shift the bitmap + // indices accordingly + addBitmap = true; + + bitmapId = m_nButtons; #endif // TB_REPLACEBITMAP - { - // we can't replace the old bitmap, so we will add another one - // (awfully inefficient, but what else to do?) and shift the bitmap - // indices accordingly - addBitmap = true; - - bitmapId = m_nButtons; - } } if ( addBitmap ) // no old bitmap or we can't replace it { - TBADDBITMAP addBitmap; - addBitmap.hInst = 0; - addBitmap.nID = (UINT_PTR)hBitmap; + TBADDBITMAP tbAddBitmap; + tbAddBitmap.hInst = 0; + tbAddBitmap.nID = (UINT_PTR)hBitmap; if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP, - (WPARAM) nButtons, (LPARAM)&addBitmap) == -1 ) + (WPARAM) nButtons, (LPARAM)&tbAddBitmap) == -1 ) { wxFAIL_MSG(wxT("Could not add bitmap to toolbar")); } } - // disable image lists are only supported in comctl32.dll 4.70+ - if ( wxApp::GetComCtl32Version() >= 470 ) - { - HIMAGELIST hil = m_disabledImgList - ? GetHimagelistOf(m_disabledImgList) - : 0; + HIMAGELIST hil = m_disabledImgList + ? GetHimagelistOf(m_disabledImgList) + : 0; - // notice that we set the image list even if don't have one right - // now as we could have it before and need to reset it in this case - HIMAGELIST oldImageList = (HIMAGELIST) - ::SendMessage(GetHwnd(), TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hil); + // notice that we set the image list even if don't have one right + // now as we could have it before and need to reset it in this case + HIMAGELIST oldImageList = (HIMAGELIST) + ::SendMessage(GetHwnd(), TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hil); - // delete previous image list if any - if ( oldImageList ) - ::DeleteObject(oldImageList); - } + // delete previous image list if any + if ( oldImageList ) + ::DeleteObject(oldImageList); } // Next add the buttons and separators // ----------------------------------- - wxScopedArray buttons(new TBBUTTON[nTools]); + wxScopedArray buttons(nTools); // this array will hold the indices of all controls in the toolbar wxArrayInt controlIds; @@ -942,14 +933,6 @@ bool wxToolBar::Realize() { wxToolBarTool *tool = static_cast(node->GetData()); - // don't add separators to the vertical toolbar with old comctl32.dll - // versions as they didn't handle this properly - if ( IsVertical() && tool->IsSeparator() && - wxApp::GetComCtl32Version() <= 472 ) - { - continue; - } - TBBUTTON& button = buttons[i]; wxZeroMemory(button); @@ -958,6 +941,25 @@ bool wxToolBar::Realize() switch ( tool->GetStyle() ) { case wxTOOL_STYLE_CONTROL: + if ( wxStaticText *staticText = tool->GetStaticText() ) + { + // Display control and its label only if buttons have icons + // and texts as otherwise there is not enough room on the + // toolbar to fit the label. + staticText-> + Show(HasFlag(wxTB_TEXT) && !HasFlag(wxTB_NOICONS)); + } + + // Set separator width/height to fit the control width/height + // taking into account tool padding value. + // (height is not used but it is set for the sake of consistency). + { + const wxSize sizeControl = tool->GetControl()->GetSize(); + button.iBitmap = m_toolPacking + (IsVertical() ? sizeControl.y : sizeControl.x); + } + + wxFALLTHROUGH; + case wxTOOL_STYLE_SEPARATOR: if ( tool->IsStretchableSpace() ) { @@ -965,14 +967,17 @@ bool wxToolBar::Realize() // so we need a valid id for it and not wxID_SEPARATOR // which is used by spacers by default tool->AllocSpacerId(); - - // also set the number of separators so that the logic in - // HandlePaint() works correctly - tool->SetSeparatorsCount(1); } button.idCommand = tool->GetId(); - button.fsState = TBSTATE_ENABLED; + + // We don't embed controls in the vertical toolbar but for + // every control there must exist a corresponding button to + // keep indexes the same as in the horizontal case. + if ( IsVertical() && tool->IsControl() ) + button.fsState = TBSTATE_HIDDEN; + else + button.fsState = TBSTATE_ENABLED; button.fsStyle = TBSTYLE_SEP; break; @@ -991,7 +996,7 @@ bool wxToolBar::Realize() if ( tool->IsEnabled() ) button.fsState |= TBSTATE_ENABLED; - if ( tool->IsToggled() ) + if ( MSWShouldBeChecked(tool) ) button.fsState |= TBSTATE_CHECKED; switch ( tool->GetKind() ) @@ -1018,12 +1023,12 @@ bool wxToolBar::Realize() while ( nodePrev ) { TBBUTTON& prevButton = buttons[prevIndex]; - wxToolBarToolBase *tool = nodePrev->GetData(); - if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) + wxToolBarToolBase *toolPrev = nodePrev->GetData(); + if ( !toolPrev->IsButton() || toolPrev->GetKind() != wxITEM_RADIO ) break; - if ( tool->Toggle(false) ) - DoToggleTool(tool, false); + if ( toolPrev->Toggle(false) ) + DoToggleTool(toolPrev, false); prevButton.fsState &= ~TBSTATE_CHECKED; nodePrev = nodePrev->GetPrevious(); @@ -1052,13 +1057,15 @@ bool wxToolBar::Realize() break; } - // Instead of using fixed widths for all buttons, size them + // When toolbar has wxTB_HORZ_LAYOUT style then + // instead of using fixed widths for all buttons, size them // automatically according to the size of their bitmap and text - // label, if present. This particularly matters for toolbars - // with the wxTB_HORZ_LAYOUT style: they look hideously ugly - // without autosizing when the labels have even slightly - // different lengths. - button.fsStyle |= TBSTYLE_AUTOSIZE; + // label, if present. They look hideously ugly without autosizing + // when the labels have even slightly different lengths. + if ( !IsVertical() ) + { + button.fsStyle |= TBSTYLE_AUTOSIZE; + } bitmapId++; break; @@ -1086,7 +1093,7 @@ bool wxToolBar::Realize() { wxToolBarTool * const tool = (wxToolBarTool*)node->GetData(); - const RECT r = wxGetTBItemRect(GetHwnd(), toolIndex); + const RECT r = wxGetTBItemRect(GetHwnd(), toolIndex, tool->GetId()); if ( !tool->IsControl() ) { @@ -1098,78 +1105,27 @@ bool wxToolBar::Realize() continue; } + wxControl * const control = tool->GetControl(); if ( IsVertical() ) { // don't embed controls in the vertical toolbar, this doesn't look // good and wxGTK doesn't do it neither (and the code below can't // deal with this case) + control->Hide(); continue; } - wxControl * const control = tool->GetControl(); + control->Show(); wxStaticText * const staticText = tool->GetStaticText(); wxSize size = control->GetSize(); wxSize staticTextSize; - if ( staticText ) + if ( staticText && staticText->IsShown() ) { staticTextSize = staticText->GetSize(); staticTextSize.y += 3; // margin between control and its label } - // TB_SETBUTTONINFO message is only supported by comctl32.dll 4.71+ -#ifdef TB_SETBUTTONINFO - // available in headers, now check whether it is available now - // (during run-time) - if ( wxApp::GetComCtl32Version() >= 471 ) - { - // set the (underlying) separators width to be that of the - // control - TBBUTTONINFO tbbi; - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_SIZE; - tbbi.cx = (WORD)size.x; - if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO, - tool->GetId(), (LPARAM)&tbbi) ) - { - // the id is probably invalid? - wxLogLastError(wxT("TB_SETBUTTONINFO")); - } - } - else -#endif // comctl32.dll 4.71 - // TB_SETBUTTONINFO unavailable - { - // try adding several separators to fit the controls width - int widthSep = r.right - r.left; - - TBBUTTON tbb; - wxZeroMemory(tbb); - tbb.idCommand = 0; - tbb.fsState = TBSTATE_ENABLED; - tbb.fsStyle = TBSTYLE_SEP; - - size_t nSeparators = size.x / widthSep; - for ( size_t nSep = 0; nSep < nSeparators; nSep++ ) - { - if ( !::SendMessage(GetHwnd(), TB_INSERTBUTTON, - toolIndex, (LPARAM)&tbb) ) - { - wxLogLastError(wxT("TB_INSERTBUTTON")); - } - - toolIndex++; - } - - // remember the number of separators we used - we'd have to - // delete all of them later - tool->SetSeparatorsCount(nSeparators); - - // adjust the controls width to exactly cover the separators - size.x = (nSeparators + 1)*widthSep; - control->SetSize(size.x, wxDefaultCoord); - } - // position the control itself correctly vertically centering it on the // icon area of the toolbar int height = r.bottom - r.top - staticTextSize.y; @@ -1187,7 +1143,9 @@ bool wxToolBar::Realize() if ( diff < 0 ) { // the control is too high, resize to fit - control->SetSize(wxDefaultCoord, height - 2); + // Actually don't set the size, otherwise we can never fit + // the toolbar around the controls. + // control->SetSize(wxDefaultCoord, height - 2); diff = 2; } @@ -1198,14 +1156,15 @@ bool wxToolBar::Realize() staticText->Show(); } - control->Move(r.left, r.top + (diff + 1) / 2); + // Take also into account tool padding value. + control->Move(r.left + m_toolPacking/2, r.top + (diff + 1) / 2); if ( staticText ) { - staticText->Move(r.left + (size.x - staticTextSize.x)/2, + staticText->Move(r.left + m_toolPacking/2 + (size.x - staticTextSize.x)/2, r.bottom - staticTextSize.y); } - m_totalFixedSize += size.x; + m_totalFixedSize += r.right - r.left; } // the max index is the "real" number of buttons - i.e. counting even the @@ -1228,27 +1187,54 @@ bool wxToolBar::Realize() InvalidateBestSize(); UpdateSize(); + if ( IsVertical() ) + { + // For vertical toolbar heights of buttons are incorrect + // unless TB_AUTOSIZE in invoked. + // We need to recalculate fixed elements size again. + m_totalFixedSize = 0; + toolIndex = 0; + for ( node = m_tools.GetFirst(); node; node = node->GetNext(), toolIndex++ ) + { + wxToolBarTool * const tool = (wxToolBarTool*)node->GetData(); + if ( !tool->IsStretchableSpace() ) + { + const RECT r = wxGetTBItemRect(GetHwnd(), toolIndex); + if ( !IsVertical() ) + m_totalFixedSize += r.right - r.left; + else if ( !tool->IsControl() ) + m_totalFixedSize += r.bottom - r.top; + } + } + // Enforce invoking UpdateStretchableSpacersSize() with correct value of fixed elements size. + UpdateSize(); + } + return true; } void wxToolBar::UpdateStretchableSpacersSize() { -#ifdef TB_SETBUTTONINFO - // we can't resize the spacers if TB_SETBUTTONINFO is not supported (we - // could try to do it with multiple separators as for the controls but this - // is too painful and it just doesn't seem to be worth doing for the - // ancient systems) - if ( wxApp::GetComCtl32Version() < 471 ) - return; - // check if we have any stretchable spacers in the first place unsigned numSpaces = 0; wxToolBarToolsList::compatibility_iterator node; + int toolIndex = 0; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarTool * const tool = (wxToolBarTool*)node->GetData(); + + if ( tool->IsToBeDeleted() ) + continue; + if ( tool->IsStretchableSpace() ) - numSpaces++; + { + // Count only enabled items + const RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex); + if ( !::IsRectEmpty(&rcItem) ) + numSpaces++; + } + + toolIndex++; } if ( !numSpaces ) @@ -1271,40 +1257,63 @@ void wxToolBar::UpdateStretchableSpacersSize() // move the controls manually ourselves to ensure they remain at the // correct place int offset = 0; - int toolIndex = 0; - for ( node = m_tools.GetFirst(); node; node = node->GetNext(), toolIndex++ ) + toolIndex = 0; + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarTool * const tool = (wxToolBarTool*)node->GetData(); + if ( tool->IsToBeDeleted() ) + continue; + if ( tool->IsControl() && offset ) { tool->MoveBy(offset); - + toolIndex++; continue; } if ( !tool->IsStretchableSpace() ) + { + toolIndex++; continue; + } const RECT rcOld = wxGetTBItemRect(GetHwnd(), toolIndex); - WinStruct tbbi; - tbbi.dwMask = TBIF_SIZE; - tbbi.cx = --numSpaces ? sizeSpacer : sizeLastSpacer; + const int oldSize = IsVertical()? (rcOld.bottom - rcOld.top): (rcOld.right - rcOld.left); + const int newSize = --numSpaces ? sizeSpacer : sizeLastSpacer; + if ( newSize != oldSize) + { + if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, toolIndex, 0) ) + { + wxLogLastError(wxT("TB_DELETEBUTTON (separator)")); + } + else + { + TBBUTTON button; + wxZeroMemory(button); - if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO, - tool->GetId(), (LPARAM)&tbbi) ) - { - wxLogLastError(wxT("TB_SETBUTTONINFO")); - } - else - { - // we successfully resized this one, move all the controls after it - // by the corresponding amount (may be positive or negative) - offset += tbbi.cx - (rcOld.right - rcOld.left); + button.idCommand = tool->GetId(); + button.iBitmap = newSize; // set separator width/height + button.fsState = TBSTATE_ENABLED; + button.fsStyle = TBSTYLE_SEP; + if ( IsVertical() ) + button.fsState |= TBSTATE_WRAP; + if ( !::SendMessage(GetHwnd(), TB_INSERTBUTTON, toolIndex, (LPARAM)&button) ) + { + wxLogLastError(wxT("TB_INSERTBUTTON (separator)")); + } + else + { + // We successfully replaced this seprator, move all the controls after it + // by the corresponding amount (may be positive or negative) + offset += newSize - oldSize; + } + } } + + toolIndex++; } -#endif // TB_SETBUTTONINFO } // ---------------------------------------------------------------------------- @@ -1356,13 +1365,24 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) bool allowLeftClick = OnLeftClick(id, toggled); + // Check if the tool hasn't been deleted in the event handler (notice that + // it's also possible that this tool was deleted and a new tool with the + // same ID was created, so we really need to check if the pointer to the + // tool with the given ID didn't change, not just that it's non null). + if ( FindById(id) != tool ) + { + // The rest of this event handler deals with updating the tool and must + // not be executed if the tool doesn't exist any more. + return true; + } + // Restore the unpressed state. Enabled/toggled state might have been // changed since so take care of it. if (tool->IsEnabled()) state |= TBSTATE_ENABLED; else state &= ~TBSTATE_ENABLED; - if (tool->IsToggled()) + if ( MSWShouldBeChecked(tool) ) state |= TBSTATE_CHECKED; else state &= ~TBSTATE_CHECKED; @@ -1375,7 +1395,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) // revert back tool->Toggle(!toggled); - ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0)); + ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, + MAKELONG(MSWShouldBeChecked(tool), 0)); } return true; @@ -1448,6 +1469,12 @@ bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), void wxToolBar::SetToolBitmapSize(const wxSize& size) { + // Leave the effective size as (0, 0) if we are not showing bitmaps at all. + wxSize effectiveSize; + + if ( !HasFlag(wxTB_NOICONS) ) + effectiveSize = size; + wxToolBarBase::SetToolBitmapSize(size); ::SendMessage(GetHwnd(), TB_SETBITMAPSIZE, 0, MAKELONG(size.x, size.y)); @@ -1470,51 +1497,35 @@ void wxToolBar::SetRows(int nRows) m_maxRows = nRows; + // Enable stretchable spacers only for single-row horizontal toobar or + // single-column vertical toolbar, they don't work correctly when the extra + // space can be redistributed among multiple columns or rows at any moment. + const bool enable = (!IsVertical() && m_maxRows == 1) || + (IsVertical() && (size_t)m_maxRows == m_nButtons); + + const LPARAM state = MAKELONG(enable ? TBSTATE_ENABLED : TBSTATE_HIDDEN, 0); + wxToolBarToolsList::compatibility_iterator node; + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + wxToolBarTool * const tool = (wxToolBarTool*)node->GetData(); + if ( tool->IsStretchableSpace() ) + { + if ( !::SendMessage(GetHwnd(), TB_SETSTATE, tool->GetId(), state) ) + { + wxLogLastError(wxT("TB_SETSTATE (stretchable spacer)")); + } + } + } + UpdateSize(); } // The button size is bigger than the bitmap size wxSize wxToolBar::GetToolSize() const { - // TB_GETBUTTONSIZE is supported from version 4.70 -#if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 ) \ - && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) \ - && !defined (__DIGITALMARS__) - if ( wxApp::GetComCtl32Version() >= 470 ) - { - DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0); + DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0); - return wxSize(LOWORD(dw), HIWORD(dw)); - } - else -#endif // comctl32.dll 4.70+ - { - // defaults - return wxSize(m_defaultWidth + 8, m_defaultHeight + 7); - } -} - -static -wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, - size_t index ) -{ - wxToolBarToolsList::compatibility_iterator current = tools.GetFirst(); - - for ( ; current ; current = current->GetNext() ) - { - if ( index == 0 ) - return current->GetData(); - - wxToolBarTool *tool = (wxToolBarTool *)current->GetData(); - size_t separators = tool->GetSeparatorsCount(); - - // if it is a normal button, sepcount == 0, so skip 1 item (the button) - // otherwise, skip as many items as the separator count, plus the - // control itself - index -= separators ? separators + 1 : 1; - } - - return 0; + return wxSize(LOWORD(dw), HIWORD(dw)); } wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const @@ -1530,18 +1541,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const // it's a separator or there is no tool at all there return NULL; - // when TB_SETBUTTONINFO is available (both during compile- and run-time), - // we don't use the dummy separators hack -#ifdef TB_SETBUTTONINFO - if ( wxApp::GetComCtl32Version() >= 471 ) - { return m_tools.Item((size_t)index)->GetData(); - } - else -#endif // TB_SETBUTTONINFO - { - return GetItemSkippingDummySpacers( m_tools, (size_t) index ); - } } void wxToolBar::UpdateSize() @@ -1597,14 +1597,34 @@ void wxToolBar::SetWindowStyleFlag(long style) void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable) { - ::SendMessage(GetHwnd(), TB_ENABLEBUTTON, - (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); + if ( tool->IsButton() ) + { + ::SendMessage(GetHwnd(), TB_ENABLEBUTTON, + (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); + + // Adjust displayed checked state -- it could have changed if the tool is + // disabled and has a custom "disabled state" bitmap. + DoToggleTool(tool, tool->IsToggled()); + } + else if ( tool->IsControl() ) + { + wxToolBarTool* tbTool = static_cast(tool); + + tbTool->GetControl()->Enable(enable); + wxStaticText* text = tbTool->GetStaticText(); + if ( text ) + text->Enable(enable); + } } -void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle) +void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, + bool WXUNUSED_UNLESS_DEBUG(toggle)) { + wxASSERT_MSG( tool->IsToggled() == toggle, wxT("Inconsistent tool state") ); + ::SendMessage(GetHwnd(), TB_CHECKBUTTON, - (WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0)); + (WPARAM)tool->GetId(), + (LPARAM)MAKELONG(MSWShouldBeChecked(tool), 0)); } void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) @@ -1638,6 +1658,19 @@ void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) } } +void wxToolBar::SetToolPacking(int packing) +{ + if ( packing > 0 && packing != m_toolPacking ) + { + m_toolPacking = packing; + if ( GetHwnd() ) + { + MSWSetPadding(packing); + Realize(); + } + } +} + // ---------------------------------------------------------------------------- // event handlers // ---------------------------------------------------------------------------- @@ -1702,12 +1735,68 @@ void wxToolBar::OnEraseBackground(wxEraseEvent& event) bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) { // wait until we have some tools - if ( !GetToolsCount() ) + const int toolsCount = GetToolsCount(); + if ( toolsCount == 0 ) return false; // calculate our minor dimension ourselves - we're confusing the standard // logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks - const RECT r = wxGetTBItemRect(GetHwnd(), 0); + // Find bounding box for all rows. + RECT r; + ::SetRectEmpty(&r); + // Bounding box for single (current) row + RECT rcRow; + ::SetRectEmpty(&rcRow); + int rowPosX = INT_MIN; + wxToolBarToolsList::compatibility_iterator node; + int i = 0; + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + wxToolBarTool * const + tool = static_cast(node->GetData()); + if ( tool->IsToBeDeleted() ) + continue; + + // Skip hidden buttons + const RECT rcItem = wxGetTBItemRect(GetHwnd(), i); + if ( ::IsRectEmpty(&rcItem) ) + { + i++; + continue; + } + + if ( rcItem.top > rowPosX ) + { + // We have the next row. + rowPosX = rcItem.top; + + // Shift origin to (0, 0) to make it the same as for the total rect. + ::OffsetRect(&rcRow, -rcRow.left, -rcRow.top); + + // And update the bounding box for all rows. + ::UnionRect(&r, &r, &rcRow); + + // Reset the current row bounding box for the next row. + ::SetRectEmpty(&rcRow); + } + + // Separators shouldn't be taken into account as they are sometimes + // reported to have the width of the entire client area by the toolbar. + // And we know that they are not the biggest items in the toolbar in + // any case, so just skip them. + if( !tool->IsSeparator() ) + { + // Update bounding box of current row + ::UnionRect(&rcRow, &rcRow, &rcItem); + } + + i++; + } + + // Take into account the last row rectangle too. + ::OffsetRect(&rcRow, -rcRow.left, -rcRow.top); + ::UnionRect(&r, &r, &rcRow); + if ( !r.right ) return false; @@ -1716,10 +1805,6 @@ bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) if ( IsVertical() ) { w = r.right - r.left; - if ( m_maxRows ) - { - w *= (m_nButtons + m_maxRows - 1)/m_maxRows; - } h = HIWORD(lParam); } else @@ -1729,6 +1814,20 @@ bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) h = r.bottom - r.top - 3; else h = r.bottom - r.top; + + // Take control height into account + for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) + { + wxToolBarTool * const + tool = static_cast(node->GetData()); + if (tool->IsControl()) + { + int y = (tool->GetControl()->GetSize().y - 2); // -2 since otherwise control height + 4 (below) is too much + if (y > h) + h = y; + } + } + if ( m_maxRows ) { // FIXME: hardcoded separator line height... @@ -1765,38 +1864,41 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam) int toolIndex = 0; for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; - node = node->GetNext() ) + node = node->GetNext(), toolIndex++ ) { wxToolBarTool * const tool = static_cast(node->GetData()); + if ( tool->IsToBeDeleted() ) + continue; + if ( tool->IsControl() || tool->IsStretchableSpace() ) { - const size_t numSeps = tool->GetSeparatorsCount(); - for ( size_t n = 0; n < numSeps; n++, toolIndex++ ) - { - // for some reason TB_GETITEMRECT returns a rectangle 1 pixel - // shorter than the full window size (at least under Windows 7) - // but we need to erase the full width/height below - RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex); - if ( IsVertical() ) - { - rcItem.left = 0; - rcItem.right = rectTotal.width; - } - else - { - rcItem.top = 0; - rcItem.bottom = rectTotal.height; - } + // for some reason TB_GETITEMRECT returns a rectangle 1 pixel + // shorter than the full window size (at least under Windows 7) + // but we need to erase the full width/height below + RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex); - rgnDummySeps.Union(wxRectFromRECT(rcItem)); + // Skip hidden buttons + if ( ::IsRectEmpty(&rcItem) ) + continue; + + if ( IsVertical() ) + { + rcItem.left = 0; + rcItem.right = rectTotal.width; } - } - else - { - // normal tools never correspond to more than one native button - toolIndex++; + else + { + rcItem.bottom = rcItem.top + rectTotal.height / m_maxRows; + } + + // Apparently, regions of height < 3 are not taken into account + // in clipping so we need to extend them for this purpose. + if ( rcItem.bottom - rcItem.top > 0 && rcItem.bottom - rcItem.top < 3 ) + rcItem.bottom = rcItem.top + 3; + + rgnDummySeps.Union(wxRectFromRECT(rcItem)); } } @@ -1940,11 +2042,7 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam #ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK case WM_PAINT: - // refreshing the controls in the toolbar inside a composite window - // results in an endless stream of WM_PAINT messages -- and seems - // to be unnecessary anyhow as everything works just fine without - // any special workarounds in this case - if ( !IsDoubleBuffered() && HandlePaint(wParam, lParam) ) + if ( HandlePaint(wParam, lParam) ) return 0; break; #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK @@ -1961,8 +2059,6 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam // private functions // ---------------------------------------------------------------------------- -#ifdef wxREMAP_BUTTON_COLOURS - WXHBITMAP wxToolBar::MapBitmap(WXHBITMAP bitmap, int width, int height) { MemoryHDC hdcMem; @@ -2009,6 +2105,4 @@ WXHBITMAP wxToolBar::MapBitmap(WXHBITMAP bitmap, int width, int height) return bitmap; } -#endif // wxREMAP_BUTTON_COLOURS - #endif // wxUSE_TOOLBAR diff --git a/Externals/wxWidgets3/src/msw/tooltip.cpp b/Externals/wxWidgets3/src/msw/tooltip.cpp index 56aa27bad9..e5937918f1 100644 --- a/Externals/wxWidgets3/src/msw/tooltip.cpp +++ b/Externals/wxWidgets3/src/msw/tooltip.cpp @@ -30,6 +30,8 @@ #include "wx/msw/wrapcctl.h" // include "properly" #include "wx/app.h" #include "wx/control.h" + #include "wx/module.h" + #include "wx/toplevel.h" #endif #include "wx/tokenzr.h" @@ -129,13 +131,34 @@ public: // then as the control gets "focus lost" events and dismisses the // tooltip which then reappears because mouse remains hovering over the // control, see SF patch 1821229 - if ( wxApp::GetComCtl32Version() >= 470 ) - { - uFlags |= TTF_TRANSPARENT; - } + uFlags |= TTF_TRANSPARENT; } }; +// Takes care of deleting ToolTip control window when shutting down the library. +class wxToolTipModule : public wxModule +{ +public: + wxToolTipModule() + { + } + + virtual bool OnInit() wxOVERRIDE + { + return true; + } + + virtual void OnExit() wxOVERRIDE + { + wxToolTip::DeleteToolTipCtrl(); + } + +private: + wxDECLARE_DYNAMIC_CLASS(wxToolTipModule); +}; + +wxIMPLEMENT_DYNAMIC_CLASS(wxToolTipModule, wxModule); + #ifdef __VISUALC__ #pragma warning( default : 4097 ) #endif @@ -255,6 +278,15 @@ void wxToolTip::SetMaxWidth(int width) ms_maxWidth = width; } +void wxToolTip::DeleteToolTipCtrl() +{ + if ( ms_hwndTT ) + { + ::DestroyWindow((HWND)ms_hwndTT); + ms_hwndTT = (WXHWND)NULL; + } +} + // --------------------------------------------------------------------------- // implementation helpers // --------------------------------------------------------------------------- @@ -266,7 +298,7 @@ WXHWND wxToolTip::GetToolTipCtrl() if ( !ms_hwndTT ) { WXDWORD exflags = 0; - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( wxApp::MSWGetDefaultLayout() == wxLayout_RightToLeft ) { exflags |= WS_EX_LAYOUTRTL; } @@ -298,6 +330,40 @@ WXHWND wxToolTip::GetToolTipCtrl() return ms_hwndTT; } +/* static */ +void wxToolTip::UpdateVisibility() +{ + wxToolInfo ti(NULL, 0, wxRect()); + ti.uFlags = 0; + + if ( !SendTooltipMessage(ms_hwndTT, TTM_GETCURRENTTOOL, &ti) ) + return; + + wxWindow* const associatedWindow = wxFindWinFromHandle(ti.hwnd); + if ( !associatedWindow ) + return; + + bool hideTT = false; + if ( !associatedWindow->IsShownOnScreen() ) + { + // If the associated window or its parent is hidden, the tooltip + // shouldn't remain shown. + hideTT = true; + } + else + { + // Even if it's not hidden, it could also be iconized. + wxTopLevelWindow* const + frame = wxDynamicCast(wxGetTopLevelParent(associatedWindow), wxTopLevelWindow); + + if ( frame && frame->IsIconized() ) + hideTT = true; + } + + if ( hideTT ) + ::ShowWindow(ms_hwndTT, SW_HIDE); +} + /* static */ void wxToolTip::RelayEvent(WXMSG *msg) { @@ -308,7 +374,7 @@ void wxToolTip::RelayEvent(WXMSG *msg) // ctor & dtor // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip(const wxString &tip) : m_text(tip) @@ -406,78 +472,7 @@ void wxToolTip::DoAddHWND(WXHWND hWnd) } #ifdef TTM_SETMAXTIPWIDTH - if ( wxApp::GetComCtl32Version() >= 470 ) - { - // use TTM_SETMAXTIPWIDTH to make tooltip multiline using the - // extent of its first line as max value - HFONT hfont = (HFONT) - SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, 0); - - if ( !hfont ) - { - hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - if ( !hfont ) - { - wxLogLastError(wxT("GetStockObject(DEFAULT_GUI_FONT)")); - } - } - - MemoryHDC hdc; - if ( !hdc ) - { - wxLogLastError(wxT("CreateCompatibleDC(NULL)")); - } - - if ( !SelectObject(hdc, hfont) ) - { - wxLogLastError(wxT("SelectObject(hfont)")); - } - - // find the width of the widest line - int maxWidth = 0; - wxStringTokenizer tokenizer(m_text, wxT("\n")); - while ( tokenizer.HasMoreTokens() ) - { - const wxString token = tokenizer.GetNextToken(); - - SIZE sz; - if ( !::GetTextExtentPoint32(hdc, token.t_str(), - token.length(), &sz) ) - { - wxLogLastError(wxT("GetTextExtentPoint32")); - } - - if ( sz.cx > maxWidth ) - maxWidth = sz.cx; - } - - // limit size to ms_maxWidth, if set - if ( ms_maxWidth == 0 ) - { - // this is more or less arbitrary but seems to work well - static const int DEFAULT_MAX_WIDTH = 400; - - ms_maxWidth = wxGetClientDisplayRect().width / 2; - - if ( ms_maxWidth > DEFAULT_MAX_WIDTH ) - ms_maxWidth = DEFAULT_MAX_WIDTH; - } - - if ( ms_maxWidth != -1 && maxWidth > ms_maxWidth ) - maxWidth = ms_maxWidth; - - // only set a new width if it is bigger than the current setting: - // otherwise adding a tooltip with shorter line(s) than a previous - // one would result in breaking the longer lines unnecessarily as - // all our tooltips share the same maximal width - if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(), - TTM_GETMAXTIPWIDTH, 0) ) - { - SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, - wxUIntToPtr(maxWidth)); - } - } - else + if ( !AdjustMaxWidth() ) #endif // TTM_SETMAXTIPWIDTH { // replace the '\n's with spaces because otherwise they appear as @@ -546,6 +541,15 @@ void wxToolTip::SetTip(const wxString& tip) { m_text = tip; +#ifdef TTM_SETMAXTIPWIDTH + if ( !AdjustMaxWidth() ) +#endif // TTM_SETMAXTIPWIDTH + { + // replace the '\n's with spaces because otherwise they appear as + // unprintable characters in the tooltip string + m_text.Replace(wxT("\n"), wxT(" ")); + } + DoForAllWindows(&wxToolTip::DoSetTip); } @@ -564,6 +568,80 @@ void wxToolTip::DoSetTip(WXHWND hWnd) (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti); } +bool wxToolTip::AdjustMaxWidth() +{ + // use TTM_SETMAXTIPWIDTH to make tooltip multiline using the + // extent of its first line as max value + HFONT hfont = (HFONT) + SendTooltipMessage(GetToolTipCtrl(), WM_GETFONT, 0); + + if ( !hfont ) + { + hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + if ( !hfont ) + { + wxLogLastError(wxT("GetStockObject(DEFAULT_GUI_FONT)")); + } + } + + MemoryHDC hdc; + if ( !hdc ) + { + wxLogLastError(wxT("CreateCompatibleDC(NULL)")); + } + + if ( !SelectObject(hdc, hfont) ) + { + wxLogLastError(wxT("SelectObject(hfont)")); + } + + // find the width of the widest line + int maxWidth = 0; + wxStringTokenizer tokenizer(m_text, wxT("\n")); + while ( tokenizer.HasMoreTokens() ) + { + const wxString token = tokenizer.GetNextToken(); + + SIZE sz; + if ( !::GetTextExtentPoint32(hdc, token.t_str(), + token.length(), &sz) ) + { + wxLogLastError(wxT("GetTextExtentPoint32")); + } + + if ( sz.cx > maxWidth ) + maxWidth = sz.cx; + } + + // limit size to ms_maxWidth, if set + if ( ms_maxWidth == 0 ) + { + // this is more or less arbitrary but seems to work well + static const int DEFAULT_MAX_WIDTH = 400; + + ms_maxWidth = wxGetClientDisplayRect().width / 2; + + if ( ms_maxWidth > DEFAULT_MAX_WIDTH ) + ms_maxWidth = DEFAULT_MAX_WIDTH; + } + + if ( ms_maxWidth != -1 && maxWidth > ms_maxWidth ) + maxWidth = ms_maxWidth; + + // only set a new width if it is bigger than the current setting: + // otherwise adding a tooltip with shorter line(s) than a previous + // one would result in breaking the longer lines unnecessarily as + // all our tooltips share the same maximal width + if ( maxWidth > SendTooltipMessage(GetToolTipCtrl(), + TTM_GETMAXTIPWIDTH, 0) ) + { + SendTooltipMessage(GetToolTipCtrl(), TTM_SETMAXTIPWIDTH, + wxUIntToPtr(maxWidth)); + } + + return true; +} + void wxToolTip::DoForAllWindows(void (wxToolTip::*func)(WXHWND)) { if ( m_window ) diff --git a/Externals/wxWidgets3/src/msw/toplevel.cpp b/Externals/wxWidgets3/src/msw/toplevel.cpp index 25ab481401..0ddfefcbe6 100644 --- a/Externals/wxWidgets3/src/msw/toplevel.cpp +++ b/Externals/wxWidgets3/src/msw/toplevel.cpp @@ -38,16 +38,9 @@ #endif //WX_PRECOMP #include "wx/dynlib.h" +#include "wx/tooltip.h" #include "wx/msw/private.h" -#if defined(__WXWINCE__) && !defined(__HANDHELDPC__) - #include - #include - // Standard SDK doesn't have aygshell.dll: see include/wx/msw/wince/libraries.h - #if _WIN32_WCE < 400 || !defined(__WINCE_STANDARDSDK__) - #include - #endif -#endif #include "wx/msw/winundef.h" #include "wx/msw/missing.h" @@ -62,35 +55,9 @@ #define ICON_SMALL 0 #endif -// FIXME-VC6: Only VC6 doesn't have this in its standard headers so this -// could be removed once support for it is dropped. -#ifndef WM_UNINITMENUPOPUP - #define WM_UNINITMENUPOPUP 0x0125 -#endif - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -#if wxUSE_MENUS || wxUSE_MENUS_NATIVE - extern wxMenu *wxCurrentPopupMenu; -#endif // wxUSE_MENUS || wxUSE_MENUS_NATIVE - - -// ---------------------------------------------------------------------------- -// stubs for missing functions under MicroWindows -// ---------------------------------------------------------------------------- - -#ifdef __WXMICROWIN__ - -// static inline bool IsIconic(HWND WXUNUSED(hwnd)) { return false; } -static inline bool IsZoomed(HWND WXUNUSED(hwnd)) { return false; } - -#endif // __WXMICROWIN__ - // NB: wxDlgProc must be defined here and not in dialog.cpp because the latter // is not included by wxUniv build which does need wxDlgProc -LONG APIENTRY _EXPORT +LONG APIENTRY wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); // ---------------------------------------------------------------------------- @@ -115,18 +82,18 @@ private: // the class used to create it static const wxChar *ms_className; - DECLARE_DYNAMIC_CLASS(wxTLWHiddenParentModule) + wxDECLARE_DYNAMIC_CLASS(wxTLWHiddenParentModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxTLWHiddenParentModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTLWHiddenParentModule, wxModule); // ============================================================================ // wxTopLevelWindowMSW implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxTopLevelWindowMSW, wxTopLevelWindowBase) +wxBEGIN_EVENT_TABLE(wxTopLevelWindowMSW, wxTopLevelWindowBase) EVT_ACTIVATE(wxTopLevelWindowMSW::OnActivate) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxTopLevelWindowMSW creation @@ -145,20 +112,7 @@ void wxTopLevelWindowMSW::Init() m_winLastFocused = NULL; -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - m_MenuBarHWND = 0; -#endif - -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - SHACTIVATEINFO* info = new SHACTIVATEINFO; - wxZeroMemory(*info); - info->cbSize = sizeof(SHACTIVATEINFO); - - m_activateInfo = (void*) info; -#endif - m_menuSystem = NULL; - m_menuDepth = 0; } WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const @@ -170,13 +124,6 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const (style & ~wxBORDER_MASK) | wxBORDER_NONE, exflags ) & ~WS_CHILD & ~WS_VISIBLE; - // For some reason, WS_VISIBLE needs to be defined on creation for - // SmartPhone 2003. The title can fail to be displayed otherwise. -#if defined(__SMARTPHONE__) || (defined(__WXWINCE__) && _WIN32_WCE < 400) - msflags |= WS_VISIBLE; - ((wxTopLevelWindowMSW*)this)->wxWindowBase::Show(true); -#endif - // first select the kind of window being created // // note that if we don't set WS_POPUP, Windows assumes WS_OVERLAPPED and @@ -191,26 +138,13 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const *exflags |= WS_EX_DLGMODALFRAME; else if ( !(style & wxBORDER_NONE) ) msflags |= WS_BORDER; -#ifndef __POCKETPC__ else msflags |= WS_POPUP; -#endif - // normally we consider that all windows without a caption must be popups, - // but CE is an exception: there windows normally do not have the caption - // but shouldn't be made popups as popups can't have menus and don't look - // like normal windows anyhow - - // TODO: Smartphone appears to like wxCAPTION, but we should check that - // we need it. -#if defined(__SMARTPHONE__) || !defined(__WXWINCE__) if ( style & wxCAPTION ) msflags |= WS_CAPTION; -#ifndef __WXWINCE__ else msflags |= WS_POPUP; -#endif // !__WXWINCE__ -#endif // next translate the individual flags @@ -227,12 +161,10 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const msflags |= WS_MAXIMIZEBOX; } -#ifndef __WXWINCE__ // notice that if wxCLOSE_BOX is specified we need to use WS_SYSMENU too as // otherwise the close box doesn't appear if ( style & (wxSYSTEM_MENU | wxCLOSE_BOX) ) msflags |= WS_SYSMENU; -#endif // !__WXWINCE__ // NB: under CE these 2 styles are not supported currently, we should // call Minimize()/Maximize() "manually" if we want to support them @@ -248,8 +180,6 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const if ( exflags ) { - // there is no taskbar under CE, so omit all this -#if !defined(__WXWINCE__) if ( !(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) ) { if ( style & wxFRAME_TOOL_WINDOW ) @@ -283,7 +213,6 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const if ( GetExtraStyle() & wxWS_EX_CONTEXTHELP ) *exflags |= WS_EX_CONTEXTHELP; -#endif // !__WXWINCE__ if ( style & wxSTAY_ON_TOP ) *exflags |= WS_EX_TOPMOST; @@ -326,19 +255,6 @@ WXHWND wxTopLevelWindowMSW::MSWGetParent() const return (WXHWND)hwndParent; } -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -bool wxTopLevelWindowMSW::HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam) -{ - SHACTIVATEINFO *info = (SHACTIVATEINFO*) m_activateInfo; - if ( info ) - { - SHHandleWMSettingChange(GetHwnd(), wParam, lParam, info); - } - - return wxWindowMSW::HandleSettingChange(wParam, lParam); -} -#endif - WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { WXLRESULT rc = 0; @@ -346,35 +262,6 @@ WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WX switch ( message ) { -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - case WM_ACTIVATE: - { - SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo; - if (info) - { - DWORD flags = 0; - if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) flags = SHA_INPUTDIALOG; - SHHandleWMActivate(GetHwnd(), wParam, lParam, info, flags); - } - - // This implicitly sends a wxEVT_ACTIVATE_APP event - if (wxTheApp) - wxTheApp->SetActive(wParam != 0, FindFocus()); - - break; - } - case WM_HIBERNATE: - { - if (wxTheApp) - { - wxActivateEvent event(wxEVT_HIBERNATE, true, wxID_ANY); - event.SetEventObject(wxTheApp); - processed = wxTheApp->ProcessEvent(event); - } - break; - } -#endif // __SMARTPHONE__ || __POCKETPC__ - case WM_SYSCOMMAND: { // From MSDN: @@ -386,10 +273,9 @@ WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WX // using the bitwise AND operator. unsigned id = wParam & 0xfff0; - // Preserve the focus when minimizing/restoring the window: we - // need to do it manually as DefWindowProc() doesn't appear to - // do this for us for some reason (perhaps because we don't use - // WM_NEXTDLGCTL for setting focus?). Moreover, our code in + // Preserve the focus when minimizing/restoring the window: + // surprisingly, DefWindowProc() doesn't do it automatically + // and so we need to it ourselves. Moreover, our code in // OnActivate() doesn't work in this case as we receive the // deactivation event too late when the window is being // minimized and the focus is already NULL by then. Similarly, @@ -429,38 +315,6 @@ WXLRESULT wxTopLevelWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WX #endif // #ifndef __WXUNIVERSAL__ } break; - -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) -#if wxUSE_MENUS - case WM_INITMENUPOPUP: - processed = HandleMenuPopup(wxEVT_MENU_OPEN, (WXHMENU)wParam); - break; - - case WM_MENUSELECT: - { - WXWORD item, flags; - WXHMENU hmenu; - UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); - - processed = HandleMenuSelect(item, flags, hmenu); - } - break; - - case WM_EXITMENULOOP: - // Under Windows 98 and 2000 and later we're going to get - // WM_UNINITMENUPOPUP which will be used to generate this event - // with more information (notably the menu that was closed) so we - // only need this one under old Windows systems where the newer - // event is never sent. - if ( wxGetWinVersion() < wxWinVersion_98 ) - processed = HandleExitMenuLoop(wParam); - break; - - case WM_UNINITMENUPOPUP: - processed = HandleMenuPopup(wxEVT_MENU_CLOSE, (WXHMENU)wParam); - break; -#endif // wxUSE_MENUS -#endif // !__WXMICROWIN__ } if ( !processed ) @@ -474,10 +328,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, const wxPoint& pos, const wxSize& size) { -#ifdef __WXMICROWIN__ - // no dialogs support under MicroWin yet - return CreateFrame(title, pos, size); -#else // !__WXMICROWIN__ // static cast is valid as we're only ever called for dialogs wxWindow * const parent = static_cast(this)->GetParentForModalDialog(); @@ -499,7 +349,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, return false; } -#if !defined(__WXWINCE__) // For some reason, the system menu is activated when we use the // WS_EX_CONTEXTHELP style, so let's set a reasonable icon if ( HasExtraStyle(wxWS_EX_CONTEXTHELP) ) @@ -516,7 +365,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, } } } -#endif // !__WXWINCE__ if ( !title.empty() ) { @@ -525,7 +373,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, SubclassWin(m_hWnd); -#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) // move the dialog to its initial position without forcing repainting int x, y, w, h; (void)MSWGetCreateWindowCoords(pos, size, x, y, w, h); @@ -544,15 +391,8 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, wxLogLastError(wxT("MoveWindow")); } } -#endif // !__WXWINCE__ - -#ifdef __SMARTPHONE__ - // Work around title non-display glitch - Show(false); -#endif return true; -#endif // __WXMICROWIN__/!__WXMICROWIN__ } bool wxTopLevelWindowMSW::CreateFrame(const wxString& title, @@ -564,10 +404,8 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title, const wxSize sz = IsAlwaysMaximized() ? wxDefaultSize : size; -#ifndef __WXWINCE__ - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( wxApp::MSWGetDefaultLayout(m_parent) == wxLayout_RightToLeft ) exflags |= WS_EX_LAYOUTRTL; -#endif return MSWCreate(MSWGetRegisteredClassName(), title.t_str(), pos, sz, flags, exflags); @@ -631,8 +469,7 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, // all dialogs are popups dlgTemplate->style |= WS_POPUP; -#ifndef __WXWINCE__ - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + if ( wxApp::MSWGetDefaultLayout(m_parent) == wxLayout_RightToLeft ) { dlgTemplate->dwExtendedStyle |= WS_EX_LAYOUTRTL; } @@ -640,7 +477,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, // force 3D-look if necessary, it looks impossibly ugly otherwise if ( style & (wxRESIZE_BORDER | wxCAPTION) ) dlgTemplate->style |= DS_MODALFRAME; -#endif ret = CreateDialog(dlgTemplate, title, pos, sizeReal); free(dlgTemplate); @@ -650,12 +486,10 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, ret = CreateFrame(title, pos, sizeReal); } -#ifndef __WXWINCE__ if ( ret && !(GetWindowStyleFlag() & wxCLOSE_BOX) ) { EnableCloseButton(false); } -#endif // for standard dialogs the dialog manager generates WM_CHANGEUISTATE // itself but for custom windows we have to do it ourselves in order to @@ -666,19 +500,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, MSWUpdateUIState(UIS_INITIALIZE); } - // Note: if we include PocketPC in this test, dialogs can fail to show up, - // for example the text entry dialog in the dialogs sample. Problem with Maximise()? -#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__WINCE_STANDARDSDK__)) - if ( ( style & wxMAXIMIZE ) || IsAlwaysMaximized() ) - { - this->Maximize(); - } -#endif - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - SetRightMenu(); // to nothing for initialization -#endif - return ret; } @@ -688,12 +509,6 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW() SendDestroyEvent(); -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo; - delete info; - m_activateInfo = NULL; -#endif - // after destroying an owned window, Windows activates the next top level // window in Z order but it may be different from our owner (to reproduce // this simply Alt-TAB to another application and back before closing the @@ -723,6 +538,11 @@ void wxTopLevelWindowMSW::DoShowWindow(int nShowCmd) // makes it not iconized and only minimizing it does make it iconized. m_iconized = nShowCmd == SW_MINIMIZE; } + +#if wxUSE_TOOLTIPS + // Don't leave a tooltip hanging around if TLW is hidden now. + wxToolTip::UpdateVisibility(); +#endif // wxUSE_TOOLTIPS } void wxTopLevelWindowMSW::ShowWithoutActivating() @@ -747,11 +567,6 @@ bool wxTopLevelWindowMSW::Show(bool show) // show and maximize nShowCmd = SW_MAXIMIZE; - // This is necessary, or no window appears -#if defined( __WINCE_STANDARDSDK__) || defined(__SMARTPHONE__) - DoShowWindow(SW_SHOW); -#endif - m_maximizeOnShow = false; } else if ( m_iconized ) @@ -802,13 +617,6 @@ bool wxTopLevelWindowMSW::Show(bool show) DoShowWindow(nShowCmd); -#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) - // Addornments have to be added when the frame is the correct size - wxFrame* frame = wxDynamicCast(this, wxFrame); - if (frame && frame->GetMenuBar()) - frame->GetMenuBar()->AddAdornments(GetWindowStyleFlag()); -#endif - return true; } @@ -859,10 +667,7 @@ void wxTopLevelWindowMSW::Maximize(bool maximize) bool wxTopLevelWindowMSW::IsMaximized() const { return IsAlwaysMaximized() || -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) && !defined(__WINCE_STANDARDSDK__) - (::IsZoomed(GetHwnd()) != 0) || -#endif m_maximizeOnShow; } @@ -890,9 +695,6 @@ void wxTopLevelWindowMSW::Iconize(bool iconize) bool wxTopLevelWindowMSW::IsIconized() const { -#ifdef __WXWINCE__ - return false; -#else if ( !IsShown() ) return m_iconized; @@ -901,7 +703,6 @@ bool wxTopLevelWindowMSW::IsIconized() const // from an event handler from one of the messages we receive before it, // such as WM_MOVE return ::IsIconic(GetHwnd()) != 0; -#endif } void wxTopLevelWindowMSW::Restore() @@ -912,7 +713,7 @@ void wxTopLevelWindowMSW::Restore() void wxTopLevelWindowMSW::SetLayoutDirection(wxLayoutDirection dir) { if ( dir == wxLayout_Default ) - dir = wxTheApp->GetLayoutDirection(); + dir = wxApp::MSWGetDefaultLayout(m_parent); if ( dir != wxLayout_Default ) wxTopLevelWindowBase::SetLayoutDirection(dir); @@ -922,8 +723,6 @@ void wxTopLevelWindowMSW::SetLayoutDirection(wxLayoutDirection dir) // wxTopLevelWindowMSW geometry // ---------------------------------------------------------------------------- -#ifndef __WXWINCE__ - void wxTopLevelWindowMSW::DoGetPosition(int *x, int *y) const { if ( IsIconized() ) @@ -989,8 +788,6 @@ void wxTopLevelWindowMSW::DoGetSize(int *width, int *height) const wxTopLevelWindowBase::DoGetSize(width, height); } -#endif // __WXWINCE__ - void wxTopLevelWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, const wxSize& size, @@ -1037,18 +834,11 @@ wxTopLevelWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, // guess a reasonably good size for a new window just as well // ourselves // - // The only exception is for the Windows CE platform where the system - // does know better than we how should the windows be sized -#ifdef _WIN32_WCE - w = - h = CW_USEDEFAULT; -#else // !_WIN32_WCE wxSize sizeReal = size; sizeReal.SetDefaults(GetDefaultSize()); w = sizeReal.x; h = sizeReal.y; -#endif // _WIN32_WCE/!_WIN32_WCE } else { @@ -1091,9 +881,7 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) if (style & wxFULLSCREEN_NOBORDER) { offFlags |= WS_BORDER; -#ifndef __WXWINCE__ offFlags |= WS_THICKFRAME; -#endif } if (style & wxFULLSCREEN_NOCAPTION) offFlags |= WS_CAPTION | WS_SYSMENU; @@ -1104,8 +892,7 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) // decorations (and are definitely not children) and while not using // this style doesn't seem to make any difference for most windows, it // breaks wxGLCanvas in some cases, see #15434, so just always use it. - // XXX comex: this causes Dolphin issue 6651. - // newStyle |= WS_POPUP; + newStyle |= WS_POPUP; // change our window style to be compatible with full-screen mode ::SetWindowLong(GetHwnd(), GWL_STYLE, newStyle); @@ -1123,12 +910,6 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) { // resize to the size of the desktop wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect); -#ifdef __WXWINCE__ - // FIXME: size of the bottom menu (toolbar) - // should be taken in account - rect.height += rect.y; - rect.y = 0; -#endif } SetSize(rect); @@ -1153,10 +934,6 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) rect.x, rect.y, rect.width, rect.height, flags); -#if !defined(__HANDHELDPC__) && (defined(__WXWINCE__) && (_WIN32_WCE < 400)) - ::SHFullScreen(GetHwnd(), SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); -#endif - // finally send an event allowing the window to relayout itself &c wxSizeEvent event(rect.GetSize(), GetId()); event.SetEventObject(this); @@ -1164,9 +941,6 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) } else // stop showing full screen { -#if !defined(__HANDHELDPC__) && (defined(__WXWINCE__) && (_WIN32_WCE < 400)) - ::SHFullScreen(GetHwnd(), SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON); -#endif Maximize(m_fsIsMaximized); SetWindowLong(GetHwnd(),GWL_STYLE, m_fsOldWindowStyle); SetWindowPos(GetHwnd(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y, @@ -1224,7 +998,6 @@ void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons) bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) { -#if !defined(__WXMICROWIN__) // get system (a.k.a. window) menu HMENU hmenu = GetSystemMenu(GetHwnd(), FALSE /* get it */); if ( !hmenu ) @@ -1244,65 +1017,89 @@ bool wxTopLevelWindowMSW::EnableCloseButton(bool enable) return false; } -#ifndef __WXWINCE__ // update appearance immediately if ( !::DrawMenuBar(GetHwnd()) ) { wxLogLastError(wxT("DrawMenuBar")); } -#endif -#endif // !__WXMICROWIN__ return true; } +// Window must have wxCAPTION and either wxCLOSE_BOX or wxSYSTEM_MENU for the +// button to be visible. Also check for wxMAXIMIZE_BOX because we don't want +// to enable a button that is excluded from the current style. + +bool wxTopLevelWindowMSW::EnableMaximizeButton(bool enable) +{ + if ( ( HasFlag(wxCAPTION) && + ( HasFlag(wxCLOSE_BOX) || HasFlag(wxSYSTEM_MENU) ) ) && + HasFlag(wxMAXIMIZE_BOX) ) + { + if ( enable ) + { + SetWindowStyleFlag(GetWindowStyleFlag() | wxMAXIMIZE_BOX); + } + else + { + SetWindowStyleFlag(GetWindowStyleFlag() ^ wxMAXIMIZE_BOX); + // Restore the style to our internal store + wxWindowBase::SetWindowStyleFlag(GetWindowStyle() | wxMAXIMIZE_BOX); + } + + return true; + } + + return false; +} + +bool wxTopLevelWindowMSW::EnableMinimizeButton(bool enable) +{ + if ( ( HasFlag(wxCAPTION) && + ( HasFlag(wxCLOSE_BOX) || HasFlag(wxSYSTEM_MENU) ) ) && + HasFlag(wxMINIMIZE_BOX) ) + { + if ( enable ) + { + SetWindowStyleFlag(GetWindowStyleFlag() | wxMINIMIZE_BOX); + } + else + { + SetWindowStyleFlag(GetWindowStyleFlag() ^ wxMINIMIZE_BOX); + // Restore the style to our internal store + wxWindowBase::SetWindowStyleFlag(GetWindowStyle() | wxMINIMIZE_BOX); + } + + return true; + } + + return false; +} + void wxTopLevelWindowMSW::RequestUserAttention(int flags) { - // check if we can use FlashWindowEx(): unfortunately a simple test for - // FLASHW_STOP doesn't work because MSVC6 headers do #define it but don't - // provide FlashWindowEx() declaration, so try to detect whether we have - // real headers for WINVER 0x0500 by checking for existence of a symbol not - // declated in MSVC6 header -#if defined(FLASHW_STOP) && defined(VK_XBUTTON1) && wxUSE_DYNLIB_CLASS - // available in the headers, check if it is supported by the system - typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi); - static FlashWindowEx_t s_pfnFlashWindowEx = NULL; - if ( !s_pfnFlashWindowEx ) +#if defined(FLASHW_STOP) + WinStruct fwi; + fwi.hwnd = GetHwnd(); + fwi.dwFlags = FLASHW_ALL; + if ( flags & wxUSER_ATTENTION_INFO ) { - wxDynamicLibrary dllUser32(wxT("user32.dll")); - s_pfnFlashWindowEx = (FlashWindowEx_t) - dllUser32.GetSymbol(wxT("FlashWindowEx")); - - // we can safely unload user32.dll here, it's going to remain loaded as - // long as the program is running anyhow + // just flash a few times + fwi.uCount = 3; + } + else // wxUSER_ATTENTION_ERROR + { + // flash until the user notices it + fwi.dwFlags |= FLASHW_TIMERNOFG; } - if ( s_pfnFlashWindowEx ) - { - WinStruct fwi; - fwi.hwnd = GetHwnd(); - fwi.dwFlags = FLASHW_ALL; - if ( flags & wxUSER_ATTENTION_INFO ) - { - // just flash a few times - fwi.uCount = 3; - } - else // wxUSER_ATTENTION_ERROR - { - // flash until the user notices it - fwi.dwFlags |= FLASHW_TIMERNOFG; - } - - s_pfnFlashWindowEx(&fwi); - } - else // FlashWindowEx() not available -#endif // FlashWindowEx() defined + ::FlashWindowEx(&fwi); +#else { wxUnusedVar(flags); -#ifndef __WXWINCE__ ::FlashWindow(GetHwnd(), TRUE); -#endif // __WXWINCE__ } +#endif // defined(FLASHW_STOP) } wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const @@ -1344,28 +1141,6 @@ wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) { -#if wxUSE_DYNLIB_CLASS - typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD); - static PSETLAYEREDWINDOWATTR - pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR)-1; - - if ( pSetLayeredWindowAttributes == (PSETLAYEREDWINDOWATTR)-1 ) - { - wxDynamicLibrary dllUser32(wxT("user32.dll")); - - // use RawGetSymbol() and not GetSymbol() to avoid error messages under - // Windows 95: there is nothing the user can do about this anyhow - pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR) - dllUser32.RawGetSymbol(wxT("SetLayeredWindowAttributes")); - - // it's ok to destroy dllUser32 here, we link statically to user32.dll - // anyhow so it won't be unloaded - } - - if ( !pSetLayeredWindowAttributes ) - return false; -#endif // wxUSE_DYNLIB_CLASS - LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE); // if setting alpha to fully opaque then turn off the layered style @@ -1376,29 +1151,19 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) return true; } -#if wxUSE_DYNLIB_CLASS // Otherwise, set the layered style if needed and set the alpha value if ((exstyle & WS_EX_LAYERED) == 0 ) SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED); - if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) ) + if ( ::SetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) ) return true; -#endif // wxUSE_DYNLIB_CLASS return false; } bool wxTopLevelWindowMSW::CanSetTransparent() { - // The API is available on win2k and above - - static int os_type = -1; - static int ver_major = -1; - - if (os_type == -1) - os_type = ::wxGetOsVersion(&ver_major); - - return (os_type == wxOS_WINDOWS_NT && ver_major >= 5); + return true; } void wxTopLevelWindowMSW::DoFreeze() @@ -1424,16 +1189,9 @@ void wxTopLevelWindowMSW::DoSaveLastFocus() return; // remember the last focused child if it is our child - m_winLastFocused = FindFocus(); + wxWindow* const winFocus = FindFocus(); - if ( m_winLastFocused ) - { - // and don't remember it if it's a child from some other frame - if ( wxGetTopLevelParent(m_winLastFocused) != this ) - { - m_winLastFocused = NULL; - } - } + m_winLastFocused = IsDescendant(winFocus) ? winFocus : NULL; } void wxTopLevelWindowMSW::DoRestoreLastFocus() @@ -1461,12 +1219,15 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) return; } - // restore focus to the child which was last focused unless we already - // have it + // restore focus to the child which was last focused unless one of our + // children already has it (the frame having focus on itself does not + // count, if only because this would be always the case for an MDI + // child frame as the MDI parent sets focus to it before it's + // activated) wxLogTrace(wxT("focus"), wxT("wxTLW %p activated."), m_hWnd); - wxWindow *winFocus = FindFocus(); - if ( !winFocus || wxGetTopLevelParent(winFocus) != this ) + wxWindow* const winFocus = FindFocus(); + if ( winFocus == this || !IsDescendant(winFocus) ) DoRestoreLastFocus(); } else // deactivating @@ -1482,120 +1243,9 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) } } -#if wxUSE_MENUS - -bool -wxTopLevelWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) -{ - // Ignore the special messages generated when the menu is closed (this is - // the only case when the flags are set to -1), in particular don't clear - // the help string in the status bar when this happens as it had just been - // restored by the base class code. - if ( !hMenu && flags == 0xffff ) - return false; - - // Unfortunately we also need to ignore another message which is sent after - // closing the currently active submenu of the menu bar by pressing Escape: - // in this case we get WM_UNINITMENUPOPUP, from which we generate - // wxEVT_MENU_CLOSE, and _then_ we get WM_MENUSELECT for the top level menu - // from which we overwrite the help string just restored by OnMenuClose() - // handler in wxFrameBase. To prevent this from happening we discard these - // messages but only in the case it's really the top level menu as we still - // need to clear the help string when a submenu is selected in a menu. - if ( flags == (MF_POPUP | MF_HILITE) && !m_menuDepth ) - return false; - - // sign extend to int from unsigned short we get from Windows - int item = (signed short)nItem; - - // WM_MENUSELECT is generated for both normal items and menus, including - // the top level menus of the menu bar, which can't be represented using - // any valid identifier in wxMenuEvent so use an otherwise unused value for - // them - if ( flags & (MF_POPUP | MF_SEPARATOR) ) - item = wxID_NONE; - - wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); - event.SetEventObject(this); - - if ( HandleWindowEvent(event) ) - return true; - - // by default, i.e. if the event wasn't handled above, clear the status bar - // text when an item which can't have any associated help string in wx API - // is selected - if ( item == wxID_NONE ) - DoGiveHelp(wxEmptyString, true); - - return false; -} - -bool -wxTopLevelWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup) -{ - // Update the menu depth when dealing with the top level menus. - if ( !popup ) - { - if ( evtType == wxEVT_MENU_OPEN ) - { - m_menuDepth++; - } - else if ( evtType == wxEVT_MENU_CLOSE ) - { - wxASSERT_MSG( m_menuDepth > 0, wxS("No open menus?") ); - - m_menuDepth--; - } - else - { - wxFAIL_MSG( wxS("Unexpected menu event type") ); - } - } - - wxMenuEvent event(evtType, popup ? wxID_ANY : 0, menu); - event.SetEventObject(menu); - - return HandleWindowEvent(event); -} - -bool wxTopLevelWindowMSW::HandleExitMenuLoop(WXWORD isPopup) -{ - return DoSendMenuOpenCloseEvent(wxEVT_MENU_CLOSE, - isPopup ? wxCurrentPopupMenu : NULL, - isPopup != 0); -} - -bool wxTopLevelWindowMSW::HandleMenuPopup(wxEventType evtType, WXHMENU hMenu) -{ - bool isPopup = false; - wxMenu* menu = NULL; - if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu ) - { - menu = wxCurrentPopupMenu; - isPopup = true; - } - else - { - menu = MSWFindMenuFromHMENU(hMenu); - } - - - return DoSendMenuOpenCloseEvent(evtType, menu, isPopup); -} - -wxMenu* wxTopLevelWindowMSW::MSWFindMenuFromHMENU(WXHMENU WXUNUSED(hMenu)) -{ - // We don't have any menus at this level. - return NULL; -} - -#endif // wxUSE_MENUS - - - // the DialogProc for all wxWidgets dialogs -LONG APIENTRY _EXPORT -wxDlgProc(HWND hDlg, +LONG APIENTRY +wxDlgProc(HWND WXUNUSED(hDlg), UINT message, WPARAM WXUNUSED(wParam), LPARAM WXUNUSED(lParam)) @@ -1604,27 +1254,6 @@ wxDlgProc(HWND hDlg, { case WM_INITDIALOG: { - // under CE, add a "Ok" button in the dialog title bar and make it full - // screen - // - // TODO: find the window for this HWND, and take into account - // wxMAXIMIZE and wxCLOSE_BOX. For now, assume both are present. - // - // Standard SDK doesn't have aygshell.dll: see - // include/wx/msw/wince/libraries.h -#if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__) - SHINITDLGINFO shidi; - shidi.dwMask = SHIDIM_FLAGS; - shidi.dwFlags = SHIDIF_SIZEDLG // take account of the SIP or menubar -#ifndef __SMARTPHONE__ - | SHIDIF_DONEBUTTON -#endif - ; - shidi.hDlg = hDlg; - SHInitDialog( &shidi ); -#else // no SHInitDialog() - wxUnusedVar(hDlg); -#endif // for WM_INITDIALOG, returning TRUE tells system to set focus to // the first control in the dialog box, but as we set the focus // ourselves, we return FALSE for it as well diff --git a/Externals/wxWidgets3/src/msw/treectrl.cpp b/Externals/wxWidgets3/src/msw/treectrl.cpp index 8f664ffa2f..a2dc9138b4 100644 --- a/Externals/wxWidgets3/src/msw/treectrl.cpp +++ b/Externals/wxWidgets3/src/msw/treectrl.cpp @@ -36,7 +36,6 @@ #include "wx/settings.h" #endif -#include "wx/dynlib.h" #include "wx/msw/private.h" #include "wx/imaglist.h" @@ -341,11 +340,11 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem) // prevent the tree from unselecting the old focus which it // would do by default (TreeView_SelectItem unselects the // focused item) - TreeView_SelectItem(hwndTV, 0); + (void)TreeView_SelectItem(hwndTV, 0); SelectItem(hwndTV, htFocus); } - TreeView_SelectItem(hwndTV, htItem); + (void)TreeView_SelectItem(hwndTV, htItem); if ( !wasSelected ) { @@ -360,7 +359,7 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem) bool wasFocusSelected = IsItemSelected(hwndTV, htFocus); // just clear the focus - TreeView_SelectItem(hwndTV, 0); + (void)TreeView_SelectItem(hwndTV, 0); if ( wasFocusSelected ) { @@ -764,11 +763,10 @@ bool wxTreeCtrl::Create(wxWindow *parent, if ( m_windowStyle & wxTR_FULL_ROW_HIGHLIGHT ) { - if ( wxApp::GetComCtl32Version() >= 471 ) - wstyle |= TVS_FULLROWSELECT; + wstyle |= TVS_FULLROWSELECT; } -#if !defined(__WXWINCE__) && defined(TVS_INFOTIP) +#if defined(TVS_INFOTIP) // Need so that TVN_GETINFOTIP messages will be sent wstyle |= TVS_INFOTIP; #endif @@ -784,16 +782,9 @@ bool wxTreeCtrl::Create(wxWindow *parent, if ( m_windowStyle & wxTR_TWIST_BUTTONS ) { - // Under Vista and later Explorer uses rotating ("twist") buttons - // instead of the default "+/-" ones so apply its theme to the tree - // control to implement this style. - if ( wxGetWinVersion() >= wxWinVersion_Vista ) - { - if ( wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive() ) - { - theme->SetWindowTheme(GetHwnd(), L"EXPLORER", NULL); - } - } + // The Vista+ system theme uses rotating ("twist") buttons, so we map + // this style to it. + EnableSystemTheme(); } return true; @@ -874,7 +865,7 @@ unsigned int wxTreeCtrl::GetIndent() const void wxTreeCtrl::SetIndent(unsigned int indent) { - TreeView_SetIndent(GetHwnd(), indent); + (void)TreeView_SetIndent(GetHwnd(), indent); } void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which) @@ -1526,10 +1517,10 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, // need this to make the "[+]" appear if ( firstChild ) { - TVGetItemRectParam param; + TVGetItemRectParam param2; - wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param, FALSE); - ::InvalidateRect(GetHwnd(), ¶m.rect, FALSE); + wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param2, FALSE); + ::InvalidateRect(GetHwnd(), ¶m2.rect, FALSE); } // associate the application tree item with Win32 tree item handle @@ -1970,7 +1961,7 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) wxCHECK_RET( !IsHiddenRoot(item), wxT("can't show hidden root item") ); // no error return - TreeView_EnsureVisible(GetHwnd(), HITEM(item)); + (void)TreeView_EnsureVisible(GetHwnd(), HITEM(item)); } void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) @@ -2032,7 +2023,8 @@ wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item, // End label editing, optionally cancelling the edit void wxTreeCtrl::DoEndEditLabel(bool discardChanges) { - TreeView_EndEditLabelNow(GetHwnd(), discardChanges); + if ( !TreeView_EndEditLabelNow(GetHwnd(), discardChanges) ) + wxLogLastError(wxS("TreeView_EndEditLabelNow()")); DeleteTextCtrl(); } @@ -2165,13 +2157,14 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item) // rely on the fact that TreeView_SortChildren does the same thing as our // default behaviour, i.e. sorts items alphabetically and so call it // directly if we're not in derived class (much more efficient!) - // RN: Note that if you find you're code doesn't sort as expected this - // may be why as if you don't use the DECLARE_CLASS/IMPLEMENT_CLASS - // combo for your derived wxTreeCtrl if will sort without + // RN: Note that if you find your code doesn't sort as expected this + // may be why as if you don't use the wxDECLARE_CLASS/wxIMPLEMENT_CLASS + // combo for your derived wxTreeCtrl it will sort without // OnCompareItems if ( GetClassInfo() == wxCLASSINFO(wxTreeCtrl) ) { - TreeView_SortChildren(GetHwnd(), HITEM(item), 0); + if ( !TreeView_SortChildren(GetHwnd(), HITEM(item), 0) ) + wxLogLastError(wxS("TreeView_SortChildren()")); } else { @@ -2179,7 +2172,8 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item) tvSort.hParent = HITEM(item); tvSort.lpfnCompare = wxTreeSortHelper::Compare; tvSort.lParam = (LPARAM)this; - TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */); + if ( !TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */) ) + wxLogLastError(wxS("TreeView_SortChildrenCB()")); } } @@ -2972,7 +2966,6 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) break; case WM_MOUSEMOVE: -#ifndef __WXWINCE__ if ( m_htClickedItem ) { int cx = abs(m_ptClick.x - x); @@ -2997,28 +2990,28 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) tviAux.hItem = HITEM(m_htClickedItem); tviAux.mask = TVIF_STATE | TVIF_PARAM; tviAux.stateMask = 0xffffffff; - TreeView_GetItem(GetHwnd(), &tviAux); + if ( TreeView_GetItem(GetHwnd(), &tviAux) ) + { + tv.itemNew.state = tviAux.state; + tv.itemNew.lParam = tviAux.lParam; - tv.itemNew.state = tviAux.state; - tv.itemNew.lParam = tviAux.lParam; + tv.ptDrag.x = x; + tv.ptDrag.y = y; - tv.ptDrag.x = x; - tv.ptDrag.y = y; + // do it before SendMessage() call below to avoid + // reentrancies here if there is another WM_MOUSEMOVE + // in the queue already + m_htClickedItem.Unset(); - // do it before SendMessage() call below to avoid - // reentrancies here if there is another WM_MOUSEMOVE - // in the queue already - m_htClickedItem.Unset(); + ::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY, + tv.hdr.idFrom, (LPARAM)&tv ); - ::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY, - tv.hdr.idFrom, (LPARAM)&tv ); - - // don't pass it to the default window proc, it would - // start dragging again - processed = true; + // don't pass it to the default window proc, it would + // start dragging again + processed = true; + } } } -#endif // __WXWINCE__ #if wxUSE_DRAGIMAGE if ( m_dragImage ) @@ -3029,7 +3022,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // highlight the item as target (hiding drag image is // necessary - otherwise the display will be corrupted) m_dragImage->Hide(); - TreeView_SelectDropTarget(GetHwnd(), htItem); + if ( !TreeView_SelectDropTarget(GetHwnd(), htItem) ) + wxLogLastError(wxS("TreeView_SelectDropTarget()")); m_dragImage->Show(); } } @@ -3102,7 +3096,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // if we don't do it, the tree seems to think that 2 items // are selected simultaneously which is quite weird - TreeView_SelectDropTarget(GetHwnd(), 0); + if ( !TreeView_SelectDropTarget(GetHwnd(), 0) ) + wxLogLastError(wxS("TreeView_SelectDropTarget(0)")); } #endif // wxUSE_DRAGIMAGE @@ -3236,7 +3231,8 @@ wxTreeCtrl::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // if we don't do it, the tree seems to think that 2 items // are selected simultaneously which is quite weird - TreeView_SelectDropTarget(GetHwnd(), 0); + if ( !TreeView_SelectDropTarget(GetHwnd(), 0) ) + wxLogLastError(wxS("TreeView_SelectDropTarget(0)")); } } } @@ -3279,7 +3275,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case TVN_BEGINLABELEDIT: { eventType = wxEVT_TREE_BEGIN_LABEL_EDIT; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; + NMTVDISPINFO *info = (NMTVDISPINFO *)lParam; // although the user event handler may still veto it, it is // important to set it now so that calls to SetItemText() from @@ -3313,7 +3309,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case TVN_ENDLABELEDIT: { eventType = wxEVT_TREE_END_LABEL_EDIT; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; + NMTVDISPINFO *info = (NMTVDISPINFO *)lParam; event.m_item = info->item.hItem; event.m_label = info->item.pszText; @@ -3321,7 +3317,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; } -#ifndef __WXWINCE__ // These *must* not be removed or TVN_GETINFOTIP will // not be processed each time the mouse is moved // and the tooltip will only ever update once. @@ -3345,7 +3340,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; } #endif // TVN_GETINFOTIP -#endif // !__WXWINCE__ case TVN_GETDISPINFO: eventType = wxEVT_TREE_GET_INFO; @@ -3357,7 +3351,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) eventType = wxEVT_TREE_SET_INFO; //else: get, already set above - TV_DISPINFO *info = (TV_DISPINFO *)lParam; + NMTVDISPINFO *info = (NMTVDISPINFO *)lParam; event.m_item = info->item.hItem; break; @@ -3435,9 +3429,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } return false; - // NB: MSLU is broken and sends TVN_SELCHANGEDA instead of - // TVN_SELCHANGEDW in Unicode mode under Win98. Therefore - // we have to handle both messages: case TVN_SELCHANGEDA: case TVN_SELCHANGEDW: if ( !m_changingSelection ) @@ -3481,7 +3472,14 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // to avoid such surprises, we force the generation of focus events // now, before we generate the selection change ones if ( !m_changingSelection && !m_isBeingDeleted ) + { + // Setting focus can generate selection events too however, + // suppress them as they're completely artificial and we'll + // generate the real ones soon. + TempSetter set(m_changingSelection); + SetFocus(); + } break; // instead of explicitly checking for _WIN32_IE, check if the @@ -3506,31 +3504,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // delete it (in POSTPAINT notify) if (m_imageListState && m_imageListState->GetImageCount() > 0) { - typedef BOOL (wxSTDCALL *ImageList_Copy_t) - (HIMAGELIST, int, HIMAGELIST, int, UINT); - static ImageList_Copy_t s_pfnImageList_Copy = NULL; - static bool loaded = false; - - if ( !loaded ) - { - wxLoadedDLL dllComCtl32(wxT("comctl32.dll")); - if ( dllComCtl32.IsLoaded() ) - { - wxDL_INIT_FUNC(s_pfn, ImageList_Copy, dllComCtl32); - loaded = true; - } - } - - if ( !s_pfnImageList_Copy ) - { - // this code is broken with ImageList_Copy() - // but I don't care enough about Win95 support - // to write it now -- if anybody does, please - // do it - wxFAIL_MSG("TODO: implement this for Win95"); - break; - } - const HIMAGELIST hImageList = GetHimagelistOf(m_imageListState); @@ -3547,9 +3520,9 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // move images to right for ( int i = index; i > 0; i-- ) { - (*s_pfnImageList_Copy)(hImageList, i, - hImageList, i-1, - ILCF_MOVE); + ImageList_Copy(hImageList, i, + hImageList, i-1, + ILCF_MOVE); } // we must remove the image in POSTPAINT notify @@ -3641,8 +3614,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { DWORD pos = GetMessagePos(); POINT point; - point.x = LOWORD(pos); - point.y = HIWORD(pos); + point.x = GET_X_LPARAM(pos); + point.y = GET_Y_LPARAM(pos); ::MapWindowPoints(HWND_DESKTOP, GetHwnd(), &point, 1); int htFlags = 0; wxTreeItemId item = HitTest(wxPoint(point.x, point.y), htFlags); @@ -3667,7 +3640,10 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( MSWIsOnItem(tvhti.flags) ) { event.m_item = tvhti.hItem; - eventType = (int)hdr->code == NM_DBLCLK + // Cast is needed for the very old (gcc 3.4.5) MinGW + // headers which didn't define NM_DBLCLK as unsigned, + // resulting in signed/unsigned comparison warning. + eventType = hdr->code == (UINT)NM_DBLCLK ? wxEVT_TREE_ITEM_ACTIVATED : wxEVT_TREE_ITEM_RIGHT_CLICK; @@ -3794,7 +3770,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) DeleteTextCtrl(); break; -#ifndef __WXWINCE__ #ifdef TVN_GETINFOTIP case TVN_GETINFOTIP: { @@ -3805,7 +3780,6 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } } break; -#endif #endif case TVN_SELCHANGING: @@ -3859,7 +3833,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) //if ( /* !processed && */ ) { wxTreeItemId item = event.m_item; - TV_DISPINFO *info = (TV_DISPINFO *)lParam; + NMTVDISPINFO *info = (NMTVDISPINFO *)lParam; const wxTreeItemParam * const param = GetItemParam(item); if ( !param ) diff --git a/Externals/wxWidgets3/src/msw/urlmsw.cpp b/Externals/wxWidgets3/src/msw/urlmsw.cpp index 75febe2704..ad933ffcfb 100644 --- a/Externals/wxWidgets3/src/msw/urlmsw.cpp +++ b/Externals/wxWidgets3/src/msw/urlmsw.cpp @@ -48,13 +48,13 @@ public: protected: wxProtocolError m_error; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxHTTPDummyProto) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxHTTPDummyProto); DECLARE_PROTOCOL(wxHTTPDummyProto) }; // the only "reason for being" for this class is to tell // wxURL that there is someone dealing with the http protocol -IMPLEMENT_DYNAMIC_CLASS(wxHTTPDummyProto, wxProtocol) +wxIMPLEMENT_DYNAMIC_CLASS(wxHTTPDummyProto, wxProtocol); IMPLEMENT_PROTOCOL(wxHTTPDummyProto, wxT("http"), NULL, false) USE_PROTOCOL(wxHTTPDummyProto) diff --git a/Externals/wxWidgets3/src/msw/utils.cpp b/Externals/wxWidgets3/src/msw/utils.cpp index 59adbbe3cc..172de6b5dd 100644 --- a/Externals/wxWidgets3/src/msw/utils.cpp +++ b/Externals/wxWidgets3/src/msw/utils.cpp @@ -50,13 +50,13 @@ #endif // Doesn't work with Cygwin at present -#if wxUSE_SOCKETS && (defined(__GNUWIN32_OLD__) || defined(__WXWINCE__) || defined(__CYGWIN32__)) +#if wxUSE_SOCKETS && (defined(__CYGWIN32__)) // apparently we need to include winsock.h to get WSADATA and other stuff // used in wxGetFullHostName() with the old mingw32 versions #include #endif -#if !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if !defined(__GNUWIN32__) #include #include @@ -86,22 +86,16 @@ #include #endif // USE_NET_API -#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - #ifndef __UNIX__ - #include - #endif - - #ifndef __GNUWIN32__ - #include - #endif +#ifndef __UNIX__ + #include #endif -#ifndef __WATCOMC__ - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif +#ifndef __GNUWIN32__ + #include #endif +#include + // For wxKillAllChildren #include @@ -110,11 +104,11 @@ // ---------------------------------------------------------------------------- // In the WIN.INI file -#if (!defined(USE_NET_API) && !defined(__WXWINCE__)) || defined(__WXMICROWIN__) +#if !defined(USE_NET_API) static const wxChar WX_SECTION[] = wxT("wxWindows"); #endif -#if (!defined(USE_NET_API) && !defined(__WXWINCE__)) +#if !defined(USE_NET_API) static const wxChar eUSERNAME[] = wxT("UserName"); #endif @@ -131,17 +125,6 @@ WXDLLIMPEXP_DATA_BASE(const wxChar *) wxUserResourceStr = wxT("TEXT"); // Get hostname only (without domain name) bool wxGetHostName(wxChar *buf, int maxSize) { -#if defined(__WXWINCE__) - // GetComputerName() is not supported but the name seems to be stored in - // this location in the registry, at least for PPC2003 and WM5 - wxString hostName; - wxRegKey regKey(wxRegKey::HKLM, wxT("Ident")); - if ( !regKey.HasValue(wxT("Name")) || - !regKey.QueryValue(wxT("Name"), hostName) ) - return false; - - wxStrlcpy(buf, hostName.t_str(), maxSize); -#else // !__WXWINCE__ DWORD nSize = maxSize; if ( !::GetComputerName(buf, &nSize) ) { @@ -149,7 +132,6 @@ bool wxGetHostName(wxChar *buf, int maxSize) return false; } -#endif // __WXWINCE__/!__WXWINCE__ return true; } @@ -157,7 +139,7 @@ bool wxGetHostName(wxChar *buf, int maxSize) // get full hostname (with domain name if possible) bool wxGetFullHostName(wxChar *buf, int maxSize) { -#if !defined( __WXMICROWIN__) && wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS +#if wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS // TODO should use GetComputerNameEx() when available // we don't want to always link with Winsock DLL as we might not use it at @@ -214,7 +196,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) if ( pHostEnt ) { - host = wxString::FromAscii(pHostEnt->h_name); + host = pHostEnt->h_name; } } } @@ -233,19 +215,15 @@ bool wxGetFullHostName(wxChar *buf, int maxSize) } } } -#endif // !__WXMICROWIN__ +#endif // wxUSE_DYNLIB_CLASS && wxUSE_SOCKETS return wxGetHostName(buf, maxSize); } // Get user ID e.g. jacs -bool wxGetUserId(wxChar *WXUNUSED_IN_WINCE(buf), - int WXUNUSED_IN_WINCE(maxSize)) +bool wxGetUserId(wxChar *buf, + int maxSize) { -#if defined(__WXWINCE__) - // TODO-CE - return false; -#else DWORD nSize = maxSize; if ( ::GetUserName(buf, &nSize) == 0 ) { @@ -259,7 +237,6 @@ bool wxGetUserId(wxChar *WXUNUSED_IN_WINCE(buf), } return true; -#endif } // Get user name e.g. Julian Smart @@ -267,17 +244,7 @@ bool wxGetUserName(wxChar *buf, int maxSize) { wxCHECK_MSG( buf && ( maxSize > 0 ), false, wxT("empty buffer in wxGetUserName") ); -#if defined(__WXWINCE__) && wxUSE_REGKEY - wxLogNull noLog; - wxRegKey key(wxRegKey::HKCU, wxT("ControlPanel\\Owner")); - if(!key.Open(wxRegKey::Read)) - return false; - wxString name; - if(!key.QueryValue(wxT("Owner"),name)) - return false; - wxStrlcpy(buf, name.c_str(), maxSize); - return true; -#elif defined(USE_NET_API) +#if defined(USE_NET_API) CHAR szUserName[256]; if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) ) return false; @@ -384,14 +351,12 @@ const wxChar* wxGetHomeDir(wxString *pstr) // Cygwin returns unix type path but that does not work well static wxChar windowsPath[MAX_PATH]; #if CYGWIN_VERSION_DLL_MAJOR >= 1007 - cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir, windowsPath, MAX_PATH); + cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir.c_str(), windowsPath, MAX_PATH); #else - cygwin_conv_to_full_win32_path(strDir, windowsPath); + cygwin_conv_to_full_win32_path(strDir.c_str(), windowsPath); #endif strDir = windowsPath; #endif -#elif defined(__WXWINCE__) - strDir = wxT("\\"); #else strDir.clear(); @@ -461,136 +426,62 @@ wxString wxGetUserHome(const wxString& user) return home; } -bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path), - wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pTotal), - wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pFree)) +bool wxGetDiskSpace(const wxString& path, + wxDiskspaceSize_t *pTotal, + wxDiskspaceSize_t *pFree) { -#ifdef __WXWINCE__ - // TODO-CE - return false; -#else if ( path.empty() ) return false; -// old w32api don't have ULARGE_INTEGER -#if defined(__WIN32__) && \ - (!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION( 0, 3 )) - // GetDiskFreeSpaceEx() is not available under original Win95, check for - // it - typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR, - PULARGE_INTEGER, - PULARGE_INTEGER, - PULARGE_INTEGER); + ULARGE_INTEGER bytesFree, bytesTotal; - GetDiskFreeSpaceEx_t - pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress - ( - ::GetModuleHandle(wxT("kernel32.dll")), -#if wxUSE_UNICODE - "GetDiskFreeSpaceExW" -#else - "GetDiskFreeSpaceExA" -#endif - ); - - if ( pGetDiskFreeSpaceEx ) + // may pass the path as is, GetDiskFreeSpaceEx() is smart enough + if ( !::GetDiskFreeSpaceEx(path.t_str(), + &bytesFree, + &bytesTotal, + NULL) ) { - ULARGE_INTEGER bytesFree, bytesTotal; + wxLogLastError(wxT("GetDiskFreeSpaceEx")); - // may pass the path as is, GetDiskFreeSpaceEx() is smart enough - if ( !pGetDiskFreeSpaceEx(path.t_str(), - &bytesFree, - &bytesTotal, - NULL) ) - { - wxLogLastError(wxT("GetDiskFreeSpaceEx")); - - return false; - } - - // ULARGE_INTEGER is a union of a 64 bit value and a struct containing - // two 32 bit fields which may be or may be not named - try to make it - // compile in all cases -#if defined(__BORLANDC__) && !defined(_ANONYMOUS_STRUCT) - #define UL(ul) ul.u -#else // anon union - #define UL(ul) ul -#endif - if ( pTotal ) - { -#if wxUSE_LONGLONG - *pTotal = wxDiskspaceSize_t(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart); -#else - *pTotal = wxDiskspaceSize_t(UL(bytesTotal).LowPart); -#endif - } - - if ( pFree ) - { -#if wxUSE_LONGLONG - *pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart); -#else - *pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart); -#endif - } + return false; } - else -#endif // Win32 + + // ULARGE_INTEGER is a union of a 64 bit value and a struct containing + // two 32 bit fields which may be or may be not named - try to make it + // compile in all cases +#if defined(__BORLANDC__) && !defined(_ANONYMOUS_STRUCT) + #define UL(ul) ul.u +#else // anon union + #define UL(ul) ul +#endif + if ( pTotal ) { - // there's a problem with drives larger than 2GB, GetDiskFreeSpaceEx() - // should be used instead - but if it's not available, fall back on - // GetDiskFreeSpace() nevertheless... +#if wxUSE_LONGLONG + *pTotal = wxDiskspaceSize_t(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart); +#else + *pTotal = wxDiskspaceSize_t(UL(bytesTotal).LowPart); +#endif + } - DWORD lSectorsPerCluster, - lBytesPerSector, - lNumberOfFreeClusters, - lTotalNumberOfClusters; - - // FIXME: this is wrong, we should extract the root drive from path - // instead, but this is the job for wxFileName... - if ( !::GetDiskFreeSpace(path.t_str(), - &lSectorsPerCluster, - &lBytesPerSector, - &lNumberOfFreeClusters, - &lTotalNumberOfClusters) ) - { - wxLogLastError(wxT("GetDiskFreeSpace")); - - return false; - } - - wxDiskspaceSize_t lBytesPerCluster = (wxDiskspaceSize_t) lSectorsPerCluster; - lBytesPerCluster *= lBytesPerSector; - - if ( pTotal ) - { - *pTotal = lBytesPerCluster; - *pTotal *= lTotalNumberOfClusters; - } - - if ( pFree ) - { - *pFree = lBytesPerCluster; - *pFree *= lNumberOfFreeClusters; - } + if ( pFree ) + { +#if wxUSE_LONGLONG + *pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart); +#else + *pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart); +#endif } return true; -#endif - // __WXWINCE__ } // ---------------------------------------------------------------------------- // env vars // ---------------------------------------------------------------------------- -bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var), - wxString *WXUNUSED_IN_WINCE(value)) +bool wxGetEnv(const wxString& var, + wxString *value) { -#ifdef __WXWINCE__ - // no environment variables under CE - return false; -#else // Win32 // first get the size of the buffer DWORD dwRet = ::GetEnvironmentVariable(var.t_str(), NULL, 0); if ( !dwRet ) @@ -607,17 +498,10 @@ bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var), } return true; -#endif // WinCE/32 } bool wxDoSetEnv(const wxString& var, const wxChar *value) { -#ifdef __WXWINCE__ - // no environment variables under CE - wxUnusedVar(var); - wxUnusedVar(value); - return false; -#else // !__WXWINCE__ // update the CRT environment if possible as people expect getenv() to also // work and it is not affected by Win32 SetEnvironmentVariable() call (OTOH // the CRT does use Win32 call to update the process environment block so @@ -647,7 +531,6 @@ bool wxDoSetEnv(const wxString& var, const wxChar *value) #endif // compiler return true; -#endif // __WXWINCE__/!__WXWINCE__ } bool wxSetEnv(const wxString& variable, const wxString& value) @@ -861,61 +744,36 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags) return 0; } -typedef HANDLE (WINAPI *CreateToolhelp32Snapshot_t)(DWORD,DWORD); -typedef BOOL (WINAPI *Process32_t)(HANDLE,LPPROCESSENTRY32); - -CreateToolhelp32Snapshot_t lpfCreateToolhelp32Snapshot; -Process32_t lpfProcess32First, lpfProcess32Next; - -static void InitToolHelp32() +// This is used by wxProcess::Activate(). +extern +bool wxMSWActivatePID(long pid) { - static bool s_initToolHelpDone = false; + wxFindByPidParams params; + params.pid = (DWORD)pid; - if (s_initToolHelpDone) - return; + if ( ::EnumWindows(wxEnumFindByPidProc, (LPARAM)¶ms) != 0 ) + { + // No windows corresponding to this PID were found. + return false; + } - s_initToolHelpDone = true; + if ( !::BringWindowToTop(params.hwnd) ) + { + wxLogLastError(wxS("BringWindowToTop")); + return false; + } - lpfCreateToolhelp32Snapshot = NULL; - lpfProcess32First = NULL; - lpfProcess32Next = NULL; - -#if wxUSE_DYNLIB_CLASS - - wxDynamicLibrary dllKernel(wxT("kernel32.dll"), wxDL_VERBATIM); - - // Get procedure addresses. - // We are linking to these functions of Kernel32 - // explicitly, because otherwise a module using - // this code would fail to load under Windows NT, - // which does not have the Toolhelp32 - // functions in the Kernel 32. - lpfCreateToolhelp32Snapshot = - (CreateToolhelp32Snapshot_t)dllKernel.RawGetSymbol(wxT("CreateToolhelp32Snapshot")); - - lpfProcess32First = - (Process32_t)dllKernel.RawGetSymbol(wxT("Process32First")); - - lpfProcess32Next = - (Process32_t)dllKernel.RawGetSymbol(wxT("Process32Next")); - -#endif // wxUSE_DYNLIB_CLASS + return true; } // By John Skiff int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc) { - InitToolHelp32(); - if (krc) *krc = wxKILL_OK; - // If not implemented for this platform (e.g. NT 4.0), silently ignore - if (!lpfCreateToolhelp32Snapshot || !lpfProcess32First || !lpfProcess32Next) - return 0; - // Take a snapshot of all processes in the system. - HANDLE hProcessSnap = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) { if (krc) *krc = wxKILL_ERROR; @@ -929,7 +787,7 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc) // Walk the snapshot of the processes, and for each process, // kill it if its parent is pid. - if (!lpfProcess32First(hProcessSnap, &pe)) { + if (!::Process32First(hProcessSnap, &pe)) { // Can't get first process. if (krc) *krc = wxKILL_ERROR; @@ -942,7 +800,7 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc) if (wxKill(pe.th32ProcessID, sig, krc)) return -1; } - } while (lpfProcess32Next (hProcessSnap, &pe)); + } while (::Process32Next (hProcessSnap, &pe)); return 0; @@ -953,9 +811,6 @@ bool wxShell(const wxString& command) { wxString cmd; -#ifdef __WXWINCE__ - cmd = command; -#else wxChar *shell = wxGetenv(wxT("COMSPEC")); if ( !shell ) shell = (wxChar*) wxT("\\COMMAND.COM"); @@ -970,50 +825,42 @@ bool wxShell(const wxString& command) // pass the command to execute to the command processor cmd.Printf(wxT("%s /c %s"), shell, command.c_str()); } -#endif return wxExecute(cmd, wxEXEC_SYNC) == 0; } // Shutdown or reboot the PC -bool wxShutdown(int WXUNUSED_IN_WINCE(flags)) +bool wxShutdown(int flags) { -#ifdef __WXWINCE__ - // TODO-CE - return false; -#elif defined(__WIN32__) bool bOK = true; - if ( wxGetOsVersion(NULL, NULL) == wxOS_WINDOWS_NT ) // if is NT or 2K + // Get a token for this process. + HANDLE hToken; + bOK = ::OpenProcessToken(GetCurrentProcess(), + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + &hToken) != 0; + if ( bOK ) { - // Get a token for this process. - HANDLE hToken; - bOK = ::OpenProcessToken(GetCurrentProcess(), - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - &hToken) != 0; + TOKEN_PRIVILEGES tkp; + + // Get the LUID for the shutdown privilege. + bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, + &tkp.Privileges[0].Luid) != 0; + if ( bOK ) { - TOKEN_PRIVILEGES tkp; + tkp.PrivilegeCount = 1; // one privilege to set + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - // Get the LUID for the shutdown privilege. - bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, - &tkp.Privileges[0].Luid) != 0; + // Get the shutdown privilege for this process. + ::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, + (PTOKEN_PRIVILEGES)NULL, 0); - if ( bOK ) - { - tkp.PrivilegeCount = 1; // one privilege to set - tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - - // Get the shutdown privilege for this process. - ::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, - (PTOKEN_PRIVILEGES)NULL, 0); - - // Cannot test the return value of AdjustTokenPrivileges. - bOK = ::GetLastError() == ERROR_SUCCESS; - } - - ::CloseHandle(hToken); + // Cannot test the return value of AdjustTokenPrivileges. + bOK = ::GetLastError() == ERROR_SUCCESS; } + + ::CloseHandle(hToken); } if ( bOK ) @@ -1048,7 +895,6 @@ bool wxShutdown(int WXUNUSED_IN_WINCE(flags)) } return bOK; -#endif // WinCE/!WinCE } // ---------------------------------------------------------------------------- @@ -1078,21 +924,7 @@ unsigned long wxGetProcessId() bool wxIsDebuggerRunning() { -#if wxUSE_DYNLIB_CLASS - // IsDebuggerPresent() is not available under Win95, so load it dynamically - wxDynamicLibrary dll(wxT("kernel32.dll"), wxDL_VERBATIM); - - typedef BOOL (WINAPI *IsDebuggerPresent_t)(); - if ( !dll.HasSymbol(wxT("IsDebuggerPresent")) ) - { - // no way to know, assume no - return false; - } - - return (*(IsDebuggerPresent_t)dll.GetSymbol(wxT("IsDebuggerPresent")))() != 0; -#else - return false; -#endif + return ::IsDebuggerPresent() != 0; } // ---------------------------------------------------------------------------- @@ -1162,33 +994,70 @@ wxLoadUserResource(const wxString& resourceName, // OS version // ---------------------------------------------------------------------------- +namespace +{ + +// Helper trying to get the real Windows version which is needed because +// GetVersionEx() doesn't return it any more since Windows 8. +OSVERSIONINFOEXW wxGetWindowsVersionInfo() +{ + OSVERSIONINFOEXW info; + wxZeroMemory(info); + info.dwOSVersionInfoSize = sizeof(info); + + // The simplest way to get the version is to call the kernel + // RtlGetVersion() directly, if it is available. +#if wxUSE_DYNLIB_CLASS + wxDynamicLibrary dllNtDll; + if ( dllNtDll.Load(wxS("ntdll.dll"), wxDL_VERBATIM | wxDL_QUIET) ) + { + typedef LONG /* NTSTATUS */ (WINAPI *RtlGetVersion_t)(OSVERSIONINFOEXW*); + + RtlGetVersion_t wxDL_INIT_FUNC(pfn, RtlGetVersion, dllNtDll); + if ( pfnRtlGetVersion && + (pfnRtlGetVersion(&info) == 0 /* STATUS_SUCCESS */) ) + { + return info; + } + } +#endif // wxUSE_DYNLIB_CLASS + +#ifdef __VISUALC__ + #pragma warning(push) + #pragma warning(disable:4996) // 'xxx': was declared deprecated +#endif + + if ( !::GetVersionExW(reinterpret_cast(&info)) ) + { + // This really shouldn't ever happen. + wxFAIL_MSG( "GetVersionEx() unexpectedly failed" ); + } + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + + return info; +} + // check if we're running under a server or workstation Windows system: it // returns true or false with obvious meaning as well as -1 if the system type // couldn't be determined // // this function is currently private but we may want to expose it later if // it's really useful -namespace -{ int wxIsWindowsServer() { #ifdef VER_NT_WORKSTATION - OSVERSIONINFOEX info; - wxZeroMemory(info); - - info.dwOSVersionInfoSize = sizeof(info); - if ( ::GetVersionEx(reinterpret_cast(&info)) ) + switch ( wxGetWindowsVersionInfo().wProductType ) { - switch ( info.wProductType ) - { - case VER_NT_WORKSTATION: - return false; + case VER_NT_WORKSTATION: + return false; - case VER_NT_SERVER: - case VER_NT_DOMAIN_CONTROLLER: - return true; - } + case VER_NT_SERVER: + case VER_NT_DOMAIN_CONTROLLER: + return true; } #endif // VER_NT_WORKSTATION @@ -1201,145 +1070,141 @@ wxString wxGetOsDescription() { wxString str; - OSVERSIONINFO info; - wxZeroMemory(info); - - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - if ( ::GetVersionEx(&info) ) + const OSVERSIONINFOEXW info = wxGetWindowsVersionInfo(); + switch ( info.dwPlatformId ) { - switch ( info.dwPlatformId ) - { #ifdef VER_PLATFORM_WIN32_CE - case VER_PLATFORM_WIN32_CE: - str.Printf(_("Windows CE (%d.%d)"), - info.dwMajorVersion, - info.dwMinorVersion); - break; + case VER_PLATFORM_WIN32_CE: + str.Printf(_("Windows CE (%d.%d)"), + info.dwMajorVersion, + info.dwMinorVersion); + break; #endif - case VER_PLATFORM_WIN32s: - str = _("Win32s on Windows 3.1"); - break; + case VER_PLATFORM_WIN32s: + str = _("Win32s on Windows 3.1"); + break; - case VER_PLATFORM_WIN32_WINDOWS: - switch (info.dwMinorVersion) - { - case 0: - if ( info.szCSDVersion[1] == 'B' || - info.szCSDVersion[1] == 'C' ) - { - str = _("Windows 95 OSR2"); - } - else - { - str = _("Windows 95"); - } - break; - case 10: - if ( info.szCSDVersion[1] == 'B' || - info.szCSDVersion[1] == 'C' ) - { - str = _("Windows 98 SE"); - } - else - { - str = _("Windows 98"); - } - break; - case 90: - str = _("Windows ME"); - break; - default: - str.Printf(_("Windows 9x (%d.%d)"), - info.dwMajorVersion, - info.dwMinorVersion); - break; - } - if ( !wxIsEmpty(info.szCSDVersion) ) - { - str << wxT(" (") << info.szCSDVersion << wxT(')'); - } - break; - - case VER_PLATFORM_WIN32_NT: - switch ( info.dwMajorVersion ) - { - case 5: - switch ( info.dwMinorVersion ) - { - case 0: - str = _("Windows 2000"); - break; - - case 2: - // we can't distinguish between XP 64 and 2003 - // as they both are 5.2, so examine the product - // type to resolve this ambiguity - if ( wxIsWindowsServer() == 1 ) - { - str = _("Windows Server 2003"); - break; - } - //else: must be XP, fall through - - case 1: - str = _("Windows XP"); - break; - } - break; - - case 6: - switch ( info.dwMinorVersion ) - { - case 0: - str = wxIsWindowsServer() == 1 - ? _("Windows Server 2008") - : _("Windows Vista"); - break; - - case 1: - str = wxIsWindowsServer() == 1 - ? _("Windows Server 2008 R2") - : _("Windows 7"); - break; - - case 2: - str = wxIsWindowsServer() == 1 - ? _("Windows Server 2012") - : _("Windows 8"); - break; - - case 3: - str = wxIsWindowsServer() == 1 - ? _("Windows Server 2012 R2") - : _("Windows 8.1"); - break; - } - break; - } - - if ( str.empty() ) - { - str.Printf(_("Windows NT %lu.%lu"), + case VER_PLATFORM_WIN32_WINDOWS: + switch (info.dwMinorVersion) + { + case 0: + if ( info.szCSDVersion[1] == 'B' || + info.szCSDVersion[1] == 'C' ) + { + str = _("Windows 95 OSR2"); + } + else + { + str = _("Windows 95"); + } + break; + case 10: + if ( info.szCSDVersion[1] == 'B' || + info.szCSDVersion[1] == 'C' ) + { + str = _("Windows 98 SE"); + } + else + { + str = _("Windows 98"); + } + break; + case 90: + str = _("Windows ME"); + break; + default: + str.Printf(_("Windows 9x (%d.%d)"), info.dwMajorVersion, info.dwMinorVersion); - } + break; + } + if ( !wxIsEmpty(info.szCSDVersion) ) + { + str << wxT(" (") << info.szCSDVersion << wxT(')'); + } + break; - str << wxT(" (") - << wxString::Format(_("build %lu"), info.dwBuildNumber); - if ( !wxIsEmpty(info.szCSDVersion) ) - { - str << wxT(", ") << info.szCSDVersion; - } - str << wxT(')'); + case VER_PLATFORM_WIN32_NT: + switch ( info.dwMajorVersion ) + { + case 5: + switch ( info.dwMinorVersion ) + { + case 0: + str = _("Windows 2000"); + break; - if ( wxIsPlatform64Bit() ) - str << _(", 64-bit edition"); - break; - } - } - else - { - wxFAIL_MSG( wxT("GetVersionEx() failed") ); // should never happen + case 2: + // we can't distinguish between XP 64 and 2003 + // as they both are 5.2, so examine the product + // type to resolve this ambiguity + if ( wxIsWindowsServer() == 1 ) + { + str = _("Windows Server 2003"); + break; + } + //else: must be XP, fall through + + case 1: + str = _("Windows XP"); + break; + } + break; + + case 6: + switch ( info.dwMinorVersion ) + { + case 0: + str = wxIsWindowsServer() == 1 + ? _("Windows Server 2008") + : _("Windows Vista"); + break; + + case 1: + str = wxIsWindowsServer() == 1 + ? _("Windows Server 2008 R2") + : _("Windows 7"); + break; + + case 2: + str = wxIsWindowsServer() == 1 + ? _("Windows Server 2012") + : _("Windows 8"); + break; + + case 3: + str = wxIsWindowsServer() == 1 + ? _("Windows Server 2012 R2") + : _("Windows 8.1"); + break; + } + break; + + case 10: + str = wxIsWindowsServer() == 1 + ? _("Windows Server 2016") + : _("Windows 10"); + break; + } + + if ( str.empty() ) + { + str.Printf(_("Windows NT %lu.%lu"), + info.dwMajorVersion, + info.dwMinorVersion); + } + + str << wxT(" (") + << wxString::Format(_("build %lu"), info.dwBuildNumber); + if ( !wxIsEmpty(info.szCSDVersion) ) + { + str << wxT(", ") << info.szCSDVersion; + } + str << wxT(')'); + + if ( wxIsPlatform64Bit() ) + str << _(", 64-bit edition"); + break; } return str; @@ -1347,7 +1212,7 @@ wxString wxGetOsDescription() bool wxIsPlatform64Bit() { -#if defined(_WIN64) +#if defined(__WIN64__) return true; // 64-bit programs run only on Win64 #elif wxUSE_DYNLIB_CLASS // Win32 // 32-bit programs run on both 32-bit and 64-bit Windows so check @@ -1370,68 +1235,74 @@ bool wxIsPlatform64Bit() #endif // Win64/Win32 } -wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) +wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro) { static struct { - // this may be false, true or -1 if we tried to initialize but failed - int initialized; + bool initialized; wxOperatingSystemId os; int verMaj, - verMin; + verMin, + verMicro; } s_version; // query the OS info only once as it's not supposed to change if ( !s_version.initialized ) { - OSVERSIONINFO info; - wxZeroMemory(info); - info.dwOSVersionInfoSize = sizeof(info); - if ( ::GetVersionEx(&info) ) + const OSVERSIONINFOEXW info = wxGetWindowsVersionInfo(); + + s_version.initialized = true; + + switch ( info.dwPlatformId ) { - s_version.initialized = true; + case VER_PLATFORM_WIN32_NT: + s_version.os = wxOS_WINDOWS_NT; + break; -#if defined(__WXWINCE__) - s_version.os = wxOS_WINDOWS_CE; -#elif defined(__WXMICROWIN__) - s_version.os = wxOS_WINDOWS_MICRO; -#else // "normal" desktop Windows system, use run-time detection - switch ( info.dwPlatformId ) - { - case VER_PLATFORM_WIN32_NT: - s_version.os = wxOS_WINDOWS_NT; - break; - - case VER_PLATFORM_WIN32_WINDOWS: - s_version.os = wxOS_WINDOWS_9X; - break; - } -#endif // Windows versions - - s_version.verMaj = info.dwMajorVersion; - s_version.verMin = info.dwMinorVersion; - } - else // GetVersionEx() failed - { - s_version.initialized = -1; + case VER_PLATFORM_WIN32_WINDOWS: + s_version.os = wxOS_WINDOWS_9X; + break; } + + s_version.verMaj = info.dwMajorVersion; + s_version.verMin = info.dwMinorVersion; + s_version.verMicro = info.dwBuildNumber; } - if ( s_version.initialized == 1 ) - { - if ( verMaj ) - *verMaj = s_version.verMaj; - if ( verMin ) - *verMin = s_version.verMin; - } + if ( verMaj ) + *verMaj = s_version.verMaj; + if ( verMin ) + *verMin = s_version.verMin; + if ( verMicro ) + *verMicro = s_version.verMicro; - // this works even if we were not initialized successfully as the initial - // values of this field is 0 which is wxOS_UNKNOWN and exactly what we need return s_version.os; } +bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn) +{ + OSVERSIONINFOEX osvi; + wxZeroMemory(osvi); + osvi.dwOSVersionInfoSize = sizeof(osvi); + + DWORDLONG const dwlConditionMask = + ::VerSetConditionMask( + ::VerSetConditionMask( + ::VerSetConditionMask( + 0, VER_MAJORVERSION, VER_GREATER_EQUAL), + VER_MINORVERSION, VER_GREATER_EQUAL), + VER_BUILDNUMBER, VER_GREATER_EQUAL); + + osvi.dwMajorVersion = majorVsn; + osvi.dwMinorVersion = minorVsn; + osvi.dwBuildNumber = microVsn; + + return ::VerifyVersionInfo(&osvi, + VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask) != FALSE; +} + wxWinVersion wxGetWinVersion() { int verMaj, @@ -1479,10 +1350,26 @@ wxWinVersion wxGetWinVersion() break; case 6: - return wxWinVersion_NT6; - } - break; + switch ( verMin ) + { + case 0: + return wxWinVersion_Vista; + case 1: + return wxWinVersion_7; + + case 2: + return wxWinVersion_8; + + case 3: + return wxWinVersion_8_1; + + } + break; + + case 10: + return wxWinVersion_10; + } default: // Do nothing just to silence GCC warning break; @@ -1528,7 +1415,6 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding) case wxFONTENCODING_CP1252: return ANSI_CHARSET; -#if !defined(__WXMICROWIN__) // The following four fonts are multi-byte charsets case wxFONTENCODING_CP932: return SHIFTJIS_CHARSET; @@ -1536,10 +1422,8 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding) case wxFONTENCODING_CP936: return GB2312_CHARSET; -#ifndef __WXWINCE__ case wxFONTENCODING_CP949: return HANGUL_CHARSET; -#endif case wxFONTENCODING_CP950: return CHINESEBIG5_CHARSET; @@ -1568,7 +1452,6 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding) case wxFONTENCODING_CP874: return THAI_CHARSET; -#endif // !__WXMICROWIN__ case wxFONTENCODING_CP437: return OEM_CHARSET; diff --git a/Externals/wxWidgets3/src/msw/utilsexc.cpp b/Externals/wxWidgets3/src/msw/utilsexc.cpp index 82c7649972..b0b84739bd 100644 --- a/Externals/wxWidgets3/src/msw/utilsexc.cpp +++ b/Externals/wxWidgets3/src/msw/utilsexc.cpp @@ -45,7 +45,7 @@ #include -#if !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) +#if !defined(__GNUWIN32__) #include #include #endif @@ -54,24 +54,18 @@ #include #endif -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - #ifndef __UNIX__ - #include - #endif +#ifndef __UNIX__ + #include +#endif - #ifndef __GNUWIN32__ - #include - #endif +#ifndef __GNUWIN32__ + #include #endif #include #include #include -#ifndef __WATCOMC__ - #if !(defined(_MSC_VER) && (_MSC_VER > 800)) - #include - #endif -#endif +#include #include #if wxUSE_IPC @@ -79,15 +73,7 @@ #endif // wxUSE_IPC #include "wx/msw/private/hiddenwin.h" - -// FIXME-VC6: These are not defined in VC6 SDK headers. -#ifndef BELOW_NORMAL_PRIORITY_CLASS - #define BELOW_NORMAL_PRIORITY_CLASS 0x4000 -#endif - -#ifndef ABOVE_NORMAL_PRIORITY_CLASS - #define ABOVE_NORMAL_PRIORITY_CLASS 0x8000 -#endif +#include "wx/msw/private/event.h" // ---------------------------------------------------------------------------- // constants @@ -107,7 +93,7 @@ static const wxChar *wxMSWEXEC_WNDCLASSNAME = wxT("_wxExecute_Internal_Class"); static const wxChar *gs_classForHiddenWindow = NULL; // event used to wake up threads waiting in wxExecuteThread -static HANDLE gs_heventShutdown = NULL; +static wxWinAPI::Event gs_heventShutdown; // handles of all threads monitoring the execution of asynchronously running // processes @@ -121,6 +107,14 @@ static wxVector gs_asyncThreads; struct wxExecuteData { public: + wxExecuteData() + { + // The rest is initialized in the code creating the objects of this + // class, but the thread handle can't be set until later, so initialize + // it here to ensure we never use an uninitialized value in our dtor. + hThread = 0; + } + ~wxExecuteData() { if ( !::CloseHandle(hProcess) ) @@ -131,6 +125,7 @@ public: HWND hWnd; // window to send wxWM_PROC_TERMINATED to HANDLE hProcess; // handle of the process + HANDLE hThread; // handle of the thread monitoring its termination DWORD dwProcessId; // pid of the process wxProcess *handler; DWORD dwExitCode; // the exit code of the process @@ -143,17 +138,16 @@ public: virtual bool OnInit() { return true; } virtual void OnExit() { - if ( gs_heventShutdown ) + if ( gs_heventShutdown.IsOk() ) { // stop any threads waiting for the termination of asynchronously // running processes - if ( !::SetEvent(gs_heventShutdown) ) + if ( !gs_heventShutdown.Set() ) { wxLogDebug(wxT("Failed to set shutdown event in wxExecuteModule")); } - ::CloseHandle(gs_heventShutdown); - gs_heventShutdown = NULL; + gs_heventShutdown.Close(); // now wait until they terminate if ( !gs_asyncThreads.empty() ) @@ -192,12 +186,12 @@ public: } private: - DECLARE_DYNAMIC_CLASS(wxExecuteModule) + wxDECLARE_DYNAMIC_CLASS(wxExecuteModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxExecuteModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxExecuteModule, wxModule); -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS #include "wx/private/pipestream.h" #include "wx/private/streamtempinput.h" @@ -291,11 +285,10 @@ static DWORD __stdcall wxExecuteThread(void *arg) wxExecuteData * const data = (wxExecuteData *)arg; // create the shutdown event if we're the first thread starting to wait - if ( !gs_heventShutdown ) + if ( !gs_heventShutdown.IsOk() ) { // create a manual initially non-signalled event object - gs_heventShutdown = ::CreateEvent(NULL, TRUE, FALSE, NULL); - if ( !gs_heventShutdown ) + if ( !gs_heventShutdown.Create(wxWinAPI::Event::ManualReset, wxWinAPI::Event::Nonsignaled) ) { wxLogDebug(wxT("CreateEvent() in wxExecuteThread failed")); } @@ -338,8 +331,8 @@ static DWORD __stdcall wxExecuteThread(void *arg) // window procedure of a hidden window which is created just to receive // the notification message when a process exits -LRESULT APIENTRY _EXPORT wxExecuteWindowCbk(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam) +LRESULT APIENTRY +wxExecuteWindowCbk(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if ( message == wxWM_PROC_TERMINATED ) { @@ -361,6 +354,21 @@ LRESULT APIENTRY _EXPORT wxExecuteWindowCbk(HWND hWnd, UINT message, else { // asynchronous execution - we should do the clean up + for ( wxVector::iterator it = gs_asyncThreads.begin(); + it != gs_asyncThreads.end(); + ++it ) + { + if ( *it == data->hThread ) + { + gs_asyncThreads.erase(it); + if ( !::CloseHandle(data->hThread) ) + { + wxLogLastError(wxT("CloseHandle(hThread)")); + } + break; + } + } + delete data; } @@ -376,7 +384,7 @@ LRESULT APIENTRY _EXPORT wxExecuteWindowCbk(HWND hWnd, UINT message, // implementation of IO redirection support classes // ============================================================================ -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS // ---------------------------------------------------------------------------- // wxPipeInputStreams @@ -681,12 +689,9 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, // the IO redirection is only supported with wxUSE_STREAMS BOOL redirect = FALSE; -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS wxPipe pipeIn, pipeOut, pipeErr; - // we'll save here the copy of pipeIn[Write] - HANDLE hpipeStdinWrite = INVALID_HANDLE_VALUE; - // open the pipes to which child process IO will be redirected if needed if ( handler && handler->IsRedirected() ) { @@ -709,7 +714,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, wxZeroMemory(si); si.cb = sizeof(si); -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS if ( redirect ) { si.dwFlags = STARTF_USESTDHANDLES; @@ -718,27 +723,24 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, si.hStdOutput = pipeOut[wxPipe::Write]; si.hStdError = pipeErr[wxPipe::Write]; - // we must duplicate the handle to the write side of stdin pipe to make - // it non inheritable: indeed, we must close the writing end of pipeIn - // before launching the child process as otherwise this handle will be - // inherited by the child which will never close it and so the pipe - // will never be closed and the child will be left stuck in ReadFile() - HANDLE pipeInWrite = pipeIn.Detach(wxPipe::Write); - if ( !::DuplicateHandle - ( - ::GetCurrentProcess(), - pipeInWrite, - ::GetCurrentProcess(), - &hpipeStdinWrite, - 0, // desired access: unused here - FALSE, // not inherited - DUPLICATE_SAME_ACCESS // same access as for src handle - ) ) - { - wxLogLastError(wxT("DuplicateHandle")); - } + // We must set the handles to those sides of std* pipes that we won't + // in the child to be non-inheritable. We must do this before launching + // the child process as otherwise these handles will be inherited by + // the child which will never close them and so the pipe will not + // return ERROR_BROKEN_PIPE if the parent or child exits unexpectedly + // causing the remaining process to potentially become deadlocked in + // ReadFile() or WriteFile(). + if ( !::SetHandleInformation(pipeIn[wxPipe::Write], + HANDLE_FLAG_INHERIT, 0) ) + wxLogLastError(wxT("SetHandleInformation(pipeIn)")); - ::CloseHandle(pipeInWrite); + if ( !::SetHandleInformation(pipeOut[wxPipe::Read], + HANDLE_FLAG_INHERIT, 0) ) + wxLogLastError(wxT("SetHandleInformation(pipeOut)")); + + if ( !::SetHandleInformation(pipeErr[wxPipe::Read], + HANDLE_FLAG_INHERIT, 0) ) + wxLogLastError(wxT("SetHandleInformation(pipeErr)")); } #endif // wxUSE_STREAMS @@ -756,17 +758,10 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, PROCESS_INFORMATION pi; DWORD dwFlags = CREATE_SUSPENDED; -#ifndef __WXWINCE__ - if ( (flags & wxEXEC_MAKE_GROUP_LEADER) && - (wxGetOsVersion() == wxOS_WINDOWS_NT) ) + if ( (flags & wxEXEC_MAKE_GROUP_LEADER) ) dwFlags |= CREATE_NEW_PROCESS_GROUP; dwFlags |= CREATE_DEFAULT_ERROR_MODE ; -#else - // we are assuming commands without spaces for now - wxString moduleName = command.BeforeFirst(wxT(' ')); - wxString arguments = command.AfterFirst(wxT(' ')); -#endif wxWxCharBuffer envBuffer; bool useCwd = false; @@ -842,15 +837,8 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, bool ok = ::CreateProcess ( - // WinCE requires appname to be non null - // Win32 allows for null -#ifdef __WXWINCE__ - moduleName.t_str(), // application name - wxMSW_CONV_LPTSTR(arguments), // arguments -#else NULL, // application name (use only cmd line) wxMSW_CONV_LPTSTR(command), // full command line -#endif NULL, // security attributes: defaults for both NULL, // the process and its main thread redirect, // inherit handles if we use pipes @@ -863,7 +851,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, &pi // process info ) != 0; -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS // we can close the pipe ends used by child anyhow if ( redirect ) { @@ -875,10 +863,11 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, if ( !ok ) { -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS // close the other handles too if ( redirect ) { + ::CloseHandle(pipeIn.Detach(wxPipe::Write)); ::CloseHandle(pipeOut.Detach(wxPipe::Read)); ::CloseHandle(pipeErr.Detach(wxPipe::Read)); } @@ -889,7 +878,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, return flags & wxEXEC_SYNC ? -1 : 0; } -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS // the input buffer bufOut is connected to stdout, this is why it is // called bufOut and not bufIn wxStreamTempInputBuffer bufOut, @@ -903,7 +892,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, wxPipeInputStream * errStream = new wxPipeInputStream(pipeErr.Detach(wxPipe::Read)); wxPipeOutputStream * - inStream = new wxPipeOutputStream(hpipeStdinWrite); + inStream = new wxPipeOutputStream(pipeIn.Detach(wxPipe::Write)); handler->SetPipeStreams(outStream, inStream, errStream); @@ -978,8 +967,9 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, } gs_asyncThreads.push_back(hThread); + data->hThread = hThread; -#if wxUSE_IPC && !defined(__WXWINCE__) +#if wxUSE_IPC // second part of DDE hack: now establish the DDE conversation with the // just launched process if ( !ddeServer.empty() ) @@ -1040,7 +1030,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, // wait until the child process terminates while ( data->state ) { -#if wxUSE_STREAMS && !defined(__WXWINCE__) +#if wxUSE_STREAMS if ( !bufOut.Update() && !bufErr.Update() ) #endif // wxUSE_STREAMS { diff --git a/Externals/wxWidgets3/src/msw/utilsgui.cpp b/Externals/wxWidgets3/src/msw/utilsgui.cpp index a174c666b5..98e985d6e1 100644 --- a/Externals/wxWidgets3/src/msw/utilsgui.cpp +++ b/Externals/wxWidgets3/src/msw/utilsgui.cpp @@ -29,10 +29,11 @@ #include "wx/utils.h" #endif //WX_PRECOMP -#include "wx/dynlib.h" - #include "wx/msw/private.h" // includes +#include "wx/msw/wrapwin.h" +#include + // ============================================================================ // implementation // ============================================================================ @@ -62,9 +63,7 @@ void wxBeginBusyCursor(const wxCursor *cursor) if ( gs_wxBusyCursorCount++ == 0 ) { gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR(); -#ifndef __WXMICROWIN__ gs_wxBusyCursorOld = ::SetCursor(gs_wxBusyCursor); -#endif } //else: nothing to do, already set } @@ -77,9 +76,7 @@ void wxEndBusyCursor() if ( --gs_wxBusyCursorCount == 0 ) { -#ifndef __WXMICROWIN__ ::SetCursor(gs_wxBusyCursorOld); -#endif gs_wxBusyCursorOld = 0; } } @@ -123,10 +120,6 @@ void wxGetMousePosition( int* x, int* y ) // Return true if we have a colour display bool wxColourDisplay() { -#ifdef __WXMICROWIN__ - // MICROWIN_TODO - return true; -#else // this function is called from wxDC ctor so it is called a *lot* of times // hence we optimize it a bit but doing the check only once // @@ -143,7 +136,6 @@ bool wxColourDisplay() } return s_isColour != 0; -#endif } // Returns depth of screen @@ -156,41 +148,22 @@ int wxDisplayDepth() // Get size of display void wxDisplaySize(int *width, int *height) { -#ifdef __WXMICROWIN__ - RECT rect; - HWND hWnd = GetDesktopWindow(); - ::GetWindowRect(hWnd, & rect); - - if ( width ) - *width = rect.right - rect.left; - if ( height ) - *height = rect.bottom - rect.top; -#else // !__WXMICROWIN__ ScreenHDC dc; if ( width ) *width = ::GetDeviceCaps(dc, HORZRES); if ( height ) *height = ::GetDeviceCaps(dc, VERTRES); -#endif // __WXMICROWIN__/!__WXMICROWIN__ } void wxDisplaySizeMM(int *width, int *height) { -#ifdef __WXMICROWIN__ - // MICROWIN_TODO - if ( width ) - *width = 0; - if ( height ) - *height = 0; -#else ScreenHDC dc; if ( width ) *width = ::GetDeviceCaps(dc, HORZSIZE); if ( height ) *height = ::GetDeviceCaps(dc, VERTSIZE); -#endif } // --------------------------------------------------------------------------- @@ -214,8 +187,6 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) { wxString str; - // MICROWIN_TODO -#ifndef __WXMICROWIN__ if ( hWnd ) { int len = 256; // some starting value @@ -236,7 +207,6 @@ wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) } } } -#endif // !__WXMICROWIN__ return str; } @@ -257,10 +227,9 @@ void PixelToHIMETRIC(LONG *x, LONG *y, HDC hdcRef) iWidthPels = GetDeviceCaps(hdcRef, HORZRES), iHeightPels = GetDeviceCaps(hdcRef, VERTRES); - *x *= (iWidthMM * 100); - *x /= iWidthPels; - *y *= (iHeightMM * 100); - *y /= iHeightPels; + // Take care to use MulDiv() here to avoid overflow. + *x = ::MulDiv(*x, iWidthMM * 100, iWidthPels); + *y = ::MulDiv(*y, iHeightMM * 100, iHeightPels); } void HIMETRICToPixel(LONG *x, LONG *y, HDC hdcRef) @@ -270,10 +239,8 @@ void HIMETRICToPixel(LONG *x, LONG *y, HDC hdcRef) iWidthPels = GetDeviceCaps(hdcRef, HORZRES), iHeightPels = GetDeviceCaps(hdcRef, VERTRES); - *x *= iWidthPels; - *x /= (iWidthMM * 100); - *y *= iHeightPels; - *y /= (iHeightMM * 100); + *x = ::MulDiv(*x, iWidthPels, iWidthMM * 100); + *y = ::MulDiv(*y, iHeightPels, iHeightMM * 100); } void HIMETRICToPixel(LONG *x, LONG *y) @@ -288,16 +255,7 @@ void PixelToHIMETRIC(LONG *x, LONG *y) void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) { -#ifdef __WXWINCE__ - POINT points[2]; - points[0].x = x1; - points[0].y = y1; - points[1].x = x2; - points[1].y = y2; - Polyline(hdc, points, 2); -#else MoveToEx(hdc, x1, y1, NULL); LineTo((HDC) hdc, x2, y2); -#endif } @@ -307,34 +265,7 @@ void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) extern bool wxEnableFileNameAutoComplete(HWND hwnd) { -#if wxUSE_DYNLIB_CLASS - typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); - - static SHAutoComplete_t s_pfnSHAutoComplete = NULL; - static bool s_initialized = false; - - if ( !s_initialized ) - { - s_initialized = true; - - wxLogNull nolog; - wxDynamicLibrary dll(wxT("shlwapi.dll")); - if ( dll.IsLoaded() ) - { - s_pfnSHAutoComplete = - (SHAutoComplete_t)dll.GetSymbol(wxT("SHAutoComplete")); - if ( s_pfnSHAutoComplete ) - { - // won't be unloaded until the process termination, no big deal - dll.Detach(); - } - } - } - - if ( !s_pfnSHAutoComplete ) - return false; - - HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */); + HRESULT hr = ::SHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */); if ( FAILED(hr) ) { wxLogApiError(wxT("SHAutoComplete"), hr); @@ -342,8 +273,4 @@ extern bool wxEnableFileNameAutoComplete(HWND hwnd) } return true; -#else - wxUnusedVar(hwnd); - return false; -#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS } diff --git a/Externals/wxWidgets3/src/msw/utilswin.cpp b/Externals/wxWidgets3/src/msw/utilswin.cpp index 18af87b0f9..b9196a26da 100644 --- a/Externals/wxWidgets3/src/msw/utilswin.cpp +++ b/Externals/wxWidgets3/src/msw/utilswin.cpp @@ -18,6 +18,7 @@ #include "wx/utils.h" #endif //WX_PRECOMP +#include "wx/private/launchbrowser.h" #include "wx/msw/private.h" // includes #include "wx/msw/registry.h" #include // needed for SHELLEXECUTEINFO @@ -32,11 +33,7 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) WinStruct sei; sei.lpFile = document.t_str(); -#ifdef __WXWINCE__ - sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216) -#else sei.nShow = SW_SHOWDEFAULT; -#endif // avoid Windows message box in case of error for consistency with // wxLaunchDefaultBrowser() even if don't show the error ourselves in this @@ -53,16 +50,30 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) // Launch default browser // ---------------------------------------------------------------------------- -bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int flags) -{ - wxUnusedVar(flags); +// NOTE: when testing wxMSW's wxLaunchDefaultBrowser all possible forms +// of the URL/flags should be tested; e.g.: +// +// for (int i=0; i<2; i++) +// { +// // test arguments without a valid URL scheme: +// wxLaunchDefaultBrowser("C:\\test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); +// wxLaunchDefaultBrowser("wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); +// +// // test arguments with different valid schemes: +// wxLaunchDefaultBrowser("file:/C%3A/test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW); +// wxLaunchDefaultBrowser("http://wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); +// wxLaunchDefaultBrowser("mailto:user@host.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW); +// } +// (assuming you have a C:\test.txt file) +bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) +{ #if wxUSE_IPC - if ( flags & wxBROWSER_NEW_WINDOW ) + if ( params.flags & wxBROWSER_NEW_WINDOW ) { // ShellExecuteEx() opens the URL in an existing window by default so // we can't use it if we need a new window - wxRegKey key(wxRegKey::HKCR, scheme + wxT("\\shell\\open")); + wxRegKey key(wxRegKey::HKCR, params.scheme + wxT("\\shell\\open")); if ( !key.Exists() ) { // try the default browser, it must be registered at least for http URLs @@ -102,7 +113,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int f // contain a placeholder for the URL and we should fail if // we didn't find it as this would mean that we have no way // of passing the URL to the browser - ok = ddeCmd.Replace(wxT("%1"), url, false) == 1; + ok = ddeCmd.Replace(wxT("%1"), params.url, false) == 1; } if ( ok ) @@ -126,7 +137,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, const wxString& scheme, int f #endif // wxUSE_IPC WinStruct sei; - sei.lpFile = url.c_str(); + sei.lpFile = params.GetPathOrURL().t_str(); sei.lpVerb = wxT("open"); sei.nShow = SW_SHOWNORMAL; sei.fMask = SEE_MASK_FLAG_NO_UI; // we give error message ourselves diff --git a/Externals/wxWidgets3/src/msw/uxtheme.cpp b/Externals/wxWidgets3/src/msw/uxtheme.cpp index ee30955555..b9c0573f45 100644 --- a/Externals/wxWidgets3/src/msw/uxtheme.cpp +++ b/Externals/wxWidgets3/src/msw/uxtheme.cpp @@ -55,17 +55,17 @@ public: // something like this wxUxThemeEngine *themeEngine = wxUxThemeEngine::ms_themeEngine; wxUxThemeEngine::ms_themeEngine = NULL; - wxUxThemeEngine::ms_isThemeEngineAvailable = false; + wxUxThemeEngine::ms_isThemeEngineAvailable = -1; delete themeEngine; } } - DECLARE_DYNAMIC_CLASS(wxUxThemeModule) + wxDECLARE_DYNAMIC_CLASS(wxUxThemeModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxUxThemeModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxUxThemeModule, wxModule); // ============================================================================ // wxUxThemeEngine implementation @@ -115,8 +115,11 @@ bool wxUxThemeEngine::Initialize() if ( !m_dllUxTheme.Load(wxT("uxtheme.dll")) ) return false; +#define RESOLVE_OPTIONAL_UXTHEME_FUNCTION(type, funcname) \ + funcname = (type)m_dllUxTheme.GetSymbol(wxT(#funcname)) + #define RESOLVE_UXTHEME_FUNCTION(type, funcname) \ - funcname = (type)m_dllUxTheme.GetSymbol(wxT(#funcname)); \ + RESOLVE_OPTIONAL_UXTHEME_FUNCTION(type, funcname); \ if ( !funcname ) \ return false @@ -124,6 +127,9 @@ bool wxUxThemeEngine::Initialize() RESOLVE_UXTHEME_FUNCTION(PFNWXUCLOSETHEMEDATA, CloseThemeData); RESOLVE_UXTHEME_FUNCTION(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground); RESOLVE_UXTHEME_FUNCTION(PFNWXUDRAWTHEMETEXT, DrawThemeText); + // This function is not available under XP, so don't fail if it can't be + // resolved, we'll check before using it. + RESOLVE_OPTIONAL_UXTHEME_FUNCTION(PFNWXUDRAWTHEMETEXTEX, DrawThemeTextEx); RESOLVE_UXTHEME_FUNCTION(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect); RESOLVE_UXTHEME_FUNCTION(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent); RESOLVE_UXTHEME_FUNCTION(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize); diff --git a/Externals/wxWidgets3/src/msw/volume.cpp b/Externals/wxWidgets3/src/msw/volume.cpp index 2b38bc7310..eb639084f4 100644 --- a/Externals/wxWidgets3/src/msw/volume.cpp +++ b/Externals/wxWidgets3/src/msw/volume.cpp @@ -614,11 +614,14 @@ wxIcon wxFSVolume::GetIcon(wxFSIconType type) const SHFILEINFO fi; long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags); - m_icons[type].SetHICON((WXHICON)fi.hIcon); if (!rc || !fi.hIcon) { wxLogError(_("Cannot load icon from '%s'."), m_volName.c_str()); } + else + { + m_icons[type].CreateFromHICON((WXHICON)fi.hIcon); + } } return m_icons[type]; diff --git a/Externals/wxWidgets3/src/msw/webview_ie.cpp b/Externals/wxWidgets3/src/msw/webview_ie.cpp index 9a3d3ea019..3d11783c76 100644 --- a/Externals/wxWidgets3/src/msw/webview_ie.cpp +++ b/Externals/wxWidgets3/src/msw/webview_ie.cpp @@ -24,8 +24,11 @@ #include #include "wx/msw/registry.h" #include "wx/msw/missing.h" +#include "wx/msw/ole/safearray.h" #include "wx/filesys.h" #include "wx/dynlib.h" +#include "wx/scopeguard.h" + #include #include @@ -59,10 +62,10 @@ enum //Internal find flags wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE, wxWebView); -BEGIN_EVENT_TABLE(wxWebViewIE, wxControl) +wxBEGIN_EVENT_TABLE(wxWebViewIE, wxControl) EVT_ACTIVEX(wxID_ANY, wxWebViewIE::onActiveXEvent) EVT_ERASE_BACKGROUND(wxWebViewIE::onEraseBg) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxWebViewIE::Create(wxWindow* parent, wxWindowID id, @@ -141,18 +144,39 @@ void wxWebViewIE::LoadURL(const wxString& url) m_ie.CallMethod("Navigate", wxConvertStringToOle(url)); } +namespace +{ + +// Helper function: wrap the given string in a SAFEARRAY of size 1. +SAFEARRAY* MakeOneElementVariantSafeArray(const wxString& str) +{ + wxSafeArray sa; + if ( !sa.Create(1) ) + { + wxLogLastError(wxT("SafeArrayCreateVector")); + return NULL; + } + + long ind = 0; + if ( !sa.SetElement(&ind, str) ) + { + wxLogLastError(wxT("SafeArrayPtrOfIndex")); + return NULL; + } + + return sa.Detach(); +} + +} // anonymous namespace + void wxWebViewIE::DoSetPage(const wxString& html, const wxString& baseUrl) { - BSTR bstr = SysAllocString(OLESTR("")); - SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); - if (psaStrings != NULL) { - VARIANT *param; - HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m); - param->vt = VT_BSTR; - param->bstrVal = bstr; + SAFEARRAY* const psaStrings = MakeOneElementVariantSafeArray(wxString()); + if ( !psaStrings ) + return; - hr = SafeArrayUnaccessData(psaStrings); + wxON_BLOCK_EXIT1(SafeArrayDestroy, psaStrings); wxCOMPtr document(GetDocument()); @@ -161,50 +185,34 @@ void wxWebViewIE::DoSetPage(const wxString& html, const wxString& baseUrl) document->write(psaStrings); document->close(); - - SafeArrayDestroy(psaStrings); - - bstr = SysAllocString(html.wc_str()); - - // Creates a new one-dimensional array - psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); - if (psaStrings != NULL) - { - hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m); - param->vt = VT_BSTR; - param->bstrVal = bstr; - hr = SafeArrayUnaccessData(psaStrings); - - document = GetDocument(); - - if(!document) - return; - - document->write(psaStrings); - - // SafeArrayDestroy calls SysFreeString for each BSTR - SafeArrayDestroy(psaStrings); - - //We send the events when we are done to mimic webkit - //Navigated event - wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED, - GetId(), baseUrl, ""); - event.SetEventObject(this); - HandleWindowEvent(event); - - //Document complete event - event.SetEventType(wxEVT_WEBVIEW_LOADED); - event.SetEventObject(this); - HandleWindowEvent(event); - } - else - { - wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL"); - } } - else + { - wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL during clear"); + SAFEARRAY* const psaStrings = MakeOneElementVariantSafeArray(html); + + if ( !psaStrings ) + return; + + wxON_BLOCK_EXIT1(SafeArrayDestroy, psaStrings); + + wxCOMPtr document(GetDocument()); + + if(!document) + return; + + document->write(psaStrings); + + //We send the events when we are done to mimic webkit + //Navigated event + wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED, + GetId(), baseUrl, ""); + event.SetEventObject(this); + HandleWindowEvent(event); + + //Document complete event + event.SetEventType(wxEVT_WEBVIEW_LOADED); + event.SetEventObject(this); + HandleWindowEvent(event); } } @@ -224,8 +232,8 @@ wxString wxWebViewIE::GetPageSource() const if(SUCCEEDED(hr)) { BSTR bstr; - htmlTag->get_outerHTML(&bstr); - source = wxString(bstr); + if ( htmlTag->get_outerHTML(&bstr) == S_OK ) + source = wxString(bstr); } } return source; @@ -565,16 +573,15 @@ wxString wxWebViewIE::GetCurrentTitle() const { wxCOMPtr document(GetDocument()); + wxString s; if(document) { BSTR title; - document->get_nameProp(&title); - return wxString(title); - } - else - { - return ""; + if ( document->get_nameProp(&title) == S_OK ) + s = title; } + + return s; } bool wxWebViewIE::CanCut() const @@ -699,16 +706,13 @@ bool wxWebViewIE::IsEditable() const if(document) { BSTR mode; - document->get_designMode(&mode); - if(wxString(mode) == "On") - return true; - else - return false; - } - else - { - return false; + if ( document->get_designMode(&mode) == S_OK ) + { + if ( wxString(mode) == "On" ) + return true; + } } + return false; } void wxWebViewIE::SelectAll() @@ -728,8 +732,8 @@ bool wxWebViewIE::HasSelection() const if(SUCCEEDED(hr)) { BSTR type; - selection->get_type(&type); - sel = wxString(type); + if ( selection->get_type(&type) == S_OK ) + sel = wxString(type); } return sel != "None"; } @@ -764,8 +768,8 @@ wxString wxWebViewIE::GetSelectedText() const if(SUCCEEDED(hr)) { BSTR text; - range->get_text(&text); - selected = wxString(text); + if ( range->get_text(&text) == S_OK ) + selected = wxString(text); } } } @@ -797,8 +801,8 @@ wxString wxWebViewIE::GetSelectedSource() const if(SUCCEEDED(hr)) { BSTR text; - range->get_htmlText(&text); - selected = wxString(text); + if ( range->get_htmlText(&text) == S_OK ) + selected = wxString(text); } } } @@ -838,8 +842,8 @@ wxString wxWebViewIE::GetPageText() const if(SUCCEEDED(hr)) { BSTR out; - body->get_innerText(&out); - text = wxString(out); + if ( body->get_innerText(&out) == S_OK ) + text = wxString(out); } return text; } @@ -960,13 +964,13 @@ bool wxWebViewIE::IsElementVisible(wxCOMPtr elm) { //Check if the object has the style display:none. if((style->get_display(&tmp_bstr) != S_OK) || - (tmp_bstr != NULL && (_wcsicmp(tmp_bstr, L"none") == 0))) + (tmp_bstr != NULL && (wxCRT_StricmpW(tmp_bstr, L"none") == 0))) { is_visible = false; } //Check if the object has the style visibility:hidden. if((is_visible && (style->get_visibility(&tmp_bstr) != S_OK)) || - (tmp_bstr != NULL && _wcsicmp(tmp_bstr, L"hidden") == 0)) + (tmp_bstr != NULL && wxCRT_StricmpW(tmp_bstr, L"hidden") == 0)) { is_visible = false; } diff --git a/Externals/wxWidgets3/src/msw/wince/checklst.cpp b/Externals/wxWidgets3/src/msw/wince/checklst.cpp deleted file mode 100644 index 6b9fd5e409..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/checklst.cpp +++ /dev/null @@ -1,393 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/checklst.cpp -// Purpose: implementation of wxCheckListBox class -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.10.2005 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHECKLISTBOX - -#include "wx/checklst.h" - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" // include "properly" -#endif - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// implementation of wxCheckListBox class -// ---------------------------------------------------------------------------- - -// define event table -// ------------------ -BEGIN_EVENT_TABLE(wxCheckListBox, wxControl) - EVT_SIZE(wxCheckListBox::OnSize) -END_EVENT_TABLE() - -// control creation -// ---------------- - -// def ctor: use Create() to really create the control -wxCheckListBox::wxCheckListBox() -{ -} - -// ctor which creates the associated control -wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - int nStrings, const wxString choices[], - long style, const wxValidator& val, - const wxString& name) -{ - Create(parent, id, pos, size, nStrings, choices, style, val, name); -} - -wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - const wxArrayString& choices, - long style, const wxValidator& val, - const wxString& name) -{ - Create(parent, id, pos, size, choices, style, val, name); -} - -wxCheckListBox::~wxCheckListBox() -{ - m_itemsClientData.Clear(); -} - -bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, const wxString& name) -{ - // initialize base class fields - if ( !CreateControl(parent, id, pos, size, style, validator, name) ) - return false; - - // create the native control - if ( !MSWCreateControl(WC_LISTVIEW, wxEmptyString, pos, size) ) - { - // control creation failed - return false; - } - - ::SendMessage(GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, - LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT ); - - // insert single column with checkboxes and labels - LV_COLUMN col; - wxZeroMemory(col); - ListView_InsertColumn(GetHwnd(), 0, &col ); - - ListView_SetItemCount( GetHwnd(), n ); - - // initialize the contents - for ( int i = 0; i < n; i++ ) - { - Append(choices[i]); - } - - m_itemsClientData.SetCount(n); - - // now we can compute our best size correctly, so do it if necessary - SetInitialSize(size); - - return true; -} - -bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, const wxString& name) -{ - wxCArrayString chs(choices); - return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), - style, validator, name); -} - -WXDWORD wxCheckListBox::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - WXDWORD wstyle = wxControl::MSWGetStyle(style, exstyle); - - wstyle |= LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER; - - return wstyle; -} - -void wxCheckListBox::OnSize(wxSizeEvent& event) -{ - // set width of the column we use to the width of list client area - event.Skip(); - int w = GetClientSize().x; - ListView_SetColumnWidth( GetHwnd(), 0, w ); -} - -// misc overloaded methods -// ----------------------- - -void wxCheckListBox::DoDeleteOneItem(unsigned int n) -{ - wxCHECK_RET( IsValid( n ), wxT("invalid index in wxCheckListBox::Delete") ); - - if ( !ListView_DeleteItem(GetHwnd(), n) ) - { - wxLogLastError(wxT("ListView_DeleteItem")); - } - m_itemsClientData.RemoveAt(n); -} - -// check items -// ----------- - -bool wxCheckListBox::IsChecked(unsigned int uiIndex) const -{ - wxCHECK_MSG( IsValid( uiIndex ), false, - wxT("invalid index in wxCheckListBox::IsChecked") ); - - return (ListView_GetCheckState(((HWND)GetHWND()), uiIndex) != 0); -} - -void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck) -{ - wxCHECK_RET( IsValid( uiIndex ), - wxT("invalid index in wxCheckListBox::Check") ); - - ListView_SetCheckState(((HWND)GetHWND()), uiIndex, bCheck) -} - -// interface derived from wxListBox and lower classes -// -------------------------------------------------- - -void wxCheckListBox::DoClear() -{ - unsigned int n = GetCount(); - - while ( n > 0 ) - { - n--; - DoDeleteOneItem(n); - } - - wxASSERT_MSG( IsEmpty(), wxT("logic error in DoClear()") ); -} - -unsigned int wxCheckListBox::GetCount() const -{ - return (unsigned int)ListView_GetItemCount( (HWND)GetHWND() ); -} - -int wxCheckListBox::GetSelection() const -{ - int i; - for (i = 0; (unsigned int)i < GetCount(); i++) - { - int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED); - if (selState == LVIS_SELECTED) - return i; - } - - return wxNOT_FOUND; -} - -int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const -{ - int i; - for (i = 0; (unsigned int)i < GetCount(); i++) - { - int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED); - if (selState == LVIS_SELECTED) - aSelections.Add(i); - } - - return aSelections.GetCount(); -} - -wxString wxCheckListBox::GetString(unsigned int n) const -{ - const int bufSize = 513; - wxChar buf[bufSize]; - ListView_GetItemText( (HWND)GetHWND(), n, 0, buf, bufSize - 1 ); - buf[bufSize-1] = wxT('\0'); - wxString str(buf); - return str; -} - -bool wxCheckListBox::IsSelected(int n) const -{ - int selState = ListView_GetItemState(GetHwnd(), n, LVIS_SELECTED); - return (selState == LVIS_SELECTED); -} - -void wxCheckListBox::SetString(unsigned int n, const wxString& s) -{ - wxCHECK_RET( IsValid( n ), - wxT("invalid index in wxCheckListBox::SetString") ); - wxChar *buf = new wxChar[s.length()+1]; - wxStrcpy(buf, s.c_str()); - ListView_SetItemText( (HWND)GetHWND(), n, 0, buf ); - delete [] buf; -} - -void* wxCheckListBox::DoGetItemClientData(unsigned int n) const -{ - return m_itemsClientData.Item(n); -} - -int wxCheckListBox::DoInsertItems(const wxArrayStringsAdapter & items, - unsigned int pos, - void **clientData, wxClientDataType type) -{ - const unsigned int count = items.GetCount(); - - ListView_SetItemCount( GetHwnd(), GetCount() + count ); - - int n = wxNOT_FOUND; - - for( unsigned int i = 0; i < count; i++ ) - { - LVITEM newItem; - wxZeroMemory(newItem); - newItem.iItem = pos + i; - n = ListView_InsertItem( (HWND)GetHWND(), & newItem ); - wxCHECK_MSG( n != -1, -1, wxT("Item not added") ); - SetString( n, items[i] ); - m_itemsClientData.Insert(NULL, n); - - AssignNewItemClientData(n, clientData, i, type); - } - - return n; -} - -void wxCheckListBox::DoSetFirstItem(int n) -{ - int pos = ListView_GetTopIndex( (HWND)GetHWND() ); - if(pos == n) return; - POINT ppt; - BOOL ret = ListView_GetItemPosition( (HWND)GetHWND(), n, &ppt ); - wxCHECK_RET( ret == TRUE, wxT("Broken DoSetFirstItem") ); - ListView_Scroll( (HWND)GetHWND(), 0, 0 ); - ListView_Scroll( (HWND)GetHWND(), 0, ppt.y ); -} - -void wxCheckListBox::DoSetItemClientData(unsigned int n, void* clientData) -{ - m_itemsClientData.Item(n) = clientData; -} - -void wxCheckListBox::DoSetSelection(int n, bool select) -{ - ListView_SetItemState(GetHwnd(), n, select ? LVIS_SELECTED : 0, LVIS_SELECTED); -} - -bool wxCheckListBox::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) -{ - // prepare the event - // ----------------- - - wxCommandEvent event(wxEVT_NULL, m_windowId); - event.SetEventObject(this); - - wxEventType eventType = wxEVT_NULL; - - NMHDR *nmhdr = (NMHDR *)lParam; - - if ( nmhdr->hwndFrom == GetHwnd() ) - { - // almost all messages use NM_LISTVIEW - NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr; - - const int iItem = nmLV->iItem; - - bool processed = true; - switch ( nmhdr->code ) - { - case LVN_ITEMCHANGED: - // we translate this catch all message into more interesting - // (and more easy to process) wxWidgets events - - // first of all, we deal with the state change events only and - // only for valid items (item == -1 for the virtual list - // control) - if ( nmLV->uChanged & LVIF_STATE && iItem != -1 ) - { - // temp vars for readability - const UINT stOld = nmLV->uOldState; - const UINT stNew = nmLV->uNewState; - - // Check image changed - if ((stOld & LVIS_STATEIMAGEMASK) != (stNew & LVIS_STATEIMAGEMASK)) - { - event.SetEventType(wxEVT_CHECKLISTBOX); - event.SetInt(IsChecked(iItem)); - (void) GetEventHandler()->ProcessEvent(event); - } - - if ( (stNew & LVIS_SELECTED) != (stOld & LVIS_SELECTED) ) - { - eventType = wxEVT_LISTBOX; - - event.SetExtraLong( (stNew & LVIS_SELECTED) != 0 ); // is a selection - event.SetInt(iItem); - } - } - - if ( eventType == wxEVT_NULL ) - { - // not an interesting event for us - return false; - } - - break; - - default: - processed = false; - } - - if ( !processed ) - return wxControl::MSWOnNotify(idCtrl, lParam, result); - } - else - { - // where did this one come from? - return false; - } - - // process the event - // ----------------- - - event.SetEventType(eventType); - - bool processed = GetEventHandler()->ProcessEvent(event); - if ( processed ) - *result = 0; - - return processed; -} - - -#endif diff --git a/Externals/wxWidgets3/src/msw/wince/choicece.cpp b/Externals/wxWidgets3/src/msw/wince/choicece.cpp deleted file mode 100644 index 04ea4850a2..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/choicece.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/choicece.cpp -// Purpose: wxChoice implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 29.07.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_CHOICE && defined(__SMARTPHONE__) && defined(__WXWINCE__) - -#include "wx/choice.h" - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" // include "properly" -#endif - -#include "wx/spinbutt.h" // for wxSpinnerBestSize - -#define GetBuddyHwnd() (HWND)(m_hwndBuddy) - -#define IsVertical(wxStyle) ( (wxStyle & wxSP_HORIZONTAL) != wxSP_HORIZONTAL ) - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the up-down control and its buddy (can be arbitrary, -// choose what you like - or may be decide during run-time depending on the -// font size?) -static const int MARGIN_BETWEEN = 0; - -// ============================================================================ -// implementation -// ============================================================================ - -wxArrayChoiceSpins wxChoice::ms_allChoiceSpins; - -// ---------------------------------------------------------------------------- -// wnd proc for the buddy text ctrl -// ---------------------------------------------------------------------------- - -LRESULT APIENTRY _EXPORT wxBuddyChoiceWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) -{ - wxChoice *spin = (wxChoice *)wxGetWindowUserData(hwnd); - - // forward some messages (the key and focus ones only so far) to - // the spin ctrl - switch ( message ) - { - case WM_SETFOCUS: - // if the focus comes from the spin control itself, don't set it - // back to it -- we don't want to go into an infinite loop - if ( (WXHWND)wParam == spin->GetHWND() ) - break; - //else: fall through - - case WM_KILLFOCUS: - case WM_CHAR: - case WM_DEADCHAR: - case WM_KEYUP: - case WM_KEYDOWN: - spin->MSWWindowProc(message, wParam, lParam); - - // The control may have been deleted at this point, so check. - if ( !::IsWindow(hwnd) || wxGetWindowUserData(hwnd) != spin ) - return 0; - break; - - case WM_GETDLGCODE: - // we want to get WXK_RETURN in order to generate the event for it - return DLGC_WANTCHARS; - } - - return ::CallWindowProc(CASTWNDPROC spin->GetBuddyWndProc(), - hwnd, message, wParam, lParam); -} - -wxChoice *wxChoice::GetChoiceForListBox(WXHWND hwndBuddy) -{ - wxChoice *choice = (wxChoice *)wxGetWindowUserData((HWND)hwndBuddy); - - int i = ms_allChoiceSpins.Index(choice); - - if ( i == wxNOT_FOUND ) - return NULL; - - // sanity check - wxASSERT_MSG( choice->m_hwndBuddy == hwndBuddy, - wxT("wxChoice has incorrect buddy HWND!") ); - - return choice; -} - -// ---------------------------------------------------------------------------- -// creation -// ---------------------------------------------------------------------------- - -bool wxChoice::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - return CreateAndInit(parent, id, pos, size, n, choices, style, - validator, name); -} - -bool wxChoice::CreateAndInit(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( !(style & wxSP_VERTICAL) ) - style |= wxSP_HORIZONTAL; - - if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) - style |= wxBORDER_SIMPLE; - - style |= wxSP_ARROW_KEYS; - - SetWindowStyle(style); - - WXDWORD exStyle = 0; - WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; - - wxSize sizeText(size), sizeBtn(size); - sizeBtn.x = GetBestSpinnerSize(IsVertical(style)).x; - - if ( sizeText.x == wxDefaultCoord ) - { - // DEFAULT_ITEM_WIDTH is the default width for the text control - sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; - } - - sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; - if ( sizeText.x <= 0 ) - { - wxLogDebug(wxT("not enough space for wxSpinCtrl!")); - } - - wxPoint posBtn(pos); - posBtn.x += sizeText.x + MARGIN_BETWEEN; - - // we must create the list control before the spin button for the purpose - // of the dialog navigation: if there is a static text just before the spin - // control, activating it by Alt-letter should give focus to the text - // control, not the spin and the dialog navigation code will give focus to - // the next control (at Windows level), not the one after it - - // create the text window - - m_hwndBuddy = (WXHWND)::CreateWindowEx - ( - exStyle, // sunken border - wxT("LISTBOX"), // window class - NULL, // no window title - msStyle, // style (will be shown later) - pos.x, pos.y, // position - 0, 0, // size (will be set later) - GetHwndOf(parent), // parent - (HMENU)-1, // control id - wxGetInstance(), // app instance - NULL // unused client data - ); - - if ( !m_hwndBuddy ) - { - wxLogLastError(wxT("CreateWindow(buddy text window)")); - - return false; - } - - // initialize wxControl - if ( !CreateControl(parent, id, posBtn, sizeBtn, style, validator, name) ) - return false; - - // now create the real HWND - WXDWORD spiner_style = WS_VISIBLE | - UDS_ALIGNRIGHT | - UDS_ARROWKEYS | - UDS_SETBUDDYINT | - UDS_EXPANDABLE; - - if ( !IsVertical(style) ) - spiner_style |= UDS_HORZ; - - if ( style & wxSP_WRAP ) - spiner_style |= UDS_WRAP; - - if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxEmptyString, 0) ) - return false; - - // subclass the text ctrl to be able to intercept some events - wxSetWindowUserData(GetBuddyHwnd(), this); - m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), - wxBuddyChoiceWndProc); - - // set up fonts and colours (This is nomally done in MSWCreateControl) - InheritAttributes(); - if (!m_hasFont) - SetFont(GetDefaultAttributes().font); - - // set the size of the text window - can do it only now, because we - // couldn't call DoGetBestSize() before as font wasn't set - if ( sizeText.y <= 0 ) - { - int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); - - sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); - } - - SetInitialSize(size); - - (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); - - // associate the list window with the spin button - (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0); - - // do it after finishing with m_hwndBuddy creation to avoid generating - // initial wxEVT_TEXT message - ms_allChoiceSpins.Add(this); - - // initialize the controls contents - for ( int i = 0; i < n; i++ ) - { - Append(choices[i]); - } - - return true; -} - -bool wxChoice::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, - const wxString& name) -{ - wxCArrayString chs(choices); - return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), - style, validator, name); -} - -WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - // we never have an external border - WXDWORD msStyle = wxControl::MSWGetStyle - ( - (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle - ); - - msStyle |= WS_VISIBLE; - - // wxChoice-specific styles - msStyle |= LBS_NOINTEGRALHEIGHT; - if ( style & wxCB_SORT ) - msStyle |= LBS_SORT; - - msStyle |= LBS_NOTIFY; - - return msStyle; -} - -bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) -{ - if ( param != LBN_SELCHANGE) - { - // "selection changed" is the only event we're after - return false; - } - - int n = GetSelection(); - if (n > -1) - { - wxCommandEvent event(wxEVT_CHOICE, m_windowId); - event.SetInt(n); - event.SetEventObject(this); - event.SetString(GetStringSelection()); - if ( HasClientObjectData() ) - event.SetClientObject( GetClientObject(n) ); - else if ( HasClientUntypedData() ) - event.SetClientData( GetClientData(n) ); - ProcessCommand(event); - } - - return true; -} - -wxChoice::~wxChoice() -{ - Clear(); -} - -// ---------------------------------------------------------------------------- -// adding/deleting items to/from the list -// ---------------------------------------------------------------------------- - -int wxChoice::DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, - wxClientDataType type) -{ - MSWAllocStorage(items, LB_INITSTORAGE); - - const bool append = pos == GetCount(); - const unsigned msg = append ? LB_ADDSTRING : LB_INSERTSTRING; - if ( append ) - pos = 0; - - int n = wxNOT_FOUND; - - const unsigned int numItems = items.GetCount(); - for ( unsigned int i = 0; i < numItems; ++i ) - { - n = MSWInsertOrAppendItem(pos, items[i], msg); - if ( !append ) - pos++; - - AssignNewItemClientData(n, clientData, i, type); - } - - return n; -} - -void wxChoice::DoDeleteOneItem(unsigned int n) -{ - wxCHECK_RET( IsValid(n), wxT("invalid item index in wxChoice::Delete") ); - - ::SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0); -} - -void wxChoice::DoClear() -{ - ::SendMessage(GetBuddyHwnd(), LB_RESETCONTENT, 0, 0); -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -int wxChoice::GetSelection() const -{ - return (int)::SendMessage(GetBuddyHwnd(), LB_GETCURSEL, 0, 0); -} - -void wxChoice::SetSelection(int n) -{ - ::SendMessage(GetBuddyHwnd(), LB_SETCURSEL, n, 0); -} - -// ---------------------------------------------------------------------------- -// string list functions -// ---------------------------------------------------------------------------- - -unsigned int wxChoice::GetCount() const -{ - return (unsigned int)::SendMessage(GetBuddyHwnd(), LB_GETCOUNT, 0, 0); -} - -int wxChoice::FindString(const wxString& s, bool bCase) const -{ - // back to base class search for not native search type - if (bCase) - return wxItemContainerImmutable::FindString( s, bCase ); - - int pos = (int)::SendMessage(GetBuddyHwnd(), LB_FINDSTRINGEXACT, - (WPARAM)-1, (LPARAM)s.c_str()); - - return pos == LB_ERR ? wxNOT_FOUND : pos; -} - -void wxChoice::SetString(unsigned int n, const wxString& s) -{ - wxCHECK_RET( IsValid(n), - wxT("invalid item index in wxChoice::SetString") ); - - // we have to delete and add back the string as there is no way to change a - // string in place - - // we need to preserve the client data - void *data; - if ( m_clientDataItemsType != wxClientData_None ) - { - data = DoGetItemClientData(n); - } - else // no client data - { - data = NULL; - } - - ::SendMessage(GetBuddyHwnd(), LB_DELETESTRING, n, 0); - ::SendMessage(GetBuddyHwnd(), LB_INSERTSTRING, n, (LPARAM)s.c_str() ); - - if ( data ) - { - DoSetItemClientData(n, data); - } - //else: it's already NULL by default -} - -wxString wxChoice::GetString(unsigned int n) const -{ - int len = (int)::SendMessage(GetBuddyHwnd(), LB_GETTEXTLEN, n, 0); - - wxString str; - if ( len != LB_ERR && len > 0 ) - { - if ( ::SendMessage - ( - GetBuddyHwnd(), - LB_GETTEXT, - n, - (LPARAM)(wxChar *)wxStringBuffer(str, len) - ) == LB_ERR ) - { - wxLogLastError(wxT("SendMessage(LB_GETLBTEXT)")); - } - } - - return str; -} - -// ---------------------------------------------------------------------------- -// client data -// ---------------------------------------------------------------------------- - -void wxChoice::DoSetItemClientData(unsigned int n, void* clientData) -{ - if ( ::SendMessage(GetHwnd(), LB_SETITEMDATA, - n, (LPARAM)clientData) == LB_ERR ) - { - wxLogLastError(wxT("LB_SETITEMDATA")); - } -} - -void* wxChoice::DoGetItemClientData(unsigned int n) const -{ - LPARAM rc = ::SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0); - if ( rc == LB_ERR ) - { - wxLogLastError(wxT("LB_GETITEMDATA")); - - // unfortunately, there is no way to return an error code to the user - rc = (LPARAM) NULL; - } - - return (void *)rc; -} - -// ---------------------------------------------------------------------------- -// size calculations -// ---------------------------------------------------------------------------- - -wxSize wxChoice::DoGetBestSize() const -{ - wxSize sizeBtn = GetBestSpinnerSize(IsVertical(GetWindowStyle())); - sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN; - - int y; - wxGetCharSize(GetHWND(), NULL, &y, GetFont()); - y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y); - - // JACS: we should always use the height calculated - // from above, because otherwise we'll get a spin control - // that's too big. So never use the height calculated - // from wxSpinButton::DoGetBestSize(). - - // if ( sizeBtn.y < y ) - { - // make the text tall enough - sizeBtn.y = y; - } - - return sizeBtn; -} - -void wxChoice::DoMoveWindow(int x, int y, int width, int height) -{ - int widthBtn = GetBestSpinnerSize(IsVertical(GetWindowStyle())).x; - int widthText = width - widthBtn - MARGIN_BETWEEN; - if ( widthText <= 0 ) - { - wxLogDebug(wxT("not enough space for wxSpinCtrl!")); - } - - if ( !::MoveWindow(GetBuddyHwnd(), x, y, widthText, height, TRUE) ) - { - wxLogLastError(wxT("MoveWindow(buddy)")); - } - - x += widthText + MARGIN_BETWEEN; - if ( !::MoveWindow(GetHwnd(), x, y, widthBtn, height, TRUE) ) - { - wxLogLastError(wxT("MoveWindow")); - } -} - -// get total size of the control -void wxChoice::DoGetSize(int *x, int *y) const -{ - RECT spinrect, textrect, ctrlrect; - GetWindowRect(GetHwnd(), &spinrect); - GetWindowRect(GetBuddyHwnd(), &textrect); - UnionRect(&ctrlrect, &textrect, &spinrect); - - if ( x ) - *x = ctrlrect.right - ctrlrect.left; - if ( y ) - *y = ctrlrect.bottom - ctrlrect.top; -} - -void wxChoice::DoGetPosition(int *x, int *y) const -{ - // hack: pretend that our HWND is the text control just for a moment - WXHWND hWnd = GetHWND(); - wxConstCast(this, wxChoice)->m_hWnd = m_hwndBuddy; - - wxChoiceBase::DoGetPosition(x, y); - - wxConstCast(this, wxChoice)->m_hWnd = hWnd; -} - -#endif // wxUSE_CHOICE && __SMARTPHONE__ && __WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/wince/clean_vcp.py b/Externals/wxWidgets3/src/msw/wince/clean_vcp.py deleted file mode 100644 index cfce50fb0a..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/clean_vcp.py +++ /dev/null @@ -1,48 +0,0 @@ -''' -This script will delete dependences from *.vcp files. -After using this script, next time when you will try to save project, -you will have wait until 'Visual Tools' will rebuild all dependencies -and this process might take HUGE amount of time - -Author : Viktor Voroshylo -''' -__version__='$Revision: 74602 $'[11:-2] - -import sys - -if len(sys.argv) != 2 : - print "Usage: %s project_file.vcp" % sys.argv[0] - sys.exit(0) - -vsp_filename = sys.argv[1] -exclude_line = 0 -resultLines = [] - -vsp_file = open(vsp_filename, "r") -empty_if_start = -1 - -line = vsp_file.readline() -while line : - skip_line = 0 - if exclude_line : - if not line.endswith("\\\n") : exclude_line = 0 - skip_line = 1 - elif line.startswith("DEP_CPP_") or line.startswith("NODEP_CPP_") : - exclude_line = 1 - skip_line = 1 - elif empty_if_start != -1 : - if line == "!ENDIF \n" : - resultLines = resultLines[:empty_if_start] - empty_if_start = -1 - skip_line = 1 - elif line != "\n" and not line.startswith("!ELSEIF ") : - empty_if_start = -1 - elif line.startswith("!IF ") : - empty_if_start = len(resultLines) - - if not skip_line : - resultLines.append(line) - - line = vsp_file.readline() - -open(vsp_filename, "w").write("".join(resultLines)) diff --git a/Externals/wxWidgets3/src/msw/wince/crt.cpp b/Externals/wxWidgets3/src/msw/wince/crt.cpp deleted file mode 100644 index 2a98a6d073..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/crt.cpp +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/crt.cpp -// Purpose: Implementation of CRT functions missing under Windows CE -// Author: Vadim Zeitlin -// Modified by: -// Created: 03.04.04 -// Copyright: (c) 2004 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/app.h" -#endif - -#include "wx/msw/wince/missing.h" - -extern "C" void * -bsearch(const void *key, const void *base, size_t num, size_t size, - int (wxCMPFUNC_CONV *cmp)(const void *, const void *)) -{ - int res; - char *mid; - - char *lo = (char *)base; - char *hi = lo + num*size; - while ( lo < hi ) - { - mid = lo + (hi - lo)/2; - - res = (*cmp)(key, mid); - if ( res < 0 ) - hi = mid; - else if ( res > 0 ) - lo = mid + size; - else // res == 0 - return mid; - } - - return NULL; -} - -extern "C" -void abort() -{ - wxString name; - if ( wxTheApp ) - name = wxTheApp->GetAppDisplayName(); - if ( name.empty() ) - name = L"wxWidgets Application"; - - MessageBox(NULL, L"Abnormal program termination", name, MB_ICONHAND | MB_OK); - - _exit(3); -// ::ExitProcess(3); -} - -extern "C" -char *getenv(const char * WXUNUSED(name)) -{ - // no way to implement it in Unicode-only environment without using - // wxCharBuffer and it is of no use in C code which uses this function - // (libjpeg) - return NULL; -} - -int wxCRT_Rename(const wchar_t *src, const wchar_t *dst) -{ - return ::MoveFile(src, dst) ? 0 : -1; -} - -int wxCRT_Remove(const wchar_t *path) -{ - return ::DeleteFile(path) ? 0 : -1; -} - diff --git a/Externals/wxWidgets3/src/msw/wince/filedlgwce.cpp b/Externals/wxWidgets3/src/msw/wince/filedlgwce.cpp deleted file mode 100644 index 19a4a19101..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/filedlgwce.cpp +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/filedlgwce.cpp -// Purpose: wxFileDialog implementation for smart phones driven by WinCE -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// 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 - -// Only use this for MS SmartPhone. Use standard file dialog -// for Pocket PC. - -#if wxUSE_FILEDLG && defined(__SMARTPHONE__) && defined(__WXWINCE__) - -#include "wx/filedlg.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/msgdlg.h" - #include "wx/dialog.h" - #include "wx/filefn.h" - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/app.h" -#endif - -#include "wx/msw/private.h" - -#include -#include - -#include "wx/filename.h" -#include "wx/modalhook.h" - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxWin macros -// ---------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxFileDialog, wxDialog) - -// ---------------------------------------------------------------------------- -// wxFileDialog -// ---------------------------------------------------------------------------- - -wxFileDialog::wxFileDialog(wxWindow *parent, - const wxString& message, - const wxString& defaultDir, - const wxString& defaultFileName, - const wxString& wildCard, - long style, - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(sz), - const wxString& WXUNUSED(name)) -{ - m_message = message; - m_windowStyle = style; - if ( ( m_windowStyle & wxFD_MULTIPLE ) && ( m_windowStyle & wxFD_SAVE ) ) - m_windowStyle &= ~wxFD_MULTIPLE; - m_parent = parent; - m_path = wxEmptyString; - m_fileName = defaultFileName; - m_dir = defaultDir; - m_wildCard = wildCard; - m_filterIndex = 0; -} - -void wxFileDialog::GetPaths(wxArrayString& paths) const -{ - paths.Empty(); - - wxString dir(m_dir); - if ( m_dir.Last() != wxT('\\') ) - dir += wxT('\\'); - - size_t count = m_fileNames.GetCount(); - for ( size_t n = 0; n < count; n++ ) - { - if (wxFileName(m_fileNames[n]).IsAbsolute()) - paths.Add(m_fileNames[n]); - else - paths.Add(dir + m_fileNames[n]); - } -} - -void wxFileDialog::SetPath(const wxString& path) -{ - wxString ext; - wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); - if ( !ext.empty() ) - m_fileName << wxT('.') << ext; -} - -int wxFileDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - wxWindow* parentWindow = GetParent(); - if (!parentWindow) - parentWindow = wxTheApp->GetTopWindow(); - - wxString str = wxGetTextFromUser(m_message, _("File"), m_fileName, parentWindow); - if (str.empty()) - return wxID_CANCEL; - - m_fileName = str; - m_fileNames.Add(str); - return wxID_OK; -} - -void wxFileDialog::GetFilenames(wxArrayString& files) const -{ - files = m_fileNames; -} - -#endif // wxUSE_FILEDLG && __SMARTPHONE__ && __WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/wince/filefnwce.cpp b/Externals/wxWidgets3/src/msw/wince/filefnwce.cpp deleted file mode 100644 index 6f9292fa84..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/filefnwce.cpp +++ /dev/null @@ -1,216 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/filefn.cpp -// Purpose: File- and directory-related functions -// Author: Julian Smart -// Modified by: -// Created: 29/01/98 -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/file.h" - -#include -#include -#include -#include - -#ifdef __WXWINCE__ -#include "wx/msw/wince/missing.h" - -int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)) -{ - DWORD access = 0; - DWORD shareMode = 0; - DWORD disposition = 0; - - if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) - { - access = GENERIC_READ; - shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE; - disposition = OPEN_EXISTING; - } - else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) - { - access = GENERIC_WRITE; - disposition = OPEN_ALWAYS; - } - else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR) - { - access = GENERIC_READ|GENERIC_WRITE; - disposition = OPEN_ALWAYS; - } - - if (oflag & O_APPEND) - { - if ( wxFile::Exists(filename) ) - { - access |= GENERIC_WRITE; - shareMode = FILE_SHARE_READ; - disposition = OPEN_EXISTING; - } - else - { - oflag |= O_TRUNC; - } - } - if (oflag & O_TRUNC) - { - access |= GENERIC_WRITE; - shareMode = 0; - disposition = oflag & O_CREAT ? CREATE_ALWAYS : TRUNCATE_EXISTING; - } - else if (oflag & O_CREAT) - { - access |= GENERIC_WRITE; - shareMode = 0; - disposition = CREATE_NEW; - } - else if (oflag & O_EXCL) - { - access |= GENERIC_WRITE; - shareMode = 0; - disposition = TRUNCATE_EXISTING; - } - - int fd = 0; - HANDLE fileHandle = ::CreateFile(filename, access, shareMode, NULL, - disposition, FILE_ATTRIBUTE_NORMAL, 0); - if (fileHandle == INVALID_HANDLE_VALUE) - fd = -1; - else - fd = (int) fileHandle; - - return fd; -} - -int wxCRT_Access(const wxChar *name, int WXUNUSED(how)) -{ - HANDLE fileHandle = ::CreateFile(name, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - - if (fileHandle == INVALID_HANDLE_VALUE) - return -1; - - CloseHandle(fileHandle); - - return 0; -} - -int wxCRT_Chmod(const wxChar *WXUNUSED(name), int WXUNUSED(how)) -{ - // TODO - return -1; -} - -int wxClose(int fd) -{ - if (CloseHandle((HANDLE)fd)) - return 0; - return -1; -} - -int wxEof(int fd) -{ - DWORD off0 = SetFilePointer((HANDLE) fd, 0, NULL, FILE_CURRENT); - if (off0 == 0xFFFFFFFF && GetLastError() != NO_ERROR) - return -1; - - DWORD off1 = SetFilePointer((HANDLE) fd, 0, NULL, FILE_END); - if (off1 == 0xFFFFFFFF && GetLastError() != NO_ERROR) - return -1; - - if (off0 == off1) - return 1; - else - { - SetFilePointer((HANDLE) fd, off0, NULL, FILE_BEGIN); - return 0; - } -} - -int wxRead(int fd, void *buf, unsigned int count) -{ - DWORD bytesRead = 0; - - if (ReadFile((HANDLE) fd, buf, (DWORD) count, &bytesRead, NULL)) - return bytesRead; - else - return -1; -} - -int wxWrite(int fd, const void *buf, unsigned int count) -{ - DWORD bytesWritten = 0; - - if (WriteFile((HANDLE) fd, buf, (DWORD) count, &bytesWritten, NULL)) - return bytesWritten; - else - return -1; -} - -__int64 wxSeek(int fd, __int64 offset, int origin) -{ - int method; - switch ( origin ) { - default: - wxFAIL_MSG(_("unknown seek origin")); - - case SEEK_SET: - method = FILE_BEGIN; - break; - - case SEEK_CUR: - method = FILE_CURRENT; - break; - - case SEEK_END: - method = FILE_END; - break; - } - - DWORD res = SetFilePointer((HANDLE) fd, offset, NULL, method) ; - if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR) - { - wxLogSysError(_("can't seek on file descriptor %d"), fd); - return wxInvalidOffset; - } - else - return (off_t)res; -} - -__int64 wxTell(int fd) -{ - // WinCE apparently doesn't support lpDistanceToMoveHigh. - // LONG high = 0; - DWORD res = SetFilePointer((HANDLE) fd, 0, NULL, FILE_CURRENT) ; - if (res == 0xFFFFFFFF && GetLastError() != NO_ERROR) - { - wxLogSysError(_("can't get seek position on file descriptor %d"), fd); - return wxInvalidOffset; - } - else - return res ; // + (((__int64)high) << 32); -} - -int wxFsync(int WXUNUSED(fd)) -{ - return 0; -} - -#endif //__WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/wince/helpwce.cpp b/Externals/wxWidgets3/src/msw/wince/helpwce.cpp deleted file mode 100644 index 2582360788..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/helpwce.cpp +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/helpwce.cpp -// Purpose: Help system: Windows CE help implementation -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_HELP - -#include "wx/filefn.h" -#include "wx/msw/wince/helpwce.h" - -#ifndef WX_PRECOMP - #include "wx/msw/missing.h" - #include "wx/intl.h" -#endif - -#include "wx/msw/private.h" - -IMPLEMENT_DYNAMIC_CLASS(wxWinceHelpController, wxHelpControllerBase) - -bool wxWinceHelpController::Initialize(const wxString& filename) -{ - m_helpFile = filename; - return true; -} - -bool wxWinceHelpController::LoadFile(const wxString& file) -{ - if (!file.empty()) - m_helpFile = file; - return true; -} - -bool wxWinceHelpController::DisplayContents() -{ - return ViewURL(); -} - -// Use topic -bool wxWinceHelpController::DisplaySection(const wxString& section) -{ - return ViewURL(section); -} - -// Use context number -bool wxWinceHelpController::DisplaySection(int WXUNUSED(section)) -{ - return true; -} - -bool wxWinceHelpController::DisplayContextPopup(int WXUNUSED(contextId)) -{ - return true; -} - -bool wxWinceHelpController::DisplayTextPopup(const wxString& WXUNUSED(text), const wxPoint& WXUNUSED(pos)) -{ - return true; -} - -bool wxWinceHelpController::DisplayBlock(long WXUNUSED(block)) -{ - return true; -} - -bool wxWinceHelpController::KeywordSearch(const wxString& WXUNUSED(k), - wxHelpSearchMode WXUNUSED(mode)) -{ - return true; -} - -bool wxWinceHelpController::Quit() -{ - return true; -} - -// Append extension if necessary. -wxString wxWinceHelpController::GetValidFilename(const wxString& file) const -{ - wxString path, name, ext; - wxFileName::SplitPath(file, & path, & name, & ext); - - wxString fullName; - if (path.empty()) - fullName = name + wxT(".htm"); - else if (path.Last() == wxT('\\')) - fullName = path + name + wxT(".htm"); - else - fullName = path + wxT("\\") + name + wxT(".htm"); - - if (!wxFileExists(fullName)) - fullName = wxT("\\Windows\\") + name + wxT(".htm"); - - return fullName; -} - -// View URL -bool wxWinceHelpController::ViewURL(const wxString& topic) -{ - if (m_helpFile.empty()) return false; - - wxString url( wxT("file:") + GetValidFilename(m_helpFile) ); - if (!topic.empty()) - url = url + wxT("#") + topic; - - return CreateProcess(wxT("peghelp.exe"), - url, NULL, NULL, FALSE, 0, NULL, - NULL, NULL, NULL) != 0 ; -} - -#endif // wxUSE_HELP diff --git a/Externals/wxWidgets3/src/msw/wince/menuce.cpp b/Externals/wxWidgets3/src/msw/wince/menuce.cpp deleted file mode 100644 index 9f8822d9bc..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/menuce.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/menuce.cpp -// Purpose: Smartphone menus implementation -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 28.05.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if defined(__SMARTPHONE__) && defined(__WXWINCE__) - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/toplevel.h" - #include "wx/menu.h" -#endif //WX_PRECOMP - -#include -#include -#include -#include -#include -#include -#include "wx/msw/wince/missing.h" - -#include "wx/msw/wince/resources.h" - -#include "wx/stockitem.h" - -wxTopLevelWindowMSW::ButtonMenu::ButtonMenu() -{ - m_id = wxID_ANY; - m_label = wxEmptyString; - m_menu = NULL; - m_assigned = false; -} - -wxTopLevelWindowMSW::ButtonMenu::~ButtonMenu() -{ - wxDELETE(m_menu); -} - -void wxTopLevelWindowMSW::SetLeftMenu(int id, const wxString& label, wxMenu *subMenu) -{ - m_LeftButton.SetButton(id, label, subMenu); - ReloadAllButtons(); -} - -void wxTopLevelWindowMSW::SetRightMenu(int id, const wxString& label, wxMenu *subMenu) -{ - m_RightButton.SetButton(id, label, subMenu); - ReloadAllButtons(); -} - -void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, wxMenu *subMenu) -{ - m_assigned = true; - m_id = id; - if(label.empty() && wxIsStockID(id)) - m_label = wxGetStockLabel(id, wxSTOCK_NOFLAGS); - else - m_label = label; - m_menu = subMenu; -} - -wxMenu *wxTopLevelWindowMSW::ButtonMenu::DuplicateMenu(wxMenu *menu) -{ - // This is required in case of converting wxMenuBar to wxMenu in wxFrame::SetMenuBar. - // All submenus has to be recreated because of new owner. - - wxMenu *duplication = new wxMenu; - - if (menu) - { - wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); - while (node) - { - wxMenuItem *item = node->GetData(); - if (item) - { - wxMenu *submenu = NULL; - - if(item->IsSubMenu()) - submenu = DuplicateMenu( item->GetSubMenu() ); - else - submenu = NULL; - - wxMenuItem *new_item = wxMenuItem::New(duplication, item->GetId(), item->GetLabel(), item->GetHelp(), item->GetKind(), submenu); - - if( item->IsCheckable() ) - new_item->Check(item->IsChecked()); - - new_item->Enable( item->IsEnabled() ); - - duplication->Append(new_item); - } - node = node->GetNext(); - } - - } - - return duplication; -} - -void wxMenuToHMenu(wxMenu* in, HMENU hMenu) -{ - if(!in) return; - - wxChar buf[256]; - - wxMenuItemList::compatibility_iterator node = in->GetMenuItems().GetFirst(); - while ( node ) - { - wxMenuItem *item = node->GetData(); - - UINT uFlags = 0; - UINT uIDNewItem; - LPCTSTR lpNewItem; - - if( item->IsSeparator() ) - { - uFlags |= MF_SEPARATOR; - uIDNewItem = (unsigned)wxID_ANY; - lpNewItem = NULL; - } - else - { - // label - uFlags |= MF_STRING; - wxStrcpy(buf, item->GetLabel().c_str()); - lpNewItem = buf; - - // state - uFlags |= ( item->IsEnabled() ? MF_ENABLED : MF_GRAYED ); - - // checked - uFlags |= ( item->IsChecked() ? MF_CHECKED : MF_UNCHECKED ); - - if( item->IsSubMenu() ) - { - uFlags |= MF_POPUP; - HMENU hSubMenu = CreatePopupMenu(); - wxMenuToHMenu(item->GetSubMenu(), hSubMenu); - uIDNewItem = (UINT) hSubMenu; - } - else - { - uIDNewItem = item->GetId(); - } - } - - AppendMenu(hMenu, uFlags, uIDNewItem, lpNewItem); - - node = node->GetNext(); - } -} - -void wxTopLevelWindowMSW::ReloadButton(ButtonMenu& button, UINT menuID) -{ - TBBUTTONINFO button_info; - wxChar buf[256]; - - // set button name - memset (&button_info, 0, sizeof (TBBUTTONINFO)); - button_info.cbSize = sizeof(TBBUTTONINFO); - button_info.dwMask = TBIF_TEXT | TBIF_STATE; - button_info.fsState = TBSTATE_ENABLED; - wxStrcpy(buf, button.GetLabel().c_str()); - button_info.pszText = buf; - ::SendMessage(m_MenuBarHWND, TB_SETBUTTONINFO, menuID, (LPARAM) &button_info); - - if(button.IsMenu()) - { - HMENU hPopupMenu = (HMENU) ::SendMessage(m_MenuBarHWND, SHCMBM_GETSUBMENU, 0, menuID); - RemoveMenu(hPopupMenu, 0, MF_BYPOSITION); - wxMenuToHMenu(button.GetMenu(), hPopupMenu); - } -} - -void wxTopLevelWindowMSW::ReloadAllButtons() -{ - // first reaload only after initialization of both buttons - // it should is done at the end of Create() of wxTLW - if(!m_LeftButton.IsAssigned() || !m_RightButton.IsAssigned()) - return; - - SHMENUBARINFO menu_bar; - wxString label; - - memset (&menu_bar, 0, sizeof (SHMENUBARINFO)); - menu_bar.cbSize = sizeof (SHMENUBARINFO); - menu_bar.hwndParent = (HWND) GetHWND(); - - if(m_LeftButton.IsMenu() && m_RightButton.IsMenu()) - menu_bar.nToolBarId = IDR_MENUBAR_BOTH_MENUS; - else if(m_LeftButton.IsMenu()) - menu_bar.nToolBarId = IDR_MENUBAR_LEFT_MENU; - else if(m_RightButton.IsMenu()) - menu_bar.nToolBarId = IDR_MENUBAR_RIGHT_MENU; - else - menu_bar.nToolBarId = IDR_MENUBAR_ONE_BUTTON; - - menu_bar.hInstRes = wxGetInstance(); - - if (!SHCreateMenuBar(&menu_bar)) - { - wxFAIL_MSG( wxT("SHCreateMenuBar failed") ); - return; - } - - HWND prev_MenuBar = m_MenuBarHWND; - m_MenuBarHWND = menu_bar.hwndMB; - - ReloadButton(m_LeftButton, IDM_LEFT); - ReloadButton(m_RightButton, IDM_RIGHT); - - // hide previous and show new menubar - if ( prev_MenuBar ) - ::ShowWindow( prev_MenuBar, SW_HIDE ); - ::ShowWindow( m_MenuBarHWND, SW_SHOW ); - - // Setup backspace key handling - SendMessage(m_MenuBarHWND, SHCMBM_OVERRIDEKEY, VK_TBACK, - MAKELPARAM( SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - SHMBOF_NODEFAULT | SHMBOF_NOTIFY )); -} - -bool wxTopLevelWindowMSW::HandleCommand(WXWORD id, WXWORD WXUNUSED(cmd), WXHWND WXUNUSED(control)) -{ - // handle here commands from Smartphone menu bar - if ( id == IDM_LEFT || id == IDM_RIGHT ) - { - int menuId = id == IDM_LEFT ? m_LeftButton.GetId() : m_RightButton.GetId() ; - wxCommandEvent commandEvent(wxEVT_MENU, menuId); - commandEvent.SetEventObject(this); - GetEventHandler()->ProcessEvent(commandEvent); - return true; - } - return false; -} - -bool wxTopLevelWindowMSW::MSWShouldPreProcessMessage(WXMSG* pMsg) -{ - MSG *msg = (MSG *)pMsg; - - // Process back key to be like backspace. - if (msg->message == WM_HOTKEY) - { - if (HIWORD(msg->lParam) == VK_TBACK) - SHSendBackToFocusWindow(msg->message, msg->wParam, msg->lParam); - } - - return wxTopLevelWindowBase::MSWShouldPreProcessMessage(pMsg); -} - -#endif // __SMARTPHONE__ && __WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/wince/net.cpp b/Externals/wxWidgets3/src/msw/wince/net.cpp deleted file mode 100644 index 98110369e6..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/net.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/net.cpp -// Purpose: -// Author: -// Modified by: -// Created: -// Copyright: Copyright 1998, Ben Goetter. All rights reserved. -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -/* - patch holes in winsock - - WCE 2.0 lacks many of the 'database' winsock routines. - Stub just enough them for ss.dll. - - getprotobynumber - getservbyport - getservbyname - -*/ - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/msw/wrapwin.h" -#endif - -#include -#include -#include -#include "wx/msw/wince/net.h" - - -#define CCH_MAX_PROTO 4 - -static struct protoent RgProtoEnt[] = -{ - { "tcp", {NULL}, 6 }, - { "udp", {NULL}, 17 }, - { "icmp", {NULL}, 1 }, - { "ip", {NULL}, 0 }, - { NULL, {NULL}, 0 } -}; - - -#define CCH_MAX_SERV 8 - -// Ordered by most likely to be requested. -// Assumes that a service available on different protocols -// will use the same port number on each protocol. -// Should that be no longer the case, -// remove the fFoundOnce code from getservbyXxx fcns. - -// This table keeps port numbers in host byte order. - -static struct servent RgServEnt[] = -{ - { "ftp", {NULL}, 21, "tcp" }, - { "ftp-data", {NULL}, 20, "tcp" }, - { "telnet", {NULL}, 23, "tcp" }, - { "smtp", {NULL}, 25, "tcp" }, - { "http", {NULL}, 80, "tcp" }, - { "http", {NULL}, 80, "udp" }, - { "pop", {NULL}, 109, "tcp" }, - { "pop2", {NULL}, 109, "tcp" }, - { "pop3", {NULL}, 110, "tcp" }, - { "nntp", {NULL}, 119, "tcp" }, - { "finger", {NULL}, 79, "tcp" }, - /* include most of the simple TCP services for testing */ - { "echo", {NULL}, 7, "tcp" }, - { "echo", {NULL}, 7, "udp" }, - { "discard", {NULL}, 9, "tcp" }, - { "discard", {NULL}, 9, "udp" }, - { "chargen", {NULL}, 19, "tcp" }, - { "chargen", {NULL}, 19, "udp" }, - { "systat", {NULL}, 11, "tcp" }, - { "systat", {NULL}, 11, "udp" }, - { "daytime", {NULL}, 13, "tcp" }, - { "daytime", {NULL}, 13, "udp" }, - { "netstat", {NULL}, 15, "tcp" }, - { "qotd", {NULL}, 17, "tcp" }, - { "qotd", {NULL}, 17, "udp" }, - { NULL, {NULL}, 0, NULL } -}; - -// Since table kept in host byte order, -// return this element to callers - -static struct servent ServEntReturn = {0}; - -// Because CE doesn't have _stricmp - that's why. - -static void strcpyLC(char* szDst, const char* szSrc, int cch) -{ - int i; - char ch; - for (i = 0, ch = szSrc[i]; i < cch && ch != 0; ch = szSrc[++i]) - { - szDst[i] = (ch >= 'A' && ch <= 'Z') ? (ch + ('a'-'A')) : ch; - } szDst[i] = 0; -} - - -struct servent * WINSOCKAPI getservbyport(int port, const char * proto) -{ - - port = ntohs((unsigned short)port); // arrives in network byte order - struct servent *ps = &RgServEnt[0]; - BOOL fFoundOnce = FALSE; // flag to short-circuit search through rest of db - - // Make a lowercase version for comparison - // truncate to 1 char longer than any value in table - char szProtoLC[CCH_MAX_PROTO+2]; - if (NULL != proto) - strcpyLC(szProtoLC, proto, CCH_MAX_PROTO+1); - - while (NULL != ps->s_name) - { - if (port == ps->s_port) - { - fFoundOnce = TRUE; - if (NULL == proto || !strcmp(szProtoLC, ps->s_proto)) - { - ServEntReturn = *ps; - ServEntReturn.s_port = htons(ps->s_port); - return &ServEntReturn; - } - } - else if (fFoundOnce) - break; - ++ps; - } return NULL; -} - - -struct servent * WINSOCKAPI getservbyname(const char * name, - const char * proto) -{ - struct servent *ps = &RgServEnt[0]; - BOOL fFoundOnce = FALSE; // flag to short-circuit search through rest of db - - // Make lowercase versions for comparisons - // truncate to 1 char longer than any value in table - char szNameLC[CCH_MAX_SERV+2]; - strcpyLC(szNameLC, name, CCH_MAX_SERV+1); - char szProtoLC[CCH_MAX_PROTO+2]; - if (NULL != proto) - strcpyLC(szProtoLC, proto, CCH_MAX_PROTO+1); - - while (NULL != ps->s_name) - { - if (!strcmp(szNameLC, ps->s_name)) - { - fFoundOnce = TRUE; - if (NULL == proto || !strcmp(szProtoLC, ps->s_proto)) - { - ServEntReturn = *ps; - ServEntReturn.s_port = htons(ps->s_port); - return &ServEntReturn; - } - } - else if (fFoundOnce) - break; - ++ps; - } return NULL; -} - - -struct protoent * WINSOCKAPI getprotobynumber(int proto) -{ - struct protoent *pr = &RgProtoEnt[0]; - while (NULL != pr->p_name) - { - if (proto == pr->p_proto) - return pr; - ++pr; - } return NULL; -} diff --git a/Externals/wxWidgets3/src/msw/wince/tbarwce.cpp b/Externals/wxWidgets3/src/msw/wince/tbarwce.cpp deleted file mode 100644 index bb0f99f380..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/tbarwce.cpp +++ /dev/null @@ -1,652 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/tbarwce.cpp -// Purpose: wxToolBar for Windows CE -// Author: Julian Smart -// Modified by: -// Created: 2003-07-12 -// 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 - -// Use the WinCE-specific toolbar only if we're either compiling -// with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI -#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) - -#include "wx/toolbar.h" - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" // include "properly" - #include "wx/dynarray.h" - #include "wx/frame.h" - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/settings.h" - #include "wx/bitmap.h" - #include "wx/dcmemory.h" - #include "wx/control.h" -#endif - -#if !defined(__GNUWIN32__) - #include "malloc.h" -#endif - -#include "wx/msw/private.h" -#include -#include -#include -#include -#include -#if defined(WINCE_WITHOUT_COMMANDBAR) - #include - #include "wx/msw/wince/resources.h" -#endif -#include "wx/msw/wince/missing.h" - -#include "wx/msw/winundef.h" - -#if !defined(__SMARTPHONE__) - -///////////// This implementation is for PocketPC. -///////////// See later for the Smartphone dummy toolbar class. - -// ---------------------------------------------------------------------------- -// Event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxToolMenuBar, wxToolBar) - -BEGIN_EVENT_TABLE(wxToolMenuBar, wxToolBar) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -class wxToolMenuBarTool : public wxToolBarToolBase -{ -public: - wxToolMenuBarTool(wxToolBar *tbar, - int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) - : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp) - { - m_nSepCount = 0; - m_bitmapIndex = -1; - } - - wxToolMenuBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) - : wxToolBarToolBase(tbar, control, label) - { - m_nSepCount = 1; - m_bitmapIndex = -1; - } - - virtual void SetLabel(const wxString& label) - { - if ( label == m_label ) - return; - - wxToolBarToolBase::SetLabel(label); - - // we need to update the label shown in the toolbar because it has a - // pointer to the internal buffer of the old label - // - // TODO: use TB_SETBUTTONINFO - } - - // set/get the number of separators which we use to cover the space used by - // a control in the toolbar - void SetSeparatorsCount(size_t count) { m_nSepCount = count; } - size_t GetSeparatorsCount() const { return m_nSepCount; } - - void SetBitmapIndex(int idx) { m_bitmapIndex = idx; } - int GetBitmapIndex() const { return m_bitmapIndex; } - -private: - size_t m_nSepCount; - int m_bitmapIndex; -}; - - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxToolBarTool -// ---------------------------------------------------------------------------- - -wxToolBarToolBase *wxToolMenuBar::CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) -{ - return new wxToolMenuBarTool(this, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp); -} - -wxToolBarToolBase * -wxToolMenuBar::CreateTool(wxControl *control, const wxString& label) -{ - return new wxToolMenuBarTool(this, control, label); -} - -// ---------------------------------------------------------------------------- -// wxToolBar construction -// ---------------------------------------------------------------------------- - -void wxToolMenuBar::Init() -{ - wxToolBar::Init(); - - m_nButtons = 0; - m_menuBar = NULL; -} - -bool wxToolMenuBar::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name, - wxMenuBar* menuBar) -{ - // common initialisation - if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) - return false; - - // MSW-specific initialisation - if ( !MSWCreateToolbar(pos, size, menuBar) ) - return false; - - // set up the colors and fonts - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); - SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - - return true; -} - -bool wxToolMenuBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(size), - wxMenuBar *menuBar) -{ - SetMenuBar(menuBar); - if (m_menuBar) - m_menuBar->SetToolBar(this); - - HWND hwndParent = GetHwndOf(GetParent()); - wxCHECK_MSG( hwndParent, false, wxT("should have valid parent HWND") ); - -#if defined(WINCE_WITHOUT_COMMANDBAR) - // create the menubar. - WinStruct mbi; - - mbi.hwndParent = hwndParent; - mbi.nToolBarId = wxIDM_SHMENU; - mbi.hInstRes = wxGetInstance(); - - if ( !SHCreateMenuBar(&mbi) ) - { - wxFAIL_MSG( wxT("SHCreateMenuBar failed") ); - return false; - } - - SetHWND((WXHWND) mbi.hwndMB); -#else - HWND hWnd = CommandBar_Create(wxGetInstance(), hwndParent, GetId()); - SetHWND((WXHWND) hWnd); -#endif - - // install wxWidgets window proc for this window - SubclassWin(m_hWnd); - - if (menuBar) - menuBar->Create(); - - return true; -} - -void wxToolMenuBar::Recreate() -{ - // TODO -} - -wxToolMenuBar::~wxToolMenuBar() -{ - if (GetMenuBar()) - GetMenuBar()->SetToolBar(NULL); -} - -// Return HMENU for the menu associated with the commandbar -WXHMENU wxToolMenuBar::GetHMenu() -{ -#if !defined(__HANDHELDPC__) - if (GetHWND()) - { - return (WXHMENU)::SendMessage(GetHwnd(), SHCMBM_GETMENU, 0, 0); - } -#endif - - return NULL; -} - -// ---------------------------------------------------------------------------- -// adding/removing tools -// ---------------------------------------------------------------------------- - -bool wxToolMenuBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) -{ - // nothing special to do here - we really create the toolbar buttons in - // Realize() later - tool->Attach(this); - - return true; -} - -bool wxToolMenuBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) -{ - // Skip over the menus - if (GetMenuBar()) - pos += GetMenuBar()->GetMenuCount(); - - // the main difficulty we have here is with the controls in the toolbars: - // as we (sometimes) use several separators to cover up the space used by - // them, the indices are not the same for us and the toolbar - - // first determine the position of the first button to delete: it may be - // different from pos if we use several separators to cover the space used - // by a control - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - wxToolBarToolBase *tool2 = node->GetData(); - if ( tool2 == tool ) - { - // let node point to the next node in the list - node = node->GetNext(); - - break; - } - - if ( tool2->IsControl() ) - { - pos += ((wxToolMenuBarTool *)tool2)->GetSeparatorsCount() - 1; - } - } - - // now determine the number of buttons to delete and the area taken by them - size_t nButtonsToDelete = 1; - - // get the size of the button we're going to delete - RECT r; - if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, pos, (LPARAM)&r) ) - { - wxLogLastError(wxT("TB_GETITEMRECT")); - } - - int width = r.right - r.left; - - if ( tool->IsControl() ) - { - nButtonsToDelete = ((wxToolMenuBarTool *)tool)->GetSeparatorsCount(); - - width *= nButtonsToDelete; - } - - // do delete all buttons - m_nButtons -= nButtonsToDelete; - while ( nButtonsToDelete-- > 0 ) - { - if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) - { - wxLogLastError(wxT("TB_DELETEBUTTON")); - - return false; - } - } - - tool->Detach(); - - // and finally reposition all the controls after this button (the toolbar - // takes care of all normal items) - for ( /* node -> first after deleted */ ; node; node = node->GetNext() ) - { - wxToolBarToolBase *tool2 = node->GetData(); - if ( tool2->IsControl() ) - { - int x; - wxControl *control = tool2->GetControl(); - control->GetPosition(&x, NULL); - control->Move(x - width, wxDefaultCoord); - } - } - - return true; -} - -bool wxToolMenuBar::Realize() -{ - const size_t nTools = GetToolsCount(); - if ( nTools == 0 ) - { - // nothing to do - return true; - } - -#if 0 - // delete all old buttons, if any - for ( size_t pos = 0; pos < m_nButtons; pos++ ) - { - if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) - { - wxLogDebug(wxT("TB_DELETEBUTTON failed")); - } - } -#endif // 0 - - bool lastWasRadio = false; - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - wxToolMenuBarTool *tool = (wxToolMenuBarTool*) node->GetData(); - - TBBUTTON buttons[1] ; - - TBBUTTON& button = buttons[0]; - - wxZeroMemory(button); - - bool isRadio = false; - switch ( tool->GetStyle() ) - { - case wxTOOL_STYLE_CONTROL: - button.idCommand = tool->GetId(); - // fall through: create just a separator too - // TODO: controls are not yet supported on wxToolMenuBar. - - case wxTOOL_STYLE_SEPARATOR: - button.fsState = TBSTATE_ENABLED; - button.fsStyle = TBSTYLE_SEP; - break; - - case wxTOOL_STYLE_BUTTON: - - if ( HasFlag(wxTB_TEXT) ) - { - const wxString& label = tool->GetLabel(); - if ( !label.empty() ) - { - button.iString = (int) wxMSW_CONV_LPCTSTR(label); - } - } - - const wxBitmap& bmp = tool->GetNormalBitmap(); - - wxBitmap bmpToUse = bmp; - - if (bmp.GetWidth() < 16 || bmp.GetHeight() < 16 || bmp.GetMask() != NULL) - { - wxMemoryDC memDC; - wxBitmap b(16,16); - memDC.SelectObject(b); - wxColour col = wxColour(192,192,192); - memDC.SetBackground(wxBrush(col)); - memDC.Clear(); - int x = (16 - bmp.GetWidth())/2; - int y = (16 - bmp.GetHeight())/2; - memDC.DrawBitmap(bmp, x, y, true); - memDC.SelectObject(wxNullBitmap); - - bmpToUse = b; - tool->SetNormalBitmap(b); - } - - int n = 0; - if ( bmpToUse.IsOk() ) - { - n = ::CommandBar_AddBitmap( (HWND) GetHWND(), NULL, (int) (HBITMAP) bmpToUse.GetHBITMAP(), - 1, 16, 16 ); - } - - button.idCommand = tool->GetId(); - button.iBitmap = n; - - if ( tool->IsEnabled() ) - button.fsState |= TBSTATE_ENABLED; - if ( tool->IsToggled() ) - button.fsState |= TBSTATE_CHECKED; - - switch ( tool->GetKind() ) - { - case wxITEM_RADIO: - button.fsStyle = TBSTYLE_CHECKGROUP; - - if ( !lastWasRadio ) - { - // the first item in the radio group is checked by - // default to be consistent with wxGTK and the menu - // radio items - button.fsState |= TBSTATE_CHECKED; - - tool->Toggle(true); - } - - isRadio = true; - break; - - case wxITEM_CHECK: - button.fsStyle = TBSTYLE_CHECK; - break; - - default: - wxFAIL_MSG( wxT("unexpected toolbar button kind") ); - // fall through - - case wxITEM_NORMAL: - button.fsStyle = TBSTYLE_BUTTON; - } - break; - } - - if ( !::CommandBar_AddButtons( (HWND) GetHWND(), 1, buttons ) ) - { - wxFAIL_MSG( wxT("Could not add toolbar button.")); - } - - lastWasRadio = isRadio; - } - - return true; -} - -bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) -{ - const int id = (signed short)id_; - - wxToolBarToolBase *tool = FindById(id); - if ( !tool ) - { - bool checked = false; - if ( m_menuBar ) - { - wxMenuItem *item = m_menuBar->FindItem(id); - if ( item && item->IsCheckable() ) - { - item->Toggle(); - checked = item->IsChecked(); - } - } - - wxCommandEvent event(wxEVT_MENU); - event.SetEventObject(this); - event.SetId(id); - event.SetInt(checked); - - return GetEventHandler()->ProcessEvent(event); - } - - if ( tool->CanBeToggled() ) - { - LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0); - tool->Toggle((state & TBSTATE_CHECKED) != 0); - } - - bool toggled = tool->IsToggled(); - - // avoid sending the event when a radio button is released, this is not - // interesting - if ( !tool->CanBeToggled() || tool->GetKind() != wxITEM_RADIO || toggled ) - { - // OnLeftClick() can veto the button state change - for buttons which - // may be toggled only, of course. - if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() ) - { - // revert back - toggled = !toggled; - tool->SetToggle(toggled); - - ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0)); - } - } - - return true; -} - -WXLRESULT wxToolMenuBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - switch ( nMsg ) - { - case WM_SIZE: - break; - - case WM_MOUSEMOVE: - // we don't handle mouse moves, so always pass the message to - // wxControl::MSWWindowProc - HandleMouseMove(wParam, lParam); - break; - - case WM_PAINT: - break; - } - - return MSWDefWindowProc(nMsg, wParam, lParam); -} - - -#else - -////////////// For Smartphone - -// ---------------------------------------------------------------------------- -// Event table -// ---------------------------------------------------------------------------- - -IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase) - -BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) -END_EVENT_TABLE() - -wxToolBarToolBase *wxToolBar::CreateTool(int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) -{ - return new wxToolBarToolBase(this, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp); -} - -wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control) -{ - return new wxToolBarToolBase(this, control); -} - -bool wxToolBar::Create(wxWindow *parent, - wxWindowID WXUNUSED(id), - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(size), - long style, - const wxString& name) -{ - // TODO: we may need to make this a dummy hidden window to - // satisfy other parts of wxWidgets. - - parent->AddChild(this); - - SetWindowStyle(style); - SetName(name); - - return true; -} - -// ---------------------------------------------------------------------------- -// adding/removing tools -// ---------------------------------------------------------------------------- - -bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) -{ - tool->Attach(this); - return true; -} - -bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) -{ - tool->Detach(); - return true; -} - -wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const -{ - return NULL; -} - -// ---------------------------------------------------------------------------- -// tool state -// ---------------------------------------------------------------------------- - -void wxToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(enable)) -{ -} - -void wxToolBar::DoToggleTool(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) -{ -} - -void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) -{ - wxFAIL_MSG( wxT("not implemented") ); -} - -#endif - // !__SMARTPHONE__ - -#endif // wxUSE_TOOLBAR diff --git a/Externals/wxWidgets3/src/msw/wince/textctrlce.cpp b/Externals/wxWidgets3/src/msw/wince/textctrlce.cpp deleted file mode 100644 index d1b487be04..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/textctrlce.cpp +++ /dev/null @@ -1,1207 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/textctrlce.cpp -// Purpose: wxTextCtrl implementation for smart phones driven by WinCE -// Author: Wlodzimierz ABX Skiba -// Modified by: -// Created: 30.08.2004 -// Copyright: (c) Wlodzimierz Skiba -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_TEXTCTRL && defined(__SMARTPHONE__) && defined(__WXWINCE__) - -#include "wx/textctrl.h" - -#ifndef WX_PRECOMP - #include "wx/msw/wrapcctl.h" // include "properly" -#endif - -#include "wx/spinbutt.h" -#include "wx/textfile.h" - -#define GetBuddyHwnd() (HWND)(m_hwndBuddy) - -#define IsVertical(wxStyle) (true) - -// ---------------------------------------------------------------------------- -// event tables and other macros -// ---------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) - EVT_CHAR(wxTextCtrl::OnChar) - - EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) - EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy) - EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste) - EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo) - EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo) - EVT_MENU(wxID_CLEAR, wxTextCtrl::OnDelete) - EVT_MENU(wxID_SELECTALL, wxTextCtrl::OnSelectAll) - - EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut) - EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy) - EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste) - EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo) - EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) - EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete) - EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll) - - EVT_SET_FOCUS(wxTextCtrl::OnSetFocus) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the up-down control and its buddy (can be arbitrary, -// choose what you like - or may be decide during run-time depending on the -// font size?) -static const int MARGIN_BETWEEN = 0; - -// ============================================================================ -// implementation -// ============================================================================ - -wxArrayTextSpins wxTextCtrl::ms_allTextSpins; - -// ---------------------------------------------------------------------------- -// wnd proc for the buddy text ctrl -// ---------------------------------------------------------------------------- - -LRESULT APIENTRY _EXPORT wxBuddyTextCtrlWndProc(HWND hwnd, - UINT message, - WPARAM wParam, - LPARAM lParam) -{ - wxTextCtrl *spin = (wxTextCtrl *)wxGetWindowUserData(hwnd); - - // forward some messages (the key and focus ones only so far) to - // the spin ctrl - switch ( message ) - { - case WM_SETFOCUS: - // if the focus comes from the spin control itself, don't set it - // back to it -- we don't want to go into an infinite loop - if ( (WXHWND)wParam == spin->GetHWND() ) - break; - //else: fall through - - case WM_KILLFOCUS: - case WM_CHAR: - case WM_DEADCHAR: - case WM_KEYUP: - case WM_KEYDOWN: - spin->MSWWindowProc(message, wParam, lParam); - - // The control may have been deleted at this point, so check. - if ( !::IsWindow(hwnd) || wxGetWindowUserData(hwnd) != spin ) - return 0; - break; - - case WM_GETDLGCODE: - // we want to get WXK_RETURN in order to generate the event for it - return DLGC_WANTCHARS; - } - - return ::CallWindowProc(CASTWNDPROC spin->GetBuddyWndProc(), - hwnd, message, wParam, lParam); -} - -// ---------------------------------------------------------------------------- -// creation -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Init() -{ - m_suppressNextUpdate = false; - m_isNativeCaretShown = true; -} - -wxTextCtrl::~wxTextCtrl() -{ -} - -bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT ) - style |= wxBORDER_SIMPLE; - - SetWindowStyle(style); - - WXDWORD exStyle = 0; - WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ; - - wxSize sizeText(size), sizeBtn(size); - sizeBtn.x = GetBestSpinnerSize(IsVertical(style)).x / 2; - - if ( sizeText.x == wxDefaultCoord ) - { - // DEFAULT_ITEM_WIDTH is the default width for the text control - sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x; - } - - sizeText.x -= sizeBtn.x + MARGIN_BETWEEN; - if ( sizeText.x <= 0 ) - { - wxLogDebug(wxT("not enough space for wxSpinCtrl!")); - } - - wxPoint posBtn(pos); - posBtn.x += sizeText.x + MARGIN_BETWEEN; - - // we need to turn '\n's into "\r\n"s for the multiline controls - wxString valueWin; - if ( m_windowStyle & wxTE_MULTILINE ) - { - valueWin = wxTextFile::Translate(value, wxTextFileType_Dos); - } - else // single line - { - valueWin = value; - } - - // we must create the list control before the spin button for the purpose - // of the dialog navigation: if there is a static text just before the spin - // control, activating it by Alt-letter should give focus to the text - // control, not the spin and the dialog navigation code will give focus to - // the next control (at Windows level), not the one after it - - // create the text window - - m_hwndBuddy = (WXHWND)::CreateWindowEx - ( - exStyle, // sunken border - wxT("EDIT"), // window class - valueWin, // no window title - msStyle, // style (will be shown later) - pos.x, pos.y, // position - 0, 0, // size (will be set later) - GetHwndOf(parent), // parent - (HMENU)-1, // control id - wxGetInstance(), // app instance - NULL // unused client data - ); - - if ( !m_hwndBuddy ) - { - wxLogLastError(wxT("CreateWindow(buddy text window)")); - - return false; - } - - // initialize wxControl - if ( !CreateControl(parent, id, posBtn, sizeBtn, style, validator, name) ) - return false; - - // now create the real HWND - WXDWORD spiner_style = WS_VISIBLE | - UDS_ALIGNRIGHT | - UDS_EXPANDABLE | - UDS_NOSCROLL; - - if ( !IsVertical(style) ) - spiner_style |= UDS_HORZ; - - if ( style & wxSP_WRAP ) - spiner_style |= UDS_WRAP; - - if ( !MSWCreateControl(UPDOWN_CLASS, spiner_style, posBtn, sizeBtn, wxT(""), 0) ) - return false; - - // subclass the text ctrl to be able to intercept some events - wxSetWindowUserData(GetBuddyHwnd(), this); - m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), - wxBuddyTextCtrlWndProc); - - // set up fonts and colours (This is nomally done in MSWCreateControl) - InheritAttributes(); - if (!m_hasFont) - SetFont(GetDefaultAttributes().font); - - // set the size of the text window - can do it only now, because we - // couldn't call DoGetBestSize() before as font wasn't set - if ( sizeText.y <= 0 ) - { - int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); - - sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); - } - - SetInitialSize(size); - - (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); - - // associate the list window with the spin button - (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0); - - // do it after finishing with m_hwndBuddy creation to avoid generating - // initial wxEVT_TEXT message - ms_allTextSpins.Add(this); - - return true; -} - -// Make sure the window style (etc.) reflects the HWND style (roughly) -void wxTextCtrl::AdoptAttributesFromHWND() -{ - wxWindow::AdoptAttributesFromHWND(); - - long style = ::GetWindowLong(GetBuddyHwnd(), GWL_STYLE); - - if (style & ES_MULTILINE) - m_windowStyle |= wxTE_MULTILINE; - if (style & ES_PASSWORD) - m_windowStyle |= wxTE_PASSWORD; - if (style & ES_READONLY) - m_windowStyle |= wxTE_READONLY; - if (style & ES_WANTRETURN) - m_windowStyle |= wxTE_PROCESS_ENTER; - if (style & ES_CENTER) - m_windowStyle |= wxTE_CENTRE; - if (style & ES_RIGHT) - m_windowStyle |= wxTE_RIGHT; -} - -WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - // we never have an external border - WXDWORD msStyle = wxControl::MSWGetStyle - ( - (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle - ); - - msStyle |= WS_VISIBLE; - - // styles which we alaways add by default - if ( style & wxTE_MULTILINE ) - { - wxASSERT_MSG( !(style & wxTE_PROCESS_ENTER), - wxT("wxTE_PROCESS_ENTER style is ignored for multiline text controls (they always process it)") ); - - msStyle |= ES_MULTILINE | ES_WANTRETURN; - if ( !(style & wxTE_NO_VSCROLL) ) - { - // always adjust the vertical scrollbar automatically if we have it - msStyle |= WS_VSCROLL | ES_AUTOVSCROLL; - } - - style |= wxTE_PROCESS_ENTER; - } - else // !multiline - { - // there is really no reason to not have this style for single line - // text controls - msStyle |= ES_AUTOHSCROLL; - } - - // note that wxTE_DONTWRAP is the same as wxHSCROLL so if we have a horz - // scrollbar, there is no wrapping -- which makes sense - if ( style & wxTE_DONTWRAP ) - { - // automatically scroll the control horizontally as necessary - // - // NB: ES_AUTOHSCROLL is needed for richedit controls or they don't - // show horz scrollbar at all, even in spite of WS_HSCROLL, and as - // it doesn't seem to do any harm for plain edit controls, add it - // always - msStyle |= WS_HSCROLL | ES_AUTOHSCROLL; - } - - if ( style & wxTE_READONLY ) - msStyle |= ES_READONLY; - - if ( style & wxTE_PASSWORD ) - msStyle |= ES_PASSWORD; - - if ( style & wxTE_NOHIDESEL ) - msStyle |= ES_NOHIDESEL; - - // note that we can't do do "& wxTE_LEFT" as wxTE_LEFT == 0 - if ( style & wxTE_CENTRE ) - msStyle |= ES_CENTER; - else if ( style & wxTE_RIGHT ) - msStyle |= ES_RIGHT; - else - msStyle |= ES_LEFT; // ES_LEFT is 0 as well but for consistency... - - return msStyle; -} - -// ---------------------------------------------------------------------------- -// set/get the controls text -// ---------------------------------------------------------------------------- - -wxString wxTextCtrl::GetValue() const -{ - // range 0..-1 is special for GetRange() and means to retrieve all text - return GetRange(0, -1); -} - -wxString wxTextCtrl::GetRange(long from, long to) const -{ - wxString str; - - if ( from >= to && to != -1 ) - { - // nothing to retrieve - return str; - } - - // retrieve all text - str = wxGetWindowText(GetBuddyHwnd()); - - // need only a range? - if ( from < to ) - { - str = str.Mid(from, to - from); - } - - // WM_GETTEXT uses standard DOS CR+LF (\r\n) convention - convert to the - // canonical one (same one as above) for consistency with the other kinds - // of controls and, more importantly, with the other ports - str = wxTextFile::Translate(str, wxTextFileType_Unix); - - return str; -} - -void wxTextCtrl::DoSetValue(const wxString& value, int flags) -{ - // if the text is long enough, it's faster to just set it instead of first - // comparing it with the old one (chances are that it will be different - // anyhow, this comparison is there to avoid flicker for small single-line - // edit controls mostly) - if ( (value.length() > 0x400) || (value != GetValue()) ) - { - DoWriteText(value, flags); - - // for compatibility, don't move the cursor when doing SetValue() - SetInsertionPoint(0); - } - else // same text - { - // still send an event for consistency - if ( flags & SetValue_SendEvent ) - SendUpdateEvent(); - } - - // we should reset the modified flag even if the value didn't really change - - // mark the control as being not dirty - we changed its text, not the - // user - DiscardEdits(); -} - -void wxTextCtrl::WriteText(const wxString& value) -{ - DoWriteText(value); -} - -void wxTextCtrl::DoWriteText(const wxString& value, int flags) -{ - bool selectionOnly = (flags & SetValue_SelectionOnly) != 0; - wxString valueDos; - if ( m_windowStyle & wxTE_MULTILINE ) - valueDos = wxTextFile::Translate(value, wxTextFileType_Dos); - else - valueDos = value; - - // in some cases we get 2 EN_CHANGE notifications after the SendMessage - // call below which is confusing for the client code and so should be - // avoided - // - if ( selectionOnly && HasSelection() ) - { - m_suppressNextUpdate = true; - } - - ::SendMessage(GetBuddyHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT, - 0, (LPARAM)valueDos.c_str()); - - if ( !selectionOnly && !( flags & SetValue_SendEvent ) ) - { - // Windows already sends an update event for single-line - // controls. - if ( m_windowStyle & wxTE_MULTILINE ) - SendUpdateEvent(); - } - - AdjustSpaceLimit(); -} - -void wxTextCtrl::AppendText(const wxString& text) -{ - SetInsertionPointEnd(); - - WriteText(text); -} - -void wxTextCtrl::Clear() -{ - ::SetWindowText(GetBuddyHwnd(), wxEmptyString); - - // Windows already sends an update event for single-line - // controls. - if ( m_windowStyle & wxTE_MULTILINE ) - SendUpdateEvent(); -} - -// ---------------------------------------------------------------------------- -// Clipboard operations -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Copy() -{ - if (CanCopy()) - { - ::SendMessage(GetBuddyHwnd(), WM_COPY, 0, 0L); - } -} - -void wxTextCtrl::Cut() -{ - if (CanCut()) - { - ::SendMessage(GetBuddyHwnd(), WM_CUT, 0, 0L); - } -} - -void wxTextCtrl::Paste() -{ - if (CanPaste()) - { - ::SendMessage(GetBuddyHwnd(), WM_PASTE, 0, 0L); - } -} - -bool wxTextCtrl::HasSelection() const -{ - long from, to; - GetSelection(&from, &to); - return from != to; -} - -bool wxTextCtrl::CanCopy() const -{ - // Can copy if there's a selection - return HasSelection(); -} - -bool wxTextCtrl::CanCut() const -{ - return CanCopy() && IsEditable(); -} - -bool wxTextCtrl::CanPaste() const -{ - if ( !IsEditable() ) - return false; - - // Standard edit control: check for straight text on clipboard - if ( !::OpenClipboard(GetHwndOf(wxTheApp->GetTopWindow())) ) - return false; - - bool isTextAvailable = ::IsClipboardFormatAvailable(CF_TEXT) != 0; - ::CloseClipboard(); - - return isTextAvailable; -} - -// ---------------------------------------------------------------------------- -// Accessors -// ---------------------------------------------------------------------------- - -void wxTextCtrl::SetEditable(bool editable) -{ - ::SendMessage(GetBuddyHwnd(), EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L); -} - -void wxTextCtrl::SetInsertionPoint(long pos) -{ - DoSetSelection(pos, pos); -} - -void wxTextCtrl::SetInsertionPointEnd() -{ - if ( GetInsertionPoint() != GetLastPosition() ) - SetInsertionPoint(GetLastPosition()); -} - -long wxTextCtrl::GetInsertionPoint() const -{ - DWORD Pos = (DWORD)::SendMessage(GetBuddyHwnd(), EM_GETSEL, 0, 0L); - return Pos & 0xFFFF; -} - -wxTextPos wxTextCtrl::GetLastPosition() const -{ - int numLines = GetNumberOfLines(); - long posStartLastLine = XYToPosition(0, numLines - 1); - - long lenLastLine = GetLengthOfLineContainingPos(posStartLastLine); - - return posStartLastLine + lenLastLine; -} - -void wxTextCtrl::GetSelection(long* from, long* to) const -{ - DWORD dwStart, dwEnd; - ::SendMessage(GetBuddyHwnd(), EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd); - - *from = dwStart; - *to = dwEnd; -} - -bool wxTextCtrl::IsEditable() const -{ - if ( !GetBuddyHwnd() ) - return true; - - long style = ::GetWindowLong(GetBuddyHwnd(), GWL_STYLE); - - return (style & ES_READONLY) == 0; -} - -// ---------------------------------------------------------------------------- -// selection -// ---------------------------------------------------------------------------- - -void wxTextCtrl::SetSelection(long from, long to) -{ - // if from and to are both -1, it means (in wxWidgets) that all text should - // be selected - translate into Windows convention - if ( (from == -1) && (to == -1) ) - { - from = 0; - to = -1; - } - - DoSetSelection(from, to); -} - -void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret) -{ - ::SendMessage(GetBuddyHwnd(), EM_SETSEL, (WPARAM)from, (LPARAM)to); - - if ( scrollCaret ) - { - ::SendMessage(GetBuddyHwnd(), EM_SCROLLCARET, (WPARAM)0, (LPARAM)0); - } -} - -// ---------------------------------------------------------------------------- -// Working with files -// ---------------------------------------------------------------------------- - -bool wxTextCtrl::LoadFile(const wxString& file) -{ - if ( wxTextCtrlBase::LoadFile(file) ) - { - // update the size limit if needed - AdjustSpaceLimit(); - - return true; - } - - return false; -} - -// ---------------------------------------------------------------------------- -// Editing -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Replace(long from, long to, const wxString& value) -{ - // Set selection and remove it - DoSetSelection(from, to, false); - - DoWriteText(value, SetValue_SelectionOnly); -} - -void wxTextCtrl::Remove(long from, long to) -{ - Replace(from, to, wxEmptyString); -} - -bool wxTextCtrl::IsModified() const -{ - return ::SendMessage(GetBuddyHwnd(), EM_GETMODIFY, 0, 0) != 0; -} - -void wxTextCtrl::MarkDirty() -{ - ::SendMessage(GetBuddyHwnd(), EM_SETMODIFY, TRUE, 0L); -} - -void wxTextCtrl::DiscardEdits() -{ - ::SendMessage(GetBuddyHwnd(), EM_SETMODIFY, FALSE, 0L); -} - -int wxTextCtrl::GetNumberOfLines() const -{ - return (int)::SendMessage(GetBuddyHwnd(), EM_GETLINECOUNT, 0, 0L); -} - -// ---------------------------------------------------------------------------- -// Positions <-> coords -// ---------------------------------------------------------------------------- - -long wxTextCtrl::XYToPosition(long x, long y) const -{ - // This gets the char index for the _beginning_ of this line - long charIndex = ::SendMessage(GetBuddyHwnd(), EM_LINEINDEX, (WPARAM)y, (LPARAM)0); - - return charIndex + x; -} - -bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const -{ - // This gets the line number containing the character - long lineNo = ::SendMessage(GetBuddyHwnd(), EM_LINEFROMCHAR, (WPARAM)pos, 0); - - if ( lineNo == -1 ) - { - // no such line - return false; - } - - // This gets the char index for the _beginning_ of this line - long charIndex = ::SendMessage(GetBuddyHwnd(), EM_LINEINDEX, (WPARAM)lineNo, (LPARAM)0); - if ( charIndex == -1 ) - { - return false; - } - - // The X position must therefore be the different between pos and charIndex - if ( x ) - *x = pos - charIndex; - if ( y ) - *y = lineNo; - - return true; -} - -wxTextCtrlHitTestResult -wxTextCtrl::HitTest(const wxPoint& pt, long *posOut) const -{ - // first get the position from Windows - // for the plain ones, we are limited to 16 bit positions which are - // combined in a single 32 bit value - LPARAM lParam = MAKELPARAM(pt.x, pt.y); - - LRESULT pos = ::SendMessage(GetBuddyHwnd(), EM_CHARFROMPOS, 0, lParam); - - if ( pos == -1 ) - { - // this seems to indicate an error... - return wxTE_HT_UNKNOWN; - } - - // for plain EDIT controls the higher word contains something else - pos = LOWORD(pos); - - - // next determine where it is relatively to our point: EM_CHARFROMPOS - // always returns the closest character but we need to be more precise, so - // double check that we really are where it pretends - POINTL ptReal; - - LRESULT lRc = ::SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0); - - if ( lRc == -1 ) - { - // this is apparently returned when pos corresponds to the last - // position - ptReal.x = - ptReal.y = 0; - } - else - { - ptReal.x = LOWORD(lRc); - ptReal.y = HIWORD(lRc); - } - - wxTextCtrlHitTestResult rc; - - if ( pt.y > ptReal.y + GetCharHeight() ) - rc = wxTE_HT_BELOW; - else if ( pt.x > ptReal.x + GetCharWidth() ) - rc = wxTE_HT_BEYOND; - else - rc = wxTE_HT_ON_TEXT; - - if ( posOut ) - *posOut = pos; - - return rc; -} - -void wxTextCtrl::ShowPosition(long pos) -{ - int currentLineLineNo = (int)::SendMessage(GetBuddyHwnd(), EM_GETFIRSTVISIBLELINE, 0, 0L); - - int specifiedLineLineNo = (int)::SendMessage(GetBuddyHwnd(), EM_LINEFROMCHAR, (WPARAM)pos, 0L); - - int linesToScroll = specifiedLineLineNo - currentLineLineNo; - - if (linesToScroll != 0) - (void)::SendMessage(GetBuddyHwnd(), EM_LINESCROLL, 0, (LPARAM)linesToScroll); -} - -long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const -{ - return ::SendMessage(GetBuddyHwnd(), EM_LINELENGTH, (WPARAM)pos, 0L); -} - -int wxTextCtrl::GetLineLength(long lineNo) const -{ - long pos = XYToPosition(0, lineNo); - - return GetLengthOfLineContainingPos(pos); -} - -wxString wxTextCtrl::GetLineText(long lineNo) const -{ - size_t len = (size_t)GetLineLength(lineNo) + 1; - - // there must be at least enough place for the length WORD in the - // buffer - len += sizeof(WORD); - - wxString str; - { - wxStringBufferLength tmp(str, len); - wxChar *buf = tmp; - - *(WORD *)buf = (WORD)len; - len = (size_t)::SendMessage(GetBuddyHwnd(), EM_GETLINE, lineNo, (LPARAM)buf); - - // remove the '\n' at the end, if any (this is how this function is - // supposed to work according to the docs) - if ( buf[len - 1] == wxT('\n') ) - { - len--; - } - - buf[len] = 0; - tmp.SetLength(len); - } - - return str; -} - -void wxTextCtrl::SetMaxLength(unsigned long len) -{ - ::SendMessage(GetBuddyHwnd(), EM_LIMITTEXT, len, 0); -} - -// ---------------------------------------------------------------------------- -// Undo/redo -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Undo() -{ - if (CanUndo()) - { - ::SendMessage(GetBuddyHwnd(), EM_UNDO, 0, 0); - } -} - -void wxTextCtrl::Redo() -{ - if (CanRedo()) - { - ::SendMessage(GetBuddyHwnd(), EM_UNDO, 0, 0); - } -} - -bool wxTextCtrl::CanUndo() const -{ - return ::SendMessage(GetBuddyHwnd(), EM_CANUNDO, 0, 0) != 0; -} - -bool wxTextCtrl::CanRedo() const -{ - return ::SendMessage(GetBuddyHwnd(), EM_CANUNDO, 0, 0) != 0; -} - -// ---------------------------------------------------------------------------- -// caret handling -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// implemenation details -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Command(wxCommandEvent & event) -{ - SetValue(event.GetString()); - ProcessCommand (event); -} - -// ---------------------------------------------------------------------------- -// kbd input processing -// ---------------------------------------------------------------------------- - -void wxTextCtrl::OnChar(wxKeyEvent& event) -{ - switch ( event.GetKeyCode() ) - { - case WXK_RETURN: - if ( !HasFlag(wxTE_MULTILINE) ) - { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); - InitCommandEvent(event); - event.SetString(GetValue()); - if ( GetEventHandler()->ProcessEvent(event) ) - return; - } - //else: multiline controls need Enter for themselves - - break; - - case WXK_TAB: - // ok, so this is getting absolutely ridiculous but I don't see - // any other way to fix this bug: when a multiline text control is - // inside a wxFrame, we need to generate the navigation event as - // otherwise nothing happens at all, but when the same control is - // created inside a dialog, IsDialogMessage() *does* switch focus - // all by itself and so if we do it here as well, it is advanced - // twice and goes to the next control... to prevent this from - // happening we're doing this ugly check, the logic being that if - // we don't have focus then it had been already changed to the next - // control - // - // the right thing to do would, of course, be to understand what - // the hell is IsDialogMessage() doing but this is beyond my feeble - // forces at the moment unfortunately - if ( !(m_windowStyle & wxTE_PROCESS_TAB)) - { - if ( FindFocus() == this ) - { - int flags = 0; - if (!event.ShiftDown()) - flags |= wxNavigationKeyEvent::IsForward ; - if (event.ControlDown()) - flags |= wxNavigationKeyEvent::WinChange ; - if (Navigate(flags)) - return; - } - } - else - { - // Insert tab since calling the default Windows handler - // doesn't seem to do it - WriteText(wxT("\t")); - } - break; - } - - // no, we didn't process it - event.Skip(); -} - -WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) -{ - WXLRESULT lRc = wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam); - - if ( nMsg == WM_GETDLGCODE ) - { - // we always want the chars and the arrows: the arrows for navigation - // and the chars because we want Ctrl-C to work even in a read only - // control - long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS; - - if ( IsEditable() ) - { - // we may have several different cases: - // 1. normal case: both TAB and ENTER are used for dlg navigation - // 2. ctrl which wants TAB for itself: ENTER is used to pass to the - // next control in the dialog - // 3. ctrl which wants ENTER for itself: TAB is used for dialog - // navigation - // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to go - // to the next control - - // the multiline edit control should always get for itself - if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) ) - lDlgCode |= DLGC_WANTMESSAGE; - - if ( HasFlag(wxTE_PROCESS_TAB) ) - lDlgCode |= DLGC_WANTTAB; - - lRc |= lDlgCode; - } - else // !editable - { - // NB: use "=", not "|=" as the base class version returns the - // same flags is this state as usual (i.e. including - // DLGC_WANTMESSAGE). This is strange (how does it work in the - // native Win32 apps?) but for now live with it. - lRc = lDlgCode; - } - } - - return lRc; -} - -// ---------------------------------------------------------------------------- -// text control event processing -// ---------------------------------------------------------------------------- - -bool wxTextCtrl::SendUpdateEvent() -{ - // is event reporting suspended? - if ( m_suppressNextUpdate ) - { - // do process the next one - m_suppressNextUpdate = false; - - return false; - } - - wxCommandEvent event(wxEVT_TEXT, GetId()); - InitCommandEvent(event); - event.SetString(GetValue()); - - return ProcessCommand(event); -} - -bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) -{ - switch ( param ) - { - case EN_SETFOCUS: - case EN_KILLFOCUS: - { - wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS - : wxEVT_SET_FOCUS, - m_windowId); - event.SetEventObject(this); - GetEventHandler()->ProcessEvent(event); - } - break; - - case EN_CHANGE: - SendUpdateEvent(); - break; - - case EN_MAXTEXT: - // the text size limit has been hit -- try to increase it - if ( !AdjustSpaceLimit() ) - { - wxCommandEvent event(wxEVT_TEXT_MAXLEN, m_windowId); - InitCommandEvent(event); - event.SetString(GetValue()); - ProcessCommand(event); - } - break; - - // the other edit notification messages are not processed - default: - return false; - } - - // processed - return true; -} - -bool wxTextCtrl::AdjustSpaceLimit() -{ - unsigned int limit = ::SendMessage(GetBuddyHwnd(), EM_GETLIMITTEXT, 0, 0); - - // HACK: we try to automatically extend the limit for the amount of text - // to allow (interactively) entering more than 64Kb of text under - // Win9x but we shouldn't reset the text limit which was previously - // set explicitly with SetMaxLength() - // - // we could solve this by storing the limit we set in wxTextCtrl but - // to save space we prefer to simply test here the actual limit - // value: we consider that SetMaxLength() can only be called for - // values < 32Kb - if ( limit < 0x8000 ) - { - // we've got more text than limit set by SetMaxLength() - return false; - } - - unsigned int len = ::GetWindowTextLength(GetBuddyHwnd()); - if ( len >= limit ) - { - limit = len + 0x8000; // 32Kb - - if ( limit > 0xffff ) - { - // this will set it to a platform-dependent maximum (much more - // than 64Kb under NT) - limit = 0; - } - - ::SendMessage(GetBuddyHwnd(), EM_LIMITTEXT, limit, 0L); - } - - // we changed the limit - return true; -} - -bool wxTextCtrl::AcceptsFocus() const -{ - // we don't want focus if we can't be edited unless we're a multiline - // control because then it might be still nice to get focus from keyboard - // to be able to scroll it without mouse - return (IsEditable() || IsMultiLine()) && wxControl::AcceptsFocus(); -} - -void wxTextCtrl::DoMoveWindow(int x, int y, int width, int height) -{ - int widthBtn = GetBestSpinnerSize(IsVertical(GetWindowStyle())).x / 2; - int widthText = width - widthBtn - MARGIN_BETWEEN; - if ( widthText <= 0 ) - { - wxLogDebug(wxT("not enough space for wxSpinCtrl!")); - } - - if ( !::MoveWindow(GetBuddyHwnd(), x, y, widthText, height, TRUE) ) - { - wxLogLastError(wxT("MoveWindow(buddy)")); - } - - x += widthText + MARGIN_BETWEEN; - if ( !::MoveWindow(GetHwnd(), x, y, widthBtn, height, TRUE) ) - { - wxLogLastError(wxT("MoveWindow")); - } -} - -wxSize wxTextCtrl::DoGetBestSize() const -{ - int cx, cy; - wxGetCharSize(GetBuddyHwnd(), &cx, &cy, GetFont()); - - int wText = DEFAULT_ITEM_WIDTH; - - int hText = cy; - if ( m_windowStyle & wxTE_MULTILINE ) - { - hText *= wxMax(GetNumberOfLines(), 5); - } - //else: for single line control everything is ok - - // we have to add the adjustments for the control height only once, not - // once per line, so do it after multiplication above - hText += EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) - cy; - - return wxSize(wText, hText); -} - -// ---------------------------------------------------------------------------- -// standard handlers for standard edit menu events -// ---------------------------------------------------------------------------- - -void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event)) -{ - Cut(); -} - -void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event)) -{ - Copy(); -} - -void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event)) -{ - Paste(); -} - -void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event)) -{ - Undo(); -} - -void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event)) -{ - Redo(); -} - -void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event)) -{ - long from, to; - GetSelection(& from, & to); - if (from != -1 && to != -1) - Remove(from, to); -} - -void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event)) -{ - SetSelection(-1, -1); -} - -void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event) -{ - event.Enable( CanCut() ); -} - -void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event) -{ - event.Enable( CanCopy() ); -} - -void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event) -{ - event.Enable( CanPaste() ); -} - -void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event) -{ - event.Enable( CanUndo() ); -} - -void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) -{ - event.Enable( CanRedo() ); -} - -void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event) -{ - long from, to; - GetSelection(& from, & to); - event.Enable(from != -1 && to != -1 && from != to && IsEditable()) ; -} - -void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event) -{ - event.Enable(GetLastPosition() > 0); -} - -void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event)) -{ - // be sure the caret remains invisible if the user had hidden it - if ( !m_isNativeCaretShown ) - { - ::HideCaret(GetBuddyHwnd()); - } -} - -#endif // wxUSE_TEXTCTRL && __SMARTPHONE__ && __WXWINCE__ diff --git a/Externals/wxWidgets3/src/msw/wince/time.cpp b/Externals/wxWidgets3/src/msw/wince/time.cpp deleted file mode 100644 index ef2ca653f4..0000000000 --- a/Externals/wxWidgets3/src/msw/wince/time.cpp +++ /dev/null @@ -1,761 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/msw/wince/time.cpp -// Purpose: Implements missing time functionality for WinCE -// Author: Marco Cavallini (MCK) - wx@koansoftware.com -// Modified by: Vadim Zeitlin for VC8 support -// Created: 31-08-2003 -// Copyright: (c) Marco Cavallini -// 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/msw/wrapwin.h" -#endif - -#include "wx/msw/wince/time.h" - -#if defined(__VISUALC__) && (__VISUALC__ >= 1400) - -// VC8 does provide the time functions but not the standard ones -#include - -time_t __cdecl time(time_t *t) -{ - __time64_t t64; - if ( !_time64(&t64) ) - return (time_t)-1; - - if ( t ) - *t = (time_t)t64; - - return (time_t)t64; -} - -time_t __cdecl mktime(struct tm *t) -{ - return (time_t)_mktime64(t); -} - -#else // !VC8 - -///////////////////////////////////////////////////////////////////////////////////////////// -// // -// strftime() - taken from OpenBSD // -// // -///////////////////////////////////////////////////////////////////////////////////////////// - -#define IN_NONE 0 -#define IN_SOME 1 -#define IN_THIS 2 -#define IN_ALL 3 -#define CHAR_BIT 8 - -#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) -#define TYPE_SIGNED(type) (((type) -1) < 0) - -#define INT_STRLEN_MAXIMUM(type) \ - ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type)) - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) - -#define MONSPERYEAR 12 -#define DAYSPERWEEK 7 -#define TM_YEAR_BASE 1900 -#define HOURSPERDAY 24 -#define DAYSPERNYEAR 365 -#define DAYSPERLYEAR 366 - -static char wildabbr[] = "WILDABBR"; - -char * tzname[2] = { - wildabbr, - wildabbr -}; - - -#define Locale (&C_time_locale) - -struct lc_time_T { - const char * mon[MONSPERYEAR]; - const char * month[MONSPERYEAR]; - const char * wday[DAYSPERWEEK]; - const char * weekday[DAYSPERWEEK]; - const char * X_fmt; - const char * x_fmt; - const char * c_fmt; - const char * am; - const char * pm; - const char * date_fmt; -}; - -static const struct lc_time_T C_time_locale = { - { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }, { - "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" - }, { - "Sun", "Mon", "Tue", "Wed", - "Thu", "Fri", "Sat" - }, { - "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday" - }, - - /* X_fmt */ - "%H:%M:%S", - - /* - ** x_fmt - ** C99 requires this format. - ** Using just numbers (as here) makes Quakers happier; - ** it's also compatible with SVR4. - */ - "%m/%d/%y", - - /* - ** c_fmt - ** C99 requires this format. - ** Previously this code used "%D %X", but we now conform to C99. - ** Note that - ** "%a %b %d %H:%M:%S %Y" - ** is used by Solaris 2.3. - */ - "%a %b %e %T %Y", - - /* am */ - "AM", - - /* pm */ - "PM", - - /* date_fmt */ - "%a %b %e %H:%M:%S %Z %Y" -}; - - -static char * -_add(const char * str, char * pt, const char * const ptlim) -{ - while (pt < ptlim && (*pt = *str++) != '\0') - ++pt; - return pt; -} - - -static char * -_conv(const int n, const char * const format, char * const pt, const char * const ptlim) -{ - char buf[INT_STRLEN_MAXIMUM(int) + 1]; - - (void) _snprintf(buf, sizeof buf, format, n); - return _add(buf, pt, ptlim); -} - - -static char * -_fmt(const char * format, const struct tm * const t, char * pt, const char * const ptlim, int * warnp) -{ - for ( ; *format; ++format) { - if (*format == '%') { -label: - switch (*++format) { - case '\0': - --format; - break; - case 'A': - pt = _add((t->tm_wday < 0 || - t->tm_wday >= DAYSPERWEEK) ? - "?" : Locale->weekday[t->tm_wday], - pt, ptlim); - continue; - case 'a': - pt = _add((t->tm_wday < 0 || - t->tm_wday >= DAYSPERWEEK) ? - "?" : Locale->wday[t->tm_wday], - pt, ptlim); - continue; - case 'B': - pt = _add((t->tm_mon < 0 || - t->tm_mon >= MONSPERYEAR) ? - "?" : Locale->month[t->tm_mon], - pt, ptlim); - continue; - case 'b': - case 'h': - pt = _add((t->tm_mon < 0 || - t->tm_mon >= MONSPERYEAR) ? - "?" : Locale->mon[t->tm_mon], - pt, ptlim); - continue; - case 'C': - /* - ** %C used to do a... - ** _fmt("%a %b %e %X %Y", t); - ** ...whereas now POSIX 1003.2 calls for - ** something completely different. - ** (ado, 1993-05-24) - */ - pt = _conv((t->tm_year + TM_YEAR_BASE) / 100, - "%02d", pt, ptlim); - continue; - case 'c': - { - int warn2 = IN_SOME; - - pt = _fmt(Locale->c_fmt, t, pt, ptlim, warnp); - if (warn2 == IN_ALL) - warn2 = IN_THIS; - if (warn2 > *warnp) - *warnp = warn2; - } - continue; - case 'D': - pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp); - continue; - case 'd': - pt = _conv(t->tm_mday, "%02d", pt, ptlim); - continue; - case 'E': - case 'O': - /* - ** C99 locale modifiers. - ** The sequences - ** %Ec %EC %Ex %EX %Ey %EY - ** %Od %oe %OH %OI %Om %OM - ** %OS %Ou %OU %OV %Ow %OW %Oy - ** are supposed to provide alternate - ** representations. - */ - goto label; - case 'e': - pt = _conv(t->tm_mday, "%2d", pt, ptlim); - continue; - case 'F': - pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp); - continue; - case 'H': - pt = _conv(t->tm_hour, "%02d", pt, ptlim); - continue; - case 'I': - pt = _conv((t->tm_hour % 12) ? - (t->tm_hour % 12) : 12, - "%02d", pt, ptlim); - continue; - case 'j': - pt = _conv(t->tm_yday + 1, "%03d", pt, ptlim); - continue; - case 'k': - /* - ** This used to be... - ** _conv(t->tm_hour % 12 ? - ** t->tm_hour % 12 : 12, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbins' - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ - pt = _conv(t->tm_hour, "%2d", pt, ptlim); - continue; -#ifdef KITCHEN_SINK - case 'K': - /* - ** After all this time, still unclaimed! - */ - pt = _add("kitchen sink", pt, ptlim); - continue; -#endif /* defined KITCHEN_SINK */ - case 'l': - /* - ** This used to be... - ** _conv(t->tm_hour, 2, ' '); - ** ...and has been changed to the below to - ** match SunOS 4.1.1 and Arnold Robbin's - ** strftime version 3.0. That is, "%k" and - ** "%l" have been swapped. - ** (ado, 1993-05-24) - */ - pt = _conv((t->tm_hour % 12) ? - (t->tm_hour % 12) : 12, - "%2d", pt, ptlim); - continue; - case 'M': - pt = _conv(t->tm_min, "%02d", pt, ptlim); - continue; - case 'm': - pt = _conv(t->tm_mon + 1, "%02d", pt, ptlim); - continue; - case 'n': - pt = _add("\n", pt, ptlim); - continue; - case 'p': - pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? - Locale->pm : - Locale->am, - pt, ptlim); - continue; - case 'R': - pt = _fmt("%H:%M", t, pt, ptlim, warnp); - continue; - case 'r': - pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp); - continue; - case 'S': - pt = _conv(t->tm_sec, "%02d", pt, ptlim); - continue; - case 's': - { - struct tm tm; - char buf[INT_STRLEN_MAXIMUM( - time_t) + 1]; - time_t mkt; - - tm = *t; - mkt = mktime(&tm); - if (TYPE_SIGNED(time_t)) - (void) _snprintf(buf, sizeof buf, - "%ld", (long) mkt); - else (void) _snprintf(buf, sizeof buf, - "%lu", (unsigned long) mkt); - pt = _add(buf, pt, ptlim); - } - continue; - case 'T': - pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp); - continue; - case 't': - pt = _add("\t", pt, ptlim); - continue; - case 'U': - pt = _conv((t->tm_yday + DAYSPERWEEK - - t->tm_wday) / DAYSPERWEEK, - "%02d", pt, ptlim); - continue; - case 'u': - /* - ** From Arnold Robbins' strftime version 3.0: - ** "ISO 8601: Weekday as a decimal number - ** [1 (Monday) - 7]" - ** (ado, 1993-05-24) - */ - pt = _conv((t->tm_wday == 0) ? - DAYSPERWEEK : t->tm_wday, - "%d", pt, ptlim); - continue; - case 'V': /* ISO 8601 week number */ - case 'G': /* ISO 8601 year (four digits) */ - case 'g': /* ISO 8601 year (two digits) */ - { - int year; - int yday; - int wday; - int w; - - year = t->tm_year + TM_YEAR_BASE; - yday = t->tm_yday; - wday = t->tm_wday; - for ( ; ; ) { - int len; - int bot; - int top; - - len = isleap(year) ? - DAYSPERLYEAR : - DAYSPERNYEAR; - /* - ** What yday (-3 ... 3) does - ** the ISO year begin on? - */ - bot = ((yday + 11 - wday) % - DAYSPERWEEK) - 3; - /* - ** What yday does the NEXT - ** ISO year begin on? - */ - top = bot - - (len % DAYSPERWEEK); - if (top < -3) - top += DAYSPERWEEK; - top += len; - if (yday >= top) { - ++year; - w = 1; - break; - } - if (yday >= bot) { - w = 1 + ((yday - bot) / - DAYSPERWEEK); - break; - } - --year; - yday += isleap(year) ? - DAYSPERLYEAR : - DAYSPERNYEAR; - } - if (*format == 'V') - pt = _conv(w, "%02d", - pt, ptlim); - else if (*format == 'g') { - *warnp = IN_ALL; - pt = _conv(year % 100, "%02d", - pt, ptlim); - } else pt = _conv(year, "%04d", - pt, ptlim); - } - continue; - case 'v': - pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp); - continue; - case 'W': - pt = _conv((t->tm_yday + DAYSPERWEEK - - (t->tm_wday ? - (t->tm_wday - 1) : - (DAYSPERWEEK - 1))) / DAYSPERWEEK, - "%02d", pt, ptlim); - continue; - case 'w': - pt = _conv(t->tm_wday, "%d", pt, ptlim); - continue; - case 'X': - pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp); - continue; - case 'x': - { - int warn2 = IN_SOME; - - pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2); - if (warn2 == IN_ALL) - warn2 = IN_THIS; - if (warn2 > *warnp) - *warnp = warn2; - } - continue; - case 'y': - *warnp = IN_ALL; - pt = _conv((t->tm_year + TM_YEAR_BASE) % 100, - "%02d", pt, ptlim); - continue; - case 'Y': - pt = _conv(t->tm_year + TM_YEAR_BASE, "%04d", - pt, ptlim); - continue; - case 'Z': - if (t->tm_isdst >= 0) - pt = _add(tzname[t->tm_isdst != 0], - pt, ptlim); - /* - ** C99 says that %Z must be replaced by the - ** empty string if the time zone is not - ** determinable. - */ - continue; - case 'z': - { - int diff = -timezone; - char const * sign; - - if (diff < 0) { - sign = "-"; - diff = -diff; - } else sign = "+"; - pt = _add(sign, pt, ptlim); - diff /= 60; - pt = _conv((diff/60)*100 + diff%60, - "%04d", pt, ptlim); - } - continue; - case '+': - pt = _fmt(Locale->date_fmt, t, pt, ptlim, - warnp); - continue; - case '%': - default: - break; - } - } - if (pt == ptlim) - break; - *pt++ = *format; - } - return pt; -} - -size_t -strftime(char * const s, const size_t maxsize, const char *format, const struct tm * const t) -{ - char *p; - int warn; - - //tzset(); - - warn = IN_NONE; - p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn); - - if (p == s + maxsize) { - if (maxsize > 0) - s[maxsize - 1] = '\0'; - return 0; - } - *p = '\0'; - return p - s; -} - -extern "C" -{ - -/* Not needed in VS Studio 2005 */ - -size_t wcsftime(wchar_t *s, - const size_t maxsize, - const wchar_t *format, - const struct tm *t) -{ - wxCharBuffer sBuf(maxsize/sizeof(wchar_t)); - - wxString formatStr(format); - wxCharBuffer bufFormatStr(formatStr.mb_str()); - - size_t sz = strftime(sBuf.data(), maxsize/sizeof(wchar_t), bufFormatStr, t); - - wxMB2WC(s, sBuf, maxsize); - - return sz; -} - -} /* extern "C" */ - -#define is_leap(y) (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) -#define SECONDS_IN_ONE_MINUTE 60 -#define DAYS_IN_ONE_YEAR 365 -#define SECONDS_IN_ONE_MIN 60 -#define SECONDS_IN_ONE_HOUR 3600 -#define SECONDS_IN_ONE_DAY 86400 -#define DEFAULT_TIMEZONE 28800 -#define DO_GMTIME 0 -#define DO_LOCALTIME 1 - - -long timezone ; // global variable - - -//////////////////////////////////////////////////////////////////////// -// Common code for localtime and gmtime (static) -//////////////////////////////////////////////////////////////////////// - -static struct tm * __cdecl common_localtime(const time_t *t, BOOL bLocal) -{ - wxLongLong i64; - FILETIME ft; - wxString str ; - SYSTEMTIME SystemTime; - TIME_ZONE_INFORMATION pTz; - static struct tm st_res ; // data holder - static struct tm * res = &st_res ; // data pointer - int iLeap; - const unsigned short int __mon_yday[2][13] = - { - // Normal years - { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }, - // Leap years - { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 } - }; - - if (!*t) - ::GetLocalTime(&SystemTime); - else - { - i64 = *t; - i64 = i64 * 10000000 + 116444736000000000; - - ft.dwLowDateTime = i64.GetLo(); - ft.dwHighDateTime = i64.GetHi(); - - ::FileTimeToSystemTime(&ft, &SystemTime); - } - - ::GetTimeZoneInformation(&pTz); - - /////////////////////////////////////////////// - // Set timezone - timezone = pTz.Bias * SECONDS_IN_ONE_MINUTE ; - /////////////////////////////////////////////// - - iLeap = is_leap(SystemTime.wYear) ; - - res->tm_hour = SystemTime.wHour; - res->tm_min = SystemTime.wMinute; - res->tm_sec = SystemTime.wSecond; - - res->tm_mday = SystemTime.wDay; - res->tm_mon = SystemTime.wMonth - 1; // this the correct month but localtime returns month aligned to zero - res->tm_year = SystemTime.wYear; // this the correct year - res->tm_year = res->tm_year - 1900; // but localtime returns the value starting at the 1900 - - res->tm_wday = SystemTime.wDayOfWeek; - res->tm_yday = __mon_yday[iLeap][res->tm_mon] + SystemTime.wDay - 1; // localtime returns year-day aligned to zero - - // if localtime behaviour and daylight saving - if (bLocal && pTz.DaylightBias != 0) - res->tm_isdst = 1; - else - res->tm_isdst = 0; // without daylight saving or gmtime - - return res; -} - -extern "C" -{ - -//////////////////////////////////////////////////////////////////////// -// Receive the number of seconds elapsed since midnight(00:00:00) -// and convert a time value and corrects for the local time zone -//////////////////////////////////////////////////////////////////////// -struct tm * __cdecl localtime(const time_t * t) -{ - return common_localtime(t, DO_LOCALTIME) ; -} - -//////////////////////////////////////////////////////////////////////// -// Receives the number of seconds elapsed since midnight(00:00:00) -// and converts a time value WITHOUT correcting for the local time zone -//////////////////////////////////////////////////////////////////////// -struct tm * __cdecl gmtime(const time_t *t) -{ - return common_localtime(t, DO_GMTIME) ; -} - -} - -//////////////////////////////////////////////////////////////////////// -// Common code for conversion of struct tm into time_t (static) -//////////////////////////////////////////////////////////////////////// -static time_t __cdecl common_tm_to_time(int day, int month, int year, int hour, int minute, int second) -{ -#if 1 - // Use mktime since it seems less broken - tm t; - t.tm_isdst = -1; - t.tm_hour = hour; - t.tm_mday = day; - t.tm_min = minute; - t.tm_mon = month-1; - t.tm_sec = second; - t.tm_wday = -1; - t.tm_yday = -1; - t.tm_year = year - 1900; - return mktime(& t); -#else - time_t prog = 0 ; - static int mdays[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 } ; - - while (--month) - { - prog += mdays[month - 1] ; - if (month == 2 && is_leap(year)) - prog++ ; - } - - // Calculate seconds in elapsed days - prog = day - 1 ; // align first day of the year to zero - prog += (DAYS_IN_ONE_YEAR * (year - 1970) + (year - 1901) / 4 - 19) ; - prog *= SECONDS_IN_ONE_DAY ; - - // Add Calculated elapsed seconds in the current day - prog += (hour * SECONDS_IN_ONE_HOUR + minute * - SECONDS_IN_ONE_MIN + second) ; - - return prog ; -#endif -} - -extern "C" -{ - -//////////////////////////////////////////////////////////////////////// -// Returns the number of seconds elapsed since -// midnight(00:00:00) of 1 January 1970 -//////////////////////////////////////////////////////////////////////// -time_t __cdecl time(time_t *t) -{ - time_t prog = 0 ; - - if (t != NULL) - { - SYSTEMTIME SystemTime; - - ::GetLocalTime(&SystemTime) ; - prog = common_tm_to_time(SystemTime.wDay, SystemTime.wMonth, SystemTime.wYear, - SystemTime.wHour, SystemTime.wMinute, SystemTime.wSecond) ; - *t = prog ; - } - - return prog ; -} - -//////////////////////////////////////////////////////////////////////// -// Converts the local time provided by struct tm -// into a time_t calendar value -// Implementation from OpenBSD -//////////////////////////////////////////////////////////////////////// - -#if 1 -int month_to_day[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; - -time_t mktime(struct tm *t) -{ - short month, year; - time_t result; - - month = t->tm_mon; - year = t->tm_year + month / 12 + 1900; - month %= 12; - if (month < 0) - { - year -= 1; - month += 12; - } - result = (year - 1970) * 365 + (year - 1969) / 4 + month_to_day[month]; - result = (year - 1970) * 365 + month_to_day[month]; - if (month <= 1) - year -= 1; - result += (year - 1968) / 4; - result -= (year - 1900) / 100; - result += (year - 1600) / 400; - result += t->tm_mday; - result -= 1; - result *= 24; - result += t->tm_hour; - result *= 60; - result += t->tm_min; - result *= 60; - result += t->tm_sec; - return(result); -} - -#else -time_t __cdecl mktime(struct tm *t) -{ - return (common_tm_to_time(t->tm_mday, t->tm_mon+1, t->tm_year+1900, t->tm_hour, t->tm_min, t->tm_sec)) ; -} -#endif - -} // extern "C" - -#endif // VC8/!VC8 diff --git a/Externals/wxWidgets3/src/msw/window.cpp b/Externals/wxWidgets3/src/msw/window.cpp index 225e13d531..01c9d59584 100644 --- a/Externals/wxWidgets3/src/msw/window.cpp +++ b/Externals/wxWidgets3/src/msw/window.cpp @@ -34,6 +34,7 @@ #include "wx/dc.h" #include "wx/dcclient.h" #include "wx/dcmemory.h" + #include "wx/dialog.h" #include "wx/utils.h" #include "wx/app.h" #include "wx/layout.h" @@ -81,6 +82,7 @@ #include "wx/msw/private.h" #include "wx/msw/private/keyboard.h" #include "wx/msw/dcclient.h" +#include "wx/msw/seh.h" #include "wx/private/textmeasure.h" #if wxUSE_TOOLTIPS @@ -105,24 +107,10 @@ #include -#if (!defined(__GNUWIN32_OLD__) && !defined(__WXMICROWIN__) /* && !defined(__WXWINCE__) */ ) || defined(__CYGWIN10__) - #include - #include -#endif +#include +#include -#ifdef __WIN32__ - #include -#endif - -#if defined(__WXWINCE__) - #include "wx/msw/wince/missing.h" -#ifdef __POCKETPC__ - #include - #include - #include - #include -#endif -#endif +#include #if wxUSE_UXTHEME #include "wx/msw/uxtheme.h" @@ -153,14 +141,6 @@ #define HAVE_TRACKMOUSEEVENT #endif // everything needed for TrackMouseEvent() -// set this to 1 to filter out duplicate mouse events, e.g. mouse move events -// when mouse position didnd't change -#ifdef __WXWINCE__ - #define wxUSE_MOUSEEVENT_HACK 0 -#else - #define wxUSE_MOUSEEVENT_HACK 1 -#endif - // not all compilers/platforms have X button related declarations (notably // Windows CE doesn't, and probably some old SDKs don't neither) #ifdef WM_XBUTTONDOWN @@ -194,7 +174,6 @@ namespace bool gs_hasStdCmap = false; // last mouse event information we need to filter out the duplicates -#if wxUSE_MOUSEEVENT_HACK struct MouseEventInfoDummy { // mouse position (in screen coordinates) @@ -203,7 +182,6 @@ struct MouseEventInfoDummy // last mouse event type wxEventType type; } gs_lastMouseEvent; -#endif // wxUSE_MOUSEEVENT_HACK // hash containing the registered handlers for the custom messages WX_DECLARE_HASH_MAP(int, wxWindow::MSWMessageHandler, @@ -251,12 +229,24 @@ bool gs_insideCaptureChanged = false; // --------------------------------------------------------------------------- // the window proc for all our windows -LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); - +LRESULT WXDLLEXPORT APIENTRY +wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); #if wxDEBUG_LEVEL >= 2 - const wxChar *wxGetMessageName(int message); +const wxChar *wxGetMessageName(int message); + +inline +void wxTraceMSWMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + // The casts to size_t allow to avoid having different code for Win32 and + // Win64 as size_t is of the right size in both cases, unlike int or long. + wxLogTrace("winmsg", + wxT("Processing %s(hWnd=%p, wParam=%zx, lParam=%zx)"), + wxGetMessageName(message), + hWnd, + static_cast(wParam), + static_cast(lParam)); +} #endif // wxDEBUG_LEVEL >= 2 void wxRemoveHandleAssociation(wxWindowMSW *win); @@ -265,22 +255,9 @@ extern void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win); // get the text metrics for the current font static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win); -#ifdef __WXWINCE__ -// find the window for the mouse event at the specified position -static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y); -#endif // __WXWINCE__ - // wrapper around BringWindowToTop() API static inline void wxBringWindowToTop(HWND hwnd) { -#ifdef __WXMICROWIN__ - // It seems that MicroWindows brings the _parent_ of the window to the top, - // which can be the wrong one. - - // activate (set focus to) specified window - ::SetFocus(hwnd); -#endif - // raise top level parent to top of z order if (!::SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)) { @@ -288,8 +265,6 @@ static inline void wxBringWindowToTop(HWND hwnd) } } -#ifndef __WXWINCE__ - // ensure that all our parent windows have WS_EX_CONTROLPARENT style static void EnsureParentHasControlParentStyle(wxWindow *parent) { @@ -319,8 +294,6 @@ static void EnsureParentHasControlParentStyle(wxWindow *parent) } } -#endif // !__WXWINCE__ - // GetCursorPos can return an error, so use this function // instead. // Error originally observed with WinCE, but later using Remote Desktop @@ -329,9 +302,6 @@ void wxGetCursorPosMSW(POINT* pt) { if (!GetCursorPos(pt)) { -#ifdef __WXWINCE__ - wxLogLastError(wxT("GetCursorPos")); -#endif DWORD pos = GetMessagePos(); // the coordinates may be negative in multi-monitor systems pt->x = GET_X_LPARAM(pos); @@ -346,15 +316,12 @@ void wxGetCursorPosMSW(POINT* pt) // in wxUniv/MSW this class is abstract because it doesn't have DoPopupMenu() // method #ifdef __WXUNIVERSAL__ - IMPLEMENT_ABSTRACT_CLASS(wxWindowMSW, wxWindowBase) + wxIMPLEMENT_ABSTRACT_CLASS(wxWindowMSW, wxWindowBase); #endif // __WXUNIVERSAL__ -BEGIN_EVENT_TABLE(wxWindowMSW, wxWindowBase) +wxBEGIN_EVENT_TABLE(wxWindowMSW, wxWindowBase) EVT_SYS_COLOUR_CHANGED(wxWindowMSW::OnSysColourChanged) -#ifdef __WXWINCE__ - EVT_INIT_DIALOG(wxWindowMSW::OnInitDialog) -#endif -END_EVENT_TABLE() +wxEND_EVENT_TABLE() // =========================================================================== // implementation @@ -451,9 +418,6 @@ void wxWindowMSW::Init() m_pendingSize = wxDefaultSize; #endif // wxUSE_DEFERRED_SIZING -#ifdef __POCKETPC__ - m_contextMenuEnabled = false; -#endif } // Destructor @@ -551,6 +515,26 @@ bool wxWindowMSW::Create(wxWindow *parent, return true; } +void wxWindowMSW::SetId(wxWindowID winid) +{ + wxWindowBase::SetId(winid); + + // Also update the ID used at the Windows level to avoid nasty surprises + // when we can't find the control when handling messages for it after + // changing its ID because Windows still uses the old one. + if ( GetHwnd() ) + { + ::SetLastError(0); + + if ( !::SetWindowLong(GetHwnd(), GWL_ID, winid) ) + { + const DWORD err = ::GetLastError(); + if ( err ) + wxLogApiError(wxT("SetWindowLong(GWL_ID)"), err); + } + } +} + // --------------------------------------------------------------------------- // basic operations // --------------------------------------------------------------------------- @@ -560,9 +544,7 @@ void wxWindowMSW::SetFocus() HWND hWnd = GetHwnd(); wxCHECK_RET( hWnd, wxT("can't set focus to invalid window") ); -#if !defined(__WXWINCE__) ::SetLastError(0); -#endif if ( !::SetFocus(hWnd) ) { @@ -673,24 +655,6 @@ wxWindowMSW::MSWShowWithEffect(bool show, if ( !wxWindowBase::Show(show) ) return false; - typedef BOOL (WINAPI *AnimateWindow_t)(HWND, DWORD, DWORD); - - static AnimateWindow_t s_pfnAnimateWindow = NULL; - static bool s_initDone = false; - if ( !s_initDone ) - { - wxDynamicLibrary dllUser32(wxT("user32.dll"), wxDL_VERBATIM | wxDL_QUIET); - wxDL_INIT_FUNC(s_pfn, AnimateWindow, dllUser32); - - s_initDone = true; - - // notice that it's ok to unload user32.dll here as it won't be really - // unloaded, being still in use because we link to it statically too - } - - if ( !s_pfnAnimateWindow ) - return Show(show); - // Show() has a side effect of sending a WM_SIZE to the window, which helps // ensuring that it's laid out correctly, but AnimateWindow() doesn't do // this so send the event ourselves @@ -755,7 +719,7 @@ wxWindowMSW::MSWShowWithEffect(bool show, return false; } - if ( !(*s_pfnAnimateWindow)(GetHwnd(), timeout, dwFlags) ) + if ( !::AnimateWindow(GetHwnd(), timeout, dwFlags) ) { wxLogLastError(wxT("AnimateWindow")); @@ -903,22 +867,9 @@ void wxWindowMSW::WarpPointer(int x, int y) void wxWindowMSW::MSWUpdateUIState(int action, int state) { - // WM_CHANGEUISTATE only appeared in Windows 2000 so it can do us no good - // to use it on older systems -- and could possibly do some harm - static int s_needToUpdate = -1; - if ( s_needToUpdate == -1 ) - { - int verMaj, verMin; - s_needToUpdate = wxGetOsVersion(&verMaj, &verMin) == wxOS_WINDOWS_NT && - verMaj >= 5; - } - - if ( s_needToUpdate ) - { - // we send WM_CHANGEUISTATE so if nothing needs changing then the system - // won't send WM_UPDATEUISTATE - ::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0); - } + // we send WM_CHANGEUISTATE so if nothing needs changing then the system + // won't send WM_UPDATEUISTATE + ::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0); } // --------------------------------------------------------------------------- @@ -930,17 +881,12 @@ namespace inline int GetScrollPosition(HWND hWnd, int wOrient) { -#ifdef __WXMICROWIN__ - return ::GetScrollPosWX(hWnd, wOrient); -#else WinStruct scrollInfo; scrollInfo.cbSize = sizeof(SCROLLINFO); scrollInfo.fMask = SIF_POS; ::GetScrollInfo(hWnd, wOrient, &scrollInfo ); return scrollInfo.nPos; - -#endif } inline UINT WXOrientToSB(int orient) @@ -1063,12 +1009,7 @@ void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect) } -#ifdef __WXWINCE__ - // FIXME: is this the exact equivalent of the line below? - ::ScrollWindowEx(GetHwnd(), dx, dy, pr, pr, 0, 0, SW_SCROLLCHILDREN|SW_ERASE|SW_INVALIDATE); -#else ::ScrollWindow(GetHwnd(), dx, dy, pr, pr); -#endif } static bool ScrollVertically(HWND hwnd, int kind, int count) @@ -1117,47 +1058,21 @@ bool wxWindowMSW::ScrollPages(int pages) void wxWindowMSW::SetLayoutDirection(wxLayoutDirection dir) { -#ifdef __WXWINCE__ - wxUnusedVar(dir); -#else - wxCHECK_RET( GetHwnd(), - wxT("layout direction must be set after window creation") ); - - LONG styleOld = wxGetWindowExStyle(this); - - LONG styleNew = styleOld; - switch ( dir ) + if ( wxUpdateLayoutDirection(GetHwnd(), dir) ) { - case wxLayout_LeftToRight: - styleNew &= ~WS_EX_LAYOUTRTL; - break; - - case wxLayout_RightToLeft: - styleNew |= WS_EX_LAYOUTRTL; - break; - - default: - wxFAIL_MSG(wxT("unsupported layout direction")); - break; + // Update layout: whether we have children or are drawing something, we + // need to redo it with the new layout. + SendSizeEvent(); + Refresh(); } - - if ( styleNew != styleOld ) - { - wxSetWindowExStyle(this, styleNew); - } -#endif } wxLayoutDirection wxWindowMSW::GetLayoutDirection() const { -#ifdef __WXWINCE__ - return wxLayout_Default; -#else wxCHECK_MSG( GetHwnd(), wxLayout_Default, wxT("invalid window") ); return wxHasWindowExStyle(this, WS_EX_LAYOUTRTL) ? wxLayout_RightToLeft : wxLayout_LeftToRight; -#endif } wxCoord @@ -1394,12 +1309,6 @@ wxBorder wxWindowMSW::GetDefaultBorder() const // that makes most sense for this Windows environment wxBorder wxWindowMSW::TranslateBorder(wxBorder border) const { -#if defined(__POCKETPC__) || defined(__SMARTPHONE__) - if (border == wxBORDER_THEME || border == wxBORDER_SUNKEN || border == wxBORDER_SIMPLE) - return wxBORDER_SIMPLE; - else - return wxBORDER_NONE; -#else #if wxUSE_UXTHEME if (border == wxBORDER_THEME) { @@ -1413,7 +1322,6 @@ wxBorder wxWindowMSW::TranslateBorder(wxBorder border) const } #endif return border; -#endif } @@ -1460,10 +1368,8 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const { *exstyle = 0; -#ifndef __WXWINCE__ if ( flags & wxTRANSPARENT_WINDOW ) *exstyle |= WS_EX_TRANSPARENT; -#endif switch ( border ) { @@ -1496,7 +1402,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const } // wxUniv doesn't use Windows dialog navigation functions at all -#if !defined(__WXUNIVERSAL__) && !defined(__WXWINCE__) +#if !defined(__WXUNIVERSAL__) // to make the dialog navigation work with the nested panels we must // use this style (top level windows such as dialogs don't need it) if ( (flags & wxTAB_TRAVERSAL) && !IsTopLevel() ) @@ -1560,21 +1466,17 @@ bool wxWindowMSW::Reparent(wxWindowBase *parent) ::SetParent(hWndChild, hWndParent); -#ifndef __WXWINCE__ if ( wxHasWindowExStyle(this, WS_EX_CONTROLPARENT) ) { EnsureParentHasControlParentStyle(GetParent()); } -#endif // !__WXWINCE__ return true; } static inline void SendSetRedraw(HWND hwnd, bool on) { -#ifndef __WXMICROWIN__ ::SendMessage(hwnd, WM_SETREDRAW, (WPARAM)on, 0); -#endif } void wxWindowMSW::DoFreeze() @@ -1614,16 +1516,11 @@ void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect) pRect = NULL; } - // RedrawWindow not available on SmartPhone or eVC++ 3 -#if !defined(__SMARTPHONE__) && !(defined(_WIN32_WCE) && _WIN32_WCE < 400) UINT flags = RDW_INVALIDATE | RDW_ALLCHILDREN; if ( eraseBack ) flags |= RDW_ERASE; ::RedrawWindow(hWnd, pRect, NULL, flags); -#else - ::InvalidateRect(hWnd, pRect, eraseBack); -#endif } } @@ -1634,19 +1531,15 @@ void wxWindowMSW::Update() wxLogLastError(wxT("UpdateWindow")); } -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) // just calling UpdateWindow() is not enough, what we did in our WM_PAINT // handler needs to be really drawn right now (void)::GdiFlush(); -#endif // __WIN32__ } // --------------------------------------------------------------------------- // drag and drop // --------------------------------------------------------------------------- -#if wxUSE_DRAG_AND_DROP || !defined(__WXWINCE__) - #if wxUSE_STATBOX // we need to lower the sibling static boxes so controls contained within can be @@ -1678,9 +1571,8 @@ static inline void AdjustStaticBoxZOrder(wxWindow * WXUNUSED(parent)) #endif // wxUSE_STATBOX/!wxUSE_STATBOX -#endif // drag and drop is used - #if wxUSE_DRAG_AND_DROP + void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget) { if ( m_dropTarget != 0 ) { @@ -1695,20 +1587,19 @@ void wxWindowMSW::SetDropTarget(wxDropTarget *pDropTarget) m_dropTarget->Register(m_hWnd); } } + #endif // wxUSE_DRAG_AND_DROP // old-style file manager drag&drop support: we retain the old-style // DragAcceptFiles in parallel with SetDropTarget. -void wxWindowMSW::DragAcceptFiles(bool WXUNUSED_IN_WINCE(accept)) +void wxWindowMSW::DragAcceptFiles(bool accept) { -#ifndef __WXWINCE__ HWND hWnd = GetHwnd(); if ( hWnd ) { AdjustStaticBoxZOrder(GetParent()); ::DragAcceptFiles(hWnd, (BOOL)accept); } -#endif } // ---------------------------------------------------------------------------- @@ -1836,31 +1727,18 @@ void wxWindowMSW::DoGetPosition(int *x, int *y) const { RECT rect = wxGetWindowRect(GetHwnd()); - POINT point; - point.x = rect.left; - point.y = rect.top; - // we do the adjustments with respect to the parent only for the "real" // children, not for the dialogs/frames if ( !IsTopLevel() ) { - if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) - { - // In RTL mode, we want the logical left x-coordinate, - // which would be the physical right x-coordinate. - point.x = rect.right; - } - - // Since we now have the absolute screen coords, if there's a - // parent we must subtract its top left corner - if ( parent ) - { - ::ScreenToClient(GetHwndOf(parent), &point); - } + // In RTL mode, we want the logical left x-coordinate, + // which would be the physical right x-coordinate. + ::MapWindowPoints(NULL, parent ? GetHwndOf(parent) : HWND_DESKTOP, + (LPPOINT)&rect, 2); } - pos.x = point.x; - pos.y = point.y; + pos.x = rect.left; + pos.y = rect.top; } // we also must adjust by the client area offset: a control which is just @@ -2127,11 +2005,11 @@ wxSize wxWindowMSW::DoGetBorderSize() const break; case wxBORDER_SUNKEN: + case wxBORDER_THEME: border = 2; break; case wxBORDER_RAISED: - case wxBORDER_DOUBLE: border = 3; break; @@ -2221,8 +2099,6 @@ static void wxYieldForCommandsOnly() bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) { - menu->UpdateUI(); - wxPoint pt; if ( x == wxDefaultCoord && y == wxDefaultCoord ) { @@ -2233,22 +2109,10 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) pt = ClientToScreen(wxPoint(x, y)); } -#if defined(__WXWINCE__) - static const UINT flags = 0; -#else // !__WXWINCE__ - UINT flags = TPM_RIGHTBUTTON; - // NT4 doesn't support TPM_RECURSE and simply doesn't show the menu at all - // when it's use, I'm not sure about Win95/98 but prefer to err on the safe - // side and not to use it there neither -- modify the test if it does work - // on these systems - if ( wxGetWinVersion() >= wxWinVersion_5 ) - { - // using TPM_RECURSE allows us to show a popup menu while another menu - // is opened which can be useful and is supported by the other - // platforms, so allow it under Windows too - flags |= TPM_RECURSE; - } -#endif // __WXWINCE__/!__WXWINCE__ + // using TPM_RECURSE allows us to show a popup menu while another menu + // is opened which can be useful and is supported by the other + // platforms, so allow it under Windows too + UINT flags = TPM_RIGHTBUTTON | TPM_RECURSE; ::TrackPopupMenu(GetHmenuOf(menu), flags, pt.x, pt.y, 0, GetHwnd(), NULL); @@ -2266,6 +2130,74 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) #endif // wxUSE_MENUS_NATIVE +// --------------------------------------------------------------------------- +// menu events +// --------------------------------------------------------------------------- + +#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) + +bool +wxWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) +{ + // Ignore the special messages generated when the menu is closed (this is + // the only case when the flags are set to -1), in particular don't clear + // the help string in the status bar when this happens as it had just been + // restored by the base class code. + if ( !hMenu && flags == 0xffff ) + return false; + + // sign extend to int from unsigned short we get from Windows + int item = (signed short)nItem; + + // WM_MENUSELECT is generated for both normal items and menus, including + // the top level menus of the menu bar, which can't be represented using + // any valid identifier in wxMenuEvent so use an otherwise unused value for + // them + if ( flags & (MF_POPUP | MF_SEPARATOR) ) + item = wxID_NONE; + + wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item); + if ( wxMenu::ProcessMenuEvent(MSWFindMenuFromHMENU(hMenu), event, this) ) + return true; + + // by default, i.e. if the event wasn't handled above, clear the status bar + // text when an item which can't have any associated help string in wx API + // is selected + if ( item == wxID_NONE ) + { + wxFrame *frame = wxDynamicCast(wxGetTopLevelParent(this), wxFrame); + if ( frame ) + frame->DoGiveHelp(wxEmptyString, true); + } + + return false; +} + +bool +wxWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu) +{ + wxMenuEvent event(evtType, menu && !menu->IsAttached() ? wxID_ANY : 0, menu); + + return wxMenu::ProcessMenuEvent(menu, event, this); +} + +bool wxWindowMSW::HandleMenuPopup(wxEventType evtType, WXHMENU hMenu) +{ + wxMenu* const menu = MSWFindMenuFromHMENU(hMenu); + + return DoSendMenuOpenCloseEvent(evtType, menu); +} + +wxMenu* wxWindowMSW::MSWFindMenuFromHMENU(WXHMENU hMenu) +{ + if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetHMenu() == hMenu ) + return wxCurrentPopupMenu; + + return NULL; +} + +#endif // wxUSE_MENUS && !defined(__WXUNIVERSAL__) + // =========================================================================== // pre/post message processing // =========================================================================== @@ -2384,7 +2316,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) // currently active button should get enter press even // if there is a default button elsewhere so check if // this window is a button first - wxWindow *btn = NULL; + wxButton *btn = NULL; if ( lDlgCode & DLGC_DEFPUSHBUTTON ) { // let IsDialogMessage() handle this for all @@ -2393,8 +2325,11 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) long style = ::GetWindowLong(msg->hwnd, GWL_STYLE); if ( (style & BS_OWNERDRAW) == BS_OWNERDRAW ) { - // emulate the button click - btn = wxFindWinFromHandle(msg->hwnd); + btn = wxDynamicCast + ( + wxFindWinFromHandle(msg->hwnd), + wxButton + ); } } else // not a button itself, do we have default button? @@ -2435,25 +2370,12 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) ); } } - else // bCtrlDown - { - win = wxGetTopLevelParent(win); - } - wxTopLevelWindow * const - tlw = wxDynamicCast(win, wxTopLevelWindow); - if ( tlw ) - { - btn = wxDynamicCast(tlw->GetDefaultItem(), - wxButton); - } + btn = MSWGetDefaultButtonFor(win); } - if ( btn && btn->IsEnabled() ) - { - btn->MSWCommand(BN_CLICKED, 0 /* unused */); + if ( MSWClickButtonIfPossible(btn) ) return true; - } // This "Return" key press won't be actually used for // navigation so don't generate wxNavigationKeyEvent @@ -2464,13 +2386,6 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) #endif // wxUSE_BUTTON -#ifdef __WXWINCE__ - // map Enter presses into button presses on PDAs - wxJoystickEvent event(wxEVT_JOY_BUTTON_DOWN); - event.SetEventObject(this); - if ( HandleWindowEvent(event) ) - return true; -#endif // __WXWINCE__ } break; @@ -2498,7 +2413,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) } } - if ( ::IsDialogMessage(GetHwnd(), msg) ) + if ( MSWSafeIsDialogMessage(msg) ) { // IsDialogMessage() did something... return true; @@ -2529,12 +2444,16 @@ bool wxWindowMSW::MSWTranslateMessage(WXMSG* pMsg) #endif // wxUSE_ACCEL } -bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* msg) +bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* WXUNUSED(msg)) { - // all tests below have to deal with various bugs/misfeatures of - // IsDialogMessage(): we have to prevent it from being called from our - // MSWProcessMessage() in some situations + // We don't have any reason to not preprocess messages at this level. + return true; +} +#ifndef __WXUNIVERSAL__ + +bool wxWindowMSW::MSWSafeIsDialogMessage(WXMSG* msg) +{ // don't let IsDialogMessage() get VK_ESCAPE as it _always_ eats the // message even when there is no cancel button and when the message is // needed by the control itself: in particular, it prevents the tree in @@ -2548,48 +2467,43 @@ bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* msg) // going into an infinite loop when it tries to find the control to give // focus to when Alt- is pressed, so we try to detect [some of] the // situations when this may happen and not call it then - if ( msg->message != WM_SYSCHAR ) - return true; - - // assume we can call it by default - bool canSafelyCallIsDlgMsg = true; - - HWND hwndFocus = ::GetFocus(); - - // if the currently focused window itself has WS_EX_CONTROLPARENT style, - // ::IsDialogMessage() will also enter an infinite loop, because it will - // recursively check the child windows but not the window itself and so if - // none of the children accepts focus it loops forever (as it only stops - // when it gets back to the window it started from) - // - // while it is very unusual that a window with WS_EX_CONTROLPARENT - // style has the focus, it can happen. One such possibility is if - // all windows are either toplevel, wxDialog, wxPanel or static - // controls and no window can actually accept keyboard input. -#if !defined(__WXWINCE__) - if ( ::GetWindowLong(hwndFocus, GWL_EXSTYLE) & WS_EX_CONTROLPARENT ) + if ( msg->message == WM_SYSCHAR ) { - // pessimistic by default - canSafelyCallIsDlgMsg = false; - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) + HWND hwndFocus = ::GetFocus(); + + // if the currently focused window itself has WS_EX_CONTROLPARENT style, + // ::IsDialogMessage() will also enter an infinite loop, because it will + // recursively check the child windows but not the window itself and so if + // none of the children accepts focus it loops forever (as it only stops + // when it gets back to the window it started from) + // + // while it is very unusual that a window with WS_EX_CONTROLPARENT + // style has the focus, it can happen. One such possibility is if + // all windows are either toplevel, wxDialog, wxPanel or static + // controls and no window can actually accept keyboard input. + if ( ::GetWindowLong(hwndFocus, GWL_EXSTYLE) & WS_EX_CONTROLPARENT ) { - wxWindow * const win = node->GetData(); - if ( win->CanAcceptFocus() && - !wxHasWindowExStyle(win, WS_EX_CONTROLPARENT) ) + // pessimistic by default + bool canSafelyCallIsDlgMsg = false; + for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); + node; + node = node->GetNext() ) { - // it shouldn't hang... - canSafelyCallIsDlgMsg = true; + wxWindow * const win = node->GetData(); + if ( win->CanAcceptFocus() && + !wxHasWindowExStyle(win, WS_EX_CONTROLPARENT) ) + { + // it shouldn't hang... + canSafelyCallIsDlgMsg = true; - break; + break; + } } - } - } -#endif // !__WXWINCE__ - if ( canSafelyCallIsDlgMsg ) - { + if ( !canSafelyCallIsDlgMsg ) + return false; + } + // ::IsDialogMessage() can enter in an infinite loop when the // currently focused window is disabled or hidden and its // parent has WS_EX_CONTROLPARENT style, so don't call it in @@ -2600,9 +2514,7 @@ bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* msg) !::IsWindowVisible(hwndFocus) ) { // it would enter an infinite loop if we do this! - canSafelyCallIsDlgMsg = false; - - break; + return false; } if ( !(::GetWindowLong(hwndFocus, GWL_STYLE) & WS_CHILD) ) @@ -2617,7 +2529,39 @@ bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* msg) } } - return canSafelyCallIsDlgMsg; + return ::IsDialogMessage(GetHwnd(), msg) != 0; +} + +#endif // __WXUNIVERSAL__ + +/* static */ +wxButton* wxWindowMSW::MSWGetDefaultButtonFor(wxWindow* win) +{ +#if wxUSE_BUTTON + win = wxGetTopLevelParent(win); + + wxTopLevelWindow *const tlw = wxDynamicCast(win, wxTopLevelWindow); + if ( tlw ) + return wxDynamicCast(tlw->GetDefaultItem(), wxButton); +#endif // wxUSE_BUTTON + + return NULL; +} + +/* static */ +bool wxWindowMSW::MSWClickButtonIfPossible(wxButton* btn) +{ +#if wxUSE_BUTTON + if ( btn && btn->IsEnabled() && btn->IsShownOnScreen() ) + { + btn->MSWCommand(BN_CLICKED, 0 /* unused */); + return true; + } +#endif // wxUSE_BUTTON + + wxUnusedVar(btn); + + return false; } // --------------------------------------------------------------------------- @@ -2684,19 +2628,16 @@ wxWindowCreationHook::~wxWindowCreationHook() } // Main window proc -LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT WXDLLEXPORT APIENTRY +wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { // trace all messages: useful for the debugging but noticeably slows down // the code so don't do it by default #if wxDEBUG_LEVEL >= 2 - // notice that we cast wParam and lParam to long to avoid mismatch with - // format specifiers in 64 bit builds where they are both int64 quantities - // - // casting like this loses information, of course, but it shouldn't matter - // much for this diagnostic code and it keeps the code simple - wxLogTrace("winmsg", - wxT("Processing %s(hWnd=%p, wParam=%08lx, lParam=%08lx)"), - wxGetMessageName(message), hWnd, (long)wParam, (long)lParam); + // We have to do this inside a helper function as wxLogTrace() constructs + // an object internally, but objects can't be used in functions using __try + // (expanded from wxSEH_TRY below) with MSVC. + wxTraceMSWMessage(hWnd, message, wParam, lParam); #endif // wxDEBUG_LEVEL >= 2 wxWindowMSW *wnd = wxFindWinFromHandle(hWnd); @@ -2713,10 +2654,21 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM w LRESULT rc; - if ( wnd && wxGUIEventLoop::AllowProcessing(wnd) ) - rc = wnd->MSWWindowProc(message, wParam, lParam); - else - rc = ::DefWindowProc(hWnd, message, wParam, lParam); + // We have to catch unhandled Win32 exceptions here because otherwise they + // would be simply lost if we're called from a kernel callback (as it + // happens when we process WM_PAINT, for example under WOW64: the 32 bit + // exceptions can't pass through the 64 bit kernel in this case and so are + // mostly just suppressed, although the exact behaviour differs across + // Windows versions, see the "Remarks" section of WindowProc documentation + // at https://msdn.microsoft.com/en-us/library/ms633573.aspx + wxSEH_TRY + { + if ( wnd && wxGUIEventLoop::AllowProcessing(wnd) ) + rc = wnd->MSWWindowProc(message, wParam, lParam); + else + rc = ::DefWindowProc(hWnd, message, wParam, lParam); + } + wxSEH_HANDLE(0) return rc; } @@ -2771,21 +2723,20 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, processed = HandleMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; -#if !defined(__WXWINCE__) case WM_MOVING: { LPRECT pRect = (LPRECT)lParam; - wxRect rc; - rc.SetLeft(pRect->left); - rc.SetTop(pRect->top); - rc.SetRight(pRect->right); - rc.SetBottom(pRect->bottom); - processed = HandleMoving(rc); + wxRect rect; + rect.SetLeft(pRect->left); + rect.SetTop(pRect->top); + rect.SetRight(pRect->right); + rect.SetBottom(pRect->bottom); + processed = HandleMoving(rect); if (processed) { - pRect->left = rc.GetLeft(); - pRect->top = rc.GetTop(); - pRect->right = rc.GetRight(); - pRect->bottom = rc.GetBottom(); + pRect->left = rect.GetLeft(); + pRect->top = rect.GetTop(); + pRect->right = rect.GetRight(); + pRect->bottom = rect.GetBottom(); } } break; @@ -2805,28 +2756,25 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_SIZING: { LPRECT pRect = (LPRECT)lParam; - wxRect rc; - rc.SetLeft(pRect->left); - rc.SetTop(pRect->top); - rc.SetRight(pRect->right); - rc.SetBottom(pRect->bottom); - processed = HandleSizing(rc); + wxRect rect; + rect.SetLeft(pRect->left); + rect.SetTop(pRect->top); + rect.SetRight(pRect->right); + rect.SetBottom(pRect->bottom); + processed = HandleSizing(rect); if (processed) { - pRect->left = rc.GetLeft(); - pRect->top = rc.GetTop(); - pRect->right = rc.GetRight(); - pRect->bottom = rc.GetBottom(); + pRect->left = rect.GetLeft(); + pRect->top = rect.GetTop(); + pRect->right = rect.GetRight(); + pRect->bottom = rect.GetBottom(); } } break; -#endif // !__WXWINCE__ -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) case WM_ACTIVATEAPP: // This implicitly sends a wxEVT_ACTIVATE_APP event wxTheApp->SetActive(wParam != 0, FindFocus()); break; -#endif case WM_ACTIVATE: { @@ -2927,83 +2875,10 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_XBUTTONDBLCLK: #endif // wxHAS_XBUTTON { -#ifdef __WXMICROWIN__ - // MicroWindows seems to ignore the fact that a window is - // disabled. So catch mouse events and throw them away if - // necessary. - wxWindowMSW* win = this; - for ( ;; ) - { - if (!win->IsEnabled()) - { - processed = true; - break; - } - - win = win->GetParent(); - if ( !win || win->IsTopLevel() ) - break; - } - - if ( processed ) - break; - -#endif // __WXMICROWIN__ int x = GET_X_LPARAM(lParam), y = GET_Y_LPARAM(lParam); -#ifdef __WXWINCE__ - // redirect the event to a static control if necessary by - // finding one under mouse because under CE the static controls - // don't generate mouse events (even with SS_NOTIFY) - wxWindowMSW *win; - if ( GetCapture() == this ) - { - // but don't do it if the mouse is captured by this window - // because then it should really get this event itself - win = this; - } - else - { - win = FindWindowForMouseEvent(this, &x, &y); - - // this should never happen - wxCHECK_MSG( win, 0, - wxT("FindWindowForMouseEvent() returned NULL") ); - } -#ifdef __POCKETPC__ - if (IsContextMenuEnabled() && message == WM_LBUTTONDOWN) - { - SHRGINFO shrgi = {0}; - - shrgi.cbSize = sizeof(SHRGINFO); - shrgi.hwndClient = (HWND) GetHWND(); - shrgi.ptDown.x = x; - shrgi.ptDown.y = y; - - shrgi.dwFlags = SHRG_RETURNCMD; - // shrgi.dwFlags = SHRG_NOTIFYPARENT; - - if (GN_CONTEXTMENU == ::SHRecognizeGesture(&shrgi)) - { - wxPoint pt(x, y); - pt = ClientToScreen(pt); - - wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU, GetId(), pt); - - evtCtx.SetEventObject(this); - if (HandleWindowEvent(evtCtx)) - { - processed = true; - return true; - } - } - } -#endif - -#else // !__WXWINCE__ wxWindowMSW *win = this; -#endif // __WXWINCE__/!__WXWINCE__ processed = win->HandleMouseEvent(message, x, y, wParam); @@ -3037,7 +2912,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, HIWORD(lParam), wParam); break; -#endif // __WXMICROWIN__ +#endif // MM_JOY1MOVE case WM_COMMAND: { @@ -3053,19 +2928,6 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, processed = HandleNotify((int)wParam, lParam, &rc.result); break; - // we only need to reply to WM_NOTIFYFORMAT manually when using MSLU, - // otherwise DefWindowProc() does it perfectly fine for us, but MSLU - // apparently doesn't always behave properly and needs some help -#if wxUSE_UNICODE_MSLU && defined(NF_QUERY) - case WM_NOTIFYFORMAT: - if ( lParam == NF_QUERY ) - { - processed = true; - rc.result = NFR_UNICODE; - } - break; -#endif // wxUSE_UNICODE_MSLU - // for these messages we must return true if process the message #ifdef WM_DRAWITEM case WM_DRAWITEM: @@ -3159,6 +3021,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case VK_OEM_5: case VK_OEM_6: case VK_OEM_7: + case VK_OEM_8: case VK_OEM_102: case VK_OEM_PLUS: case VK_OEM_COMMA: @@ -3251,7 +3114,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, #if wxUSE_HOTKEY case WM_HOTKEY: - processed = HandleHotKey((WORD)wParam, lParam); + processed = HandleHotKey(wParam, lParam); break; #endif // wxUSE_HOTKEY @@ -3276,7 +3139,6 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, // CTLCOLOR messages are sent by children to query the parent for their // colors -#ifndef __WXMICROWIN__ case WM_CTLCOLORMSGBOX: case WM_CTLCOLOREDIT: case WM_CTLCOLORLISTBOX: @@ -3292,18 +3154,15 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, processed = HandleCtlColor(&rc.hBrush, (WXHDC)hdc, (WXHWND)hwnd); } break; -#endif // !__WXMICROWIN__ case WM_SYSCOLORCHANGE: // the return value for this message is ignored processed = HandleSysColorChange(); break; -#if !defined(__WXWINCE__) case WM_DISPLAYCHANGE: processed = HandleDisplayChange(); break; -#endif case WM_PALETTECHANGED: processed = HandlePaletteChanged((WXHWND)wParam); @@ -3340,11 +3199,9 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } break; -#if !defined(__WXWINCE__) case WM_DROPFILES: processed = HandleDropFiles(wParam); break; -#endif case WM_INITDIALOG: processed = HandleInitDialog((WXHWND)wParam); @@ -3356,7 +3213,6 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } break; -#if !defined(__WXWINCE__) case WM_QUERYENDSESSION: processed = HandleQueryEndSession(lParam, &rc.allow); break; @@ -3368,7 +3224,6 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_GETMINMAXINFO: processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam); break; -#endif case WM_SETCURSOR: processed = HandleSetCursor((WXHWND)wParam, @@ -3392,7 +3247,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, if (dwObjId == (LPARAM)OBJID_CLIENT && GetOrCreateAccessible()) { - return LresultFromObject(IID_IAccessible, wParam, (IUnknown*) GetAccessible()->GetIAccessible()); + processed = true; + rc.result = LresultFromObject(IID_IAccessible, wParam, (IUnknown*) GetAccessible()->GetIAccessible()); } break; } @@ -3408,25 +3264,18 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, processed = true; // WM_HELP doesn't use lParam under CE -#ifndef __WXWINCE__ HELPINFO* info = (HELPINFO*) lParam; if ( info->iContextType == HELPINFO_WINDOW ) { -#endif // !__WXWINCE__ wxHelpEvent helpEvent ( wxEVT_HELP, GetId(), -#ifdef __WXWINCE__ - wxGetMousePosition() // what else? -#else wxPoint(info->MousePos.x, info->MousePos.y) -#endif ); helpEvent.SetEventObject(this); HandleWindowEvent(helpEvent); -#ifndef __WXWINCE__ } else if ( info->iContextType == HELPINFO_MENUITEM ) { @@ -3439,29 +3288,30 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, { processed = false; } -#endif // !__WXWINCE__ } break; #endif // WM_HELP -#if !defined(__WXWINCE__) case WM_CONTEXTMENU: { - // Ignore the events that are propagated from a child window by - // DefWindowProc(): as wxContextMenuEvent is already propagated - // upwards the window hierarchy by us, not doing this would - // result in duplicate events being sent. - WXHWND hWnd = (WXHWND)wParam; - if ( hWnd != m_hWnd ) + // As with WM_HELP above, we need to avoid duplicate events due + // to wxContextMenuEvent being a (propagatable) wxCommandEvent + // at wx level but WM_CONTEXTMENU also being propagated upwards + // by DefWindowProc(). Unlike WM_HELP, we still need to pass + // this one to DefWindowProc() as it sometimes does useful + // things with it, e.g. displays the default context menu in + // EDIT controls. So we do let the default processing to take + // place but set this flag before calling into DefWindowProc() + // and don't do anything if we're called from inside it. + static bool s_propagatedByDefWndProc = false; + if ( s_propagatedByDefWndProc ) { - wxWindowMSW *win = FindItemByHWND(hWnd); - if ( win && IsDescendant(win) ) - { - // We had already generated wxContextMenuEvent when we - // got WM_CONTEXTMENU for that window. - processed = true; - break; - } + // We could also return false from here, it shouldn't + // matter, the important thing is to not send any events. + // But returning true prevents the message from bubbling up + // even further upwards and so seems to be better. + processed = true; + break; } // we don't convert from screen to client coordinates as @@ -3469,14 +3319,44 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, wxPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU, GetId(), pt); - evtCtx.SetEventObject(this); - processed = HandleWindowEvent(evtCtx); + // we could have got an event from our child, reflect it back + // to it if this is the case + wxWindowMSW *win = NULL; + WXHWND hWnd = (WXHWND)wParam; + if ( hWnd != m_hWnd ) + { + win = FindItemByHWND(hWnd); + } + + if ( !win ) + win = this; + + evtCtx.SetEventObject(win); + processed = win->HandleWindowEvent(evtCtx); + + if ( !processed ) + { + // Temporarily set the flag before calling out. + s_propagatedByDefWndProc = true; + wxON_BLOCK_EXIT_SET(s_propagatedByDefWndProc, false); + + // Now do whatever the default handling does, which could + // be nothing at all -- but we can't know this, so we still + // need to call it. + win->MSWDefWindowProc(message, wParam, lParam); + + // And finally pretend that we processed the message in any + // case because otherwise DefWindowProc() that we're called + // from would pass the message to our parent resulting in + // duplicate events. As it is, we ensure that only one + // wxWindow ever gets this message for any given click. + processed = true; + } } break; -#endif -#if wxUSE_MENUS +#if wxUSE_MENUS && !defined(__WXUNIVERSAL__) case WM_MENUCHAR: // we're only interested in our own menus, not MF_SYSMENU if ( HIWORD(wParam) == MF_POPUP ) @@ -3490,9 +3370,26 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } } break; -#endif // wxUSE_MENUS -#ifndef __WXWINCE__ + case WM_INITMENUPOPUP: + processed = HandleMenuPopup(wxEVT_MENU_OPEN, (WXHMENU)wParam); + break; + + case WM_MENUSELECT: + { + WXWORD item, flags; + WXHMENU hmenu; + UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); + + processed = HandleMenuSelect(item, flags, hmenu); + } + break; + + case WM_UNINITMENUPOPUP: + processed = HandleMenuPopup(wxEVT_MENU_CLOSE, (WXHMENU)wParam); + break; +#endif // wxUSE_MENUS && !defined(__WXUNIVERSAL__) + case WM_POWERBROADCAST: { bool vetoed; @@ -3500,7 +3397,6 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, rc.result = processed && vetoed ? BROADCAST_QUERY_DENY : TRUE; } break; -#endif // __WXWINCE__ #if wxUSE_UXTHEME // If we want the default themed border then we need to draw it ourselves @@ -3804,7 +3700,6 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass, bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { -#ifndef __WXMICROWIN__ LPNMHDR hdr = (LPNMHDR)lParam; HWND hWnd = hdr->hwndFrom; wxWindow *win = wxFindWinFromHandle(hWnd); @@ -3838,9 +3733,6 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // by default, handle it ourselves return MSWOnNotify(idCtrl, lParam, result); -#else // __WXMICROWIN__ - return false; -#endif } #if wxUSE_TOOLTIPS @@ -3854,14 +3746,12 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code, // this message is supposed to be sent to Unicode programs only) -- hence // we need to handle it as well, otherwise no tooltips will be shown in // this case -#ifndef __WXWINCE__ if ( !(code == (WXUINT) TTN_NEEDTEXTA || code == (WXUINT) TTN_NEEDTEXTW) || ttip.empty() ) { // not a tooltip message or no tooltip to show anyhow return false; } -#endif LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam; @@ -4001,16 +3891,11 @@ bool wxWindowMSW::HandleEndSession(bool endSession, long logOff) // window creation/destruction // --------------------------------------------------------------------------- -bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT WXUNUSED_IN_WINCE(cs), +bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) { - // VZ: why is this commented out for WinCE? If it doesn't support - // WS_EX_CONTROLPARENT at all it should be somehow handled globally, - // not with multiple #ifdef's! -#ifndef __WXWINCE__ if ( ((CREATESTRUCT *)cs)->dwExStyle & WS_EX_CONTROLPARENT ) EnsureParentHasControlParentStyle(GetParent()); -#endif // !__WXWINCE__ *mayCreate = true; @@ -4038,9 +3923,19 @@ bool wxWindowMSW::HandleDestroy() // --------------------------------------------------------------------------- bool wxWindowMSW::HandleActivate(int state, - bool WXUNUSED(minimized), - WXHWND WXUNUSED(activate)) + bool minimized, + WXHWND WXUNUSED(activate)) { + if ( minimized ) + { + // Getting activation event when the window is minimized, as happens + // e.g. when the window task bar icon is clicked, is unexpected and + // managed to even break the logic in wx itself (see #17128), so just + // don't do it as there doesn't seem to be any need to be notified + // about the activation of the window icon in the task bar in practice. + return false; + } + wxActivateEvent event(wxEVT_ACTIVATE, (state == WA_ACTIVE) || (state == WA_CLICKACTIVE), m_windowId, @@ -4145,10 +4040,6 @@ bool wxWindowMSW::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam) { -#if defined (__WXMICROWIN__) || defined(__WXWINCE__) - wxUnusedVar(wParam); - return false; -#else // __WXMICROWIN__ HDROP hFilesInfo = (HDROP) wParam; // Get the total number of files dropped @@ -4182,7 +4073,6 @@ bool wxWindowMSW::HandleDropFiles(WXWPARAM wParam) DragFinish(hFilesInfo); return HandleWindowEvent(event); -#endif } @@ -4190,7 +4080,6 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), short nHitTest, int WXUNUSED(mouseMsg)) { -#ifndef __WXMICROWIN__ // the logic is as follows: // 0. if we're busy, set the busy cursor (even for non client elements) // 1. don't set custom cursor for non client area of enabled windows @@ -4198,7 +4087,20 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), // 3. if still no cursor but we're in a TLW, set the global cursor HCURSOR hcursor = 0; + + // Check for "business" is complicated by the fact that modal dialogs shown + // while busy cursor is in effect shouldn't show it as they are active and + // accept input from the user, unlike all the other windows. + bool isBusy = false; if ( wxIsBusy() ) + { + wxDialog* const + dlg = wxDynamicCast(wxGetTopLevelParent((wxWindow *)this), wxDialog); + if ( !dlg || !dlg->IsModal() ) + isBusy = true; + } + + if ( isBusy ) { hcursor = wxGetCurrentBusyCursor(); } @@ -4255,20 +4157,15 @@ bool wxWindowMSW::HandleSetCursor(WXHWND WXUNUSED(hWnd), // cursor set, stop here return true; } -#endif // __WXMICROWIN__ // pass up the window chain return false; } -bool wxWindowMSW::HandlePower(WXWPARAM WXUNUSED_IN_WINCE(wParam), +bool wxWindowMSW::HandlePower(WXWPARAM wParam, WXLPARAM WXUNUSED(lParam), - bool *WXUNUSED_IN_WINCE(vetoed)) + bool *vetoed) { -#ifdef __WXWINCE__ - // FIXME - return false; -#else wxEventType evtType; switch ( wParam ) { @@ -4321,7 +4218,6 @@ bool wxWindowMSW::HandlePower(WXWPARAM WXUNUSED_IN_WINCE(wParam), *vetoed = event.IsVetoed(); return true; -#endif } bool wxWindowMSW::IsDoubleBuffered() const @@ -4496,8 +4392,6 @@ bool wxWindowMSW::HandleDisplayChange() return HandleWindowEvent(event); } -#ifndef __WXMICROWIN__ - bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC hDC, WXHWND hWnd) { #if !wxUSE_CONTROLS || defined(__WXUNIVERSAL__) @@ -4515,8 +4409,6 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC hDC, WXHWND hWnd) return *brush != NULL; } -#endif // __WXMICROWIN__ - bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange) { #if wxUSE_PALETTE @@ -4826,11 +4718,15 @@ bool wxWindowMSW::HandlePaint() bool processed = HandleWindowEvent(event); - if ( processed && !wxDidCreatePaintDC ) + if ( wxDidCreatePaintDC && !processed ) { - // do call MSWDefWindowProc() to validate the update region to avoid - // the problems mentioned above - processed = false; + // Event handler did paint something as wxPaintDC object was created + // but then it must have skipped the event to indicate that default + // handling should still take place, so call MSWDefWindowProc() right + // now. It's important to do it before EndPaint() call below as that + // would validate the window and MSWDefWindowProc(WM_PAINT) wouldn't do + // anything if called after it. + OnPaint(event); } // note that we must generate NC event after the normal one as otherwise @@ -4846,7 +4742,14 @@ bool wxWindowMSW::HandlePaint() wxPaintDCImpl::EndPaint((wxWindow *)this); - return processed; + // It doesn't matter whether the event was actually processed or not here, + // what matters is whether we already painted, and hence validated, the + // window or not. If we did, either the event was processed or we called + // OnPaint() above, so we should return true. If we did not, even the event + // was processed, we must still call MSWDefWindowProc() to ensure that the + // window is validated, i.e. to avoid the problem described in the comment + // before wxDidCreatePaintDC definition above. + return wxDidCreatePaintDC; } // Can be called from an application's OnPaint handler @@ -5242,11 +5145,8 @@ bool wxWindowMSW::HandleSizing(wxRect& rect) return rc; } -bool wxWindowMSW::HandleGetMinMaxInfo(void *WXUNUSED_IN_WINCE(mmInfo)) +bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo) { -#ifdef __WXWINCE__ - return false; -#else MINMAXINFO *info = (MINMAXINFO *)mmInfo; bool rc = false; @@ -5281,7 +5181,6 @@ bool wxWindowMSW::HandleGetMinMaxInfo(void *WXUNUSED_IN_WINCE(mmInfo)) } return rc; -#endif } // --------------------------------------------------------------------------- @@ -5346,14 +5245,6 @@ bool wxWindowMSW::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND control) return true; #endif // wxUSE_SPINCTRL -#if wxUSE_CHOICE && defined(__SMARTPHONE__) - // the listbox ctrl which is logically part of wxChoice sends WM_COMMAND - // notifications to its parent which we want to reflect back to - // wxChoice - wxChoice *choice = wxChoice::GetChoiceForListBox(control); - if ( choice && choice->MSWCommand(cmd, id) ) - return true; -#endif } return false; @@ -5383,85 +5274,15 @@ void wxWindowMSW::InitMouseEvent(wxMouseEvent& event, #endif // wxHAS_XBUTTON event.m_altDown = ::wxIsAltDown(); -#ifndef __WXWINCE__ event.SetTimestamp(::GetMessageTime()); -#endif event.SetEventObject(this); event.SetId(GetId()); -#if wxUSE_MOUSEEVENT_HACK gs_lastMouseEvent.pos = ClientToScreen(wxPoint(x, y)); gs_lastMouseEvent.type = event.GetEventType(); -#endif // wxUSE_MOUSEEVENT_HACK } -#ifdef __WXWINCE__ -// Windows doesn't send the mouse events to the static controls (which are -// transparent in the sense that their WM_NCHITTEST handler returns -// HTTRANSPARENT) at all but we want all controls to receive the mouse events -// and so we manually check if we don't have a child window under mouse and if -// we do, send the event to it instead of the window Windows had sent WM_XXX -// to. -// -// Notice that this is not done for the mouse move events because this could -// (would?) be too slow, but only for clicks which means that the static texts -// still don't get move, enter nor leave events. -static wxWindowMSW *FindWindowForMouseEvent(wxWindowMSW *win, int *x, int *y) -{ - wxCHECK_MSG( x && y, win, wxT("NULL pointer in FindWindowForMouseEvent") ); - - // first try to find a non transparent child: this allows us to send events - // to a static text which is inside a static box, for example - POINT pt = { *x, *y }; - HWND hwnd = GetHwndOf(win), - hwndUnderMouse; - -#ifdef __WXWINCE__ - hwndUnderMouse = ::ChildWindowFromPoint - ( - hwnd, - pt - ); -#else - hwndUnderMouse = ::ChildWindowFromPointEx - ( - hwnd, - pt, - CWP_SKIPINVISIBLE | - CWP_SKIPDISABLED | - CWP_SKIPTRANSPARENT - ); -#endif - - if ( !hwndUnderMouse || hwndUnderMouse == hwnd ) - { - // now try any child window at all - hwndUnderMouse = ::ChildWindowFromPoint(hwnd, pt); - } - - // check that we have a child window which is susceptible to receive mouse - // events: for this it must be shown and enabled - if ( hwndUnderMouse && - hwndUnderMouse != hwnd && - ::IsWindowVisible(hwndUnderMouse) && - ::IsWindowEnabled(hwndUnderMouse) ) - { - wxWindow *winUnderMouse = wxFindWinFromHandle(hwndUnderMouse); - if ( winUnderMouse ) - { - // translate the mouse coords to the other window coords - win->ClientToScreen(x, y); - winUnderMouse->ScreenToClient(x, y); - - win = winUnderMouse; - } - } - - return win; -} -#endif // __WXWINCE__ - bool wxWindowMSW::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags) { // the mouse events take consecutive IDs from WM_MOUSEFIRST to @@ -5523,10 +5344,6 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags) #ifdef HAVE_TRACKMOUSEEVENT typedef BOOL (WINAPI *_TrackMouseEvent_t)(LPTRACKMOUSEEVENT); -#ifdef __WXWINCE__ - static const _TrackMouseEvent_t - s_pfn_TrackMouseEvent = _TrackMouseEvent; -#else // !__WXWINCE__ static _TrackMouseEvent_t s_pfn_TrackMouseEvent; static bool s_initDone = false; if ( !s_initDone ) @@ -5544,7 +5361,6 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags) } if ( s_pfn_TrackMouseEvent ) -#endif // __WXWINCE__/!__WXWINCE__ { WinStruct trackinfo; @@ -5574,7 +5390,6 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags) } #endif // HAVE_TRACKMOUSEEVENT -#if wxUSE_MOUSEEVENT_HACK // Windows often generates mouse events even if mouse position hasn't // changed (http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/66576) // @@ -5592,7 +5407,6 @@ bool wxWindowMSW::HandleMouseMove(int x, int y, WXUINT flags) return false; } } -#endif // wxUSE_MOUSEEVENT_HACK return HandleMouseEvent(WM_MOUSEMOVE, x, y, flags); } @@ -5606,9 +5420,15 @@ wxWindowMSW::HandleMouseWheel(wxMouseWheelAxis axis, // notice that WM_MOUSEWHEEL position is in screen coords (as it's // forwarded up to the parent by DefWindowProc()) and not in the client // ones as all the other messages, translate them to the client coords for - // consistency - const wxPoint - pt = ScreenToClient(wxPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + // consistency -- but do it using Windows function and not our own one + // because InitMouseEvent() expects coordinates in Windows client + // coordinates and not wx ones (the difference being the height of the + // toolbar, if any). + POINT pt; + pt.x = GET_X_LPARAM(lParam); + pt.y = GET_Y_LPARAM(lParam); + ::ScreenToClient(GetHwnd(), &pt); + wxMouseEvent event(wxEVT_MOUSEWHEEL); InitMouseEvent(event, pt.x, pt.y, LOWORD(wParam)); event.m_wheelRotation = (short)HIWORD(wParam); @@ -5721,9 +5541,7 @@ MSWInitAnyKeyEvent(wxKeyEvent& event, event.m_rawCode = (wxUint32) wParam; event.m_rawFlags = (wxUint32) lParam; -#ifndef __WXWINCE__ event.SetTimestamp(::GetMessageTime()); -#endif } } // anonymous namespace @@ -5834,12 +5652,9 @@ bool wxWindowMSW::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam) } #if wxUSE_MENUS -int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel), - WXLPARAM WXUNUSED_IN_WINCE(lParam)) +int wxWindowMSW::HandleMenuChar(int chAccel, + WXLPARAM lParam) { - // FIXME: implement GetMenuItemCount for WinCE, possibly - // in terms of GetMenuItemInfo -#ifndef __WXWINCE__ const HMENU hmenu = (HMENU)lParam; WinStruct mii; @@ -5899,7 +5714,6 @@ int wxWindowMSW::HandleMenuChar(int WXUNUSED_IN_WINCE(chAccel), wxLogLastError(wxT("GetMenuItemInfo")); } } -#endif return wxNOT_FOUND; } @@ -6245,6 +6059,24 @@ const struct wxKeyMapping { VK_RWIN, WXK_WINDOWS_RIGHT }, { VK_APPS, WXK_WINDOWS_MENU }, #endif // VK_APPS defined + + { VK_BROWSER_BACK, WXK_BROWSER_BACK }, + { VK_BROWSER_FORWARD, WXK_BROWSER_FORWARD }, + { VK_BROWSER_REFRESH, WXK_BROWSER_REFRESH }, + { VK_BROWSER_STOP, WXK_BROWSER_STOP }, + { VK_BROWSER_SEARCH, WXK_BROWSER_SEARCH }, + { VK_BROWSER_FAVORITES, WXK_BROWSER_FAVORITES }, + { VK_BROWSER_HOME, WXK_BROWSER_HOME }, + { VK_VOLUME_MUTE, WXK_VOLUME_MUTE }, + { VK_VOLUME_DOWN, WXK_VOLUME_DOWN }, + { VK_VOLUME_UP, WXK_VOLUME_UP }, + { VK_MEDIA_NEXT_TRACK, WXK_MEDIA_NEXT_TRACK }, + { VK_MEDIA_PREV_TRACK, WXK_MEDIA_PREV_TRACK }, + { VK_MEDIA_STOP, WXK_MEDIA_STOP }, + { VK_MEDIA_PLAY_PAUSE, WXK_MEDIA_PLAY_PAUSE }, + { VK_LAUNCH_MAIL, WXK_LAUNCH_MAIL }, + { VK_LAUNCH_APP1, WXK_LAUNCH_APP1 }, + { VK_LAUNCH_APP2, WXK_LAUNCH_APP2 }, }; } // anonymous namespace @@ -6284,6 +6116,7 @@ int VKToWX(WXWORD vk, WXLPARAM lParam, wchar_t *uc) case VK_OEM_5: case VK_OEM_6: case VK_OEM_7: + case VK_OEM_8: case VK_OEM_102: // MapVirtualKey() returns 0 if it fails to convert the virtual // key which nicely corresponds to our WXK_NONE. @@ -6473,9 +6306,6 @@ WXWORD WXToVK(int wxk, bool *isExtended) break; default: - // no VkKeyScan() under CE unfortunately, we need to test how does - // it handle OEM keys -#ifndef __WXWINCE__ // check to see if its one of the OEM key codes. BYTE vks = LOBYTE(VkKeyScan(wxk)); if ( vks != 0xff ) @@ -6483,7 +6313,6 @@ WXWORD WXToVK(int wxk, bool *isExtended) vk = vks; } else -#endif // !__WXWINCE__ { vk = (WXWORD)wxk; } @@ -6627,13 +6456,11 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) // FIXME: this is clearly not the best way to do it but I think we'll // need to change HWND <-> wxWindow code more heavily than I can // do it now to fix it -#ifndef __WXMICROWIN__ if ( ::GetWindow(hwnd, GW_OWNER) ) { // it's a dialog box, don't go upwards break; } -#endif hwnd = ::GetParent(hwnd); win = wxFindWinFromHandle(hwnd); @@ -6642,8 +6469,6 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) return win; } -#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) - // Windows keyboard hook. Allows interception of e.g. F1, ESCAPE // in active frames and dialogs, regardless of where the focus is. static HHOOK wxTheKeyboardHook = 0; @@ -6732,8 +6557,6 @@ void wxSetKeyboardHook(bool doIt) } } -#endif // !__WXMICROWIN__ - #if wxDEBUG_LEVEL >= 2 const wxChar *wxGetMessageName(int message) { @@ -7291,25 +7114,6 @@ wxPoint wxGetMousePosition() #if wxUSE_HOTKEY -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) -static void WinCEUnregisterHotKey(int modifiers, int id) -{ - // Register hotkeys for the hardware buttons - HINSTANCE hCoreDll; - typedef BOOL (WINAPI *UnregisterFunc1Proc)(UINT, UINT); - - UnregisterFunc1Proc procUnregisterFunc; - hCoreDll = LoadLibrary(wxT("coredll.dll")); - if (hCoreDll) - { - procUnregisterFunc = (UnregisterFunc1Proc)GetProcAddress(hCoreDll, wxT("UnregisterFunc1")); - if (procUnregisterFunc) - procUnregisterFunc(modifiers, id); - FreeLibrary(hCoreDll); - } -} -#endif - bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int keycode) { UINT win_modifiers=0; @@ -7322,12 +7126,6 @@ bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int keycode) if ( modifiers & wxMOD_WIN ) win_modifiers |= MOD_WIN; -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - // Required for PPC and Smartphone hardware buttons - if (keycode >= WXK_SPECIAL1 && keycode <= WXK_SPECIAL20) - WinCEUnregisterHotKey(win_modifiers, hotkeyId); -#endif - if ( !::RegisterHotKey(GetHwnd(), hotkeyId, win_modifiers, keycode) ) { wxLogLastError(wxT("RegisterHotKey")); @@ -7340,10 +7138,6 @@ bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int keycode) bool wxWindowMSW::UnregisterHotKey(int hotkeyId) { -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - WinCEUnregisterHotKey(MOD_WIN, hotkeyId); -#endif - if ( !::UnregisterHotKey(GetHwnd(), hotkeyId) ) { wxLogLastError(wxT("UnregisterHotKey")); @@ -7370,9 +7164,6 @@ bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) #endif // wxUSE_HOTKEY -// Not tested under WinCE -#ifndef __WXWINCE__ - // this class installs a message hook which really wakes up our idle processing // each time a WM_NULL is received (wxWakeUpIdle does this), even if we're // sitting inside a local modal loop (e.g. a menu is opened or scrollbar is @@ -7424,44 +7215,9 @@ public: private: static HHOOK ms_hMsgHookProc; - DECLARE_DYNAMIC_CLASS(wxIdleWakeUpModule) + wxDECLARE_DYNAMIC_CLASS(wxIdleWakeUpModule); }; HHOOK wxIdleWakeUpModule::ms_hMsgHookProc = 0; -IMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule) - -#endif // __WXWINCE__ - -#ifdef __WXWINCE__ - -#if wxUSE_STATBOX -static void wxAdjustZOrder(wxWindow* parent) -{ - if (wxDynamicCast(parent, wxStaticBox)) - { - // Set the z-order correctly - SetWindowPos((HWND) parent->GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - } - - wxWindowList::compatibility_iterator current = parent->GetChildren().GetFirst(); - while (current) - { - wxWindow *childWin = current->GetData(); - wxAdjustZOrder(childWin); - current = current->GetNext(); - } -} -#endif - -// We need to adjust the z-order of static boxes in WinCE, to -// make 'contained' controls visible -void wxWindowMSW::OnInitDialog( wxInitDialogEvent& event ) -{ -#if wxUSE_STATBOX - wxAdjustZOrder(this); -#endif - - event.Skip(); -} -#endif +wxIMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule); diff --git a/Externals/wxWidgets3/src/osx/accel.cpp b/Externals/wxWidgets3/src/osx/accel.cpp index 389f6fb5f2..49ca614533 100644 --- a/Externals/wxWidgets3/src/osx/accel.cpp +++ b/Externals/wxWidgets3/src/osx/accel.cpp @@ -18,7 +18,7 @@ #include "wx/string.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject); // ---------------------------------------------------------------------------- // wxAccelList: a list of wxAcceleratorEntries diff --git a/Externals/wxWidgets3/src/osx/anybutton_osx.cpp b/Externals/wxWidgets3/src/osx/anybutton_osx.cpp index 8a417aff56..8fc481a544 100644 --- a/Externals/wxWidgets3/src/osx/anybutton_osx.cpp +++ b/Externals/wxWidgets3/src/osx/anybutton_osx.cpp @@ -22,10 +22,10 @@ #include "wx/osx/private.h" -BEGIN_EVENT_TABLE(wxAnyButton, wxControl) +wxBEGIN_EVENT_TABLE(wxAnyButton, wxControl) EVT_ENTER_WINDOW(wxAnyButton::OnEnterWindow) EVT_LEAVE_WINDOW(wxAnyButton::OnLeaveWindow) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxAnyButton::SetLabel(const wxString& label) { diff --git a/Externals/wxWidgets3/src/osx/artmac.cpp b/Externals/wxWidgets3/src/osx/artmac.cpp index d72da8b768..8b6b14079c 100644 --- a/Externals/wxWidgets3/src/osx/artmac.cpp +++ b/Externals/wxWidgets3/src/osx/artmac.cpp @@ -35,12 +35,12 @@ class wxMacArtProvider : public wxArtProvider protected: #if wxOSX_USE_COCOA_OR_CARBON virtual wxIconBundle CreateIconBundle(const wxArtID& id, - const wxArtClient& client); + const wxArtClient& client) wxOVERRIDE; #endif #if wxOSX_USE_COCOA_OR_IPHONE virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, - const wxSize& size) + const wxSize& size) wxOVERRIDE { return wxOSXCreateSystemBitmap(id, client, size); } @@ -87,6 +87,7 @@ static wxIconBundle wxMacArtProvider_CreateIconBundle(const wxArtID& id) ART_MSGBOX(wxART_FLOPPY, wxICON_FLOPPY, floppy) ART_MSGBOX(wxART_HARDDISK, wxICON_HARDDISK, harddisk) ART_MSGBOX(wxART_REMOVABLE, wxICON_REMOVABLE, removable) + ART_MSGBOX(wxART_PRINT, wxICON_PRINT, print) ART_MSGBOX(wxART_DELETE, wxICON_DELETE, delete) @@ -96,6 +97,7 @@ static wxIconBundle wxMacArtProvider_CreateIconBundle(const wxArtID& id) ART_MSGBOX(wxART_HELP_SETTINGS, wxICON_HELP_SETTINGS, htmoptns) ART_MSGBOX(wxART_HELP_PAGE, wxICON_HELP_PAGE, htmpage) + ART_MSGBOX(wxART_HELP_FOLDER, wxICON_HELP_FOLDER, htmlfoldr) return wxNullIconBundle; } diff --git a/Externals/wxWidgets3/src/osx/brush.cpp b/Externals/wxWidgets3/src/osx/brush.cpp index a71c45d0f5..9effab162a 100644 --- a/Externals/wxWidgets3/src/osx/brush.cpp +++ b/Externals/wxWidgets3/src/osx/brush.cpp @@ -18,7 +18,7 @@ #include "wx/osx/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject); class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { @@ -99,12 +99,10 @@ wxBrush::wxBrush(const wxColour& col, wxBrushStyle style) m_refData = new wxBrushRefData( col, style ); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxBrush::wxBrush(const wxColour& col, int style) { m_refData = new wxBrushRefData(col, (wxBrushStyle)style); } -#endif wxBrush::wxBrush(const wxBitmap& stipple) { diff --git a/Externals/wxWidgets3/src/osx/button_osx.cpp b/Externals/wxWidgets3/src/osx/button_osx.cpp index e604d21483..8895171565 100644 --- a/Externals/wxWidgets3/src/osx/button_osx.cpp +++ b/Externals/wxWidgets3/src/osx/button_osx.cpp @@ -69,12 +69,15 @@ bool wxButton::Create(wxWindow *parent, wxString label; - // Ignore the standard label for help buttons if possible, they use "?" - // label under Mac which looks better. - if ( !IsHelpButtonWithStandardLabel(id, labelOrig) ) + if ( !(style & wxBU_NOTEXT) ) { - label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id) - : labelOrig; + // Ignore the standard label for help buttons if possible, they use "?" + // label under Mac which looks better. + if ( !IsHelpButtonWithStandardLabel(id, labelOrig) ) + { + label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id) + : labelOrig; + } } @@ -138,57 +141,3 @@ wxSize wxButtonBase::GetDefaultSize() { return wxAnyButton::GetDefaultSize(); } - -//------------------------------------------------------- -// wxDisclosureTriangle -//------------------------------------------------------- - -bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxString& label, - const wxPoint& pos, const wxSize& size, long style,const wxValidator& validator, const wxString& name ) -{ - DontCreatePeer(); - if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) - return false; - - SetPeer(wxWidgetImpl::CreateDisclosureTriangle(this, parent, id, label, pos, size, style, GetExtraStyle() )); - - MacPostControlCreate( pos, size ); - // passing the text in the param doesn't seem to work, so let's do it again - SetLabel( label ); - - return true; -} - -void wxDisclosureTriangle::SetOpen( bool open ) -{ - GetPeer()->SetValue( open ? 1 : 0 ); -} - -bool wxDisclosureTriangle::IsOpen() const -{ - return GetPeer()->GetValue() == 1; -} - -bool wxDisclosureTriangle::OSXHandleClicked( double WXUNUSED(timestampsec) ) -{ - // Just emit button event for now - wxCommandEvent event(wxEVT_BUTTON, m_windowId); - event.SetEventObject(this); - ProcessCommand(event); - - return true; -} - -wxSize wxDisclosureTriangle::DoGetBestSize() const -{ - wxSize size = wxWindow::DoGetBestSize(); - - // under Carbon the base class GetBestSize() implementation doesn't seem to - // take the label into account at all, correct for it here -#if wxOSX_USE_CARBON - size.x += GetTextExtent(GetLabel()).x; -#endif // wxOSX_USE_CARBON - - return size; -} - diff --git a/Externals/wxWidgets3/src/osx/carbon/Info.plist.in b/Externals/wxWidgets3/src/osx/carbon/Info.plist.in index f53a692e68..70807ce631 100644 --- a/Externals/wxWidgets3/src/osx/carbon/Info.plist.in +++ b/Externals/wxWidgets3/src/osx/carbon/Info.plist.in @@ -32,11 +32,11 @@ CFBundleShortVersionString VERSION CFBundleGetInfoString - EXECUTABLE version VERSION, (c) 2002-2012 wxWidgets + EXECUTABLE version VERSION, (c) 2002-2016 wxWidgets CFBundleLongVersionString - VERSION, (c) 2002-2012 wxWidgets + VERSION, (c) 2002-2016 wxWidgets NSHumanReadableCopyright - Copyright 2002-2012 wxWidgets + Copyright 2002-2016 wxWidgets LSRequiresCarbon CSResourcesFileMapped diff --git a/Externals/wxWidgets3/src/osx/carbon/aboutdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/aboutdlg.cpp deleted file mode 100644 index 37ad8f4d7d..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/aboutdlg.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/aboutdlg.cpp -// Purpose: native wxAboutBox() implementation for wxMac -// Author: Vadim Zeitlin -// Created: 2006-10-08 -// Copyright: (c) 2006 Vadim Zeitlin -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if wxUSE_ABOUTDLG - -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - -#include "wx/aboutdlg.h" -#include "wx/generic/aboutdlgg.h" - -#include "wx/osx/private.h" - -// helper class for HIAboutBox options -class AboutBoxOptions : public wxCFRef -{ -public: - AboutBoxOptions() : wxCFRef - ( - CFDictionaryCreateMutable - ( - kCFAllocatorDefault, - 4, // there are at most 4 values - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks - ) - ) - { - } - - void Set(CFStringRef key, const wxString& value) - { - CFDictionarySetValue(*this, key, wxCFStringRef(value)); - } -}; - -// ============================================================================ -// implementation -// ============================================================================ - -void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent) -{ - // Mac native about box currently can show only name, version, copyright - // and description fields and we also shoehorn the credits text into the - // description but if we have anything else we must use the generic version - - if ( info.IsSimple() ) - { - AboutBoxOptions opts; - - opts.Set(kHIAboutBoxNameKey, info.GetName()); - - if ( info.HasVersion() ) - opts.Set(kHIAboutBoxVersionKey,info.GetLongVersion()); - - if ( info.HasCopyright() ) - opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyrightToDisplay()); - - opts.Set(kHIAboutBoxDescriptionKey, info.GetDescriptionAndCredits()); - - HIAboutBox(opts); - } - else // simple "native" version is not enough - { - // we need to use the full-blown generic version - wxGenericAboutBox(info, parent); - } -} - -#endif // wxUSE_ABOUTDLG diff --git a/Externals/wxWidgets3/src/osx/carbon/anybutton.cpp b/Externals/wxWidgets3/src/osx/carbon/anybutton.cpp deleted file mode 100644 index 0788b23c84..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/anybutton.cpp +++ /dev/null @@ -1,122 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/anybutton.cpp -// Purpose: wxAnyButton -// Author: Stefan Csomor -// Created: 1998-01-01 (extracted from button.cpp) -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/anybutton.h" - -#ifndef WX_PRECOMP - #include "wx/panel.h" - #include "wx/toplevel.h" - #include "wx/dcclient.h" -#endif - -#include "wx/stockitem.h" - -#include "wx/osx/private.h" - -wxSize wxAnyButton::DoGetBestSize() const -{ - if ( GetId() == wxID_HELP ) - return wxSize( 20 , 20 ) ; - - wxSize sz = GetDefaultSize() ; - - switch (GetWindowVariant()) - { - case wxWINDOW_VARIANT_NORMAL: - case wxWINDOW_VARIANT_LARGE: - sz.y = 20 ; - break; - - case wxWINDOW_VARIANT_SMALL: - sz.y = 17 ; - break; - - case wxWINDOW_VARIANT_MINI: - sz.y = 15 ; - break; - - default: - break; - } - -#if wxOSX_USE_CARBON - Rect bestsize = { 0 , 0 , 0 , 0 } ; - GetPeer()->GetBestRect( &bestsize ) ; - - int wBtn; - if ( GetBitmapLabel().IsOk() ) - { - sz.x = bestsize.right - bestsize.left ; - sz.y = bestsize.bottom - bestsize.top ; - sz.x = sz.x + MacGetLeftBorderSize() + - MacGetRightBorderSize(); - sz.y = sz.y + MacGetTopBorderSize() + - MacGetBottomBorderSize(); - wBtn = sz.x; - } - else if ( EmptyRect( &bestsize ) || ( GetWindowStyle() & wxBU_EXACTFIT) ) - { - Point bounds; - - ControlFontStyleRec controlFont; - OSStatus err = GetPeer()->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); - verify_noerr( err ); - - // GetThemeTextDimensions will cache strings and the documentation - // says not to use the NoCopy string creation calls. - // This also means that we can't use CFSTR without - // -fno-constant-cfstrings if the library might be unloaded, - // as GetThemeTextDimensions may cache a pointer to our - // unloaded segment. - wxCFStringRef str( !m_label.empty() ? m_label : wxString(" "), - GetFont().GetEncoding() ); - -#if wxOSX_USE_ATSU_TEXT - SInt16 baseline; - if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont ) - { - err = GetThemeTextDimensions( - (CFStringRef)str, - m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline ); - verify_noerr( err ); - } - else -#endif - { - wxClientDC dc(const_cast(this)); - wxCoord width, height ; - dc.GetTextExtent( m_label , &width, &height); - bounds.h = width; - bounds.v = height; - } - - wBtn = bounds.h + sz.y; - } - else - { - wBtn = bestsize.right - bestsize.left ; - // non 'normal' window variants don't return the correct height - // sz.y = bestsize.bottom - bestsize.top ; - } - if ((wBtn > sz.x) || ( GetWindowStyle() & wxBU_EXACTFIT)) - sz.x = wBtn; -#endif - - return sz ; -} - -wxSize wxAnyButton::GetDefaultSize() -{ - int wBtn = 70 ; - int hBtn = 20 ; - - return wxSize(wBtn, hBtn); -} diff --git a/Externals/wxWidgets3/src/osx/carbon/app.cpp b/Externals/wxWidgets3/src/osx/carbon/app.cpp index 1a3d426aaa..fec23b9533 100644 --- a/Externals/wxWidgets3/src/osx/carbon/app.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/app.cpp @@ -44,11 +44,7 @@ #include // mac -#if wxOSX_USE_CARBON -#include "wx/osx/uma.h" -#else #include "wx/osx/private.h" -#endif #if defined(WXMAKINGDLL_CORE) # include @@ -57,17 +53,14 @@ // Keep linker from discarding wxStockGDIMac wxFORCE_LINK_MODULE(gdiobj) -IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler); +wxBEGIN_EVENT_TABLE(wxApp, wxEvtHandler) EVT_IDLE(wxApp::OnIdle) EVT_END_SESSION(wxApp::OnEndSession) EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -// platform specific static variables -static const short kwxMacAppleMenuId = 1 ; - wxWindow* wxApp::s_captureWindow = NULL ; long wxApp::s_lastModifiers = 0 ; @@ -78,210 +71,6 @@ wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ; bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin -#if wxOSX_USE_CARBON - -//---------------------------------------------------------------------- -// Core Apple Event Support -//---------------------------------------------------------------------- - -AEEventHandlerUPP sODocHandler = NULL ; -AEEventHandlerUPP sGURLHandler = NULL ; -AEEventHandlerUPP sOAppHandler = NULL ; -AEEventHandlerUPP sPDocHandler = NULL ; -AEEventHandlerUPP sRAppHandler = NULL ; -AEEventHandlerUPP sQuitHandler = NULL ; - -pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; -pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; -pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; -pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; -pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; -pascal OSErr AEHandleGURL( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; - -pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ; -} - -pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ; -} - -pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ; -} - -pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ; -} - -pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAERApp( (AppleEvent*) event , reply) ; -} - -pascal OSErr AEHandleGURL( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) -{ - return wxTheApp->MacHandleAEGURL((WXEVENTREF *)event , reply) ; -} - - -// AEODoc Calls MacOpenFiles with all of the files passed - -short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) -{ - AEDescList docList; - AEKeyword keywd; - DescType returnedType; - Size actualSize; - long itemsInList; - OSErr err; - short i; - - err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); - if (err != noErr) - return err; - - err = AECountItems(&docList, &itemsInList); - if (err != noErr) - return err; - - ProcessSerialNumber PSN ; - PSN.highLongOfPSN = 0 ; - PSN.lowLongOfPSN = kCurrentProcess ; - SetFrontProcess( &PSN ) ; - - wxString fName ; - FSRef theRef ; - - wxArrayString fileNames; - for (i = 1; i <= itemsInList; i++) - { - err = AEGetNthPtr( - &docList, i, typeFSRef, &keywd, &returnedType, - (Ptr)&theRef, sizeof(theRef), &actualSize); - - if ( err != noErr) - return err; - - fName = wxMacFSRefToPath( &theRef ) ; - - fileNames.Add(fName); - } - - MacOpenFiles(fileNames); - - return noErr; -} - -// AEODoc Calls MacOpenURL on the url passed - -short wxApp::MacHandleAEGURL(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) -{ - DescType returnedType; - Size actualSize; - char url[255]; - OSErr err = AEGetParamPtr((AppleEvent *)event, keyDirectObject, typeChar, - &returnedType, url, sizeof(url)-1, - &actualSize); - if (err != noErr) - return err; - - url[actualSize] = '\0'; // Terminate the C string - - ProcessSerialNumber PSN ; - PSN.highLongOfPSN = 0 ; - PSN.lowLongOfPSN = kCurrentProcess ; - SetFrontProcess( &PSN ) ; - - MacOpenURL(wxString(url, wxConvUTF8)); - - return noErr; -} - -// AEPDoc Calls MacPrintFile on each of the files passed - -short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)) -{ - AEDescList docList; - AEKeyword keywd; - DescType returnedType; - Size actualSize; - long itemsInList; - OSErr err; - short i; - - err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); - if (err != noErr) - return err; - - err = AECountItems(&docList, &itemsInList); - if (err != noErr) - return err; - - ProcessSerialNumber PSN ; - PSN.highLongOfPSN = 0 ; - PSN.lowLongOfPSN = kCurrentProcess ; - SetFrontProcess( &PSN ) ; - - wxString fName ; - FSRef theRef ; - - wxArrayString fileNames; - - for (i = 1; i <= itemsInList; i++) - { - err = AEGetNthPtr( - &docList, i, typeFSRef, &keywd, &returnedType, - (Ptr)&theRef, sizeof(theRef), &actualSize); - - if ( err != noErr) - return err; - - fName = wxMacFSRefToPath( &theRef ) ; - fileNames.Add( fName ); - } - - MacPrintFiles(fileNames); - - return noErr; -} - -// AEOApp calls MacNewFile - -short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) -{ - MacNewFile() ; - return noErr ; -} - -// AEQuit attempts to quit the application - -short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) -{ - wxCloseEvent event; - wxTheApp->OnQueryEndSession(event); - if ( !event.GetVeto() ) - { - wxCloseEvent event; - wxTheApp->OnEndSession(event); - } - return noErr ; -} - -// AEROApp calls MacReopenApp - -short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) -{ - MacReopenApp() ; - - return noErr ; -} - -#endif //---------------------------------------------------------------------- // Support Routines linking the Mac...File Calls to the Document Manager @@ -420,361 +209,30 @@ void wxApp::OSXOnWillFinishLaunching() void wxApp::OSXOnDidFinishLaunching() { + // on cocoa we cannot do this, as it would arrive "AFTER" an OpenFiles event +#if wxOSX_USE_IPHONE + wxTheApp->OnInit(); +#endif } void wxApp::OSXOnWillTerminate() { - wxCloseEvent event; + wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY); + event.SetEventObject(this); event.SetCanVeto(false); - wxTheApp->OnEndSession(event); + ProcessEvent(event); } bool wxApp::OSXOnShouldTerminate() { - wxCloseEvent event; - wxTheApp->OnQueryEndSession(event); + wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY); + event.SetEventObject(this); + event.SetCanVeto(true); + ProcessEvent(event); return !event.GetVeto(); } #endif -//---------------------------------------------------------------------- -// Macintosh CommandID support - converting between native and wx IDs -//---------------------------------------------------------------------- - -// if no native match they just return the passed-in id - -#if wxOSX_USE_CARBON - -struct IdPair -{ - UInt32 macId ; - int wxId ; -} ; - -IdPair gCommandIds [] = -{ - { kHICommandCut , wxID_CUT } , - { kHICommandCopy , wxID_COPY } , - { kHICommandPaste , wxID_PASTE } , - { kHICommandSelectAll , wxID_SELECTALL } , - { kHICommandClear , wxID_CLEAR } , - { kHICommandUndo , wxID_UNDO } , - { kHICommandRedo , wxID_REDO } , -} ; - -int wxMacCommandToId( UInt32 macCommandId ) -{ - int wxid = 0 ; - - switch ( macCommandId ) - { - case kHICommandPreferences : - wxid = wxApp::s_macPreferencesMenuItemId ; - break ; - - case kHICommandQuit : - wxid = wxApp::s_macExitMenuItemId ; - break ; - - case kHICommandAbout : - wxid = wxApp::s_macAboutMenuItemId ; - break ; - - default : - { - for ( size_t i = 0 ; i < WXSIZEOF(gCommandIds) ; ++i ) - { - if ( gCommandIds[i].macId == macCommandId ) - { - wxid = gCommandIds[i].wxId ; - break ; - } - } - } - break ; - } - - if ( wxid == 0 ) - wxid = (int) macCommandId ; - - return wxid ; -} - -UInt32 wxIdToMacCommand( int wxId ) -{ - UInt32 macId = 0 ; - - if ( wxId == wxApp::s_macPreferencesMenuItemId ) - macId = kHICommandPreferences ; - else if (wxId == wxApp::s_macExitMenuItemId) - macId = kHICommandQuit ; - else if (wxId == wxApp::s_macAboutMenuItemId) - macId = kHICommandAbout ; - else - { - for ( size_t i = 0 ; i < WXSIZEOF(gCommandIds) ; ++i ) - { - if ( gCommandIds[i].wxId == wxId ) - { - macId = gCommandIds[i].macId ; - break ; - } - } - } - - if ( macId == 0 ) - macId = (int) wxId ; - - return macId ; -} - -wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item ) -{ - wxMenu* itemMenu = NULL ; -#ifndef __WXUNIVERSAL__ - int id = 0 ; - - // for 'standard' commands which don't have a wx-menu - if ( command.commandID == kHICommandPreferences || command.commandID == kHICommandQuit || command.commandID == kHICommandAbout ) - { - id = wxMacCommandToId( command.commandID ) ; - - wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ; - if ( mbar ) - item = mbar->FindItem( id , &itemMenu ) ; - } - else if ( command.commandID != 0 && command.menu.menuRef != 0 && command.menu.menuItemIndex != 0 ) - { - id = wxMacCommandToId( command.commandID ) ; - // make sure it is one of our own menus, or of the 'synthetic' apple and help menus , otherwise don't touch - MenuItemIndex firstUserHelpMenuItem ; - static MenuHandle helpMenuHandle = NULL ; - if ( helpMenuHandle == NULL ) - { - if ( UMAGetHelpMenuDontCreate( &helpMenuHandle , &firstUserHelpMenuItem) != noErr ) - helpMenuHandle = NULL ; - } - - // is it part of the application or the Help menu, then look for the id directly - if ( ( GetMenuHandle( kwxMacAppleMenuId ) != NULL && command.menu.menuRef == GetMenuHandle( kwxMacAppleMenuId ) ) || - ( helpMenuHandle != NULL && command.menu.menuRef == helpMenuHandle ) || - wxMenuBar::MacGetWindowMenuHMenu() != NULL && command.menu.menuRef == wxMenuBar::MacGetWindowMenuHMenu() ) - { - wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ; - if ( mbar ) - item = mbar->FindItem( id , &itemMenu ) ; - } - else - { - URefCon refCon = 0 ; - - GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ; - itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ; - if ( itemMenu != NULL && refCon != 0) - item = (wxMenuItem*) refCon; - } - } -#endif - return itemMenu ; -} - -#endif - -//---------------------------------------------------------------------- -// Carbon Event Handler -//---------------------------------------------------------------------- - -#if wxOSX_USE_CARBON - -static const EventTypeSpec eventList[] = -{ - { kEventClassCommand, kEventProcessCommand } , - { kEventClassCommand, kEventCommandUpdateStatus } , - - { kEventClassMenu, kEventMenuOpening }, - { kEventClassMenu, kEventMenuClosed }, - { kEventClassMenu, kEventMenuTargetItem }, - - { kEventClassApplication , kEventAppActivated } , - { kEventClassApplication , kEventAppDeactivated } , - // handling the quit event is not recommended by apple - // rather using the quit apple event - which we do - - { kEventClassAppleEvent , kEventAppleEvent } , - - { kEventClassMouse , kEventMouseDown } , - { kEventClassMouse , kEventMouseMoved } , - { kEventClassMouse , kEventMouseUp } , - { kEventClassMouse , kEventMouseDragged } , - { 'WXMC' , 'WXMC' } -} ; - -static pascal OSStatus -wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler), - EventRef event, - void *WXUNUSED(data) ) -{ - wxMacCarbonEvent cEvent( event ) ; - MenuRef menuRef = cEvent.GetParameter(kEventParamDirectObject) ; -#ifndef __WXUNIVERSAL__ - wxMenu* menu = wxFindMenuFromMacMenu( menuRef ) ; - - if ( menu ) - { - switch (GetEventKind(event)) - { - case kEventMenuOpening: - menu->HandleMenuOpened(); - break; - - case kEventMenuClosed: - menu->HandleMenuClosed(); - break; - - case kEventMenuTargetItem: - { - HICommand command ; - - command.menu.menuRef = menuRef; - command.menu.menuItemIndex = cEvent.GetParameter(kEventParamMenuItemIndex,typeMenuItemIndex) ; - command.commandID = cEvent.GetParameter(kEventParamMenuCommand,typeMenuCommand) ; - if (command.commandID != 0) - { - wxMenuItem* item = NULL ; - wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ; - if ( itemMenu && item ) - itemMenu->HandleMenuItemHighlighted( item ); - } - } - break; - - default: - wxFAIL_MSG(wxT("Unexpected menu event kind")); - break; - } - - } -#endif - return eventNotHandledErr; -} - -static pascal OSStatus -wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) , - EventRef event , - void *WXUNUSED(data) ) -{ - OSStatus result = eventNotHandledErr ; - - HICommand command ; - - wxMacCarbonEvent cEvent( event ) ; - cEvent.GetParameter(kEventParamDirectObject,typeHICommand,&command) ; - - wxMenuItem* item = NULL ; - wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ; - - if ( item ) - { - wxASSERT( itemMenu != NULL ) ; - - switch ( cEvent.GetKind() ) - { - case kEventProcessCommand : - if ( itemMenu->HandleCommandProcess( item ) ) - result = noErr; - break ; - - case kEventCommandUpdateStatus: - if ( itemMenu->HandleCommandUpdateStatus( item ) ) - result = noErr; - break ; - - default : - break ; - } - } - return result ; -} - -static pascal OSStatus -wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) , - EventRef event , - void *WXUNUSED(data) ) -{ - OSStatus result = eventNotHandledErr ; - switch ( GetEventKind( event ) ) - { - case kEventAppActivated : - if ( wxTheApp ) - wxTheApp->SetActive( true , NULL ) ; - result = noErr ; - break ; - - case kEventAppDeactivated : - if ( wxTheApp ) - wxTheApp->SetActive( false , NULL ) ; - result = noErr ; - break ; - - default : - break ; - } - - return result ; -} - -pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - EventRef formerEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ; - EventHandlerCallRef formerEventHandlerCallRef = (EventHandlerCallRef) wxTheApp->MacGetCurrentEventHandlerCallRef() ; - wxTheApp->MacSetCurrentEvent( event , handler ) ; - - OSStatus result = eventNotHandledErr ; - switch ( GetEventClass( event ) ) - { -#ifndef __LP64__ - case kEventClassCommand : - result = wxMacAppCommandEventHandler( handler , event , data ) ; - break ; -#endif - case kEventClassApplication : - result = wxMacAppApplicationEventHandler( handler , event , data ) ; - break ; -#ifndef __LP64__ - case kEventClassMenu : - result = wxMacAppMenuEventHandler( handler , event , data ) ; - break ; - - case kEventClassMouse : - { - wxMacCarbonEvent cEvent( event ) ; - - WindowRef window ; - Point screenMouseLocation = cEvent.GetParameter(kEventParamMouseLocation) ; - ::FindWindow(screenMouseLocation, &window); - // only send this event in case it had not already been sent to a tlw, as we get - // double events otherwise (in case event.skip) was called - if ( window == NULL ) - result = wxMacTopLevelMouseEventHandler( handler , event , NULL ) ; - } - break ; -#endif - case kEventClassAppleEvent : - result = AEProcessEvent(event); - break ; - - default : - break ; - } - - wxTheApp->MacSetCurrentEvent( formerEvent, formerEventHandlerCallRef ) ; - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler ) -#endif - #if wxDEBUG_LEVEL && wxOSX_USE_COCOA_OR_CARBON pascal static void @@ -884,14 +342,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv) return true; } -#if wxOSX_USE_CARBON -bool wxApp::CallOnInit() -{ - wxMacAutoreleasePool autoreleasepool; - return OnInit(); -} -#endif - bool wxApp::OnInitGui() { if ( !wxAppBase::OnInitGui() ) @@ -915,77 +365,6 @@ int wxApp::OnRun() return wxAppBase::OnRun(); } -#if wxOSX_USE_CARBON -bool wxApp::DoInitGui() -{ - InstallStandardEventHandler( GetApplicationEventTarget() ) ; - if (!sm_isEmbedded) - { - InstallApplicationEventHandler( - GetwxMacAppEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler)); - } - - if (!sm_isEmbedded) - { - sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ; - sGURLHandler = NewAEEventHandlerUPP(AEHandleGURL) ; - sOAppHandler = NewAEEventHandlerUPP(AEHandleOApp) ; - sPDocHandler = NewAEEventHandlerUPP(AEHandlePDoc) ; - sRAppHandler = NewAEEventHandlerUPP(AEHandleRApp) ; - sQuitHandler = NewAEEventHandlerUPP(AEHandleQuit) ; - - AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , - sODocHandler , 0 , FALSE ) ; - AEInstallEventHandler( kInternetEventClass, kAEGetURL, - sGURLHandler , 0 , FALSE ) ; - AEInstallEventHandler( kCoreEventClass , kAEOpenApplication , - sOAppHandler , 0 , FALSE ) ; - AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , - sPDocHandler , 0 , FALSE ) ; - AEInstallEventHandler( kCoreEventClass , kAEReopenApplication , - sRAppHandler , 0 , FALSE ) ; - AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , - sQuitHandler , 0 , FALSE ) ; - } - - if ( !wxMacInitCocoa() ) - return false; - - return true; -} - -void wxApp::DoCleanUp() -{ - if (!sm_isEmbedded) - RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) ); - - if (!sm_isEmbedded) - { - AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments , - sODocHandler , FALSE ) ; - AERemoveEventHandler( kInternetEventClass, kAEGetURL, - sGURLHandler , FALSE ) ; - AERemoveEventHandler( kCoreEventClass , kAEOpenApplication , - sOAppHandler , FALSE ) ; - AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments , - sPDocHandler , FALSE ) ; - AERemoveEventHandler( kCoreEventClass , kAEReopenApplication , - sRAppHandler , FALSE ) ; - AERemoveEventHandler( kCoreEventClass , kAEQuitApplication , - sQuitHandler , FALSE ) ; - - DisposeAEEventHandlerUPP( sODocHandler ) ; - DisposeAEEventHandlerUPP( sGURLHandler ) ; - DisposeAEEventHandlerUPP( sOAppHandler ) ; - DisposeAEEventHandlerUPP( sPDocHandler ) ; - DisposeAEEventHandlerUPP( sRAppHandler ) ; - DisposeAEEventHandlerUPP( sQuitHandler ) ; - } -} - -#endif - void wxApp::CleanUp() { wxMacAutoreleasePool autoreleasepool; @@ -1395,34 +774,10 @@ int wxMacKeyCodeToModifier(wxKeyCode key) } #endif -#if wxOSX_USE_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 +#if wxOSX_USE_COCOA // defined in utils.mm -#elif wxOSX_USE_COCOA_OR_CARBON - -wxMouseState wxGetMouseState() -{ - wxMouseState ms; - - wxPoint pt = wxGetMousePosition(); - ms.SetX(pt.x); - ms.SetY(pt.y); - - UInt32 buttons = GetCurrentButtonState(); - ms.SetLeftDown( (buttons & 0x01) != 0 ); - ms.SetMiddleDown( (buttons & 0x04) != 0 ); - ms.SetRightDown( (buttons & 0x02) != 0 ); - - UInt32 modifiers = GetCurrentKeyModifiers(); - ms.SetRawControlDown(modifiers & controlKey); - ms.SetShiftDown(modifiers & shiftKey); - ms.SetAltDown(modifiers & optionKey); - ms.SetControlDown(modifiers & cmdKey); - - return ms; -} - #endif // TODO : once the new key/char handling is tested, move all the code to wxWindow @@ -1458,79 +813,6 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers bool handled = false ; -#if wxOSX_USE_CARBON - long keyval = event.m_keyCode ; - - { - wxKeyEvent eventCharHook(wxEVT_CHAR_HOOK, event); - handled = focus->HandleWindowEvent( eventCharHook ); - if ( handled && eventCharHook.IsNextEventAllowed() ) - handled = false ; - } - - if ( !handled ) - { - handled = focus->HandleWindowEvent( event ) ; - } - - if ( !handled && (keyval == WXK_TAB) ) - { - wxWindow* iter = focus->GetParent() ; - while ( iter && !handled ) - { - if ( iter->HasFlag( wxTAB_TRAVERSAL ) ) - { - wxNavigationKeyEvent new_event; - new_event.SetEventObject( focus ); - new_event.SetDirection( !event.ShiftDown() ); - /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */ - new_event.SetWindowChange( event.ControlDown() ); - new_event.SetCurrentFocus( focus ); - handled = focus->GetParent()->HandleWindowEvent( new_event ); - if ( handled && new_event.GetSkipped() ) - handled = false ; - } - - iter = iter->GetParent() ; - } - } - - // backdoor handler for default return and command escape - if ( !handled && (!focus->IsKindOf(CLASSINFO(wxControl) ) || !focus->AcceptsFocus() ) ) - { - // if window is not having a focus still testing for default enter or cancel - // TODO: add the UMA version for ActiveNonFloatingWindow -#ifndef __LP64__ - wxWindow* focus = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontWindow() ) ; - if ( focus ) - { - if ( keyval == WXK_RETURN || keyval == WXK_NUMPAD_ENTER ) - { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(focus), wxTopLevelWindow); - if ( tlw && tlw->GetDefaultItem() ) - { - wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); - if ( def && def->IsEnabled() ) - { - wxCommandEvent event(wxEVT_BUTTON, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - - return true ; - } - } - } - else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) ) - { - // generate wxID_CANCEL if command-. or has been pressed (typically in dialogs) - wxCommandEvent new_event(wxEVT_BUTTON,wxID_CANCEL); - new_event.SetEventObject( focus ); - handled = focus->HandleWindowEvent( new_event ); - } - } -#endif - } -#endif return handled ; } @@ -1632,12 +914,4 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess void wxApp::MacHideApp() { -#if wxOSX_USE_CARBON - wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ); - HICommand command; - memset( &command, 0 , sizeof(command) ); - command.commandID = kHICommandHide ; - event.SetParameter(kEventParamDirectObject, command ); - SendEventToApplication( event ); -#endif } diff --git a/Externals/wxWidgets3/src/osx/carbon/apprsrc.h b/Externals/wxWidgets3/src/osx/carbon/apprsrc.h deleted file mode 100644 index 55d7f307ad..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/apprsrc.h +++ /dev/null @@ -1 +0,0 @@ -// TODO REMOVE diff --git a/Externals/wxWidgets3/src/osx/carbon/apprsrc.r b/Externals/wxWidgets3/src/osx/carbon/apprsrc.r deleted file mode 100644 index 4113a172a0..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/apprsrc.r +++ /dev/null @@ -1 +0,0 @@ -/* not needed anymore */ diff --git a/Externals/wxWidgets3/src/osx/carbon/bmpbuttn.cpp b/Externals/wxWidgets3/src/osx/carbon/bmpbuttn.cpp deleted file mode 100644 index 9f0adc85a9..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/bmpbuttn.cpp +++ /dev/null @@ -1,150 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/bmpbuttn.cpp -// Purpose: wxBitmapButton -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_BMPBUTTON - -#include "wx/bmpbuttn.h" -#include "wx/image.h" - -#ifndef WX_PRECOMP - #include "wx/dcmemory.h" -#endif - -#include "wx/osx/private.h" - -namespace -{ - -// define a derived class to override SetBitmap() and also to provide -// InitButtonContentInfo() helper used by CreateBitmapButton() -class wxMacBitmapButton : public wxMacControl, public wxButtonImpl -{ -public: - wxMacBitmapButton(wxWindowMac* peer, const wxBitmap& bitmap, int style) - : wxMacControl(peer) - { - // decide what kind of contents the button will have: we want to use an - // icon for buttons with wxBORDER_NONE style as bevel buttons always do - // have a border but icons are limited to a few standard sizes only and - // are resized by the system with extremely ugly results if they don't - // fit (in the past we also tried being smart and pasting a bitmap - // instead of a larger square icon to avoid resizing but this resulted - // in buttons having different size than specified by wx API and - // breaking the layouts and still didn't look good so we don't even try - // to do this any more) - m_isIcon = (style & wxBORDER_NONE) && - bitmap.IsOk() && IsOfStandardSize(bitmap); - } - - virtual void SetBitmap(const wxBitmap& bitmap) - { - // unfortunately we can't avoid the ugly resizing problem mentioned - // above if a bitmap of supported size was used initially but was - // replaced with another one later as the control was already created - // as an icon control (although maybe we ought to recreate it?) - ControlButtonContentInfo info; - InitButtonContentInfo(info, bitmap); - - if ( info.contentType == kControlContentIconRef ) - SetData(kControlIconPart, kControlIconContentTag, info); - else if ( info.contentType != kControlNoContent ) - SetData(kControlButtonPart, kControlBevelButtonContentTag, info); - - wxMacReleaseBitmapButton(&info); - } - - void InitButtonContentInfo(ControlButtonContentInfo& info, - const wxBitmap& bitmap) - { - wxMacCreateBitmapButton(&info, bitmap, - m_isIcon ? kControlContentIconRef : 0); - } - - void SetPressedBitmap( const wxBitmap& WXUNUSED(bitmap) ) - { - // not implemented under Carbon - } - -private: - // helper function: returns true if the given bitmap is of one of standard - // sizes supported by OS X icons - static bool IsOfStandardSize(const wxBitmap& bmp) - { - const int w = bmp.GetWidth(); - - return bmp.GetHeight() == w && - (w == 128 || w == 48 || w == 32 || w == 16); - } - - - // true if this is an icon control, false if it's a bevel button - bool m_isIcon; - - wxDECLARE_NO_COPY_CLASS(wxMacBitmapButton); -}; - -} // anonymous namespace - -wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxBitmap& bitmap, - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - wxMacBitmapButton* peer = new wxMacBitmapButton(wxpeer, bitmap, style); - - OSStatus err; - WXWindow macParent = MAC_WXHWND(parent->MacGetTopLevelWindowRef()); - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - - ControlButtonContentInfo info; - peer->InitButtonContentInfo(info, bitmap); - - if ( info.contentType == kControlContentIconRef ) - { - err = CreateIconControl - ( - macParent, - &bounds, - &info, - false, - peer->GetControlRefAddr() - ); - } - else // normal bevel button - { - err = CreateBevelButtonControl - ( - macParent, - &bounds, - CFSTR(""), - style & wxBU_AUTODRAW ? kControlBevelButtonSmallBevel - : kControlBevelButtonNormalBevel, - kControlBehaviorOffsetContents, - &info, - 0, // menu id (no associated menu) - 0, // menu behaviour (unused) - 0, // menu placement (unused too) - peer->GetControlRefAddr() - ); - } - - verify_noerr( err ); - - wxMacReleaseBitmapButton( &info ); - return peer; -} - -#endif // wxUSE_BMPBUTTON diff --git a/Externals/wxWidgets3/src/osx/carbon/button.cpp b/Externals/wxWidgets3/src/osx/carbon/button.cpp deleted file mode 100644 index 6c6844de45..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/button.cpp +++ /dev/null @@ -1,120 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/button.cpp -// Purpose: wxButton -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/button.h" - -#ifndef WX_PRECOMP - #include "wx/panel.h" - #include "wx/toplevel.h" - #include "wx/dcclient.h" -#endif - -#include "wx/stockitem.h" - -#include "wx/osx/private.h" - -// -// -// - -wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - OSStatus err; - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - if ( id == wxID_HELP ) - { - ControlButtonContentInfo info ; - info.contentType = kControlContentIconRef ; - GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef); - err = CreateRoundButtonControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), - &bounds, kControlRoundButtonNormalSize, - &info, peer->GetControlRefAddr() ); - } - else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND) - { - // Button height is static in Mac, can't be changed, so we need to force it here - int maxHeight; - switch (wxpeer->GetWindowVariant() ) - { - default: - wxFAIL_MSG( "unknown window variant" ); - // fall through - - case wxWINDOW_VARIANT_NORMAL: - case wxWINDOW_VARIANT_LARGE: - maxHeight = 20 ; - break; - case wxWINDOW_VARIANT_SMALL: - maxHeight = 17; - break; - case wxWINDOW_VARIANT_MINI: - maxHeight = 15; - } - bounds.bottom = bounds.top + maxHeight ; - wxpeer->SetMaxSize( wxSize( wxpeer->GetMaxWidth() , maxHeight )); - err = CreatePushButtonControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), - &bounds, CFSTR(""), peer->GetControlRefAddr() ); - } - else - { - ControlButtonContentInfo info ; - info.contentType = kControlNoContent ; - err = CreateBevelButtonControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""), - kControlBevelButtonLargeBevel, kControlBehaviorPushbutton, - &info, 0, 0, 0, peer->GetControlRefAddr() ); - } - verify_noerr( err ); - return peer; -} - -void wxMacControl::SetDefaultButton( bool isDefault ) -{ - SetData(kControlButtonPart , kControlPushButtonDefaultTag , (Boolean) isDefault ) ; -} - -wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - - OSStatus err = CreateDisclosureTriangleControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, - kControlDisclosureTrianglePointDefault, - wxCFStringRef( label ), - 0, // closed - TRUE, // draw title - TRUE, // auto toggle back and forth - peer->GetControlRefAddr() ); - - verify_noerr( err ); - return peer; -} - - diff --git a/Externals/wxWidgets3/src/osx/carbon/carbrsrc.r b/Externals/wxWidgets3/src/osx/carbon/carbrsrc.r deleted file mode 100644 index 9326cc3b56..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/carbrsrc.r +++ /dev/null @@ -1,7 +0,0 @@ -// carbon for 9 -data 'carb' (0) { - $"0000" /* .. */ -}; - -// the plist resource should only be included in the application -// since it contains the bundle information and should not be duplicated diff --git a/Externals/wxWidgets3/src/osx/carbon/checkbox.cpp b/Externals/wxWidgets3/src/osx/carbon/checkbox.cpp deleted file mode 100644 index 44e9dcd033..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/checkbox.cpp +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/checkbox.cpp -// Purpose: wxCheckBox -// Author: Stefan Csomor -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_CHECKBOX - -#include "wx/checkbox.h" -#include "wx/osx/uma.h" - -wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - - verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , - CFSTR("") , 0 , false , peer->GetControlRefAddr() ) ); - SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */; - if (style & wxCHK_3STATE) - maxValue = 2 /* kControlCheckboxMixedValue */; - - peer->SetMaximum( maxValue ) ; - - return peer; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/choice.cpp b/Externals/wxWidgets3/src/osx/carbon/choice.cpp deleted file mode 100644 index dc7d1b91fd..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/choice.cpp +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/choice.cpp -// Purpose: wxChoice -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_CHOICE - -#include "wx/choice.h" - -#ifndef WX_PRECOMP - #include "wx/menu.h" - #include "wx/dcclient.h" -#endif - -#include "wx/osx/private.h" - -// adapt the number offset (mac menu are 1 based) - -class wxMacChoiceCarbonControl : public wxMacControl -{ -public : - wxMacChoiceCarbonControl( wxWindowMac* peer ) : wxMacControl( peer ) - { - } - - void SetValue(wxInt32 v) - { - wxMacControl::SetValue( v + 1 ); - } - - wxInt32 GetValue() const - { - return wxMacControl::GetValue() - 1; - } - }; - -wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - wxMenu* menu, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ); - - wxMacControl* peer = new wxMacChoiceCarbonControl( wxpeer ) ; - OSStatus err = CreatePopupButtonControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , - -12345 , false /* no variable width */ , 0 , 0 , 0 , peer->GetControlRefAddr() ); - verify_noerr( err ); - - peer->SetData( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) menu->GetHMenu() ) ; - return peer; -} - -#endif // wxUSE_CHOICE diff --git a/Externals/wxWidgets3/src/osx/carbon/clipbrd.cpp b/Externals/wxWidgets3/src/osx/carbon/clipbrd.cpp index 7835430e65..535f5e4cff 100644 --- a/Externals/wxWidgets3/src/osx/carbon/clipbrd.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/clipbrd.cpp @@ -37,7 +37,7 @@ // (there will be a *lot* of them!) #define TRACE_CLIPBOARD wxT("clipboard") -IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject); wxClipboard::wxClipboard() { diff --git a/Externals/wxWidgets3/src/osx/carbon/colordlg.cpp b/Externals/wxWidgets3/src/osx/carbon/colordlg.cpp index 191286f6b1..fbeb4db8f4 100644 --- a/Externals/wxWidgets3/src/osx/carbon/colordlg.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/colordlg.cpp @@ -16,9 +16,9 @@ #include "wx/modalhook.h" -#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX && wxUSE_COLOURDLG -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); #include "wx/osx/private.h" diff --git a/Externals/wxWidgets3/src/osx/carbon/colordlgosx.mm b/Externals/wxWidgets3/src/osx/carbon/colordlgosx.mm index 946471ff37..9d3fddd0e2 100644 --- a/Externals/wxWidgets3/src/osx/carbon/colordlgosx.mm +++ b/Externals/wxWidgets3/src/osx/carbon/colordlgosx.mm @@ -28,9 +28,9 @@ // ============================================================================ //Mac OSX 10.2+ only -#if USE_NATIVE_FONT_DIALOG_FOR_MACOSX +#if USE_NATIVE_FONT_DIALOG_FOR_MACOSX && wxUSE_COLOURDLG -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); #include "wx/osx/private.h" @@ -41,7 +41,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) // wxCPWCDelegate - Window Closed delegate // --------------------------------------------------------------------------- -@interface wxCPWCDelegate : NSObject wxOSX_10_6_AND_LATER() +@interface wxCPWCDelegate : NSObject { bool m_bIsClosed; } @@ -107,12 +107,7 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; if(m_colourData.GetColour().IsOk()) - [[NSColorPanel sharedColorPanel] setColor: - [NSColor colorWithCalibratedRed:(CGFloat) (m_colourData.GetColour().Red() / 255.0) - green:(CGFloat) (m_colourData.GetColour().Green() / 255.0) - blue:(CGFloat) (m_colourData.GetColour().Blue() / 255.0) - alpha:(CGFloat) (m_colourData.GetColour().Alpha() / 255.0)] - ]; + [[NSColorPanel sharedColorPanel] setColor:m_colourData.GetColour().OSXGetNSColor()]; else [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]]; @@ -162,14 +157,7 @@ int wxColourDialog::ShowModal() [theCPDelegate release]; //Get the shared color panel along with the chosen color and set the chosen color - NSColor* theColor = [[theColorPanel color] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; - - m_colourData.GetColour().Set( - (unsigned char) ([theColor redComponent] * 255.0), - (unsigned char) ([theColor greenComponent] * 255.0), - (unsigned char) ([theColor blueComponent] * 255.0), - (unsigned char) ([theColor alphaComponent] * 255.0) - ); + m_colourData.GetColour() = wxColour([theColorPanel color]); //Release the pool, we're done :) [thePool release]; diff --git a/Externals/wxWidgets3/src/osx/carbon/combobox.cpp b/Externals/wxWidgets3/src/osx/carbon/combobox.cpp deleted file mode 100644 index 301af54dea..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/combobox.cpp +++ /dev/null @@ -1,668 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/combobox.cpp -// Purpose: wxComboBox class -// Author: Stefan Csomor, Dan "Bud" Keith (composite combobox) -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_COMBOBOX && wxOSX_USE_CARBON - -#include "wx/combobox.h" - -#ifndef WX_PRECOMP - #include "wx/button.h" - #include "wx/menu.h" - #include "wx/containr.h" - #include "wx/toplevel.h" - #include "wx/textctrl.h" -#endif - -#include "wx/osx/private.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the text control and the choice -// margin should be bigger on OS X due to blue highlight -// around text control. -static const wxCoord MARGIN = 4; -// this is the border a focus rect on OSX is needing -static const int TEXTFOCUSBORDER = 3 ; - - -// ---------------------------------------------------------------------------- -// wxComboBoxText: text control forwards events to combobox -// ---------------------------------------------------------------------------- - -class wxComboBoxText : public wxTextCtrl -{ -public: - wxComboBoxText( wxComboBox * cb ) - : wxTextCtrl( cb , 1 ) - { - m_cb = cb; - } - -protected: - void OnChar( wxKeyEvent& event ) - { - // Allows processing the tab key to go to the next control - if (event.GetKeyCode() == WXK_TAB) - { - wxNavigationKeyEvent NavEvent; - NavEvent.SetEventObject(this); - NavEvent.SetDirection(!event.ShiftDown()); - NavEvent.SetWindowChange(false); - - // Get the parent of the combo and have it process the navigation? - if (m_cb->GetParent()->HandleWindowEvent(NavEvent)) - return; - } - - // send the event to the combobox class in case the user has bound EVT_CHAR - wxKeyEvent kevt(event); - kevt.SetEventObject(m_cb); - if (m_cb->HandleWindowEvent(kevt)) - // If the event was handled and not skipped then we're done - return; - - if ( event.GetKeyCode() == WXK_RETURN ) - { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_cb->GetId()); - event.SetString( GetValue() ); - event.SetInt( m_cb->GetSelection() ); - event.SetEventObject( m_cb ); - - // This will invoke the dialog default action, - // such as the clicking the default button. - if (!m_cb->HandleWindowEvent( event )) - { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw && tlw->GetDefaultItem() ) - { - wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); - if ( def && def->IsEnabled() ) - { - wxCommandEvent event( wxEVT_BUTTON, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - } - } - - return; - } - } - - event.Skip(); - } - - void OnKeyUp( wxKeyEvent& event ) - { - event.SetEventObject(m_cb); - event.SetId(m_cb->GetId()); - if (! m_cb->HandleWindowEvent(event)) - event.Skip(); - } - - void OnKeyDown( wxKeyEvent& event ) - { - event.SetEventObject(m_cb); - event.SetId(m_cb->GetId()); - if (! m_cb->HandleWindowEvent(event)) - event.Skip(); - } - - void OnText( wxCommandEvent& event ) - { - event.SetEventObject(m_cb); - event.SetId(m_cb->GetId()); - if (! m_cb->HandleWindowEvent(event)) - event.Skip(); - } - - void OnFocus( wxFocusEvent& event ) - { - // in case the textcontrol gets the focus we propagate - // it to the parent's handlers. - wxFocusEvent evt2(event.GetEventType(),m_cb->GetId()); - evt2.SetEventObject(m_cb); - m_cb->GetEventHandler()->ProcessEvent(evt2); - - event.Skip(); - } - -private: - wxComboBox *m_cb; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxComboBoxText, wxTextCtrl) - EVT_KEY_DOWN(wxComboBoxText::OnKeyDown) - EVT_CHAR(wxComboBoxText::OnChar) - EVT_KEY_UP(wxComboBoxText::OnKeyUp) - EVT_SET_FOCUS(wxComboBoxText::OnFocus) - EVT_KILL_FOCUS(wxComboBoxText::OnFocus) - EVT_TEXT(wxID_ANY, wxComboBoxText::OnText) -END_EVENT_TABLE() - -class wxComboBoxChoice : public wxChoice -{ -public: - wxComboBoxChoice( wxComboBox *cb, int style ) - : wxChoice( cb , 1 , wxDefaultPosition , wxDefaultSize , 0 , NULL , style & (wxCB_SORT) ) - { - m_cb = cb; - } - - int GetPopupWidth() const - { - switch ( GetWindowVariant() ) - { - case wxWINDOW_VARIANT_NORMAL : - case wxWINDOW_VARIANT_LARGE : - return 24 ; - - default : - return 21 ; - } - } - -protected: - void OnChoice( wxCommandEvent& e ) - { - wxString s = e.GetString(); - - m_cb->DelegateChoice( s ); - wxCommandEvent event2(wxEVT_COMBOBOX, m_cb->GetId() ); - event2.SetInt(m_cb->GetSelection()); - event2.SetEventObject(m_cb); - event2.SetString(m_cb->GetStringSelection()); - m_cb->ProcessCommand(event2); - - // For consistency with MSW and GTK, also send a text updated event - // After all, the text is updated when a selection is made - wxCommandEvent TextEvent( wxEVT_TEXT, m_cb->GetId() ); - TextEvent.SetString( m_cb->GetStringSelection() ); - TextEvent.SetEventObject( m_cb ); - m_cb->ProcessCommand( TextEvent ); - } - - virtual wxSize DoGetBestSize() const - { - wxSize sz = wxChoice::DoGetBestSize() ; - if (! m_cb->HasFlag(wxCB_READONLY) ) - sz.x = GetPopupWidth() ; - - return sz ; - } - -private: - wxComboBox *m_cb; - - friend class wxComboBox; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice) - EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice) -END_EVENT_TABLE() - -wxComboBox::~wxComboBox() -{ - // delete the controls now, don't leave them alive even though they would - // still be eventually deleted by our parent - but it will be too late, the - // user code expects them to be gone now - wxDELETE(m_text); - wxDELETE(m_choice); -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxComboBox::DoGetBestSize() const -{ - if (!m_choice && !m_text) - return GetSize(); - - wxSize size = m_choice->GetBestSize(); - - if ( m_text != NULL ) - { - wxSize sizeText = m_text->GetBestSize(); - if (sizeText.y + 2 * TEXTFOCUSBORDER > size.y) - size.y = sizeText.y + 2 * TEXTFOCUSBORDER; - - size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN; - size.x += TEXTFOCUSBORDER ; - } - else - { - // clipping is too tight - size.y += 1 ; - } - - return size; -} - -void wxComboBox::DoMoveWindow(int x, int y, int width, int height) -{ - wxControl::DoMoveWindow( x, y, width , height ); - - if ( m_text == NULL ) - { - // we might not be fully constructed yet, therefore watch out... - if ( m_choice ) - m_choice->SetSize(0, 0 , width, -1); - } - else - { - wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN; - m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1); - wxSize tSize = m_text->GetSize(); - wxSize cSize = m_choice->GetSize(); - - int yOffset = ( tSize.y + 2 * TEXTFOCUSBORDER - cSize.y ) / 2; - - // put it at an inset of 1 to have outer area shadows drawn as well - m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , yOffset, m_choice->GetPopupWidth() , -1); - } -} - -// ---------------------------------------------------------------------------- -// operations forwarded to the subcontrols -// ---------------------------------------------------------------------------- - -bool wxComboBox::Enable(bool enable) -{ - if ( !wxControl::Enable(enable) ) - return false; - - if (m_text) - m_text->Enable(enable); - - return true; -} - -bool wxComboBox::Show(bool show) -{ - if ( !wxControl::Show(show) ) - return false; - - return true; -} - -void wxComboBox::DelegateTextChanged( const wxString& value ) -{ - SetStringSelection( value ); -} - -void wxComboBox::DelegateChoice( const wxString& value ) -{ - SetStringSelection( value ); -} - -bool wxComboBox::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( !Create( parent, id, value, pos, size, 0, NULL, - style, validator, name ) ) - return false; - - Append(choices); - - return true; -} - -bool wxComboBox::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - int n, - const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , - validator, name) ) - { - return false; - } - - wxSize csize = size; - if ( style & wxCB_READONLY ) - { - m_text = NULL; - } - else - { - m_text = new wxComboBoxText(this); - if ( size.y == -1 ) - { - csize.y = m_text->GetSize().y ; - csize.y += 2 * TEXTFOCUSBORDER ; - } - } - m_choice = new wxComboBoxChoice(this, style ); - - DoSetSize(pos.x, pos.y, csize.x, csize.y); - - Append( n, choices ); - - // Needed because it is a wxControlWithItems - SetInitialSize(size); - SetStringSelection(value); - - return true; -} - -void wxComboBox::EnableTextChangedEvents(bool enable) -{ - if ( m_text ) - m_text->ForwardEnableTextChangedEvents(enable); -} - -wxString wxComboBox::DoGetValue() const -{ - wxCHECK_MSG( m_text, wxString(), "can't be called for read-only combobox" ); - - return m_text->GetValue(); -} - -wxString wxComboBox::GetValue() const -{ - wxString result; - - if ( m_text == NULL ) - result = m_choice->GetString( m_choice->GetSelection() ); - else - result = m_text->GetValue(); - - return result; -} - -unsigned int wxComboBox::GetCount() const -{ - return m_choice->GetCount() ; -} - -void wxComboBox::SetValue(const wxString& value) -{ - if ( HasFlag(wxCB_READONLY) ) - SetStringSelection( value ) ; - else - m_text->SetValue( value ); -} - -void wxComboBox::WriteText(const wxString& text) -{ - m_text->WriteText(text); -} - -void wxComboBox::GetSelection(long *from, long *to) const -{ - m_text->GetSelection(from, to); -} - -// Clipboard operations - -void wxComboBox::Copy() -{ - if ( m_text != NULL ) - m_text->Copy(); -} - -void wxComboBox::Cut() -{ - if ( m_text != NULL ) - m_text->Cut(); -} - -void wxComboBox::Paste() -{ - if ( m_text != NULL ) - m_text->Paste(); -} - -void wxComboBox::SetEditable(bool editable) -{ - if ( ( m_text == NULL ) && editable ) - { - m_text = new wxComboBoxText( this ); - } - else if ( !editable ) - { - wxDELETE(m_text); - } - - int currentX, currentY; - GetPosition( ¤tX, ¤tY ); - - int currentW, currentH; - GetSize( ¤tW, ¤tH ); - - DoMoveWindow( currentX, currentY, currentW, currentH ); -} - -void wxComboBox::SetInsertionPoint(long pos) -{ - if ( m_text ) - m_text->SetInsertionPoint(pos); -} - -void wxComboBox::SetInsertionPointEnd() -{ - if ( m_text ) - m_text->SetInsertionPointEnd(); -} - -long wxComboBox::GetInsertionPoint() const -{ - if ( m_text ) - return m_text->GetInsertionPoint(); - return 0; -} - -wxTextPos wxComboBox::GetLastPosition() const -{ - if ( m_text ) - return m_text->GetLastPosition(); - return 0; -} - -void wxComboBox::Replace(long from, long to, const wxString& value) -{ - if ( m_text ) - m_text->Replace(from,to,value); -} - -void wxComboBox::Remove(long from, long to) -{ - if ( m_text ) - m_text->Remove(from,to); -} - -void wxComboBox::SetSelection(long from, long to) -{ - if ( m_text ) - m_text->SetSelection(from,to); -} - -int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, - wxClientDataType type) -{ - return m_choice->DoInsertItems(items, pos, clientData, type); -} - -void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) -{ - return m_choice->DoSetItemClientData( n , clientData ) ; -} - -void* wxComboBox::DoGetItemClientData(unsigned int n) const -{ - return m_choice->DoGetItemClientData( n ) ; -} - -wxClientDataType wxComboBox::GetClientDataType() const -{ - return m_choice->GetClientDataType(); -} - -void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType) -{ - m_choice->SetClientDataType(clientDataItemsType); -} - -void wxComboBox::DoDeleteOneItem(unsigned int n) -{ - m_choice->DoDeleteOneItem( n ); -} - -void wxComboBox::DoClear() -{ - m_choice->DoClear(); -} - -int wxComboBox::GetSelection() const -{ - return m_choice->GetSelection(); -} - -void wxComboBox::SetSelection(int n) -{ - m_choice->SetSelection( n ); - - if ( m_text != NULL ) - m_text->SetValue(n != wxNOT_FOUND ? GetString(n) : wxString(wxEmptyString)); -} - -int wxComboBox::FindString(const wxString& s, bool bCase) const -{ - return m_choice->FindString( s, bCase ); -} - -wxString wxComboBox::GetString(unsigned int n) const -{ - return m_choice->GetString( n ); -} - -wxString wxComboBox::GetStringSelection() const -{ - int sel = GetSelection(); - if (sel != wxNOT_FOUND) - return wxString(this->GetString((unsigned int)sel)); - else - return wxEmptyString; -} - -void wxComboBox::SetString(unsigned int n, const wxString& s) -{ - m_choice->SetString( n , s ); -} - -bool wxComboBox::IsEditable() const -{ - return m_text != NULL && !HasFlag(wxCB_READONLY); -} - -void wxComboBox::Undo() -{ - if (m_text != NULL) - m_text->Undo(); -} - -void wxComboBox::Redo() -{ - if (m_text != NULL) - m_text->Redo(); -} - -void wxComboBox::SelectAll() -{ - if (m_text != NULL) - m_text->SelectAll(); -} - -bool wxComboBox::CanCopy() const -{ - if (m_text != NULL) - return m_text->CanCopy(); - else - return false; -} - -bool wxComboBox::CanCut() const -{ - if (m_text != NULL) - return m_text->CanCut(); - else - return false; -} - -bool wxComboBox::CanPaste() const -{ - if (m_text != NULL) - return m_text->CanPaste(); - else - return false; -} - -bool wxComboBox::CanUndo() const -{ - if (m_text != NULL) - return m_text->CanUndo(); - else - return false; -} - -bool wxComboBox::CanRedo() const -{ - if (m_text != NULL) - return m_text->CanRedo(); - else - return false; -} - -bool wxComboBox::OSXHandleClicked( double WXUNUSED(timestampsec) ) -{ -/* - For consistency with other platforms, clicking in the text area does not constitute a selection - wxCommandEvent event(wxEVT_COMBOBOX, m_windowId ); - event.SetInt(GetSelection()); - event.SetEventObject(this); - event.SetString(GetStringSelection()); - ProcessCommand(event); -*/ - - return true ; -} - -wxTextWidgetImpl* wxComboBox::GetTextPeer() const -{ - if (m_text) - return m_text->GetTextPeer(); - - return NULL; -} - -#endif // wxUSE_COMBOBOX && wxOSX_USE_CARBON diff --git a/Externals/wxWidgets3/src/osx/carbon/combobxc.cpp b/Externals/wxWidgets3/src/osx/carbon/combobxc.cpp deleted file mode 100644 index b38c20cc21..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/combobxc.cpp +++ /dev/null @@ -1,783 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/combobxc.cpp -// Purpose: wxComboBox class using HIView ComboBox -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/combobox.h" - -#ifndef WX_PRECOMP - #include "wx/button.h" - #include "wx/menu.h" -#endif - -#include "wx/osx/uma.h" -#if TARGET_API_MAC_OSX -#ifndef __HIVIEW__ - #include -#endif -#endif - -#if TARGET_API_MAC_OSX -#define USE_HICOMBOBOX 1 //use hi combobox define -#else -#define USE_HICOMBOBOX 0 -#endif - -static int nextPopUpMenuId = 1000; -MenuHandle NewUniqueMenu() -{ - MenuHandle handle = NewMenu( nextPopUpMenuId , "\pMenu" ); - nextPopUpMenuId++; - return handle; -} - -#if USE_HICOMBOBOX -static const EventTypeSpec eventList[] = -{ - { kEventClassTextField , kEventTextAccepted } , -}; - -static pascal OSStatus wxMacComboBoxEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr; - wxComboBox* cb = (wxComboBox*) data; - - wxMacCarbonEvent cEvent( event ); - - switch( cEvent.GetClass() ) - { - case kEventClassTextField : - switch( cEvent.GetKind() ) - { - case kEventTextAccepted : - { - wxCommandEvent event( wxEVT_COMBOBOX, cb->GetId() ); - event.SetInt( cb->GetSelection() ); - event.SetString( cb->GetStringSelection() ); - event.SetEventObject( cb ); - cb->HandleWindowEvent( event ); - } - break; - default : - break; - } - break; - default : - break; - } - - - return result; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacComboBoxEventHandler ) - -#endif - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the margin between the text control and the choice -static const wxCoord MARGIN = 2; -#if TARGET_API_MAC_OSX -static const int POPUPWIDTH = 24; -#else -static const int POPUPWIDTH = 18; -#endif -static const int POPUPHEIGHT = 23; - -// ---------------------------------------------------------------------------- -// wxComboBoxText: text control forwards events to combobox -// ---------------------------------------------------------------------------- - -class wxComboBoxText : public wxTextCtrl -{ -public: - wxComboBoxText( wxComboBox * cb ) - : wxTextCtrl( cb , 1 ) - { - m_cb = cb; - } - -protected: - void OnChar( wxKeyEvent& event ) - { - if ( event.GetKeyCode() == WXK_RETURN ) - { - wxString value = GetValue(); - - if ( m_cb->GetCount() == 0 ) - { - // make Enter generate "selected" event if there is only one item - // in the combobox - without it, it's impossible to select it at - // all! - wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() ); - event.SetInt( 0 ); - event.SetString( value ); - event.SetEventObject( m_cb ); - m_cb->HandleWindowEvent( event ); - } - else - { - // add the item to the list if it's not there yet - if ( m_cb->FindString(value) == wxNOT_FOUND ) - { - m_cb->Append(value); - m_cb->SetStringSelection(value); - - // and generate the selected event for it - wxCommandEvent event( wxEVT_COMBOBOX, m_cb->GetId() ); - event.SetInt( m_cb->GetCount() - 1 ); - event.SetString( value ); - event.SetEventObject( m_cb ); - m_cb->HandleWindowEvent( event ); - } - - // This will invoke the dialog default action, such - // as the clicking the default button. - - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); - if ( tlw && tlw->GetDefaultItem() ) - { - wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); - if ( def && def->IsEnabled() ) - { - wxCommandEvent event(wxEVT_BUTTON, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - return; - } - } - - return; - } - } - - event.Skip(); - } -private: - wxComboBox *m_cb; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxComboBoxText, wxTextCtrl) - EVT_CHAR( wxComboBoxText::OnChar) -END_EVENT_TABLE() - -class wxComboBoxChoice : public wxChoice -{ -public: - wxComboBoxChoice(wxComboBox *cb, int style) - : wxChoice( cb , 1 ) - { - m_cb = cb; - } - -protected: - void OnChoice( wxCommandEvent& e ) - { - wxString s = e.GetString(); - - m_cb->DelegateChoice( s ); - wxCommandEvent event2(wxEVT_COMBOBOX, m_cb->GetId() ); - event2.SetInt(m_cb->GetSelection()); - event2.SetEventObject(m_cb); - event2.SetString(m_cb->GetStringSelection()); - m_cb->ProcessCommand(event2); - } - virtual wxSize DoGetBestSize() const - { - wxSize sz = wxChoice::DoGetBestSize(); - sz.x = POPUPWIDTH; - return sz; - } - -private: - wxComboBox *m_cb; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice) - EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice) -END_EVENT_TABLE() - -wxComboBox::~wxComboBox() -{ - // delete the controls now, don't leave them alive even though they would - // still be eventually deleted by our parent - but it will be too late, the - // user code expects them to be gone now - wxDELETE( m_text ); - wxDELETE( m_choice ); -} - - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxComboBox::DoGetBestSize() const -{ -#if USE_HICOMBOBOX - return wxControl::DoGetBestSize(); -#else - wxSize size = m_choice->GetBestSize(); - - if ( m_text != NULL ) - { - wxSize sizeText = m_text->GetBestSize(); - - size.x = POPUPWIDTH + sizeText.x + MARGIN; - } - - return size; -#endif -} - -void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { -#if USE_HICOMBOBOX - wxControl::DoMoveWindow(x, y, width, height); -#else - height = POPUPHEIGHT; - - wxControl::DoMoveWindow(x, y, width, height); - - if ( m_text == NULL ) - { - // we might not be fully constructed yet, therefore watch out... - if ( m_choice ) - m_choice->SetSize(0, 0 , width, wxDefaultCoord); - } - else - { - wxCoord wText = width - POPUPWIDTH - MARGIN; - m_text->SetSize(0, 0, wText, height); - m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord); - } -#endif -} - - - -// ---------------------------------------------------------------------------- -// operations forwarded to the subcontrols -// ---------------------------------------------------------------------------- - -bool wxComboBox::Enable(bool enable) -{ - if ( !wxControl::Enable(enable) ) - return false; - - return true; -} - -bool wxComboBox::Show(bool show) -{ - if ( !wxControl::Show(show) ) - return false; - - return true; -} - -void wxComboBox::SetFocus() -{ -#if USE_HICOMBOBOX - wxControl::SetFocus(); -#else - if ( m_text != NULL) { - m_text->SetFocus(); - } -#endif -} - - -void wxComboBox::DelegateTextChanged( const wxString& value ) -{ - SetStringSelection( value ); -} - - -void wxComboBox::DelegateChoice( const wxString& value ) -{ - SetStringSelection( value ); -} - - -bool wxComboBox::Create(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style, - const wxValidator& validator, - const wxString& name) -{ - wxCArrayString chs( choices ); - - return Create( parent, id, value, pos, size, chs.GetCount(), - chs.GetStrings(), style, validator, name ); -} - - -bool wxComboBox::Create(wxWindow *parent, wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - int n, const wxString choices[], - long style, - const wxValidator& validator, - const wxString& name) -{ - m_text = NULL; - m_choice = NULL; -#if USE_HICOMBOBOX - DontCreatePeer(); -#endif - if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , - wxDefaultValidator, name) ) - { - return false; - } -#if USE_HICOMBOBOX - Rect bounds = wxMacGetBoundsForControl( this , pos , size ); - HIRect hiRect; - - hiRect.origin.x = 20; //bounds.left; - hiRect.origin.y = 25; //bounds.top; - hiRect.size.width = 120;// bounds.right - bounds.left; - hiRect.size.height = 24; - - //For some reason, this code causes the combo box not to be displayed at all. - //hiRect.origin.x = bounds.left; - //hiRect.origin.y = bounds.top; - //hiRect.size.width = bounds.right - bounds.left; - //hiRect.size.height = bounds.bottom - bounds.top; - //printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom); - //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height); - m_peer = new wxMacControl(this); - verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, m_peer->GetControlRefAddr() ) ); - - - m_peer->SetMinimum( 0 ); - m_peer->SetMaximum( 100); - if ( n > 0 ) - m_peer->SetValue( 1 ); - - MacPostControlCreate(pos,size); - - Append( choices[ i ] ); - - HIViewSetVisible( m_peer->GetControlRef(), true ); - SetSelection(0); - EventHandlerRef comboEventHandler; - InstallControlEventHandler( m_peer->GetControlRef(), GetwxMacComboBoxEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, this, - (EventHandlerRef *)&comboEventHandler); -#else - m_choice = new wxComboBoxChoice(this, style ); - m_choice->SetMinSize( wxSize( POPUPWIDTH , POPUPHEIGHT ) ); - - wxSize csize = size; - if ( style & wxCB_READONLY ) - { - m_text = NULL; - } - else - { - m_text = new wxComboBoxText(this); - if ( size.y == wxDefaultCoord ) { - csize.y = m_text->GetSize().y; - } - } - - DoSetSize(pos.x, pos.y, csize.x, csize.y); - - m_choice->Append( n, choices ); - SetInitialSize(csize); // Needed because it is a wxControlWithItems -#endif - - return true; -} - -wxString wxComboBox::GetValue() const -{ -#if USE_HICOMBOBOX - CFStringRef myString; - HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)GetSelection(), &myString ); - return wxMacCFStringHolder( myString, GetFont().GetEncoding() ).AsString(); -#else - wxString result; - - if ( m_text == NULL ) - { - result = m_choice->GetString( m_choice->GetSelection() ); - } - else - { - result = m_text->GetValue(); - } - - return result; -#endif -} - -void wxComboBox::SetValue(const wxString& value) -{ -#if USE_HICOMBOBOX - -#else - int s = FindString (value); - if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) ) - { - m_choice->Append(value); - } - SetStringSelection( value ); -#endif -} - -// Clipboard operations -void wxComboBox::Copy() -{ - if ( m_text != NULL ) - { - m_text->Copy(); - } -} - -void wxComboBox::Cut() -{ - if ( m_text != NULL ) - { - m_text->Cut(); - } -} - -void wxComboBox::Paste() -{ - if ( m_text != NULL ) - { - m_text->Paste(); - } -} - -void wxComboBox::SetEditable(bool editable) -{ - if ( ( m_text == NULL ) && editable ) - { - m_text = new wxComboBoxText( this ); - } - else if ( !editable ) - { - wxDELETE(m_text); - } - - int currentX, currentY; - GetPosition( ¤tX, ¤tY ); - - int currentW, currentH; - GetSize( ¤tW, ¤tH ); - - DoMoveWindow( currentX, currentY, currentW, currentH ); -} - -void wxComboBox::SetInsertionPoint(long pos) -{ - // TODO -} - -void wxComboBox::SetInsertionPointEnd() -{ - // TODO -} - -long wxComboBox::GetInsertionPoint() const -{ - // TODO - return 0; -} - -wxTextPos wxComboBox::GetLastPosition() const -{ - // TODO - return 0; -} - -void wxComboBox::Replace(long from, long to, const wxString& value) -{ - // TODO -} - -void wxComboBox::Remove(long from, long to) -{ - // TODO -} - -void wxComboBox::SetSelection(long from, long to) -{ - // TODO -} - -int wxComboBox::DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type) -{ -#if USE_HICOMBOBOX - const unsigned int count = items.GetCount(); - for ( unsigned int i = 0; i < count; ++i, ++pos ) - { - HIComboBoxInsertTextItemAtIndex(m_peer->GetControlRef(), - (CFIndex)pos, - wxMacCFStringHolder(items[i], - GetFont().GetEncoding())); - AssignNewItemClientData(pos, clientData, i, type); - } - - //SetControl32BitMaximum( m_peer->GetControlRef(), GetCount() ); - - return pos - 1; -#else - return m_choice->DoInsertItems( items, pos, clientData, type ); -#endif -} - -void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData) -{ -#if USE_HICOMBOBOX - return; //TODO -#else - return m_choice->DoSetItemClientData( n , clientData ); -#endif -} - -void* wxComboBox::DoGetItemClientData(unsigned int n) const -{ -#if USE_HICOMBOBOX - return NULL; //TODO -#else - return m_choice->DoGetItemClientData( n ); -#endif -} - -unsigned int wxComboBox::GetCount() const { -#if USE_HICOMBOBOX - return (unsigned int) HIComboBoxGetItemCount( m_peer->GetControlRef() ); -#else - return m_choice->GetCount(); -#endif -} - -void wxComboBox::DoDeleteOneItem(unsigned int n) -{ -#if USE_HICOMBOBOX - HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex)n ); -#else - m_choice->Delete( n ); -#endif -} - -void wxComboBox::DoClear() -{ -#if USE_HICOMBOBOX - for ( CFIndex i = GetCount() - 1; i >= 0; ++ i ) - verify_noerr( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), i ) ); - m_peer->SetData(kHIComboBoxEditTextPart,kControlEditTextCFStringTag,CFSTR("")); -#else - m_choice->Clear(); -#endif -} - -int wxComboBox::GetSelection() const -{ -#if USE_HICOMBOBOX - return FindString( GetStringSelection() ); -#else - return m_choice->GetSelection(); -#endif -} - -void wxComboBox::SetSelection(int n) -{ -#if USE_HICOMBOBOX - SetControl32BitValue( m_peer->GetControlRef() , n + 1 ); -#else - m_choice->SetSelection( n ); - - if ( m_text != NULL ) - { - m_text->SetValue(GetString(n)); - } -#endif -} - -int wxComboBox::FindString(const wxString& s, bool bCase) const -{ -#if USE_HICOMBOBOX - for( unsigned int i = 0 ; i < GetCount() ; i++ ) - { - if (GetString(i).IsSameAs(s, bCase) ) - return i ; - } - return wxNOT_FOUND; -#else - return m_choice->FindString( s, bCase ); -#endif -} - -wxString wxComboBox::GetString(unsigned int n) const -{ -#if USE_HICOMBOBOX - CFStringRef itemText; - HIComboBoxCopyTextItemAtIndex( m_peer->GetControlRef(), (CFIndex)n, &itemText ); - return wxMacCFStringHolder(itemText).AsString(); -#else - return m_choice->GetString( n ); -#endif -} - -wxString wxComboBox::GetStringSelection() const -{ -#if USE_HICOMBOBOX - return wxMacCFStringHolder(m_peer->GetData(kHIComboBoxEditTextPart,kControlEditTextCFStringTag)).AsString(); -#else - int sel = GetSelection (); - if (sel != wxNOT_FOUND) - return wxString(this->GetString((unsigned int)sel)); - else - return wxEmptyString; -#endif -} - -void wxComboBox::SetString(unsigned int n, const wxString& s) -{ -#if USE_HICOMBOBOX - verify_noerr ( HIComboBoxInsertTextItemAtIndex( m_peer->GetControlRef(), (CFIndex) n, - wxMacCFStringHolder(s, GetFont().GetEncoding()) ) ); - verify_noerr ( HIComboBoxRemoveItemAtIndex( m_peer->GetControlRef(), (CFIndex) n + 1 ) ); -#else - m_choice->SetString( n , s ); -#endif -} - -bool wxComboBox::IsEditable() const -{ -#if USE_HICOMBOBOX - // TODO - return !HasFlag(wxCB_READONLY); -#else - return m_text != NULL && !HasFlag(wxCB_READONLY); -#endif -} - -void wxComboBox::Undo() -{ -#if USE_HICOMBOBOX - // TODO -#else - if (m_text != NULL) - m_text->Undo(); -#endif -} - -void wxComboBox::Redo() -{ -#if USE_HICOMBOBOX - // TODO -#else - if (m_text != NULL) - m_text->Redo(); -#endif -} - -void wxComboBox::SelectAll() -{ -#if USE_HICOMBOBOX - // TODO -#else - if (m_text != NULL) - m_text->SelectAll(); -#endif -} - -bool wxComboBox::CanCopy() const -{ -#if USE_HICOMBOBOX - // TODO - return false; -#else - if (m_text != NULL) - return m_text->CanCopy(); - else - return false; -#endif -} - -bool wxComboBox::CanCut() const -{ -#if USE_HICOMBOBOX - // TODO - return false; -#else - if (m_text != NULL) - return m_text->CanCut(); - else - return false; -#endif -} - -bool wxComboBox::CanPaste() const -{ -#if USE_HICOMBOBOX - // TODO - return false; -#else - if (m_text != NULL) - return m_text->CanPaste(); - else - return false; -#endif -} - -bool wxComboBox::CanUndo() const -{ -#if USE_HICOMBOBOX - // TODO - return false; -#else - if (m_text != NULL) - return m_text->CanUndo(); - else - return false; -#endif -} - -bool wxComboBox::CanRedo() const -{ -#if USE_HICOMBOBOX - // TODO - return false; -#else - if (m_text != NULL) - return m_text->CanRedo(); - else - return false; -#endif -} - -bool wxComboBox::OSXHandleClicked( double timestampsec ) -{ - wxCommandEvent event(wxEVT_COMBOBOX, m_windowId ); - event.SetInt(GetSelection()); - event.SetEventObject(this); - event.SetString(GetStringSelection()); - ProcessCommand(event); - return true; -} diff --git a/Externals/wxWidgets3/src/osx/carbon/control.cpp b/Externals/wxWidgets3/src/osx/carbon/control.cpp index fbf5a31ba7..9886b996fe 100644 --- a/Externals/wxWidgets3/src/osx/carbon/control.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/control.cpp @@ -28,7 +28,7 @@ #include "wx/osx/private.h" -IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) +wxIMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow); wxControl::wxControl() @@ -75,16 +75,5 @@ void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) if ( GetPeer() == NULL || !GetPeer()->IsOk() ) return; -#if wxOSX_USE_CARBON - UInt32 keyCode, modifiers; - char charCode; - - GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); - GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode ); - GetEventParameter( (EventRef)wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - - GetPeer()->HandleKey( keyCode, charCode, modifiers ); -#else // TODO -#endif } diff --git a/Externals/wxWidgets3/src/osx/carbon/corersrc.r b/Externals/wxWidgets3/src/osx/carbon/corersrc.r deleted file mode 100644 index 676a4d3d2a..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/corersrc.r +++ /dev/null @@ -1,159 +0,0 @@ -#ifdef __UNIX__ - #include -#else - #include - #if UNIVERSAL_INTERFACES_VERSION > 0x320 - #include - #endif -#endif - -resource 'ldes' ( 128 ) -{ - versionZero - { - 0 , - 0 , - 0 , - 0 , - hasVertScroll , - noHorizScroll , - 0 , - noGrowSpace , - } -} ; - -resource 'ldes' ( 129 ) -{ - versionZero - { - 0 , - 0 , - 0 , - 0 , - hasVertScroll , - hasHorizScroll , - 0 , - noGrowSpace , - } -} ; - -data 'CURS' (10) { - $"0000 03E0 0630 0808 1004 31C6 2362 2222" - $"2362 31C6 1004 0808 0630 03E0 0000 0000" - $"0000 03E0 07F0 0FF8 1FFC 3FFE 3FFE 3FFE" - $"3FFE 3FFE 1FFC 0FF8 07F0 03E0 0000 0000" - $"0007 0008" -}; - -data 'CURS' (11) { - $"0000 0000 0000 0000 0000 0000 0000 0000" - $"0000 0000 0000 0000 0000 0000 0000 0000" - $"0000 0000 0000 0000 0000 0000 0000 0000" - $"0000 0000 0000 0000 0000 0000 0000 0000" - $"0000 0000" -}; - -data 'CURS' (12) { - $"00F0 0088 0108 0190 0270 0220 0440 0440" - $"0880 0880 1100 1E00 1C00 1800 1000 0000" - $"00F0 00F8 01F8 01F0 03F0 03E0 07C0 07C0" - $"0F80 0F80 1F00 1E00 1C00 1800 1000 0000" - $"000E 0003" -}; - -data 'CURS' (13) { - $"0000 1E00 2100 4080 4080 4080 4080 2180" - $"1FC0 00E0 0070 0038 001C 000E 0006 0000" - $"3F00 7F80 FFC0 FFC0 FFC0 FFC0 FFC0 7FC0" - $"3FE0 1FF0 00F8 007C 003E 001F 000F 0007" - $"0004 0004" -}; - -data 'CURS' (14) { - $"0000 07E0 1FF0 3838 3C0C 6E0E 6706 6386" - $"61C6 60E6 7076 303C 1C1C 0FF8 07E0 0000" - $"0540 0FF0 3FF8 3C3C 7E0E FF0F 6F86 E7C7" - $"63E6 E1F7 70FE 707E 3C3C 1FFC 0FF0 0540" - $"0007 0007" -}; - -data 'CURS' (15) { - $"0000 0380 0380 0380 0380 0380 0380 0FE0" - $"1FF0 1FF0 0000 1FF0 1FF0 1550 1550 1550" - $"07C0 07C0 07C0 07C0 07C0 07C0 0FE0 1FF0" - $"3FF8 3FF8 3FF8 3FF8 3FF8 3FF8 3FF8 3FF8" - $"000B 0007" -}; - -data 'CURS' (16) { - $"00C0 0140 0640 08C0 3180 47FE 8001 8001" - $"81FE 8040 01C0 0040 03C0 C080 3F80 0000" - $"00C0 01C0 07C0 0FC0 3F80 7FFE FFFF FFFF" - $"FFFE FFC0 FFC0 FFC0 FFC0 FF80 3F80 0000" - $"0006 000F" -}; - -data 'CURS' (17) { - $"0100 0280 0260 0310 018C 7FE3 8000 8000" - $"7F80 0200 0380 0200 03C0 0107 01F8 0000" - $"0100 0380 03E0 03F0 01FC 7FFF FFFF FFFF" - $"FFFF 03FF 03FF 03FF 03FF 01FF 01F8 0000" - $"0006 0000" -}; - -data 'CURS' (18) { - $"0000 4078 60FC 71CE 7986 7C06 7E0E 7F1C" - $"7FB8 7C30 6C30 4600 0630 0330 0300 0000" - $"C078 E0FC F1FE FBFF FFCF FF8F FF1F FFBE" - $"FFFC FE78 FF78 EFF8 CFF8 87F8 07F8 0300" - $"0001 0001" -}; - -data 'CURS' (19) { - $"0000 0002 0006 000E 001E 003E 007E 00FE" - $"01FE 003E 0036 0062 0060 00C0 00C0 0000" - $"0003 0007 000F 001F 003F 007F 00FF 01FF" - $"03FF 07FF 007F 00F7 00F3 01E1 01E0 01C0" - $"0001 000E" -}; - -data 'CURS' (20) { - $"0000 0080 01C0 03E0 0080 0080 0080 1FFC" - $"1FFC 0080 0080 0080 03E0 01C0 0080 0000" - $"0080 01C0 03E0 07F0 0FF8 01C0 3FFE 3FFE" - $"3FFE 3FFE 01C0 0FF8 07F0 03E0 01C0 0080" - $"0007 0008" -}; - -data 'CURS' (21) { - $"0000 0080 01C0 03E0 0080 0888 188C 3FFE" - $"188C 0888 0080 03E0 01C0 0080 0000 0000" - $"0080 01C0 03E0 07F0 0BE8 1DDC 3FFE 7FFF" - $"3FFE 1DDC 0BE8 07F0 03E0 01C0 0080 0000" - $"0007 0008" -}; - -data 'CURS' (22) { - $"0000 001E 000E 060E 0712 03A0 01C0 00E0" - $"0170 1238 1C18 1C00 1E00 0000 0000 0000" - $"007F 003F 0E1F 0F0F 0F97 07E3 03E1 21F0" - $"31F8 3A7C 3C3C 3E1C 3F00 3F80 0000 0000" - $"0006 0009" -}; - -data 'CURS' (23) { - $"0000 7800 7000 7060 48E0 05C0 0380 0700" - $"0E80 1C48 1838 0038 0078 0000 0000 0000" - $"FE00 FC00 F870 F0F0 E9F0 C7E0 87C0 0F84" - $"1F8C 3E5C 3C3C 387C 00FC 01FC 0000 0000" - $"0006 0006" -}; - -data 'CURS' (24) { - $"0006 000E 001C 0018 0020 0040 00F8 0004" - $"1FF4 200C 2AA8 1FF0 1F80 3800 6000 8000" - $"000F 001F 003E 007C 0070 00E0 01FC 3FF6" - $"7FF6 7FFE 7FFC 7FF8 3FF0 7FC0 F800 E000" - $"000A 0006" -}; - diff --git a/Externals/wxWidgets3/src/osx/carbon/cursor.cpp b/Externals/wxWidgets3/src/osx/carbon/cursor.cpp index 34afa0c00c..9f6e7f69bf 100644 --- a/Externals/wxWidgets3/src/osx/carbon/cursor.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/cursor.cpp @@ -23,7 +23,7 @@ #include "wx/osx/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject); class WXDLLEXPORT wxCursorRefData: public wxGDIRefData @@ -33,15 +33,11 @@ public: wxCursorRefData(const wxCursorRefData& cursor); virtual ~wxCursorRefData(); - virtual bool IsOk() const + virtual bool IsOk() const wxOVERRIDE { #if wxOSX_USE_COCOA_OR_CARBON if ( m_hCursor != NULL ) return true; -#if wxOSX_USE_CARBON - if ( m_themeCursor != -1 ) - return true; -#endif return false; #else @@ -53,12 +49,6 @@ public: protected: #if wxOSX_USE_COCOA WX_NSCursor m_hCursor; -#elif wxOSX_USE_CARBON - WXHCURSOR m_hCursor; - bool m_disposeHandle; - bool m_releaseHandle; - bool m_isColorCursor; - long m_themeCursor; #elif wxOSX_USE_IPHONE void* m_hCursor; #endif @@ -209,33 +199,9 @@ ClassicCursor gMacCursors[kwxCursorLast+1] = wxCursor gMacCurrentCursor ; -#if wxOSX_USE_CARBON -CursHandle wxGetStockCursor( int number ) -{ - wxASSERT_MSG( number >= 0 && number <=kwxCursorLast , wxT("invalid stock cursor id") ) ; - CursHandle c = (CursHandle) NewHandle( sizeof(Cursor) ) ; - memcpy( *c, &gMacCursors[number], sizeof(Cursor) ) ; - -#ifndef WORDS_BIGENDIAN - short *sptr = (short*) *c ; - for ( int i = 0 ; i < 2 * 16 /* image and mask */ ; ++i, ++sptr ) - { - *sptr = CFSwapInt16( *sptr ) ; - } -#endif - return c ; -} -#endif - wxCursorRefData::wxCursorRefData() { m_hCursor = NULL; -#if wxOSX_USE_CARBON - m_disposeHandle = false; - m_releaseHandle = false; - m_isColorCursor = false; - m_themeCursor = -1; -#endif } wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) : wxGDIRefData() @@ -244,12 +210,6 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) : wxGDIRefData() #if wxOSX_USE_COCOA m_hCursor = (WX_NSCursor) wxMacCocoaRetain(cursor.m_hCursor); -#elif wxOSX_USE_CARBON - // FIXME: need to copy the cursor - m_disposeHandle = false; - m_releaseHandle = false; - m_isColorCursor = cursor.m_isColorCursor; - m_themeCursor = cursor.m_themeCursor; #endif } @@ -258,22 +218,6 @@ wxCursorRefData::~wxCursorRefData() #if wxOSX_USE_COCOA if ( m_hCursor ) wxMacCocoaRelease(m_hCursor); -#elif wxOSX_USE_CARBON - if ( m_isColorCursor ) - { -#ifndef __LP64__ - ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ; -#endif - } - else if ( m_disposeHandle ) - { - ::DisposeHandle( (Handle ) m_hCursor ) ; - } - else if ( m_releaseHandle ) - { - // we don't release the resource since it may already - // be in use again - } #endif } @@ -303,29 +247,6 @@ WXHCURSOR wxCursor::GetHCURSOR() const return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } -#if wxOSX_USE_CARBON -short GetCTabIndex( CTabHandle colors , RGBColor *col ) -{ - short retval = 0 ; - unsigned long bestdiff = 0xFFFF ; - - for ( int i = 0 ; i < (**colors).ctSize ; ++i ) - { - unsigned long diff = abs(col->red - (**colors).ctTable[i].rgb.red ) + - abs(col->green - (**colors).ctTable[i].rgb.green ) + - abs(col->blue - (**colors).ctTable[i].rgb.blue ) ; - - if ( diff < bestdiff ) - { - bestdiff = diff ; - retval = (**colors).ctTable[i].value ; - } - } - - return retval ; -} -#endif - #if wxUSE_IMAGE void wxCursor::CreateFromImage(const wxImage & image) @@ -341,137 +262,6 @@ void wxCursor::CreateFromImage(const wxImage & image) M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY ); CFRelease( cgimage ); } -#elif wxOSX_USE_CARBON -#ifndef __LP64__ - int w = 16; - int h = 16; - - int image_w = image.GetWidth(); - int image_h = image.GetHeight(); - - wxASSERT_MSG( hotSpotX >= 0 && hotSpotX < image_w && - hotSpotY >= 0 && hotSpotY < image_h, - wxT("invalid cursor hot spot coordinates") ); - - wxImage image16(image); // final image of correct size - - // if image is too small then place it in the center, resize it if too big - if ((w > image_w) && (h > image_h)) - { - wxPoint offset((w - image_w) / 2, (h - image_h) / 2); - hotSpotX = hotSpotX + offset.x; - hotSpotY = hotSpotY + offset.y; - - image16 = image.Size(wxSize(w, h), offset); - } - else if ((w != image_w) || (h != image_h)) - { - hotSpotX = int(hotSpotX * double(w) / double(image_w)); - hotSpotY = int(hotSpotY * double(h) / double(image_h)); - - image16 = image.Scale(w, h); - } - - unsigned char * rgbBits = image16.GetData(); - bool bHasMask = image16.HasMask() ; - - PixMapHandle pm = (PixMapHandle) NewHandleClear( sizeof(PixMap) ) ; - short extent = 16 ; - short bytesPerPixel = 1 ; - short depth = 8 ; - Rect bounds = { 0 , 0 , extent , extent } ; - CCrsrHandle ch = (CCrsrHandle) NewHandleClear( sizeof(CCrsr) ) ; - CTabHandle newColors = GetCTable( 8 ) ; - HandToHand( (Handle *) &newColors ); - - // set the values to the indices - for ( int i = 0 ; i < (**newColors).ctSize ; ++i ) - { - (**newColors).ctTable[i].value = i ; - } - - HLock( (Handle)ch ); - (**ch).crsrType = 0x8001; // color cursors - (**ch).crsrMap = pm; - short bytesPerRow = bytesPerPixel * extent; - - (**pm).baseAddr = 0; - (**pm).rowBytes = bytesPerRow | 0x8000; - (**pm).bounds = bounds; - (**pm).pmVersion = 0; - (**pm).packType = 0; - (**pm).packSize = 0; - (**pm).hRes = 0x00480000; // 72 DPI default res - (**pm).vRes = 0x00480000; // 72 DPI default res - (**pm).pixelSize = depth; - (**pm).pixelType = 0; - (**pm).cmpCount = 1; - (**pm).cmpSize = depth; - (**pm).pmTable = newColors; - - (**ch).crsrData = NewHandleClear( extent * bytesPerRow ) ; - (**ch).crsrXData = NULL ; - (**ch).crsrXValid = 0; - (**ch).crsrXHandle = NULL; - - (**ch).crsrHotSpot.h = hotSpotX ; - (**ch).crsrHotSpot.v = hotSpotY ; - (**ch).crsrXTable = 0 ; - (**ch).crsrID = GetCTSeed() ; - - memset( (**ch).crsr1Data , 0 , sizeof( Bits16 ) ) ; - memset( (**ch).crsrMask , 0 , sizeof( Bits16 ) ) ; - - unsigned char mr = image16.GetMaskRed() ; - unsigned char mg = image16.GetMaskGreen() ; - unsigned char mb = image16.GetMaskBlue() ; - - for ( int y = 0 ; y < h ; ++y ) - { - short rowbits = 0, maskbits = 0 ; - - for ( int x = 0 ; x < w ; ++x ) - { - long pos = (y * w + x) * 3; - - unsigned char r = rgbBits[pos] ; - unsigned char g = rgbBits[pos + 1] ; - unsigned char b = rgbBits[pos + 2] ; - RGBColor col = { 0xFFFF, 0xFFFF, 0xFFFF } ; - - if ( bHasMask && r == mr && g == mg && b == mb ) - { - // masked area, does not appear anywhere - } - else - { - if ( (int)r + (int)g + (int)b < 0x0200 ) - rowbits |= ( 1 << (15 - x) ) ; - - maskbits |= ( 1 << (15 - x) ) ; - - wxColor( r , g , b ).GetRGBColor( &col ); - } - - *((*(**ch).crsrData) + y * bytesPerRow + x) = - GetCTabIndex( newColors , &col) ; - } -#ifdef WORDS_BIGENDIAN - (**ch).crsr1Data[y] = rowbits ; - (**ch).crsrMask[y] = maskbits ; -#else - (**ch).crsr1Data[y] = CFSwapInt16(rowbits) ; - (**ch).crsrMask[y] = CFSwapInt16(maskbits) ; -#endif - } - - if ( !bHasMask ) - memcpy( (**ch).crsrMask , (**ch).crsr1Data , sizeof( Bits16) ) ; - - HUnlock( (Handle)ch ) ; - M_CURSORDATA->m_hCursor = ch ; - M_CURSORDATA->m_isColorCursor = true ; -#endif #endif } @@ -484,41 +274,6 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX { #if wxOSX_USE_COCOA wxFAIL_MSG( wxT("Not implemented") ); -#elif wxOSX_USE_CARBON -#ifndef __LP64__ - Str255 theName ; - wxMacStringToPascal( cursor_file , theName ) ; - - Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ; - if ( resHandle ) - { - short theId = -1 ; - OSType theType ; - - GetResInfo( resHandle , &theId , &theType , theName ) ; - ReleaseResource( resHandle ) ; - - M_CURSORDATA->m_hCursor = GetCCursor( theId ) ; - if ( M_CURSORDATA->m_hCursor ) - M_CURSORDATA->m_isColorCursor = true ; - } - else - { - Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ; - if ( resHandle ) - { - short theId = -1 ; - OSType theType ; - - GetResInfo( resHandle , &theId , &theType , theName ) ; - ReleaseResource( resHandle ) ; - - M_CURSORDATA->m_hCursor = GetCursor( theId ) ; - if ( M_CURSORDATA->m_hCursor ) - M_CURSORDATA->m_releaseHandle = true ; - } - } -#endif #endif } else @@ -544,117 +299,6 @@ void wxCursor::InitFromStock(wxStockCursor cursor_type) m_refData = new wxCursorRefData; #if wxOSX_USE_COCOA M_CURSORDATA->m_hCursor = wxMacCocoaCreateStockCursor( cursor_type ); -#elif wxOSX_USE_CARBON - switch (cursor_type) - { - case wxCURSOR_COPY_ARROW: - M_CURSORDATA->m_themeCursor = kThemeCopyArrowCursor; - break; - - case wxCURSOR_WAIT: - M_CURSORDATA->m_themeCursor = kThemeWatchCursor; - break; - - case wxCURSOR_IBEAM: - M_CURSORDATA->m_themeCursor = kThemeIBeamCursor; - break; - - case wxCURSOR_CROSS: - M_CURSORDATA->m_themeCursor = kThemeCrossCursor; - break; - - case wxCURSOR_SIZENWSE: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNWSE); - break; - - case wxCURSOR_SIZENESW: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNESW); - break; - - case wxCURSOR_SIZEWE: - M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor; - break; - - case wxCURSOR_SIZENS: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSizeNS); - break; - - case wxCURSOR_SIZING: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorSize); - break; - - case wxCURSOR_HAND: - M_CURSORDATA->m_themeCursor = kThemePointingHandCursor; - break; - - case wxCURSOR_BULLSEYE: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorBullseye); - break; - - case wxCURSOR_PENCIL: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPencil); - break; - - case wxCURSOR_MAGNIFIER: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorMagnifier); - break; - - case wxCURSOR_NO_ENTRY: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorNoEntry); - break; - - case wxCURSOR_WATCH: - M_CURSORDATA->m_themeCursor = kThemeWatchCursor; - break; - - case wxCURSOR_PAINT_BRUSH: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPaintBrush); - break; - - case wxCURSOR_POINT_LEFT: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPointLeft); - break; - - case wxCURSOR_POINT_RIGHT: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorPointRight); - break; - - case wxCURSOR_QUESTION_ARROW: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorQuestionArrow); - break; - - case wxCURSOR_BLANK: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorBlank); - break; - - case wxCURSOR_RIGHT_ARROW: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorRightArrow); - break; - - case wxCURSOR_SPRAYCAN: - M_CURSORDATA->m_hCursor = wxGetStockCursor(kwxCursorRoller); - break; - - case wxCURSOR_OPEN_HAND: - M_CURSORDATA->m_themeCursor = kThemeOpenHandCursor; - break; - - case wxCURSOR_CLOSED_HAND: - M_CURSORDATA->m_themeCursor = kThemeClosedHandCursor; - break; - - case wxCURSOR_CHAR: - case wxCURSOR_ARROW: - case wxCURSOR_LEFT_BUTTON: - case wxCURSOR_RIGHT_BUTTON: - case wxCURSOR_MIDDLE_BUTTON: - default: - M_CURSORDATA->m_themeCursor = kThemeArrowCursor; - break; - } - - if ( M_CURSORDATA->m_themeCursor == -1 ) - M_CURSORDATA->m_releaseHandle = true; #endif } @@ -664,24 +308,6 @@ void wxCursor::MacInstall() const #if wxOSX_USE_COCOA if ( IsOk() ) wxMacCocoaSetCursor( M_CURSORDATA->m_hCursor ); -#elif wxOSX_USE_CARBON - if ( m_refData && M_CURSORDATA->m_themeCursor != -1 ) - { - SetThemeCursor( M_CURSORDATA->m_themeCursor ) ; - } - else if ( m_refData && M_CURSORDATA->m_hCursor ) - { -#ifndef __LP64__ - if ( M_CURSORDATA->m_isColorCursor ) - ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ; - else - ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ; -#endif - } - else - { - SetThemeCursor( kThemeArrowCursor ) ; - } #endif } diff --git a/Externals/wxWidgets3/src/osx/carbon/dataobj.cpp b/Externals/wxWidgets3/src/osx/carbon/dataobj.cpp index 2b625d0e06..edd62110b3 100644 --- a/Externals/wxWidgets3/src/osx/carbon/dataobj.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/dataobj.cpp @@ -24,15 +24,12 @@ #include "wx/mstream.h" #include "wx/metafile.h" +#include "wx/scopedarray.h" #include "wx/tokenzr.h" #include "wx/filename.h" #include "wx/osx/private.h" -#if wxOSX_USE_COCOA_OR_CARBON - #include -#endif - // ---------------------------------------------------------------------------- // wxDataFormat // ---------------------------------------------------------------------------- @@ -395,8 +392,8 @@ bool wxDataObject::GetFromPasteboard( void * pb ) PasteboardRef pasteboard = (PasteboardRef) pb; size_t formatcount = GetFormatCount(wxDataObject::Set); - wxDataFormat *array = new wxDataFormat[ formatcount ]; - GetAllFormats(array, wxDataObject::Set); + wxScopedArray array(formatcount); + GetAllFormats(array.get(), wxDataObject::Set); ItemCount itemCount = 0; wxString filenamesPassed; @@ -539,8 +536,8 @@ bool wxDataObject::HasDataInPasteboard( void * pb ) { PasteboardRef pasteboard = (PasteboardRef) pb; size_t formatcount = GetFormatCount(wxDataObject::Set); - wxDataFormat *array = new wxDataFormat[ formatcount ]; - GetAllFormats(array, wxDataObject::Set); + wxScopedArray array(formatcount); + GetAllFormats(array.get(), wxDataObject::Set); ItemCount itemCount = 0; bool hasData = false; @@ -840,10 +837,7 @@ bool wxBitmapDataObject::SetData( size_t nSize, const void *pBuf ) if ( cgImageRef ) { - m_bitmap.Create( CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); - CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); - // since our context is upside down we dont use CGContextDrawImage - wxMacDrawCGImage( (CGContextRef) m_bitmap.GetHBITMAP() , &r, cgImageRef ) ; + m_bitmap.Create( cgImageRef ); CGImageRelease(cgImageRef); cgImageRef = NULL; } diff --git a/Externals/wxWidgets3/src/osx/carbon/dataview.cpp b/Externals/wxWidgets3/src/osx/carbon/dataview.cpp deleted file mode 100644 index 66781a9e74..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/dataview.cpp +++ /dev/null @@ -1,2823 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/dataview.cpp -// Purpose: wxDataViewCtrl native carbon implementation -// Author: -// Copyright: (c) 2009 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if (wxUSE_DATAVIEWCTRL == 1) && !defined(wxUSE_GENERICDATAVIEWCTRL) - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/toplevel.h" - #include "wx/font.h" - #include "wx/settings.h" - #include "wx/utils.h" -#endif - -#include "wx/osx/carbon/dataview.h" -#include "wx/osx/private.h" -#include "wx/osx/uma.h" -#include "wx/renderer.h" - -#include - -// ============================================================================ -// Variables used locally in dataview.cpp -// ============================================================================ -static DataBrowserGetContextualMenuUPP gDataBrowserTableViewGetContextualMenuUPP = NULL; -static DataBrowserItemCompareUPP gDataBrowserTableViewItemCompareUPP = NULL; -static DataBrowserItemDataUPP gDataBrowserTableViewItemDataUPP = NULL; -static DataBrowserItemNotificationUPP gDataBrowserTableViewItemNotificationUPP = NULL; - -static DataBrowserAcceptDragUPP gDataBrowserTableViewAcceptDragUPP = NULL; -static DataBrowserAddDragItemUPP gDataBrowserTableViewAddDragItemUPP = NULL; -static DataBrowserReceiveDragUPP gDataBrowserTableViewReceiveDragUPP = NULL; - -static DataBrowserDrawItemUPP gDataBrowserTableViewDrawItemUPP = NULL; -static DataBrowserEditItemUPP gDataBrowserTableViewEditItemUPP = NULL; -static DataBrowserHitTestUPP gDataBrowserTableViewHitTestUPP = NULL; -static DataBrowserTrackingUPP gDataBrowserTableViewTrackingUPP = NULL; - -// ============================================================================ -// Functions used locally in dataview.cpp -// ============================================================================ -static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDataViewItemArray const& items) // returns a newly allocated pointer to valid data browser item IDs -{ - size_t const noOfItems = items.GetCount(); - - DataBrowserItemID* itemIDs(new DataBrowserItemID[noOfItems]); - - - // convert all valid data view items to data browser items - noOfEntries = 0; - for (size_t i=0; i(items[i].GetID()); - ++noOfEntries; - } - // done: - return itemIDs; -} - -static const EventTypeSpec eventList[] = -{ - { kEventClassControl, kEventControlHit }, - { kEventClassControl, kEventControlDraw } -}; - -static pascal OSStatus DataBrowserCtrlEventHandler(EventHandlerCallRef handler, EventRef EventReference, void* Data) -{ - wxDataViewCtrl* DataViewCtrlPtr((wxDataViewCtrl*) Data); // the 'Data' variable always contains a pointer to the data view control that installed the handler - - wxMacCarbonEvent CarbonEvent(EventReference) ; - - - switch (GetEventKind(EventReference)) - { - case kEventControlDraw: - { - OSStatus status; - - DataViewCtrlPtr->MacSetDrawingContext(CarbonEvent.GetParameter(kEventParamCGContextRef,typeCGContextRef)); - status = ::CallNextEventHandler(handler,EventReference); - DataViewCtrlPtr->MacSetDrawingContext(NULL); - return status; - } - case kEventControlHit : - if (CarbonEvent.GetParameter(kEventParamControlPart,typeControlPartCode) == kControlButtonPart) // we only care about the header - { - ControlRef controlReference; - DataBrowserPropertyID columnPropertyID; - DataBrowserSortOrder order; - unsigned long columnIndex; - wxDataViewColumn* column; - OSStatus status; - wxDataViewEvent DataViewEvent(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId()); - - CarbonEvent.GetParameter(kEventParamDirectObject,&controlReference); - // determine the column that triggered the event (this is the column that is responsible for sorting the data view): - status = ::GetDataBrowserSortProperty(controlReference,&columnPropertyID); - wxCHECK(status == noErr,status); - status = ::GetDataBrowserTableViewColumnPosition(controlReference,columnPropertyID,&columnIndex); - if (status == errDataBrowserPropertyNotFound) // user clicked into part of the header that does not have a property - return ::CallNextEventHandler(handler,EventReference); - wxCHECK(status == noErr,status); - column = DataViewCtrlPtr->GetColumn(columnIndex); - // set the column sort order: - status = ::GetDataBrowserSortOrder(controlReference,&order); - wxCHECK(status == noErr,status); - column->SetSortOrderVariable(order == kDataBrowserOrderIncreasing); - // initialize wxWidget event handler: - DataViewEvent.SetEventObject(DataViewCtrlPtr); - DataViewEvent.SetColumn(columnIndex); - DataViewEvent.SetDataViewColumn(column); - // finally sent the equivalent wxWidget event: - DataViewCtrlPtr->HandleWindowEvent(DataViewEvent); - return ::CallNextEventHandler(handler,EventReference); - } - else - return eventNotHandledErr; - } - return eventNotHandledErr; -} - -static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, wxCFStringRef const& title) -{ - // set properties for the column: - columnDescription.propertyDesc.propertyID = columnPtr->GetNativeData()->GetPropertyID(); - columnDescription.propertyDesc.propertyType = columnPtr->GetRenderer()->GetNativeData()->GetPropertyType(); - columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable - if (columnPtr->IsReorderable()) - columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn; - if (columnPtr->IsResizeable()) - { - columnDescription.headerBtnDesc.minimumWidth = 0; - columnDescription.headerBtnDesc.maximumWidth = 30000; // 32767 is the theoretical maximum though but 30000 looks nicer - } - else - { - columnDescription.headerBtnDesc.minimumWidth = columnPtr->GetWidth(); - columnDescription.headerBtnDesc.maximumWidth = columnPtr->GetWidth(); - } - if (columnPtr->IsSortable()) - columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn; - if ((columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE) || - (columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)) - columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable; - if ((columnDescription.propertyDesc.propertyType == kDataBrowserCustomType) || - (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType) || - (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) || - (columnDescription.propertyDesc.propertyType == kDataBrowserTextType)) - columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types - columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; - // set header's properties: - columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - columnDescription.headerBtnDesc.titleOffset = 0; - columnDescription.headerBtnDesc.titleString = ::CFStringCreateCopy(kCFAllocatorDefault,title); - columnDescription.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing; // choose one of the orders as "undefined" is not supported anyway (s. ControlDefs.h in the HIToolbox framework) - columnDescription.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask; - switch (columnPtr->GetAlignment()) - { - case wxALIGN_CENTER: - case wxALIGN_CENTER_HORIZONTAL: - columnDescription.headerBtnDesc.btnFontStyle.just = teCenter; - break; - case wxALIGN_LEFT: - columnDescription.headerBtnDesc.btnFontStyle.just = teFlushLeft; - break; - case wxALIGN_RIGHT: - columnDescription.headerBtnDesc.btnFontStyle.just = teFlushRight; - break; - default: - columnDescription.headerBtnDesc.btnFontStyle.just = teFlushDefault; - } - columnDescription.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; - columnDescription.headerBtnDesc.btnFontStyle.style = normal; - if (columnPtr->GetBitmap().IsOk()) - { - columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef; - columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef(); - } - else - { - // not text only as we otherwise could not add a bitmap later - // columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; - columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef; - columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = NULL; - } - - // done: - return true; -} - -// ============================================================================ -// Type definitions of locally used function pointers -// ============================================================================ -DEFINE_ONE_SHOT_HANDLER_GETTER(DataBrowserCtrlEventHandler) - -// ============================================================================ -// Helper functions for dataview implementation on OSX -// ============================================================================ -wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(parent), wxWindowID WXUNUSED(id), wxPoint const& pos, wxSize const& size, - long style, long WXUNUSED(extraStyle)) -{ - return new wxMacDataViewDataBrowserListViewControl(wxpeer,pos,size,style); -} - -// ============================================================================ -// wxMacDataBrowserTableViewControl -// ============================================================================ -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - return ControlPtr->DataBrowserCompareProc(itemOneID,itemTwoID,sortProperty); - else - return FALSE; -} - -pascal void wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - ControlPtr->DataBrowserGetContextualMenuProc(menu,helpType,helpItemString,selection); -} - -pascal OSStatus wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - return ControlPtr->DataBrowserGetSetItemDataProc(itemID,propertyID,itemData,getValue); - else - return errDataBrowserPropertyNotSupported; -} - -pascal void wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - ControlPtr->DataBrowserItemNotificationProc(itemID,message,itemData); -} - -pascal void wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - ControlPtr->DataBrowserDrawItemProc(itemID,propertyID,state,rectangle,bitDepth,colorDevice); -} - -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - return ((ControlPtr != NULL) && ControlPtr->DataBrowserEditItemProc(itemID,propertyID,theString,maxEditTextRect,shrinkToFit)); -} - -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserHitTestProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - return ((ControlPtr != NULL) && ControlPtr->DataBrowserHitTestProc(itemID,propertyID,theRect,mouseRect)); -} - -pascal DataBrowserTrackingResult wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) -{ - wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - if (ControlPtr != NULL) - return ControlPtr->DataBrowserTrackingProc(itemID,propertyID,theRect,startPt,modifiers); - else - return kDataBrowserNothingHit; -} - -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID) -{ - wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - return ((controlPtr != NULL) && controlPtr->DataBrowserAcceptDragProc(dragRef,itemID)); -} - -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) -{ - wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - return ((controlPtr != NULL) && controlPtr->DataBrowserAddDragItemProc(dragRef,itemID,itemRef)); -} - -pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID) -{ - wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast(wxMacControl::GetReferenceFromNativeControl(browser))); - - - return ((controlPtr != NULL) && controlPtr->DataBrowserReceiveDragProc(dragRef,itemID)); -} - -wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) - :wxMacControl(peer) -{ - Rect bounds = wxMacGetBoundsForControl(peer,pos,size); - OSStatus err = ::CreateDataBrowserControl(MAC_WXHWND(peer->MacGetTopLevelWindowRef()),&bounds,kDataBrowserListView,&(m_controlRef)); - - - SetReferenceInNativeControl(); - verify_noerr(err); - - ::InstallControlEventHandler(m_controlRef, GetDataBrowserCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, peer, (EventHandlerRef *)&m_macDataViewCtrlEventHandler); - - // setup standard callbacks: - if (gDataBrowserTableViewGetContextualMenuUPP == NULL) gDataBrowserTableViewGetContextualMenuUPP = NewDataBrowserGetContextualMenuUPP(wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc); - if (gDataBrowserTableViewItemCompareUPP == NULL) gDataBrowserTableViewItemCompareUPP = NewDataBrowserItemCompareUPP (wxMacDataBrowserTableViewControl::DataBrowserCompareProc); - if (gDataBrowserTableViewItemDataUPP == NULL) gDataBrowserTableViewItemDataUPP = NewDataBrowserItemDataUPP (wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc); - if (gDataBrowserTableViewItemNotificationUPP == NULL) - { - gDataBrowserTableViewItemNotificationUPP = -#if TARGET_API_MAC_OSX - (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc); -#else - NewDataBrowserItemNotificationUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc); -#endif - } - // setup drag and drop callbacks: - if (gDataBrowserTableViewAcceptDragUPP == NULL) gDataBrowserTableViewAcceptDragUPP = NewDataBrowserAcceptDragUPP (wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc); - if (gDataBrowserTableViewAddDragItemUPP == NULL) gDataBrowserTableViewAddDragItemUPP = NewDataBrowserAddDragItemUPP(wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc); - if (gDataBrowserTableViewReceiveDragUPP == NULL) gDataBrowserTableViewReceiveDragUPP = NewDataBrowserReceiveDragUPP(wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc); - - DataBrowserCallbacks callbacks; // variable definition - - InitializeDataBrowserCallbacks(&callbacks,kDataBrowserLatestCallbacks); - callbacks.u.v1.getContextualMenuCallback = gDataBrowserTableViewGetContextualMenuUPP; - callbacks.u.v1.itemDataCallback = gDataBrowserTableViewItemDataUPP; - callbacks.u.v1.itemCompareCallback = gDataBrowserTableViewItemCompareUPP; - callbacks.u.v1.itemNotificationCallback = gDataBrowserTableViewItemNotificationUPP; - callbacks.u.v1.acceptDragCallback = gDataBrowserTableViewAcceptDragUPP; - callbacks.u.v1.addDragItemCallback = gDataBrowserTableViewAddDragItemUPP; - callbacks.u.v1.receiveDragCallback = gDataBrowserTableViewReceiveDragUPP; - SetCallbacks(&callbacks); - - // setup callbacks for customized items: - if (gDataBrowserTableViewDrawItemUPP == NULL) gDataBrowserTableViewDrawItemUPP = NewDataBrowserDrawItemUPP(wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc); - if (gDataBrowserTableViewEditItemUPP == NULL) gDataBrowserTableViewEditItemUPP = NewDataBrowserEditItemUPP(wxMacDataBrowserTableViewControl::DataBrowserEditItemProc); - if (gDataBrowserTableViewHitTestUPP == NULL) gDataBrowserTableViewHitTestUPP = NewDataBrowserHitTestUPP (wxMacDataBrowserTableViewControl::DataBrowserHitTestProc); - if (gDataBrowserTableViewTrackingUPP == NULL) gDataBrowserTableViewTrackingUPP = NewDataBrowserTrackingUPP(wxMacDataBrowserTableViewControl::DataBrowserTrackingProc); - - DataBrowserCustomCallbacks customCallbacks; // variable definition - - InitializeDataBrowserCustomCallbacks(&customCallbacks,kDataBrowserLatestCallbacks); - customCallbacks.u.v1.drawItemCallback = gDataBrowserTableViewDrawItemUPP; - customCallbacks.u.v1.editTextCallback = gDataBrowserTableViewEditItemUPP; - customCallbacks.u.v1.hitTestCallback = gDataBrowserTableViewHitTestUPP; - customCallbacks.u.v1.trackingCallback = gDataBrowserTableViewTrackingUPP; - SetCustomCallbacks(&customCallbacks); - - // style setting: - EnableCellSizeModification( ((style & wxDV_VARIABLE_LINE_HEIGHT) != 0), true ); - - DataBrowserSelectionFlags flags; // variable definition - - if (GetSelectionFlags(&flags) == noErr) // get default settings - { - if ((style & wxDV_MULTIPLE) != 0) - flags &= ~kDataBrowserSelectOnlyOne; - else - flags |= kDataBrowserSelectOnlyOne; - (void) SetSelectionFlags(flags); - } - - OptionBits attributes; // variable definition - - if (GetAttributes(&attributes) == noErr) // get default settings - { - if ((style & wxDV_VERT_RULES) != 0) - attributes |= kDataBrowserAttributeListViewDrawColumnDividers; - else - attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers; - if ((style & wxDV_ROW_LINES) != 0) - attributes |= kDataBrowserAttributeListViewAlternatingRowColors; - else - attributes &= ~kDataBrowserAttributeListViewAlternatingRowColors; - (void) SetAttributes(attributes); - } - - if ((style & wxDV_NO_HEADER) != 0) - SetHeaderButtonHeight(0); -} - -wxMacDataBrowserTableViewControl::~wxMacDataBrowserTableViewControl() -{ - ::RemoveEventHandler((EventHandlerRef) m_macDataViewCtrlEventHandler); -} - -// -// callback handling -// -OSStatus wxMacDataBrowserTableViewControl::SetCallbacks(DataBrowserCallbacks const* callbacks) -{ - return ::SetDataBrowserCallbacks(m_controlRef,callbacks); -} - -OSStatus wxMacDataBrowserTableViewControl::SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks) -{ - return ::SetDataBrowserCustomCallbacks(m_controlRef,customCallbacks); -} - -// -// DnD handling -// -OSStatus wxMacDataBrowserTableViewControl::EnableAutomaticDragTracking(bool enable) -{ - return ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(m_controlRef),enable); -} - -// -// header handling -// -OSStatus wxMacDataBrowserTableViewControl::GetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc) const -{ - desc->version = kDataBrowserListViewLatestHeaderDesc; // if this statement is missing the next call will fail (NOT DOCUMENTED!!) - return ::GetDataBrowserListViewHeaderDesc(m_controlRef,propertyID,desc); -} - -OSStatus wxMacDataBrowserTableViewControl::SetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc) -{ - return ::SetDataBrowserListViewHeaderDesc(m_controlRef,propertyID,desc); -} - -// -// layout handling -// -OSStatus wxMacDataBrowserTableViewControl::AutoSizeColumns() -{ - return AutoSizeDataBrowserListViewColumns(m_controlRef); -} - -OSStatus wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool enableHeight, bool enableWidth) -{ - return ::SetDataBrowserTableViewGeometry(GetControlRef(),enableWidth,enableHeight); -} - -OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes) -{ - return ::DataBrowserGetAttributes(GetControlRef(),attributes); -} - -OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const -{ - return ::GetDataBrowserTableViewNamedColumnWidth(m_controlRef,propertyID,width); -} - -OSStatus wxMacDataBrowserTableViewControl::GetDefaultColumnWidth( UInt16 *width ) const -{ - return GetDataBrowserTableViewColumnWidth(m_controlRef, width ); -} - -OSStatus wxMacDataBrowserTableViewControl::GetDefaultRowHeight(UInt16* height) const -{ - return ::GetDataBrowserTableViewRowHeight(m_controlRef,height); -} - -OSStatus wxMacDataBrowserTableViewControl::GetHeaderButtonHeight(UInt16 *height) -{ - return ::GetDataBrowserListViewHeaderBtnHeight(m_controlRef,height); -} - -OSStatus wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserPropertyPart part, Rect* bounds) -{ - return ::GetDataBrowserItemPartBounds(m_controlRef,item,propertyID,part,bounds); -} - -OSStatus wxMacDataBrowserTableViewControl::GetRowHeight(DataBrowserItemID item, UInt16* height) const -{ - return ::GetDataBrowserTableViewItemRowHeight(m_controlRef,item,height); -} - -OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt32 *left ) const -{ - return GetDataBrowserScrollPosition(m_controlRef, top , left ); -} - -OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes) -{ - return ::DataBrowserChangeAttributes(GetControlRef(),attributes,~attributes); -} - -OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width) -{ - return ::SetDataBrowserTableViewNamedColumnWidth(m_controlRef,propertyID,width); -} - -OSStatus wxMacDataBrowserTableViewControl::SetDefaultColumnWidth(UInt16 width) -{ - return ::SetDataBrowserTableViewColumnWidth(m_controlRef,width); -} - -OSStatus wxMacDataBrowserTableViewControl::SetDefaultRowHeight(UInt16 height) -{ - return ::SetDataBrowserTableViewRowHeight(m_controlRef,height); -} - -OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars(bool horiz, bool vert) -{ - return ::SetDataBrowserHasScrollBars(m_controlRef,horiz,vert); -} - -OSStatus wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16 height) -{ - return ::SetDataBrowserListViewHeaderBtnHeight(m_controlRef,height); -} - -OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle) -{ - return ::SetDataBrowserTableViewHiliteStyle(m_controlRef,hiliteStyle); -} - -OSStatus wxMacDataBrowserTableViewControl::SetIndent(float Indent) -{ - return ::DataBrowserSetMetric(m_controlRef,kDataBrowserMetricDisclosureColumnPerDepthGap,true,Indent); -} - -OSStatus wxMacDataBrowserTableViewControl::SetItemRowHeight(DataBrowserItemID item, UInt16 height) -{ - return ::SetDataBrowserTableViewItemRowHeight(m_controlRef,item,height); -} - -OSStatus wxMacDataBrowserTableViewControl::SetScrollPosition(UInt32 top, UInt32 left) -{ - return ::SetDataBrowserScrollPosition(m_controlRef,top,left); -} - -// -// column handling -// -OSStatus wxMacDataBrowserTableViewControl::GetColumnCount(UInt32* numColumns) const -{ - return ::GetDataBrowserTableViewColumnCount(m_controlRef,numColumns); -} - -OSStatus wxMacDataBrowserTableViewControl::GetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const -{ - return ::GetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,index); -} - -OSStatus wxMacDataBrowserTableViewControl::GetFreePropertyID(DataBrowserPropertyID* propertyID) const -{ - for (*propertyID=kMinPropertyID; *propertyID::max(); ++(*propertyID)) - if (IsUsedPropertyID(*propertyID) == errDataBrowserPropertyNotFound) - return noErr; - return errDataBrowserPropertyNotSupported; -} - -OSStatus wxMacDataBrowserTableViewControl::GetPropertyFlags(DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags) const -{ - return ::GetDataBrowserPropertyFlags(m_controlRef,propertyID,flags); -} - -OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID) const -{ - return ::GetDataBrowserItemDataProperty(itemData,propertyID); -} - -OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserTableViewColumnIndex index, DataBrowserTableViewColumnID* propertyID) const -{ - return ::GetDataBrowserTableViewColumnProperty(m_controlRef,index,propertyID); -} - -OSStatus wxMacDataBrowserTableViewControl::IsUsedPropertyID(DataBrowserPropertyID propertyID) const -{ - // as the Mac interface does not provide a function that checks if the property id is in use or not a function is chosen that should not - // lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns - // the column position for the property id: - DataBrowserTableViewColumnIndex index; - - return ::GetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,&index); -} - -OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID) -{ - return ::RemoveDataBrowserTableViewColumn(m_controlRef,propertyID); -} - -OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex index) -{ - DataBrowserTableViewColumnID propertyID; - - - GetPropertyID(index,&propertyID); - return ::RemoveDataBrowserTableViewColumn(m_controlRef,propertyID); -} - -OSStatus wxMacDataBrowserTableViewControl::SetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index) -{ - return ::SetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,index); -} - -OSStatus wxMacDataBrowserTableViewControl::SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows) -{ - return ::SetDataBrowserListViewDisclosureColumn(m_controlRef,propertyID,expandableRows); -} - -OSStatus wxMacDataBrowserTableViewControl::SetPropertyFlags(DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags) -{ - return ::SetDataBrowserPropertyFlags(m_controlRef,propertyID,flags); -} - -// -// item handling -// -OSStatus wxMacDataBrowserTableViewControl::AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty) -{ - return ::AddDataBrowserItems(m_controlRef,container,numItems,items,preSortProperty); -} - -OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const -{ - ItemCount noOfItems; - - OSStatus status; - - - status = GetItemCount(&noOfItems); - wxCHECK_MSG(status == noErr,status,_("Could not retrieve number of items")); - if (noOfItems == 0) - { - *id = 1; - return noErr; - } - else - { - // as there might be a lot of items in the data browser and mostly the data is added item by item the largest used ID number is roughly in the order of magnitude - // as the number of items; therefore, start from the number of items to look for a new ID: - for (*id=noOfItems; *id::max(); ++(*id)) - if (IsUsedItemID(*id) == errDataBrowserItemNotFound) - return noErr; - // as the first approach was not successful, try from the beginning: - for (*id=0; *id(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); - itemIDs.Empty(); - itemIDs.Alloc(noOfItems); - HLock(handle); - itemIDPtr = (DataBrowserItemID*) (*handle); - for (size_t i=0; iGetNativeData()->GetPropertyID()) == noErr); -} - -void wxMacDataViewDataBrowserListViewControl::DoSetExpanderColumn(wxDataViewColumn const* columnPtr) -{ - SetDisclosureColumn(columnPtr->GetNativeData()->GetPropertyID(),false); // second parameter explicitly passed to ensure that arrow is centered -} - -wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumn(unsigned int pos) const -{ - DataBrowserPropertyID propertyID; - - - if (GetPropertyID(pos,&propertyID) == noErr) - return GetColumnPtr(propertyID); - else - return NULL; -} - -int wxMacDataViewDataBrowserListViewControl::GetColumnPosition(wxDataViewColumn const* columnPtr) const -{ - if (columnPtr != NULL) - { - DataBrowserTableViewColumnIndex Position; - - wxCHECK_MSG(GetColumnIndex(columnPtr->GetNativeData()->GetPropertyID(),&Position) == noErr,wxNOT_FOUND,_("Could not determine column's position")); - return static_cast(Position); - } - else - return wxNOT_FOUND; -} - -bool wxMacDataViewDataBrowserListViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) -{ - DataBrowserListViewColumnDesc columnDescription; - - DataBrowserPropertyID newPropertyID; - - UInt32 noOfColumns; - - wxCFStringRef title(columnPtr->GetTitle(),m_font.IsOk() ? dynamic_cast(GetWXPeer())->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); - - - // try to get new ID for the column: - wxCHECK_MSG(GetFreePropertyID(&newPropertyID) == noErr,false,_("Cannot create new column's ID. Probably max. number of columns reached.")); - // set native data: - columnPtr->GetNativeData()->SetPropertyID(newPropertyID); - // create a column description, add column to the native control and do some final layout adjustments: - wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,title), false,_("Column description could not be initialized.")); - wxCHECK_MSG(AddColumn(&columnDescription,pos) == noErr, false,_("Column could not be added.")); - wxCHECK_MSG(SetColumnWidth(newPropertyID,columnPtr->GetWidth()) == noErr,false,_("Column width could not be set.")); - wxCHECK_MSG(GetColumnCount(&noOfColumns) == noErr, false,_("Number of columns could not be determined.")); - if (noOfColumns == 1) - { - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("wxWidget's control not initialized.")); - dataViewCtrlPtr->AddChildren(wxDataViewItem()); - return true; - } - else - return Update(columnPtr); -} - -// -// item related methods (inherited from wxDataViewWidgetImpl) -// -bool wxMacDataViewDataBrowserListViewControl::Add(wxDataViewItem const& parent, wxDataViewItem const& item) -{ - DataBrowserItemID itemID(reinterpret_cast(item.GetID())); - - - return (( parent.IsOk() && AddItem(reinterpret_cast(parent.GetID()),&itemID) == noErr) || - (!(parent.IsOk()) && AddItem(kDataBrowserNoItem,&itemID) == noErr)); -} - -bool wxMacDataViewDataBrowserListViewControl::Add(wxDataViewItem const& parent, wxDataViewItemArray const& items) -{ - bool noFailureFlag; - - DataBrowserItemID* itemIDs; - - size_t noOfEntries; - - - // convert all valid data view items to data browser items: - itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); - // insert all valid items into control: - noFailureFlag = ((noOfEntries == 0) || - !(parent.IsOk()) && (AddItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) || - parent.IsOk() && (AddItems(reinterpret_cast(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr)); - // give allocated array space free again: - delete[] itemIDs; - // done: - return noFailureFlag; -} - -void wxMacDataViewDataBrowserListViewControl::Collapse(wxDataViewItem const& item) -{ - CloseContainer(reinterpret_cast(item.GetID())); -} - -void wxMacDataViewDataBrowserListViewControl::EnsureVisible(wxDataViewItem const& item, const wxDataViewColumn* columnPtr) -{ - DataBrowserPropertyID propertyID; - - - if (columnPtr != NULL) - propertyID = columnPtr->GetNativeData()->GetPropertyID(); - else - propertyID = kDataBrowserNoItem; - RevealItem(reinterpret_cast(item.GetID()),propertyID,kDataBrowserRevealOnly); -} - -void wxMacDataViewDataBrowserListViewControl::Expand(wxDataViewItem const& item) -{ - OpenContainer(reinterpret_cast(item.GetID())); -} - -unsigned int wxMacDataViewDataBrowserListViewControl::GetCount() const -{ - ItemCount noOfItems; - - - wxCHECK_MSG(GetItemCount(&noOfItems) == noErr,0,_("Could not determine number of items")); - return noOfItems; -} - -wxRect wxMacDataViewDataBrowserListViewControl::GetRectangle(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) -{ - Rect MacRectangle; - - - if (GetPartBounds(reinterpret_cast(item.GetID()),columnPtr->GetNativeData()->GetPropertyID(),kDataBrowserPropertyContentPart,&MacRectangle) == noErr) - { - wxRect rectangle; - - ::wxMacNativeToRect(&MacRectangle,&rectangle); - return rectangle; - } - else - return wxRect(); -} - -bool wxMacDataViewDataBrowserListViewControl::IsExpanded(wxDataViewItem const& item) const -{ - DataBrowserItemState state = 0; - - if (GetItemState(reinterpret_cast(item.GetID()),&state) != noErr) - return false; - - return ((state & kDataBrowserContainerIsOpen) != 0); -} - -bool wxMacDataViewDataBrowserListViewControl::Reload() -{ - bool noFailureFlag; - - wxDataViewItemArray dataViewChildren; - - - noFailureFlag = (RemoveItems() == noErr); - SetScrollPosition(0,0); // even after having removed all items the scrollbars may remain at their old position -> reset them - GetDataViewCtrl()->GetModel()->GetChildren(wxDataViewItem(),dataViewChildren); - GetDataViewCtrl()->GetModel()->ItemsAdded(wxDataViewItem(),dataViewChildren); - - return noFailureFlag; -} - -bool wxMacDataViewDataBrowserListViewControl::Remove(wxDataViewItem const& parent, wxDataViewItem const& item) -{ - DataBrowserItemID itemID(reinterpret_cast(item.GetID())); - - - return (RemoveItem(reinterpret_cast(parent.GetID()),&itemID) == noErr); -} - -bool wxMacDataViewDataBrowserListViewControl::Remove(wxDataViewItem const& parent, wxDataViewItemArray const& items) -{ - bool noFailureFlag; - - DataBrowserItemID* itemIDs; - - size_t noOfEntries; - - - // convert all valid data view items to data browser items: - itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); - // insert all valid items into control: - noFailureFlag = ((noOfEntries == 0) || - !(parent.IsOk()) && (RemoveItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) || - parent.IsOk() && (RemoveItems(reinterpret_cast(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr)); - // give allocated array space free again: - delete[] itemIDs; - // done: - return noFailureFlag; -} - -bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewColumn const* columnPtr) -{ - return (UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,columnPtr->GetNativeData()->GetPropertyID()) == noErr); -} - -bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewItem const& parent, wxDataViewItem const& item) -{ - DataBrowserItemID itemID(reinterpret_cast(item.GetID())); - - - if (parent.IsOk()) - return (UpdateItem(reinterpret_cast(parent.GetID()),&itemID) == noErr); - else - return (UpdateItem(kDataBrowserNoItem,&itemID) == noErr); -} - -bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewItem const& parent, wxDataViewItemArray const& items) -{ - bool noFailureFlag; - - DataBrowserItemID* itemIDs; - - size_t noOfEntries; - - - // convert all valid data view items to data browser items: - itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); - if (parent.IsOk()) - noFailureFlag = (UpdateItems(reinterpret_cast(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr); - else - noFailureFlag = (UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr); - // release allocated array space: - delete[] itemIDs; - // done: - return noFailureFlag; -} - -// -// model related methods -// -bool wxMacDataViewDataBrowserListViewControl::AssociateModel(wxDataViewModel* WXUNUSED(model)) -{ - return true; -} - -// -// selection related methods (inherited from wxDataViewWidgetImpl) -// -wxDataViewItem wxMacDataViewDataBrowserListViewControl::GetCurrentItem() const -{ - wxFAIL_MSG( "unimplemented for Carbon" ); - - return wxDataViewItem(); -} - -wxDataViewColumn *wxMacDataViewDataBrowserListViewControl::GetCurrentColumn() const -{ - wxFAIL_MSG( "unimplemented for Carbon" ); - return NULL; -} - -void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewItem& WXUNUSED(item)) -{ - wxFAIL_MSG( "unimplemented for Carbon" ); -} - -int wxMacDataViewDataBrowserListViewControl::GetSelectedItemsCount() const -{ - Handle handle(::NewHandle(0)); - - if ( GetItems(kDataBrowserNoItem,true,kDataBrowserItemIsSelected,handle) != noErr ) - { - wxFAIL_MSG( "failed to get selected items" ); - return 0; - } - - size_t noOfItems = static_cast(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); - HUnlock(handle); - DisposeHandle(handle); - - return noOfItems; -} - -int wxMacDataViewDataBrowserListViewControl::GetSelections(wxDataViewItemArray& sel) const -{ - size_t noOfSelectedItems; - - wxArrayDataBrowserItemID itemIDs; - - - noOfSelectedItems = GetSelectedItemIDs(itemIDs); - sel.Empty(); - sel.SetCount(noOfSelectedItems); - for (size_t i=0; i(itemIDs[i])); - return static_cast(noOfSelectedItems); -} - -bool wxMacDataViewDataBrowserListViewControl::IsSelected(wxDataViewItem const& item) const -{ - return IsItemSelected(reinterpret_cast(item.GetID())); -} - -void wxMacDataViewDataBrowserListViewControl::Select(wxDataViewItem const& item) -{ - DataBrowserItemID itemID(reinterpret_cast(item.GetID())); - - - SetSelectedItems(1,&itemID,kDataBrowserItemsAdd); -} - -void wxMacDataViewDataBrowserListViewControl::SelectAll() -{ - DataBrowserItemID* itemIDPtr; - - Handle handle(::NewHandle(0)); - - size_t noOfItems; - - - wxCHECK_RET(GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items.")); - noOfItems = static_cast(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); - ::HLock(handle); - itemIDPtr = (DataBrowserItemID*) (*handle); - SetSelectedItems(noOfItems,itemIDPtr,kDataBrowserItemsAssign); - ::HUnlock(handle); - ::DisposeHandle(handle); -} - -void wxMacDataViewDataBrowserListViewControl::Unselect(wxDataViewItem const& item) -{ - DataBrowserItemID itemID(reinterpret_cast(item.GetID())); - - - SetSelectedItems(1,&itemID,kDataBrowserItemsRemove); -} - -void wxMacDataViewDataBrowserListViewControl::UnselectAll() -{ - DataBrowserItemID* itemIDPtr; - - Handle handle(::NewHandle(0)); - - size_t noOfItems; - - - wxCHECK_RET(GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items.")); - noOfItems = static_cast(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); - ::HLock(handle); - itemIDPtr = (DataBrowserItemID*) (*handle); - SetSelectedItems(noOfItems,itemIDPtr,kDataBrowserItemsRemove); - ::HUnlock(handle); - ::DisposeHandle(handle); -} - -// -// sorting related methods -// -wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetSortingColumn() const -{ - DataBrowserPropertyID propertyID; - - - if (GetSortProperty(&propertyID) == noErr) - return GetColumnPtr(propertyID); - else - return NULL; -} - -void wxMacDataViewDataBrowserListViewControl::Resort() -{ - (void) wxMacDataBrowserListViewControl::Resort(); -} - -// -// other methods (inherited from wxDataViewWidgetImpl) -// -void -wxMacDataViewDataBrowserListViewControl::HitTest(const wxPoint& WXUNUSED(point), - wxDataViewItem& item, - wxDataViewColumn*& columnPtr) const -{ - // not yet implemented: - item = wxDataViewItem(); - columnPtr = NULL; -} - -void wxMacDataViewDataBrowserListViewControl::DoSetIndent(int indent) -{ - SetIndent(static_cast(indent)); -} - -void wxMacDataViewDataBrowserListViewControl::SetRowHeight(wxDataViewItem const& item, unsigned int height) -{ - SetItemRowHeight(reinterpret_cast(item.GetID()),static_cast(height)); -} - -void wxMacDataViewDataBrowserListViewControl::OnSize() -{ - UInt32 noOfColumns; - - - GetColumnCount(&noOfColumns); - if (noOfColumns <= 1) // no horizontal scroll bar and the only column expands to the width of the whole control - { - SetHasScrollBars(false,true); - AutoSizeColumns(); - } - else // otherwise keep the current column size and have scrollbars in both directions - SetHasScrollBars(true,true); -} - -void wxMacDataViewDataBrowserListViewControl::StartEditor( const wxDataViewItem & WXUNUSED(item), unsigned int WXUNUSED(column) ) -{ - // implement me -} - -// -// callback functions (inherited from wxMacDataBrowserTableViewControl) -// -Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) -{ - DataBrowserSortOrder sortOrder; - - DataBrowserTableViewColumnIndex modelColumnIndex; - - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - - wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); - if (sortProperty >= kMinPropertyID) - { - // variable definition and initialization: - wxDataViewColumn* ColumnPtr(GetColumnPtr(sortProperty)); - - wxCHECK_MSG(ColumnPtr != NULL,false,_("Could not determine column index.")); - modelColumnIndex = ColumnPtr->GetModelColumn(); - } - else - modelColumnIndex = 0; - GetSortOrder(&sortOrder); - return static_cast(dataViewCtrlPtr->GetModel()->Compare(wxDataViewItem(reinterpret_cast(itemOneID)),wxDataViewItem(reinterpret_cast(itemTwoID)), - modelColumnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0); -} - -void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection)) - // In this method we do not supply a contextual menu handler at all but only send a wxEVT_DATAVIEW_ITEM_CONTEXT_MENU. -{ - wxArrayDataBrowserItemID itemIDs; - - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - - wxCHECK_RET(dataViewCtrlPtr != NULL,_("wxWidget control pointer is not a data view pointer")); - // initialize parameters so that no context menu will be displayed automatically by the native data browser: - *menu = NULL; - *helpType = kCMHelpItemNoHelp; - *helpItemString = NULL; - // create information for a context menu event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId()); - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); - // get the item information; - // theoretically more than one ID can be returned but the event can only handle one item, therefore all item related data is using the data of the first item in the array: - if (GetSelectedItemIDs(itemIDs) > 0) - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemIDs[0]))); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); -} - -OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue) -{ - if (getValue) - { - // variable definitions: - wxDataViewCtrl* dataViewCtrlPtr; - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); - if (dataViewCtrlPtr->IsDeleting()) - return noErr; // if a delete process is running the data of editable fields cannot be saved because the associated model variable may already have been deleted - else - { - // variable definitions: - OSStatus errorStatus; - wxDataViewColumn* dataViewColumnPtr; - - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); - dataViewColumnPtr = GetColumnPtr(propertyID); - wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index.")); - - wxDataViewItem dvItem(reinterpret_cast(itemID)); - unsigned int col = dataViewColumnPtr->GetModelColumn(); - - switch (dataViewColumnPtr->GetRenderer()->GetNativeData()->GetPropertyType()) - { - case kDataBrowserCheckboxType: - { - // variable definition: - ThemeButtonValue buttonValue; - - errorStatus = ::GetDataBrowserItemDataButtonValue(itemData,&buttonValue); - if (errorStatus == noErr) - { - if (buttonValue == kThemeButtonOn) - { - // variable definition and initialization: - wxVariant modifiedData(true); - - if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) - return noErr; - else - return errDataBrowserInvalidPropertyData; - } - else if (buttonValue == kThemeButtonOff) - { - // variable definition and initialization: - wxVariant modifiedData(false); - - if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) - return noErr; - else - return errDataBrowserInvalidPropertyData; - } - else - return errDataBrowserInvalidPropertyData; - } - else - return errorStatus; - } /* block */ - case kDataBrowserTextType: - { - // variable definitions: - CFStringRef stringReference; - - errorStatus = ::GetDataBrowserItemDataText(itemData,&stringReference); - if (errorStatus == noErr) - { - // variable definitions and initializations: -#if wxCHECK_VERSION(2,9,0) - wxCFStringRef modifiedString(stringReference); -#else - wxMacCFStringHolder modifiedString(stringReference); -#endif - wxVariant modifiedData(modifiedString.AsString()); - - if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) - return noErr; - else - return errDataBrowserInvalidPropertyData; - } - else - return errorStatus; - } /* block */ - default: - return errDataBrowserPropertyNotSupported; - } - } - } - else - { - if (propertyID >= kMinPropertyID) // in case data columns set the data - { - // variable definitions: - wxVariant variant; - wxDataViewColumn* dataViewColumnPtr; - wxDataViewCtrl* dataViewCtrlPtr; - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); - dataViewColumnPtr = GetColumnPtr(propertyID); - wxCHECK_MSG(dataViewColumnPtr != NULL,errDataBrowserNotConfigured,_("No column for the specified column position existing.")); - wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,errDataBrowserNotConfigured,_("No renderer specified for column.")); - dataViewCtrlPtr->GetModel()->GetValue(variant,wxDataViewItem(reinterpret_cast(itemID)),dataViewColumnPtr->GetModelColumn()); - if (!(variant.IsNull())) - { - dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemDataRef(itemData); - dataViewColumnPtr->GetRenderer()->SetValue(variant); - wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->MacRender(),errDataBrowserNotConfigured,_("Rendering failed.")); - } - return noErr; - } - else // react on special system requests - { - switch (propertyID) - { - case kDataBrowserContainerIsClosableProperty: - { - // variable definitions: - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast(itemID))); - dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - // opening the container is allowed if not vetoed: - return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed()); - } /* block */ - case kDataBrowserContainerIsOpenableProperty: - { - // variable definitions: - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast(itemID))); - dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - // opening the container is allowed if not vetoed: - return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed()); - } /* block */ - case kDataBrowserItemIsContainerProperty: - { - // variable definition: - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); - return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewCtrlPtr->GetModel()->IsContainer(wxDataViewItem(reinterpret_cast(itemID)))); - } /* block */ - case kDataBrowserItemIsEditableProperty: - return ::SetDataBrowserItemDataBooleanValue(itemData,true); - } - } - } - return errDataBrowserPropertyNotSupported; -} - -void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) -{ - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - - // check if the data view control pointer still exists because this call back function can still be called when the control has already been deleted: - if (dataViewCtrlPtr != NULL) - switch (message) - { - case kDataBrowserContainerClosed: - dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) - { - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemID))); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } /* block */ - break; - case kDataBrowserContainerOpened: - dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) - { - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemID))); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - // add children to the expanded container: - dataViewCtrlPtr->AddChildren(wxDataViewItem(reinterpret_cast(itemID))); - } /* block */ - break; - case kDataBrowserEditStarted: - dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) - { - // initialize wxWidget event: - DataBrowserPropertyID propertyID; - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemID))); - if (GetPropertyID(itemData,&propertyID) == noErr) - { - // variable definition and initialization: - DataBrowserTableViewColumnIndex columnIndex; - - wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex),_("Column index not found.")); - dataViewEvent.SetColumn(columnIndex); - dataViewEvent.SetDataViewColumn(GetColumnPtr(propertyID)); - } - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } /* block */ - break; - case kDataBrowserEditStopped: - { - // initialize wxWidget event: - DataBrowserPropertyID propertyID; - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemID))); - if (GetPropertyID(itemData,&propertyID) == noErr) - { - // variable definition and initialization: - DataBrowserTableViewColumnIndex columnIndex; - - wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex),_("Column index not found.")); - dataViewEvent.SetColumn(columnIndex); - dataViewEvent.SetDataViewColumn(GetColumnPtr(propertyID)); - } - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } /* block */ - break; - case kDataBrowserItemAdded: - dataViewCtrlPtr->FinishCustomItemEditing(); - break; - case kDataBrowserItemDeselected: - dataViewCtrlPtr->FinishCustomItemEditing(); - break; - case kDataBrowserItemDoubleClicked: - { - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast(itemID))); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } /* block */ - break; - case kDataBrowserItemRemoved: - dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) - break; - case kDataBrowserItemSelected: - break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged - case kDataBrowserSelectionSetChanged: - { - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } /* block */ - break; - case kDataBrowserTargetChanged: // no idea if this notification is ever sent - break; - case kDataBrowserUserStateChanged: - { - // finish custom item editing if necessary: - dataViewCtrlPtr->FinishCustomItemEditing(); - // update column widths: - for (size_t i=0; iGetColumnCount(); ++i) - { - // constant definition for abbreviational purposes: - wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumnPtr(i); - // variable definition: - UInt16 columnWidth; - - wxCHECK_RET(GetColumnWidth(columnPtr->GetNativeData()->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined")); - columnPtr->SetWidthVariable(columnWidth); - } - // update sorting orders: - DataBrowserPropertyID propertyID; // variable definition - - if ((GetSortProperty(&propertyID) == noErr) && (propertyID >= kMinPropertyID)) - { - DataBrowserSortOrder sortOrder; - DataBrowserTableViewColumnIndex columnIndex; - - if ((GetSortOrder(&sortOrder) == noErr) && (GetColumnIndex(propertyID,&columnIndex) == noErr)) - { - // variable definition and initialization: - wxDataViewColumn* columnPtr; - columnPtr = dataViewCtrlPtr->GetColumn(columnIndex); - // check if the sort order has changed: - if ( columnPtr->IsSortOrderAscending() && (sortOrder == kDataBrowserOrderDecreasing) || - !(columnPtr->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing)) - { - columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending())); - // initialize wxWidget event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable definition - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetColumn(columnIndex); - dataViewEvent.SetDataViewColumn(columnPtr); - // finally send the equivalent wxWidget event: - dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); - } - } - } - } /* block */ - break; - } -} - -void -wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, - DataBrowserPropertyID propertyID, - DataBrowserItemState state, - Rect const* rectangle, - SInt16 WXUNUSED(bitDepth), - Boolean WXUNUSED(colorDevice)) -{ - DataBrowserTableViewColumnIndex columnIndex; - - wxDataViewColumn* dataViewColumnPtr; - - wxDataViewCtrl* dataViewCtrlPtr; - - wxDataViewCustomRenderer* dataViewCustomRendererPtr; - - wxVariant dataToRender; - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_RET(dataViewCtrlPtr != NULL, _("Pointer to data view control not set correctly.")); - wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL, _("Pointer to model not set correctly.")); - wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex) == noErr,_("Could not determine column index.")); - dataViewColumnPtr = GetColumnPtr(propertyID); - wxCHECK_RET(dataViewColumnPtr != NULL,_("No column for the specified column existing.")); - dataViewCustomRendererPtr = dynamic_cast(dataViewColumnPtr->GetRenderer()); - wxCHECK_RET(dataViewCustomRendererPtr != NULL,_("No renderer or invalid renderer type specified for custom data column.")); - dataViewCtrlPtr->GetModel()->GetValue(dataToRender,wxDataViewItem(reinterpret_cast(itemID)),dataViewColumnPtr->GetModelColumn()); - dataViewCustomRendererPtr->SetValue(dataToRender); - - wxDataViewItem dataItem( reinterpret_cast(itemID) ); - dataViewCtrlPtr->GetModel()->GetValue(dataToRender,dataItem,dataViewColumnPtr->GetModelColumn()); - dataViewCustomRendererPtr->SetValue(dataToRender); - - // try to determine the content's size (drawable part): - Rect content; - RgnHandle rgn(NewRgn()); - UInt16 headerHeight; - - if (GetControlRegion(m_controlRef,kControlContentMetaPart,rgn) == noErr) - GetRegionBounds(rgn,&content); - else - GetControlBounds(m_controlRef, &content); - ::DisposeRgn(rgn); - // space for the header - GetHeaderButtonHeight(&headerHeight); - content.top += headerHeight; - // extra space for the frame (todo: do not how to determine the space automatically from the control) - content.top += 5; - content.left += 5; - content.right -= 3; - content.bottom -= 3; - // extra space for the scrollbars: - content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); - content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); - - wxDC *dc = dataViewCustomRendererPtr->GetDC(); - - int active_border_fudge = 0; - if (dataViewCtrlPtr->HasFocus() && !dataViewCtrlPtr->HasFlag( wxBORDER_NONE )) - active_border_fudge = 1; - else - active_border_fudge = -2; - - wxRect cellrect( static_cast(rectangle->left + active_border_fudge), - static_cast(rectangle->top + active_border_fudge), - static_cast(1+rectangle->right-rectangle->left), - static_cast(rectangle->bottom-rectangle->top) ); - - bool is_active = IsControlActive( m_controlRef ); - if (state == kDataBrowserItemIsSelected) - { - wxColour col( wxMacCreateCGColorFromHITheme( (is_active) ? - kThemeBrushAlternatePrimaryHighlightColor - : kThemeBrushSecondaryHighlightColor ) ); - - wxRect rect = cellrect; - Rect itemrect; - GetDataBrowserItemPartBounds( m_controlRef, itemID, propertyID, - kDataBrowserPropertyEnclosingPart, &itemrect ); - rect.x = itemrect.left-2; - rect.width = itemrect.right-itemrect.left+3; - - wxDCPenChanger setPen(*dc, *wxTRANSPARENT_PEN); - wxDCBrushChanger setBrush(*dc, col); - dc->DrawRectangle(rect); - } - - wxDataViewModel *model = dataViewCtrlPtr->GetModel(); - if ((columnIndex == 0) || !model->IsContainer(dataItem) || model->HasContainerColumns(dataItem)) - { - // make sure that 'Render' can draw only in the allowed area: - dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1); - (void) (dataViewCustomRendererPtr->WXCallRender( cellrect, dc, - ((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0))); - dc->DestroyClippingRegion(); // probably not necessary - } - - dataViewCustomRendererPtr->SetDC(NULL); -} - -Boolean -wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc( - DataBrowserItemID WXUNUSED(itemID), - DataBrowserPropertyID WXUNUSED(propertyID), - CFStringRef WXUNUSED(theString), - Rect* WXUNUSED(maxEditTextRect), - Boolean* WXUNUSED(shrinkToFit)) -{ - return false; -} - -Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserHitTestProc(DataBrowserItemID WXUNUSED(itemID), DataBrowserPropertyID WXUNUSED(property), Rect const* WXUNUSED(theRect), Rect const* WXUNUSED(mouseRect)) -{ - return true; -} - -DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point WXUNUSED(startPt), EventModifiers WXUNUSED(modifiers)) -{ - wxDataViewColumn* dataViewColumnPtr; - - wxDataViewCtrl* dataViewCtrlPtr; - - wxDataViewCustomRenderer* dataViewCustomRendererPtr; - - wxDataViewItem dataViewCustomRendererItem; - - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); - dataViewCustomRendererItem = wxDataViewItem(reinterpret_cast(itemID)); - wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item")); - dataViewColumnPtr = GetColumnPtr(propertyID); - wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing.")); - dataViewCustomRendererPtr = dynamic_cast(dataViewColumnPtr->GetRenderer()); - wxCHECK_MSG(dataViewCustomRendererPtr != NULL,kDataBrowserNothingHit,_("No renderer or invalid renderer type specified for custom data column.")); - // if the currently edited item is identical to the to be edited nothing is done (this hit should only be handled in the control itself): - if (dataViewCtrlPtr->GetCustomRendererItem() == dataViewCustomRendererItem) - return kDataBrowserContentHit; - // an(other) item is going to be edited and therefore the current editing - if existing - has to be finished: - if (dataViewCtrlPtr->GetCustomRendererPtr() != NULL) - { - dataViewCtrlPtr->GetCustomRendererPtr()->FinishEditing(); - dataViewCtrlPtr->SetCustomRendererItem(wxDataViewItem()); - dataViewCtrlPtr->SetCustomRendererPtr (NULL); - } - // check if renderer has got a valid editor control for editing; if this is the case start editing of the new item: - if (dataViewCustomRendererPtr->HasEditorCtrl()) - { - // variable definition: - wxRect wxRectangle; - - ::wxMacNativeToRect(theRect,&wxRectangle); - dataViewCustomRendererPtr->StartEditing(dataViewCustomRendererItem,wxRectangle); - dataViewCtrlPtr->SetCustomRendererItem(dataViewCustomRendererItem); - dataViewCtrlPtr->SetCustomRendererPtr (dataViewCustomRendererPtr); - } - return kDataBrowserContentHit; -} - -Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAcceptDragProc(DragReference dragRef, DataBrowserItemID itemID) -{ - bool acceptDrag; - - UInt16 noOfDraggedItems; - - wxDataViewCtrl* dataViewCtrlPtr; - - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); - - // send a drag possible event for each available and item und proceed with it unless the event is vetoed: - ::CountDragItems(dragRef,&noOfDraggedItems); - for (UInt16 indexDraggedItem=1; indexDraggedItem<=noOfDraggedItems; ++indexDraggedItem) - { - // collect native information: - ItemReference itemRef; - wxDataObjectComposite* dataObjects; - wxMemoryBuffer buffer; - - ::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1! - dataObjects = GetDnDDataObjects(dragRef,itemRef); - // create wxWidget's event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId()); - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - - // this is the item that receives the event (can be an invalid item ID, this is - // especially useful if the dataview does not contain any items) - dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast(itemID)) ); - - dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); - dataViewEvent.SetDataObject(dataObjects); - dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects)); - if (dataViewEvent.GetDataFormat().GetType() != wxDF_INVALID) - { - dataViewEvent.SetDataSize(dataObjects->GetDataSize(dataViewEvent.GetDataFormat().GetType())); - dataObjects->GetDataHere(dataViewEvent.GetDataFormat().GetType(),buffer.GetWriteBuf(dataViewEvent.GetDataSize())); - buffer.UngetWriteBuf(dataViewEvent.GetDataSize()); - dataViewEvent.SetDataBuffer(buffer.GetData()); - } - - // send event: - acceptDrag = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); - delete dataObjects; - if (!acceptDrag) - return false; - } - return true; -} - -Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) -{ - Boolean addDragItem; - - wxDataViewCtrl* dataViewCtrlPtr; - - wxDataViewItem dataViewItem; - - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); - dataViewItem = wxDataViewItem(reinterpret_cast(itemID)); - wxCHECK_MSG(dataViewItem.IsOk(),false,_("Invalid data view item")); - - // send a begin drag event and proceed with dragging unless the event is vetoed: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId()); - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - dataViewEvent.SetItem(dataViewItem); - dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); - // the dataview event object is also initialized with a default set of data; as it is a set of data and the user should be able to easily complete - // the object a wxDataObjectComposite object is used; - // currently, the composite object only contains a TAB concatenated string of all data: - wxDataObjectComposite* dataObject(new wxDataObjectComposite()); - - dataObject->Add(new wxTextDataObject(::ConcatenateDataViewItemValues(dataViewCtrlPtr,dataViewItem))); - dataViewEvent.SetDataObject(dataObject); - // check if event has not been vetoed: - addDragItem = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); - if (addDragItem) - { - // for the internal drag & drop functions create two flavors: - // - the data browser's item id; - // - the data contained the dataview event object (if available). - // Definition: a flavor is the type dependent representation of identical data. - // Example: a number can be represented by its value and by its value converted to a string. In this case the flavor - // of the number's internal representation is typeSInt32 while its string representation has got the flavor 'TEXT'. - // Item id is one of the flavors: - wxCHECK_MSG(::AddDragItemFlavor(dragRef,*itemRef,typeUInt32,&itemID,sizeof(itemID),0) == noErr,false,_("Unable to handle native drag&drop data")); - // if the dataview event object contains data it is used for additional flavors; all natively known flavors are supported: - if (dataViewEvent.GetDataObject() != NULL) - { - // constant definition for abbreviational purposes: - size_t const noOfFormats = dataViewEvent.GetDataObject()->GetFormatCount(); - - if (noOfFormats > 0) - { - // variable definition: - wxDataFormat* dataFormats; - - dataFormats = new wxDataFormat[noOfFormats]; - dataViewEvent.GetDataObject()->GetAllFormats(dataFormats,wxDataObject::Get); - for (size_t i=0; iGetDataSize(wxDF_TEXT); - // variable definition and initialization: - wxMemoryBuffer dataObject(dataSize); - - dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize)); - dataObject.UngetWriteBuf(dataSize); - if (::AddDragItemFlavor(dragRef,*itemRef,'TEXT',dataObject.GetData(),dataSize,0) != noErr) - wxFAIL_MSG(_("Adding flavor TEXT failed")); - } /* block */ - break; - case wxDF_UNICODETEXT: - { - // constant definition for abbreviational purposes: - size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT); - // as there is no direct access to the data copy it to a memory buffer: - wxMemoryBuffer dataObject(dataSize); - - dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize)); - dataObject.UngetWriteBuf(dataSize); - // if the data is stored in unicode format the internal representation is utf-8 (not mentioned in the documentation but in the source code); - // DnD uses fixed utf-16 representation -> use the OSX functions for a conversion: - CFDataRef osxData (::CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,reinterpret_cast(dataObject.GetData()),dataSize,kCFAllocatorNull)); - CFStringRef osxString(::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,osxData,kCFStringEncodingUTF8)); - - // the osxString contains now the data and therefore the previously occupied memory can be released and re-used: - ::CFRelease(osxData); - osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF16,32); - if (::AddDragItemFlavor(dragRef,*itemRef,'utxt',::CFDataGetBytePtr(osxData),::CFDataGetLength(osxData),0) != noErr) - wxFAIL_MSG(_("Adding flavor utxt failed")); - // clean up: - ::CFRelease(osxData); - ::CFRelease(osxString); - } /* block */ - break; - case wxDF_BITMAP: - case wxDF_METAFILE: - case wxDF_SYLK: - case wxDF_DIF: - case wxDF_TIFF: - case wxDF_OEMTEXT: - case wxDF_DIB: - case wxDF_PALETTE: - case wxDF_PENDATA: - case wxDF_RIFF: - case wxDF_WAVE: - case wxDF_ENHMETAFILE: - case wxDF_FILENAME: - case wxDF_LOCALE: - case wxDF_PRIVATE: - case wxDF_HTML: - break; // not (yet) supported data formats - default: - wxFAIL_MSG(_("Unknown data format")); - } - delete[] dataFormats; - } - } - } - // clean-up and return result: - delete dataObject; - return addDragItem; -} - -Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID) -{ - UInt16 noOfDraggedItems; - - wxDataViewCtrl* dataViewCtrlPtr; - - - dataViewCtrlPtr = dynamic_cast(GetWXPeer()); - wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); - wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); - - // send a drag possible event for each available and item und proceed with it unless the event is vetoed: - ::CountDragItems(dragRef,&noOfDraggedItems); - for (UInt16 indexDraggedItem=1; indexDraggedItem<=noOfDraggedItems; ++indexDraggedItem) - { - bool receiveDrag; - ItemReference itemRef; - wxDataObjectComposite* dataObjects; - wxMemoryBuffer buffer; - - // collect native information: - ::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1! - dataObjects = GetDnDDataObjects(dragRef,itemRef); - // create wxWidget's event: - wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId()); - - dataViewEvent.SetEventObject(dataViewCtrlPtr); - - // this is the item that receives the event (can be an invalid item ID, this is - // especially useful if the dataview does not contain any items) - dataViewEvent.SetItem( wxDataViewItem(reinterpret_cast(itemID)) ); - - dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); - dataViewEvent.SetDataObject(dataObjects); - dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects)); - if (dataViewEvent.GetDataFormat().GetType() != wxDF_INVALID) - { - dataViewEvent.SetDataSize(dataObjects->GetDataSize(dataViewEvent.GetDataFormat().GetType())); - dataObjects->GetDataHere(dataViewEvent.GetDataFormat().GetType(),buffer.GetWriteBuf(dataViewEvent.GetDataSize())); - buffer.UngetWriteBuf(dataViewEvent.GetDataSize()); - dataViewEvent.SetDataBuffer(buffer.GetData()); - } - - // send event: - receiveDrag = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); - delete dataObjects; - if (!receiveDrag) - return false; - } - return true; -} - -// -// drag & drop helper methods -// -wxDataFormat wxMacDataViewDataBrowserListViewControl::GetDnDDataFormat(wxDataObjectComposite* dataObjects) -{ - wxDataFormat resultFormat; - - - if (dataObjects != NULL) - { - bool compatible(true); - - size_t const noOfFormats = dataObjects->GetFormatCount(); - size_t indexFormat; - - wxDataFormat* formats; - - // get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise - // wxDF_INVALID is returned; - // currently compatible types (ordered by priority are): - // - wxDF_UNICODETEXT - wxDF_TEXT - formats = new wxDataFormat[noOfFormats]; - dataObjects->GetAllFormats(formats); - indexFormat = 0; - while ((indexFormat < noOfFormats) && compatible) - { - switch (resultFormat.GetType()) - { - case wxDF_INVALID: - resultFormat.SetType(formats[indexFormat].GetType()); // first format (should only be reached if indexFormat == 0 - break; - case wxDF_TEXT: - if (formats[indexFormat].GetType() == wxDF_UNICODETEXT) - resultFormat.SetType(wxDF_UNICODETEXT); - else // incompatible - { - resultFormat.SetType(wxDF_INVALID); - compatible = false; - } - break; - case wxDF_UNICODETEXT: - if (formats[indexFormat].GetType() != wxDF_TEXT) - { - resultFormat.SetType(wxDF_INVALID); - compatible = false; - } - break; - default: - resultFormat.SetType(wxDF_INVALID); // not (yet) supported format - compatible = false; - } - ++indexFormat; - } /* while */ - // clean up: - delete[] formats; - } - else - resultFormat = wxDF_INVALID; - return resultFormat; -} - -wxDataObjectComposite* wxMacDataViewDataBrowserListViewControl::GetDnDDataObjects(DragReference dragRef, ItemReference itemRef) const -{ - UInt16 noOfFlavors; - - wxDataObjectComposite* dataObject; - - - ::CountDragItemFlavors(dragRef,itemRef,&noOfFlavors); - if (noOfFlavors > 0) - { - // as the native drag data can be separated into TEXT and UTXT a pointer to a wxTextDataObject is used to track the existence of 'TEXT' and 'utxt' flavors: - wxTextDataObject* textDataObject(NULL); - - dataObject = new wxDataObjectComposite(); - for (UInt16 indexFlavor=1; indexFlavor<=noOfFlavors; ++indexFlavor) - { - // variable definition: - FlavorType flavorDataObject; - - if (::GetFlavorType(dragRef,itemRef,indexFlavor,&flavorDataObject) == noErr) // GetFlavorType uses a 1 based index! - switch (flavorDataObject) - { - case 'TEXT': - if (textDataObject == NULL) // otherwise a 'utxt' flavor has already been found that gets priority compared to the 'TEXT' flavor - { - // variable definitions: - Size nativeDataSize; - wxMemoryBuffer nativeData; - - if ((::GetFlavorDataSize(dragRef,itemRef,'TEXT',&nativeDataSize) == noErr) && - (::GetFlavorData(dragRef,itemRef,'TEXT',nativeData.GetWriteBuf(nativeDataSize),&nativeDataSize,0) == noErr)) - { - nativeData.UngetWriteBuf(nativeDataSize); - textDataObject = new wxTextDataObject(); - if (textDataObject->SetData(nativeData.GetDataLen(),nativeData.GetData())) - dataObject->Add(textDataObject); - else - { - wxDELETE(textDataObject); - } - } - } /* block */ - break; - case 'utxt': - { - // variable definition: - Size nativeDataSize; - - if (::GetFlavorDataSize(dragRef,itemRef,'utxt',&nativeDataSize) == noErr) - { - CFMutableDataRef draggedData; - - draggedData = ::CFDataCreateMutable(kCFAllocatorDefault,nativeDataSize); - ::CFDataSetLength(draggedData,nativeDataSize); - if (::GetFlavorData(dragRef,itemRef,'utxt',::CFDataGetMutableBytePtr(draggedData),&nativeDataSize,0) == noErr) - { - // convert internally used UTF-16 representation to a UTF-8 representation: - CFDataRef osxData; - CFStringRef osxString; - - osxString = ::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,draggedData,kCFStringEncodingUTF16); // BOM character is handled by this function automatically - osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF8,32); - if (textDataObject == NULL) - { - textDataObject = new wxTextDataObject(); - if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData))) - dataObject->Add(textDataObject); - else - { - wxDELETE(textDataObject); - } - } - else // overwrite data because the 'utxt' flavor has priority over the 'TEXT' flavor - (void) textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)); - // clean up: - ::CFRelease(osxData); - ::CFRelease(osxString); - } - // clean up: - ::CFRelease(draggedData); - } - } /* block */ - break; - } - } - } - else - dataObject = NULL; - return dataObject; -} - -// -// other methods -// -wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumnPtr(DataBrowserPropertyID propertyID) const -{ - wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast(GetWXPeer())); - - if (dataViewCtrlPtr != NULL) - { - size_t const noOfColumns = dataViewCtrlPtr->GetColumnCount(); - - for (size_t i=0; iGetColumnPtr(i)->GetNativeData()->GetPropertyID() == propertyID) - return dataViewCtrlPtr->GetColumnPtr(i); - } - return NULL; -} - -// --------------------------------------------------------- -// wxDataViewRenderer -// --------------------------------------------------------- -wxDataViewRenderer::wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewRendererBase(varianttype,mode,align), m_alignment(align), m_mode(mode), m_NativeDataPtr(NULL) -{ -} - -wxDataViewRenderer::~wxDataViewRenderer() -{ - delete m_NativeDataPtr; -} - -void wxDataViewRenderer::SetAlignment(int align) -{ - m_alignment = align; -} - -namespace -{ - -// get the browser control or NULL if anything went wrong (it's not supposed to -// so we assert if it did) -wxMacDataViewDataBrowserListViewControl * -GetBrowserFromCol(wxDataViewColumn *col) -{ - wxCHECK_MSG( col, NULL, "should have a valid column" ); - - wxDataViewCtrl * const dvc = col->GetOwner(); - wxCHECK_MSG( dvc, NULL, "column must be associated with the control" ); - - return static_cast(dvc->GetPeer()); -} - -} // anonymous namespace - -void wxDataViewRenderer::SetMode(wxDataViewCellMode mode) -{ - wxDataViewColumn * const col = GetOwner(); - wxMacDataViewDataBrowserListViewControl * const - browser = GetBrowserFromCol(col); - wxCHECK_RET( browser, "must be fully initialized" ); - - const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); - - DataBrowserPropertyFlags flags; - verify_noerr( browser->GetPropertyFlags(colID, &flags) ); - - if ( (mode == wxDATAVIEW_CELL_EDITABLE) || - (mode == wxDATAVIEW_CELL_ACTIVATABLE) ) - flags |= kDataBrowserPropertyIsEditable; - else - flags &= ~kDataBrowserPropertyIsEditable; - - verify_noerr( browser->SetPropertyFlags(colID, flags) ); -} - -void wxDataViewRenderer::EnableEllipsize(wxEllipsizeMode mode) -{ - wxDataViewColumn * const col = GetOwner(); - - wxMacDataViewDataBrowserListViewControl * const - browser = GetBrowserFromCol(col); - wxCHECK_RET( browser, "must be fully initialized" ); - - const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); - - DataBrowserPropertyFlags flags; - browser->GetPropertyFlags(colID, &flags); - - flags &= ~(kDataBrowserDoNotTruncateText | - kDataBrowserTruncateTextAtStart | - kDataBrowserTruncateTextMiddle | - kDataBrowserTruncateTextAtEnd); - - int flagToSet = 0; - switch ( mode ) - { - case wxELLIPSIZE_NONE: - flagToSet = kDataBrowserDoNotTruncateText; - break; - - case wxELLIPSIZE_START: - flagToSet = kDataBrowserTruncateTextAtStart; - break; - - case wxELLIPSIZE_MIDDLE: - flagToSet = kDataBrowserTruncateTextMiddle; - break; - - case wxELLIPSIZE_END: - flagToSet = kDataBrowserTruncateTextAtEnd; - break; - } - - wxCHECK_RET( flagToSet, "unknown wxEllipsizeMode value" ); - - flags |= flagToSet; - verify_noerr( browser->SetPropertyFlags(colID, flags) ); -} - -wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const -{ - wxDataViewColumn * const col = GetOwner(); - - wxMacDataViewDataBrowserListViewControl * const - browser = GetBrowserFromCol(col); - wxCHECK_MSG( browser, wxELLIPSIZE_NONE, "must be fully initialized" ); - - const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); - - DataBrowserPropertyFlags flags; - browser->GetPropertyFlags(colID, &flags); - - if ( flags & kDataBrowserDoNotTruncateText ) - return wxELLIPSIZE_NONE; - if ( flags & kDataBrowserTruncateTextAtStart ) - return wxELLIPSIZE_START; - if ( flags & kDataBrowserTruncateTextAtEnd ) - return wxELLIPSIZE_END; - - // kDataBrowserTruncateTextMiddle == 0 so there is no need to test for it - return wxELLIPSIZE_MIDDLE; -} - -void wxDataViewRenderer::SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr) -{ - delete m_NativeDataPtr; - m_NativeDataPtr = newNativeDataPtr; -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase) - -// --------------------------------------------------------- -// wxDataViewCustomRenderer -// --------------------------------------------------------- -wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewCustomRendererBase(varianttype,mode,align), - m_editorCtrlPtr(NULL), - m_DCPtr(NULL) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType)); -} - -bool wxDataViewCustomRenderer::MacRender() -{ - return true; -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewTextRenderer -// --------------------------------------------------------- -wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewRenderer(varianttype,mode,align) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserTextType)); -} - -bool wxDataViewTextRenderer::MacRender() -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << GetValue().GetType()); - - wxCFStringRef cfString(GetValue().GetString(),(GetView()->GetFont().IsOk() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); - return (::SetDataBrowserItemDataText(GetNativeData()->GetItemDataRef(),cfString) == noErr); -} - -IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewBitmapRenderer -// --------------------------------------------------------- -wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewRenderer(varianttype,mode,align) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconType)); -} - -bool wxDataViewBitmapRenderer::MacRender() - // This method returns 'true' if - // - the passed bitmap is valid and it could be assigned to the native data browser; - // - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap. - // In all other cases the method returns 'false'. -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Bitmap renderer cannot render value; value type: ")) << GetValue().GetType()); - - wxBitmap bitmap; - - bitmap << GetValue(); - return (!(bitmap.IsOk()) || (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),bitmap.GetIconRef()) == noErr)); -} - -IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewIconTextRenderer -// --------------------------------------------------------- -wxDataViewIconTextRenderer::wxDataViewIconTextRenderer( - const wxString& varianttype, - wxDataViewCellMode mode, - int WXUNUSED(align)) - :wxDataViewRenderer(varianttype,mode) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconAndTextType)); -} - -bool wxDataViewIconTextRenderer::MacRender() -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << GetValue().GetType()); - - wxDataViewIconText iconText; - - iconText << GetValue(); - - wxCFStringRef cfString(iconText.GetText(),(GetView()->GetFont().IsOk() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); - - if (iconText.GetIcon().IsOk()) - if (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),MAC_WXHICON(iconText.GetIcon().GetHICON())) != noErr) - return false; - return (::SetDataBrowserItemDataText(GetNativeData()->GetItemDataRef(),cfString) == noErr); -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer) - - -// --------------------------------------------------------- -// wxDataViewToggleRenderer -// --------------------------------------------------------- -wxDataViewToggleRenderer::wxDataViewToggleRenderer( - const wxString& varianttype, - wxDataViewCellMode mode, - int WXUNUSED(align)) - :wxDataViewRenderer(varianttype,mode) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCheckboxType)); -} - -bool wxDataViewToggleRenderer::MacRender() -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << GetValue().GetType()); - return (::SetDataBrowserItemDataButtonValue(GetNativeData()->GetItemDataRef(),GetValue().GetBool()) == noErr); -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewProgressRenderer -// --------------------------------------------------------- -wxDataViewProgressRenderer::wxDataViewProgressRenderer( - const wxString& WXUNUSED(label), - wxString const& varianttype, - wxDataViewCellMode mode, - int align) - :wxDataViewRenderer(varianttype,mode,align) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserProgressBarType)); -} - -bool wxDataViewProgressRenderer::MacRender() -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << GetValue().GetType()); - return ((::SetDataBrowserItemDataMinimum(GetNativeData()->GetItemDataRef(), 0) == noErr) && - (::SetDataBrowserItemDataMaximum(GetNativeData()->GetItemDataRef(),100) == noErr) && - (::SetDataBrowserItemDataValue (GetNativeData()->GetItemDataRef(),GetValue().GetLong()) == noErr)); -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewDateRenderer -// --------------------------------------------------------- -wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) - :wxDataViewRenderer(varianttype,mode,align) -{ - SetNativeData(new wxDataViewRendererNativeData(kDataBrowserDateTimeType)); -} - -bool wxDataViewDateRenderer::MacRender() -{ - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << GetValue().GetType()); - return (::SetDataBrowserItemDataDateTime(GetNativeData()->GetItemDataRef(),GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr); -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer) - -// --------------------------------------------------------- -// wxDataViewColumn -// --------------------------------------------------------- -wxDataViewColumn::wxDataViewColumn(const wxString& title, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags) - :wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title) -{ - InitCommon(width, align, flags); - if ((renderer != NULL) && !renderer->IsCustomRenderer() && - (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT)) - renderer->SetAlignment(align); -} - -wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags) - :wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()) -{ - InitCommon(width, align, flags); - if ((renderer != NULL) && !renderer->IsCustomRenderer() && - (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT)) - renderer->SetAlignment(align); -} - -wxDataViewColumn::~wxDataViewColumn() -{ - delete m_NativeDataPtr; -} - -int wxDataViewColumn::GetWidth() const -{ - // FIXME: This returns the last programmatically set width and will not work if - // the user changes the column's width by dragging it with the mouse. - return m_width; -} - -bool wxDataViewColumn::IsSortKey() const -{ - wxDataViewCtrl * const dataViewCtrlPtr(GetOwner()); - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr( - dynamic_cast( - dataViewCtrlPtr->GetPeer())); - - DataBrowserPropertyID propertyID; - return (macDataViewListCtrlPtr->GetSortProperty(&propertyID) == noErr) && - (propertyID == GetNativeData()->GetPropertyID()); -} - -void wxDataViewColumn::SetAlignment(wxAlignment align) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - m_alignment = align; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); - switch (align) - { - case wxALIGN_CENTER: - case wxALIGN_CENTER_HORIZONTAL: - headerDescription.btnFontStyle.just = teCenter; - break; - case wxALIGN_LEFT: - headerDescription.btnFontStyle.just = teFlushLeft; - break; - case wxALIGN_RIGHT: - headerDescription.btnFontStyle.just = teFlushRight; - break; - default: - headerDescription.btnFontStyle.just = teFlushDefault; - } - wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set alignment.")); - } - } -} - -void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - wxDataViewColumnBase::SetBitmap(bitmap); - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); - if (GetBitmap().IsOk()) - headerDescription.btnContentInfo.u.iconRef = GetBitmap().GetIconRef(); - else - headerDescription.btnContentInfo.u.iconRef = NULL; - wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon.")); - } - } -} - -void wxDataViewColumn::SetMaxWidth(int maxWidth) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - m_maxWidth = maxWidth; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); - headerDescription.maximumWidth = static_cast(maxWidth); - wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set maximum width.")); - } - } -} - -void wxDataViewColumn::SetMinWidth(int minWidth) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - m_minWidth = minWidth; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); - headerDescription.minimumWidth = static_cast(minWidth); - wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set minimum width.")); - } - } -} - -void wxDataViewColumn::SetReorderable(bool reorderable) -{ - // first set the internal flag of the column: - if (reorderable) - m_flags |= wxDATAVIEW_COL_REORDERABLE; - else - m_flags &= ~wxDATAVIEW_COL_REORDERABLE; - // if the column is associated with a control change also immediately the flags of the control: - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - if (dataViewCtrlPtr != NULL) - { - DataBrowserPropertyFlags flags; - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - wxCHECK_RET(macDataViewListCtrlPtr != NULL, _("Valid pointer to native data view control does not exist")); - wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(GetNativeData()->GetPropertyID(),&flags) == noErr,_("Could not get property flags.")); - if (reorderable) - flags |= kDataBrowserListViewMovableColumn; - else - flags &= ~kDataBrowserListViewMovableColumn; - wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(GetNativeData()->GetPropertyID(),flags) == noErr,_("Could not set property flags.")); - } -} - -void wxDataViewColumn::SetResizeable(bool resizable) -{ - // first set the internal flag of the column: - if (resizable) - m_flags |= wxDATAVIEW_COL_RESIZABLE; - else - m_flags &= ~wxDATAVIEW_COL_RESIZABLE; - // if the column is associated with a control change also immediately the flags of the control: - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); - if (resizable) - { - if (GetMinWidth() >= GetMaxWidth()) - { - m_minWidth = 0; - m_maxWidth = 30000; - } - headerDescription.minimumWidth = m_minWidth; - headerDescription.maximumWidth = m_maxWidth; - } - else - { - headerDescription.minimumWidth = m_width; - headerDescription.maximumWidth = m_width; - } - verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); - macDataViewListCtrlPtr->SetSortProperty(GetNativeData()->GetPropertyID()); - } - } -} - -void wxDataViewColumn::SetSortable(bool sortable) -{ - // first set the internal flag of the column: - if (sortable) - m_flags |= wxDATAVIEW_COL_SORTABLE; - else - m_flags &= ~wxDATAVIEW_COL_SORTABLE; - // if the column is associated with a control change also immediately the flags of the control: - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - if (dataViewCtrlPtr != NULL) - { - DataBrowserPropertyFlags flags; - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - wxCHECK_RET(macDataViewListCtrlPtr != NULL, _("Valid pointer to native data view control does not exist")); - wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(GetNativeData()->GetPropertyID(),&flags) == noErr,_("Could not get property flags.")); - if (sortable) - flags |= kDataBrowserListViewSortableColumn; - else - flags &= ~kDataBrowserListViewSortableColumn; - wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(GetNativeData()->GetPropertyID(),flags) == noErr,_("Could not set property flags.")); - } -} - -void wxDataViewColumn::SetSortOrder(bool ascending) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - m_ascending = ascending; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - - verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); - if (ascending) - headerDescription.initialOrder = kDataBrowserOrderIncreasing; - else - headerDescription.initialOrder = kDataBrowserOrderDecreasing; - verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); - macDataViewListCtrlPtr->SetSortProperty(GetNativeData()->GetPropertyID()); - } - } -} - -void wxDataViewColumn::SetTitle(wxString const& title) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - - m_title = title; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - { - DataBrowserListViewHeaderDesc headerDescription; - wxCFStringRef cfTitle(title,(dataViewCtrlPtr->GetFont().IsOk() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); - - wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); - headerDescription.titleString = cfTitle; - wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set header description.")); - } - } -} - -void wxDataViewColumn::SetWidth(int width) -{ - wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); - - switch ( width ) - { - case wxCOL_WIDTH_AUTOSIZE: - // not implemented, fall through - case wxCOL_WIDTH_DEFAULT: - width = wxDVC_DEFAULT_WIDTH; - break; - default: - break; - } - - if ((width >= m_minWidth) && (width <= m_maxWidth)) - { - m_width = width; - if (dataViewCtrlPtr != NULL) - { - wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast(dataViewCtrlPtr->GetPeer())); - - if (macDataViewListCtrlPtr != NULL) - wxCHECK_RET(macDataViewListCtrlPtr->SetColumnWidth(GetNativeData()->GetPropertyID(),static_cast(width)) == noErr,_("Could not set column width.")); - } - } -} - -void wxDataViewColumn::SetHidden(bool WXUNUSED(hidden)) -{ - // How to do that? -} - -bool wxDataViewColumn::IsHidden() const -{ - return true; -} - - -void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr) -{ - delete m_NativeDataPtr; - m_NativeDataPtr = newNativeDataPtr; -} - -#endif // wxUSE_DATAVIEWCTRL && !wxUSE_GENERICDATAVIEWCTRL diff --git a/Externals/wxWidgets3/src/osx/carbon/dcclient.cpp b/Externals/wxWidgets3/src/osx/carbon/dcclient.cpp index e619f25404..9798ab24aa 100644 --- a/Externals/wxWidgets3/src/osx/carbon/dcclient.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/dcclient.cpp @@ -31,7 +31,7 @@ // wxWindowDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGCDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGCDCImpl); wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) : wxGCDCImpl( owner ) @@ -76,12 +76,12 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() ); wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg ); - context->EnableOffset(true); + context->EnableOffset(m_contentScaleFactor <= 1); SetGraphicsContext( context ); } DoSetClippingRegion( 0 , 0 , m_width , m_height ) ; - SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID)); + SetBackground(wxBrush(window->GetBackgroundColour(),wxBRUSHSTYLE_SOLID)); SetFont( window->GetFont() ) ; } @@ -105,51 +105,11 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const *height = m_height; } -#if wxOSX_USE_CARBON -wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const -{ - // wxScreenDC is derived from wxWindowDC, so a screen dc will - // call this method when a Blit is performed with it as a source. - if (!m_window) - return wxNullBitmap; - - ControlRef handle = (ControlRef) m_window->GetHandle(); - if ( !handle ) - return wxNullBitmap; - - HIRect rect; - CGImageRef image; - CGContextRef context; - - HIViewCreateOffscreenImage( handle, 0, &rect, &image); - - - int width = subrect != NULL ? subrect->width : (int)rect.size.width; - int height = subrect != NULL ? subrect->height : (int)rect.size.height ; - - wxBitmap bmp = wxBitmap(width, height, 32); - - context = (CGContextRef)bmp.GetHBITMAP(); - - CGContextSaveGState(context); - - CGContextTranslateCTM( context, 0, height ); - CGContextScaleCTM( context, 1, -1 ); - - if ( subrect ) - rect = CGRectOffset( rect, -subrect->x, -subrect->y ) ; - CGContextDrawImage( context, rect, image ); - - CGContextRestoreGState(context); - return bmp; -} -#endif - /* * wxClientDCImpl */ -IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl); wxClientDCImpl::wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) @@ -174,7 +134,7 @@ wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) : wxClientDCImpl::~wxClientDCImpl() { - if( GetGraphicsContext() && GetGraphicsContext()->GetNativeContext() ) + if( GetGraphicsContext() && GetGraphicsContext()->GetNativeContext() && !m_release ) Flush(); } @@ -182,7 +142,7 @@ wxClientDCImpl::~wxClientDCImpl() * wxPaintDCImpl */ -IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl); wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) diff --git a/Externals/wxWidgets3/src/osx/carbon/dcprint.cpp b/Externals/wxWidgets3/src/osx/carbon/dcprint.cpp index e7f42f9b95..9c4978f843 100644 --- a/Externals/wxWidgets3/src/osx/carbon/dcprint.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/dcprint.cpp @@ -29,7 +29,7 @@ #include "wx/osx/dcprint.h" #include "wx/graphics.h" -IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxGCDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxGCDCImpl); class wxNativePrinterDC { @@ -45,7 +45,7 @@ public : // returns 0 in case of no Error, otherwise platform specific error codes virtual wxUint32 GetStatus() const = 0 ; - bool IsOk() { return GetStatus() == 0 ; } + bool IsOk() const { return GetStatus() == 0 ; } static wxNativePrinterDC* Create(wxPrintData* data) ; } ; @@ -55,13 +55,13 @@ class wxMacCarbonPrinterDC : public wxNativePrinterDC public : wxMacCarbonPrinterDC( wxPrintData* data ) ; virtual ~wxMacCarbonPrinterDC() ; - virtual bool StartDoc( wxPrinterDC* dc , const wxString& message ) ; - virtual void EndDoc( wxPrinterDC* dc ) ; - virtual void StartPage( wxPrinterDC* dc ) ; - virtual void EndPage( wxPrinterDC* dc ) ; - virtual wxUint32 GetStatus() const { return m_err ; } - virtual void GetSize( int *w , int *h) const ; - virtual wxSize GetPPI() const ; + virtual bool StartDoc( wxPrinterDC* dc , const wxString& message ) wxOVERRIDE ; + virtual void EndDoc( wxPrinterDC* dc ) wxOVERRIDE ; + virtual void StartPage( wxPrinterDC* dc ) wxOVERRIDE ; + virtual void EndPage( wxPrinterDC* dc ) wxOVERRIDE ; + virtual wxUint32 GetStatus() const wxOVERRIDE { return m_err ; } + virtual void GetSize( int *w , int *h) const wxOVERRIDE ; + virtual wxSize GetPPI() const wxOVERRIDE ; private : wxCoord m_maxX ; wxCoord m_maxY ; @@ -141,17 +141,24 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message PMResolution res; PMPrinter printer; + bool useDefaultResolution = true; m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer); if (m_err == noErr) { m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ; - if ( m_err == -9589 /* kPMKeyNotFound */ ) - { - m_err = noErr ; - res.hRes = res.vRes = 300; - } + if (m_err == noErr) + useDefaultResolution = true; } + // Ignore errors which may occur while retrieving the resolution and just + // use the default one. + if ( useDefaultResolution ) + { + res.hRes = + res.vRes = 300; + m_err = noErr ; + } + m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0); m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0); @@ -182,7 +189,7 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc ) native->GetPageFormat(), NULL); - CGContextRef pageContext; + CGContextRef pageContext = NULL ; if ( m_err == noErr ) { diff --git a/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp b/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp index e738a13e58..df7b09db24 100644 --- a/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp @@ -15,11 +15,8 @@ #include "wx/osx/private.h" #include "wx/graphics.h" -#if wxOSX_USE_COCOA_OR_CARBON -#include "wx/osx/private/glgrab.h" -#endif -IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl); // TODO : for the Screenshot use case, which doesn't work in Quartz // we should do a GetAsBitmap using something like @@ -90,16 +87,7 @@ wxBitmap wxScreenDCImpl::DoGetAsBitmap(const wxRect *subrect) const CGImageRef image = NULL; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - if ( UMAGetSystemVersion() >= 0x1060) - { - image = CGDisplayCreateImage(kCGDirectMainDisplay); - } - else -#endif - { - image = grabViaOpenGL(kCGNullDirectDisplay, srcRect); - } + image = CGDisplayCreateImage(kCGDirectMainDisplay); wxASSERT_MSG(image, wxT("wxScreenDC::GetAsBitmap - unable to get screenshot.")); diff --git a/Externals/wxWidgets3/src/osx/carbon/dialog.cpp b/Externals/wxWidgets3/src/osx/carbon/dialog.cpp deleted file mode 100644 index 14f3968e60..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/dialog.cpp +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/dialog.cpp -// Purpose: wxDialog class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/dialog.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/frame.h" - #include "wx/settings.h" -#endif // WX_PRECOMP - -#include "wx/osx/private.h" -#include "wx/evtloop.h" - -void wxDialog::EndWindowModal() -{ - // Nothing to do for now. -} - -void wxDialog::DoShowWindowModal() -{ - // If someone wants to add support for this to wxOSX Carbon, here would - // be the place to start: http://trac.wxwidgets.org/ticket/9459 - // Unfortunately, supporting sheets in Carbon isn't as straightforward - // as with Cocoa, so it will probably take some tweaking. - - m_modality = wxDIALOG_MODALITY_APP_MODAL; - ShowModal(); - SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); -} diff --git a/Externals/wxWidgets3/src/osx/carbon/dirdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/dirdlg.cpp deleted file mode 100644 index b6cc8a45ef..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/dirdlg.cpp +++ /dev/null @@ -1,148 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/dirdlg.cpp -// Purpose: wxDirDialog -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_DIRDLG && !defined(__WXUNIVERSAL__) - -#include "wx/dirdlg.h" - -#ifndef WX_PRECOMP - #include "wx/utils.h" - #include "wx/dialog.h" -#endif // WX_PRECOMP - -#include "wx/filename.h" -#include "wx/modalhook.h" - -#include "wx/osx/private.h" - -IMPLEMENT_CLASS(wxDirDialog, wxDialog) - -static pascal void NavEventProc( - NavEventCallbackMessage inSelector, - NavCBRecPtr ioParams, - NavCallBackUserData ioUserData ); - -static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc); - -static pascal void NavEventProc( - NavEventCallbackMessage inSelector, - NavCBRecPtr ioParams, - NavCallBackUserData ioUserData ) -{ - wxDirDialog * data = ( wxDirDialog *) ioUserData ; - if ( inSelector == kNavCBStart ) - { - if (data && !data->GetPath().empty() ) - { - // Set default location for the modern Navigation APIs - // Apple Technical Q&A 1151 - FSRef theFile; - wxMacPathToFSRef(data->GetPath(), &theFile); - AEDesc theLocation = { typeNull, NULL }; - if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation)) - ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation); - } - } -} - -void wxDirDialog::Init() -{ -} - -void wxDirDialog::Create(wxWindow *parent, - const wxString& message, - const wxString& defaultPath, - long style, - const wxPoint& WXUNUSED(pos), - const wxSize& WXUNUSED(size), - const wxString& WXUNUSED(name)) -{ - wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; - m_parent = parent; - - SetMessage( message ); - SetWindowStyle(style); - SetPath(defaultPath); -} - -int wxDirDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - NavDialogRef dialog = NULL; - NavDialogCreationOptions options; - NavReplyRecord reply ; - bool disposeReply = false ; - OSStatus err = noErr; - - err = NavGetDefaultDialogCreationOptions(&options); - options.optionFlags &= ~kNavAllowMultipleFiles; - if (err == noErr) - { - wxCFStringRef message(m_message, GetFont().GetEncoding()); - options.message = message; - err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL, this , &dialog); - if (err == noErr) - { - wxDialog::OSXBeginModalDialog(); - err = NavDialogRun(dialog); - wxDialog::OSXEndModalDialog(); - if ( err == noErr ) - { - err = NavDialogGetReply(dialog, &reply); - disposeReply = true ; - } - } - } - - if ( err == noErr ) - { - if ( reply.validRecord ) - { - FSRef folderInfo; - AEDesc specDesc ; - - OSErr err = ::AECoerceDesc( &reply.selection , typeFSRef, &specDesc); - if ( err != noErr ) - { - m_path = wxEmptyString ; - } - else - { - folderInfo = **(FSRef**) specDesc.dataHandle; - m_path = wxMacFSRefToPath( &folderInfo ) ; - if (specDesc.dataHandle != nil) - { - ::AEDisposeDesc(&specDesc); - } - } - } - else - { - err = paramErr ; // could be any error, only used for giving back wxID_CANCEL - } - } - - if ( disposeReply ) - ::NavDisposeReply(&reply); - - // apparently cancelling shouldn't change m_path - if ( err != noErr && err != userCanceledErr ) - m_path = wxEmptyString ; - - if ( dialog ) - ::NavDialogDispose(dialog); - - return (err == noErr) ? wxID_OK : wxID_CANCEL ; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/dirmac.cpp b/Externals/wxWidgets3/src/osx/carbon/dirmac.cpp deleted file mode 100644 index f565a30688..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/dirmac.cpp +++ /dev/null @@ -1,256 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/dirmac.cpp -// Purpose: wxDir implementation for Mac -// Author: Stefan Csomor -// Modified by: -// Created: 08.12.99 -// Copyright: (c) 1999 Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/dir.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" -#endif // PCH - -#include "wx/filename.h" -#include "wx/osx/private.h" - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// this class stores everything we need to enumerate the files -class wxDirData -{ -public: - wxDirData(const wxString& dirname); - ~wxDirData(); - - void Close() ; - void SetFileSpec(const wxString& filespec) { m_filespec = filespec; } - void SetFlags(int flags) { m_flags = flags; } - - bool Read(wxString *filename); // reads the next - void Rewind() ; - - const wxString& GetName() const { return m_dirname; } - -private: - FSIterator m_iterator ; - - wxString m_dirname; - wxString m_filespec; - - int m_flags; -}; - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxDirData -// ---------------------------------------------------------------------------- - -wxDirData::wxDirData(const wxString& dirname) - : m_dirname(dirname) -{ - // throw away the trailing slashes - size_t n = m_dirname.length(); - wxCHECK_RET( n, wxT("empty dir name in wxDir") ); - - while ( n > 0 && wxIsPathSeparator(m_dirname[--n]) ) - ; - - m_dirname.Truncate(n + 1); - m_iterator = NULL ; -} - -wxDirData::~wxDirData() -{ - Close() ; -} - -void wxDirData::Close() -{ - if ( m_iterator ) - { - FSCloseIterator( m_iterator ) ; - m_iterator = NULL ; - } -} - -void wxDirData::Rewind() -{ - Close() ; -} - -bool wxDirData::Read(wxString *filename) -{ - wxString result; - OSStatus err = noErr ; - if ( NULL == m_iterator ) - { - FSRef dirRef; - err = wxMacPathToFSRef( m_dirname , &dirRef ) ; - if ( err == noErr ) - { - err = FSOpenIterator(&dirRef, kFSIterateFlat, &m_iterator); - } - if ( err ) - { - Close() ; - return false ; - } - } - - wxString name ; - wxString lowerfilespec = m_filespec.Lower(); - - while( noErr == err ) - { - HFSUniStr255 uniname ; - FSRef fileRef; - FSCatalogInfo catalogInfo; - ItemCount fetched = 0; - - err = FSGetCatalogInfoBulk( m_iterator, 1, &fetched, NULL, kFSCatInfoNodeFlags | kFSCatInfoFinderInfo , &catalogInfo , &fileRef, NULL, &uniname ); - - // expected error codes - - if ( errFSNoMoreItems == err ) - return false ; - if ( afpAccessDenied == err ) - return false ; - - if ( noErr != err ) - break ; - - name = wxMacHFSUniStrToString( &uniname ) ; - wxString lowername = name.Lower(); - - if ( ( name == wxT(".") || name == wxT("..") ) && !(m_flags & wxDIR_DOTDOT) ) - continue; - - if ( ( name[0U] == '.' ) && !(m_flags & wxDIR_HIDDEN ) ) - continue ; - - if ( (((FileInfo*)&catalogInfo.finderInfo)->finderFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN ) ) - continue ; - - // its a dir and we don't want it - if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) && !(m_flags & wxDIR_DIRS) ) - continue ; - - // its a file but we don't want it - if ( (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) == 0 && !(m_flags & wxDIR_FILES ) ) - continue ; - - if ( m_filespec.empty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") ) - { - } - else if ( !wxMatchWild(lowerfilespec, lowername , false) ) - { - continue ; - } - - break ; - } - if ( err != noErr ) - { - return false ; - } - - *filename = name ; - return true; -} - -// ---------------------------------------------------------------------------- -// wxDir construction/destruction -// ---------------------------------------------------------------------------- - -wxDir::wxDir(const wxString& dirname) -{ - m_data = NULL; - - (void)Open(dirname); -} - -bool wxDir::Open(const wxString& dirname) -{ - delete m_data; - m_data = new wxDirData(dirname); - - return true; -} - -bool wxDir::IsOpened() const -{ - return m_data != NULL; -} - -wxString wxDir::GetName() const -{ - wxString name; - if ( m_data ) - { - name = m_data->GetName(); - if ( !name.empty() && (name.Last() == wxT('/')) ) - { - // chop off the last (back)slash - name.Truncate(name.length() - 1); - } - } - - return name; -} - -wxDir::~wxDir() -{ - wxDELETE(m_data); -} - -// ---------------------------------------------------------------------------- -// wxDir enumerating -// ---------------------------------------------------------------------------- - -bool wxDir::GetFirst(wxString *filename, - const wxString& filespec, - int flags) const -{ - wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") ); - - m_data->Rewind(); - - m_data->SetFileSpec(filespec); - m_data->SetFlags(flags); - - return GetNext(filename); -} - -bool wxDir::GetNext(wxString *filename) const -{ - wxCHECK_MSG( IsOpened(), false, wxT("must wxDir::Open() first") ); - - wxCHECK_MSG( filename, false, wxT("bad pointer in wxDir::GetNext()") ); - - return m_data->Read(filename); -} diff --git a/Externals/wxWidgets3/src/osx/carbon/dnd.cpp b/Externals/wxWidgets3/src/osx/carbon/dnd.cpp deleted file mode 100644 index 7310caed04..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/dnd.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/dnd.cpp -// Purpose: wxDropTarget, wxDropSource implementations -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) 1998 Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_DRAG_AND_DROP - -#include "wx/dnd.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/toplevel.h" - #include "wx/gdicmn.h" -#endif // WX_PRECOMP - -#include "wx/osx/private.h" - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -typedef struct -{ - wxWindow *m_currentTargetWindow; - wxDropTarget *m_currentTarget; - wxDropSource *m_currentSource; - wxDragResult m_result; - int m_flags; -} MacTrackingGlobals; - -MacTrackingGlobals gTrackingGlobals; - -void wxMacEnsureTrackingHandlersInstalled(); - -OSStatus wxMacPromiseKeeper(PasteboardRef WXUNUSED(inPasteboard), - PasteboardItemID WXUNUSED(inItem), - CFStringRef WXUNUSED(inFlavorType), - void * WXUNUSED(inContext)) -{ - OSStatus err = noErr; - - // we might add promises here later, inContext is the wxDropSource* - - return err; -} - -wxDropTarget::wxDropTarget( wxDataObject *data ) - : wxDropTargetBase( data ) -{ - wxMacEnsureTrackingHandlersInstalled(); -} - - -//------------------------------------------------------------------------- -// wxDropSource -//------------------------------------------------------------------------- - -wxDropSource::wxDropSource(wxWindow *win, - const wxCursor &cursorCopy, - const wxCursor &cursorMove, - const wxCursor &cursorStop) - : wxDropSourceBase(cursorCopy, cursorMove, cursorStop) -{ - wxMacEnsureTrackingHandlersInstalled(); - - m_window = win; -} - -wxDropSource* wxDropSource::GetCurrentDropSource() -{ - return gTrackingGlobals.m_currentSource; -} - -wxDropSource::wxDropSource(wxDataObject& data, - wxWindow *win, - const wxCursor &cursorCopy, - const wxCursor &cursorMove, - const wxCursor &cursorStop) - : wxDropSourceBase(cursorCopy, cursorMove, cursorStop) -{ - wxMacEnsureTrackingHandlersInstalled(); - - SetData( data ); - m_window = win; -} - -wxDragResult wxDropSource::DoDragDrop(int flags) -{ - wxASSERT_MSG( m_data, wxT("Drop source: no data") ); - - if ((m_data == NULL) || (m_data->GetFormatCount() == 0)) - return (wxDragResult)wxDragNone; - - DragReference theDrag; - RgnHandle dragRegion; - OSStatus err = noErr; - PasteboardRef pasteboard; - - // add data to drag - - err = PasteboardCreate( kPasteboardUniqueName, &pasteboard ); - if ( err != noErr ) - return wxDragNone; - - // we add a dummy promise keeper because of strange messages when linking against carbon debug - err = PasteboardSetPromiseKeeper( pasteboard, wxMacPromiseKeeper, this ); - if ( err != noErr ) - { - CFRelease( pasteboard ); - return wxDragNone; - } - - err = PasteboardClear( pasteboard ); - if ( err != noErr ) - { - CFRelease( pasteboard ); - return wxDragNone; - } - PasteboardSynchronize( pasteboard ); - - m_data->AddToPasteboard( pasteboard, 1 ); - - if (NewDragWithPasteboard( pasteboard , &theDrag) != noErr) - { - CFRelease( pasteboard ); - return wxDragNone; - } - - dragRegion = NewRgn(); - RgnHandle tempRgn = NewRgn(); - - EventRecord rec; - ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent(), &rec ); - - const short dragRegionOuterBoundary = 10; - const short dragRegionInnerBoundary = 9; - - SetRectRgn( - dragRegion, - rec.where.h - dragRegionOuterBoundary, - rec.where.v - dragRegionOuterBoundary, - rec.where.h + dragRegionOuterBoundary, - rec.where.v + dragRegionOuterBoundary ); - - SetRectRgn( - tempRgn, - rec.where.h - dragRegionInnerBoundary, - rec.where.v - dragRegionInnerBoundary, - rec.where.h + dragRegionInnerBoundary, - rec.where.v + dragRegionInnerBoundary ); - - DiffRgn( dragRegion, tempRgn, dragRegion ); - DisposeRgn( tempRgn ); - - // TODO: work with promises in order to return data - // only when drag was successfully completed - - gTrackingGlobals.m_currentSource = this; - gTrackingGlobals.m_result = wxDragNone; - gTrackingGlobals.m_flags = flags; - - err = TrackDrag( theDrag, &rec, dragRegion ); - - DisposeRgn( dragRegion ); - DisposeDrag( theDrag ); - CFRelease( pasteboard ); - gTrackingGlobals.m_currentSource = NULL; - - return gTrackingGlobals.m_result; -} - -bool gTrackingGlobalsInstalled = false; - -// passing the globals via refcon is not needed by the CFM and later architectures anymore -// but I'll leave it in there, just in case... - -pascal OSErr wxMacWindowDragTrackingHandler( - DragTrackingMessage theMessage, WindowPtr theWindow, - void *handlerRefCon, DragReference theDrag ); -pascal OSErr wxMacWindowDragReceiveHandler( - WindowPtr theWindow, void *handlerRefCon, - DragReference theDrag ); - -void wxMacEnsureTrackingHandlersInstalled() -{ - if ( !gTrackingGlobalsInstalled ) - { - OSStatus err; - - err = InstallTrackingHandler( NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L, &gTrackingGlobals ); - verify_noerr( err ); - - err = InstallReceiveHandler( NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals ); - verify_noerr( err ); - - gTrackingGlobalsInstalled = true; - } -} - -pascal OSErr wxMacWindowDragTrackingHandler( - DragTrackingMessage theMessage, WindowPtr theWindow, - void *handlerRefCon, DragReference theDrag ) -{ - MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon; - - Point mouse, localMouse; - DragAttributes attributes; - - GetDragAttributes( theDrag, &attributes ); - PasteboardRef pasteboard = 0; - GetDragPasteboard( theDrag, &pasteboard ); - wxNonOwnedWindow* toplevel = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) theWindow ); - - bool optionDown = GetCurrentKeyModifiers() & optionKey; - wxDragResult result = optionDown ? wxDragCopy : wxDragMove; - - switch (theMessage) - { - case kDragTrackingEnterHandler: - case kDragTrackingLeaveHandler: - break; - - case kDragTrackingEnterWindow: - if (trackingGlobals != NULL) - { - trackingGlobals->m_currentTargetWindow = NULL; - trackingGlobals->m_currentTarget = NULL; - } - break; - - case kDragTrackingInWindow: - if (trackingGlobals == NULL) - break; - if (toplevel == NULL) - break; - - GetDragMouse( theDrag, &mouse, 0L ); - { - int x = mouse.h ; - int y = mouse.v ; - toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y ); - localMouse.h = x; - localMouse.v = y; - - { - wxWindow *win = NULL; - ControlPartCode controlPart; - ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart ); - if ( control ) - win = wxFindWindowFromWXWidget( (WXWidget) control ); - else - win = toplevel; - - int localx, localy; - localx = localMouse.h; - localy = localMouse.v; - - if ( win ) - win->MacRootWindowToWindow( &localx, &localy ); - if ( win != trackingGlobals->m_currentTargetWindow ) - { - if ( trackingGlobals->m_currentTargetWindow ) - { - // this window is left - if ( trackingGlobals->m_currentTarget ) - { - HideDragHilite( theDrag ); - trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); - trackingGlobals->m_currentTarget->OnLeave(); - trackingGlobals->m_currentTarget = NULL; - trackingGlobals->m_currentTargetWindow = NULL; - } - } - - if ( win ) - { - // this window is entered - trackingGlobals->m_currentTargetWindow = win; - trackingGlobals->m_currentTarget = win->GetDropTarget(); - { - if ( trackingGlobals->m_currentTarget ) - { - trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); - result = trackingGlobals->m_currentTarget->OnEnter( localx, localy, result ); - } - - if ( result != wxDragNone ) - { - int x, y; - - x = y = 0; - win->MacWindowToRootWindow( &x, &y ); - RgnHandle hiliteRgn = NewRgn(); - Rect r = { y, x, y + win->GetSize().y, x + win->GetSize().x }; - RectRgn( hiliteRgn, &r ); - ShowDragHilite( theDrag, hiliteRgn, true ); - DisposeRgn( hiliteRgn ); - } - } - } - } - else - { - if ( trackingGlobals->m_currentTarget ) - { - trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); - result = trackingGlobals->m_currentTarget->OnDragOver( localx, localy, result ); - } - } - - // set cursor for OnEnter and OnDragOver - if ( trackingGlobals->m_currentSource && !trackingGlobals->m_currentSource->GiveFeedback( result ) ) - { - if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) ) - { - wxStockCursor cursorID = wxCURSOR_NONE; - - switch (result) - { - case wxDragCopy: - cursorID = wxCURSOR_COPY_ARROW; - break; - - case wxDragMove: - cursorID = wxCURSOR_ARROW; - break; - - case wxDragNone: - cursorID = wxCURSOR_NO_ENTRY; - break; - - case wxDragError: - case wxDragLink: - case wxDragCancel: - default: - // put these here to make gcc happy - ; - } - - if (cursorID != wxCURSOR_NONE) - { - wxCursor cursor( cursorID ); - cursor.MacInstall(); - } - } - } - } - } - break; - - case kDragTrackingLeaveWindow: - if (trackingGlobals == NULL) - break; - - if (trackingGlobals->m_currentTarget) - { - trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); - trackingGlobals->m_currentTarget->OnLeave(); - HideDragHilite( theDrag ); - trackingGlobals->m_currentTarget = NULL; - } - trackingGlobals->m_currentTargetWindow = NULL; - break; - - default: - break; - } - - return noErr; -} - -pascal OSErr wxMacWindowDragReceiveHandler( - WindowPtr theWindow, - void *handlerRefCon, - DragReference theDrag) -{ - MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*)handlerRefCon; - if ( trackingGlobals->m_currentTarget ) - { - Point mouse, localMouse; - int localx, localy; - - PasteboardRef pasteboard = 0; - GetDragPasteboard( theDrag, &pasteboard ); - trackingGlobals->m_currentTarget->SetCurrentDragPasteboard( pasteboard ); - GetDragMouse( theDrag, &mouse, 0L ); - localMouse = mouse; - localx = localMouse.h; - localy = localMouse.v; - wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) theWindow); - if ( tlw ) - tlw->GetNonOwnedPeer()->ScreenToWindow( &localx, &localy ); - - // TODO : should we use client coordinates? - if ( trackingGlobals->m_currentTargetWindow ) - trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx, &localy ); - if ( trackingGlobals->m_currentTarget->OnDrop( localx, localy ) ) - { - // the option key indicates copy in Mac UI, if it's not pressed do - // move by default if it's allowed at all - wxDragResult - result = !(trackingGlobals->m_flags & wxDrag_AllowMove) || - (GetCurrentKeyModifiers() & optionKey) - ? wxDragCopy - : wxDragMove; - trackingGlobals->m_result = - trackingGlobals->m_currentTarget->OnData( localx, localy, result ); - } - } - - return noErr; -} - -#endif // wxUSE_DRAG_AND_DROP - diff --git a/Externals/wxWidgets3/src/osx/carbon/drawer.cpp b/Externals/wxWidgets3/src/osx/carbon/drawer.cpp deleted file mode 100644 index 16854bf02a..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/drawer.cpp +++ /dev/null @@ -1,198 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/drawer.cpp -// Purpose: Drawer child window classes. -// Drawer windows appear under their parent window and -// behave like a drawer, opening and closing to reveal -// content that does not need to be visible at all times. -// Author: Jason Bagley -// Modified by: Ryan Norton (To make it work :), plus bug fixes) -// Created: 2004-30-01 -// Copyright: (c) Jason Bagley; Art & Logic, Inc. -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/osx/private.h" - -#if defined( __WXMAC__ ) - -#include "wx/osx/carbon/drawer.h" - -IMPLEMENT_DYNAMIC_CLASS(wxDrawerWindow, wxWindow) - -// Use constants for now. -// These can be made into member variables and set dynamically. -const int kLeadingOffset = 20; -const int kTrailingOffset = 20; - - -// Converts Mac window edge constants to wxDirections, wxLEFT, wxRIGHT, etc. -static wxDirection WindowEdgeToDirection(OptionBits edge); - -// Convert wxDirections to MAc window edge constants. -static OptionBits DirectionToWindowEdge(wxDirection direction); - - -wxDrawerWindow::wxDrawerWindow() -{ -} - -wxDrawerWindow::~wxDrawerWindow() -{ - SendDestroyEvent(); - Show(FALSE); -} - -bool wxDrawerWindow::Create(wxWindow *parent, - wxWindowID id, const wxString& WXUNUSED(title), - wxSize size, wxDirection edge, const wxString& name) -{ - wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window.")); - - // Constrain the drawer size to the parent window. - const wxSize parentSize(parent->GetClientSize()); - if (wxLEFT == edge || wxRIGHT == edge) - { - if (size.GetHeight() > parentSize.GetHeight()) - size.SetHeight(parentSize.GetHeight() - (kLeadingOffset + kTrailingOffset)); - } - else - { - if (size.GetWidth() > parentSize.GetWidth()) - size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset)); - } - - // Create the drawer window. - const wxPoint pos(0, 0); - const wxSize dummySize(0,0); - const long style = wxFRAME_DRAWER; - - bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name); - if (success) - { - // this->MacCreateRealWindow(pos, size, style, name); - success = (GetWXWindow() != NULL); - } - - if (success) - { - // Use drawer brush. - SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) ); - ::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false); - - // Leading and trailing offset are gaps from parent window edges - // to where the drawer starts. - ::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset); - - // Set the drawers parent. - // Is there a better way to get the parent's WindowRef? - wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow); - if (NULL != tlwParent) - { - OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(), - (WindowRef)tlwParent->GetWXWindow()); - success = (noErr == status); - } - else - success = false; - } - - return success && SetPreferredEdge(edge); -} - -wxDirection wxDrawerWindow::GetCurrentEdge() const -{ - const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)GetWXWindow()); - return WindowEdgeToDirection(edge); -} - -wxDirection wxDrawerWindow::GetPreferredEdge() const -{ - const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow()); - return WindowEdgeToDirection(edge); -} - -bool wxDrawerWindow::IsOpen() const -{ - WindowDrawerState state = ::GetDrawerState((WindowRef)GetWXWindow()); - return (state == kWindowDrawerOpen || state == kWindowDrawerOpening); -} - -bool wxDrawerWindow::Open(bool show) -{ - static const Boolean kAsynchronous = true; - OSStatus status = noErr; - - if (show) - { - const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow()); - status = ::OpenDrawer((WindowRef)GetWXWindow(), preferredEdge, kAsynchronous); - } - else - status = ::CloseDrawer((WindowRef)GetWXWindow(), kAsynchronous); - - return (noErr == status); -} - -bool wxDrawerWindow::SetPreferredEdge(wxDirection edge) -{ - const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(), - DirectionToWindowEdge(edge)); - return (noErr == status); -} - - -OptionBits DirectionToWindowEdge(wxDirection direction) -{ - OptionBits edge; - switch (direction) - { - case wxTOP: - edge = kWindowEdgeTop; - break; - - case wxBOTTOM: - edge = kWindowEdgeBottom; - break; - - case wxRIGHT: - edge = kWindowEdgeRight; - break; - - case wxLEFT: - default: - edge = kWindowEdgeLeft; - break; - } - return edge; -} - -wxDirection WindowEdgeToDirection(OptionBits edge) -{ - wxDirection direction; - switch (edge) - { - case kWindowEdgeTop: - direction = wxTOP; - break; - - case kWindowEdgeBottom: - direction = wxBOTTOM; - break; - - case kWindowEdgeRight: - direction = wxRIGHT; - break; - - case kWindowEdgeDefault: // store current preferred and return that here? - case kWindowEdgeLeft: - default: - direction = wxLEFT; - break; - } - - return direction; -} - -#endif // defined( __WXMAC__ ) diff --git a/Externals/wxWidgets3/src/osx/carbon/dummy.txt b/Externals/wxWidgets3/src/osx/carbon/dummy.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Externals/wxWidgets3/src/osx/carbon/evtloop.cpp b/Externals/wxWidgets3/src/osx/carbon/evtloop.cpp deleted file mode 100644 index 4a8238baa0..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/evtloop.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/evtloop.cpp -// Purpose: implementation of wxEventLoop for wxMac -// Author: Vadim Zeitlin -// Modified by: -// Created: 2006-01-12 -// Copyright: (c) 2006 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/evtloop.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/log.h" -#endif // WX_PRECOMP - -#if wxUSE_GUI -#include "wx/nonownedwnd.h" -#endif - -#include "wx/osx/private.h" - -// ============================================================================ -// wxEventLoop implementation -// ============================================================================ - -wxGUIEventLoop::wxGUIEventLoop() -{ -} - -static void DispatchAndReleaseEvent(EventRef theEvent) -{ - if ( wxTheApp ) - wxTheApp->MacSetCurrentEvent( theEvent, NULL ); - - OSStatus status = SendEventToEventTarget(theEvent, GetEventDispatcherTarget()); - if (status == eventNotHandledErr && wxTheApp) - wxTheApp->MacHandleUnhandledEvent(theEvent); - - ReleaseEvent( theEvent ); -} - -int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) -{ - wxMacAutoreleasePool autoreleasepool; - - EventRef event; - OSStatus status = ReceiveNextEvent(0, NULL, timeout/1000, true, &event); - switch ( status ) - { - default: - wxFAIL_MSG( "unexpected ReceiveNextEvent() error" ); - // fall through - - case eventLoopTimedOutErr: - return -1; - - case eventLoopQuitErr: - // according to QA1061 this may also occur - // when a WakeUp Process is executed - return 0; - - case noErr: - DispatchAndReleaseEvent(event); - return 1; - } -} - -void wxGUIEventLoop::WakeUp() -{ - OSStatus err = noErr; - wxMacCarbonEvent wakeupEvent; - wakeupEvent.Create( 'WXMC', 'WXMC', GetCurrentEventTime(), - kEventAttributeNone ); - err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, - kEventPriorityHigh ); -} - -void wxGUIEventLoop::OSXDoRun() -{ - wxMacAutoreleasePool autoreleasepool; - - while (!m_shouldExit) - { - RunApplicationEventLoop(); - } - - // Force enclosing event loop to temporarily exit and check - // if it should be stopped. - QuitApplicationEventLoop(); -} - -void wxGUIEventLoop::OSXDoStop() -{ - QuitApplicationEventLoop(); -} - -CFRunLoopRef wxGUIEventLoop::CFGetCurrentRunLoop() const -{ - return wxCFEventLoop::CFGetCurrentRunLoop(); -} - -// TODO move into a evtloop_osx.cpp - -wxModalEventLoop::wxModalEventLoop(wxWindow *modalWindow) -{ - m_modalWindow = wxDynamicCast(modalWindow, wxNonOwnedWindow); - wxASSERT_MSG( m_modalWindow != NULL, "must pass in a toplevel window for modal event loop" ); - m_modalNativeWindow = m_modalWindow->GetWXWindow(); -} - -wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow) -{ - m_modalWindow = NULL; - wxASSERT_MSG( modalNativeWindow != NULL, "must pass in a toplevel window for modal event loop" ); - m_modalNativeWindow = modalNativeWindow; -} - -// END move into a evtloop_osx.cpp - -void wxModalEventLoop::OSXDoRun() -{ - wxWindowDisabler disabler(m_modalWindow); - wxMacAutoreleasePool autoreleasepool; - - bool resetGroupParent = false; - - WindowGroupRef windowGroup = NULL; - WindowGroupRef formerParentGroup = NULL; - - // make sure modal dialogs are in the right layer so that they are not covered - if ( m_modalWindow != NULL ) - { - if ( m_modalWindow->GetParent() == NULL ) - { - windowGroup = GetWindowGroup(m_modalNativeWindow) ; - if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) ) - { - formerParentGroup = GetWindowGroupParent( windowGroup ); - SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) ); - resetGroupParent = true; - } - } - } - - m_modalWindow->SetFocus(); - - RunAppModalLoopForWindow(m_modalNativeWindow); - - if ( resetGroupParent ) - { - SetWindowGroupParent( windowGroup , formerParentGroup ); - } - -} - -void wxModalEventLoop::OSXDoStop() -{ - wxMacAutoreleasePool autoreleasepool; - QuitAppModalLoopForWindow(m_modalNativeWindow); -} - - diff --git a/Externals/wxWidgets3/src/osx/carbon/filedlg.cpp b/Externals/wxWidgets3/src/osx/carbon/filedlg.cpp deleted file mode 100644 index fb953d1986..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/filedlg.cpp +++ /dev/null @@ -1,625 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/filedlg.cpp -// Purpose: wxFileDialog -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_FILEDLG - -#include "wx/filedlg.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/dialog.h" -#endif - -#include "wx/tokenzr.h" -#include "wx/filename.h" - -#include "wx/osx/private.h" -#include "wx/modalhook.h" - -#ifndef __DARWIN__ - #include - #include "PLStringFuncs.h" -#endif - -IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) - -// the data we need to pass to our standard file hook routine -// includes a pointer to the dialog, a pointer to the standard -// file reply record (so we can inspect the current selection) -// and a copy of the "previous" file spec of the reply record -// so we can see if the selection has changed - -class OpenUserDataRec -{ -public: - OpenUserDataRec( wxFileDialog* dialog ); - - bool FilterCallback( AEDesc *theItem, void *info, NavFilterModes filterMode ); - void EventProc( NavEventCallbackMessage inSelector, NavCBRecPtr ioParams ); - - int GetCurrentFilter() const {return m_currentfilter;} - CFArrayRef GetMenuItems() const { return m_menuitems;} - - -private: - void EventProcCBEvent( NavCBRecPtr ioParams ); - void EventProcCBEventMouseDown( NavCBRecPtr ioParams); - void EventProcCBStart( NavCBRecPtr ioParams ); - void EventProcCBPopupMenuSelect( NavCBRecPtr ioParams ); - void EventProcCBCustomize( NavCBRecPtr ioParams ); - void EventProcCBAdjustRect( NavCBRecPtr ioParams ); - bool CheckFile( const wxString &filename , OSType type); - void MakeUserDataRec( const wxString& filter); - - wxFileDialog* m_dialog; - int m_currentfilter; - wxString m_defaultLocation; - wxArrayString m_extensions; - wxArrayLong m_filtermactypes; - CFMutableArrayRef m_menuitems; - wxArrayString m_name; - bool m_saveMode; - SInt16 m_lastRight; - SInt16 m_lastBottom; - bool m_controlAdded; -}; - -OpenUserDataRec::OpenUserDataRec( wxFileDialog* d) -{ - m_dialog = d; - m_controlAdded = false; - m_saveMode = m_dialog->HasFdFlag(wxFD_SAVE); - - m_defaultLocation = m_dialog->GetDirectory(); - MakeUserDataRec(m_dialog->GetWildcard()); - m_currentfilter = m_dialog->GetFilterIndex(); - - m_menuitems = NULL; - - size_t numFilters = m_extensions.GetCount(); - if (numFilters) - { - m_menuitems = CFArrayCreateMutable( kCFAllocatorDefault , - numFilters , &kCFTypeArrayCallBacks ) ; - for ( size_t i = 0 ; i < numFilters ; ++i ) - { - CFArrayAppendValue( m_menuitems , (CFStringRef) wxCFStringRef( m_name[i] ) ) ; - } - } - m_lastRight = m_lastBottom = 0; -} - -void OpenUserDataRec::EventProc(NavEventCallbackMessage inSelector,NavCBRecPtr ioParams) -{ - switch (inSelector) - { - case kNavCBEvent: - EventProcCBEvent(ioParams); - break; - case kNavCBStart: - EventProcCBStart(ioParams); - break; - case kNavCBPopupMenuSelect: - EventProcCBPopupMenuSelect(ioParams); - break; - case kNavCBCustomize: - EventProcCBCustomize(ioParams); - break; - case kNavCBAdjustRect: - EventProcCBAdjustRect(ioParams); - break; - default: - break; - } -} - -void OpenUserDataRec::EventProcCBEvent(NavCBRecPtr callBackParms) -{ - switch (callBackParms->eventData.eventDataParms.event->what) - { - case mouseDown: - { - EventProcCBEventMouseDown(callBackParms); - break; - } - } -} - -void OpenUserDataRec::EventProcCBEventMouseDown(NavCBRecPtr callBackParms) -{ - EventRecord *evt = callBackParms->eventData.eventDataParms.event; - Point where = evt->where; - QDGlobalToLocalPoint(GetWindowPort(callBackParms->window), &where); - - ControlRef whichControl = FindControlUnderMouse(where, callBackParms->window, NULL); - if (whichControl != NULL) - { - ControlKind theKind; - GetControlKind(whichControl, &theKind); - - // Moving the focus if we clicked in an focusable control - if ((theKind.kind == kControlKindEditUnicodeText) || - (theKind.kind == kControlKindEditText) || - (theKind.kind == kControlKindDataBrowser) || - (theKind.kind == kControlKindListBox)) - { - ControlRef currentlyFocusedControl; - GetKeyboardFocus(callBackParms->window, ¤tlyFocusedControl); - if (currentlyFocusedControl != whichControl) - SetKeyboardFocus(callBackParms->window, whichControl, kControlFocusNextPart); - } - HandleControlClick(whichControl, where, evt->modifiers, NULL); - } -} - -void OpenUserDataRec::EventProcCBStart(NavCBRecPtr ioParams) -{ - if (!m_defaultLocation.empty()) - { - // Set default location for the modern Navigation APIs - // Apple Technical Q&A 1151 - FSRef theFile; - wxMacPathToFSRef(m_defaultLocation, &theFile); - AEDesc theLocation = { typeNull, NULL }; - if (noErr == ::AECreateDesc(typeFSRef, &theFile, sizeof(FSRef), &theLocation)) - ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation); - } - - if( m_extensions.GetCount() > 0 ) - { - NavMenuItemSpec menuItem; - memset( &menuItem, 0, sizeof(menuItem) ); - menuItem.version = kNavMenuItemSpecVersion; - menuItem.menuType = m_currentfilter; - ::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem); - } - - if (m_dialog->GetExtraControl()) - { - m_controlAdded = true; - ControlRef ref = m_dialog->GetExtraControl()->GetPeer()->GetControlRef(); - NavCustomControl(ioParams->context, kNavCtlAddControl, ref); - } - -} - -void OpenUserDataRec::EventProcCBPopupMenuSelect(NavCBRecPtr ioParams) -{ - NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ; - const size_t numFilters = m_extensions.GetCount(); - - if ( menu->menuType < numFilters ) - { - m_currentfilter = menu->menuType ; - if ( m_saveMode ) - { - int i = menu->menuType ; - - // isolate the first extension string - wxString firstExtension = m_extensions[i].BeforeFirst('|').BeforeFirst(';'); - - wxString extension = firstExtension.AfterLast('.') ; - wxString sfilename ; - - wxCFStringRef cfString( wxCFRetain( NavDialogGetSaveFileName( ioParams->context ) ) ); - sfilename = cfString.AsString() ; - - int pos = sfilename.Find('.', true) ; - if ( pos != wxNOT_FOUND && extension != wxT("*") ) - { - sfilename = sfilename.Left(pos+1)+extension ; - cfString = wxCFStringRef( sfilename , wxFONTENCODING_DEFAULT ) ; - NavDialogSetSaveFileName( ioParams->context , cfString ) ; - } - } - } -} - -void OpenUserDataRec::EventProcCBCustomize(NavCBRecPtr ioParams) -{ - wxWindow* control = m_dialog->GetExtraControl(); - - if ( control ) - { - SInt16 neededRight, neededBottom; - - wxSize size = m_dialog->GetExtraControl()->GetSize(); - neededRight = ioParams->customRect.left + size.x; - neededBottom = ioParams->customRect.top + size.y; - - if (ioParams->customRect.right == 0 && ioParams->customRect.bottom == 0) - { - ioParams->customRect.right = neededRight; - ioParams->customRect.bottom = neededBottom; - } - else - { - if ( ioParams->customRect.right != m_lastRight ) - { - if ( ioParams->customRect.right < neededRight ) - ioParams->customRect.right = neededRight; - } - if ( ioParams->customRect.bottom != m_lastBottom ) - { - if ( ioParams->customRect.bottom < neededBottom ) - ioParams->customRect.bottom = neededBottom; - } - } - m_lastRight = ioParams->customRect.right; - m_lastBottom = ioParams->customRect.bottom; - } -} - -void OpenUserDataRec::EventProcCBAdjustRect(NavCBRecPtr ioParams) -{ - wxWindow* control = m_dialog->GetExtraControl(); - - if ( control && m_controlAdded) - { - control->SetSize(ioParams->customRect.left , ioParams->customRect.top, - ioParams->customRect.right - ioParams->customRect.left, - ioParams->customRect.bottom - ioParams->customRect.top); - } -} - -void OpenUserDataRec::MakeUserDataRec( const wxString& filter ) -{ - if ( !filter.empty() ) - { - wxString filter2(filter) ; - int filterIndex = 0; - bool isName = true ; - wxString current ; - - for ( unsigned int i = 0; i < filter2.length() ; i++ ) - { - if ( filter2.GetChar(i) == wxT('|') ) - { - if ( isName ) - { - m_name.Add( current ) ; - } - else - { - m_extensions.Add( current ) ; - ++filterIndex ; - } - - isName = !isName ; - current = wxEmptyString ; - } - else - { - current += filter2.GetChar(i) ; - } - } - // we allow for compatibility reason to have a single filter expression (like *.*) without - // an explanatory text, in that case the first part is name and extension at the same time - - wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ; - if ( current.empty() ) - m_extensions.Add( m_name[filterIndex] ) ; - else - m_extensions.Add( current ) ; - if ( filterIndex == 0 || isName ) - m_name.Add( current ) ; - - ++filterIndex ; - - const size_t extCount = m_extensions.GetCount(); - for ( size_t i = 0 ; i < extCount; i++ ) - { - wxUint32 fileType, creator; - wxString extension = m_extensions[i]; - - // Remove leading '*' - if ( !extension.empty() && (extension.GetChar(0) == '*') ) - extension = extension.Mid( 1 ); - - // Remove leading '.' - if ( !extension.empty() && (extension.GetChar(0) == '.') ) - extension = extension.Mid( 1 ); - - if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator )) - m_filtermactypes.Add( (OSType)fileType ); - else - m_filtermactypes.Add( '****' ); // We'll fail safe if it's not recognized - } - } -} - -bool OpenUserDataRec::CheckFile( const wxString &filename , OSType type) -{ - wxString file(filename) ; - file.MakeUpper() ; - - if ( m_extensions.GetCount() > 0 ) - { - //for ( int i = 0 ; i < data->numfilters ; ++i ) - int i = m_currentfilter ; - if ( m_extensions[i].Right(2) == wxT(".*") ) - return true ; - - { - if ( type == (OSType)m_filtermactypes[i] ) - return true ; - - wxStringTokenizer tokenizer( m_extensions[i] , wxT(";") ) ; - while ( tokenizer.HasMoreTokens() ) - { - wxString extension = tokenizer.GetNextToken() ; - if ( extension.GetChar(0) == '*' ) - extension = extension.Mid(1) ; - extension.MakeUpper(); - - if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) ) - return true ; - } - } - - return false ; - } - - return true ; -} - -bool OpenUserDataRec::FilterCallback( - AEDesc *theItem, - void *info, - NavFilterModes filterMode ) -{ - if (filterMode == kNavFilteringBrowserList) - { - // We allow navigation to all folders. For files, we check against the current - // filter string. - // However, packages should be dealt with like files and not like folders. So - // check if a folder is a package before deciding what to do. - NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ; - FSRef fsref; - - if ( theInfo->isFolder ) - { - // check bundle bit (using Finder Services - used by OS9 on some bundles) - FSCatalogInfo catalogInfo; - if (FSGetCatalogInfo (&fsref, kFSCatInfoFinderInfo, &catalogInfo, NULL, NULL, NULL) != noErr) - return true; - - // Check bundle item (using Launch Services - used by OS-X through info.plist or APP) - LSItemInfoRecord lsInfo; - if (LSCopyItemInfoForRef(&fsref, kLSRequestBasicFlagsOnly, &lsInfo ) != noErr) - return true; - - // If it's not a bundle, then it's a normal folder and it passes our filter - FileInfo *fileInfo = (FileInfo *) catalogInfo.finderInfo; - if ( !(fileInfo->finderFlags & kHasBundle) && - !(lsInfo.flags & (kLSItemInfoIsApplication | kLSItemInfoIsPackage)) ) - return true; - } - else - { - AECoerceDesc (theItem, typeFSRef, theItem); - if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr) - { - wxString file = wxMacFSRefToPath( &fsref ) ; - return CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType ) ; - } - } - } - - return true; -} - -// end wxmac - -pascal Boolean CrossPlatformFilterCallback( - AEDesc *theItem, - void *info, - void *callBackUD, - NavFilterModes filterMode ); - -pascal Boolean CrossPlatformFilterCallback( - AEDesc *theItem, - void *info, - void *callBackUD, - NavFilterModes filterMode ) -{ - OpenUserDataRec* data = (OpenUserDataRec*) callBackUD ; - return data->FilterCallback(theItem,info,filterMode); -} - -static pascal void NavEventProc( - NavEventCallbackMessage inSelector, - NavCBRecPtr ioParams, - NavCallBackUserData ioUserData ); - -static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc); - -static pascal void NavEventProc( - NavEventCallbackMessage inSelector, - NavCBRecPtr ioParams, - NavCallBackUserData ioUserData ) -{ - OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ; - data->EventProc(inSelector, ioParams); -} - - -void wxFileDialog::Init() -{ -} - -void 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) -{ - wxFileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name); - - wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; -} - -void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) -{ - wxTopLevelWindow::Create( GetParent(), nativeWindow ); - - if (HasExtraControlCreator()) - { - CreateExtraControl(); - } -} - -int wxFileDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - m_paths.Empty(); - m_fileNames.Empty(); - - OSErr err; - NavDialogCreationOptions dialogCreateOptions; - - // set default options - ::NavGetDefaultDialogCreationOptions(&dialogCreateOptions); - - // this was always unset in the old code - dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation; - - wxCFStringRef message(m_message, GetFont().GetEncoding()); - dialogCreateOptions.windowTitle = message; - - wxCFStringRef defaultFileName(m_fileName, GetFont().GetEncoding()); - dialogCreateOptions.saveFileName = defaultFileName; - - NavDialogRef dialog; - NavObjectFilterUPP navFilterUPP = NULL; - OpenUserDataRec myData( this ); - - dialogCreateOptions.popupExtension = myData.GetMenuItems(); - - if (HasFdFlag(wxFD_SAVE)) - { - dialogCreateOptions.optionFlags |= kNavDontAutoTranslate; - dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems; - if (dialogCreateOptions.popupExtension == NULL) - dialogCreateOptions.optionFlags |= kNavNoTypePopup; - - // The extension is important - if ( dialogCreateOptions.popupExtension == NULL || CFArrayGetCount(dialogCreateOptions.popupExtension)<2) - dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension; - - if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT)) - dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement; - - err = ::NavCreatePutFileDialog( - &dialogCreateOptions, - kNavGenericSignature, // Suppresses the 'Default' (top) menu item - kNavGenericSignature, - sStandardNavEventFilter, - &myData, // for defaultLocation - &dialog ); - } - else - { - // let the user select bundles/programs in dialogs - dialogCreateOptions.optionFlags |= kNavSupportPackages; - - navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback); - err = ::NavCreateGetFileDialog( - &dialogCreateOptions, - NULL, // NavTypeListHandle - sStandardNavEventFilter, - NULL, // NavPreviewUPP - navFilterUPP, - (void *) &myData, // inClientData - &dialog ); - } - - SetupExtraControls(NavDialogGetWindow(dialog)); - - if (err == noErr) - { - wxDialog::OSXBeginModalDialog(); - err = ::NavDialogRun(dialog); - wxDialog::OSXEndModalDialog(); - } - - // clean up filter related data, etc. - if (navFilterUPP) - ::DisposeNavObjectFilterUPP(navFilterUPP); - - if (err != noErr) - { - ::NavDialogDispose(dialog); - return wxID_CANCEL; - } - - NavReplyRecord navReply; - err = ::NavDialogGetReply(dialog, &navReply); - if (err == noErr && navReply.validRecord) - { - AEKeyword theKeyword; - DescType actualType; - Size actualSize; - FSRef theFSRef; - wxString thePath ; - long count; - - m_filterIndex = myData.GetCurrentFilter(); - ::AECountItems( &navReply.selection, &count ); - for (long i = 1; i <= count; ++i) - { - err = ::AEGetNthPtr( - &(navReply.selection), i, typeFSRef, &theKeyword, &actualType, - &theFSRef, sizeof(theFSRef), &actualSize ); - if (err != noErr) - break; - - if (HasFdFlag(wxFD_SAVE)) - thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName ); - else - thePath = wxMacFSRefToPath( &theFSRef ); - - if (!thePath) - { - ::NavDisposeReply(&navReply); - ::NavDialogDispose(dialog); - return wxID_CANCEL; - } - - m_path = thePath; - m_paths.Add(m_path); - m_fileName = wxFileNameFromPath(m_path); - m_fileNames.Add(m_fileName); - } - - // set these to the first hit - m_path = m_paths[0]; - m_fileName = wxFileNameFromPath(m_path); - m_dir = wxPathOnly(m_path); - } - - UnsubclassWin(); - ::NavDisposeReply(&navReply); - ::NavDialogDispose(dialog); - - return (err == noErr) ? wxID_OK : wxID_CANCEL; -} - -bool wxFileDialog::SupportsExtraControl() const -{ - return true; -} - -#endif // wxUSE_FILEDLG - diff --git a/Externals/wxWidgets3/src/osx/carbon/font.cpp b/Externals/wxWidgets3/src/osx/carbon/font.cpp index c3ad61eb15..29a9909427 100644 --- a/Externals/wxWidgets3/src/osx/carbon/font.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/font.cpp @@ -18,6 +18,7 @@ #include "wx/intl.h" #include "wx/gdicmn.h" #include "wx/log.h" + #include "wx/math.h" #endif #include "wx/fontutil.h" @@ -38,7 +39,7 @@ public: { Init(); m_info.Init(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, - false, wxEmptyString, wxFONTENCODING_DEFAULT); + false, false, wxEmptyString, wxFONTENCODING_DEFAULT); } wxFontRefData(const wxFontRefData& data); @@ -102,6 +103,15 @@ public: wxFontWeight GetWeight() const { return m_info.GetWeight(); } + void SetStrikethrough( bool s ) + { + if ( m_info.m_strikethrough != s ) + { + m_info.SetStrikethrough( s ); + Free(); + } + } + void SetUnderlined( bool u ) { if ( m_info.m_underlined != u ) @@ -112,6 +122,7 @@ public: } bool GetUnderlined() const { return m_info.GetUnderlined(); } + bool GetStrikethrough() const { return m_info.GetStrikethrough(); } void SetFaceName( const wxString& facename ) { @@ -146,11 +157,6 @@ protected: void Init(); public: bool m_fontValid; -#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT - // for true theming support we must store the correct font - // information here, as this speeds up and optimizes rendering - ThemeFontID m_macThemeFontID ; -#endif wxCFRef m_ctFont; #if wxOSX_USE_ATSU_TEXT void CreateATSUFont(); @@ -174,9 +180,6 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData() Init(); m_info = data.m_info; m_fontValid = data.m_fontValid; -#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT - m_macThemeFontID = data.m_macThemeFontID; -#endif m_ctFont = data.m_ctFont; m_cgFont = data.m_cgFont; #if wxOSX_USE_ATSU_TEXT @@ -199,15 +202,15 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData() // implementation // ============================================================================ +wxStringToStringHashMap gs_FontFamilyToPSName; +static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName, CTFontSymbolicTraits iTraits ); + // ---------------------------------------------------------------------------- // wxFontRefData // ---------------------------------------------------------------------------- void wxFontRefData::Init() { -#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT - m_macThemeFontID = kThemeCurrentPortFont ; -#endif #if wxOSX_USE_ATSU_TEXT m_macATSUStyle = NULL ; #endif @@ -230,9 +233,6 @@ void wxFontRefData::Free() m_ctFont.reset(); m_cgFont.reset(); #if wxOSX_USE_ATSU_TEXT -#if wxOSX_USE_CARBON - m_macThemeFontID = kThemeCurrentPortFont ; -#endif if ( m_macATSUStyle ) { ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle); @@ -299,10 +299,8 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size) } #if wxOSX_USE_ATSU_TEXT { -#if !wxOSX_USE_CARBON // not needed outside ThemeFontID m_macThemeFontID = kThemeSystemFont; -#endif switch( font ) { case wxOSX_SYSTEM_FONT_NORMAL: @@ -346,6 +344,7 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size) wxFontStyle fontstyle = wxFONTSTYLE_NORMAL; wxFontWeight fontweight = wxFONTWEIGHT_NORMAL; bool underlined = false; + bool strikethrough = false; if ( style & bold ) fontweight = wxFONTWEIGHT_BOLD ; @@ -356,7 +355,8 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size) if ( style & underline ) underlined = true ; - m_info.Init(fontSize,wxFONTFAMILY_DEFAULT,fontstyle,fontweight,underlined, + m_info.Init(fontSize,wxFONTFAMILY_DEFAULT,fontstyle, + fontweight,underlined, strikethrough, wxMacMakeStringFromPascal( qdFontName ), wxFONTENCODING_DEFAULT); } } @@ -393,6 +393,7 @@ void wxFontRefData::CreateATSUFont() kATSUQDUnderlineTag , kATSUQDCondensedTag , kATSUQDExtendedTag , + kATSUStyleStrikeThroughTag }; ByteCount atsuSizes[WXSIZEOF(atsuTags)] = { @@ -404,6 +405,7 @@ void wxFontRefData::CreateATSUFont() sizeof( Boolean ) , sizeof( Boolean ) , sizeof( Boolean ) , + sizeof( Boolean ) }; Boolean kTrue = true ; @@ -422,6 +424,7 @@ void wxFontRefData::CreateATSUFont() (addQDStyle & underline) ? &kTrue : &kFalse , (addQDStyle & condense) ? &kTrue : &kFalse , (addQDStyle & extend) ? &kTrue : &kFalse , + m_info.m_strikethrough ? & kTrue : &kFalse }; status = ::ATSUSetAttributes( @@ -439,8 +442,7 @@ void wxFontRefData::CreateATSUFont() } #endif -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(DegToRad(11)), 1, 0, 0 ); +static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(wxDegToRad(11)), 1, 0, 0 ); void wxFontRefData::MacFindFont() { @@ -466,7 +468,20 @@ void wxFontRefData::MacFindFont() m_ctFont = fontcache[ std::wstring(lookupnameWithSize.wc_str()) ]; if ( !m_ctFont ) { - m_ctFont.reset(CTFontCreateWithName( wxCFStringRef(m_info.m_faceName), m_info.m_pointSize , NULL )); + + wxStringToStringHashMap::const_iterator it = gs_FontFamilyToPSName.find(m_info.m_faceName); + + if ( it != gs_FontFamilyToPSName.end() ) + { + m_ctFont.reset(CTFontCreateWithName( wxCFStringRef(it->second), m_info.m_pointSize , NULL )); + } + else + { + wxCFRef desc(wxMacCreateCTFontDescriptor(wxCFStringRef(m_info.m_faceName),0)); + m_ctFont.reset(CTFontCreateWithFontDescriptor(desc, m_info.m_pointSize , NULL )); + m_info.UpdateNamesMap(m_info.m_faceName, m_ctFont); + } + if ( m_ctFont.get() == NULL ) { // TODO try fallbacks according to font type @@ -501,7 +516,7 @@ void wxFontRefData::MacFindFont() if ( fontWithTraits == NULL ) { - fontWithTraits = CTFontCreateWithName( wxCFStringRef(m_info.m_faceName), m_info.m_pointSize, remainingTransform ); + fontWithTraits = CTFontCreateCopyWithAttributes( m_ctFont, m_info.m_pointSize, remainingTransform, NULL ); } } @@ -557,6 +572,18 @@ wxFont::wxFont(const wxString& fontdesc) (void)Create(info); } +wxFont::wxFont(int size, + int family, + int style, + int weight, + bool underlined, + const wxString& face, + wxFontEncoding encoding) +{ + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, + (wxFontWeight)weight, underlined, face, encoding); +} + bool wxFont::Create(int pointSize, wxFontFamily family, wxFontStyle style, @@ -601,7 +628,7 @@ bool wxFont::Create(int pointSize, wxNativeFontInfo info; info.Init(pointSize, family, style, weight, - underlined, faceName, encoding); + underlined, false, faceName, encoding); m_refData = new wxFontRefData(info); @@ -691,6 +718,13 @@ void wxFont::SetUnderlined(bool underlined) M_FONTDATA->SetUnderlined( underlined ); } +void wxFont::SetStrikethrough(bool strikethrough) +{ + AllocExclusive(); + + M_FONTDATA->SetStrikethrough( strikethrough ); +} + // ---------------------------------------------------------------------------- // accessors // ---------------------------------------------------------------------------- @@ -755,6 +789,13 @@ bool wxFont::GetUnderlined() const return M_FONTDATA->GetUnderlined(); } +bool wxFont::GetStrikethrough() const +{ + wxCHECK_MSG( M_FONTDATA != NULL, false, wxT("invalid font") ); + + return M_FONTDATA->GetStrikethrough(); +} + wxString wxFont::GetFaceName() const { wxCHECK_MSG( M_FONTDATA != NULL , wxEmptyString , wxT("invalid font") ); @@ -769,37 +810,6 @@ wxFontEncoding wxFont::GetEncoding() const return M_FONTDATA->GetEncoding() ; } -#if wxOSX_USE_ATSU_TEXT && wxOSX_USE_CARBON - -short wxFont::MacGetFontNum() const -{ - wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); - - // cast away constness otherwise lazy font resolution is not possible - const_cast(this)->RealizeResource(); - - return M_FONTDATA->m_info.m_qdFontFamily; -} - -wxByte wxFont::MacGetFontStyle() const -{ - wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); - - // cast away constness otherwise lazy font resolution is not possible - const_cast(this)->RealizeResource(); - - return M_FONTDATA->m_info.m_qdFontStyle; -} - -wxUint16 wxFont::MacGetThemeFontID() const -{ - wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); - - return M_FONTDATA->m_macThemeFontID; -} - -#endif - #if wxOSX_USE_ATSU_TEXT void * wxFont::MacGetATSUStyle() const { @@ -902,8 +912,6 @@ const wxNativeFontInfo * wxFont::GetNativeFontInfo() const // wxNativeFontInfo // ---------------------------------------------------------------------------- -#if 0 // wxOSX_USE_CORE_TEXT - /* from Core Text Manual Common Operations */ static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName, CTFontSymbolicTraits iTraits ) @@ -958,7 +966,6 @@ static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName, return descriptor ; } -#endif void wxNativeFontInfo::Init() { @@ -966,16 +973,13 @@ void wxNativeFontInfo::Init() m_atsuFontID = 0 ; m_atsuAdditionalQDStyles = 0; m_atsuFontValid = false; -#if wxOSX_USE_CARBON - m_qdFontStyle = 0; - m_qdFontFamily = 0; -#endif #endif m_pointSize = 0; m_family = wxFONTFAMILY_DEFAULT; m_style = wxFONTSTYLE_NORMAL; m_weight = wxFONTWEIGHT_NORMAL; m_underlined = false; + m_strikethrough = false; m_faceName.clear(); m_encoding = wxFont::GetDefaultEncoding(); m_descriptorValid = false; @@ -1002,6 +1006,8 @@ void wxNativeFontInfo::Init(CTFontDescriptorRef descr) wxCFStringRef familyName( (CFStringRef) CTFontDescriptorCopyAttribute(descr, kCTFontFamilyNameAttribute)); m_faceName = familyName.AsString(); + + UpdateNamesMap(m_faceName, descr); } void wxNativeFontInfo::EnsureValid() @@ -1012,11 +1018,9 @@ void wxNativeFontInfo::EnsureValid() #if wxOSX_USE_ATSU_TEXT if ( !m_atsuFontValid ) { -#if !wxOSX_USE_CARBON // not needed outside wxInt16 m_qdFontFamily; wxInt16 m_qdFontStyle; -#endif wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() ); ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault ); if ( atsfamily == (ATSFontFamilyRef) -1 ) @@ -1061,16 +1065,13 @@ void wxNativeFontInfo::Init(const wxNativeFontInfo& info) m_atsuFontValid = info.m_atsuFontValid; m_atsuFontID = info.m_atsuFontID ; m_atsuAdditionalQDStyles = info.m_atsuAdditionalQDStyles; -#if wxOSX_USE_CARBON - m_qdFontFamily = info.m_qdFontFamily; - m_qdFontStyle = info.m_qdFontStyle; -#endif #endif m_pointSize = info.m_pointSize; m_family = info.m_family; m_style = info.m_style; m_weight = info.m_weight; m_underlined = info.m_underlined; + m_strikethrough = info.m_strikethrough; m_faceName = info.m_faceName; m_encoding = info.m_encoding; m_descriptorValid = info.m_descriptorValid; @@ -1081,6 +1082,7 @@ void wxNativeFontInfo::Init(int size, wxFontStyle style, wxFontWeight weight, bool underlined, + bool strikethrough, const wxString& faceName, wxFontEncoding encoding) { @@ -1099,6 +1101,7 @@ void wxNativeFontInfo::Init(int size, m_style = style; m_weight = weight; m_underlined = underlined; + m_strikethrough = strikethrough; m_faceName = faceName; if ( encoding == wxFONTENCODING_DEFAULT ) encoding = wxFont::GetDefaultEncoding(); @@ -1118,11 +1121,14 @@ void wxNativeFontInfo::Free() bool wxNativeFontInfo::FromString(const wxString& s) { - long l; + long l, version; wxStringTokenizer tokenizer(s, wxT(";")); wxString token = tokenizer.GetNextToken(); + if ( !token.ToLong(&l) ) + return false; + version = l; // // Ignore the version for now // @@ -1152,6 +1158,18 @@ bool wxNativeFontInfo::FromString(const wxString& s) return false; m_underlined = l != 0; + if ( version == 0L ) + { + m_strikethrough = false; + } + else + { + token = tokenizer.GetNextToken(); + if ( !token.ToLong(&l) ) + return false; + m_strikethrough = l != 0; + } + m_faceName = tokenizer.GetNextToken(); #ifndef __WXMAC__ @@ -1171,13 +1189,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 m_pointSize, m_family, (int)m_style, (int)m_weight, m_underlined, + m_strikethrough, m_faceName.GetData(), (int)m_encoding); @@ -1221,7 +1240,7 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const bool wxNativeFontInfo::GetStrikethrough() const { - return false; + return m_strikethrough; } @@ -1290,8 +1309,26 @@ void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding_) // not reflected in native descriptors } -void wxNativeFontInfo::SetStrikethrough(bool WXUNUSED(strikethrough)) +void wxNativeFontInfo::SetStrikethrough(bool strikethrough) { + m_strikethrough = strikethrough; } +void wxNativeFontInfo::UpdateNamesMap(const wxString& familyName, CTFontDescriptorRef descr) +{ + if ( gs_FontFamilyToPSName.find(familyName) == gs_FontFamilyToPSName.end() ) + { + wxCFStringRef psName( (CFStringRef) CTFontDescriptorCopyAttribute(descr, kCTFontNameAttribute)); + gs_FontFamilyToPSName[familyName] = psName.AsString(); + } +} + +void wxNativeFontInfo::UpdateNamesMap(const wxString& familyName, CTFontRef font) +{ + if ( gs_FontFamilyToPSName.find(familyName) == gs_FontFamilyToPSName.end() ) + { + wxCFRef descr(CTFontCopyFontDescriptor( font )); + UpdateNamesMap(familyName, descr); + } +} diff --git a/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp index b2a4013620..0ed0a2651d 100644 --- a/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp @@ -45,7 +45,7 @@ #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); #include "wx/osx/private.h" @@ -53,149 +53,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) // wxFontDialog // --------------------------------------------------------------------------- -#if wxOSX_USE_CARBON - -static const EventTypeSpec eventList[] = -{ - { kEventClassFont, kEventFontSelection } , -} ; - - -pascal OSStatus -wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler), - EventRef event, - void *userData) -{ - OSStatus result = eventNotHandledErr ; - wxFontDialog *fontdialog = (wxFontDialog*) userData ; - wxFontData& fontdata= fontdialog->GetFontData() ; - - wxMacCarbonEvent cEvent( event ); - switch(cEvent.GetKind()) - { - case kEventFontSelection : - { - bool setup = false ; - if ( !setup ) - { - CTFontDescriptorRef descr; - if ( cEvent.GetParameter( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr ) - { - wxFont font; - wxNativeFontInfo fontinfo; - fontinfo.Init(descr); - font.Create(fontinfo); - fontdata.SetChosenFont( font ) ; - setup = true; - } - } -#if wxOSX_USE_ATSU_TEXT - ATSUFontID fontId = 0 ; - if ( !setup && (cEvent.GetParameter(kEventParamATSUFontID, &fontId) == noErr) ) - { - FMFontStyle fontStyle = cEvent.GetParameter(kEventParamFMFontStyle); - FMFontSize fontSize = cEvent.GetParameter(kEventParamFMFontSize); - - CFStringRef cfName = NULL; -#if 1 - FMFontFamily fontFamily = cEvent.GetParameter(kEventParamFMFontFamily); - ATSFontFamilyRef atsfontfamilyref = FMGetATSFontFamilyRefFromFontFamily( fontFamily ) ; - OSStatus err = ATSFontFamilyGetName( atsfontfamilyref , kATSOptionFlagsDefault , &cfName ) ; - if ( err != noErr ) - { - wxFAIL_MSG("ATSFontFamilyGetName failed"); - } -#else - // we don't use the ATSU naming anymore - ByteCount actualLength = 0; - char *c = NULL; - OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode, - kFontNoLanguageCode , 0 , NULL , &actualLength , NULL ); - if ( err == noErr) - { - actualLength += 1 ; - char *c = (char*)malloc( actualLength ); - err = ATSUFindFontName(fontId, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode, - kFontNoLanguageCode, actualLength, c , NULL, NULL); - cfName = CFStringCreateWithCharacters(NULL, (UniChar*) c, (actualLength-1) >> 1); - } - else - { - err = ATSUFindFontName(fontId , kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode, - kFontNoLanguageCode , 0 , NULL , &actualLength , NULL ); - if ( err == noErr ) - { - actualLength += 1 ; - c = (char*)malloc(actualLength); - err = ATSUFindFontName(fontId, kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode, - kFontNoLanguageCode, actualLength, c , NULL, NULL); - c[actualLength-1] = 0; - cfName = CFStringCreateWithCString(NULL, c, kCFStringEncodingMacRoman ); - } - } - if ( c!=NULL ) - free(c); -#endif - if ( cfName!=NULL ) - { - fontdata.m_chosenFont.SetFaceName(wxCFStringRef(cfName).AsString(wxLocale::GetSystemEncoding())); - fontdata.m_chosenFont.SetPointSize(fontSize); - fontdata.m_chosenFont.SetStyle(fontStyle & italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL); - fontdata.m_chosenFont.SetUnderlined((fontStyle & underline)!=0); - fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); - } - } -#endif // wxOSX_USE_ATSU_TEXT - - // retrieving the color - RGBColor fontColor ; - if ( cEvent.GetParameter(kEventParamFontColor, &fontColor) == noErr ) - { - fontdata.m_fontColour = fontColor; - } - else - { - CFDictionaryRef dict ; - if ( cEvent.GetParameter(kEventParamDictionary, &dict) == noErr ) - { - CFDictionaryRef attributesDict ; - if ( CFDictionaryGetValueIfPresent(dict, kFontPanelAttributesKey, (const void **)&attributesDict) ) - { - CFDataRef tagsData; - CFDataRef sizesData; - CFDataRef valuesData; - if ( CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeTagsKey, (const void **)&tagsData) && - CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeSizesKey, (const void **)&sizesData) && - CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeValuesKey, (const void **)&valuesData) ) - { - ItemCount count = CFDataGetLength(tagsData)/sizeof(ATSUAttributeTag); - ATSUAttributeTag *tagPtr = (ATSUAttributeTag *)CFDataGetBytePtr(tagsData); - ByteCount *sizePtr = (ByteCount *)CFDataGetBytePtr(sizesData); - UInt32 *bytePtr = (UInt32*)CFDataGetBytePtr(valuesData); - ATSUAttributeValuePtr valuesPtr = bytePtr ; - for ( ItemCount i = 0 ; i < count ; ++i) - { - if ( tagPtr[i] == kATSUColorTag && sizePtr[i] == sizeof(RGBColor)) - { - fontdata.m_fontColour = *(RGBColor *)valuesPtr; - break ; - } - bytePtr = (UInt32*)( (UInt8*)bytePtr + sizePtr[i]); - } - } - } - } - } - } - break ; - } - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacCarbonFontPanelHandler ) -#endif - wxFontDialog::wxFontDialog() { } @@ -229,36 +86,9 @@ int wxFontDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); -#if wxOSX_USE_CARBON - - OSStatus err ; - wxFont font = *wxNORMAL_FONT ; - if ( m_fontData.m_initialFont.IsOk() ) - { - font = m_fontData.m_initialFont ; - } - - CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() ); - err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL); - CFRelease( descr ); - - // just clicking on ENTER will not send us any font setting event, therefore we have to make sure - // that field is already correct - m_fontData.m_chosenFont = font ; - - EventHandlerRef handler ; - - err = InstallApplicationEventHandler( GetwxMacCarbonFontPanelHandlerUPP(), GetEventTypeCount(eventList), eventList, this , &handler ); - - if ( !FPIsFontPanelVisible() ) - FPShowHideFontPanel(); -#endif wxDialog::OSXBeginModalDialog(); int retval = RunMixedFontDialog(this); wxDialog::OSXEndModalDialog(); -#if wxOSX_USE_CARBON - ::RemoveEventHandler(handler); -#endif return retval ; } @@ -279,8 +109,8 @@ int wxFontDialog::ShowModal() // wxFontDialog stub for mac OS's without a native font dialog // --------------------------------------------------------------------------- -static const wxChar *FontFamilyIntToString(int family); -static int FontFamilyStringToInt(const wxChar *family); +static const wxChar *FontFamilyIntToString(wxFontFamily family); +static wxFontFamily FontFamilyStringToInt(const wxChar *family); //----------------------------------------------------------------------------- @@ -298,12 +128,12 @@ public: private: void OnPaint(wxPaintEvent& event); - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxFontPreviewCtrl, wxWindow) +wxBEGIN_EVENT_TABLE(wxFontPreviewCtrl, wxWindow) EVT_PAINT(wxFontPreviewCtrl::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { @@ -332,7 +162,7 @@ void wxFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) class wxFontColourSwatchCtrl: public wxControl { - DECLARE_CLASS(wxFontColourSwatchCtrl) + wxDECLARE_CLASS(wxFontColourSwatchCtrl); public: wxFontColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0); virtual ~wxFontColourSwatchCtrl(); @@ -349,18 +179,18 @@ public: protected: wxColour m_colour; -DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; /* * A control for displaying a small preview of a colour or bitmap */ -BEGIN_EVENT_TABLE(wxFontColourSwatchCtrl, wxControl) +wxBEGIN_EVENT_TABLE(wxFontColourSwatchCtrl, wxControl) EVT_MOUSE_EVENTS(wxFontColourSwatchCtrl::OnMouseEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() -IMPLEMENT_CLASS(wxFontColourSwatchCtrl, wxControl) +wxIMPLEMENT_CLASS(wxFontColourSwatchCtrl, wxControl); wxFontColourSwatchCtrl::wxFontColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style): wxControl(parent, id, pos, size, style) @@ -407,13 +237,13 @@ void wxFontColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) * wxFontDialog type definition */ -IMPLEMENT_DYNAMIC_CLASS( wxFontDialog, wxDialog ) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); /*! * wxFontDialog event table definition */ -BEGIN_EVENT_TABLE( wxFontDialog, wxDialog ) +wxBEGIN_EVENT_TABLE( wxFontDialog, wxDialog ) EVT_LISTBOX( wxID_FONTDIALOG_FACENAME, wxFontDialog::OnFontdialogFacenameSelected ) EVT_SPINCTRL( wxID_FONTDIALOG_FONTSIZE, wxFontDialog::OnFontdialogFontsizeUpdated ) EVT_TEXT( wxID_FONTDIALOG_FONTSIZE, wxFontDialog::OnFontdialogFontsizeTextUpdated ) @@ -422,7 +252,7 @@ BEGIN_EVENT_TABLE( wxFontDialog, wxDialog ) EVT_CHECKBOX( wxID_FONTDIALOG_UNDERLINED, wxFontDialog::OnFontdialogUnderlinedClick ) EVT_BUTTON( wxID_OK, wxFontDialog::OnOkClick ) EVT_BUTTON(wxID_FONTDIALOG_COLOUR, wxFontDialog::OnColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() /*! * wxFontDialog constructors @@ -689,9 +519,9 @@ bool wxFontDialog::ShowToolTips() void wxFontDialog::InitializeFont() { - int fontFamily = wxSWISS; - int fontWeight = wxNORMAL; - int fontStyle = wxNORMAL; + wxFontFamily fontFamily = wxFONTFAMILY_SWISS; + wxFontWeight fontWeight = wxFONTWEIGHT_NORMAL; + wxFontStyle fontStyle = wxFONTSTYLE_NORMAL; int fontSize = 12; bool fontUnderline = false; wxString fontName; @@ -723,8 +553,8 @@ void wxFontDialog::InitializeControls() if (m_underlinedCtrl) m_underlinedCtrl->SetValue(m_dialogFont.GetUnderlined()); - m_boldCtrl->SetValue(m_dialogFont.GetWeight() == wxBOLD); - m_italicCtrl->SetValue(m_dialogFont.GetStyle() == wxITALIC); + m_boldCtrl->SetValue(m_dialogFont.GetWeight() == wxFONTWEIGHT_BOLD); + m_italicCtrl->SetValue(m_dialogFont.GetStyle() == wxFONTSTYLE_ITALIC); m_sizeCtrl->SetValue(m_dialogFont.GetPointSize()); wxString facename = m_dialogFont.GetFaceName(); @@ -755,14 +585,13 @@ void wxFontDialog::ChangeFont() int size = m_sizeCtrl->GetValue(); wxString facename = m_facenameCtrl->GetStringSelection(); - int family = FontFamilyStringToInt(facename); - if (family == -1) - family = wxDEFAULT; - else + wxFontFamily family = FontFamilyStringToInt(facename); + if (family != wxFONTFAMILY_DEFAULT) facename = wxEmptyString; - m_dialogFont = wxFont(size, family, italic ? wxITALIC : wxNORMAL, bold ? wxBOLD : wxNORMAL, - underlined, facename); + m_dialogFont = wxFontInfo(size) + .Family(family).FaceName(facename) + .Italic(italic).Bold(bold).Underlined(underlined); m_fontData.SetChosenFont(m_dialogFont); @@ -789,44 +618,44 @@ void wxFontDialog::OnPanelClose() { } -const wxChar *FontFamilyIntToString(int family) +const wxChar *FontFamilyIntToString(wxFontFamily family) { switch (family) { - case wxROMAN: + case wxFONTFAMILY_ROMAN: return _(""); - case wxDECORATIVE: + case wxFONTFAMILY_DECORATIVE: return _(""); - case wxMODERN: + case wxFONTFAMILY_MODERN: return _(""); - case wxSCRIPT: + case wxFONTFAMILY_SCRIPT: return _(""); - case wxTELETYPE: + case wxFONTFAMILY_TELETYPE: return _(""); - case wxSWISS: + case wxFONTFAMILY_SWISS: default: return _(""); } } -int FontFamilyStringToInt(const wxChar *family) +wxFontFamily FontFamilyStringToInt(const wxChar *family) { if (!family) - return wxSWISS; + return wxFONTFAMILY_SWISS; if (wxStrcmp(family, _("")) == 0) - return wxROMAN; + return wxFONTFAMILY_ROMAN; else if (wxStrcmp(family, _("")) == 0) - return wxDECORATIVE; + return wxFONTFAMILY_DECORATIVE; else if (wxStrcmp(family, _("")) == 0) - return wxMODERN; + return wxFONTFAMILY_MODERN; else if (wxStrcmp(family, _("")) == 0) - return wxSCRIPT; + return wxFONTFAMILY_SCRIPT; else if (wxStrcmp(family, _("")) == 0) - return wxTELETYPE; + return wxFONTFAMILY_TELETYPE; else if (wxStrcmp(family, _("")) == 0) - return wxSWISS; - else return -1; + return wxFONTFAMILY_SWISS; + else return wxFONTFAMILY_DEFAULT; } #endif // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX diff --git a/Externals/wxWidgets3/src/osx/carbon/fontdlgosx.mm b/Externals/wxWidgets3/src/osx/carbon/fontdlgosx.mm index 2129527f3e..d44e34a78d 100644 --- a/Externals/wxWidgets3/src/osx/carbon/fontdlgosx.mm +++ b/Externals/wxWidgets3/src/osx/carbon/fontdlgosx.mm @@ -34,9 +34,6 @@ // ============================================================================ -#include "wx/cocoa/autorelease.h" -#include "wx/cocoa/string.h" - #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG #import @@ -44,6 +41,65 @@ #include "wx/osx/private.h" + +@interface wxFontPanelDelegate : NSObject +{ + @public + bool m_isUnderline; + bool m_isStrikethrough; +} + +// Delegate methods +- (id)init; +- (void)changeAttributes:(id)sender; +- (void)changeFont:(id)sender; +@end // interface wxNSFontPanelDelegate : NSObject + + + +@implementation wxFontPanelDelegate : NSObject + +- (id)init +{ + [super init]; + m_isUnderline = false; + m_isStrikethrough = false; + return self; +} + +- (void)changeAttributes:(id)sender +{ + NSDictionary *dummyAttribs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:m_isUnderline?NSUnderlineStyleSingle:NSUnderlineStyleNone], NSUnderlineStyleAttributeName, + [NSNumber numberWithInt:m_isStrikethrough?NSUnderlineStyleSingle:NSUnderlineStyleNone], NSStrikethroughStyleAttributeName, + nil]; + NSDictionary *attribs = [sender convertAttributes:dummyAttribs]; + + m_isUnderline = m_isStrikethrough = false; + for (id key in attribs) { + NSNumber *number = static_cast([attribs objectForKey:key]); + int i = [number intValue]; + if ([key isEqual:NSUnderlineStyleAttributeName]) { + m_isUnderline = [number intValue] != NSUnderlineStyleNone; + } else if ([key isEqual:NSStrikethroughStyleAttributeName]) { + m_isStrikethrough = [number intValue] != NSUnderlineStyleNone; + } + } + + NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:m_isUnderline?NSUnderlineStyleSingle:NSUnderlineStyleNone], NSUnderlineStyleAttributeName, + [NSNumber numberWithInt:m_isStrikethrough?NSUnderlineStyleSingle:NSUnderlineStyleNone], NSStrikethroughStyleAttributeName, + nil]; + [[NSFontManager sharedFontManager] setSelectedAttributes:attributes isMultiple:false]; +} +- (void)changeFont:(id)sender +{ + NSFont *dummyFont = [NSFont userFontOfSize:12.0]; + [[NSFontPanel sharedFontPanel] setPanelFont:[sender convertFont:dummyFont] isMultiple:NO]; + [[NSFontManager sharedFontManager] setSelectedFont:[sender convertFont:dummyFont] isMultiple:false]; +} +@end + @interface wxMacFontPanelAccView : NSView { BOOL m_okPressed ; @@ -146,23 +202,20 @@ int RunMixedFontDialog(wxFontDialog* dialog) #endif int retval = wxID_CANCEL ; - wxAutoNSAutoreleasePool pool; + wxMacAutoreleasePool pool; // setting up the ok/cancel buttons NSFontPanel* fontPanel = [NSFontPanel sharedFontPanel] ; - // adjust modality for carbon environment -#if wxOSX_USE_CARBON - WindowRef carbonWindowRef = (WindowRef)[fontPanel windowRef] ; - SetWindowModality(carbonWindowRef, kWindowModalityAppModal , 0) ; - SetWindowGroup(carbonWindowRef , GetWindowGroupOfClass(kMovableModalWindowClass)); -#endif + wxFontPanelDelegate* theFPDelegate = [[wxFontPanelDelegate alloc] init]; + [fontPanel setDelegate:theFPDelegate]; + [fontPanel setFloatingPanel:NO] ; [[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:NO] ; - wxMacFontPanelAccView* accessoryView = (wxMacFontPanelAccView*) [fontPanel accessoryView] ; - if ( accessoryView == nil) + wxMacFontPanelAccView* accessoryView = nil; + if ( [fontPanel accessoryView] == nil || [[fontPanel accessoryView] class] != [wxMacFontPanelAccView class] ) { NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 ); accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox]; @@ -171,6 +224,10 @@ int RunMixedFontDialog(wxFontDialog* dialog) [fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ; } + else + { + accessoryView = (wxMacFontPanelAccView*)[fontPanel accessoryView]; + } [accessoryView resetFlags]; #if wxOSX_USE_COCOA @@ -179,16 +236,27 @@ int RunMixedFontDialog(wxFontDialog* dialog) { font = fontdata.m_initialFont ; } + theFPDelegate->m_isStrikethrough = font.GetStrikethrough(); + theFPDelegate->m_isUnderline = font.GetUnderlined(); [[NSFontPanel sharedFontPanel] setPanelFont: font.OSXGetNSFont() isMultiple:NO]; + [[NSFontManager sharedFontManager] setSelectedFont:font.OSXGetNSFont() isMultiple:false]; + + NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt:font.GetUnderlined() + ? NSUnderlineStyleSingle + : NSUnderlineStyleNone], + NSUnderlineStyleAttributeName, + [NSNumber numberWithInt:font.GetStrikethrough() + ? NSUnderlineStyleSingle + : NSUnderlineStyleNone], + NSStrikethroughStyleAttributeName, + nil]; + + [[NSFontManager sharedFontManager] setSelectedAttributes:attributes isMultiple:false]; if(fontdata.m_fontColour.IsOk()) - [[NSColorPanel sharedColorPanel] setColor: - [NSColor colorWithCalibratedRed:fontdata.m_fontColour.Red() / 255.0 - green:fontdata.m_fontColour.Green() / 255.0 - blue:fontdata.m_fontColour.Blue() / 255.0 - alpha:1.0] - ]; + [[NSColorPanel sharedColorPanel] setColor: fontdata.m_fontColour.OSXGetNSColor()]; else [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]]; #endif @@ -197,31 +265,24 @@ int RunMixedFontDialog(wxFontDialog* dialog) // if we don't reenable it, FPShowHideFontPanel does not work [[fontPanel standardWindowButton:NSWindowCloseButton] setEnabled:YES] ; -#if wxOSX_USE_CARBON - if( FPIsFontPanelVisible()) - FPShowHideFontPanel() ; -#else + // we must pick the selection before closing, otherwise a native textcontrol interferes + NSFont* theFont = [fontPanel panelConvertFont:[NSFont userFontOfSize:0]]; [fontPanel close]; -#endif if ( [accessoryView closedWithOk]) { #if wxOSX_USE_COCOA - NSFont* theFont = [fontPanel panelConvertFont:[NSFont userFontOfSize:0]]; - fontdata.m_chosenFont = wxFont( theFont ); + fontdata.m_chosenFont.SetUnderlined(theFPDelegate->m_isUnderline); + fontdata.m_chosenFont.SetStrikethrough(theFPDelegate->m_isStrikethrough); //Get the shared color panel along with the chosen color and set the chosen color - NSColor* theColor = [[[NSColorPanel sharedColorPanel] color] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; - - fontdata.m_fontColour.Set((unsigned char) ([theColor redComponent] * 255.0), - (unsigned char) ([theColor greenComponent] * 255.0), - (unsigned char) ([theColor blueComponent] * 255.0)); + fontdata.m_fontColour = wxColour([[NSColorPanel sharedColorPanel] color]); #endif retval = wxID_OK ; } [fontPanel setAccessoryView:nil]; - + [theFPDelegate release]; return retval ; } @@ -229,7 +290,7 @@ int RunMixedFontDialog(wxFontDialog* dialog) #if USE_NATIVE_FONT_DIALOG_FOR_MACOSX -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog); // Cocoa headers @@ -402,8 +463,8 @@ bool wxFontDialog::Create(wxWindow *parent) [[NSFontManager sharedFontManager] fontWithFamily: wxNSStringWithWxString(thewxfont.GetFaceName()) traits:theMask - weight:thewxfont.GetWeight() == wxBOLD ? 9 : - thewxfont.GetWeight() == wxLIGHT ? 0 : 5 + weight:thewxfont.GetWeight() == wxFONTWEIGHT_BOLD ? 9 : + thewxfont.GetWeight() == wxFONTWEIGHT_LIGHT ? 0 : 5 size: (float)(thewxfont.GetPointSize()) ]; @@ -413,16 +474,12 @@ bool wxFontDialog::Create(wxWindow *parent) //However, 10.3 doesn't seem to create the font panel //is this is done, so create it ourselves [[NSFontPanel sharedFontPanel] setPanelFont:theDefaultFont isMultiple:NO]; + [[NSFontManager sharedFontManager] setSelectedFont:theDefaultFont isMultiple:false]; } if(m_fontData.m_fontColour.IsOk()) - [[NSColorPanel sharedColorPanel] setColor: - [NSColor colorWithCalibratedRed:m_fontData.m_fontColour.Red() / 255.0 - green:m_fontData.m_fontColour.Green() / 255.0 - blue:m_fontData.m_fontColour.Blue() / 255.0 - alpha:1.0] - ]; + [[NSColorPanel sharedColorPanel] setColor: fontdata.m_fontColour.OSXGetNSColor()]; else [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]]; @@ -530,15 +587,11 @@ int wxFontDialog::ShowModal() m_fontData.m_chosenFont.SetFaceName(wxStringWithNSString([theFont familyName])); m_fontData.m_chosenFont.SetPointSize(theFontSize); m_fontData.m_chosenFont.SetStyle(theTraits & NSItalicFontMask ? wxFONTSTYLE_ITALIC : 0); - m_fontData.m_chosenFont.SetWeight(theFontWeight < 5 ? wxLIGHT : - theFontWeight >= 9 ? wxBOLD : wxNORMAL); + m_fontData.m_chosenFont.SetWeight(theFontWeight < 5 ? wxFONTWEIGHT_LIGHT : + theFontWeight >= 9 ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); //Get the shared color panel along with the chosen color and set the chosen color - NSColor* theColor = [[theColorPanel color] colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; - - m_fontData.m_fontColour.Set((unsigned char) ([theColor redComponent] * 255.0), - (unsigned char) ([theColor greenComponent] * 255.0), - (unsigned char) ([theColor blueComponent] * 255.0)); + m_fontData.m_fontColour = wxColour([theColorPanel color]); //Friendly debug stuff #ifdef FONTDLGDEBUG diff --git a/Externals/wxWidgets3/src/osx/carbon/frame.cpp b/Externals/wxWidgets3/src/osx/carbon/frame.cpp index 01c8825444..006a064142 100644 --- a/Externals/wxWidgets3/src/osx/carbon/frame.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/frame.cpp @@ -25,10 +25,10 @@ #include "wx/osx/private.h" -BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) +wxBEGIN_EVENT_TABLE(wxFrame, wxFrameBase) EVT_ACTIVATE(wxFrame::OnActivate) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #define WX_MAC_STATUSBAR_HEIGHT 18 @@ -55,13 +55,6 @@ bool wxFrame::Create(wxWindow *parent, return true; } -wxFrame::~wxFrame() -{ - SendDestroyEvent(); - - DeleteAllBars(); -} - // get the origin of the client area in the client coordinates wxPoint wxFrame::GetClientAreaOrigin() const { @@ -222,9 +215,7 @@ void wxFrame::DetachMenuBar() void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) { -#if wxOSX_USE_CARBON - wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame ); -#elif wxOSX_USE_COCOA +#if wxOSX_USE_COCOA wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( wxOSXGetMainWindow() ) , wxFrame ); #else wxFrame* tlf = wxDynamicCast( wxTheApp->GetTopWindow(), wxFrame ); @@ -356,12 +347,12 @@ void wxFrame::PositionToolBar() wxTopLevelWindow::DoGetClientSize( &cw , &ch ); - int statusX = 0 ; - int statusY = 0 ; - #if wxUSE_STATUSBAR if (GetStatusBar() && GetStatusBar()->IsShown()) { + int statusX = 0 ; + int statusY = 0 ; + GetStatusBar()->GetSize(&statusX, &statusY); ch -= statusY; } @@ -421,4 +412,17 @@ void wxFrame::PositionBars() #endif } +bool wxFrame::Show(bool show) +{ + if ( !show ) + { +#if wxUSE_MENUS + if (m_frameMenuBar != NULL) + { + m_frameMenuBar->MacUninstallMenuBar(); + } +#endif + } + return wxFrameBase::Show(show); +} diff --git a/Externals/wxWidgets3/src/osx/carbon/gauge.cpp b/Externals/wxWidgets3/src/osx/carbon/gauge.cpp deleted file mode 100644 index 33fff27924..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/gauge.cpp +++ /dev/null @@ -1,95 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/gauge.cpp -// Purpose: wxGauge class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_GAUGE - -#include "wx/gauge.h" - -#include "wx/osx/private.h" - -class wxMacGaugeCarbonControl : public wxMacControl -{ -public : - wxMacGaugeCarbonControl( wxWindowMac* peer ) : wxMacControl( peer ) - { - } - - void SetMaximum(wxInt32 v) - { - // switch back to determinate mode if not there already - if ( GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) - { - SetData( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false ); - } - - wxMacControl::SetMaximum( v ) ; - } - - void SetValue(wxInt32 v) - { - // switch back to determinate mode if not there already - if ( GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) - { - SetData( kControlNoPart, kControlProgressBarIndeterminateTag, (Boolean)false ); - } - - wxMacControl::SetValue( v ) ; - - // turn off animation in the unnecessary situations as this is consuming a lot of CPU otherwise - Boolean shouldAnimate = ( v > 0 && v < GetMaximum() ) ; - if ( GetData( kControlEntireControl, kControlProgressBarAnimatingTag ) != shouldAnimate ) - { - SetData( kControlEntireControl, kControlProgressBarAnimatingTag, shouldAnimate ) ; - if ( !shouldAnimate ) - SetNeedsDisplay(NULL) ; - } - } - - void PulseGauge() - { - if ( GetData( kControlNoPart, kControlProgressBarIndeterminateTag ) != true ) - { - SetData( kControlNoPart, kControlProgressBarIndeterminateTag, true); - } - - if ( GetData( kControlEntireControl, kControlProgressBarAnimatingTag ) != true ) - { - SetData( kControlEntireControl, kControlProgressBarAnimatingTag, true ) ; - } - } -}; - - -wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - wxInt32 value, - wxInt32 minimum, - wxInt32 maximum, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - wxMacGaugeCarbonControl* peer = new wxMacGaugeCarbonControl( wxpeer ); - OSStatus err = CreateProgressBarControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - value, minimum, maximum, false /* not indeterminate */, peer->GetControlRefAddr() ); - verify_noerr( err ); - if ( value == 0 ) - peer->SetData( kControlEntireControl, kControlProgressBarAnimatingTag, (Boolean)false ); - return peer; -} - -#endif // wxUSE_GAUGE - diff --git a/Externals/wxWidgets3/src/osx/carbon/gdiobj.cpp b/Externals/wxWidgets3/src/osx/carbon/gdiobj.cpp index 3a8b6b826f..956a96bb46 100644 --- a/Externals/wxWidgets3/src/osx/carbon/gdiobj.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/gdiobj.cpp @@ -27,17 +27,17 @@ wxFORCE_LINK_THIS_MODULE(gdiobj) class wxStockGDIMac: public wxStockGDI, public wxModule { public: - virtual const wxFont* GetFont(Item item); + virtual const wxFont* GetFont(Item item) wxOVERRIDE; - virtual bool OnInit(); - virtual void OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; private: typedef wxStockGDI super; - DECLARE_DYNAMIC_CLASS(wxStockGDIMac) + wxDECLARE_DYNAMIC_CLASS(wxStockGDIMac); }; -IMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxStockGDIMac, wxModule); bool wxStockGDIMac::OnInit() { diff --git a/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp b/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp deleted file mode 100644 index 7006d5e68f..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#if wxUSE_GLCANVAS - -#include "wx/glcanvas.h" - -#ifndef WX_PRECOMP - #include "wx/frame.h" - #include "wx/log.h" - #include "wx/settings.h" -#endif - -#include "wx/osx/uma.h" - -#include "wx/osx/private.h" -#include - -// ---------------------------------------------------------------------------- -// helper functions -// ---------------------------------------------------------------------------- - -static void wxLogAGLError(const char *func) -{ - const int err = aglGetError(); - - wxLogError(_("OpenGL function \"%s\" failed: %s (error %d)"), - func, aglErrorString(err), err); -} - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// low level implementation routines -// ---------------------------------------------------------------------------- - -WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ) -{ - WXGLContext context = aglCreateContext(pixelFormat, shareContext); - if ( !context ) - wxLogAGLError("aglCreateContext"); - return context ; -} - -void WXGLDestroyContext( WXGLContext context ) -{ - if ( context ) - { - if ( !aglDestroyContext(context) ) - { - wxLogAGLError("aglDestroyContext"); - } - } -} - -WXGLContext WXGLGetCurrentContext() -{ - return aglGetCurrentContext(); -} - -bool WXGLSetCurrentContext(WXGLContext context) -{ - if ( !aglSetCurrentContext(context) ) - { - wxLogAGLError("aglSetCurrentContext"); - return false; - } - - return true; -} - -void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ) -{ - if ( pixelFormat ) - { - aglDestroyPixelFormat(pixelFormat); - } -} - -WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) -{ - GLint data[512]; - const GLint defaultAttribs[] = - { - AGL_RGBA, - AGL_DOUBLEBUFFER, - AGL_MINIMUM_POLICY, // never choose less than requested - AGL_DEPTH_SIZE, 1, // use largest available depth buffer - AGL_RED_SIZE, 1, - AGL_GREEN_SIZE, 1, - AGL_BLUE_SIZE, 1, - AGL_ALPHA_SIZE, 0, - AGL_NONE - }; - - const GLint *attribs; - if ( !attribList ) - { - attribs = defaultAttribs; - } - else - { - unsigned p = 0; - data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX - - for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); ) - { - switch ( attribList[arg++] ) - { - case WX_GL_RGBA: - data[p++] = AGL_RGBA; - break; - - case WX_GL_BUFFER_SIZE: - data[p++] = AGL_BUFFER_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_LEVEL: - data[p++]=AGL_LEVEL; - data[p++]=attribList[arg++]; - break; - - case WX_GL_DOUBLEBUFFER: - data[p++] = AGL_DOUBLEBUFFER; - break; - - case WX_GL_STEREO: - data[p++] = AGL_STEREO; - break; - - case WX_GL_AUX_BUFFERS: - data[p++] = AGL_AUX_BUFFERS; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_RED: - data[p++] = AGL_RED_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_GREEN: - data[p++] = AGL_GREEN_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_BLUE: - data[p++] = AGL_BLUE_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ALPHA: - data[p++] = AGL_ALPHA_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_DEPTH_SIZE: - data[p++] = AGL_DEPTH_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_STENCIL_SIZE: - data[p++] = AGL_STENCIL_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_RED: - data[p++] = AGL_ACCUM_RED_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_GREEN: - data[p++] = AGL_ACCUM_GREEN_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_BLUE: - data[p++] = AGL_ACCUM_BLUE_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_ALPHA: - data[p++] = AGL_ACCUM_ALPHA_SIZE; - data[p++] = attribList[arg++]; - break; - - case WX_GL_SAMPLE_BUFFERS: - if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) - { - if ( !attribList[arg++] ) - break; - - return NULL; - } - - data[p++] = AGL_SAMPLE_BUFFERS_ARB; - if ( (data[p++] = attribList[arg++]) == true ) - { - // don't use software fallback - data[p++] = AGL_NO_RECOVERY; - } - break; - - case WX_GL_SAMPLES: - if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) - { - if ( !attribList[arg++] ) - break; - - return NULL; - } - - data[p++] = AGL_SAMPLES_ARB; - data[p++] = attribList[arg++]; - break; - } - } - - data[p] = AGL_NONE; - - attribs = data; - } - - return aglChoosePixelFormat(NULL, 0, attribs); -} - -// ---------------------------------------------------------------------------- -// wxGLContext -// ---------------------------------------------------------------------------- - -bool wxGLContext::SetCurrent(const wxGLCanvas& win) const -{ - if ( !m_glContext ) - return false; - - GLint bufnummer = win.GetAglBufferName(); - aglSetInteger(m_glContext, AGL_BUFFER_NAME, &bufnummer); - //win.SetLastContext(m_glContext); - - const_cast(win).SetViewport(); - - aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef()); - - return WXGLSetCurrentContext(m_glContext); -} - -// ---------------------------------------------------------------------------- -// wxGLCanvas -// ---------------------------------------------------------------------------- - -/* - -sharing contexts under AGL is not straightforward, to quote from - -http://lists.apple.com/archives/mac-opengl/2003/Jan/msg00402.html : - -In Carbon OpenGL (AGL) you would use call aglSetInteger to setup a -buffer name and attached each context to that same name. From AGL -you can do: - -GLint id = 1; - -ctx1 = aglCreateContext... -aglSetInteger(ctx1, AGL_BUFFER_NAME, &id); // create name -aglAttachDrawable (ctx1,...); // create surface with associated with -name (first time) -ctx2 = aglCreateContext... -aglSetInteger(ctx2, AGL_BUFFER_NAME, &id); // uses previously created name -aglAttachDrawable (ctx2, ...); // uses existing surface with existing name - -AGL Docs say: -AGL_BUFFER_NAME -params contains one value: a non-negative integer name of the surface to be -associated to be with the current context. If this value is non-zero, and a -surface of this name is not associated to this drawable, a new surface with -this name is created and associated with the context when -aglSetDrawable is called subsequently. If this is a previously allocated -buffer name within the namespace of the current window (e.g., drawable), -that previously allocated surface is associated with the context (e.g., no -new surface is created) and the subsequent call to aglSetDrawable will -attach that surface. This allows multiple contexts to be attached to a single -surface. Using the default buffer name zero, returns to one surface per -context behaviour. -*/ - -/* -so what I'm doing is to have a dummy aglContext attached to a wxGLCanvas, -assign it a buffer number -*/ - - -bool wxGLCanvas::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name, - const int *attribList, - const wxPalette& WXUNUSED(palette)) -{ - m_needsUpdate = false; - m_macCanvasIsShown = false; - - m_glFormat = WXGLChoosePixelFormat(attribList); - if ( !m_glFormat ) - return false; - - if ( !wxWindow::Create(parent, id, pos, size, style, name) ) - return false; - - m_dummyContext = WXGLCreateContext(m_glFormat, NULL); - - static GLint gCurrentBufferName = 1; - m_bufferName = gCurrentBufferName++; - aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName); - - aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef()); - - m_macCanvasIsShown = true; - - return true; -} - -wxGLCanvas::~wxGLCanvas() -{ - if ( m_glFormat ) - WXGLDestroyPixelFormat(m_glFormat); - - if ( m_dummyContext ) - WXGLDestroyContext(m_dummyContext); -} - -bool wxGLCanvas::SwapBuffers() -{ - WXGLContext context = WXGLGetCurrentContext(); - wxCHECK_MSG(context, false, wxT("should have current context")); - - aglSwapBuffers(context); - return true; -} - -void wxGLCanvas::SetViewport() -{ - if ( !m_needsUpdate ) - return; - - m_needsUpdate = false; - -// AGLContext context = aglGetCurrentContext(); -// if ( !context ) -// return; - - // viewport is initially set to entire port, adjust it to just this window - int x = 0, - y = 0; - MacClientToRootWindow(&x , &y); - - int width, height; - GetClientSize(&width, &height); - - Rect bounds; - GetWindowPortBounds(MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds); - - GLint parms[4]; - parms[0] = x; - parms[1] = bounds.bottom - bounds.top - ( y + height ); - parms[2] = width; - parms[3] = height; - - // move the buffer rect out of sight if we're hidden - if ( !m_macCanvasIsShown ) - parms[0] += 20000; - - if ( !aglSetInteger(m_dummyContext, AGL_BUFFER_RECT, parms) ) - wxLogAGLError("aglSetInteger(AGL_BUFFER_RECT)"); - - if ( !aglEnable(m_dummyContext, AGL_BUFFER_RECT) ) - wxLogAGLError("aglEnable(AGL_BUFFER_RECT)"); - - if ( !aglUpdateContext(m_dummyContext) ) - wxLogAGLError("aglUpdateContext"); -} - -void wxGLCanvas::OnSize(wxSizeEvent& event) -{ - MacUpdateView(); - event.Skip(); -} - -void wxGLCanvas::MacUpdateView() -{ - m_needsUpdate = true; - Refresh(false); -} - -void wxGLCanvas::MacSuperChangedPosition() -{ - MacUpdateView(); - SetViewport(); - wxWindow::MacSuperChangedPosition(); -} - -void wxGLCanvas::MacTopLevelWindowChangedPosition() -{ - MacUpdateView(); - wxWindow::MacTopLevelWindowChangedPosition(); -} - -void wxGLCanvas::MacVisibilityChanged() -{ - if ( IsShownOnScreen() != m_macCanvasIsShown ) - { - m_macCanvasIsShown = !m_macCanvasIsShown; - MacUpdateView(); - } - - wxWindowMac::MacVisibilityChanged(); -} - -#endif // wxUSE_GLCANVAS diff --git a/Externals/wxWidgets3/src/osx/carbon/graphics.cpp b/Externals/wxWidgets3/src/osx/carbon/graphics.cpp index 0fb0c50e22..26830bf3dc 100644 --- a/Externals/wxWidgets3/src/osx/carbon/graphics.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/graphics.cpp @@ -46,28 +46,6 @@ #include "wx/cocoa/dcclient.h" #endif -#ifdef __WXCOCOA__ - -CGColorSpaceRef wxMacGetGenericRGBColorSpace() -{ - static wxCFRef genericRGBColorSpace; - - if (genericRGBColorSpace == NULL) - { - genericRGBColorSpace.reset( CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ) ); - } - - return genericRGBColorSpace; -} - -int UMAGetSystemVersion() -{ - return 0x1050; -} - - -#endif - #if wxOSX_USE_COCOA_OR_IPHONE extern CGContextRef wxOSXGetContextFromCurrentContext() ; #if wxOSX_USE_COCOA @@ -108,8 +86,6 @@ extern "C" const double M_PI = 3.14159265358979; #endif -static const double RAD2DEG = 180.0 / M_PI; - // // Pen, Brushes and Fonts // @@ -122,9 +98,6 @@ OSStatus wxMacDrawCGImage( const CGRect * inBounds, CGImageRef inImage) { -#if wxOSX_USE_CARBON - return HIViewDrawCGImage( inContext, inBounds, inImage ); -#else CGContextSaveGState(inContext); CGContextTranslateCTM(inContext, inBounds->origin.x, inBounds->origin.y + inBounds->size.height); CGRect r = *inBounds; @@ -133,7 +106,6 @@ OSStatus wxMacDrawCGImage( CGContextDrawImage(inContext, r, inImage ); CGContextRestoreGState(inContext); return noErr; -#endif } CGColorRef wxMacCreateCGColor( const wxColour& col ) @@ -212,7 +184,7 @@ public : Init( image , transform ); } - virtual void Render( CGContextRef ctxRef ) + virtual void Render( CGContextRef ctxRef ) wxOVERRIDE { if (m_image != NULL) wxMacDrawCGImage( ctxRef, &m_imageBounds, m_image ); @@ -260,7 +232,7 @@ public : CGContextStrokeLineSegments( ctxRef , pts , count ); } - virtual void Render( CGContextRef ctxRef ) + virtual void Render( CGContextRef ctxRef ) wxOVERRIDE { switch ( m_hatch ) { @@ -599,7 +571,7 @@ wxMacCoreGraphicsColour::wxMacCoreGraphicsColour() wxMacCoreGraphicsColour::wxMacCoreGraphicsColour( const wxBrush &brush ) { Init(); - if ( brush.GetStyle() == wxSOLID ) + if ( brush.GetStyle() == wxBRUSHSTYLE_SOLID ) { m_color.reset( wxMacCreateCGColor( brush.GetColour() )); } @@ -858,12 +830,15 @@ public: wxColour GetColour() const { return m_colour ; } bool GetUnderlined() const { return m_underlined ; } + bool GetStrikethrough() const { return m_strikethrough; } + #if wxOSX_USE_IPHONE UIFont* GetUIFont() const { return m_uiFont; } #endif private : wxColour m_colour; - bool m_underlined; + bool m_underlined, + m_strikethrough; #if wxOSX_USE_ATSU_TEXT ATSUStyle m_macATSUIStyle; #endif @@ -877,6 +852,7 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere { m_colour = col; m_underlined = font.GetUnderlined(); + m_strikethrough = font.GetStrikethrough(); m_ctFont.reset( wxMacCreateCTFont( font ) ); #if wxOSX_USE_IPHONE @@ -941,7 +917,7 @@ public: ~wxMacCoreGraphicsBitmapData(); virtual CGImageRef GetBitmap() { return m_bitmap; } - virtual void* GetNativeBitmap() const { return m_bitmap; } + virtual void* GetNativeBitmap() const wxOVERRIDE { return m_bitmap; } bool IsMonochrome() { return m_monochrome; } #if wxUSE_IMAGE @@ -982,53 +958,53 @@ public : virtual ~wxMacCoreGraphicsMatrixData() ; - virtual wxGraphicsObjectRefData *Clone() const ; + virtual wxGraphicsObjectRefData *Clone() const wxOVERRIDE ; // concatenates the matrix - virtual void Concat( const wxGraphicsMatrixData *t ); + virtual void Concat( const wxGraphicsMatrixData *t ) wxOVERRIDE; // sets the matrix to the respective values virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); + wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE; // gets the component valuess of the matrix virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, - wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const; + wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const wxOVERRIDE; // makes this the inverse matrix - virtual void Invert(); + virtual void Invert() wxOVERRIDE; // returns true if the elements of the transformation matrix are equal ? - virtual bool IsEqual( const wxGraphicsMatrixData* t) const ; + virtual bool IsEqual( const wxGraphicsMatrixData* t) const wxOVERRIDE ; // return true if this is the identity matrix - virtual bool IsIdentity() const; + virtual bool IsIdentity() const wxOVERRIDE; // // transformation // // add the translation to this matrix - virtual void Translate( wxDouble dx , wxDouble dy ); + virtual void Translate( wxDouble dx , wxDouble dy ) wxOVERRIDE; // add the scale to this matrix - virtual void Scale( wxDouble xScale , wxDouble yScale ); + virtual void Scale( wxDouble xScale , wxDouble yScale ) wxOVERRIDE; // add the rotation to this matrix (radians) - virtual void Rotate( wxDouble angle ); + virtual void Rotate( wxDouble angle ) wxOVERRIDE; // // apply the transforms // // applies that matrix to the point - virtual void TransformPoint( wxDouble *x, wxDouble *y ) const; + virtual void TransformPoint( wxDouble *x, wxDouble *y ) const wxOVERRIDE; // applies the matrix except for translations - virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const; + virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const wxOVERRIDE; // returns the native representation - virtual void * GetNativeMatrix() const; + virtual void * GetNativeMatrix() const wxOVERRIDE; private : CGAffineTransform m_matrix; @@ -1161,25 +1137,25 @@ public : ~wxMacCoreGraphicsPathData(); - virtual wxGraphicsObjectRefData *Clone() const; + virtual wxGraphicsObjectRefData *Clone() const wxOVERRIDE; // begins a new subpath at (x,y) - virtual void MoveToPoint( wxDouble x, wxDouble y ); + virtual void MoveToPoint( wxDouble x, wxDouble y ) wxOVERRIDE; // adds a straight line from the current point to (x,y) - virtual void AddLineToPoint( wxDouble x, wxDouble y ); + virtual void AddLineToPoint( wxDouble x, wxDouble y ) wxOVERRIDE; // adds a cubic Bezier curve from the current point, using two control points and an end point - virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ); + virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) wxOVERRIDE; // closes the current sub-path - virtual void CloseSubpath(); + virtual void CloseSubpath() wxOVERRIDE; // gets the last point of the current path, (0,0) if not yet set - virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const; + virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const wxOVERRIDE; // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle - virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ); + virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) wxOVERRIDE; // // These are convenience functions which - if not available natively will be assembled @@ -1187,36 +1163,36 @@ public : // // adds a quadratic Bezier curve from the current point, using a control point and an end point - virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ); + virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ) wxOVERRIDE; // appends a rectangle as a new closed subpath - virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; // appends a circle as a new closed subpath - virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ); + virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r ) wxOVERRIDE; // appends an ellipsis as a new closed subpath fitting the passed rectangle - virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h); + virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxOVERRIDE; // draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1) - virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ); + virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) wxOVERRIDE; // adds another path - virtual void AddPath( const wxGraphicsPathData* path ); + virtual void AddPath( const wxGraphicsPathData* path ) wxOVERRIDE; // returns the native path - virtual void * GetNativePath() const { return m_path; } + virtual void * GetNativePath() const wxOVERRIDE { return m_path; } // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - virtual void UnGetNativePath(void *WXUNUSED(p)) const {} + virtual void UnGetNativePath(void *WXUNUSED(p)) const wxOVERRIDE {} // transforms each point of this path by the matrix - virtual void Transform( const wxGraphicsMatrixData* matrix ); + virtual void Transform( const wxGraphicsMatrixData* matrix ) wxOVERRIDE; // gets the bounding box enclosing all points (possibly including control points) - virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const; + virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const wxOVERRIDE; - virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const; + virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const wxOVERRIDE; private : CGMutablePathRef m_path; }; @@ -1350,10 +1326,6 @@ class WXDLLEXPORT wxMacCoreGraphicsContext : public wxGraphicsContext public: wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0 ); -#if wxOSX_USE_CARBON - wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ); -#endif - wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer); @@ -1362,74 +1334,74 @@ public: void Init(); - virtual void StartPage( wxDouble width, wxDouble height ); + virtual void StartPage( wxDouble width, wxDouble height ) wxOVERRIDE; - virtual void EndPage(); + virtual void EndPage() wxOVERRIDE; - virtual void Flush(); + virtual void Flush() wxOVERRIDE; // push the current state of the context, ie the transformation matrix on a stack - virtual void PushState(); + virtual void PushState() wxOVERRIDE; // pops a stored state from the stack - virtual void PopState(); + virtual void PopState() wxOVERRIDE; // clips drawings to the region - virtual void Clip( const wxRegion ®ion ); + virtual void Clip( const wxRegion ®ion ) wxOVERRIDE; // clips drawings to the rect - virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; // resets the clipping to original extent - virtual void ResetClip(); + virtual void ResetClip() wxOVERRIDE; - virtual void * GetNativeContext(); + virtual void * GetNativeContext() wxOVERRIDE; - virtual bool SetAntialiasMode(wxAntialiasMode antialias); + virtual bool SetAntialiasMode(wxAntialiasMode antialias) wxOVERRIDE; - virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation); + virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) wxOVERRIDE; - virtual bool SetCompositionMode(wxCompositionMode op); + virtual bool SetCompositionMode(wxCompositionMode op) wxOVERRIDE; - virtual void BeginLayer(wxDouble opacity); + virtual void BeginLayer(wxDouble opacity) wxOVERRIDE; - virtual void EndLayer(); + virtual void EndLayer() wxOVERRIDE; // // transformation // // translate - virtual void Translate( wxDouble dx , wxDouble dy ); + virtual void Translate( wxDouble dx , wxDouble dy ) wxOVERRIDE; // scale - virtual void Scale( wxDouble xScale , wxDouble yScale ); + virtual void Scale( wxDouble xScale , wxDouble yScale ) wxOVERRIDE; // rotate (radians) - virtual void Rotate( wxDouble angle ); + virtual void Rotate( wxDouble angle ) wxOVERRIDE; // concatenates this transform with the current transform of this context - virtual void ConcatTransform( const wxGraphicsMatrix& matrix ); + virtual void ConcatTransform( const wxGraphicsMatrix& matrix ) wxOVERRIDE; // sets the transform of this context - virtual void SetTransform( const wxGraphicsMatrix& matrix ); + virtual void SetTransform( const wxGraphicsMatrix& matrix ) wxOVERRIDE; // gets the matrix of this context - virtual wxGraphicsMatrix GetTransform() const; + virtual wxGraphicsMatrix GetTransform() const wxOVERRIDE; // // setting the paint // // strokes along a path with the current pen - virtual void StrokePath( const wxGraphicsPath &path ); + virtual void StrokePath( const wxGraphicsPath &path ) wxOVERRIDE; // fills a path with the current brush - virtual void FillPath( const wxGraphicsPath &path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + virtual void FillPath( const wxGraphicsPath &path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) wxOVERRIDE; // draws a path by first filling and then stroking - virtual void DrawPath( const wxGraphicsPath &path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); + virtual void DrawPath( const wxGraphicsPath &path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ) wxOVERRIDE; - virtual bool ShouldOffset() const + virtual bool ShouldOffset() const wxOVERRIDE { if ( !m_enableOffset ) return false; @@ -1448,24 +1420,24 @@ public: // virtual void GetTextExtent( const wxString &text, wxDouble *width, wxDouble *height, - wxDouble *descent, wxDouble *externalLeading ) const; + wxDouble *descent, wxDouble *externalLeading ) const wxOVERRIDE; - virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const; + virtual void GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const wxOVERRIDE; // // image support // - virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; - virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; - virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; // fast convenience methods - virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ); + virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE; void SetNativeContext( CGContextRef cg ); @@ -1475,15 +1447,11 @@ private: bool EnsureIsValid(); void CheckInvariants() const; - virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ); - virtual void DoDrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ); + virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ) wxOVERRIDE; + virtual void DoDrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) wxOVERRIDE; CGContextRef m_cgContext; -#if wxOSX_USE_CARBON - WindowRef m_windowRef; -#else WXWidget m_view; -#endif bool m_contextSynthesized; CGAffineTransform m_windowTransform; bool m_invisible; @@ -1544,9 +1512,6 @@ void wxMacCoreGraphicsContext::Init() m_contextSynthesized = false; m_width = 0; m_height = 0; -#if wxOSX_USE_CARBON - m_windowRef = NULL; -#endif #if wxOSX_USE_COCOA_OR_IPHONE m_view = NULL; #endif @@ -1563,20 +1528,11 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer m_height = height; } -#if wxOSX_USE_CARBON -wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer) -{ - Init(); - m_windowRef = window; - m_enableOffset = true; -} -#endif - wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer) { Init(); - m_enableOffset = true; + m_enableOffset = window->GetContentScaleFactor() <= 1; wxSize sz = window->GetSize(); m_width = sz.x; m_height = sz.y; @@ -1675,13 +1631,6 @@ bool wxMacCoreGraphicsContext::EnsureIsValid() { m_invisible = true; } -#endif -#if wxOSX_USE_CARBON - OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext ); - if ( status != noErr ) - { - wxFAIL_MSG("Cannot nest wxDCs on the same window"); - } #endif if ( m_cgContext ) { @@ -1781,11 +1730,7 @@ bool wxMacCoreGraphicsContext::SetInterpolationQuality(wxInterpolationQuality in quality = kCGInterpolationLow; break; case wxINTERPOLATION_GOOD: -#if wxOSX_USE_COCOA_OR_CARBON - quality = UMAGetSystemVersion() < 0x1060 ? kCGInterpolationHigh : (CGInterpolationQuality) 4 /*kCGInterpolationMedium only on 10.6*/; -#else quality = kCGInterpolationMedium; -#endif break; case wxINTERPOLATION_BEST: quality = kCGInterpolationHigh; @@ -2138,9 +2083,6 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg ) CGContextRestoreGState( m_cgContext ); if ( m_contextSynthesized ) { -#if wxOSX_USE_CARBON - QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext); -#endif #if wxOSX_USE_COCOA wxOSXUnlockFocus(m_view); #endif @@ -2250,15 +2192,15 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl if (m_composition == wxCOMPOSITION_DEST) return; - CGContextSaveGState( m_cgContext ); - CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) ); - CGContextScaleCTM( m_cgContext, 1, -1 ); -#if wxOSX_USE_COCOA_OR_CARBON - CGRect r = CGRectMake( (CGFloat) 0.0 , (CGFloat) 0.0 , (CGFloat) w , (CGFloat) h ); - PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone , - NULL , kPlotIconRefNormalFlags , icon.GetHICON() ); +#if wxOSX_USE_COCOA + { + CGRect r = CGRectMake( (CGFloat) x , (CGFloat) y , (CGFloat) w , (CGFloat) h ); + const WX_NSImage nsImage = icon.GetNSImage(); + + CGImageRef cgImage = wxOSXGetCGImageFromNSImage( nsImage , &r, m_cgContext ); + wxMacDrawCGImage( m_cgContext, &r, cgImage); + } #endif - CGContextRestoreGState( m_cgContext ); CheckInvariants(); } @@ -2330,6 +2272,16 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo CGContextSetLineWidth(m_cgContext, 1.0); CGContextStrokeLineSegments(m_cgContext, points, 2); } + if ( fref->GetStrikethrough() ) + { + CGFloat width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); + CGFloat height = CTFontGetXHeight( font ); + CGPoint points[] = { {0.0, height * 0.6f}, {width, height * 0.6f} }; + CGContextSetStrokeColorWithColor(m_cgContext, col); + CGContextSetShouldAntialias(m_cgContext, false); + CGContextSetLineWidth(m_cgContext, 1.0); + CGContextStrokeLineSegments(m_cgContext, points, 2); + } CGContextRestoreGState(m_cgContext); CGContextSetTextMatrix(m_cgContext, textMatrix); @@ -2568,78 +2520,82 @@ public : // Context - virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc); - virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); + virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) wxOVERRIDE; + virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) wxOVERRIDE; #if wxUSE_PRINTING_ARCHITECTURE - virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); + virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) wxOVERRIDE; #endif - virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); + virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) wxOVERRIDE; - virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ); + virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) wxOVERRIDE; - virtual wxGraphicsContext * CreateContext( wxWindow* window ); + virtual wxGraphicsContext * CreateContext( wxWindow* window ) wxOVERRIDE; #if wxUSE_IMAGE - virtual wxGraphicsContext * CreateContextFromImage(wxImage& image); + virtual wxGraphicsContext * CreateContextFromImage(wxImage& image) wxOVERRIDE; #endif // wxUSE_IMAGE - virtual wxGraphicsContext * CreateMeasuringContext(); + virtual wxGraphicsContext * CreateMeasuringContext() wxOVERRIDE; // Path - virtual wxGraphicsPath CreatePath(); + virtual wxGraphicsPath CreatePath() wxOVERRIDE; // Matrix virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0, - wxDouble tx=0.0, wxDouble ty=0.0); + wxDouble tx=0.0, wxDouble ty=0.0) wxOVERRIDE; - virtual wxGraphicsPen CreatePen(const wxPen& pen) ; + virtual wxGraphicsPen CreatePen(const wxPen& pen) wxOVERRIDE ; - virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ; + virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) wxOVERRIDE ; virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, - const wxGraphicsGradientStops& stops); + const wxGraphicsGradientStops& stops) wxOVERRIDE; virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxGraphicsGradientStops& stops); + const wxGraphicsGradientStops& stops) wxOVERRIDE; // sets the font - virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) ; + virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ) wxOVERRIDE ; virtual wxGraphicsFont CreateFont(double sizeInPixels, const wxString& facename, int flags = wxFONTFLAG_DEFAULT, - const wxColour& col = *wxBLACK); + const wxColour& col = *wxBLACK) wxOVERRIDE; // create a native bitmap representation - virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) ; + virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) wxOVERRIDE ; #if wxUSE_IMAGE - virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image); - virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp); + virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) wxOVERRIDE; + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) wxOVERRIDE; #endif // wxUSE_IMAGE // create a graphics bitmap from a native bitmap - virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ); + virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) wxOVERRIDE; // create a native bitmap representation - virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) ; + virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) wxOVERRIDE ; + + virtual wxString GetName() const wxOVERRIDE; + virtual void GetVersion(int *major, int *minor, int *micro) const wxOVERRIDE; + private : - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacCoreGraphicsRenderer) + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMacCoreGraphicsRenderer); } ; //----------------------------------------------------------------------------- // wxMacCoreGraphicsRenderer implementation //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMacCoreGraphicsRenderer,wxGraphicsRenderer) +wxIMPLEMENT_DYNAMIC_CLASS(wxMacCoreGraphicsRenderer,wxGraphicsRenderer); static wxMacCoreGraphicsRenderer gs_MacCoreGraphicsRenderer; @@ -2666,7 +2622,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& // this is the case for all wxWindowDCs except wxPaintDC wxMacCoreGraphicsContext *context = new wxMacCoreGraphicsContext( this, cgctx, (wxDouble) w, (wxDouble) h ); - context->EnableOffset(true); + context->EnableOffset(dc.GetContentScaleFactor() < 2); return context; } return NULL; @@ -2683,7 +2639,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC& mem_impl->GetSize( &w, &h ); wxMacCoreGraphicsContext* context = new wxMacCoreGraphicsContext( this, (CGContextRef)(mem_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h ); - context->EnableOffset(true); + context->EnableOffset(dc.GetContentScaleFactor() < 2); return context; } #endif @@ -2715,14 +2671,8 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window ) { -#if wxOSX_USE_CARBON - wxMacCoreGraphicsContext* context = new wxMacCoreGraphicsContext(this,(WindowRef)window); - context->EnableOffset(true); - return context; -#else wxUnusedVar(window); return NULL; -#endif } wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window ) @@ -2769,7 +2719,7 @@ wxGraphicsMatrix wxMacCoreGraphicsRenderer::CreateMatrix( wxDouble a, wxDouble b wxGraphicsPen wxMacCoreGraphicsRenderer::CreatePen(const wxPen& pen) { - if ( !pen.IsOk() || pen.GetStyle() == wxTRANSPARENT ) + if ( !pen.IsOk() || pen.GetStyle() == wxPENSTYLE_TRANSPARENT ) return wxNullGraphicsPen; else { @@ -2781,7 +2731,7 @@ wxGraphicsPen wxMacCoreGraphicsRenderer::CreatePen(const wxPen& pen) wxGraphicsBrush wxMacCoreGraphicsRenderer::CreateBrush(const wxBrush& brush ) { - if ( !brush.IsOk() || brush.GetStyle() == wxTRANSPARENT ) + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) return wxNullGraphicsBrush; else { @@ -2852,6 +2802,21 @@ wxGraphicsBitmap wxMacCoreGraphicsRenderer::CreateSubBitmap( const wxGraphicsBit return wxNullGraphicsBitmap; } +wxString wxMacCoreGraphicsRenderer::GetName() const +{ + return "cg"; +} + +void wxMacCoreGraphicsRenderer::GetVersion(int *major, int *minor, int *micro) const +{ + if ( major ) + *major = wxPlatformInfo::Get().GetOSMajorVersion(); + if ( minor ) + *minor = wxPlatformInfo::Get().GetOSMinorVersion(); + if ( micro ) + *micro = 0; +} + wxGraphicsBrush wxMacCoreGraphicsRenderer::CreateLinearGradientBrush(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, @@ -2910,6 +2875,9 @@ wxMacCoreGraphicsRenderer::CreateFont(double sizeInPixels, (flags & wxFONTFLAG_UNDERLINED) != 0, facename); + if ( flags & wxFONTFLAG_STRIKETHROUGH ) + font.MakeStrikethrough(); + wxGraphicsFont f; f.SetRefData(new wxMacCoreGraphicsFontData(this, font, col)); return f; @@ -2977,7 +2945,10 @@ CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffe { wxMemoryBuffer* b = new wxMemoryBuffer( buf ); if ( b->GetDataLen() == 0 ) + { + delete b; return NULL; + } return CGDataProviderCreateWithData( b , (const void *) b->GetData() , b->GetDataLen() , wxMacReleaseMemoryBufferProviderCallback ); diff --git a/Externals/wxWidgets3/src/osx/carbon/helpxxxx.cpp b/Externals/wxWidgets3/src/osx/carbon/helpxxxx.cpp deleted file mode 100644 index 9f87e6754d..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/helpxxxx.cpp +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/helpxxxx.cpp -// Purpose: Help system: native implementation -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/stubs/helpxxxx.h" - -#include - -IMPLEMENT_DYNAMIC_CLASS(wxXXXXHelpController, wxHelpControllerBase) - -wxXXXXHelpController::wxXXXXHelpController() -{ - m_helpFile = ""; -} - -wxXXXXHelpController::~wxXXXXHelpController() -{ -} - -bool wxXXXXHelpController::Initialize(const wxString& filename) -{ - m_helpFile = filename; - // TODO any other inits - return TRUE; -} - -bool wxXXXXHelpController::LoadFile(const wxString& file) -{ - m_helpFile = file; - // TODO - return TRUE; -} - -bool wxXXXXHelpController::DisplayContents() -{ - // TODO - return FALSE; -} - -bool wxXXXXHelpController::DisplaySection(int section) -{ - // TODO - return FALSE; -} - -bool wxXXXXHelpController::DisplayBlock(long block) -{ - // TODO - return FALSE; -} - -bool wxXXXXHelpController::KeywordSearch(const wxString& k, - wxHelpSearchMode WXUNUSED(mode)) -{ - if (m_helpFile == "") return FALSE; - - // TODO - return FALSE; -} - -// Can't close the help window explicitly in WinHelp -bool wxXXXXHelpController::Quit() -{ - // TODO - return FALSE; -} - -void wxXXXXHelpController::OnQuit() -{ -} - diff --git a/Externals/wxWidgets3/src/osx/carbon/icon.cpp b/Externals/wxWidgets3/src/osx/carbon/icon.cpp index 51b3e34f40..03a5f43eb2 100644 --- a/Externals/wxWidgets3/src/osx/carbon/icon.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/icon.cpp @@ -20,7 +20,7 @@ #include "wx/osx/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject); #define M_ICONDATA ((wxIconRefData *)m_refData) @@ -31,7 +31,7 @@ public: wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight ); virtual ~wxIconRefData() { Free(); } - virtual bool IsOk() const { return m_iconRef != NULL; } + virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; } virtual void Free(); @@ -42,11 +42,17 @@ public: int GetHeight() const { return m_height; } WXHICON GetHICON() const { return (WXHICON) m_iconRef; } +#if wxOSX_USE_COCOA + WX_NSImage GetNSImage() const; +#endif private: void Init(); IconRef m_iconRef; +#if wxOSX_USE_COCOA + mutable NSImage* m_nsImage; +#endif int m_width; int m_height; @@ -57,6 +63,7 @@ private: wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight ) { + Init(); m_iconRef = (IconRef)( icon ) ; // Standard sizes @@ -67,6 +74,9 @@ wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight void wxIconRefData::Init() { m_iconRef = NULL ; +#if wxOSX_USE_COCOA + m_nsImage = NULL; +#endif m_width = m_height = 0; } @@ -78,8 +88,30 @@ void wxIconRefData::Free() ReleaseIconRef( m_iconRef ) ; m_iconRef = NULL ; } + +#if wxOSX_USE_COCOA + if ( m_nsImage ) + { + CFRelease(m_nsImage); + } +#endif } +#if wxOSX_USE_COCOA +WX_NSImage wxIconRefData::GetNSImage() const +{ + wxASSERT( IsOk() ); + + if ( m_nsImage == 0 ) + { + m_nsImage = wxOSXGetNSImageFromIconRef(m_iconRef); + CFRetain(m_nsImage); + } + + return m_nsImage; +} +#endif + // // // @@ -160,6 +192,15 @@ int wxIcon::GetDepth() const return 32; } +#if wxOSX_USE_COCOA +WX_NSImage wxIcon::GetNSImage() const +{ + wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") ); + + return M_ICONDATA->GetNSImage() ; +} +#endif + void wxIcon::SetDepth( int WXUNUSED(depth) ) { } @@ -275,6 +316,14 @@ bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desire { theId = kGenericDocumentIcon ; } + else if ( resourceName == wxT( "wxICON_PRINT" ) ) + { + theId = kPrintMonitorFolderIcon; + } + else if ( resourceName == wxT( "wxICON_HELP_FOLDER" ) ) + { + theId = kHelpFolderIcon; + } if ( theId != 0 ) { @@ -456,7 +505,7 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp ) } -IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler); bool wxICONResourceHandler::LoadFile( wxBitmap *bitmap, const wxString& name, wxBitmapType WXUNUSED(flags), diff --git a/Externals/wxWidgets3/src/osx/carbon/joystick.cpp b/Externals/wxWidgets3/src/osx/carbon/joystick.cpp deleted file mode 100644 index 2faa009f42..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/joystick.cpp +++ /dev/null @@ -1 +0,0 @@ -// todo remove \ No newline at end of file diff --git a/Externals/wxWidgets3/src/osx/carbon/listbox.cpp b/Externals/wxWidgets3/src/osx/carbon/listbox.cpp deleted file mode 100644 index 8275ad0a81..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/listbox.cpp +++ /dev/null @@ -1,684 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/listbox.cpp -// Purpose: wxListBox -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_LISTBOX - -#include "wx/listbox.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/intl.h" - #include "wx/utils.h" - #include "wx/settings.h" - #include "wx/arrstr.h" - #include "wx/dcclient.h" -#endif - -#include "wx/osx/private.h" - -// ============================================================================ -// list box control implementation -// ============================================================================ - -wxWidgetImplType* wxWidgetImpl::CreateListBox( wxWindowMac* wxpeer, - wxWindowMac* WXUNUSED(parent), - wxWindowID WXUNUSED(id), - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - wxMacDataBrowserListControl* control = new wxMacDataBrowserListControl( wxpeer, pos, size, style ); - // TODO CHECK control->SetClientDataType( m_clientDataItemsType ); - return control; -} - -int wxMacDataBrowserListControl::DoListHitTest(const wxPoint& inpoint) const -{ - OSStatus err; - - // There are few reasons why this is complicated: - // 1) There is no native HitTest function for Mac - // 2) GetDataBrowserItemPartBounds only works on visible items - // 3) We can't do it through GetDataBrowserTableView[Item]RowHeight - // because what it returns is basically inaccurate in the context - // of the coordinates we want here, but we use this as a guess - // for where the first visible item lies - - wxPoint point = inpoint; - - // get column property ID (req. for call to itempartbounds) - DataBrowserTableViewColumnID colId = 0; - err = GetDataBrowserTableViewColumnProperty(GetControlRef(), 0, &colId); - wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewColumnProperty")); - - // OK, first we need to find the first visible item we have - - // this will be the "low" for our binary search. There is no real - // easy way around this, as we will need to do a SLOW linear search - // until we find a visible item, but we can do a cheap calculation - // via the row height to speed things up a bit - UInt32 scrollx, scrolly; - err = GetDataBrowserScrollPosition(GetControlRef(), &scrollx, &scrolly); - wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserScrollPosition")); - - UInt16 height; - err = GetDataBrowserTableViewRowHeight(GetControlRef(), &height); - wxCHECK_MSG(err == noErr, wxNOT_FOUND, wxT("Unexpected error from GetDataBrowserTableViewRowHeight")); - - wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox ); - - // these indices are 0-based, as usual, so we need to add 1 to them when - // passing them to data browser functions which use 1-based indices - int low = scrolly / height, - high = list->GetCount() - 1; - - // search for the first visible item (note that the scroll guess above - // is the low bounds of where the item might lie so we only use that as a - // starting point - we should reach it within 1 or 2 iterations of the loop) - while ( low <= high ) - { - Rect bounds; - err = GetDataBrowserItemPartBounds( - GetControlRef(), low + 1, colId, - kDataBrowserPropertyEnclosingPart, - &bounds); // note +1 to translate to Mac ID - if ( err == noErr ) - break; - - // errDataBrowserItemNotFound is expected as it simply means that the - // item is not currently visible -- but other errors are not - wxCHECK_MSG( err == errDataBrowserItemNotFound, wxNOT_FOUND, - wxT("Unexpected error from GetDataBrowserItemPartBounds") ); - - low++; - } - - // NOW do a binary search for where the item lies, searching low again if - // we hit an item that isn't visible - while ( low <= high ) - { - int mid = (low + high) / 2; - - Rect bounds; - err = GetDataBrowserItemPartBounds( - GetControlRef(), mid + 1, colId, - kDataBrowserPropertyEnclosingPart, - &bounds); //note +1 to trans to mac id - wxCHECK_MSG( err == noErr || err == errDataBrowserItemNotFound, - wxNOT_FOUND, - wxT("Unexpected error from GetDataBrowserItemPartBounds") ); - - if ( err == errDataBrowserItemNotFound ) - { - // item not visible, attempt to find a visible one - // search lower - high = mid - 1; - } - else // visible item, do actual hitttest - { - // if point is within the bounds, return this item (since we assume - // all x coords of items are equal we only test the x coord in - // equality) - if ((point.x >= bounds.left && point.x <= bounds.right) && - (point.y >= bounds.top && point.y <= bounds.bottom) ) - { - // found! - return mid; - } - - if ( point.y < bounds.top ) - // index(bounds) greater than key(point) - high = mid - 1; - else - // index(bounds) less than key(point) - low = mid + 1; - } - } - - return wxNOT_FOUND; -} - -// ============================================================================ -// data browser based implementation -// ============================================================================ - -wxMacListBoxItem::wxMacListBoxItem() - :wxMacDataItem() -{ -} - -wxMacListBoxItem::~wxMacListBoxItem() -{ -} - -OSStatus wxMacListBoxItem::GetSetData(wxMacDataItemBrowserControl *owner , - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - bool changeValue ) -{ - wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl); - OSStatus err = errDataBrowserPropertyNotSupported; - if ( !changeValue ) - { - if ( property >= kMinColumnId ) - { - wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property ); - unsigned int n = owner->GetLineFromItem( this ); - wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox ); - wxMacDataBrowserCellValue valueholder(itemData); - list->GetValueCallback( n , col, valueholder ); - - err = noErr; - } - else - { - if ( property == kDataBrowserItemIsEditableProperty ) - { - DataBrowserPropertyID propertyToEdit ; - GetDataBrowserItemDataProperty( itemData, &propertyToEdit ); - wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( propertyToEdit ); - - verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, col->IsEditable() )); - err = noErr; - } - - } - - } - else - { - if ( property >= kMinColumnId ) - { - wxMacDataBrowserColumn* col = lb->GetColumnFromProperty( property ); - - unsigned int n = owner->GetLineFromItem( this ); - wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox ); - wxMacDataBrowserCellValue valueholder(itemData); - list->SetValueCallback( n , col, valueholder ); - - /* - // we have to change this behind the back, since Check() would be triggering another update round - bool newVal = !m_isChecked; - verify_noerr(SetDataBrowserItemDataButtonValue( itemData, newVal ? kThemeButtonOn : kThemeButtonOff )); - m_isChecked = newVal; - err = noErr; - - wxCommandEvent event( wxEVT_CHECKLISTBOX, checklist->GetId() ); - event.SetInt( owner->GetLineFromItem( this ) ); - event.SetEventObject( checklist ); - checklist->HandleWindowEvent( event ); - - */ - err = noErr; - } - } - - // call inherited if not ours - if ( err == errDataBrowserPropertyNotSupported ) - { - err = wxMacDataItem::GetSetData(owner, property, itemData, changeValue); - } - - return err; -} - -void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner , - DataBrowserItemNotification message, - DataBrowserItemDataRef WXUNUSED(itemData) ) const -{ - wxMacDataBrowserListControl *lb = wxDynamicCast(owner,wxMacDataBrowserListControl); - - // we want to depend on as little as possible to make sure tear-down of controls is safe - - if ( message == kDataBrowserItemRemoved) - { - delete this; - return; - } - - wxListBox *list = wxDynamicCast( lb->GetWXPeer() , wxListBox ); - wxCHECK_RET( list != NULL , wxT("Listbox expected")); - - if (message == kDataBrowserItemDoubleClicked) - { - unsigned int n = owner->GetLineFromItem( this ); - list->HandleLineEvent( n, true ); - return; - } -} - -IMPLEMENT_DYNAMIC_CLASS( wxMacDataBrowserListControl , wxMacDataItemBrowserControl ) - -wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style) - : wxMacDataItemBrowserControl( peer, pos, size, style ) -{ - m_nextColumnId = 0 ; - - OSStatus err = noErr; - m_clientDataItemsType = wxClientData_None; - if ( style & wxLB_SORT ) - m_sortOrder = SortOrder_Text_Ascending; - - DataBrowserSelectionFlags options = kDataBrowserDragSelect; - if ( style & wxLB_MULTIPLE ) - { - options |= kDataBrowserAlwaysExtendSelection | kDataBrowserCmdTogglesSelection; - } - else if ( style & wxLB_EXTENDED ) - { - options |= kDataBrowserCmdTogglesSelection; - } - else - { - options |= kDataBrowserSelectOnlyOne; - } - err = SetSelectionFlags( options ); - verify_noerr( err ); - - DataBrowserListViewColumnDesc columnDesc; - columnDesc.headerBtnDesc.titleOffset = 0; - columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - - columnDesc.headerBtnDesc.btnFontStyle.flags = - kControlUseFontMask | kControlUseJustMask; - - columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent; - columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault; - columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; - columnDesc.headerBtnDesc.btnFontStyle.style = normal; - columnDesc.headerBtnDesc.titleString = NULL; -/* - columnDesc.headerBtnDesc.minimumWidth = 0; - columnDesc.headerBtnDesc.maximumWidth = 10000; - - columnDesc.propertyDesc.propertyID = kTextColumnId; - columnDesc.propertyDesc.propertyType = kDataBrowserTextType; - columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; - - verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); -*/ - columnDesc.headerBtnDesc.minimumWidth = 0; - columnDesc.headerBtnDesc.maximumWidth = 0; - columnDesc.propertyDesc.propertyID = kNumericOrderColumnId; - columnDesc.propertyDesc.propertyType = kDataBrowserPropertyRelevanceRankPart; - columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; - - verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) ); - -/* - SetDataBrowserSortProperty( m_controlRef , kTextColumnId); - if ( m_sortOrder == SortOrder_Text_Ascending ) - { - SetDataBrowserSortProperty( m_controlRef , kTextColumnId); - SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing); - } - else -*/ - { - SetDataBrowserSortProperty( m_controlRef , kNumericOrderColumnId); - SetDataBrowserSortOrder( m_controlRef , kDataBrowserOrderIncreasing); - } - - verify_noerr( AutoSizeColumns() ); - verify_noerr( SetHiliteStyle(kDataBrowserTableViewFillHilite ) ); - verify_noerr( SetHeaderButtonHeight( 0 ) ); - err = SetHasScrollBars( (style & wxHSCROLL) != 0 , true ); -#if 0 - // shouldn't be necessary anymore under 10.2 - GetPeer()->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean)false ); - GetPeer()->SetNeedsFocusRect( true ); -#endif -} - -wxMacDataBrowserListControl::~wxMacDataBrowserListControl() -{ -} - -void wxMacDataBrowserListControl::ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData) -{ - wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox ); - wxCHECK_RET( list != NULL , wxT("Listbox expected")); - - if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents())) - { - list->CalcAndSendEvent(); - return; - } - - if ((message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents())) - { - wxCommandEvent event( wxEVT_LISTBOX, list->GetId() ); - - int sel = list->GetSelection(); - if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?) - return; - list->HandleLineEvent( sel, false ); - return; - } - - // call super for item level(wxMacDataItem->Notification) callback processing - wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData); -} - - -/* -wxWindow * wxMacDataBrowserListControl::GetPeer() const -{ - return wxDynamicCast( wxMacControl::GetWX() , wxWindow ); -} -*/ - -// -// List Methods -// - -wxMacDataBrowserColumn* wxMacDataBrowserListControl::DoInsertColumn( unsigned int pos, DataBrowserPropertyID property, - const wxString& title, bool editable, - DataBrowserPropertyType colType, SInt16 just, int width ) -{ - DataBrowserListViewColumnDesc columnDesc; - columnDesc.headerBtnDesc.titleOffset = 0; - columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - - columnDesc.headerBtnDesc.btnFontStyle.flags = - kControlUseFontMask | kControlUseJustMask; - - columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; - columnDesc.headerBtnDesc.btnFontStyle.just = just; - columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; - columnDesc.headerBtnDesc.btnFontStyle.style = normal; - - // TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is - // defined for other modes? - wxFontEncoding enc; - if ( m_font.IsOk() ) - enc = m_font.GetEncoding(); - else - enc = wxLocale::GetSystemEncoding(); - wxCFStringRef cfTitle( title, enc ); - columnDesc.headerBtnDesc.titleString = cfTitle; - - columnDesc.headerBtnDesc.minimumWidth = 0; - columnDesc.headerBtnDesc.maximumWidth = 30000; - - columnDesc.propertyDesc.propertyID = property; - columnDesc.propertyDesc.propertyType = colType; - columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; - - if ( editable ) - columnDesc.propertyDesc.propertyFlags |= kDataBrowserPropertyIsMutable; - - verify_noerr( AddColumn( &columnDesc, pos ) ); - - if (width > 0) - { - wxMacDataBrowserControl::SetColumnWidth(property, width); - } - - wxMacDataBrowserColumn *col = new wxMacDataBrowserColumn( property, colType, editable ); - - m_columns.Insert( col, pos ); - - return col; -} - -wxListWidgetColumn* wxMacDataBrowserListControl::InsertTextColumn( unsigned pos, const wxString& title, bool editable, - wxAlignment just, int defaultWidth) -{ - DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++; - - SInt16 j = teFlushLeft; - if ( just & wxALIGN_RIGHT ) - j = teFlushRight; - else if ( just & wxALIGN_CENTER_HORIZONTAL ) - j = teCenter; - - return DoInsertColumn( pos, property, title, editable, kDataBrowserTextType, just, defaultWidth ); -} - -wxListWidgetColumn* wxMacDataBrowserListControl::InsertCheckColumn( unsigned pos , const wxString& title, bool editable, - wxAlignment just, int defaultWidth ) -{ - DataBrowserPropertyID property = kMinColumnId + m_nextColumnId++; - - SInt16 j = teFlushLeft; - if ( just & wxALIGN_RIGHT ) - j = teFlushRight; - else if ( just & wxALIGN_CENTER_HORIZONTAL ) - j = teCenter; - - return DoInsertColumn( pos, property, title, editable, kDataBrowserCheckboxType, just, defaultWidth ); -} - -wxMacDataBrowserColumn* wxMacDataBrowserListControl::GetColumnFromProperty( DataBrowserPropertyID property) -{ - for ( unsigned int i = 0; i < m_columns.size() ; ++ i ) - if ( m_columns[i]->GetProperty() == property ) - return m_columns[i]; - - return NULL; -} - -/* -wxMacDataItem* wxMacDataBrowserListControl::ListGetLineItem( unsigned int n ) -{ - return (wxMacDataItem*) GetItemFromLine(n); -} -*/ - -unsigned int wxMacDataBrowserListControl::ListGetCount() const -{ - return MacGetCount(); -} - -void wxMacDataBrowserListControl::ListDelete( unsigned int n ) -{ - MacDelete( n ); -} - -void wxMacDataBrowserListControl::ListInsert( unsigned int n ) -{ - MacInsert( n , new wxMacListBoxItem() ); -} - -void wxMacDataBrowserListControl::ListClear() -{ - MacClear(); -} - -void wxMacDataBrowserListControl::ListDeselectAll() -{ - wxMacDataItemBrowserSelectionSuppressor suppressor(this); - SetSelectedAllItems( kDataBrowserItemsRemove ); -} - -void wxMacDataBrowserListControl::ListSetSelection( unsigned int n, bool select, bool multi ) -{ - wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n); - wxMacDataItemBrowserSelectionSuppressor suppressor(this); - - if ( IsItemSelected( item ) != select ) - { - if ( select ) - SetSelectedItem( item, multi ? kDataBrowserItemsAdd : kDataBrowserItemsAssign ); - else - SetSelectedItem( item, kDataBrowserItemsRemove ); - } - - ListScrollTo( n ); -} - -bool wxMacDataBrowserListControl::ListIsSelected( unsigned int n ) const -{ - wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n); - return IsItemSelected( item ); -} - -int wxMacDataBrowserListControl::ListGetSelection() const -{ - wxMacDataItemPtr first, last; - GetSelectionAnchor( &first, &last ); - - if ( first != NULL ) - { - return GetLineFromItem( first ); - } - - return -1; -} - -int wxMacDataBrowserListControl::ListGetSelections( wxArrayInt& aSelections ) const -{ - aSelections.Empty(); - wxArrayMacDataItemPtr selectedItems; - GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems); - - int count = selectedItems.GetCount(); - - for ( int i = 0; i < count; ++i) - { - aSelections.Add(GetLineFromItem(selectedItems[i])); - } - - return count; -} - -void wxMacDataBrowserListControl::ListScrollTo( unsigned int n ) -{ - UInt32 top , left ; - GetScrollPosition( &top , &left ) ; - wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n ); - - // there is a bug in RevealItem that leads to situations - // in large lists, where the item does not get scrolled - // into sight, so we do a pre-scroll if necessary - UInt16 height ; - GetRowHeight( (DataBrowserItemID) item , &height ) ; - UInt32 linetop = n * ((UInt32) height ); - UInt32 linebottom = linetop + height; - Rect rect ; - GetControlBounds( m_controlRef, &rect ); - - if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) ) - SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ; - - RevealItem( item , kDataBrowserRevealWithoutSelecting ); -} - -void wxMacDataBrowserListControl::UpdateLine( unsigned int n, wxListWidgetColumn* col ) -{ - wxMacDataBrowserColumn* dbcol = dynamic_cast (col); - wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n ); - UpdateItem(wxMacDataBrowserRootContainer, item, dbcol ? dbcol->GetProperty() : kDataBrowserNoItem ); -} - -void wxMacDataBrowserListControl::UpdateLineToEnd( unsigned int n) -{ - // with databrowser inserting does not need updating the entire model, it's done by databrowser itself - wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n ); - UpdateItem(wxMacDataBrowserRootContainer, item, kDataBrowserNoItem ); -} - -// value setters - -void wxMacDataBrowserCellValue::Set( CFStringRef value ) -{ - SetDataBrowserItemDataText( m_data, value ); -} - -void wxMacDataBrowserCellValue::Set( const wxString& value ) -{ - wxCFStringRef cf(value); - SetDataBrowserItemDataText( m_data, (CFStringRef) cf); -} - -void wxMacDataBrowserCellValue::Set( int value ) -{ - SetDataBrowserItemDataValue( m_data, value ); -} - -void wxMacDataBrowserCellValue::Check( bool check ) -{ - SetDataBrowserItemDataButtonValue( m_data, check ? kThemeButtonOn : kThemeButtonOff); -} - -int wxMacDataBrowserCellValue::GetIntValue() const -{ - SInt32 value; - GetDataBrowserItemDataValue( m_data, &value ); - return value; -} - -wxString wxMacDataBrowserCellValue::GetStringValue() const -{ - CFStringRef value; - GetDataBrowserItemDataText ( m_data, &value ); - wxCFStringRef cf(value); - return cf.AsString(); -} - -#if 0 - -// in case we need that one day - -// ============================================================================ -// HIView owner-draw-based implementation -// ============================================================================ - -static pascal void ListBoxDrawProc( - ControlRef browser, DataBrowserItemID item, DataBrowserPropertyID property, - DataBrowserItemState itemState, const Rect *itemRect, SInt16 depth, Boolean isColorDevice ) -{ - CFStringRef cfString; - ThemeDrawingState themeState; - long systemVersion; - - GetThemeDrawingState( &themeState ); - cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item ); - - // In this sample we handle the "selected" state; all others fall through to our "active" state - if ( itemState == kDataBrowserItemIsSelected ) - { - ThemeBrush colorBrushID; - - // TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor - // is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor - // for inactive browser highlighting - if ( !IsControlActive( browser ) ) - colorBrushID = kThemeBrushSecondaryHighlightColor; - else - colorBrushID = kThemeBrushPrimaryHighlightColor; - - // First paint the hilite rect, then the text on top - SetThemePen( colorBrushID, 32, true ); - PaintRect( itemRect ); - SetThemeDrawingState( themeState, false ); - } - - DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL ); - SetThemeDrawingState( themeState, true ); - - if ( cfString != NULL ) - CFRelease( cfString ); -} - -#endif - - -#endif // wxUSE_LISTBOX diff --git a/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp b/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp deleted file mode 100644 index d87a96ee91..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp +++ /dev/null @@ -1,3394 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/listctrl_mac.cpp -// Purpose: wxListCtrl -// Author: Julian Smart -// Modified by: Agron Selimaj -// Created: 04/01/98 -// 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 - -#if wxUSE_LISTCTRL - -#include "wx/listctrl.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/settings.h" -#endif - -#include "wx/osx/uma.h" - -#include "wx/imaglist.h" -#include "wx/sysopt.h" -#include "wx/timer.h" - -#include "wx/hashmap.h" - -WX_DECLARE_HASH_MAP( int, wxListItem*, wxIntegerHash, wxIntegerEqual, wxListItemList ); - -#include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxColumnList) - -// so we can check for column clicks -static const EventTypeSpec eventList[] = -{ - { kEventClassControl, kEventControlHit }, - { kEventClassControl, kEventControlDraw } -}; - -static pascal OSStatus wxMacListCtrlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - ControlRef controlRef ; - cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; - - wxListCtrl *window = (wxListCtrl*) data ; - wxListEvent le( wxEVT_LIST_COL_CLICK, window->GetId() ); - le.SetEventObject( window ); - - switch ( GetEventKind( event ) ) - { - // check if the column was clicked on and fire an event if so - case kEventControlHit : - { - ControlPartCode result = cEvent.GetParameter(kEventParamControlPart, typeControlPartCode) ; - if (result == kControlButtonPart){ - DataBrowserPropertyID col; - GetDataBrowserSortProperty(controlRef, &col); - - DataBrowserTableViewColumnIndex column = 0; - verify_noerr( GetDataBrowserTableViewColumnPosition( controlRef, col, &column ) ); - - le.m_col = column; - // FIXME: we can't use the sort property for virtual listctrls - // so we need to find a better way to determine which column was clicked... - if (!window->IsVirtual()) - window->HandleWindowEvent( le ); - } - result = CallNextEventHandler(handler, event); - break; - } - case kEventControlDraw: - { - CGContextRef context = cEvent.GetParameter(kEventParamCGContextRef, typeCGContextRef) ; - window->MacSetDrawingContext(context); - result = CallNextEventHandler(handler, event); - window->MacSetDrawingContext(NULL); - break; - } - default : - break ; - } - - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacListCtrlEventHandler ) - -class wxMacListCtrlItem : public wxMacDataItem -{ -public: - wxMacListCtrlItem(); - - virtual void Notification(wxMacDataItemBrowserControl *owner , - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) const; - - virtual void SetColumnInfo( unsigned int column, wxListItem* item ); - virtual wxListItem* GetColumnInfo( unsigned int column ); - virtual bool HasColumnInfo( unsigned int column ); - - virtual void SetColumnTextValue( unsigned int column, const wxString& text ); - virtual wxString GetColumnTextValue( unsigned int column ); - - virtual int GetColumnImageValue( unsigned int column ); - virtual void SetColumnImageValue( unsigned int column, int imageIndex ); - - virtual ~wxMacListCtrlItem(); -protected: - wxListItemList m_rowItems; -}; - -DataBrowserDrawItemUPP gDataBrowserDrawItemUPP = NULL; -//DataBrowserEditItemUPP gDataBrowserEditItemUPP = NULL; -DataBrowserHitTestUPP gDataBrowserHitTestUPP = NULL; - -// TODO: Make a better name!! -class wxMacDataBrowserListCtrlControl : public wxMacDataItemBrowserControl -{ -public: - wxMacDataBrowserListCtrlControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); - wxMacDataBrowserListCtrlControl() {} - virtual ~wxMacDataBrowserListCtrlControl(); - - // create a list item (can be a subclass of wxMacListBoxItem) - - virtual void MacInsertItem( unsigned int n, wxListItem* item ); - virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item ); - virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item ); - virtual void UpdateState(wxMacDataItem* dataItem, wxListItem* item); - int GetFlags() { return m_flags; } - -protected: - // we need to override to provide specialized handling for virtual wxListCtrls - virtual OSStatus GetSetItemData(DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ); - - virtual void ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); - - virtual Boolean CompareItems(DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty); - - static pascal void DataBrowserDrawItemProc(ControlRef browser, - DataBrowserItemID item, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *theRect, - SInt16 gdDepth, - Boolean colorDevice); - - virtual void DrawItem(DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *itemRect, - SInt16 gdDepth, - Boolean colorDevice); - - static pascal Boolean DataBrowserEditTextProc(ControlRef browser, - DataBrowserItemID item, - DataBrowserPropertyID property, - CFStringRef theString, - Rect *maxEditTextRect, - Boolean *shrinkToFit); - - static pascal Boolean DataBrowserHitTestProc(ControlRef WXUNUSED(browser), - DataBrowserItemID WXUNUSED(itemID), - DataBrowserPropertyID WXUNUSED(property), - const Rect *WXUNUSED(theRect), - const Rect *WXUNUSED(mouseRect)) { return true; } - - virtual bool ConfirmEditText(DataBrowserItemID item, - DataBrowserPropertyID property, - CFStringRef theString, - Rect *maxEditTextRect, - Boolean *shrinkToFit); - - - - wxClientDataType m_clientDataItemsType; - bool m_isVirtual; - int m_flags; - DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListCtrlControl) -}; - -class wxMacListCtrlEventDelegate : public wxEvtHandler -{ -public: - wxMacListCtrlEventDelegate( wxListCtrl* list, int id ); - virtual bool ProcessEvent( wxEvent& event ); - -private: - wxListCtrl* m_list; - int m_id; -}; - -wxMacListCtrlEventDelegate::wxMacListCtrlEventDelegate( wxListCtrl* list, int id ) -{ - m_list = list; - m_id = id; -} - -bool wxMacListCtrlEventDelegate::ProcessEvent( wxEvent& event ) -{ - int id = event.GetId(); - wxObject* obj = event.GetEventObject(); - - // even though we use a generic list ctrl underneath, make sure - // we present ourselves as wxListCtrl. - event.SetEventObject( m_list ); - event.SetId( m_id ); - - if ( !event.IsKindOf( CLASSINFO( wxCommandEvent ) ) ) - { - if (m_list->GetEventHandler()->ProcessEvent( event )) - { - event.SetId(id); - event.SetEventObject(obj); - return true; - } - } - // Also try with the original id - bool success = wxEvtHandler::ProcessEvent(event); - event.SetId(id); - event.SetEventObject(obj); - if (!success && id != m_id) - success = wxEvtHandler::ProcessEvent(event); - return success; -} - -//----------------------------------------------------------------------------- -// wxListCtrlRenameTimer (internal) -//----------------------------------------------------------------------------- - -class wxListCtrlRenameTimer: public wxTimer -{ -private: - wxListCtrl *m_owner; - -public: - wxListCtrlRenameTimer( wxListCtrl *owner ); - void Notify(); -}; - -//----------------------------------------------------------------------------- -// wxListCtrlTextCtrlWrapper: wraps a wxTextCtrl to make it work for inline editing -//----------------------------------------------------------------------------- - -class wxListCtrlTextCtrlWrapper : public wxEvtHandler -{ -public: - // NB: text must be a valid object but not Create()d yet - wxListCtrlTextCtrlWrapper(wxListCtrl *owner, - wxTextCtrl *text, - long itemEdit); - - wxTextCtrl *GetText() const { return m_text; } - - void AcceptChangesAndFinish(); - -protected: - void OnChar( wxKeyEvent &event ); - void OnKeyUp( wxKeyEvent &event ); - void OnKillFocus( wxFocusEvent &event ); - - bool AcceptChanges(); - void Finish(); - -private: - wxListCtrl *m_owner; - wxTextCtrl *m_text; - wxString m_startValue; - long m_itemEdited; - bool m_finished; - bool m_aboutToFinish; - - DECLARE_EVENT_TABLE() -}; - -//----------------------------------------------------------------------------- -// wxListCtrlRenameTimer (internal) -//----------------------------------------------------------------------------- - -wxListCtrlRenameTimer::wxListCtrlRenameTimer( wxListCtrl *owner ) -{ - m_owner = owner; -} - -void wxListCtrlRenameTimer::Notify() -{ - m_owner->OnRenameTimer(); -} - -//----------------------------------------------------------------------------- -// wxListCtrlTextCtrlWrapper (internal) -//----------------------------------------------------------------------------- - -BEGIN_EVENT_TABLE(wxListCtrlTextCtrlWrapper, wxEvtHandler) - EVT_CHAR (wxListCtrlTextCtrlWrapper::OnChar) - EVT_KEY_UP (wxListCtrlTextCtrlWrapper::OnKeyUp) - EVT_KILL_FOCUS (wxListCtrlTextCtrlWrapper::OnKillFocus) -END_EVENT_TABLE() - -wxListCtrlTextCtrlWrapper::wxListCtrlTextCtrlWrapper(wxListCtrl *owner, - wxTextCtrl *text, - long itemEdit) - : m_startValue(owner->GetItemText(itemEdit)), - m_itemEdited(itemEdit) -{ - m_owner = owner; - m_text = text; - m_finished = false; - m_aboutToFinish = false; - - wxRect rectLabel; - int offset = 8; - owner->GetItemRect(itemEdit, rectLabel); - - m_text->Create(owner, wxID_ANY, m_startValue, - wxPoint(rectLabel.x+offset,rectLabel.y), - wxSize(rectLabel.width-offset,rectLabel.height)); - m_text->SetFocus(); - - m_text->PushEventHandler(this); -} - -void wxListCtrlTextCtrlWrapper::Finish() -{ - if ( !m_finished ) - { - m_finished = true; - - m_text->RemoveEventHandler(this); - m_owner->FinishEditing(m_text); - - wxPendingDelete.Append( this ); - } -} - -bool wxListCtrlTextCtrlWrapper::AcceptChanges() -{ - const wxString value = m_text->GetValue(); - - if ( value == m_startValue ) - // nothing changed, always accept - return true; - - if ( !m_owner->OnRenameAccept(m_itemEdited, value) ) - // vetoed by the user - return false; - - // accepted, do rename the item - m_owner->SetItemText(m_itemEdited, value); - - return true; -} - -void wxListCtrlTextCtrlWrapper::AcceptChangesAndFinish() -{ - m_aboutToFinish = true; - - // Notify the owner about the changes - AcceptChanges(); - - // Even if vetoed, close the control (consistent with MSW) - Finish(); -} - -void wxListCtrlTextCtrlWrapper::OnChar( wxKeyEvent &event ) -{ - switch ( event.m_keyCode ) - { - case WXK_RETURN: - AcceptChangesAndFinish(); - break; - - case WXK_ESCAPE: - m_owner->OnRenameCancelled( m_itemEdited ); - Finish(); - break; - - default: - event.Skip(); - } -} - -void wxListCtrlTextCtrlWrapper::OnKeyUp( wxKeyEvent &event ) -{ - if (m_finished) - { - event.Skip(); - return; - } - - // auto-grow the textctrl: - wxSize parentSize = m_owner->GetSize(); - wxPoint myPos = m_text->GetPosition(); - wxSize mySize = m_text->GetSize(); - int sx, sy; - m_text->GetTextExtent(m_text->GetValue() + wxT("MM"), &sx, &sy); - if (myPos.x + sx > parentSize.x) - sx = parentSize.x - myPos.x; - if (mySize.x > sx) - sx = mySize.x; - m_text->SetSize(sx, wxDefaultCoord); - - event.Skip(); -} - -void wxListCtrlTextCtrlWrapper::OnKillFocus( wxFocusEvent &event ) -{ - if ( !m_finished && !m_aboutToFinish ) - { - if ( !AcceptChanges() ) - m_owner->OnRenameCancelled( m_itemEdited ); - - Finish(); - } - - // We must let the native text control handle focus - event.Skip(); -} - -// ============================================================================ -// implementation -// ============================================================================ - -wxMacDataBrowserListCtrlControl* wxListCtrl::GetListPeer() const -{ - return dynamic_cast ( GetPeer() ); -} - -// ---------------------------------------------------------------------------- -// wxListCtrl construction -// ---------------------------------------------------------------------------- - -void wxListCtrl::Init() -{ - m_imageListNormal = NULL; - m_imageListSmall = NULL; - m_imageListState = NULL; - - // keep track of if we created our own image lists, or if they were assigned - // to us. - m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = false; - m_colCount = 0; - m_count = 0; - m_textCtrl = NULL; - m_genericImpl = NULL; - m_dbImpl = NULL; - m_compareFunc = NULL; - m_compareFuncData = 0; - m_colsInfo = wxColumnList(); - m_textColor = wxNullColour; - m_bgColor = wxNullColour; - m_textctrlWrapper = NULL; - m_current = -1; - m_renameTimer = NULL; -} - -class wxGenericListCtrlHook : public wxGenericListCtrl -{ -public: - wxGenericListCtrlHook(wxListCtrl* parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) - : wxGenericListCtrl(parent, id, pos, size, style, validator, name), - m_nativeListCtrl(parent) - { - } - -protected: - virtual wxListItemAttr * OnGetItemAttr(long item) const - { - return m_nativeListCtrl->OnGetItemAttr(item); - } - - virtual int OnGetItemImage(long item) const - { - return m_nativeListCtrl->OnGetItemImage(item); - } - - virtual int OnGetItemColumnImage(long item, long column) const - { - return m_nativeListCtrl->OnGetItemColumnImage(item, column); - } - - virtual wxString OnGetItemText(long item, long column) const - { - return m_nativeListCtrl->OnGetItemText(item, column); - } - - wxListCtrl* m_nativeListCtrl; - -}; - -void wxListCtrl::OnLeftDown(wxMouseEvent& event) -{ - if ( m_textctrlWrapper ) - { - m_current = -1; - m_textctrlWrapper->AcceptChangesAndFinish(); - } - - int hitResult; - long current = HitTest(event.GetPosition(), hitResult); - if ((current == m_current) && - (hitResult & wxLIST_HITTEST_ONITEMLABEL) && - HasFlag(wxLC_EDIT_LABELS) ) - { - if ( m_renameTimer ) - m_renameTimer->Start( 250, true ); - } - else - { - m_current = current; - } - event.Skip(); -} - -void wxListCtrl::OnDblClick(wxMouseEvent& event) -{ - if ( m_renameTimer && m_renameTimer->IsRunning() ) - m_renameTimer->Stop(); - event.Skip(); -} - -#if wxABI_VERSION >= 20801 -void wxListCtrl::OnRightDown(wxMouseEvent& event) -{ - if (m_dbImpl) - FireMouseEvent(wxEVT_LIST_ITEM_RIGHT_CLICK, event.GetPosition()); - event.Skip(); -} - -void wxListCtrl::OnMiddleDown(wxMouseEvent& event) -{ - if (m_dbImpl) - FireMouseEvent(wxEVT_LIST_ITEM_MIDDLE_CLICK, event.GetPosition()); - event.Skip(); -} - -void wxListCtrl::FireMouseEvent(wxEventType eventType, wxPoint position) -{ - wxListEvent le( eventType, GetId() ); - le.SetEventObject(this); - le.m_pointDrag = position; - le.m_itemIndex = -1; - - int flags; - long item = HitTest(position, flags); - if (flags & wxLIST_HITTEST_ONITEM) - { - le.m_itemIndex = item; - le.m_item.m_itemId = item; - GetItem(le.m_item); - HandleWindowEvent(le); - } -} - -void wxListCtrl::OnChar(wxKeyEvent& event) -{ - - - if (m_dbImpl) - { - wxListEvent le( wxEVT_LIST_KEY_DOWN, GetId() ); - le.SetEventObject(this); - le.m_code = event.GetKeyCode(); - le.m_itemIndex = -1; - - if (m_current == -1) - { - // if m_current isn't set, check if there's been a selection - // made before continuing - m_current = GetNextItem(-1, wxLIST_NEXT_BELOW, wxLIST_STATE_SELECTED); - } - - // We need to determine m_current ourselves when navigation keys - // are used. Note that PAGEUP and PAGEDOWN do not alter the current - // item on native Mac ListCtrl, so we only handle up and down keys. - switch ( event.GetKeyCode() ) - { - case WXK_UP: - if ( m_current > 0 ) - m_current -= 1; - else - m_current = 0; - - break; - - case WXK_DOWN: - if ( m_current < GetItemCount() - 1 ) - m_current += 1; - else - m_current = GetItemCount() - 1; - - break; - } - - if (m_current != -1) - { - le.m_itemIndex = m_current; - le.m_item.m_itemId = m_current; - GetItem(le.m_item); - HandleWindowEvent(le); - } - } - event.Skip(); -} -#endif - -bool wxListCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - - // for now, we'll always use the generic list control for ICON and LIST views, - // because they dynamically change the number of columns on resize. - // Also, allow the user to set it to use the list ctrl as well. - if ( (wxSystemOptions::HasOption( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL ) - && (wxSystemOptions::GetOptionInt( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL ) == 1)) || - (style & wxLC_ICON) || (style & wxLC_SMALL_ICON) || (style & wxLC_LIST) ) - { - long paneStyle = style; - paneStyle &= ~wxSIMPLE_BORDER; - paneStyle &= ~wxDOUBLE_BORDER; - paneStyle &= ~wxSUNKEN_BORDER; - paneStyle &= ~wxRAISED_BORDER; - paneStyle &= ~wxSTATIC_BORDER; - if ( !wxWindow::Create(parent, id, pos, size, paneStyle | wxNO_BORDER, name) ) - return false; - - // since the generic control is a child, make sure we position it at 0, 0 - m_genericImpl = new wxGenericListCtrlHook(this, id, wxPoint(0, 0), size, style, validator, name); - m_genericImpl->PushEventHandler( new wxMacListCtrlEventDelegate( this, GetId() ) ); - return true; - } - - else - { - DontCreatePeer(); - if ( !wxWindow::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), name) ) - return false; - m_dbImpl = new wxMacDataBrowserListCtrlControl( this, pos, size, style ); - SetPeer(m_dbImpl); - - MacPostControlCreate( pos, size ); - - InstallControlEventHandler( GetPeer()->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, this, - (EventHandlerRef *)&m_macListCtrlEventHandler); - - m_renameTimer = new wxListCtrlRenameTimer( this ); - - Connect( wxID_ANY, wxEVT_CHAR, wxCharEventHandler(wxListCtrl::OnChar), NULL, this ); - Connect( wxID_ANY, wxEVT_LEFT_DOWN, wxMouseEventHandler(wxListCtrl::OnLeftDown), NULL, this ); - Connect( wxID_ANY, wxEVT_LEFT_DCLICK, wxMouseEventHandler(wxListCtrl::OnDblClick), NULL, this ); - Connect( wxID_ANY, wxEVT_MIDDLE_DOWN, wxMouseEventHandler(wxListCtrl::OnMiddleDown), NULL, this ); - Connect( wxID_ANY, wxEVT_RIGHT_DOWN, wxMouseEventHandler(wxListCtrl::OnRightDown), NULL, this ); - } - - return true; -} - -wxListCtrl::~wxListCtrl() -{ - if (m_genericImpl) - { - m_genericImpl->PopEventHandler(/* deleteHandler = */ true); - } - - if (m_ownsImageListNormal) - delete m_imageListNormal; - if (m_ownsImageListSmall) - delete m_imageListSmall; - if (m_ownsImageListState) - delete m_imageListState; - - delete m_renameTimer; - - WX_CLEAR_LIST(wxColumnList, m_colsInfo); -} - -/*static*/ -wxVisualAttributes -wxListCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) -{ - wxVisualAttributes attr; - - attr.colFg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ); - attr.colBg = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ); - static wxFont font = wxFont(wxOSX_SYSTEM_FONT_VIEWS); - attr.font = font; - - return attr; -} - -// ---------------------------------------------------------------------------- -// set/get/change style -// ---------------------------------------------------------------------------- - -// Add or remove a single window style -void wxListCtrl::SetSingleStyle(long style, bool add) -{ - long flag = GetWindowStyleFlag(); - - // Get rid of conflicting styles - if ( add ) - { - if ( style & wxLC_MASK_TYPE) - flag = flag & ~wxLC_MASK_TYPE; - if ( style & wxLC_MASK_ALIGN ) - flag = flag & ~wxLC_MASK_ALIGN; - if ( style & wxLC_MASK_SORT ) - flag = flag & ~wxLC_MASK_SORT; - } - - if ( add ) - flag |= style; - else - flag &= ~style; - - SetWindowStyleFlag(flag); -} - -// Set the whole window style -void wxListCtrl::SetWindowStyleFlag(long flag) -{ - if ( flag != m_windowStyle ) - { - m_windowStyle = flag; - - if (m_genericImpl) - { - m_genericImpl->SetWindowStyleFlag(flag); - } - - Refresh(); - } -} - -void wxListCtrl::DoSetSize( int x, int y, int width, int height, int sizeFlags ) -{ - wxListCtrlBase::DoSetSize(x, y, width, height, sizeFlags); - - if (m_genericImpl) - m_genericImpl->SetSize(0, 0, width, height, sizeFlags); - - // determine if we need a horizontal scrollbar, and add it if so - if (m_dbImpl) - { - int totalWidth = 0; - for (int column = 0; column < GetColumnCount(); column++) - { - totalWidth += m_dbImpl->GetColumnWidth( column ); - } - - if ( !(m_dbImpl->GetFlags() & wxHSCROLL) ) - { - Boolean vertScrollBar; - GetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), NULL, &vertScrollBar ); - if (totalWidth > width) - SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), true, vertScrollBar ); - else - SetDataBrowserHasScrollBars( m_dbImpl->GetControlRef(), false, vertScrollBar ); - } - } -} - -bool wxListCtrl::SetFont(const wxFont& font) -{ - bool rv = wxListCtrlBase::SetFont(font); - if (m_genericImpl) - rv = m_genericImpl->SetFont(font); - return rv; -} - -bool wxListCtrl::SetForegroundColour(const wxColour& colour) -{ - bool rv = true; - if (m_genericImpl) - rv = m_genericImpl->SetForegroundColour(colour); - if (m_dbImpl) - SetTextColour(colour); - return rv; -} - -bool wxListCtrl::SetBackgroundColour(const wxColour& colour) -{ - bool rv = true; - if (m_genericImpl) - rv = m_genericImpl->SetBackgroundColour(colour); - if (m_dbImpl) - m_bgColor = colour; - return rv; -} - -wxColour wxListCtrl::GetBackgroundColour() const -{ - if (m_genericImpl) - return m_genericImpl->GetBackgroundColour(); - if (m_dbImpl) - return m_bgColor; - - return wxNullColour; -} - -void wxListCtrl::Freeze () -{ - if (m_genericImpl) - m_genericImpl->Freeze(); - wxListCtrlBase::Freeze(); -} - -void wxListCtrl::Thaw () -{ - if (m_genericImpl) - m_genericImpl->Thaw(); - wxListCtrlBase::Thaw(); -} - -void wxListCtrl::Update () -{ - if (m_genericImpl) - m_genericImpl->Update(); - wxListCtrlBase::Update(); -} - -// ---------------------------------------------------------------------------- -// accessors -// ---------------------------------------------------------------------------- - -// Gets information about this column -bool wxListCtrl::GetColumn(int col, wxListItem& item) const -{ - if (m_genericImpl) - return m_genericImpl->GetColumn(col, item); - - bool success = true; - - if (m_dbImpl) - { - wxColumnList::compatibility_iterator node = m_colsInfo.Item( col ); - wxASSERT_MSG( node, wxT("invalid column index in wxMacListCtrlItem") ); - wxListItem* column = node->GetData(); - - long mask = column->GetMask(); - if (mask & wxLIST_MASK_TEXT) - item.SetText(column->GetText()); - if (mask & wxLIST_MASK_DATA) - item.SetData(column->GetData()); - if (mask & wxLIST_MASK_IMAGE) - item.SetImage(column->GetImage()); - if (mask & wxLIST_MASK_STATE) - item.SetState(column->GetState()); - if (mask & wxLIST_MASK_FORMAT) - item.SetAlign(column->GetAlign()); - if (mask & wxLIST_MASK_WIDTH) - item.SetWidth(column->GetWidth()); - } - - return success; -} - -// Sets information about this column -bool wxListCtrl::SetColumn(int col, const wxListItem& item) -{ - if (m_genericImpl) - return m_genericImpl->SetColumn(col, item); - - if (m_dbImpl) - { - wxASSERT_MSG( col < (int)m_colsInfo.GetCount(), wxT("invalid column index in wxMacListCtrlItem") ); - - long mask = item.GetMask(); - { - wxListItem listItem; - GetColumn( col, listItem ); - - if (mask & wxLIST_MASK_TEXT) - listItem.SetText(item.GetText()); - if (mask & wxLIST_MASK_DATA) - listItem.SetData(item.GetData()); - if (mask & wxLIST_MASK_IMAGE) - listItem.SetImage(item.GetImage()); - if (mask & wxLIST_MASK_STATE) - listItem.SetState(item.GetState()); - if (mask & wxLIST_MASK_FORMAT) - listItem.SetAlign(item.GetAlign()); - if (mask & wxLIST_MASK_WIDTH) - listItem.SetWidth(item.GetWidth()); - } - - // change the appearance in the databrowser. - DataBrowserListViewHeaderDesc columnDesc; - columnDesc.version=kDataBrowserListViewLatestHeaderDesc; - - DataBrowserTableViewColumnID id = 0; - verify_noerr( m_dbImpl->GetColumnIDFromIndex( col, &id ) ); - verify_noerr( m_dbImpl->GetHeaderDesc( id, &columnDesc ) ); - - /* - if (item.GetMask() & wxLIST_MASK_TEXT) - { - wxFontEncoding enc; - if ( m_font.IsOk() ) - enc = GetFont().GetEncoding(); - else - enc = wxLocale::GetSystemEncoding(); - wxCFStringRef cfTitle; - cfTitle.Assign( item.GetText() , enc ); - if(columnDesc.titleString) - CFRelease(columnDesc.titleString); - columnDesc.titleString = cfTitle; - } - */ - - if (item.GetMask() & wxLIST_MASK_IMAGE && item.GetImage() != -1 ) - { - wxImageList* imageList = GetImageList(wxIMAGE_LIST_SMALL); - if (imageList && imageList->GetImageCount() > 0 ) - { - wxBitmap bmp = imageList->GetBitmap( item.GetImage() ); - IconRef icon = bmp.GetIconRef(); - columnDesc.btnContentInfo.u.iconRef = icon; - columnDesc.btnContentInfo.contentType = kControlContentIconRef; - } - } - - verify_noerr( m_dbImpl->SetHeaderDesc( id, &columnDesc ) ); - - } - return true; -} - -int wxListCtrl::GetColumnCount() const -{ - if (m_genericImpl) - return m_genericImpl->GetColumnCount(); - - if (m_dbImpl) - { - UInt32 count; - m_dbImpl->GetColumnCount(&count); - return count; - } - - return m_colCount; -} - -// Gets the column width -int wxListCtrl::GetColumnWidth(int col) const -{ - if (m_genericImpl) - return m_genericImpl->GetColumnWidth(col); - - if (m_dbImpl) - { - return m_dbImpl->GetColumnWidth(col); - } - - return 0; -} - -// Sets the column width -bool wxListCtrl::SetColumnWidth(int col, int width) -{ - if (m_genericImpl) - return m_genericImpl->SetColumnWidth(col, width); - - if (m_dbImpl) - { - if ( width == wxLIST_AUTOSIZE_USEHEADER ) - { - width = 150; // FIXME - } - - if (col == -1) - { - for (int column = 0; column < GetColumnCount(); column++) - { - wxListItem colInfo; - GetColumn(column, colInfo); - - colInfo.SetWidth(width); - SetColumn(column, colInfo); - - const int mywidth = (width == wxLIST_AUTOSIZE) - ? CalcColumnAutoWidth(column) : width; - m_dbImpl->SetColumnWidth(column, mywidth); - } - } - else - { - if ( width == wxLIST_AUTOSIZE ) - width = CalcColumnAutoWidth(col); - - wxListItem colInfo; - GetColumn(col, colInfo); - - colInfo.SetWidth(width); - SetColumn(col, colInfo); - m_dbImpl->SetColumnWidth(col, width); - } - return true; - } - - return false; -} - -// Gets the number of items that can fit vertically in the -// visible area of the list control (list or report view) -// or the total number of items in the list control (icon -// or small icon view) -int wxListCtrl::GetCountPerPage() const -{ - if (m_genericImpl) - return m_genericImpl->GetCountPerPage(); - - if (m_dbImpl) - { - UInt16 height = 1; - m_dbImpl->GetDefaultRowHeight( &height ); - if (height > 0) - return GetClientSize().y / height; - } - - return 1; -} - -// Gets the edit control for editing labels. -wxTextCtrl* wxListCtrl::GetEditControl() const -{ - if (m_genericImpl) - return m_genericImpl->GetEditControl(); - - return NULL; -} - -// Gets information about the item -bool wxListCtrl::GetItem(wxListItem& info) const -{ - if (m_genericImpl) - return m_genericImpl->GetItem(info); - - if (m_dbImpl) - { - if (!IsVirtual()) - { - if (info.m_itemId >= 0 && info.m_itemId < GetItemCount()) - { - m_dbImpl->MacGetColumnInfo(info.m_itemId, info.m_col, info); - // MacGetColumnInfo returns erroneous information in the state field, so zero it. - info.SetState(0); - if (info.GetMask() & wxLIST_MASK_STATE) - { - DataBrowserItemID id = (DataBrowserItemID)m_dbImpl->GetItemFromLine(info.m_itemId); - if (IsDataBrowserItemSelected( m_dbImpl->GetControlRef(), id )) - info.SetState(info.GetState() | wxLIST_STATE_SELECTED); - } - } - } - else - { - if (info.m_itemId >= 0 && info.m_itemId < GetItemCount()) - { - info.SetText( OnGetItemText(info.m_itemId, info.m_col) ); - info.SetImage( OnGetItemColumnImage(info.m_itemId, info.m_col) ); - if (info.GetMask() & wxLIST_MASK_STATE) - { - if (IsDataBrowserItemSelected( m_dbImpl->GetControlRef(), info.m_itemId+1 )) - info.SetState(info.GetState() | wxLIST_STATE_SELECTED); - } - - wxListItemAttr* attrs = OnGetItemAttr( info.m_itemId ); - if (attrs) - { - info.SetFont( attrs->GetFont() ); - info.SetBackgroundColour( attrs->GetBackgroundColour() ); - info.SetTextColour( attrs->GetTextColour() ); - } - } - } - } - bool success = true; - return success; -} - -// Sets information about the item -bool wxListCtrl::SetItem(wxListItem& info) -{ - if (m_genericImpl) - return m_genericImpl->SetItem(info); - - if (m_dbImpl) - m_dbImpl->MacSetColumnInfo( info.m_itemId, info.m_col, &info ); - - return true; -} - -long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId) -{ - if (m_genericImpl) - return m_genericImpl->SetItem(index, col, label, imageId); - - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - info.m_col = col; - if ( imageId > -1 ) - { - info.m_image = imageId; - info.m_mask |= wxLIST_MASK_IMAGE; - } - return SetItem(info); -} - - -// Gets the item state -int wxListCtrl::GetItemState(long item, long stateMask) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemState(item, stateMask); - - if (m_dbImpl) - { - if ( HasFlag(wxLC_VIRTUAL) ) - { - if (stateMask == wxLIST_STATE_SELECTED) - { - if (IsDataBrowserItemSelected( m_dbImpl->GetControlRef(), item+1 )) - return wxLIST_STATE_SELECTED; - else - return 0; - } - } - else - { - wxListItem info; - - info.m_mask = wxLIST_MASK_STATE; - info.m_stateMask = stateMask; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - - return info.m_state; - } - } - - return 0; -} - -// Sets the item state -bool wxListCtrl::SetItemState(long item, long state, long stateMask) -{ - if (m_genericImpl) - return m_genericImpl->SetItemState(item, state, stateMask); - - if (m_dbImpl) - { - DataBrowserSetOption option = kDataBrowserItemsAdd; - if ( (stateMask & wxLIST_STATE_SELECTED) && state == 0 ) - option = kDataBrowserItemsRemove; - - if (item == -1) - { - if ( HasFlag(wxLC_VIRTUAL) ) - { - wxMacDataItemBrowserSelectionSuppressor suppressor(m_dbImpl); - m_dbImpl->SetSelectedAllItems(option); - } - else - { - for(int i = 0; i < GetItemCount();i++) - { - wxListItem info; - info.m_itemId = i; - info.m_mask = wxLIST_MASK_STATE; - info.m_stateMask = stateMask; - info.m_state = state; - SetItem(info); - } - } - } - else - { - if ( HasFlag(wxLC_VIRTUAL) ) - { - long itemID = item+1; - bool isSelected = IsDataBrowserItemSelected(m_dbImpl->GetControlRef(), (DataBrowserItemID)itemID ); - bool isSelectedState = (state == wxLIST_STATE_SELECTED); - - // toggle the selection state if wxListInfo state and actual state don't match. - if ( (stateMask & wxLIST_STATE_SELECTED) && isSelected != isSelectedState ) - { - SetDataBrowserSelectedItems(m_dbImpl->GetControlRef(), 1, (DataBrowserItemID*)&itemID, option); - } - } - else - { - wxListItem info; - info.m_itemId = item; - info.m_mask = wxLIST_MASK_STATE; - info.m_stateMask = stateMask; - info.m_state = state; - return SetItem(info); - } - } - } - return true; -} - -// Sets the item image -bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) -{ - return SetItemColumnImage(item, 0, image); -} - -// Sets the item image -bool wxListCtrl::SetItemColumnImage(long item, long column, int image) -{ - if (m_genericImpl) - return m_genericImpl->SetItemColumnImage(item, column, image); - - wxListItem info; - - info.m_mask = wxLIST_MASK_IMAGE; - info.m_image = image; - info.m_itemId = item; - info.m_col = column; - - return SetItem(info); -} - -// Gets the item text -wxString wxListCtrl::GetItemText(long item, int column) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemText(item, column); - - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = item; - info.m_col = column; - - if (!GetItem(info)) - return wxEmptyString; - return info.m_text; -} - -// Sets the item text -void wxListCtrl::SetItemText(long item, const wxString& str) -{ - if (m_genericImpl) - return m_genericImpl->SetItemText(item, str); - - wxListItem info; - - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = item; - info.m_text = str; - - SetItem(info); -} - -// Gets the item data -long wxListCtrl::GetItemData(long item) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemData(item); - - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA; - info.m_itemId = item; - - if (!GetItem(info)) - return 0; - return info.m_data; -} - -// Sets the item data -bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data) -{ - if (m_genericImpl) - return m_genericImpl->SetItemData(item, data); - - wxListItem info; - - info.m_mask = wxLIST_MASK_DATA; - info.m_itemId = item; - info.m_data = data; - - return SetItem(info); -} - -wxRect wxListCtrl::GetViewRect() const -{ - wxASSERT_MSG( !HasFlag(wxLC_REPORT | wxLC_LIST), - wxT("wxListCtrl::GetViewRect() only works in icon mode") ); - - if (m_genericImpl) - return m_genericImpl->GetViewRect(); - - wxRect rect; - return rect; -} - -bool wxListCtrl::GetSubItemRect( long item, long subItem, wxRect& rect, int code ) const -{ - if (m_genericImpl) - return m_genericImpl->GetSubItemRect(item, subItem, rect, code); - - // TODO: implement for DataBrowser implementation - return false; -} - -// Gets the item rectangle -bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemRect(item, rect, code); - - - if (m_dbImpl) - { - DataBrowserItemID id; - - DataBrowserTableViewColumnID col = 0; - verify_noerr( m_dbImpl->GetColumnIDFromIndex( 0, &col ) ); - - Rect bounds; - DataBrowserPropertyPart part = kDataBrowserPropertyEnclosingPart; - if ( code == wxLIST_RECT_LABEL ) - part = kDataBrowserPropertyTextPart; - else if ( code == wxLIST_RECT_ICON ) - part = kDataBrowserPropertyIconPart; - - if ( !(GetWindowStyleFlag() & wxLC_VIRTUAL) ) - { - wxMacDataItem* thisItem = m_dbImpl->GetItemFromLine(item); - id = (DataBrowserItemID) thisItem; - } - else - id = item+1; - - GetDataBrowserItemPartBounds( m_dbImpl->GetControlRef(), id, col, part, &bounds ); - - rect.x = bounds.left; - rect.y = bounds.top; - rect.width = bounds.right - bounds.left; //GetClientSize().x; // we need the width of the whole row, not just the item. - rect.height = bounds.bottom - bounds.top; - //fprintf("id = %d, bounds = %d, %d, %d, %d\n", id, rect.x, rect.y, rect.width, rect.height); - } - return true; -} - -// Gets the item position -bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemPosition(item, pos); - - bool success = false; - - if (m_dbImpl) - { - wxRect itemRect; - GetItemRect(item, itemRect); - pos = itemRect.GetPosition(); - success = true; - } - - return success; -} - -// Sets the item position. -bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) -{ - if (m_genericImpl) - return m_genericImpl->SetItemPosition(item, pos); - - return false; -} - -// Gets the number of items in the list control -int wxListCtrl::GetItemCount() const -{ - if (m_genericImpl) - return m_genericImpl->GetItemCount(); - - if (m_dbImpl) - return m_dbImpl->MacGetCount(); - - return m_count; -} - -void wxListCtrl::SetItemSpacing( int spacing, bool isSmall ) -{ - if (m_genericImpl) - m_genericImpl->SetItemSpacing(spacing, isSmall); -} - -wxSize wxListCtrl::GetItemSpacing() const -{ - if (m_genericImpl) - return m_genericImpl->GetItemSpacing(); - - return wxSize(0, 0); -} - -void wxListCtrl::SetItemTextColour( long item, const wxColour &col ) -{ - if (m_genericImpl) - { - m_genericImpl->SetItemTextColour(item, col); - return; - } - - wxListItem info; - info.m_itemId = item; - info.SetTextColour( col ); - SetItem( info ); -} - -wxColour wxListCtrl::GetItemTextColour( long item ) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemTextColour(item); - - if (m_dbImpl) - { - wxListItem info; - if (GetItem(info)) - return info.GetTextColour(); - } - return wxNullColour; -} - -void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col ) -{ - if (m_genericImpl) - { - m_genericImpl->SetItemBackgroundColour(item, col); - return; - } - - wxListItem info; - info.m_itemId = item; - info.SetBackgroundColour( col ); - SetItem( info ); -} - -wxColour wxListCtrl::GetItemBackgroundColour( long item ) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemBackgroundColour(item); - - if (m_dbImpl) - { - wxListItem info; - if (GetItem(info)) - return info.GetBackgroundColour(); - } - return wxNullColour; -} - -void wxListCtrl::SetItemFont( long item, const wxFont &f ) -{ - if (m_genericImpl) - { - m_genericImpl->SetItemFont(item, f); - return; - } - - wxListItem info; - info.m_itemId = item; - info.SetFont( f ); - SetItem( info ); -} - -wxFont wxListCtrl::GetItemFont( long item ) const -{ - if (m_genericImpl) - return m_genericImpl->GetItemFont(item); - - if (m_dbImpl) - { - wxListItem info; - if (GetItem(info)) - return info.GetFont(); - } - - return wxNullFont; -} - -// Gets the number of selected items in the list control -int wxListCtrl::GetSelectedItemCount() const -{ - if (m_genericImpl) - return m_genericImpl->GetSelectedItemCount(); - - if (m_dbImpl) - return m_dbImpl->GetSelectedItemCount(NULL, true); - - return 0; -} - -// Gets the text colour of the listview -wxColour wxListCtrl::GetTextColour() const -{ - if (m_genericImpl) - return m_genericImpl->GetTextColour(); - - // TODO: we need owner drawn list items to customize text color. - if (m_dbImpl) - return m_textColor; - - return wxNullColour; -} - -// Sets the text colour of the listview -void wxListCtrl::SetTextColour(const wxColour& col) -{ - if (m_genericImpl) - { - m_genericImpl->SetTextColour(col); - return; - } - - if (m_dbImpl) - m_textColor = col; -} - -// Gets the index of the topmost visible item when in -// list or report view -long wxListCtrl::GetTopItem() const -{ - if (m_genericImpl) - return m_genericImpl->GetTopItem(); - - if (m_dbImpl) - { - int flags = 0; - long item = HitTest( wxPoint(1, 1), flags); - if (flags == wxLIST_HITTEST_ONITEM) - return item; - } - - return 0; -} - -// Searches for an item, starting from 'item'. -// 'geometry' is one of -// wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT. -// 'state' is a state bit flag, one or more of -// wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT. -// item can be -1 to find the first item that matches the -// specified flags. -// Returns the item or -1 if unsuccessful. -long wxListCtrl::GetNextItem(long item, int geom, int state) const -{ - if (m_genericImpl) - return m_genericImpl->GetNextItem(item, geom, state); - - // TODO: implement all geometry and state options? - if ( m_dbImpl ) - { - if ( geom == wxLIST_NEXT_ALL || geom == wxLIST_NEXT_BELOW ) - { - long count = m_dbImpl->MacGetCount() ; - for ( long line = item + 1 ; line < count; line++ ) - { - DataBrowserItemID id = line + 1; - if ( !IsVirtual() ) - id = (DataBrowserItemID)m_dbImpl->GetItemFromLine(line); - - if ( (state & wxLIST_STATE_FOCUSED) && (m_current == line)) - return line; - - if ( (state == wxLIST_STATE_DONTCARE ) ) - return line; - - if ( (state & wxLIST_STATE_SELECTED) && IsDataBrowserItemSelected(m_dbImpl->GetControlRef(), id ) ) - return line; - } - } - - if ( geom == wxLIST_NEXT_ABOVE ) - { - int item2 = item; - if ( item2 == -1 ) - item2 = m_dbImpl->MacGetCount(); - - for ( long line = item2 - 1 ; line >= 0; line-- ) - { - DataBrowserItemID id = line + 1; - if ( !IsVirtual() ) - id = (DataBrowserItemID)m_dbImpl->GetItemFromLine(line); - - if ( (state & wxLIST_STATE_FOCUSED) && (m_current == line)) - return line; - - if ( (state == wxLIST_STATE_DONTCARE ) ) - return line; - - if ( (state & wxLIST_STATE_SELECTED) && IsDataBrowserItemSelected(m_dbImpl->GetControlRef(), id ) ) - return line; - } - } - } - - return -1; -} - - -wxImageList *wxListCtrl::GetImageList(int which) const -{ - if (m_genericImpl) - return m_genericImpl->GetImageList(which); - - if ( which == wxIMAGE_LIST_NORMAL ) - { - return m_imageListNormal; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - return m_imageListSmall; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - return m_imageListState; - } - return NULL; -} - -void wxListCtrl::SetImageList(wxImageList *imageList, int which) -{ - if (m_genericImpl) - { - m_genericImpl->SetImageList(imageList, which); - return; - } - - if ( which == wxIMAGE_LIST_NORMAL ) - { - if (m_ownsImageListNormal) delete m_imageListNormal; - m_imageListNormal = imageList; - m_ownsImageListNormal = false; - } - else if ( which == wxIMAGE_LIST_SMALL ) - { - if (m_ownsImageListSmall) delete m_imageListSmall; - m_imageListSmall = imageList; - m_ownsImageListSmall = false; - } - else if ( which == wxIMAGE_LIST_STATE ) - { - if (m_ownsImageListState) delete m_imageListState; - m_imageListState = imageList; - m_ownsImageListState = false; - } -} - -void wxListCtrl::AssignImageList(wxImageList *imageList, int which) -{ - if (m_genericImpl) - { - m_genericImpl->AssignImageList(imageList, which); - return; - } - - SetImageList(imageList, which); - if ( which == wxIMAGE_LIST_NORMAL ) - m_ownsImageListNormal = true; - else if ( which == wxIMAGE_LIST_SMALL ) - m_ownsImageListSmall = true; - else if ( which == wxIMAGE_LIST_STATE ) - m_ownsImageListState = true; -} - -// ---------------------------------------------------------------------------- -// Operations -// ---------------------------------------------------------------------------- - -// Arranges the items -bool wxListCtrl::Arrange(int flag) -{ - if (m_genericImpl) - return m_genericImpl->Arrange(flag); - return false; -} - -// Deletes an item -bool wxListCtrl::DeleteItem(long item) -{ - if (m_genericImpl) - return m_genericImpl->DeleteItem(item); - - if (m_dbImpl) - { - m_dbImpl->MacDelete(item); - wxListEvent event( wxEVT_LIST_DELETE_ITEM, GetId() ); - event.SetEventObject( this ); - event.m_itemIndex = item; - HandleWindowEvent( event ); - - } - return true; -} - -// Deletes all items -bool wxListCtrl::DeleteAllItems() -{ - m_current = -1; - if (m_genericImpl) - return m_genericImpl->DeleteAllItems(); - - if (m_dbImpl) - { - m_dbImpl->MacClear(); - wxListEvent event( wxEVT_LIST_DELETE_ALL_ITEMS, GetId() ); - event.SetEventObject( this ); - HandleWindowEvent( event ); - } - return true; -} - -// Deletes all items -bool wxListCtrl::DeleteAllColumns() -{ - if (m_genericImpl) - return m_genericImpl->DeleteAllColumns(); - - if (m_dbImpl) - { - UInt32 cols; - m_dbImpl->GetColumnCount(&cols); - for (UInt32 col = 0; col < cols; col++) - { - DeleteColumn(0); - } - } - - return true; -} - -// Deletes a column -bool wxListCtrl::DeleteColumn(int col) -{ - if (m_genericImpl) - return m_genericImpl->DeleteColumn(col); - - if (m_dbImpl) - { - OSStatus err = m_dbImpl->RemoveColumn(col); - return err == noErr; - } - - return true; -} - -// Clears items, and columns if there are any. -void wxListCtrl::ClearAll() -{ - if (m_genericImpl) - { - m_genericImpl->ClearAll(); - return; - } - - if (m_dbImpl) - { - DeleteAllItems(); - DeleteAllColumns(); - } -} - -wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) -{ - if (m_genericImpl) - return m_genericImpl->EditLabel(item, textControlClass); - - if (m_dbImpl) - { - wxCHECK_MSG( (item >= 0) && ((long)item < GetItemCount()), NULL, - wxT("wrong index in wxListCtrl::EditLabel()") ); - - wxASSERT_MSG( textControlClass->IsKindOf(CLASSINFO(wxTextCtrl)), - wxT("EditLabel() needs a text control") ); - - wxListEvent le( wxEVT_LIST_BEGIN_LABEL_EDIT, GetParent()->GetId() ); - le.SetEventObject( this ); - le.m_itemIndex = item; - le.m_col = 0; - GetItem( le.m_item ); - - if ( GetParent()->HandleWindowEvent( le ) && !le.IsAllowed() ) - { - // vetoed by user code - return NULL; - } - - wxTextCtrl * const text = (wxTextCtrl *)textControlClass->CreateObject(); - m_textctrlWrapper = new wxListCtrlTextCtrlWrapper(this, text, item); - return m_textctrlWrapper->GetText(); - } - return NULL; -} - -// End label editing, optionally cancelling the edit -bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel)) -{ - // TODO: generic impl. doesn't have this method - is it needed for us? - if (m_genericImpl) - return true; // m_genericImpl->EndEditLabel(cancel); - - if (m_dbImpl) - { - DataBrowserTableViewColumnID id = 0; - verify_noerr( m_dbImpl->GetColumnIDFromIndex( 0, &id ) ); - verify_noerr( SetDataBrowserEditItem(m_dbImpl->GetControlRef(), kDataBrowserNoItem, id ) ); - } - return true; -} - -// Ensures this item is visible -bool wxListCtrl::EnsureVisible(long item) -{ - if (m_genericImpl) - return m_genericImpl->EnsureVisible(item); - - if (m_dbImpl) - { - wxMacDataItem* dataItem = m_dbImpl->GetItemFromLine(item); - m_dbImpl->RevealItem(dataItem, kDataBrowserRevealWithoutSelecting); - } - - return true; -} - -// Find an item whose label matches this string, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxString& str, bool partial) -{ - if (m_genericImpl) - return m_genericImpl->FindItem(start, str, partial); - - wxString str_upper = str.Upper(); - - long idx = start; - if (idx < 0) - idx = 0; - long count = GetItemCount(); - - while (idx < count) - { - wxString line_upper = GetItemText(idx).Upper(); - if (!partial) - { - if (line_upper == str_upper ) - return idx; - } - else - { - if (line_upper.find(str_upper) == 0) - return idx; - } - - idx++; - }; - - return wxNOT_FOUND; -} - -// Find an item whose data matches this data, starting from the item after 'start' -// or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, long data) -{ - if (m_genericImpl) - return m_genericImpl->FindItem(start, data); - - long idx = start; - if (idx < 0) - idx = 0; - long count = GetItemCount(); - - while (idx < count) - { - if (GetItemData(idx) == data) - return idx; - idx++; - }; - - return wxNOT_FOUND; -} - -// Find an item nearest this position in the specified direction, starting from -// the item after 'start' or the beginning if 'start' is -1. -long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction) -{ - if (m_genericImpl) - return m_genericImpl->FindItem(start, pt, direction); - return -1; -} - -static void calculateCGDrawingBounds(CGRect inItemRect, CGRect *outIconRect, CGRect *outTextRect, bool hasIcon); - -// Determines which item (if any) is at the specified point, -// giving details in 'flags' (see wxLIST_HITTEST_... flags above) -long -wxListCtrl::HitTest(const wxPoint& point, int& flags, long *ptrSubItem) const -{ - if (ptrSubItem) - *ptrSubItem = -1; - - if (m_genericImpl) - return m_genericImpl->HitTest(point, flags, ptrSubItem); - - flags = wxLIST_HITTEST_NOWHERE; - if (m_dbImpl) - { - int colHeaderHeight = 22; // TODO: Find a way to get this value from the db control? - UInt16 rowHeight = 0; - m_dbImpl->GetDefaultRowHeight(&rowHeight); - - int y = point.y; - // get the actual row by taking scroll position into account - UInt32 offsetX, offsetY; - m_dbImpl->GetScrollPosition( &offsetY, &offsetX ); - y += offsetY; - - if ( !(GetWindowStyleFlag() & wxLC_NO_HEADER) ) - y -= colHeaderHeight; - - if ( y < 0 ) - return -1; - - int row = y / rowHeight; - DataBrowserItemID id; - m_dbImpl->GetItemID( (DataBrowserTableViewRowIndex) row, &id ); - - CGPoint click_point = CGPointMake( point.x, point.y ); - if (row < GetItemCount() ) - { - short column; - for( column = 0; column < GetColumnCount(); column++ ) - { - Rect enclosingRect; - CGRect enclosingCGRect, iconCGRect, textCGRect; - int imgIndex = -1; - wxMacListCtrlItem* lcItem; - - WXUNUSED_UNLESS_DEBUG( OSStatus status = ) m_dbImpl->GetItemPartBounds( id, kMinColumnId + column, kDataBrowserPropertyEnclosingPart, &enclosingRect ); - wxASSERT( status == noErr ); - - enclosingCGRect = CGRectMake(enclosingRect.left, - enclosingRect.top, - enclosingRect.right - enclosingRect.left, - enclosingRect.bottom - enclosingRect.top); - - if (column >= 0) - { - if ( !(GetWindowStyleFlag() & wxLC_VIRTUAL ) ) - { - lcItem = (wxMacListCtrlItem*) id; - if (lcItem->HasColumnInfo(column)) - { - wxListItem* item = lcItem->GetColumnInfo(column); - - if (item->GetMask() & wxLIST_MASK_IMAGE) - { - imgIndex = item->GetImage(); - } - } - } - else - { - long itemNum = (long)id-1; - if (itemNum >= 0 && itemNum < GetItemCount()) - { - imgIndex = OnGetItemColumnImage( itemNum, column ); - } - } - } - - calculateCGDrawingBounds(enclosingCGRect, &iconCGRect, &textCGRect, (imgIndex != -1) ); - - if ( CGRectContainsPoint( iconCGRect, click_point ) ) - { - flags = wxLIST_HITTEST_ONITEMICON; - if (ptrSubItem) - *ptrSubItem = column; - return row; - } - else if ( CGRectContainsPoint( textCGRect, click_point ) ) - { - flags = wxLIST_HITTEST_ONITEMLABEL; - if (ptrSubItem) - *ptrSubItem = column; - return row; - } - } - - if ( !(GetWindowStyleFlag() & wxLC_VIRTUAL ) ) - { - wxMacListCtrlItem* lcItem; - lcItem = (wxMacListCtrlItem*) id; - if (lcItem) - { - flags = wxLIST_HITTEST_ONITEM; - if (ptrSubItem) - *ptrSubItem = column; - return row; - } - } - else - { - flags = wxLIST_HITTEST_ONITEM; - if (ptrSubItem) - *ptrSubItem = column; - return row; - } - } - else - { - if ( wxControl::HitTest( point ) ) - flags = wxLIST_HITTEST_NOWHERE; - } - } - - return -1; -} - -int wxListCtrl::GetScrollPos(int orient) const -{ - if (m_genericImpl) - return m_genericImpl->GetScrollPos(orient); - - if (m_dbImpl) - { - UInt32 offsetX, offsetY; - m_dbImpl->GetScrollPosition( &offsetY, &offsetX ); - if ( orient == wxHORIZONTAL ) - return offsetX; - else - return offsetY; - } - - return 0; -} - -// Inserts an item, returning the index of the new item if successful, -// -1 otherwise. -long wxListCtrl::InsertItem(wxListItem& info) -{ - wxASSERT_MSG( !IsVirtual(), wxT("can't be used with virtual controls") ); - - if (m_genericImpl) - return m_genericImpl->InsertItem(info); - - if (m_dbImpl && !IsVirtual()) - { - int count = GetItemCount(); - - if (info.m_itemId > count) - info.m_itemId = count; - - m_dbImpl->MacInsertItem(info.m_itemId, &info ); - - wxListEvent event( wxEVT_LIST_INSERT_ITEM, GetId() ); - event.SetEventObject( this ); - event.m_itemIndex = info.m_itemId; - HandleWindowEvent( event ); - return info.m_itemId; - } - return -1; -} - -long wxListCtrl::InsertItem(long index, const wxString& label) -{ - if (m_genericImpl) - return m_genericImpl->InsertItem(index, label); - - wxListItem info; - info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image item -long wxListCtrl::InsertItem(long index, int imageIndex) -{ - if (m_genericImpl) - return m_genericImpl->InsertItem(index, imageIndex); - - wxListItem info; - info.m_image = imageIndex; - info.m_mask = wxLIST_MASK_IMAGE; - info.m_itemId = index; - return InsertItem(info); -} - -// Inserts an image/string item -long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) -{ - if (m_genericImpl) - return m_genericImpl->InsertItem(index, label, imageIndex); - - wxListItem info; - info.m_image = imageIndex; - info.m_text = label; - info.m_mask = wxLIST_MASK_IMAGE | wxLIST_MASK_TEXT; - info.m_itemId = index; - return InsertItem(info); -} - -// For list view mode (only), inserts a column. -long wxListCtrl::DoInsertColumn(long col, const wxListItem& item) -{ - if (m_genericImpl) - return m_genericImpl->InsertColumn(col, item); - - if (m_dbImpl) - { - int width = item.GetWidth(); - if ( !(item.GetMask() & wxLIST_MASK_WIDTH) ) - width = 150; - - DataBrowserPropertyType type = kDataBrowserCustomType; //kDataBrowserTextType; - wxImageList* imageList = GetImageList(wxIMAGE_LIST_SMALL); - if (imageList && imageList->GetImageCount() > 0) - { - wxBitmap bmp = imageList->GetBitmap(0); - //if (bmp.IsOk()) - // type = kDataBrowserIconAndTextType; - } - - SInt16 just = teFlushDefault; - if (item.GetMask() & wxLIST_MASK_FORMAT) - { - if (item.GetAlign() == wxLIST_FORMAT_LEFT) - just = teFlushLeft; - else if (item.GetAlign() == wxLIST_FORMAT_CENTER) - just = teCenter; - else if (item.GetAlign() == wxLIST_FORMAT_RIGHT) - just = teFlushRight; - } - m_dbImpl->InsertColumn(col, type, item.GetText(), just, width); - - wxListItem* listItem = new wxListItem(item); - m_colsInfo.Insert( col, listItem ); - SetColumn(col, item); - - // set/remove options based on the wxListCtrl type. - DataBrowserTableViewColumnID id; - m_dbImpl->GetColumnIDFromIndex(col, &id); - DataBrowserPropertyFlags flags; - verify_noerr(m_dbImpl->GetPropertyFlags(id, &flags)); - if (GetWindowStyleFlag() & wxLC_EDIT_LABELS) - flags |= kDataBrowserPropertyIsEditable; - - if (GetWindowStyleFlag() & wxLC_VIRTUAL){ - flags &= ~kDataBrowserListViewSortableColumn; - } - verify_noerr(m_dbImpl->SetPropertyFlags(id, flags)); - } - - return col; -} - -// scroll the control by the given number of pixels (exception: in list view, -// dx is interpreted as number of columns) -bool wxListCtrl::ScrollList(int dx, int dy) -{ - if (m_genericImpl) - return m_genericImpl->ScrollList(dx, dy); - - if (m_dbImpl) - { - // Notice that the parameter order is correct here: first argument is - // the "top" displacement, second one is the "left" one. - m_dbImpl->SetScrollPosition(dy, dx); - } - return true; -} - - -bool wxListCtrl::SortItems(wxListCtrlCompare fn, wxIntPtr data) -{ - if (m_genericImpl) - return m_genericImpl->SortItems(fn, data); - - if (m_dbImpl) - { - m_compareFunc = fn; - m_compareFuncData = data; - SortDataBrowserContainer( m_dbImpl->GetControlRef(), kDataBrowserNoItem, true); - - // we need to do this after each call, else we get a crash from wxPython when - // SortItems is called the second time. - m_compareFunc = NULL; - m_compareFuncData = 0; - } - - return true; -} - -void wxListCtrl::OnRenameTimer() -{ - wxCHECK_RET( HasCurrent(), wxT("unexpected rename timer") ); - - EditLabel( m_current ); -} - -bool wxListCtrl::OnRenameAccept(long itemEdit, const wxString& value) -{ - wxListEvent le( wxEVT_LIST_END_LABEL_EDIT, GetId() ); - le.SetEventObject( this ); - le.m_itemIndex = itemEdit; - - GetItem( le.m_item ); - le.m_item.m_text = value; - return !HandleWindowEvent( le ) || - le.IsAllowed(); -} - -void wxListCtrl::OnRenameCancelled(long itemEdit) -{ - // let owner know that the edit was cancelled - wxListEvent le( wxEVT_LIST_END_LABEL_EDIT, GetParent()->GetId() ); - - le.SetEditCanceled(true); - - le.SetEventObject( this ); - le.m_itemIndex = itemEdit; - - GetItem( le.m_item ); - HandleWindowEvent( le ); -} - -// ---------------------------------------------------------------------------- -// virtual list controls -// ---------------------------------------------------------------------------- - -wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const -{ - // this is a pure virtual function, in fact - which is not really pure - // because the controls which are not virtual don't need to implement it - wxFAIL_MSG( wxT("wxListCtrl::OnGetItemText not supposed to be called") ); - - return wxEmptyString; -} - -int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const -{ - wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), - -1, - wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden.")); - return -1; -} - -int wxListCtrl::OnGetItemColumnImage(long item, long column) const -{ - if (!column) - return OnGetItemImage(item); - - return -1; -} - -void wxListCtrl::SetItemCount(long count) -{ - wxASSERT_MSG( IsVirtual(), wxT("this is for virtual controls only") ); - - if (m_genericImpl) - { - m_genericImpl->SetItemCount(count); - return; - } - - if (m_dbImpl) - { - // we need to temporarily disable the new item creation notification - // procedure to speed things up - // FIXME: Even this doesn't seem to help much... - - // FIXME: Find a more efficient way to do this. - m_dbImpl->MacClear(); - - DataBrowserCallbacks callbacks; - DataBrowserItemNotificationUPP itemUPP; - GetDataBrowserCallbacks(m_dbImpl->GetControlRef(), &callbacks); - itemUPP = callbacks.u.v1.itemNotificationCallback; - callbacks.u.v1.itemNotificationCallback = 0; - m_dbImpl->SetCallbacks(&callbacks); - ::AddDataBrowserItems(m_dbImpl->GetControlRef(), kDataBrowserNoItem, - count, NULL, kDataBrowserItemNoProperty); - callbacks.u.v1.itemNotificationCallback = itemUPP; - m_dbImpl->SetCallbacks(&callbacks); - } - m_count = count; -} - -void wxListCtrl::RefreshItem(long item) -{ - if (m_genericImpl) - { - m_genericImpl->RefreshItem(item); - return; - } - - if (m_dbImpl) - { - DataBrowserItemID id; - - if ( !IsVirtual() ) - { - wxMacDataItem* thisItem = m_dbImpl->GetItemFromLine(item); - id = (DataBrowserItemID) thisItem; - } - else - id = item+1; - - m_dbImpl->wxMacDataBrowserControl::UpdateItems - ( - kDataBrowserNoItem, - 1, &id, - kDataBrowserItemNoProperty, // preSortProperty - kDataBrowserNoItem // update all columns - ); - } -} - -void wxListCtrl::RefreshItems(long itemFrom, long itemTo) -{ - if (m_genericImpl) - { - m_genericImpl->RefreshItems(itemFrom, itemTo); - return; - } - - if (m_dbImpl) - { - const long count = itemTo - itemFrom + 1; - DataBrowserItemID *ids = new DataBrowserItemID[count]; - - if ( !IsVirtual() ) - { - for ( long i = 0; i < count; i++ ) - { - wxMacDataItem* thisItem = m_dbImpl->GetItemFromLine(itemFrom+i); - ids[i] = (DataBrowserItemID) thisItem; - } - } - else - { - for ( long i = 0; i < count; i++ ) - ids[i] = itemFrom+i+1; - } - - m_dbImpl->wxMacDataBrowserControl::UpdateItems - ( - kDataBrowserNoItem, - count, ids, - kDataBrowserItemNoProperty, // preSortProperty - kDataBrowserNoItem // update all columns - ); - - delete[] ids; - } -} - -void wxListCtrl::SetDropTarget( wxDropTarget *dropTarget ) -{ -#if wxUSE_DRAG_AND_DROP - if (m_genericImpl) - m_genericImpl->SetDropTarget( dropTarget ); - - if (m_dbImpl) - wxWindow::SetDropTarget( dropTarget ); -#endif -} - -wxDropTarget *wxListCtrl::GetDropTarget() const -{ -#if wxUSE_DRAG_AND_DROP - if (m_genericImpl) - return m_genericImpl->GetDropTarget(); - - if (m_dbImpl) - return wxWindow::GetDropTarget(); -#endif - return NULL; -} - -#if wxABI_VERSION >= 20801 -void wxListCtrl::SetFocus() -{ - if (m_genericImpl) - { - m_genericImpl->SetFocus(); - return; - } - - wxWindow::SetFocus(); -} -#endif - -// wxMac internal data structures - -wxMacListCtrlItem::~wxMacListCtrlItem() -{ - WX_CLEAR_HASH_MAP( wxListItemList, m_rowItems ); -} - -void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner , - DataBrowserItemNotification message, - DataBrowserItemDataRef WXUNUSED(itemData) ) const -{ - - wxMacDataBrowserListCtrlControl *lb = wxDynamicCast(owner, wxMacDataBrowserListCtrlControl); - - // we want to depend on as little as possible to make sure tear-down of controls is safe - if ( message == kDataBrowserItemRemoved) - { - delete this; - return; - } - else if ( message == kDataBrowserItemAdded ) - { - // we don't issue events on adding, the item is not really stored in the list yet, so we - // avoid asserts by gettting out now - return ; - } - - wxListCtrl *list = wxDynamicCast( owner->GetWXPeer() , wxListCtrl ); - if ( list && lb ) - { - bool trigger = false; - - wxListEvent event( wxEVT_LIST_ITEM_SELECTED, list->GetId() ); - bool isSingle = (list->GetWindowStyle() & wxLC_SINGLE_SEL) != 0; - - event.SetEventObject( list ); - event.m_itemIndex = owner->GetLineFromItem( this ) ; - event.m_item.m_itemId = event.m_itemIndex; - list->GetItem(event.m_item); - - switch (message) - { - case kDataBrowserItemDeselected: - event.SetEventType(wxEVT_LIST_ITEM_DESELECTED); - if ( !isSingle ) - trigger = !lb->IsSelectionSuppressed(); - break; - - case kDataBrowserItemSelected: - trigger = !lb->IsSelectionSuppressed(); - break; - - case kDataBrowserItemDoubleClicked: - event.SetEventType( wxEVT_LIST_ITEM_ACTIVATED ); - trigger = true; - break; - - case kDataBrowserEditStarted : - // TODO : how to veto ? - event.SetEventType( wxEVT_LIST_BEGIN_LABEL_EDIT ) ; - trigger = true ; - break ; - - case kDataBrowserEditStopped : - // TODO probably trigger only upon the value store callback, because - // here IIRC we cannot veto - event.SetEventType( wxEVT_LIST_END_LABEL_EDIT ) ; - trigger = true ; - break ; - - default: - break; - } - - if ( trigger ) - { - // direct notification is not always having the listbox GetSelection() having in synch with event - wxPostEvent( list->GetEventHandler(), event ); - } - } - -} - -IMPLEMENT_DYNAMIC_CLASS(wxMacDataBrowserListCtrlControl, wxMacDataItemBrowserControl ) - -wxMacDataBrowserListCtrlControl::wxMacDataBrowserListCtrlControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style) - : wxMacDataItemBrowserControl( peer, pos, size, style ) -{ - OSStatus err = noErr; - m_clientDataItemsType = wxClientData_None; - m_isVirtual = false; - m_flags = 0; - - if ( style & wxLC_VIRTUAL ) - m_isVirtual = true; - - DataBrowserSelectionFlags options = kDataBrowserDragSelect; - if ( style & wxLC_SINGLE_SEL ) - { - options |= kDataBrowserSelectOnlyOne; - } - else - { - options |= kDataBrowserCmdTogglesSelection; - } - - err = SetSelectionFlags( options ); - verify_noerr( err ); - - DataBrowserCustomCallbacks callbacks; - InitializeDataBrowserCustomCallbacks( &callbacks, kDataBrowserLatestCustomCallbacks ); - - if ( gDataBrowserDrawItemUPP == NULL ) - gDataBrowserDrawItemUPP = NewDataBrowserDrawItemUPP(DataBrowserDrawItemProc); - - if ( gDataBrowserHitTestUPP == NULL ) - gDataBrowserHitTestUPP = NewDataBrowserHitTestUPP(DataBrowserHitTestProc); - - callbacks.u.v1.drawItemCallback = gDataBrowserDrawItemUPP; - callbacks.u.v1.hitTestCallback = gDataBrowserHitTestUPP; - - SetDataBrowserCustomCallbacks( GetControlRef(), &callbacks ); - - if ( style & wxLC_LIST ) - { - InsertColumn(0, kDataBrowserIconAndTextType, wxEmptyString, -1, -1); - verify_noerr( AutoSizeColumns() ); - } - - if ( style & wxLC_LIST || style & wxLC_NO_HEADER ) - verify_noerr( SetHeaderButtonHeight( 0 ) ); - - if ( m_isVirtual ) - SetSortProperty( kMinColumnId - 1 ); - else - SetSortProperty( kMinColumnId ); - - m_sortOrder = SortOrder_None; - - if ( style & wxLC_SORT_DESCENDING ) - { - SetSortOrder( kDataBrowserOrderDecreasing ); - } - else if ( style & wxLC_SORT_ASCENDING ) - { - SetSortOrder( kDataBrowserOrderIncreasing ); - } - - if ( style & wxLC_VRULES ) - { - verify_noerr( DataBrowserChangeAttributes(m_controlRef, kDataBrowserAttributeListViewDrawColumnDividers, kDataBrowserAttributeNone) ); - } - - verify_noerr( SetHiliteStyle(kDataBrowserTableViewFillHilite ) ); - verify_noerr( SetHasScrollBars( (style & wxHSCROLL) != 0 , true ) ); -} - -pascal Boolean wxMacDataBrowserListCtrlControl::DataBrowserEditTextProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserPropertyID property, - CFStringRef theString, - Rect *maxEditTextRect, - Boolean *shrinkToFit) -{ - Boolean result = false; - wxMacDataBrowserListCtrlControl* ctl = wxDynamicCast(wxMacControl::GetReferenceFromNativeControl( browser ), wxMacDataBrowserListCtrlControl); - if ( ctl != 0 ) - { - result = ctl->ConfirmEditText(itemID, property, theString, maxEditTextRect, shrinkToFit); - theString = CFSTR("Hello!"); - } - return result; -} - -bool wxMacDataBrowserListCtrlControl::ConfirmEditText( - DataBrowserItemID WXUNUSED(itemID), - DataBrowserPropertyID WXUNUSED(property), - CFStringRef WXUNUSED(theString), - Rect *WXUNUSED(maxEditTextRect), - Boolean *WXUNUSED(shrinkToFit)) -{ - return false; -} - -pascal void wxMacDataBrowserListCtrlControl::DataBrowserDrawItemProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *itemRect, - SInt16 gdDepth, - Boolean colorDevice) -{ - wxMacDataBrowserListCtrlControl* ctl = wxDynamicCast(wxMacControl::GetReferenceFromNativeControl( browser ), wxMacDataBrowserListCtrlControl); - if ( ctl != 0 ) - { - ctl->DrawItem(itemID, property, itemState, itemRect, gdDepth, colorDevice); - } -} - -// routines needed for DrawItem -enum -{ - kIconWidth = 16, - kIconHeight = 16, - kTextBoxHeight = 14, - kIconTextSpacingV = 2, - kItemPadding = 4, - kContentHeight = kIconHeight + kTextBoxHeight + kIconTextSpacingV -}; - -static void calculateCGDrawingBounds(CGRect inItemRect, CGRect *outIconRect, CGRect *outTextRect, bool hasIcon = false) -{ - float textBottom; - float iconW = 0; - float padding = kItemPadding; - if (hasIcon) - { - iconW = kIconWidth; - padding = padding*2; - } - - textBottom = inItemRect.origin.y; - - *outIconRect = CGRectMake(inItemRect.origin.x + kItemPadding, - textBottom + kIconTextSpacingV, kIconWidth, - kIconHeight); - - *outTextRect = CGRectMake(inItemRect.origin.x + padding + iconW, - textBottom + kIconTextSpacingV, inItemRect.size.width - padding - iconW, - inItemRect.size.height - kIconTextSpacingV); -} - -void wxMacDataBrowserListCtrlControl::DrawItem( - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemState itemState, - const Rect *WXUNUSED(itemRect), - SInt16 gdDepth, - Boolean colorDevice) -{ - wxString text; - wxFont font = wxNullFont; - int imgIndex = -1; - - DataBrowserTableViewColumnIndex listColumn = 0; - GetColumnPosition( property, &listColumn ); - - wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl ); - wxMacListCtrlItem* lcItem; - wxColour color = *wxBLACK; - wxColour bgColor = wxNullColour; - - if (listColumn >= 0) - { - if (!m_isVirtual) - { - lcItem = (wxMacListCtrlItem*) itemID; - if (lcItem->HasColumnInfo(listColumn)) - { - wxListItem* item = lcItem->GetColumnInfo(listColumn); - - // we always use the 0 column to get font and text/background colors. - if (lcItem->HasColumnInfo(0)) - { - wxListItem* firstItem = lcItem->GetColumnInfo(0); - color = firstItem->GetTextColour(); - bgColor = firstItem->GetBackgroundColour(); - font = firstItem->GetFont(); - } - - if (item->GetMask() & wxLIST_MASK_TEXT) - text = item->GetText(); - if (item->GetMask() & wxLIST_MASK_IMAGE) - imgIndex = item->GetImage(); - } - - } - else - { - long itemNum = (long)itemID-1; - if (itemNum >= 0 && itemNum < list->GetItemCount()) - { - text = list->OnGetItemText( itemNum, listColumn ); - imgIndex = list->OnGetItemColumnImage( itemNum, listColumn ); - wxListItemAttr* attrs = list->OnGetItemAttr( itemNum ); - if (attrs) - { - if (attrs->HasBackgroundColour()) - bgColor = attrs->GetBackgroundColour(); - if (attrs->HasTextColour()) - color = attrs->GetTextColour(); - if (attrs->HasFont()) - font = attrs->GetFont(); - } - } - } - } - - wxColour listBgColor = list->GetBackgroundColour(); - if (bgColor == wxNullColour) - bgColor = listBgColor; - - if (!font.IsOk()) - font = list->GetFont(); - - wxCFStringRef cfString( text, wxLocale::GetSystemEncoding() ); - - Rect enclosingRect; - CGRect enclosingCGRect, iconCGRect, textCGRect; - Boolean active; - ThemeDrawingState savedState = NULL; - CGContextRef context = (CGContextRef)list->MacGetDrawingContext(); - wxMacCGContextStateSaver top_saver_cg( context ); - - RGBColor labelColor; - labelColor.red = 0; - labelColor.green = 0; - labelColor.blue = 0; - - RGBColor backgroundColor; - backgroundColor.red = 255; - backgroundColor.green = 255; - backgroundColor.blue = 255; - - GetDataBrowserItemPartBounds(GetControlRef(), itemID, property, kDataBrowserPropertyEnclosingPart, - &enclosingRect); - - enclosingCGRect = CGRectMake(enclosingRect.left, - enclosingRect.top, - enclosingRect.right - enclosingRect.left, - enclosingRect.bottom - enclosingRect.top); - - bool hasFocus = (wxWindow::FindFocus() == list); - active = IsControlActive(GetControlRef()); - - // don't paint the background over the vertical rule line - if ( list->GetWindowStyleFlag() & wxLC_VRULES ) - { - enclosingCGRect.origin.x += 1; - enclosingCGRect.size.width -= 1; - } - if (itemState == kDataBrowserItemIsSelected) - { - - GetThemeDrawingState(&savedState); - - if (active && hasFocus) - { - GetThemeBrushAsColor(kThemeBrushAlternatePrimaryHighlightColor, 32, true, &backgroundColor); - GetThemeTextColor(kThemeTextColorWhite, gdDepth, colorDevice, &labelColor); - } - else - { - GetThemeBrushAsColor(kThemeBrushSecondaryHighlightColor, 32, true, &backgroundColor); - GetThemeTextColor(kThemeTextColorBlack, gdDepth, colorDevice, &labelColor); - } - wxMacCGContextStateSaver cg( context ); - - CGContextSetRGBFillColor(context, (CGFloat)backgroundColor.red / (CGFloat)USHRT_MAX, - (CGFloat)backgroundColor.green / (CGFloat)USHRT_MAX, - (CGFloat)backgroundColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); - CGContextFillRect(context, enclosingCGRect); - } - else - { - - if (color.IsOk()) - color.GetRGBColor(&labelColor); - else if (list->GetTextColour().IsOk()) - list->GetTextColour().GetRGBColor(&labelColor); - - if (bgColor.IsOk()) - { - bgColor.GetRGBColor(&backgroundColor); - CGContextSaveGState(context); - - CGContextSetRGBFillColor(context, (CGFloat)backgroundColor.red / (CGFloat)USHRT_MAX, - (CGFloat)backgroundColor.green / (CGFloat)USHRT_MAX, - (CGFloat)backgroundColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); - CGContextFillRect(context, enclosingCGRect); - - CGContextRestoreGState(context); - } - } - - calculateCGDrawingBounds(enclosingCGRect, &iconCGRect, &textCGRect, (imgIndex != -1) ); - - if (imgIndex != -1) - { - wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL); - if (imageList && imageList->GetImageCount() > 0) - { - wxBitmap bmp = imageList->GetBitmap(imgIndex); - IconRef icon = bmp.GetIconRef(); - - wxMacCGContextStateSaver cg( context ); - - CGContextTranslateCTM(context, 0,iconCGRect.origin.y + CGRectGetMaxY(iconCGRect)); - CGContextScaleCTM(context,1.0f,-1.0f); - PlotIconRefInContext(context, &iconCGRect, kAlignNone, - active ? kTransformNone : kTransformDisabled, NULL, - kPlotIconRefNormalFlags, icon); - } - } - - HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft; - HIThemeTextInfo info; - - info.version = kHIThemeTextInfoVersionOne; - info.fontID = kThemeViewsFont; - if (font.IsOk()) - { - info.fontID = kThemeSpecifiedFont; - info.font = (CTFontRef) font.OSXGetCTFont(); - } - - wxListItem item; - list->GetColumn(listColumn, item); - if (item.GetMask() & wxLIST_MASK_FORMAT) - { - if (item.GetAlign() == wxLIST_FORMAT_LEFT) - hFlush = kHIThemeTextHorizontalFlushLeft; - else if (item.GetAlign() == wxLIST_FORMAT_CENTER) - hFlush = kHIThemeTextHorizontalFlushCenter; - else if (item.GetAlign() == wxLIST_FORMAT_RIGHT) - { - hFlush = kHIThemeTextHorizontalFlushRight; - textCGRect.origin.x -= kItemPadding; // give a little extra paddding - } - } - - info.state = active ? kThemeStateActive : kThemeStateInactive; - info.horizontalFlushness = hFlush; - info.verticalFlushness = kHIThemeTextVerticalFlushCenter; - info.options = kHIThemeTextBoxOptionNone; - info.truncationPosition = kHIThemeTextTruncationEnd; - info.truncationMaxLines = 1; - - { - wxMacCGContextStateSaver cg( context ); - CGContextSetRGBFillColor (context, (CGFloat)labelColor.red / (CGFloat)USHRT_MAX, - (CGFloat)labelColor.green / (CGFloat)USHRT_MAX, - (CGFloat)labelColor.blue / (CGFloat)USHRT_MAX, (CGFloat) 1.0); - - HIThemeDrawTextBox(cfString, &textCGRect, &info, context, kHIThemeOrientationNormal); - } - -#ifndef __LP64__ - if (savedState != NULL) - SetThemeDrawingState(savedState, true); -#endif -} - -OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ) -{ - wxString text; - int imgIndex = -1; - - DataBrowserTableViewColumnIndex listColumn = 0; - verify_noerr( GetColumnPosition( property, &listColumn ) ); - - OSStatus err = errDataBrowserPropertyNotSupported; - wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl ); - wxMacListCtrlItem* lcItem = NULL; - - if (listColumn >= 0) - { - if (!m_isVirtual) - { - lcItem = (wxMacListCtrlItem*) itemID; - if (lcItem && lcItem->HasColumnInfo(listColumn)){ - wxListItem* item = lcItem->GetColumnInfo(listColumn); - if (item->GetMask() & wxLIST_MASK_TEXT) - text = item->GetText(); - if (item->GetMask() & wxLIST_MASK_IMAGE) - imgIndex = item->GetImage(); - } - } - else - { - long itemNum = (long)itemID-1; - if (itemNum >= 0 && itemNum < list->GetItemCount()) - { - text = list->OnGetItemText( itemNum, listColumn ); - imgIndex = list->OnGetItemColumnImage( itemNum, listColumn ); - } - } - } - - if ( !changeValue ) - { - switch (property) - { - case kDataBrowserItemIsEditableProperty : - if ( list && list->HasFlag( wxLC_EDIT_LABELS ) ) - { - verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, true )); - err = noErr ; - } - break ; - default : - if ( property >= kMinColumnId ) - { - if (!text.IsEmpty()){ - wxCFStringRef cfStr( text, wxLocale::GetSystemEncoding() ); - err = ::SetDataBrowserItemDataText( itemData, cfStr ); - err = noErr; - } - - - - if ( imgIndex != -1 ) - { - wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL); - if (imageList && imageList->GetImageCount() > 0){ - wxBitmap bmp = imageList->GetBitmap(imgIndex); - IconRef icon = bmp.GetIconRef(); - ::SetDataBrowserItemDataIcon(itemData, icon); - } - } - - } - break ; - } - - } - else - { - switch (property) - { - default: - if ( property >= kMinColumnId ) - { - DataBrowserTableViewColumnIndex listColumn = 0; - verify_noerr( GetColumnPosition( property, &listColumn ) ); - - // TODO probably send the 'end edit' from here, as we - // can then deal with the veto - CFStringRef sr ; - verify_noerr( GetDataBrowserItemDataText( itemData , &sr ) ) ; - wxCFStringRef cfStr(sr) ;; - if (m_isVirtual) - list->SetItem( (long)itemData-1 , listColumn, cfStr.AsString() ) ; - else - { - if (lcItem) - lcItem->SetColumnTextValue( listColumn, cfStr.AsString() ); - } - err = noErr ; - } - break; - } - } - return err; -} - -void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) -{ - wxMacListCtrlItem *item = NULL; - if ( !m_isVirtual ) - { - item = (wxMacListCtrlItem *) itemID; - } - - // we want to depend on as little as possible to make sure tear-down of controls is safe - if ( message == kDataBrowserItemRemoved ) - { - if ( item ) - item->Notification(this, message, itemData); - return; - } - else if ( message == kDataBrowserItemAdded ) - { - // we don't issue events on adding, the item is not really stored in the list yet, so we - // avoid asserts by getting out now - if ( item ) - item->Notification(this, message, itemData); - return ; - } - - wxListCtrl *list = wxDynamicCast( GetWXPeer() , wxListCtrl ); - if ( list ) - { - bool trigger = false; - - wxListEvent event( wxEVT_LIST_ITEM_SELECTED, list->GetId() ); - - event.SetEventObject( list ); - if ( !list->IsVirtual() ) - { - DataBrowserTableViewRowIndex result = 0; - verify_noerr( GetItemRow( itemID, &result ) ) ; - event.m_itemIndex = result; - } - else - { - event.m_itemIndex = (long)itemID-1; - } - event.m_item.m_itemId = event.m_itemIndex; - list->GetItem(event.m_item); - - switch (message) - { - case kDataBrowserItemDeselected: - event.SetEventType(wxEVT_LIST_ITEM_DESELECTED); - // as the generic implementation is also triggering this - // event for single selection, we do the same (different than listbox) - trigger = !IsSelectionSuppressed(); - break; - - case kDataBrowserItemSelected: - trigger = !IsSelectionSuppressed(); - - break; - - case kDataBrowserItemDoubleClicked: - event.SetEventType( wxEVT_LIST_ITEM_ACTIVATED ); - trigger = true; - break; - - case kDataBrowserEditStarted : - // TODO : how to veto ? - event.SetEventType( wxEVT_LIST_BEGIN_LABEL_EDIT ) ; - trigger = true ; - break ; - - case kDataBrowserEditStopped : - // TODO probably trigger only upon the value store callback, because - // here IIRC we cannot veto - event.SetEventType( wxEVT_LIST_END_LABEL_EDIT ) ; - trigger = true ; - break ; - - default: - break; - } - - if ( trigger ) - { - // direct notification is not always having the listbox GetSelection() having in synch with event - wxPostEvent( list->GetEventHandler(), event ); - } - } -} - -Boolean wxMacDataBrowserListCtrlControl::CompareItems(DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty) -{ - - bool retval = false; - wxString itemText; - wxString otherItemText; - long itemOrder; - long otherItemOrder; - - DataBrowserTableViewColumnIndex colId = 0; - verify_noerr( GetColumnPosition( sortProperty, &colId ) ); - - wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl ); - - DataBrowserSortOrder sort; - verify_noerr(GetSortOrder(&sort)); - - if (colId >= 0) - { - if (!m_isVirtual) - { - wxMacListCtrlItem* item = (wxMacListCtrlItem*)itemOneID; - wxMacListCtrlItem* otherItem = (wxMacListCtrlItem*)itemTwoID; - - itemOrder = item->GetOrder(); - otherItemOrder = otherItem->GetOrder(); - - wxListCtrlCompare func = list->GetCompareFunc(); - if (func != NULL) - { - - long item1 = -1; - long item2 = -1; - if (item && item->HasColumnInfo(0)) - item1 = item->GetColumnInfo(0)->GetData(); - if (otherItem && otherItem->HasColumnInfo(0)) - item2 = otherItem->GetColumnInfo(0)->GetData(); - - if (item1 > -1 && item2 > -1) - { - int result = func(item1, item2, list->GetCompareFuncData()); - if (sort == kDataBrowserOrderIncreasing) - return result >= 0; - else - return result < 0; - } - } - - // we can't use the native control's sorting abilities, so just - // sort by item id. - return itemOrder < otherItemOrder; - } - else - { - - long itemNum = (long)itemOneID; - long otherItemNum = (long)itemTwoID; - - // virtual listctrls don't support sorting - return itemNum < otherItemNum; - } - } - else{ - // fallback for undefined cases - retval = itemOneID < itemTwoID; - } - - return retval; -} - -wxMacDataBrowserListCtrlControl::~wxMacDataBrowserListCtrlControl() -{ -} - -void wxMacDataBrowserListCtrlControl::MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item ) -{ - wxMacDataItem* dataItem = GetItemFromLine(row); - wxASSERT_MSG( dataItem, wxT("could not obtain wxMacDataItem for row in MacSetColumnInfo. Is row a valid wxListCtrl row?") ); - if (item) - { - wxMacListCtrlItem* listItem = static_cast(dataItem); - bool hasInfo = listItem->HasColumnInfo( column ); - listItem->SetColumnInfo( column, item ); - listItem->SetOrder(row); - UpdateState(dataItem, item); - - wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl ); - - // NB: When this call was made before a control was completely shown, it would - // update the item prematurely (i.e. no text would be listed) and, on show, - // only the sorted column would be refreshed, meaning only first column text labels - // would be shown. Making sure not to update items until the control is visible - // seems to fix this issue. - if (hasInfo && list->IsShown()) - { - DataBrowserTableViewColumnID id = 0; - verify_noerr( GetColumnIDFromIndex( column, &id ) ); - UpdateItem( wxMacDataBrowserRootContainer, listItem , id ); - } - } -} - -// apply changes that need to happen immediately, rather than when the -// databrowser control fires a callback. -void wxMacDataBrowserListCtrlControl::UpdateState(wxMacDataItem* dataItem, wxListItem* listItem) -{ - bool isSelected = IsItemSelected( dataItem ); - bool isSelectedState = (listItem->GetState() == wxLIST_STATE_SELECTED); - - // toggle the selection state if wxListInfo state and actual state don't match. - if ( listItem->GetMask() & wxLIST_MASK_STATE && isSelected != isSelectedState ) - { - DataBrowserSetOption options = kDataBrowserItemsAdd; - if (!isSelectedState) - options = kDataBrowserItemsRemove; - SetSelectedItem(dataItem, options); - } - // TODO: Set column width if item width > than current column width -} - -void wxMacDataBrowserListCtrlControl::MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item ) -{ - wxMacDataItem* dataItem = GetItemFromLine(row); - wxASSERT_MSG( dataItem, wxT("could not obtain wxMacDataItem in MacGetColumnInfo. Is row a valid wxListCtrl row?") ); - // CS should this guard against dataItem = 0 ? , as item is not a pointer if (item) is not appropriate - //if (item) - { - wxMacListCtrlItem* listItem = static_cast(dataItem); - - if (!listItem->HasColumnInfo( column )) - return; - - wxListItem* oldItem = listItem->GetColumnInfo( column ); - - if (oldItem) - { - long mask = item.GetMask(); - if ( !mask ) - // by default, get everything for backwards compatibility - mask = -1; - - if ( mask & wxLIST_MASK_TEXT ) - item.SetText(oldItem->GetText()); - if ( mask & wxLIST_MASK_IMAGE ) - item.SetImage(oldItem->GetImage()); - if ( mask & wxLIST_MASK_DATA ) - item.SetData(oldItem->GetData()); - if ( mask & wxLIST_MASK_STATE ) - item.SetState(oldItem->GetState()); - if ( mask & wxLIST_MASK_WIDTH ) - item.SetWidth(oldItem->GetWidth()); - if ( mask & wxLIST_MASK_FORMAT ) - item.SetAlign(oldItem->GetAlign()); - - item.SetTextColour(oldItem->GetTextColour()); - item.SetBackgroundColour(oldItem->GetBackgroundColour()); - item.SetFont(oldItem->GetFont()); - } - } -} - -void wxMacDataBrowserListCtrlControl::MacInsertItem( unsigned int n, wxListItem* item ) -{ - - wxMacDataItemBrowserControl::MacInsert(n, new wxMacListCtrlItem() ); - MacSetColumnInfo(n, 0, item); -} - -wxMacListCtrlItem::wxMacListCtrlItem() -{ - m_rowItems = wxListItemList(); -} - -int wxMacListCtrlItem::GetColumnImageValue( unsigned int column ) -{ - if ( HasColumnInfo(column) ) - return GetColumnInfo(column)->GetImage(); - - return -1; -} - -void wxMacListCtrlItem::SetColumnImageValue( unsigned int column, int imageIndex ) -{ - if ( HasColumnInfo(column) ) - GetColumnInfo(column)->SetImage(imageIndex); -} - -wxString wxMacListCtrlItem::GetColumnTextValue( unsigned int column ) -{ -/* TODO CHECK REMOVE - if ( column == 0 ) - return GetLabel(); -*/ - if ( HasColumnInfo(column) ) - return GetColumnInfo(column)->GetText(); - - return wxEmptyString; -} - -void wxMacListCtrlItem::SetColumnTextValue( unsigned int column, const wxString& text ) -{ - if ( HasColumnInfo(column) ) - GetColumnInfo(column)->SetText(text); - -/* TODO CHECK REMOVE - // for compatibility with superclass APIs - if ( column == 0 ) - SetLabel(text); -*/ -} - -wxListItem* wxMacListCtrlItem::GetColumnInfo( unsigned int column ) -{ - wxASSERT_MSG( HasColumnInfo(column), wxT("invalid column index in wxMacListCtrlItem") ); - return m_rowItems[column]; -} - -bool wxMacListCtrlItem::HasColumnInfo( unsigned int column ) -{ - return !(m_rowItems.find( column ) == m_rowItems.end()); -} - -void wxMacListCtrlItem::SetColumnInfo( unsigned int column, wxListItem* item ) -{ - - if ( !HasColumnInfo(column) ) - { - wxListItem* listItem = new wxListItem(*item); - m_rowItems[column] = listItem; - } - else - { - wxListItem* listItem = GetColumnInfo( column ); - long mask = item->GetMask(); - if (mask & wxLIST_MASK_TEXT) - listItem->SetText(item->GetText()); - if (mask & wxLIST_MASK_DATA) - listItem->SetData(item->GetData()); - if (mask & wxLIST_MASK_IMAGE) - listItem->SetImage(item->GetImage()); - if (mask & wxLIST_MASK_STATE) - listItem->SetState(item->GetState()); - if (mask & wxLIST_MASK_FORMAT) - listItem->SetAlign(item->GetAlign()); - if (mask & wxLIST_MASK_WIDTH) - listItem->SetWidth(item->GetWidth()); - - if ( item->HasAttributes() ) - { - if ( listItem->HasAttributes() ) - listItem->GetAttributes()->AssignFrom(*item->GetAttributes()); - else - { - listItem->SetTextColour(item->GetTextColour()); - listItem->SetBackgroundColour(item->GetBackgroundColour()); - listItem->SetFont(item->GetFont()); - } - } - } -} - -int wxListCtrl::CalcColumnAutoWidth(int col) const -{ - int width = 0; - - for ( int i = 0; i < GetItemCount(); i++ ) - { - wxListItem info; - info.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE); - info.SetId(i); - info.SetColumn(col); - GetItem(info); - - const wxFont font = info.GetFont(); - - int w = 0; - if ( font.IsOk() ) - GetTextExtent(info.GetText(), &w, NULL, NULL, NULL, &font); - else - GetTextExtent(info.GetText(), &w, NULL); - - w += 2 * kItemPadding; - - if ( info.GetImage() != -1 ) - w += kIconWidth; - - width = wxMax(width, w); - } - - return width; -} - -#endif // wxUSE_LISTCTRL - diff --git a/Externals/wxWidgets3/src/osx/carbon/mdi.cpp b/Externals/wxWidgets3/src/osx/carbon/mdi.cpp index 9ccc98880a..a53d474ab0 100644 --- a/Externals/wxWidgets3/src/osx/carbon/mdi.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/mdi.cpp @@ -24,14 +24,14 @@ #include "wx/osx/private.h" #include "wx/osx/uma.h" -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame); +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame); +wxIMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow); -BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) +wxBEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_ACTIVATE(wxMDIParentFrame::OnActivate) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #define TRACE_MDI "mdi" @@ -45,31 +45,7 @@ static const int IDM_WINDOWTILEVERT = 4005; void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) { -#if wxOSX_USE_CARBON // TODO REMOVE - if ( inWindowRef ) - { -// bool isHighlighted = IsWindowHighlited( inWindowRef ) ; -// if ( inActivate != isHighlighted ) -#ifndef __LP64__ - GrafPtr port ; - GetPort( &port ) ; - SetPortWindowPort( inWindowRef ) ; -#endif - HiliteWindow( inWindowRef , inActivate ) ; - ControlRef control = NULL ; - ::GetRootControl( inWindowRef , &control ) ; - if ( control ) - { - if ( inActivate ) - ::ActivateControl( control ) ; - else - ::DeactivateControl( control ) ; - } -#ifndef __LP64__ - SetPort( port ) ; -#endif - } -#elif defined(wxOSX_USE_COCOA) +#if defined(wxOSX_USE_COCOA) wxUnusedVar(inActivate); wxUnusedVar(inWindowRef); // TODO: implement me! diff --git a/Externals/wxWidgets3/src/osx/carbon/mediactrl.cpp b/Externals/wxWidgets3/src/osx/carbon/mediactrl.cpp deleted file mode 100644 index c3b00f5198..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/mediactrl.cpp +++ /dev/null @@ -1,1235 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/mediactrl.cpp -// Purpose: Built-in Media Backends for Mac -// Author: Ryan Norton -// Modified by: -// Created: 11/07/04 -// Copyright: (c) 2004-2006 Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -// OK, a casual overseer of this file may wonder why we don't use -// either CreateMovieControl or HIMovieView... -// -// CreateMovieControl -// 1) Need to dispose and create each time a new movie is loaded -// 2) Not that many real advantages -// 3) Progressively buggier in higher OSX versions -// (see main.c of QTCarbonShell sample for details) -// HIMovieView -// 1) Crashes on destruction in ALL cases on quite a few systems! -// (With the only real "alternative" is to simply not -// dispose of it and let it leak...) -// 2) Massive refreshing bugs with its movie controller between -// movies -// -// At one point we had a complete implementation for CreateMovieControl -// and on my (RN) local copy I had one for HIMovieView - but they -// were simply deemed to be too buggy/unuseful. HIMovieView could -// have been useful as well because it uses OpenGL contexts instead -// of GWorlds. Perhaps someday when someone comes out with some -// ingenious workarounds :). -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#if wxUSE_MEDIACTRL - -#include "wx/mediactrl.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/timer.h" -#endif - -#if wxOSX_USE_CARBON -#define USE_QUICKTIME 1 -#else -#define USE_QUICKTIME 0 -#endif - -#if USE_QUICKTIME - -#include "wx/osx/private.h" -#include - -//--------------------------------------------------------------------------- -// Height and Width of movie controller in the movie control (apple samples) -//--------------------------------------------------------------------------- -#define wxMCWIDTH 320 -#define wxMCHEIGHT 16 - -//=========================================================================== -// BACKEND DECLARATIONS -//=========================================================================== - -//--------------------------------------------------------------------------- -// wxQTMediaBackend -//--------------------------------------------------------------------------- - -class WXDLLIMPEXP_MEDIA wxQTMediaBackend : public wxMediaBackendCommonBase -{ -public: - wxQTMediaBackend(); - virtual ~wxQTMediaBackend(); - - virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name); - - virtual bool Load(const wxString& fileName); - virtual bool Load(const wxURI& location); - virtual bool Load(const wxURI& location, - const wxURI& WXUNUSED(proxy)) - { - return Load(location); - } - - virtual bool Play(); - virtual bool Pause(); - virtual bool Stop(); - - virtual wxMediaState GetState(); - - virtual bool SetPosition(wxLongLong where); - virtual wxLongLong GetPosition(); - virtual wxLongLong GetDuration(); - - virtual void Move(int x, int y, int w, int h); - wxSize GetVideoSize() const; - - virtual double GetPlaybackRate(); - virtual bool SetPlaybackRate(double dRate); - - virtual double GetVolume(); - virtual bool SetVolume(double); - - void Cleanup(); - void FinishLoad(); - - virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags); - - virtual wxLongLong GetDownloadProgress(); - virtual wxLongLong GetDownloadTotal(); - - virtual void MacVisibilityChanged(); - - // - // ------ Implementation from now on -------- - // - bool DoPause(); - bool DoStop(); - - void DoLoadBestSize(); - void DoSetControllerVisible(wxMediaCtrlPlayerControls flags); - - wxLongLong GetDataSizeFromStart(TimeValue end); - - Boolean IsQuickTime4Installed(); - void DoNewMovieController(); - - static pascal void PPRMProc( - Movie theMovie, OSErr theErr, void* theRefCon); - - //TODO: Last param actually long - does this work on 64bit machines? - static pascal Boolean MCFilterProc(MovieController theController, - short action, void *params, long refCon); - - static pascal OSStatus WindowEventHandler( - EventHandlerCallRef inHandlerCallRef, - EventRef inEvent, void *inUserData ); - - wxSize m_bestSize; // Original movie size - Movie m_movie; // Movie instance - bool m_bPlaying; // Whether media is playing or not - class wxTimer* m_timer; // Timer for streaming the movie - MovieController m_mc; // MovieController instance - wxMediaCtrlPlayerControls m_interfaceflags; // Saved interface flags - - // Event handlers and UPPs/Callbacks - EventHandlerRef m_windowEventHandler; - EventHandlerUPP m_windowUPP; - - MoviePrePrerollCompleteUPP m_preprerollupp; - MCActionFilterWithRefConUPP m_mcactionupp; - - GWorldPtr m_movieWorld; //Offscreen movie GWorld - - friend class wxQTMediaEvtHandler; - - DECLARE_DYNAMIC_CLASS(wxQTMediaBackend) -}; - -// helper to hijack background erasing for the QT window -class WXDLLIMPEXP_MEDIA wxQTMediaEvtHandler : public wxEvtHandler -{ -public: - wxQTMediaEvtHandler(wxQTMediaBackend *qtb) - { - m_qtb = qtb; - - qtb->m_ctrl->Connect( - qtb->m_ctrl->GetId(), wxEVT_ERASE_BACKGROUND, - wxEraseEventHandler(wxQTMediaEvtHandler::OnEraseBackground), - NULL, this); - } - - void OnEraseBackground(wxEraseEvent& event); - -private: - wxQTMediaBackend *m_qtb; - - wxDECLARE_NO_COPY_CLASS(wxQTMediaEvtHandler); -}; - -//=========================================================================== -// IMPLEMENTATION -//=========================================================================== - - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// -// wxQTMediaBackend -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend) - -//Time between timer calls - this is the Apple recommondation to the TCL -//team I believe -#define MOVIE_DELAY 20 - -//--------------------------------------------------------------------------- -// wxQTMediaLoadTimer -// -// QT, esp. QT for Windows is very picky about how you go about -// async loading. If you were to go through a Windows message loop -// or a MoviesTask or both and then check the movie load state -// it would still return 1000 (loading)... even (pre)prerolling doesn't -// help. However, making a load timer like this works -//--------------------------------------------------------------------------- -class wxQTMediaLoadTimer : public wxTimer -{ -public: - wxQTMediaLoadTimer(wxQTMediaBackend* parent) : - m_parent(parent) {} - - void Notify() - { - ::MCIdle(m_parent->m_mc); - - // kMovieLoadStatePlayable is not enough on MAC: - // it plays, but IsMovieDone might return true (!) - // sure we need to wait until kMovieLoadStatePlaythroughOK - if (::GetMovieLoadState(m_parent->m_movie) >= 20000) - { - m_parent->FinishLoad(); - delete this; - } - } - -protected: - wxQTMediaBackend *m_parent; // Backend pointer -}; - -// -------------------------------------------------------------------------- -// wxQTMediaPlayTimer - Handle Asyncronous Playing -// -// 1) Checks to see if the movie is done, and if not continues -// streaming the movie -// 2) Sends the wxEVT_MEDIA_STOP event if we have reached the end of -// the movie. -// -------------------------------------------------------------------------- -class wxQTMediaPlayTimer : public wxTimer -{ -public: - wxQTMediaPlayTimer(wxQTMediaBackend* parent) : - m_parent(parent) {} - - void Notify() - { - // - // OK, a little explaining - basically originally - // we only called MoviesTask if the movie was actually - // playing (not paused or stopped)... this was before - // we realized MoviesTask actually handles repainting - // of the current frame - so if you were to resize - // or something it would previously not redraw that - // portion of the movie. - // - // So now we call MoviesTask always so that it repaints - // correctly. - // - ::MCIdle(m_parent->m_mc); - - // - // Handle the stop event - if the movie has reached - // the end, notify our handler - // - if (::IsMovieDone(m_parent->m_movie)) - { - if ( m_parent->SendStopEvent() ) - { - m_parent->Stop(); - wxASSERT(::GetMoviesError() == noErr); - - m_parent->QueueFinishEvent(); - } - } - } - -protected: - wxQTMediaBackend* m_parent; // Backend pointer -}; - - -//--------------------------------------------------------------------------- -// wxQTMediaBackend Constructor -// -// Sets m_timer to NULL signifying we havn't loaded anything yet -//--------------------------------------------------------------------------- -wxQTMediaBackend::wxQTMediaBackend() - : m_movie(NULL), m_bPlaying(false), m_timer(NULL) - , m_mc(NULL), m_interfaceflags(wxMEDIACTRLPLAYERCONTROLS_NONE) - , m_preprerollupp(NULL), m_movieWorld(NULL) -{ -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend Destructor -// -// 1) Cleans up the QuickTime movie instance -// 2) Decrements the QuickTime reference counter - if this reaches -// 0, QuickTime shuts down -// 3) Decrements the QuickTime Windows Media Layer reference counter - -// if this reaches 0, QuickTime shuts down the Windows Media Layer -//--------------------------------------------------------------------------- -wxQTMediaBackend::~wxQTMediaBackend() -{ - if (m_movie) - Cleanup(); - - // Cleanup for moviecontroller - if (m_mc) - { - // destroy wxQTMediaEvtHandler we pushed on it - m_ctrl->PopEventHandler(true); - RemoveEventHandler(m_windowEventHandler); - DisposeEventHandlerUPP(m_windowUPP); - - // Dispose of the movie controller - ::DisposeMovieController(m_mc); - m_mc = NULL; - - // Dispose of offscreen GWorld - ::DisposeGWorld(m_movieWorld); - } - - // Note that ExitMovies() is not necessary... - ExitMovies(); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::CreateControl -// -// 1) Intializes QuickTime -// 2) Creates the control window -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::CreateControl( - wxControl* ctrl, - wxWindow* parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxValidator& validator, - const wxString& name) -{ - if (!IsQuickTime4Installed()) - return false; - - EnterMovies(); - - wxMediaCtrl* mediactrl = (wxMediaCtrl*)ctrl; - - // - // Create window - // By default wxWindow(s) is created with a border - - // so we need to get rid of those - // - // Since we don't have a child window like most other - // backends, we don't need wxCLIP_CHILDREN - // - if ( !mediactrl->wxControl::Create( - parent, id, pos, size, - wxWindow::MacRemoveBordersFromStyle(style), - validator, name)) - { - return false; - } - -#if wxUSE_VALIDATORS - mediactrl->SetValidator(validator); -#endif - - m_ctrl = mediactrl; - return true; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::IsQuickTime4Installed -// -// Determines whether version 4 of QT is installed -// (Pretty much for Classic only) -//--------------------------------------------------------------------------- -Boolean wxQTMediaBackend::IsQuickTime4Installed() -{ - OSErr error; - long result; - - error = Gestalt(gestaltQuickTime, &result); - return (error == noErr) && (((result >> 16) & 0xffff) >= 0x0400); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Load (file version) -// -// 1) Get an FSSpec from the Windows path name -// 2) Open the movie -// 3) Obtain the movie instance from the movie resource -// 4) Close the movie resource -// 5) Finish loading -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::Load(const wxString& fileName) -{ - if (m_movie) - Cleanup(); - - ::ClearMoviesStickyError(); // clear previous errors so - // GetMoviesStickyError is useful - - OSErr err = noErr; - short movieResFile; - FSSpec sfFile; - - wxMacFilename2FSSpec( fileName, &sfFile ); - if (OpenMovieFile( &sfFile, &movieResFile, fsRdPerm ) != noErr) - return false; - - short movieResID = 0; - Str255 movieName; - - err = NewMovieFromFile( - &m_movie, - movieResFile, - &movieResID, - movieName, - newMovieActive, - NULL); // wasChanged - - // Do not use ::GetMoviesStickyError() here because it returns -2009 - // a.k.a. invalid track on valid mpegs - if (err == noErr && ::GetMoviesError() == noErr) - { - ::CloseMovieFile(movieResFile); - - // Create movie controller/control - DoNewMovieController(); - - FinishLoad(); - return true; - } - - return false; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Load (URL Version) -// -// 1) Build an escaped URI from location -// 2) Create a handle to store the URI string -// 3) Put the URI string inside the handle -// 4) Make a QuickTime URL data ref from the handle with the URI in it -// 5) Clean up the URI string handle -// 6) Do some prerolling -// 7) Finish Loading -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::Load(const wxURI& location) -{ - if (m_movie) - Cleanup(); - - ::ClearMoviesStickyError(); // clear previous errors so - // GetMoviesStickyError is useful - - wxString theURI = location.BuildURI(); - OSErr err; - - size_t len; - const char* theURIString; - -#if wxUSE_UNICODE - wxCharBuffer buf = wxConvLocal.cWC2MB(theURI.wc_str(), theURI.length(), &len); - theURIString = buf; -#else - theURIString = theURI; - len = theURI.length(); -#endif - - Handle theHandle = ::NewHandleClear(len + 1); - wxASSERT(theHandle); - - ::BlockMoveData(theURIString, *theHandle, len + 1); - - // create the movie from the handle that refers to the URI - err = ::NewMovieFromDataRef( - &m_movie, - newMovieActive | newMovieAsyncOK /* | newMovieIdleImportOK*/, - NULL, theHandle, - URLDataHandlerSubType); - - ::DisposeHandle(theHandle); - - if (err == noErr && ::GetMoviesStickyError() == noErr) - { - // Movie controller resets prerolling, so we must create first - DoNewMovieController(); - - long timeNow; - Fixed playRate; - - timeNow = ::GetMovieTime(m_movie, NULL); - wxASSERT(::GetMoviesError() == noErr); - - playRate = ::GetMoviePreferredRate(m_movie); - wxASSERT(::GetMoviesError() == noErr); - - // - // Note that the callback here is optional, - // but without it PrePrerollMovie can be buggy - // (see Apple ml). Also, some may wonder - // why we need this at all - this is because - // Apple docs say QuickTime streamed movies - // require it if you don't use a Movie Controller, - // which we don't by default. - // - m_preprerollupp = wxQTMediaBackend::PPRMProc; - ::PrePrerollMovie( m_movie, timeNow, playRate, - m_preprerollupp, (void*)this); - - return true; - } - - return false; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::DoNewMovieController -// -// Attaches movie to moviecontroller or creates moviecontroller -// if not created yet -//--------------------------------------------------------------------------- -void wxQTMediaBackend::DoNewMovieController() -{ - if (!m_mc) - { - // Get top level window ref for some mac functions - WindowRef wrTLW = (WindowRef) m_ctrl->MacGetTopLevelWindowRef(); - - // MovieController not set up yet, so we need to create a new one. - // You have to pass a valid movie to NewMovieController, evidently - ::SetMovieGWorld(m_movie, - (CGrafPtr) GetWindowPort(wrTLW), - NULL); - wxASSERT(::GetMoviesError() == noErr); - - Rect bounds = wxMacGetBoundsForControl( - m_ctrl, - m_ctrl->GetPosition(), - m_ctrl->GetSize()); - - m_mc = ::NewMovieController( - m_movie, &bounds, - mcTopLeftMovie | mcNotVisible /* | mcWithFrame */ ); - wxASSERT(::GetMoviesError() == noErr); - - ::MCDoAction(m_mc, 32, (void*)true); // mcActionSetKeysEnabled - wxASSERT(::GetMoviesError() == noErr); - - // Setup a callback so we can tell when the user presses - // play on the player controls - m_mcactionupp = wxQTMediaBackend::MCFilterProc; - ::MCSetActionFilterWithRefCon( m_mc, m_mcactionupp, (long)this ); - wxASSERT(::GetMoviesError() == noErr); - - // Part of a suggestion from Greg Hazel to repaint movie when idle - m_ctrl->PushEventHandler(new wxQTMediaEvtHandler(this)); - - // Create offscreen GWorld for where to "show" when window is hidden - Rect worldRect; - worldRect.left = worldRect.top = 0; - worldRect.right = worldRect.bottom = 1; - ::NewGWorld(&m_movieWorld, 0, &worldRect, NULL, NULL, 0); - - // Catch window messages: - // if we do not do this and if the user clicks the play - // button on the controller, for instance, nothing will happen... - EventTypeSpec theWindowEventTypes[] = - { - { kEventClassMouse, kEventMouseDown }, - { kEventClassMouse, kEventMouseUp }, - { kEventClassMouse, kEventMouseDragged }, - { kEventClassKeyboard, kEventRawKeyDown }, - { kEventClassKeyboard, kEventRawKeyRepeat }, - { kEventClassKeyboard, kEventRawKeyUp }, - { kEventClassWindow, kEventWindowUpdate }, - { kEventClassWindow, kEventWindowActivated }, - { kEventClassWindow, kEventWindowDeactivated } - }; - m_windowUPP = - NewEventHandlerUPP( wxQTMediaBackend::WindowEventHandler ); - InstallWindowEventHandler( - wrTLW, - m_windowUPP, - GetEventTypeCount( theWindowEventTypes ), theWindowEventTypes, - this, - &m_windowEventHandler ); - } - else - { - // MovieController already created: - // Just change the movie in it and we're good to go - Point thePoint; - thePoint.h = thePoint.v = 0; - ::MCSetMovie(m_mc, m_movie, - (WindowRef)m_ctrl->MacGetTopLevelWindowRef(), - thePoint); - wxASSERT(::GetMoviesError() == noErr); - } -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::FinishLoad -// -// Performs operations after a movie ready to play/loaded. -//--------------------------------------------------------------------------- -void wxQTMediaBackend::FinishLoad() -{ - // get the real size of the movie - DoLoadBestSize(); - - // show the player controls if the user wants to - if (m_interfaceflags) - DoSetControllerVisible(m_interfaceflags); - - // we want millisecond precision - ::SetMovieTimeScale(m_movie, 1000); - wxASSERT(::GetMoviesError() == noErr); - - // start movie progress timer - m_timer = new wxQTMediaPlayTimer(this); - wxASSERT(m_timer); - m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS); - - // send loaded event and refresh size - NotifyMovieLoaded(); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::DoLoadBestSize -// -// Sets the best size of the control from the real size of the movie -//--------------------------------------------------------------------------- -void wxQTMediaBackend::DoLoadBestSize() -{ - // get the real size of the movie - Rect outRect; - ::GetMovieNaturalBoundsRect(m_movie, &outRect); - wxASSERT(::GetMoviesError() == noErr); - - // determine best size - m_bestSize.x = outRect.right - outRect.left; - m_bestSize.y = outRect.bottom - outRect.top; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Play -// -// Start the QT movie -// (Apple recommends mcActionPrerollAndPlay but that's QT 4.1+) -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::Play() -{ - Fixed fixRate = (Fixed) (wxQTMediaBackend::GetPlaybackRate() * 0x10000); - if (!fixRate) - fixRate = ::GetMoviePreferredRate(m_movie); - - wxASSERT(fixRate != 0); - - if (!m_bPlaying) - ::MCDoAction( m_mc, 8 /* mcActionPlay */, (void*) fixRate); - - bool result = (::GetMoviesError() == noErr); - if (result) - { - m_bPlaying = true; - QueuePlayEvent(); - } - - return result; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Pause -// -// Stop the movie -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::DoPause() -{ - // Stop the movie A.K.A. ::StopMovie(m_movie); - if (m_bPlaying) - { - ::MCDoAction( m_mc, 8 /*mcActionPlay*/, (void *) 0); - m_bPlaying = false; - return ::GetMoviesError() == noErr; - } - - // already paused - return true; -} - -bool wxQTMediaBackend::Pause() -{ - bool bSuccess = DoPause(); - if (bSuccess) - this->QueuePauseEvent(); - - return bSuccess; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Stop -// -// 1) Stop the movie -// 2) Seek to the beginning of the movie -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::DoStop() -{ - if (!wxQTMediaBackend::DoPause()) - return false; - - ::GoToBeginningOfMovie(m_movie); - return ::GetMoviesError() == noErr; -} - -bool wxQTMediaBackend::Stop() -{ - bool bSuccess = DoStop(); - if (bSuccess) - QueueStopEvent(); - - return bSuccess; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetPlaybackRate -// -// 1) Get the movie playback rate from ::GetMovieRate -//--------------------------------------------------------------------------- -double wxQTMediaBackend::GetPlaybackRate() -{ - return ( ((double)::GetMovieRate(m_movie)) / 0x10000); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::SetPlaybackRate -// -// 1) Convert dRate to Fixed and Set the movie rate through SetMovieRate -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::SetPlaybackRate(double dRate) -{ - ::SetMovieRate(m_movie, (Fixed) (dRate * 0x10000)); - return ::GetMoviesError() == noErr; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::SetPosition -// -// 1) Create a time record struct (TimeRecord) with appropriate values -// 2) Pass struct to SetMovieTime -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::SetPosition(wxLongLong where) -{ - TimeRecord theTimeRecord; - memset(&theTimeRecord, 0, sizeof(TimeRecord)); - theTimeRecord.value.lo = where.GetLo(); - theTimeRecord.value.hi = where.GetHi(); - theTimeRecord.scale = ::GetMovieTimeScale(m_movie); - theTimeRecord.base = ::GetMovieTimeBase(m_movie); - ::SetMovieTime(m_movie, &theTimeRecord); - - if (::GetMoviesError() != noErr) - return false; - - return true; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetPosition -// -// Calls GetMovieTime -//--------------------------------------------------------------------------- -wxLongLong wxQTMediaBackend::GetPosition() -{ - return ::GetMovieTime(m_movie, NULL); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetVolume -// -// Gets the volume through GetMovieVolume - which returns a 16 bit short - -// -// +--------+--------+ -// + (1) + (2) + -// +--------+--------+ -// -// (1) first 8 bits are value before decimal -// (2) second 8 bits are value after decimal -// -// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to -// 1 (full gain and sound) -//--------------------------------------------------------------------------- -double wxQTMediaBackend::GetVolume() -{ - short sVolume = ::GetMovieVolume(m_movie); - - if (sVolume & (128 << 8)) //negative - no sound - return 0.0; - - return sVolume / 256.0; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::SetVolume -// -// Sets the volume through SetMovieVolume - which takes a 16 bit short - -// -// +--------+--------+ -// + (1) + (2) + -// +--------+--------+ -// -// (1) first 8 bits are value before decimal -// (2) second 8 bits are value after decimal -// -// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to -// 1 (full gain and sound) -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::SetVolume(double dVolume) -{ - ::SetMovieVolume(m_movie, (short) (dVolume * 256)); - return true; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetDuration -// -// Calls GetMovieDuration -//--------------------------------------------------------------------------- -wxLongLong wxQTMediaBackend::GetDuration() -{ - return ::GetMovieDuration(m_movie); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetState -// -// Determines the current state - the timer keeps track of whether or not -// we are paused or stopped (if the timer is running we are playing) -//--------------------------------------------------------------------------- -wxMediaState wxQTMediaBackend::GetState() -{ - // Could use - // GetMovieActive/IsMovieDone/SetMovieActive - // combo if implemented that way - if (m_bPlaying) - return wxMEDIASTATE_PLAYING; - else if (!m_movie || wxQTMediaBackend::GetPosition() == 0) - return wxMEDIASTATE_STOPPED; - else - return wxMEDIASTATE_PAUSED; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Cleanup -// -// Diposes of the movie timer, Control if native, and stops and disposes -// of the QT movie -//--------------------------------------------------------------------------- -void wxQTMediaBackend::Cleanup() -{ - m_bPlaying = false; - wxDELETE(m_timer); - - // Stop the movie: - // Apple samples with CreateMovieControl typically - // install a event handler and do this on the dispose - // event, but we do it here for simplicity - // (It might keep playing for several seconds after - // control destruction if not) - wxQTMediaBackend::Pause(); - - // Dispose of control or remove movie from MovieController - Point thePoint; - thePoint.h = thePoint.v = 0; - ::MCSetVisible(m_mc, false); - ::MCSetMovie(m_mc, NULL, NULL, thePoint); - - ::DisposeMovie(m_movie); - m_movie = NULL; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetVideoSize -// -// Returns the actual size of the QT movie -//--------------------------------------------------------------------------- -wxSize wxQTMediaBackend::GetVideoSize() const -{ - return m_bestSize; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::Move -// -// Move the movie controller or movie control -// (we need to actually move the movie control manually...) -// Top 10 things to do with quicktime in March 93's issue -// of DEVELOP - very useful -// http:// www.mactech.com/articles/develop/issue_13/031-033_QuickTime_column.html -// OLD NOTE: Calling MCSetControllerBoundsRect without detaching -// supposively resulted in a crash back then. Current code even -// with CFM classic runs fine. If there is ever a problem, -// take out the if 0 lines below -//--------------------------------------------------------------------------- -void wxQTMediaBackend::Move(int x, int y, int w, int h) -{ - if (m_timer) - { - m_ctrl->GetParent()->MacWindowToRootWindow(&x, &y); - Rect theRect = {y, x, y + h, x + w}; - -#if 0 // see note above - ::MCSetControllerAttached(m_mc, false); - wxASSERT(::GetMoviesError() == noErr); -#endif - - ::MCSetControllerBoundsRect(m_mc, &theRect); - wxASSERT(::GetMoviesError() == noErr); - -#if 0 // see note above - if (m_interfaceflags) - { - ::MCSetVisible(m_mc, true); - wxASSERT(::GetMoviesError() == noErr); - } -#endif - } -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::DoSetControllerVisible -// -// Utility function that takes care of showing the moviecontroller -// and showing/hiding the particular controls on it -//--------------------------------------------------------------------------- -void wxQTMediaBackend::DoSetControllerVisible( - wxMediaCtrlPlayerControls flags) -{ - ::MCSetVisible(m_mc, true); - - // Take care of subcontrols - if (::GetMoviesError() == noErr) - { - long mcFlags = 0; - ::MCDoAction(m_mc, 39/*mcActionGetFlags*/, (void*)&mcFlags); - - if (::GetMoviesError() == noErr) - { - mcFlags |= ( //(1<<0)/*mcFlagSuppressMovieFrame*/ | - (1 << 3)/*mcFlagsUseWindowPalette*/ - | ((flags & wxMEDIACTRLPLAYERCONTROLS_STEP) - ? 0 : (1 << 1)/*mcFlagSuppressStepButtons*/) - | ((flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) - ? 0 : (1 << 2)/*mcFlagSuppressSpeakerButton*/) - //if we take care of repainting ourselves - // | (1 << 4) /*mcFlagDontInvalidate*/ - ); - - ::MCDoAction(m_mc, 38/*mcActionSetFlags*/, (void*)mcFlags); - } - } - - // Adjust height and width of best size for movie controller - // if the user wants it shown - m_bestSize.x = m_bestSize.x > wxMCWIDTH ? m_bestSize.x : wxMCWIDTH; - m_bestSize.y += wxMCHEIGHT; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::ShowPlayerControls -// -// Shows/Hides subcontrols on the media control -//--------------------------------------------------------------------------- -bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) -{ - if (!m_mc) - return false; // no movie controller... - - bool bSizeChanged = false; - - // if the controller is visible and we want to hide it do so - if (m_interfaceflags && !flags) - { - bSizeChanged = true; - DoLoadBestSize(); - ::MCSetVisible(m_mc, false); - } - else if (!m_interfaceflags && flags) // show controller if hidden - { - bSizeChanged = true; - DoSetControllerVisible(flags); - } - - // readjust parent sizers - if (bSizeChanged) - { - NotifyMovieSizeChanged(); - - // remember state in case of loading new media - m_interfaceflags = flags; - } - - return ::GetMoviesError() == noErr; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetDataSizeFromStart -// -// Calls either GetMovieDataSize or GetMovieDataSize64 with a value -// of 0 for the starting value -//--------------------------------------------------------------------------- -wxLongLong wxQTMediaBackend::GetDataSizeFromStart(TimeValue end) -{ -#if 0 // old pre-qt4 way - return ::GetMovieDataSize(m_movie, 0, end) -#else // qt4 way - wide llDataSize; - ::GetMovieDataSize64(m_movie, 0, end, &llDataSize); - return wxLongLong(llDataSize.hi, llDataSize.lo); -#endif -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetDownloadProgress -//--------------------------------------------------------------------------- -wxLongLong wxQTMediaBackend::GetDownloadProgress() -{ -#if 0 // hackish and slow - Handle hMovie = NewHandle(0); - PutMovieIntoHandle(m_movie, hMovie); - long lSize = GetHandleSize(hMovie); - DisposeHandle(hMovie); - - return lSize; -#else - TimeValue tv; - if (::GetMaxLoadedTimeInMovie(m_movie, &tv) != noErr) - { - wxLogDebug(wxT("GetMaxLoadedTimeInMovie failed")); - return 0; - } - - return wxQTMediaBackend::GetDataSizeFromStart(tv); -#endif -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::GetDownloadTotal -//--------------------------------------------------------------------------- -wxLongLong wxQTMediaBackend::GetDownloadTotal() -{ - return wxQTMediaBackend::GetDataSizeFromStart( - ::GetMovieDuration(m_movie) - ); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::MacVisibilityChanged -// -// The main problem here is that Windows quicktime, for example, -// renders more directly to a HWND. Mac quicktime does not do this -// and instead renders to the port of the WindowRef/WindowPtr on top -// of everything else/all other windows. -// -// So, for example, if you were to have a CreateTabsControl/wxNotebook -// and change pages, even if you called HIViewSetVisible/SetControlVisibility -// directly the movie will still continue playing on top of everything else -// if you went to a different tab. -// -// Note that another issue, and why we call MCSetControllerPort instead -// of SetMovieGWorld directly, is that in addition to rendering on -// top of everything else the last created controller steals mouse and -// other input from everything else in the window, including other -// controllers. Setting the port of it releases this behaviour. -//--------------------------------------------------------------------------- -void wxQTMediaBackend::MacVisibilityChanged() -{ - if(!m_mc || !m_ctrl->m_bLoaded) - return; //not initialized yet - - if(m_ctrl->IsShownOnScreen()) - { - //The window is being shown again, so set the GWorld of the - //controller back to the port of the parent WindowRef - WindowRef wrTLW = - (WindowRef) m_ctrl->MacGetTopLevelWindowRef(); - - ::MCSetControllerPort(m_mc, (CGrafPtr) GetWindowPort(wrTLW)); - wxASSERT(::GetMoviesError() == noErr); - } - else - { - //We are being hidden - set the GWorld of the controller - //to the offscreen GWorld - ::MCSetControllerPort(m_mc, m_movieWorld); - wxASSERT(::GetMoviesError() == noErr); - } -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::OnEraseBackground -// -// Suggestion from Greg Hazel to repaint the movie when idle -// (on pause also) -//--------------------------------------------------------------------------- -void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) -{ - // Work around Nasty OSX drawing bug: - // http://lists.apple.com/archives/QuickTime-API/2002/Feb/msg00311.html - WindowRef wrTLW = (WindowRef) m_qtb->m_ctrl->MacGetTopLevelWindowRef(); - - RgnHandle region = ::MCGetControllerBoundsRgn(m_qtb->m_mc); - ::MCInvalidate(m_qtb->m_mc, wrTLW, region); - ::MCIdle(m_qtb->m_mc); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::PPRMProc (static) -// -// Called when done PrePrerolling the movie. -// Note that in 99% of the cases this does nothing... -// Anyway we set up the loading timer here to tell us when the movie is done -//--------------------------------------------------------------------------- -pascal void wxQTMediaBackend::PPRMProc( - Movie theMovie, - OSErr WXUNUSED_UNLESS_DEBUG(theErr), - void* theRefCon) -{ - wxASSERT( theMovie ); - wxASSERT( theRefCon ); - wxASSERT( theErr == noErr ); - - wxQTMediaBackend* pBE = (wxQTMediaBackend*) theRefCon; - - long lTime = ::GetMovieTime(theMovie,NULL); - Fixed rate = ::GetMoviePreferredRate(theMovie); - ::PrerollMovie(theMovie,lTime,rate); - pBE->m_timer = new wxQTMediaLoadTimer(pBE); - pBE->m_timer->Start(MOVIE_DELAY); -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::MCFilterProc (static) -// -// Callback for when the movie controller receives a message -//--------------------------------------------------------------------------- -pascal Boolean wxQTMediaBackend::MCFilterProc( - MovieController WXUNUSED(theController), - short action, - void * WXUNUSED(params), - long refCon) -{ - wxQTMediaBackend* pThis = (wxQTMediaBackend*)refCon; - - switch (action) - { - case 1: - // don't process idle events - break; - - case 8: - // play button triggered - MC will set movie to opposite state - // of current - playing ? paused : playing - pThis->m_bPlaying = !(pThis->m_bPlaying); - break; - - default: - break; - } - - return 0; -} - -//--------------------------------------------------------------------------- -// wxQTMediaBackend::WindowEventHandler [static] -// -// Event callback for the top level window of our control that passes -// messages to our moviecontroller so it can receive mouse clicks etc. -//--------------------------------------------------------------------------- -pascal OSStatus wxQTMediaBackend::WindowEventHandler( - EventHandlerCallRef WXUNUSED(inHandlerCallRef), - EventRef inEvent, - void *inUserData) -{ - wxQTMediaBackend* be = (wxQTMediaBackend*) inUserData; - - // Only process keyboard messages on this window if it actually - // has focus, otherwise it will steal keystrokes from other windows! - // As well as when it is not loaded properly as it - // will crash in MCIsPlayerEvent - if((GetEventClass(inEvent) == kEventClassKeyboard && - wxWindow::FindFocus() != be->m_ctrl) - || !be->m_ctrl->m_bLoaded) - return eventNotHandledErr; - - // Pass the event onto the movie controller - EventRecord theEvent; - ConvertEventRefToEventRecord( inEvent, &theEvent ); - OSStatus err; - - // TODO: Apple says MCIsPlayerEvent is depreciated and - // MCClick, MCKey, MCIdle etc. should be used - // (RN: Of course that's what they say about - // CreateMovieControl and HIMovieView as well, LOL!) - err = ::MCIsPlayerEvent( be->m_mc, &theEvent ); - - // Pass on to other event handlers if not handled- i.e. wx - if (err != noErr) - return noErr; - else - return eventNotHandledErr; -} - -#endif - -// in source file that contains stuff you don't directly use -#include "wx/html/forcelnk.h" -FORCE_LINK_ME(basewxmediabackends) - -#endif // wxUSE_MEDIACTRL diff --git a/Externals/wxWidgets3/src/osx/carbon/menu.cpp b/Externals/wxWidgets3/src/osx/carbon/menu.cpp deleted file mode 100644 index 06a703dfd4..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/menu.cpp +++ /dev/null @@ -1,436 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/menu.cpp -// Purpose: wxMenu, wxMenuBar, wxMenuItem -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// headers & declarations -// ============================================================================ - -// wxWidgets headers -// ----------------- - -#include "wx/wxprec.h" - -#include "wx/menu.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/frame.h" - #include "wx/menuitem.h" -#endif - -#include "wx/osx/private.h" -#include "wx/stockitem.h" - -// other standard headers -// ---------------------- -#include - -// under carbon there's no such thing as a MenuItemRef, everything is done -// on the 'parent' menu via index APIs (first line having index 1 !) -// so to make things still work, we store the wxMenuItemImpl instance as a -// RefCon at the respective menu line - -class wxMenuItemCarbonImpl : public wxMenuItemImpl -{ -public : - wxMenuItemCarbonImpl( wxMenuItem* peer ) : wxMenuItemImpl(peer) - { - // the parent menu ref is only set, once the item has been attached - m_parentMenuRef = NULL; - } - - ~wxMenuItemCarbonImpl(); - - void SetBitmap( const wxBitmap& bitmap ) - { - MenuItemIndex i = FindMenuItemIndex() ; - if ( i > 0 ) - { - if ( bitmap.IsOk() ) - { -#if wxUSE_BMPBUTTON - ControlButtonContentInfo info ; - wxMacCreateBitmapButton( &info , bitmap ) ; - if ( info.contentType != kControlNoContent ) - { - if ( info.contentType == kControlContentIconRef ) - SetMenuItemIconHandle( m_parentMenuRef, i , - kMenuIconRefType , (Handle) info.u.iconRef ) ; - else if ( info.contentType == kControlContentCGImageRef ) - SetMenuItemIconHandle( m_parentMenuRef, i , - kMenuCGImageRefType , (Handle) info.u.imageRef ) ; - } - wxMacReleaseBitmapButton( &info ) ; -#endif - } - } - } - - void Enable( bool enable ) - { - MenuItemIndex i = FindMenuItemIndex() ; - if ( i > 0 ) - { - - if ( GetWXPeer()->GetId() == wxApp::s_macPreferencesMenuItemId) - { - if ( enable ) - EnableMenuCommand( NULL , kHICommandPreferences ) ; - else - DisableMenuCommand( NULL , kHICommandPreferences ) ; - } - else if ( GetWXPeer()->GetId() == wxApp::s_macExitMenuItemId) - { - if ( enable ) - EnableMenuCommand( NULL , kHICommandQuit ) ; - else - DisableMenuCommand( NULL , kHICommandQuit ) ; - } - - if ( enable ) - EnableMenuItem(m_parentMenuRef , i); - else - DisableMenuItem(m_parentMenuRef , i); - - if ( GetWXPeer()->IsSubMenu() ) - { - UMAEnableMenuItem( GetWXPeer()->GetSubMenu()->GetHMenu() , 0 , enable ) ; - } - } - } - - void Check( bool check ) - { - MenuItemIndex i = FindMenuItemIndex() ; - if ( i > 0 ) - { - if ( check ) - ::SetItemMark( m_parentMenuRef, i, 0x12 ) ; // checkmark - else - ::SetItemMark( m_parentMenuRef, i, 0 ) ; // no mark - } - } - - void Hide( bool hide ) - { - MenuItemIndex i = FindMenuItemIndex() ; - if ( i > 0 ) - { - if ( hide ) - ChangeMenuItemAttributes( m_parentMenuRef, i, kMenuItemAttrHidden, 0 ); - else - ChangeMenuItemAttributes( m_parentMenuRef, i, 0 , kMenuItemAttrHidden ); - } - } - - void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) - { - MenuItemIndex i = FindMenuItemIndex() ; - if ( i > 0 ) - { - SetMenuItemTextWithCFString( m_parentMenuRef, i, wxCFStringRef(text)); - UMASetMenuItemShortcut( m_parentMenuRef, i , entry ) ; - } - } - - void * GetHMenuItem() { return NULL; } - - // Carbon Only - - void AttachToParent( MenuRef parentMenuRef, MenuItemIndex index ) - { - m_parentMenuRef = parentMenuRef; - if ( m_parentMenuRef && index > 0 ) - SetMenuItemRefCon( m_parentMenuRef, index, (URefCon) m_peer ); - } - - MenuItemIndex FindMenuItemIndex() - { - MenuItemIndex hit = 0 ; - if ( m_parentMenuRef ) - { - for ( MenuItemIndex i = 1 ; i <= CountMenuItems(m_parentMenuRef) ; ++i ) - { - URefCon storedRef = 0; - GetMenuItemRefCon(m_parentMenuRef, i, &storedRef ); - if ( storedRef == (URefCon) m_peer ) - { - hit = i; - break; - } - } - } - return hit; - } -protected : - MenuRef m_parentMenuRef; -} ; - -// -// wxMenuImpl -// - -class wxMenuCarbonImpl : public wxMenuImpl -{ -public : - wxMenuCarbonImpl( wxMenu* peer , MenuRef menu , MenuRef oldMenu , SInt16 menuId) - : wxMenuImpl(peer), m_osxMenu(menu), m_oldMenuRef(oldMenu), m_menuId(menuId) - { - } - - virtual ~wxMenuCarbonImpl(); - - virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) - { - // MacOS counts menu items from 1 and inserts after, therefore having the - // same effect as wx 0 based and inserting before, we must correct pos - // after however for updates to be correct - - MenuItemIndex index = pos; - if ( pos == (size_t) -1 ) - index = CountMenuItems(m_osxMenu); - - if ( pItem->IsSeparator() ) - { - InsertMenuItemTextWithCFString( m_osxMenu, CFSTR(""), index, kMenuItemAttrSeparator, 0); - // now switch to the Carbon 1 based counting - index += 1 ; - } - else - { - InsertMenuItemTextWithCFString( m_osxMenu, CFSTR("placeholder"), index, 0, 0 ); - - // now switch to the Carbon 1 based counting - index += 1 ; - if ( pItem->IsSubMenu() ) - { - MenuRef submenu = pItem->GetSubMenu()->GetHMenu(); - SetMenuItemHierarchicalMenu(m_osxMenu, index, submenu); - // carbon is using the title of the submenu, eg in the menubar - SetMenuTitleWithCFString(submenu, wxCFStringRef(pItem->GetItemLabelText())); - } - else - { - SetMenuItemCommandID( m_osxMenu, index , wxIdToMacCommand(pItem->GetId()) ) ; - } - } - - wxMenuItemCarbonImpl* impl = (wxMenuItemCarbonImpl*) pItem->GetPeer(); - impl->AttachToParent( m_osxMenu, index ); - // only now can all settings be updated correctly - pItem->UpdateItemText(); - pItem->UpdateItemStatus(); - pItem->UpdateItemBitmap(); - } - - virtual void Remove( wxMenuItem *pItem ) - { - wxMenuItemCarbonImpl* impl = (wxMenuItemCarbonImpl*) pItem->GetPeer(); - if ( impl ) - { - MenuItemIndex i = impl->FindMenuItemIndex(); - if ( i > 0 ) - { - DeleteMenuItem(m_osxMenu , i); - impl->AttachToParent( NULL, 0 ); - } - } - } - - virtual void MakeRoot() - { - SetRootMenu( m_osxMenu ); - } - - virtual void SetTitle( const wxString& text ) - { - SetMenuTitleWithCFString(m_osxMenu, wxCFStringRef(text)); - } - - WXHMENU GetHMenu() { return m_osxMenu; } - - virtual void PopUp( wxWindow *WXUNUSED(win), int x, int y ) - { - long menuResult = ::PopUpMenuSelect(m_osxMenu, y, x, 0) ; - if ( HiWord(menuResult) != 0 ) - { - MenuCommand macid; - GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &macid ); - int id = wxMacCommandToId( macid ); - wxMenuItem* item = NULL ; - wxMenu* realmenu ; - item = m_peer->FindItem( id, &realmenu ) ; - if ( item ) - { - m_peer->HandleCommandProcess(item, NULL ); - } - } - } - - static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); - static wxMenuImpl* CreateRootMenu( wxMenu* peer ); -protected : - wxCFRef m_osxMenu; - MenuRef m_oldMenuRef; - SInt16 m_menuId; -} ; - -// static const short kwxMacAppleMenuId = 1 ; - -// Find an item given the Macintosh Menu Reference - -WX_DECLARE_HASH_MAP(WXHMENU, wxMenu*, wxPointerHash, wxPointerEqual, MacMenuMap); - -static MacMenuMap wxWinMacMenuList; - -wxMenu *wxFindMenuFromMacMenu(WXHMENU inMenuRef) -{ - MacMenuMap::iterator node = wxWinMacMenuList.find(inMenuRef); - - return (node == wxWinMacMenuList.end()) ? NULL : node->second; -} - -void wxAssociateMenuWithMacMenu(WXHMENU inMenuRef, wxMenu *menu) ; -void wxAssociateMenuWithMacMenu(WXHMENU inMenuRef, wxMenu *menu) -{ - // adding NULL MenuRef is (first) surely a result of an error and - // (secondly) breaks menu command processing - wxCHECK_RET( inMenuRef != (WXHMENU) NULL, wxT("attempt to add a NULL MenuRef to menu list") ); - - wxWinMacMenuList[inMenuRef] = menu; -} - -void wxRemoveMacMenuAssociation(wxMenu *menu) ; -void wxRemoveMacMenuAssociation(wxMenu *menu) -{ - // iterate over all the elements in the class - MacMenuMap::iterator it; - for ( it = wxWinMacMenuList.begin(); it != wxWinMacMenuList.end(); ++it ) - { - if ( it->second == menu ) - { - wxWinMacMenuList.erase(it); - break; - } - } -} - -wxMenuCarbonImpl::~wxMenuCarbonImpl() -{ - wxRemoveMacMenuAssociation( GetWXPeer() ); - // restore previous menu - m_osxMenu.reset(); - if ( m_menuId > 0 ) - MacDeleteMenu(m_menuId); - if ( m_oldMenuRef ) - MacInsertMenu(m_oldMenuRef, -1); -} - -wxMenuImpl* wxMenuImpl::Create( wxMenu* peer, const wxString& title ) -{ - // create the menu - static SInt16 s_macNextMenuId = 3; - SInt16 menuId = s_macNextMenuId++; - // save existing menu in case we're embedding into an application - // or sharing outside UI elements. - WXHMENU oldMenu = GetMenuHandle(menuId); - if ( oldMenu ) - MacDeleteMenu(menuId); - WXHMENU menu = NULL; - CreateNewMenu( menuId , 0 , &menu ) ; - if ( !menu ) - { - wxLogLastError(wxT("CreateNewMenu failed")); - if ( oldMenu ) - MacInsertMenu(oldMenu, -1); - return NULL; - } - - wxMenuImpl* c = new wxMenuCarbonImpl( peer, menu, oldMenu, menuId ); - c->SetTitle(title); - wxAssociateMenuWithMacMenu( menu , peer ) ; - return c; -} - -// -// -// - -wxMenuItemCarbonImpl::~wxMenuItemCarbonImpl() -{ -} - - -wxMenuItemImpl* wxMenuItemImpl::Create( wxMenuItem* peer, - wxMenu * WXUNUSED(pParentMenu), - int WXUNUSED(id), - const wxString& WXUNUSED(text), - wxAcceleratorEntry *WXUNUSED(entry), - const wxString& WXUNUSED(strHelp), - wxItemKind WXUNUSED(kind), - wxMenu *WXUNUSED(pSubMenu) ) -{ - wxMenuItemImpl* c = NULL; - - c = new wxMenuItemCarbonImpl( peer ); - return c; -} - -void wxInsertMenuItemsInMenu(wxMenu* menu, MenuRef wm, MenuItemIndex insertAfter) -{ - wxMenuItemList::compatibility_iterator node; - wxMenuItem *item; - wxMenu *subMenu = NULL ; - bool newItems = false; - - for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext()) - { - item = (wxMenuItem *)node->GetData(); - subMenu = item->GetSubMenu() ; - if (subMenu) - { - wxInsertMenuItemsInMenu(subMenu, (MenuRef)subMenu->GetHMenu(), 0); - } - if ( item->IsSeparator() ) - { - if ( wm && newItems) - InsertMenuItemTextWithCFString( wm, - CFSTR(""), insertAfter, kMenuItemAttrSeparator, 0); - - newItems = false; - } - else - { - wxAcceleratorEntry* - entry = wxAcceleratorEntry::Create( item->GetItemLabel() ) ; - - MenuItemIndex winListPos = (MenuItemIndex)-1; - OSStatus err = GetIndMenuItemWithCommandID(wm, - wxIdToMacCommand ( item->GetId() ), 1, NULL, &winListPos); - - if ( wm && err == menuItemNotFoundErr ) - { - // NB: the only way to determine whether or not we should add - // a separator is to know if we've added menu items to the menu - // before the separator. - newItems = true; - UMAInsertMenuItem(wm, wxStripMenuCodes(item->GetItemLabel()) , wxFont::GetDefaultEncoding(), insertAfter, entry); - SetMenuItemCommandID( wm , insertAfter+1 , wxIdToMacCommand ( item->GetId() ) ) ; - SetMenuItemRefCon( wm , insertAfter+1 , (URefCon) item ) ; - } - - delete entry ; - } - } -} - - diff --git a/Externals/wxWidgets3/src/osx/carbon/menuitem.cpp b/Externals/wxWidgets3/src/osx/carbon/menuitem.cpp deleted file mode 100644 index b2ea37bbed..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/menuitem.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/menuitem.cpp -// Purpose: wxMenuItem implementation -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/menuitem.h" -#include "wx/stockitem.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/menu.h" -#endif // WX_PRECOMP - -#include "wx/osx/private.h" - -// because on mac carbon everything is done through MenuRef APIs both implementation -// classes are in menu.cpp diff --git a/Externals/wxWidgets3/src/osx/carbon/metafile.cpp b/Externals/wxWidgets3/src/osx/carbon/metafile.cpp index 1e03af7f34..5232166c38 100644 --- a/Externals/wxWidgets3/src/osx/carbon/metafile.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/metafile.cpp @@ -30,9 +30,9 @@ #include #include -IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC) -IMPLEMENT_ABSTRACT_CLASS(wxMetafileDCImpl, wxGCDCImpl) +wxIMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject); +wxIMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC); +wxIMPLEMENT_ABSTRACT_CLASS(wxMetafileDCImpl, wxGCDCImpl); #define M_METAFILEREFDATA( a ) ((wxMetafileRefData*)(a).GetRefData()) @@ -53,7 +53,7 @@ public: virtual ~wxMetafileRefData(); - virtual bool IsOk() const { return m_data != NULL; } + virtual bool IsOk() const wxOVERRIDE { return m_data != NULL; } void Init(); diff --git a/Externals/wxWidgets3/src/osx/carbon/mimetmac.cpp b/Externals/wxWidgets3/src/osx/carbon/mimetmac.cpp deleted file mode 100644 index aebcb41396..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/mimetmac.cpp +++ /dev/null @@ -1,1958 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/mimetmac.cpp -// Purpose: Mac Carbon implementation for wx MIME-related classes -// Author: Ryan Norton -// Modified by: -// Created: 04/16/2005 -// Copyright: (c) 2005 Ryan Norton () -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// -// TODO: Search Info[-macos](classic).plist dictionary in addition -// to Internet Config database. -// -// Maybe try a brainstorm a way to change the wxMimeTypesManager API -// to get info from a file instead/addition to current get all stuff -// API so that we can use Launch Services to get MIME type info. -// -// Implement GetIcon from one of the FinderInfo functions - or -// use Launch Services and search that app's plist for the icon. -// -// Put some special juice in for the print command. -// - -// for compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_MIMETYPE - -#include "wx/osx/mimetype.h" - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/string.h" - #include "wx/intl.h" - #include "wx/log.h" - - #if wxUSE_GUI - #include "wx/icon.h" - #endif -#endif - -#include "wx/file.h" -#include "wx/confbase.h" - -#include "wx/osx/private.h" - -// other standard headers -#include - -#ifndef __DARWIN__ - #include - #include -#endif - -#ifndef __LP64__ -// START CODE SAMPLE FROM TECHNOTE 1002 (http://developer.apple.com/technotes/tn/tn1002.html) - -// IsRemoteVolume can be used to find out if the -// volume referred to by vRefNum is a remote volume -// located somewhere on a network. the volume's attribute -// flags (copied from the GetVolParmsInfoBuffer structure) -// are returned in the longword pointed to by vMAttrib. -OSErr IsRemoteVolume(short vRefNum, Boolean *isRemote, long *vMAttrib) -{ - HParamBlockRec volPB; - GetVolParmsInfoBuffer volinfo; - OSErr err; - - volPB.ioParam.ioVRefNum = vRefNum; - volPB.ioParam.ioNamePtr = NULL; - volPB.ioParam.ioBuffer = (Ptr)&volinfo; - volPB.ioParam.ioReqCount = sizeof(volinfo); - err = PBHGetVolParmsSync( &volPB ); - if (err == noErr) - { - *isRemote = (volinfo.vMServerAdr != 0); - *vMAttrib = volinfo.vMAttrib; - } - - return err; -} - -// BuildVolumeList fills the array pointed to by vols with -// a list of the currently mounted volumes. If includeRemote -// is true, then remote server volumes will be included in -// the list. When remote server volumes are included in the -// list, they will be added to the end of the list. On entry, -// *count should contain the size of the array pointed to by -// vols. On exit, *count will be set to the number of id numbers -// placed in the array. If vMAttribMask is non-zero, then -// only volumes with matching attributes are added to the -// list of volumes. bits in the vMAttribMask should use the -// same encoding as bits in the vMAttrib field of -// the GetVolParmsInfoBuffer structure. -OSErr BuildVolumeList(Boolean includeRemote, short *vols, - long *count, long vMAttribMask) -{ - HParamBlockRec volPB; - Boolean isRemote; - OSErr err = noErr; - long nlocal, nremote; - long vMAttrib; - - // set up and check parameters - volPB.volumeParam.ioNamePtr = NULL; - nlocal = nremote = 0; - if (*count == 0) - return noErr; - - // iterate through volumes - for (volPB.volumeParam.ioVolIndex = 1; - PBHGetVInfoSync(&volPB) == noErr; - volPB.volumeParam.ioVolIndex++) - { - // skip remote volumes, if necessary - err = IsRemoteVolume(volPB.volumeParam.ioVRefNum, &isRemote, &vMAttrib); - if (err != noErr) - goto bail; - - if ((includeRemote || !isRemote) && ((vMAttrib & vMAttribMask) == vMAttribMask)) - { - // add local volumes at the front; remote volumes at the end - if (isRemote) - vols[nlocal + nremote++] = volPB.volumeParam.ioVRefNum; - else - { - if (nremote > 0) - BlockMoveData( - vols + nlocal, - vols + nlocal + 1, - nremote * sizeof(short) ); - vols[nlocal++] = volPB.volumeParam.ioVRefNum; - } - - // list full? - if ((nlocal + nremote) >= *count) - break; - } - } - -bail: - *count = (nlocal + nremote); - - return err; -} - - -// FindApplication iterates through mounted volumes -// searching for an application with the given creator -// type. If includeRemote is true, then remote volumes -// will be searched (after local ones) for an application -// with the creator type. -// -// Hacked to output to appName -// -#define kMaxVols 20 - -OSErr FindApplication(OSType appCreator, Boolean includeRemote, Str255 appName, FSSpec* appSpec) -{ - short rRefNums[kMaxVols]; - long i, volCount; - DTPBRec desktopPB; - OSErr err; - - // get a list of volumes - with desktop files - volCount = kMaxVols; - err = BuildVolumeList(includeRemote, rRefNums, &volCount, (1 << bHasDesktopMgr) ); - if (err != noErr) - return err; - - // iterate through the list - for (i=0; iname[0] == 0 ) - { - result = FSMakeFSSpecCompat(spec->vRefNum, spec->parID, spec->name, &tempSpec); - } - else - { -#endif - - // Make a copy of the input FSSpec that can be modified - BlockMoveData( spec, &tempSpec, sizeof(FSSpec) ); - - if ( result == noErr ) - { - if ( tempSpec.parID == fsRtParID ) - { - // object is a volume - // Add a colon to make it a full pathname - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - - // We're done - result = PtrToHand(&tempSpec.name[1], fullPath, tempSpec.name[0]); - } - else - { - // object isn't a volume - - // Is the object a file or a directory? - pb.dirInfo.ioNamePtr = tempSpec.name; - pb.dirInfo.ioVRefNum = tempSpec.vRefNum; - pb.dirInfo.ioDrDirID = tempSpec.parID; - pb.dirInfo.ioFDirIndex = 0; - result = PBGetCatInfoSync( &pb ); - - // Allow file/directory name at end of path to not exist. - realResult = result; - if ((result == noErr) || (result == fnfErr)) - { - // if the object is a directory, append a colon so full pathname ends with colon - if ((result == noErr) && (pb.hFileInfo.ioFlAttrib & kioFlAttribDirMask) != 0) - { - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - } - - // Put the object name in first - result = PtrToHand( &tempSpec.name[1], fullPath, tempSpec.name[0] ); - if ( result == noErr ) - { - // Get the ancestor directory names - pb.dirInfo.ioNamePtr = tempSpec.name; - pb.dirInfo.ioVRefNum = tempSpec.vRefNum; - pb.dirInfo.ioDrParID = tempSpec.parID; - - // loop until we have an error or find the root directory - do - { - pb.dirInfo.ioFDirIndex = -1; - pb.dirInfo.ioDrDirID = pb.dirInfo.ioDrParID; - result = PBGetCatInfoSync(&pb); - if ( result == noErr ) - { - // Append colon to directory name - ++tempSpec.name[0]; - tempSpec.name[tempSpec.name[0]] = ':'; - - // Add directory name to beginning of fullPath - (void)Munger(*fullPath, 0, NULL, 0, &tempSpec.name[1], tempSpec.name[0]); - result = MemError(); - } - } - while ( (result == noErr) && (pb.dirInfo.ioDrDirID != fsRtDirID) ); - } - } - } - } - - if ( result == noErr ) - { - // Return the length - *fullPathLength = GetHandleSize( *fullPath ); - result = realResult; // return realResult in case it was fnfErr - } - else - { - // Dispose of the handle and return NULL and zero length - if ( *fullPath != NULL ) - { - DisposeHandle( *fullPath ); - *fullPath = NULL; - } - *fullPathLength = 0; - } - - return result; -} -#endif // LP64 -// -// On the mac there are two ways to open a file - one is through apple events and the -// finder, another is through mime types. -// -// So, really there are two ways to implement wxFileType... -// -// Mime types are only available on OS 8.1+ through the InternetConfig API -// -// Much like the old-style file manager, it has 3 levels of flexibility for its methods - -// Low - which means you have to iterate yourself through the mime database -// Medium - which lets you sort of cache the database if you want to use lowlevel functions -// High - which requires access to the database every time -// -// We want to be efficient (i.e. professional :) ) about it, so we use a combo of low -// and mid-level functions -// -// TODO: Should we call ICBegin/ICEnd? Then where? -// - -// debug helper -inline void wxLogMimeDebug(const wxChar* WXUNUSED_UNLESS_DEBUG(szMsg), OSStatus WXUNUSED_UNLESS_DEBUG(status)) -{ - wxLogDebug(wxString::Format(wxT("%s LINE:%i OSERROR:%i"), szMsg, __LINE__, (int)status)); -} - -// in case we're compiling in non-GUI mode -class WXDLLIMPEXP_FWD_CORE wxIcon; - -bool wxFileTypeImpl::SetCommand(const wxString& WXUNUSED(cmd), const wxString& WXUNUSED(verb), bool WXUNUSED(overwriteprompt)) -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - return false; -} - -bool wxFileTypeImpl::SetDefaultIcon(const wxString& WXUNUSED(strIcon), int WXUNUSED(index)) -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - return false; -} - -bool wxFileTypeImpl::GetOpenCommand(wxString *openCmd, - const wxFileType::MessageParameters& params) const -{ - wxString cmd = GetCommand(wxT("open")); - - *openCmd = wxFileType::ExpandCommand(cmd, params); - - return !openCmd->empty(); -} - -bool -wxFileTypeImpl::GetPrintCommand( - wxString *printCmd, - const wxFileType::MessageParameters& params) const -{ - wxString cmd = GetCommand(wxT("print")); - - *printCmd = wxFileType::ExpandCommand(cmd, params); - - return !printCmd->empty(); -} - -// -// Internet Config vs. Launch Services -// -// From OS 8 on there was internet config... -// However, OSX and its finder does not use info -// from Internet Config at all - the Internet Config -// database ONLY CONTAINS APPS THAT ARE CLASSIC APPS -// OR REGISTERED THROUGH INTERNET CONFIG -// -// Therefore on OSX in order for the open command to be useful -// we need to go straight to launch services -// - -//on darwin, use launch services - -#include - -wxString wxFileTypeImpl::GetCommand(const wxString& verb) const -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - if (verb == wxT("open")) - { - ICMapEntry entry; - ICGetMapEntry( (ICInstance) m_manager->m_hIC, - (Handle) m_manager->m_hDatabase, - m_lIndex, &entry); - - wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension); - sCurrentExtension = sCurrentExtension.Right(sCurrentExtension.length()-1 ); - - //type, creator, ext, roles, outapp (FSRef), outappurl - CFURLRef cfurlAppPath; - OSStatus status = LSGetApplicationForInfo( kLSUnknownType, - kLSUnknownCreator, - wxCFStringRef(sCurrentExtension, wxLocale::GetSystemEncoding()), - kLSRolesAll, - NULL, - &cfurlAppPath ); - - if (status == noErr) - { - CFStringRef cfsUnixPath = CFURLCopyFileSystemPath(cfurlAppPath, kCFURLPOSIXPathStyle); - CFRelease(cfurlAppPath); - - // PHEW! Success! - // Since a filename might have spaces in it, so surround it with quotes - if (cfsUnixPath) - { - wxString resultStr; - - resultStr = - wxString(wxT("'")) - + wxCFStringRef(cfsUnixPath).AsString(wxLocale::GetSystemEncoding()) - + wxString(wxT("'")); - - return resultStr; - } - } - else - { - wxLogDebug(wxString::Format(wxT("%i - %s - %i"), - __LINE__, - wxT("LSGetApplicationForInfo failed."), - (int)status)); - } - } - - return wxEmptyString; -} - -bool wxFileTypeImpl::GetDescription(wxString *desc) const -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - ICMapEntry entry; - ICGetMapEntry( (ICInstance) m_manager->m_hIC, - (Handle) m_manager->m_hDatabase, m_lIndex, &entry ); - - *desc = wxMacMakeStringFromPascal( entry.entryName ); - - return true; -} - -bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions) -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - ICMapEntry entry; - ICGetMapEntry( (ICInstance) m_manager->m_hIC, - (Handle) m_manager->m_hDatabase, m_lIndex, &entry ); - - //entry has period in it - wxString sCurrentExtension = wxMacMakeStringFromPascal( entry.extension ); - extensions.Add( sCurrentExtension.Right( sCurrentExtension.length() - 1 ) ); - - return true; -} - -bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - ICMapEntry entry; - ICGetMapEntry( (ICInstance) m_manager->m_hIC, - (Handle) m_manager->m_hDatabase, m_lIndex, &entry ); - - *mimeType = wxMacMakeStringFromPascal(entry.MIMEType); - - return true; -} - -bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const -{ - wxString s; - - if (GetMimeType(&s)) - { - mimeTypes.Clear(); - mimeTypes.Add(s); - - return true; - } - - return false; -} - -bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - // no such file type or no value or incorrect icon entry - return false; -} - -size_t wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, - wxArrayString * commands, - const wxFileType::MessageParameters& params) const -{ - wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); - - wxString sCommand; - size_t ulCount = 0; - - if (GetOpenCommand(&sCommand, params)) - { - verbs->Add(wxString(wxT("open"))); - commands->Add(sCommand); - ++ulCount; - } - - return ulCount; -} - -void wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles), const wxString& WXUNUSED(extraDir)) -{ - wxASSERT_MSG(m_hIC == NULL, wxT("Already initialized wxMimeTypesManager!")); - - // some apps (non-wx) use the 'plst' resource instead -#if 0 - CFBundleRef cfbMain = CFBundleGetMainBundle(); - wxCFDictionary cfdInfo( CFBundleGetInfoDictionary(cfbMain), wxCF_RETAIN ); - wxString sLog; - cfdInfo.PrintOut(sLog); - wxLogDebug(sLog); -#endif - - // start Internet Config - log if there's an error - // the second param is the signature of the application, also known - // as resource ID 0. However, as per some recent discussions, we may not - // have a signature for this app, so a generic 'APPL' which is the executable - // type will work for now. - OSStatus status = ICStart( (ICInstance*)&m_hIC, 'APPL' ); - - if (status != noErr) - { - wxLogDebug(wxT("Could not initialize wxMimeTypesManager!")); - wxFAIL; - m_hIC = NULL; - - return; - } - - ICAttr attr; - m_hDatabase = (void**) NewHandle(0); - status = ICFindPrefHandle( (ICInstance) m_hIC, kICMapping, &attr, (Handle) m_hDatabase ); - - //the database file can be corrupt (on OSX its - //~/Library/Preferences/com.apple.internetconfig.plist) - //- bail if it is - if (status != noErr) - { - ClearData(); - wxLogDebug(wxT("Corrupt MIME database!")); - return; - } - - //obtain the number of entries in the map - status = ICCountMapEntries( (ICInstance) m_hIC, (Handle) m_hDatabase, &m_lCount ); - wxASSERT( status == noErr ); - -#if 0 - //debug stuff - ICMapEntry entry; - long pos; - - for (long i = 1; i <= m_lCount; ++i) - { - OSStatus status = ICGetIndMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, i, &pos, &entry ); - - if (status == noErr) - { - wxString sCreator = wxMacMakeStringFromPascal(entry.creatorAppName); - wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension); - wxString sMIMEType = wxMacMakeStringFromPascal(entry.MIMEType); - - wxFileTypeImpl impl; - impl.Init(this, pos); - - if (sMIMEType == wxT("text/html") && sCurrentExtension == wxT(".html")) - { - wxString cmd; - - impl.GetOpenCommand( &cmd, wxFileType::MessageParameters (wxT("http://www.google.com"))); - wxPrintf(wxT("APP: [%s]\n"), cmd.c_str()); - } - } - } -#endif -} - -void wxMimeTypesManagerImpl::ClearData() -{ - if (m_hIC != NULL) - { - DisposeHandle( (Handle)m_hDatabase ); - - // this can return an error, but we don't really care that much about it - ICStop( (ICInstance)m_hIC ); - m_hIC = NULL; - } -} - -// -// Q) Iterating through the map - why does it use if (err == noErr) instead of just asserting? -// A) Some intermediate indexes are bad while subsequent ones may be good. Its weird, I know. -// - -// extension -> file type -wxFileType* wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e) -{ - wxASSERT_MSG( m_hIC != NULL, wxT("wxMimeTypesManager not Initialized!") ); - - //low level functions - iterate through the database - ICMapEntry entry; - long pos; - - for (long i = 1; i <= m_lCount; ++i) - { - OSStatus status = ICGetIndMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, i, &pos, &entry ); - - if (status == noErr) - { - wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension); - if ( sCurrentExtension.Right(sCurrentExtension.length() - 1) == e ) // entry has period in it - { - wxFileType* pFileType = new wxFileType(); - pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos); - - return pFileType; - } - } - } - - return NULL; -} - -// MIME type -> extension -> file type -wxFileType* wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) -{ - wxASSERT_MSG( m_hIC != NULL, wxT("wxMimeTypesManager not Initialized!") ); - - ICMapEntry entry; - long pos; - - // low level functions - iterate through the database - for (long i = 1; i <= m_lCount; ++i) - { - OSStatus status = ICGetIndMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, i, &pos, &entry ); - wxASSERT_MSG( status == noErr, wxString::Format(wxT("Error: %d"), (int)status) ); - - if (status == noErr) - { - if ( wxMacMakeStringFromPascal(entry.MIMEType) == mimeType) - { - wxFileType* pFileType = new wxFileType(); - pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos); - - return pFileType; - } - } - } - - return NULL; -} - -size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) -{ - wxASSERT_MSG( m_hIC != NULL, wxT("wxMimeTypesManager not Initialized!") ); - - ICMapEntry entry; - long pos, lStartCount; - - // low level functions - iterate through the database - lStartCount = (long) mimetypes.GetCount(); - for (long i = 1; i <= m_lCount; ++i) - { - OSStatus status = ICGetIndMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, i, &pos, &entry ); - if ( status == noErr ) - mimetypes.Add( wxMacMakeStringFromPascal(entry.MIMEType) ); - } - - return mimetypes.GetCount() - lStartCount; -} - -pascal OSStatus MoreProcGetProcessTypeSignature( - const ProcessSerialNumberPtr pPSN, - OSType *pProcessType, - OSType *pCreator) -{ - OSStatus anErr = noErr; - ProcessInfoRec infoRec; - ProcessSerialNumber localPSN; - - infoRec.processInfoLength = sizeof(ProcessInfoRec); - infoRec.processName = NULL; -#ifndef __LP64__ - infoRec.processAppSpec = NULL; -#endif - - if ( pPSN == NULL ) - { - localPSN.highLongOfPSN = 0; - localPSN.lowLongOfPSN = kCurrentProcess; - } - else - { - localPSN = *pPSN; - } - - anErr = GetProcessInformation(&localPSN, &infoRec); - if (anErr == noErr) - { - *pProcessType = infoRec.processType; - *pCreator = infoRec.processSignature; - } - - return anErr; -} - -// -// -// TODO: clean this up, its messy -// -// -// - -#include "wx/osx/core/cfstring.h" - -#define wxCF_RELEASE true -#define wxCF_RETAIN false - -// ---------------------------------------------------------------------------- -// wxCFDictionary -// ---------------------------------------------------------------------------- - -class wxCFDictionary -{ -public: - wxCFDictionary(CFTypeRef ref) - { - m_cfmdRef = (CFMutableDictionaryRef) ref; - } - - wxCFDictionary(CFIndex cfiSize = 0) - { - CFDictionaryKeyCallBacks kcbs; - CFDictionaryValueCallBacks vcbs; - BuildKeyCallbacks(&kcbs); - BuildValueCallbacks(&vcbs); - - m_cfmdRef = CFDictionaryCreateMutable( - kCFAllocatorDefault, cfiSize, &kcbs, &vcbs ); - } - - ~wxCFDictionary() - { Clear(); } - - void Clear() - { - if (m_cfmdRef) - CFRelease(m_cfmdRef); - } - - static const void* RetainProc(CFAllocatorRef, const void* v) - { return (const void*) CFRetain(v); } - - static void ReleaseProc(CFAllocatorRef, const void* v) - { CFRelease(v); } - - void MakeMutable(CFIndex cfiSize = 0) - { - CFDictionaryRef oldref = (CFDictionaryRef) m_cfmdRef; - - m_cfmdRef = CFDictionaryCreateMutableCopy( - kCFAllocatorDefault, cfiSize, oldref ); - - CFRelease( oldref ); - } - - void BuildKeyCallbacks(CFDictionaryKeyCallBacks* pCbs) - { - pCbs->version = 0; - pCbs->retain = RetainProc; - pCbs->release = ReleaseProc; - pCbs->copyDescription = NULL; - pCbs->equal = NULL; - pCbs->hash = NULL; - } - - void BuildValueCallbacks(CFDictionaryValueCallBacks* pCbs) - { - pCbs->version = 0; - pCbs->retain = RetainProc; - pCbs->release = ReleaseProc; - pCbs->copyDescription = NULL; - pCbs->equal = NULL; - } - - operator CFTypeRef () const - { return (CFTypeRef)m_cfmdRef; } - - CFDictionaryRef GetCFDictionary() const - { return (CFDictionaryRef)m_cfmdRef; } - - CFMutableDictionaryRef GetCFMutableDictionary() - { return (CFMutableDictionaryRef) m_cfmdRef; } - - CFTypeRef operator [] (CFTypeRef cftEntry) const - { - wxASSERT(IsValid()); - return (CFTypeRef) CFDictionaryGetValue((CFDictionaryRef)m_cfmdRef, cftEntry); - } - - CFIndex GetCount() const - { - wxASSERT(IsValid()); - return CFDictionaryGetCount((CFDictionaryRef)m_cfmdRef); - } - - void Add(CFTypeRef cftKey, CFTypeRef cftValue) - { - wxASSERT(IsValid()); - wxASSERT(Exists(cftKey) == false); - CFDictionaryAddValue(m_cfmdRef, cftKey, cftValue); - } - - void Remove(CFTypeRef cftKey) - { - wxASSERT(IsValid()); - wxASSERT(Exists(cftKey)); - CFDictionaryRemoveValue(m_cfmdRef, cftKey); - } - - void Set(CFTypeRef cftKey, CFTypeRef cftValue) - { - wxASSERT(IsValid()); - wxASSERT(Exists(cftKey)); - CFDictionarySetValue(m_cfmdRef, cftKey, cftValue); - } - - bool Exists(CFTypeRef cftKey) const - { - wxASSERT(IsValid()); - return CFDictionaryContainsKey((CFDictionaryRef)m_cfmdRef, cftKey); - } - - bool IsOk() const - { return m_cfmdRef != NULL; } - - bool IsValid() const - { return IsOk() && CFGetTypeID((CFTypeRef)m_cfmdRef) == CFDictionaryGetTypeID(); } - - void PrintOut(wxString& sMessage) - { - PrintOutDictionary(sMessage, m_cfmdRef); - } - - static void PrintOutDictionary(wxString& sMessage, CFDictionaryRef cfdRef) - { - CFIndex cfiCount = CFDictionaryGetCount(cfdRef); - CFTypeRef* pKeys = new CFTypeRef[cfiCount]; - CFTypeRef* pValues = new CFTypeRef[cfiCount]; - - CFDictionaryGetKeysAndValues(cfdRef, pKeys, pValues); - - for (CFIndex i = 0; i < cfiCount; ++i) - { - wxString sKey = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID(pKeys[i]))).AsString(); - wxString sValue = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID(pValues[i]))).AsString(); - - sMessage << - wxString::Format(wxT("[{#%d} Key : %s]"), (int) i, - sKey.c_str()); - - PrintOutType(sMessage, sKey, pKeys[i]); - - sMessage << - wxString::Format(wxT("\n\t[Value : %s]"), - sValue.c_str()); - - PrintOutType(sMessage, sValue, pValues[i]); - - sMessage << wxT("\n"); - } - - delete [] pKeys; - delete [] pValues; - } - - static void PrintOutArray(wxString& sMessage, CFArrayRef cfaRef) - { - for (CFIndex i = 0; i < CFArrayGetCount(cfaRef); ++i) - { - wxString sValue = wxCFStringRef(CFCopyTypeIDDescription(CFGetTypeID( - CFArrayGetValueAtIndex(cfaRef, i) - ))).AsString(); - - sMessage << - wxString::Format(wxT("\t\t[{#%d} ArrayValue : %s]\n"), (int) i, - sValue.c_str()); - - PrintOutType(sMessage, sValue, CFArrayGetValueAtIndex(cfaRef, i)); - } - } - - static void PrintOutType(wxString& sMessage, const wxString& sValue, CFTypeRef cfRef) - { - sMessage << wxT(" {"); - - if (sValue == wxT("CFString")) - { - sMessage << wxCFStringRef(wxCFRetain((CFStringRef)cfRef)).AsString(); - } - else if (sValue == wxT("CFNumber")) - { - int nOut; - CFNumberGetValue((CFNumberRef)cfRef, kCFNumberIntType, &nOut); - sMessage << nOut; - } - else if (sValue == wxT("CFDictionary")) - { - PrintOutDictionary(sMessage, (CFDictionaryRef)cfRef); - } - else if (sValue == wxT("CFArray")) - { - PrintOutArray(sMessage, (CFArrayRef)cfRef); - } - else if (sValue == wxT("CFBoolean")) - { - sMessage << (cfRef == kCFBooleanTrue ? wxT("true") : wxT("false")); - } - else if (sValue == wxT("CFURL")) - { - sMessage << wxCFStringRef(CFURLCopyPath((CFURLRef) cfRef)).AsString(); - } - else - { - sMessage << wxT("*****UNKNOWN TYPE******"); - } - - sMessage << wxT("} "); - } - -#if wxUSE_MIMETYPE - void MakeValidXML(); -#endif - - CFTypeRef WriteAsXML() - { - return CFPropertyListCreateXMLData(kCFAllocatorDefault, m_cfmdRef); - } - - bool ReadAsXML(CFTypeRef cfData, wxString* pErrorMsg = NULL) - { - Clear(); - CFStringRef cfsError=NULL; - m_cfmdRef = (CFMutableDictionaryRef) CFPropertyListCreateFromXMLData( - kCFAllocatorDefault, - (CFDataRef)cfData, - kCFPropertyListMutableContainersAndLeaves, - &cfsError ); - if (cfsError) - { - if (pErrorMsg) - *pErrorMsg = wxCFStringRef(cfsError).AsString(); - else - CFRelease(cfsError); - } - - return m_cfmdRef != NULL; - } - -private: - CFMutableDictionaryRef m_cfmdRef; -}; - -// ---------------------------------------------------------------------------- -// wxCFArray -// ---------------------------------------------------------------------------- - -class wxCFArray -{ -public: - wxCFArray(CFTypeRef ref) - { - m_cfmaRef = (CFMutableArrayRef)ref; - } - - wxCFArray(CFIndex cfiSize = 0) : m_cfmaRef(NULL) - { Create(cfiSize); } - - ~wxCFArray() - { Clear(); } - - void MakeMutable(CFIndex cfiSize = 0) - { - wxASSERT(IsValid()); - - CFMutableArrayRef oldref = m_cfmaRef; - m_cfmaRef = CFArrayCreateMutableCopy( - kCFAllocatorDefault, - cfiSize, - (CFArrayRef)oldref); - CFRelease(oldref); - } - - void BuildCallbacks(CFArrayCallBacks* pCbs) - { - pCbs->version = 0; - pCbs->retain = RetainProc; - pCbs->release = ReleaseProc; - pCbs->copyDescription = NULL; - pCbs->equal = NULL; - } - - void Create(CFIndex cfiSize = 0) - { - Clear(); - CFArrayCallBacks cb; - BuildCallbacks(&cb); - - m_cfmaRef = CFArrayCreateMutable(kCFAllocatorDefault, cfiSize, &cb); - } - - void Clear() - { if (m_cfmaRef) CFRelease(m_cfmaRef); } - - static const void* RetainProc(CFAllocatorRef, const void* v) - { return (const void*) CFRetain(v); } - - static void ReleaseProc(CFAllocatorRef, const void* v) - { CFRelease(v); } - - operator CFTypeRef () const - { return (CFTypeRef)m_cfmaRef; } - - CFArrayRef GetCFArray() const - { return (CFArrayRef)m_cfmaRef; } - - CFMutableArrayRef GetCFMutableArray() - { return (CFMutableArrayRef) m_cfmaRef; } - - CFTypeRef operator [] (CFIndex cfiIndex) const - { - wxASSERT(IsValid()); - return (CFTypeRef) CFArrayGetValueAtIndex((CFArrayRef)m_cfmaRef, cfiIndex); - } - - CFIndex GetCount() - { - wxASSERT(IsValid()); - return CFArrayGetCount((CFArrayRef)m_cfmaRef); - } - - void Add(CFTypeRef cftValue) - { - wxASSERT(IsValid()); - CFArrayAppendValue(m_cfmaRef, cftValue); - } - - void Remove(CFIndex cfiIndex) - { - wxASSERT(IsValid()); - wxASSERT(cfiIndex < GetCount()); - CFArrayRemoveValueAtIndex(m_cfmaRef, cfiIndex); - } - - void Set(CFIndex cfiIndex, CFTypeRef cftValue) - { - wxASSERT(IsValid()); - wxASSERT(cfiIndex < GetCount()); - CFArraySetValueAtIndex(m_cfmaRef, cfiIndex, cftValue); - } - - bool IsOk() const - { return m_cfmaRef != NULL; } - - bool IsValid() const - { - return IsOk() && CFGetTypeID((CFTypeRef)m_cfmaRef) == CFArrayGetTypeID(); - } - -#if wxUSE_MIMETYPE - void MakeValidXML(); -#endif - -private: - CFMutableArrayRef m_cfmaRef; -}; - -// ---------------------------------------------------------------------------- -// wxCFNumber -// ---------------------------------------------------------------------------- - -class wxCFNumber -{ -public: - wxCFNumber(int nValue) - { - m_cfnRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &nValue); - } - - wxCFNumber(CFTypeRef ref) : m_cfnRef((CFNumberRef)ref) - { - } - - virtual ~wxCFNumber() - { - if (m_cfnRef) - CFRelease(m_cfnRef); - } - - operator CFTypeRef() const - { return (CFTypeRef) m_cfnRef; } - - int GetValue() - { - int nOut; - CFNumberGetValue( m_cfnRef, kCFNumberIntType, &nOut ); - - return nOut; - } - - bool IsOk() - { return m_cfnRef != NULL; } - -private: - CFNumberRef m_cfnRef; -}; - -// ---------------------------------------------------------------------------- -// wxCFURL -// ---------------------------------------------------------------------------- - -class wxCFURL -{ -public: - wxCFURL(CFTypeRef ref = NULL) : m_cfurlRef((CFURLRef)ref) - { - } - - wxCFURL(const wxCFStringRef& URLString, CFTypeRef BaseURL = NULL) - { - Create(URLString, BaseURL); - } - - void Create(const wxCFStringRef& URLString, CFTypeRef BaseURL = NULL) - { - m_cfurlRef = CFURLCreateWithString( - kCFAllocatorDefault, - (CFStringRef)(CFTypeRef)URLString, - (CFURLRef) BaseURL); - } - - virtual ~wxCFURL() - { - if (m_cfurlRef) - CFRelease(m_cfurlRef); - } - - wxString BuildWXString() - { - return wxCFStringRef(CFURLCopyPath(m_cfurlRef)).AsString(); - } - - operator CFTypeRef() const - { return (CFTypeRef)m_cfurlRef; } - - bool IsOk() - { return m_cfurlRef != NULL; } - -private: - CFURLRef m_cfurlRef; -}; - -// ---------------------------------------------------------------------------- -// wxCFData -// ---------------------------------------------------------------------------- - -#define wxCFDATA_RELEASEBUFFER 1 - -class wxCFData -{ -public: - wxCFData(CFTypeRef ref) : m_cfdaRef((CFDataRef)ref) - { - } - - wxCFData(const UInt8* pBytes, CFIndex len, bool bKeep = wxCFDATA_RELEASEBUFFER) - { - if (bKeep == wxCFDATA_RELEASEBUFFER) - { - m_cfdaRef = CFDataCreateWithBytesNoCopy - (kCFAllocatorDefault, pBytes, len, kCFAllocatorDefault); - } - else - { - m_cfdaRef = CFDataCreate(kCFAllocatorDefault, pBytes, len); - } - } - - virtual ~wxCFData() - { - if (m_cfdaRef) - CFRelease(m_cfdaRef); - } - - const UInt8* GetValue() - { return CFDataGetBytePtr(m_cfdaRef); } - - CFIndex GetCount() - { return CFDataGetLength(m_cfdaRef); } - - operator CFTypeRef() const - { return (CFTypeRef)m_cfdaRef; } - - bool IsOk() - { return m_cfdaRef != NULL; } - -private: - CFDataRef m_cfdaRef; -}; - -void wxCFDictionary::MakeValidXML() -{ - CFIndex cfiCount = GetCount(); - CFTypeRef* pKeys = new CFTypeRef[cfiCount]; - CFTypeRef* pValues = new CFTypeRef[cfiCount]; - - CFDictionaryGetKeysAndValues(m_cfmdRef, pKeys, pValues); - - // for plist xml format, all dictionary keys must be cfstrings and - // no values in the dictionary or subkeys/values can be NULL; - // additionally, CFURLs are not allowed - for (CFIndex i = 0; i < cfiCount; ++i) - { - // must be an array, dictionary, string, bool, or int and cannot be null - // and dictionaries can only contain cfstring keys - CFTypeRef cfRef = pValues[i]; - if (!pKeys[i] || - CFGetTypeID(pKeys[i]) != CFStringGetTypeID() || - !cfRef) - { - Remove(pKeys[i]); - --i; - --cfiCount; - delete [] pKeys; - delete [] pValues; - pKeys = new CFTypeRef[cfiCount]; - pValues = new CFTypeRef[cfiCount]; - CFDictionaryGetKeysAndValues(m_cfmdRef, pKeys, pValues); - } - else if (CFGetTypeID(cfRef) == CFArrayGetTypeID()) - { - CFRetain(cfRef); - wxCFArray cfaCurrent(cfRef); - cfaCurrent.MakeMutable(); - cfaCurrent.MakeValidXML(); - Set(pKeys[i], cfaCurrent); - } - else if (CFGetTypeID(cfRef) == CFDictionaryGetTypeID()) - { - CFRetain(cfRef); - wxCFDictionary cfdCurrent(cfRef); - cfdCurrent.MakeMutable(); - cfdCurrent.MakeValidXML(); - Set(pKeys[i], cfdCurrent); - } - else if ( CFGetTypeID(cfRef) != CFStringGetTypeID() && - CFGetTypeID(cfRef) != CFNumberGetTypeID() && - CFGetTypeID(cfRef) != CFBooleanGetTypeID() ) - { - Remove(pKeys[i]); - --i; - --cfiCount; - delete [] pKeys; - delete [] pValues; - pKeys = new CFTypeRef[cfiCount]; - pValues = new CFTypeRef[cfiCount]; - CFDictionaryGetKeysAndValues(m_cfmdRef, pKeys, pValues); - } - } - - delete [] pValues; - delete [] pKeys; -} - -void wxCFArray::MakeValidXML() -{ - for (CFIndex i = 0; i < GetCount(); ++i) - { - //must be an array, dictionary, string, bool, or int and cannot be null - //and dictionaries can only contain cfstring keys - CFTypeRef cfRef = (*this)[i]; - if (!cfRef) - { - Remove(i); - --i; - } - else if (CFGetTypeID(cfRef) == CFArrayGetTypeID()) - { - CFRetain(cfRef); - wxCFArray cfaCurrent(cfRef); - cfaCurrent.MakeMutable(); - cfaCurrent.MakeValidXML(); - Set(i, cfaCurrent); - } - else if (CFGetTypeID(cfRef) == CFDictionaryGetTypeID()) - { - CFRetain(cfRef); - wxCFDictionary cfdCurrent(cfRef); - cfdCurrent.MakeMutable(); - cfdCurrent.MakeValidXML(); - Set(i, cfdCurrent); - } - else if ( CFGetTypeID(cfRef) != CFStringGetTypeID() && - CFGetTypeID(cfRef) != CFNumberGetTypeID() && - CFGetTypeID(cfRef) != CFBooleanGetTypeID() ) - { - Remove(i); - --i; - } - } -} - -// -// -// -// END TODO -// -// -// - -wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) -{ - bool bInfoSuccess = false; - - const wxArrayString& asExtensions = ftInfo.GetExtensions(); - size_t dwFoundIndex = 0; - if (!asExtensions.GetCount()) - { - wxLogDebug(wxT("Must have extension to associate with")); - } - - // Find and write to Info.plist in main bundle (note that some other - // apps have theirs named differently, i.e. IE's is named Info-macos.plist - // some apps (non-wx) use the 'plst' resource instead - CFBundleRef cfbMain = CFBundleGetMainBundle(); - if (cfbMain) - { - UInt32 dwBundleType, dwBundleCreator; - CFBundleGetPackageInfo(cfbMain, &dwBundleType, &dwBundleCreator); - - // if launching terminal non-app, version will be 'BNDL' (generic bundle, maybe in other cases too), - // which will give us the incorrect info.plist path - // otherwise it will be 'APPL', or in the case of a framework, 'FMWK' - if (dwBundleType == 'APPL') - { - wxCFURL cfurlBundleLoc((CFTypeRef)CFBundleCopyBundleURL(cfbMain)); -// wxCFURL cfurlBundleLoc((CFTypeRef)CFBundleCopyExecutableURL(cfbMain)); - wxString sInfoPath; -// sInfoPath << wxT("file://"); - sInfoPath << cfurlBundleLoc.BuildWXString(); - sInfoPath << wxT("Contents/Info.plist"); - -// wxCFDictionary cfdInfo( CFBundleGetInfoDictionary(cfbMain), wxCF_RETAIN ); - wxCFDictionary cfdInfo; - bool bInfoOpenSuccess = false; - wxFile indictfile; - if (indictfile.Open(sInfoPath, wxFile::read)) - { - CFIndex cfiBufLen = (CFIndex) indictfile.Length(); - const UInt8* pBuffer = new UInt8[cfiBufLen]; - indictfile.Read((void*)pBuffer, cfiBufLen); - wxCFData cfdaInDict(pBuffer, cfiBufLen); - wxString sError; - bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError); - if (!bInfoOpenSuccess) - { - wxLogDebug(sError); - } - indictfile.Close(); - } - - if (bInfoOpenSuccess) - { - cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 ); - - wxCFArray cfaDocTypes( wxCFRetain( cfdInfo[ wxCFStringRef(wxT("CFBundleDocumentTypes")) ] ) ); - - bool bAddDocTypesArrayToDictionary = !cfaDocTypes.IsOk(); - if (bAddDocTypesArrayToDictionary) - cfaDocTypes.Create(); - else - cfaDocTypes.MakeMutable( cfaDocTypes.GetCount() + 1 ); - - bool bEntryFound = false; - - // search for duplicates - CFIndex i; - for (i = 0; i < cfaDocTypes.GetCount(); ++i) - { - wxCFDictionary cfdDocTypeEntry( wxCFRetain( cfaDocTypes[i] ) ); - - // A lot of apps don't support MIME types for some reason - // so we go by extensions only - wxCFArray cfaExtensions( wxCFRetain( cfdDocTypeEntry[ wxCFStringRef(wxT("CFBundleTypeExtensions")) ] ) ); - - if (!cfaExtensions.IsOk()) - continue; - - for (CFIndex iExt = 0; iExt < cfaExtensions.GetCount(); ++iExt) - { - for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt) - { - if (asExtensions[iWXExt] == - wxCFStringRef( wxCFRetain( (CFStringRef) cfaExtensions[iExt] ) ).AsString()) - { - bEntryFound = true; - dwFoundIndex = iWXExt; - - break; - } - } //end of wxstring array - - if (bEntryFound) - break; - } //end for cf array - - if (bEntryFound) - break; - } //end for doctypes - - wxCFDictionary cfdNewEntry; - - if (!ftInfo.GetDescription().empty()) - { - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeName")), - wxCFStringRef(ftInfo.GetDescription()) ); - } - - if (!ftInfo.GetIconFile().empty()) - { - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeIconFile")), - wxCFStringRef(ftInfo.GetIconFile()) ); - } - - wxCFArray cfaOSTypes; - wxCFArray cfaExtensions; - wxCFArray cfaMimeTypes; - - //OSTypes is a cfarray of four-char-codes - '****' for unrestricted - cfaOSTypes.Add( wxCFStringRef(wxT("****")) ); - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeOSTypes")), cfaOSTypes ); - - //'*' for unrestricted - if (ftInfo.GetExtensionsCount() != 0) - { - for (size_t iExtension = 0; iExtension < ftInfo.GetExtensionsCount(); ++iExtension) - { - cfaExtensions.Add( wxCFStringRef( asExtensions[iExtension] ) ); - } - - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeExtensions")), cfaExtensions ); - } - - if (!ftInfo.GetMimeType().empty()) - { - cfaMimeTypes.Add( wxCFStringRef(ftInfo.GetMimeType()) ); - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeMIMETypes")), cfaMimeTypes ); - } - - // Editor - can perform all actions - // Viewer - all actions except manipulation/saving - // None - can perform no actions - cfdNewEntry.Add( wxCFStringRef(wxT("CFBundleTypeRole")), wxCFStringRef(wxT("Editor")) ); - - // Is application bundled? - cfdNewEntry.Add( wxCFStringRef(wxT("LSTypeIsPackage")), kCFBooleanTrue ); - - if (bEntryFound) - cfaDocTypes.Set(i, cfdNewEntry); - else - cfaDocTypes.Add(cfdNewEntry); - - // set the doc types array in the muted dictionary - if (bAddDocTypesArrayToDictionary) - cfdInfo.Add(wxCFStringRef(wxT("CFBundleDocumentTypes")), cfaDocTypes); - else - cfdInfo.Set(wxCFStringRef(wxT("CFBundleDocumentTypes")), cfaDocTypes); - - cfdInfo.MakeValidXML(); - - wxFile outdictfile; - if (outdictfile.Open(sInfoPath, wxFile::write)) - { - wxCFData cfdaInfo(cfdInfo.WriteAsXML()); - if (cfdaInfo.IsOk()) - { - if (outdictfile.Write(cfdaInfo.GetValue(), cfdaInfo.GetCount()) != - (wxFileOffset)cfdaInfo.GetCount()) - { - wxLogDebug(wxT("error in writing to file")); - } - else - { - bInfoSuccess = true; - -//#if defined(__DARWIN__) -// //force launch services to update its database for the finder -// OSStatus status = LSRegisterURL((CFURLRef)(CFTypeRef)cfurlBundleLoc, true); -// if (status != noErr) -// { -// wxLogDebug(wxT("LSRegisterURL Failed.")); -// } -//#endif - } - outdictfile.Close(); - } - else - { - outdictfile.Close(); - wxLogDebug(wxT("Could not read in new dictionary")); - } - } - else - { - wxLogDebug(wxString(wxT("Could not open [")) + - sInfoPath + wxT("] for writing.")); - } - } - else - { - wxLogDebug(wxT("No info dictionary in main bundle")); - } - } - else - { - wxLogDebug(wxT("Can only call associate from bundled app within XXX.app")); - } - } - else - { - wxLogDebug(wxT("No main bundle")); - } - - if (!bInfoSuccess) - return NULL; - - // on mac you have to embed it into the mac's file reference resource ('FREF' I believe) - // or, alternately, you could just add an entry to m_hDatabase, but you'd need to get - // the app's signature somehow... - - OSType processType, creator; - OSStatus status = MoreProcGetProcessTypeSignature(NULL, &processType, &creator); - - if (status == noErr) - { - Str255 psCreatorName; -#ifndef __LP64__ - FSSpec dummySpec; - status = FindApplication(creator, false, psCreatorName, &dummySpec); -#else - FSRef fsref; - status = LSFindApplicationForInfo( creator, NULL, NULL, &fsref ,NULL); - HFSUniStr255 name; - status = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, &name, NULL, NULL); - CFStringRef str = FSCreateStringFromHFSUniStr( 0 , &name ); - CFStringGetPascalString(str, psCreatorName, 256, CFStringGetSystemEncoding()); - CFRelease( str ); -#endif - - if (status == noErr) - { - //get the file type if it exists - - //if it really does then modify the database then save it, - //otherwise we need to create a whole new entry - wxFileType* pFileType = GetFileTypeFromExtension(asExtensions[dwFoundIndex]); - if (pFileType) - { - ICMapEntry entry; - ICGetMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, - pFileType->m_impl->m_lIndex, &entry ); - - memcpy(entry.creatorAppName, psCreatorName, sizeof(Str255)); - entry.fileCreator = creator; - - status = ICSetMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, - pFileType->m_impl->m_lIndex, &entry ); - - //success - if (status == noErr) - { - return pFileType; - - //kICAttrNoChange means we don't care about attributes such as - //locking in the database -// status = ICSetPrefHandle((ICInstance) m_hIC, kICMapping, -// kICAttrNoChange, (Handle) m_hDatabase); -// if (status == noErr) -// return pFileType; -// else -// { -// wxLogDebug(wxString::Format(wxT("%i - %s"), (int)status, wxT("ICSetPrefHandle failed."))); -// } - } - else - { - wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICSetMapEntry failed."))); - } - - // failure - cleanup - delete pFileType; - } - else - { - // TODO: Maybe force all 3 of these to be non-empty? - Str255 psExtension, psMimeType, psDescription; - - wxMacStringToPascal(wxString(wxT(".")) + ftInfo.GetExtensions()[0], psExtension); - wxMacStringToPascal(ftInfo.GetMimeType(), psMimeType); - wxMacStringToPascal(ftInfo.GetDescription(), psDescription); - - Str255 psPostCreatorName; - wxMacStringToPascal(wxEmptyString, psPostCreatorName); - - //add the entry to the database - ICMapEntry entry; - entry.totalLength = sizeof(ICMapEntry); - entry.fixedLength = kICMapFixedLength; - entry.version = 0; - entry.fileType = 0; //TODO: File type? - entry.fileCreator = creator; - entry.postCreator = 0; - entry.flags = kICMapDataForkBit; //TODO: Maybe resource is valid by default too? - PLstrcpy( entry.extension , psExtension ) ; - memcpy(entry.creatorAppName, psCreatorName, sizeof(Str255)); - memcpy(entry.postAppName, psPostCreatorName, sizeof(Str255)); - memcpy(entry.MIMEType, psMimeType, sizeof(Str255)); - memcpy(entry.entryName, psDescription, sizeof(Str255)); - - status = ICAddMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, &entry); - if (status == noErr) - { - return GetFileTypeFromExtension(ftInfo.GetMimeType()); - -// kICAttrNoChange means we don't care about attributes such as -// locking in the database -// status = ICSetPrefHandle((ICInstance) m_hIC, kICMapping, -// kICAttrNoChange, (Handle) m_hDatabase); - - // return the entry in the database if successful -// if (status == noErr) -// return GetFileTypeFromExtension(ftInfo.GetMimeType()); -// else -// { -// wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICSetPrefHandle failed."))); - // } - } - else - { - wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICAppMapEntry failed."))); - } - } - } // end if FindApplcation was successful - else - { - wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("FindApplication failed."))); - } - } // end if it could obtain app's signature - else - { - wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("GetProcessSignature failed."))); - } - - return NULL; -} - -bool -wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType) -{ - wxASSERT(pFileType); - bool bInfoSuccess = false; - - wxArrayString asExtensions; - pFileType->GetExtensions(asExtensions); - - if (!asExtensions.GetCount()) - { - wxLogDebug(wxT("Must have extension to disassociate")); - return false; - } - - // Find and write to Info.plist in main bundle (note that some other - // apps have theirs named differently, i.e. IE's is named Info-macos.plist - // some apps (non-wx) use the 'plst' resource instead - CFBundleRef cfbMain = CFBundleGetMainBundle(); - if (cfbMain) - { - UInt32 dwBundleType, dwBundleCreator; - CFBundleGetPackageInfo(cfbMain, &dwBundleType, &dwBundleCreator); - - // if launching terminal non-app, version will be 'BNDL' (generic bundle, maybe in other cases too), - // which will give us the incorrect info.plist path - // otherwise it will be 'APPL', or in the case of a framework, 'FMWK' - if (dwBundleType == 'APPL') - { - - wxCFURL cfurlBundleLoc((CFTypeRef)CFBundleCopyBundleURL(cfbMain)); -// wxCFURL cfurlBundleLoc((CFTypeRef)CFBundleCopyExecutableURL(cfbMain)); - wxString sInfoPath; -// sInfoPath << wxT("file://"); - sInfoPath << cfurlBundleLoc.BuildWXString(); - sInfoPath << wxT("Contents/Info.plist"); - -// wxCFDictionary cfdInfo( (CFTypeRef) CFBundleGetInfoDictionary(cfbMain), wxCF_RETAIN ); - wxCFDictionary cfdInfo; - bool bInfoOpenSuccess = false; - wxFile indictfile; - if (indictfile.Open(sInfoPath, wxFile::read)) - { - CFIndex cfiBufLen = (CFIndex) indictfile.Length(); - const UInt8* pBuffer = new UInt8[cfiBufLen]; - indictfile.Read((void*)pBuffer, cfiBufLen); - wxCFData cfdaInDict(pBuffer, cfiBufLen); - wxString sError; - bInfoOpenSuccess = cfdInfo.ReadAsXML(cfdaInDict, &sError); - if (!bInfoOpenSuccess) - { - wxLogDebug(sError); - } - indictfile.Close(); - } - - if (bInfoOpenSuccess) - { - cfdInfo.MakeMutable( cfdInfo.GetCount() + 1 ); - - wxCFArray cfaDocTypes( wxCFRetain( cfdInfo[ wxCFStringRef(wxT("CFBundleDocumentTypes")) ] ) ); - - if (cfaDocTypes.IsOk()) - { - bool bEntryFound = false; - - //search for duplicate - CFIndex i; - for (i = 0; i < cfaDocTypes.GetCount(); ++i) - { - wxCFDictionary cfdDocTypeEntry( wxCFRetain( cfaDocTypes[i] ) ); - - //A lot of apps dont do to mime types for some reason - //so we go by extensions only - wxCFArray cfaExtensions( wxCFRetain( cfdDocTypeEntry[ wxCFStringRef(wxT("CFBundleTypeExtensions")) ]) ); - - if (!cfaExtensions.IsOk()) - continue; - - for (CFIndex iExt = 0; iExt < cfaExtensions.GetCount(); ++iExt) - { - for (size_t iWXExt = 0; iWXExt < asExtensions.GetCount(); ++iWXExt) - { - if (asExtensions[iWXExt] == - wxCFStringRef( wxCFRetain( (CFStringRef) cfaExtensions[iExt] ) ).AsString()) - { - bEntryFound = true; - cfaDocTypes.Remove(i); - cfdInfo.Set( wxCFStringRef(wxT("CFBundleDocumentTypes")) , cfaDocTypes ); - break; - } - } //end of wxstring array - - if (bEntryFound) - break; - } //end for cf array - - if (bEntryFound) - break; - }//end for doctypes - - if (bEntryFound) - { - cfdInfo.MakeValidXML(); - - wxFile outdictfile; - if (outdictfile.Open(sInfoPath, wxFile::write)) - { - wxCFData cfdaInfo(cfdInfo.WriteAsXML()); - if (cfdaInfo.IsOk()) - { - if (outdictfile.Write(cfdaInfo.GetValue(), cfdaInfo.GetCount()) != - (wxFileOffset)cfdaInfo.GetCount()) - { - wxLogDebug(wxT("error in writing to file")); - } - else - { - bInfoSuccess = true; - -//#if defined(__DARWIN__) -// //force launch services to update its database for the finder -// OSStatus status = LSRegisterURL((CFURLRef)(CFTypeRef)cfurlBundleLoc, true); -// if (status != noErr) -// { -// wxLogDebug(wxT("LSRegisterURL Failed.")); -// } -//#endif - } - outdictfile.Close(); - } - else - { - outdictfile.Close(); - wxLogDebug(wxT("Could not read in new dictionary")); - } - } - else - { - wxLogDebug( - wxString(wxT("Could not open [")) + - sInfoPath + wxT("] for writing.")); - } - } - else - { - wxLogDebug(wxT("Entry not found to remove")); - - wxString sPrintOut; - wxCFDictionary::PrintOutArray(sPrintOut, (CFArrayRef)(CFTypeRef)cfaDocTypes); - wxLogDebug(sPrintOut); - - for (size_t i = 0; i < asExtensions.GetCount(); ++i) - { - wxLogDebug(asExtensions[i]); - } - } - } - else - { - wxLogDebug(wxT("No doc types array found")); - wxString sPrintOut; cfdInfo.PrintOut(sPrintOut); wxLogDebug(sPrintOut); - } - } - else - { - wxLogDebug(wxT("No info dictionary in main bundle")); - } - } - else - { - wxLogDebug(wxT("Can only call associate from bundled app within XXX.app")); - } - } - else - { - wxLogDebug(wxT("No main bundle")); - } - - if (!bInfoSuccess) - return false; - - // this should be as easy as removing the entry from the database - // and then saving the database - OSStatus status = ICDeleteMapEntry( (ICInstance) m_hIC, (Handle) m_hDatabase, - pFileType->m_impl->m_lIndex); - - if (status == noErr) - { - return true; - - //kICAttrNoChange means we don't care about attributes such as - //locking in the database -// status = ICSetPrefHandle((ICInstance) m_hIC, kICMapping, -// kICAttrNoChange, (Handle) m_hDatabase); - -// if (status == noErr) -// { -// return true; -// } -// else -// { -// wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICSetPrefHandle failed."))); -// } - } - else - { - wxLogDebug(wxString::Format(wxT("%i - %s"), __LINE__, wxT("ICDeleteMapEntry failed."))); - } - - return false; -} - -#if 0 - CFWriteStreamRef cfwsInfo = CFWriteStreamCreateWithFile( - kCFAllocatorDefault, - (CFURLRef) (CFTypeRef)cfurlInfoLoc ); - -// CFShow(cfdInfo); - if (cfwsInfo) - { - Boolean bOpened = CFWriteStreamOpen(cfwsInfo); - if (bOpened) - { - CFStringRef cfsError; - CFIndex cfiWritten = CFPropertyListWriteToStream((CFPropertyListRef)(CFTypeRef)cfdInfo, - cfwsInfo, - kCFPropertyListXMLFormat_v1_0, //100 - &cfsError); - if (cfsError && cfiWritten == 0) - { - wxLogDebug(wxCFStringRef(cfsError).BuildWXString()); - wxString sMessage; - cfdInfo.PrintOut(sMessage); - wxLogDebug(sMessage); - } - else - { - bInfoSuccess = true; -//#if defined(__DARWIN__) -// //force launch services to update its database for the finder -// OSStatus status = LSRegisterURL((CFURLRef)(CFTypeRef)cfurlBundleLoc, true); -// if (status != noErr) -// { -// wxLogDebug(wxT("LSRegisterURL Failed.")); -// } -//#endif - } - - CFWriteStreamClose(cfwsInfo); -#endif - -#endif //wxUSE_MIMETYPE diff --git a/Externals/wxWidgets3/src/osx/carbon/msgdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/msgdlg.cpp deleted file mode 100644 index 142581d0f8..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/msgdlg.cpp +++ /dev/null @@ -1,275 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/msgdlg.cpp -// Purpose: wxMessageDialog -// Author: Stefan Csomor -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/msgdlg.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/app.h" -#endif - -#include "wx/thread.h" -#include "wx/modalhook.h" -#include "wx/osx/uma.h" - - -IMPLEMENT_CLASS(wxMessageDialog, wxDialog) - - -wxMessageDialog::wxMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption, - long style, - const wxPoint& WXUNUSED(pos)) - : wxMessageDialogBase(parent, message, caption, style) -{ -} - -int wxMessageDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - int resultbutton = wxID_CANCEL; - - const long style = GetMessageDialogStyle(); - - wxASSERT_MSG( (style & 0x3F) != wxYES, - "this style is not supported on Mac" ); - - AlertType alertType = kAlertPlainAlert; - - switch ( GetEffectiveIcon() ) - { - case wxICON_ERROR: - alertType = kAlertStopAlert; - break; - - case wxICON_WARNING: - alertType = kAlertCautionAlert; - break; - - case wxICON_QUESTION: - case wxICON_INFORMATION: - alertType = kAlertNoteAlert; - break; - } - - // (the standard alert has two slots [title, text] - // for the three wxStrings [caption, message, extended message]) - // - // if the extended text is empty we use the caption and - // the message (for backwards compatibility) - // - // if the extended text is not empty we ignore the caption - // and use the message and the extended message - - - wxString msgtitle,msgtext; - if(m_extendedMessage.IsEmpty()) - { - if ( m_caption.IsEmpty() ) - msgtitle = m_message; - else - { - msgtitle = m_caption; - msgtext = m_message; - } - } - else - { - msgtitle = m_message; - msgtext = m_extendedMessage; - } - - - if ( !wxIsMainThread() ) - { - CFStringRef defaultButtonTitle = NULL; - CFStringRef alternateButtonTitle = NULL; - CFStringRef otherButtonTitle = NULL; - - wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); - wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); - - wxCFStringRef cfNoString( GetNoLabel().c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfYesString( GetYesLabel().c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfOKString( GetOKLabel().c_str() , GetFont().GetEncoding()) ; - wxCFStringRef cfCancelString( GetCancelLabel().c_str(), GetFont().GetEncoding() ); - - int buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ }; - - if (style & wxYES_NO) - { - if ( style & wxNO_DEFAULT ) - { - defaultButtonTitle = cfNoString; - alternateButtonTitle = cfYesString; - buttonId[0] = wxID_NO; - buttonId[1] = wxID_YES; - } - else - { - defaultButtonTitle = cfYesString; - alternateButtonTitle = cfNoString; - buttonId[0] = wxID_YES; - buttonId[1] = wxID_NO; - } - if (style & wxCANCEL) - { - otherButtonTitle = cfCancelString; - buttonId[2] = wxID_CANCEL; - } - } - else - { - // the MSW implementation even shows an OK button if it is not specified, we'll do the same - buttonId[0] = wxID_OK; - // using null as default title does not work on earlier systems - defaultButtonTitle = cfOKString; - if (style & wxCANCEL) - { - alternateButtonTitle = cfCancelString; - buttonId[1] = wxID_CANCEL; - } - } - - CFOptionFlags exitButton; - OSStatus err = CFUserNotificationDisplayAlert( - 0, alertType, NULL, NULL, NULL, cfTitle, cfText, - defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton ); - if (err == noErr) - resultbutton = buttonId[exitButton]; - } - else - { - short result; - - AlertStdCFStringAlertParamRec param; - wxCFStringRef cfNoString( GetNoLabel().c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfYesString( GetYesLabel().c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfOKString( GetOKLabel().c_str(), GetFont().GetEncoding() ); - wxCFStringRef cfCancelString( GetCancelLabel().c_str(), GetFont().GetEncoding() ); - - wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); - wxCFStringRef cfText = msgtext.IsEmpty() ? NULL : wxCFStringRef( msgtext, GetFont().GetEncoding() ); - - param.movable = true; - param.flags = 0; - param.version = kStdCFStringAlertVersionOne; - - bool skipDialog = false; - - if (style & wxYES_NO) - { - if (style & wxCANCEL) - { - param.defaultText = cfYesString; - param.cancelText = cfCancelString; - param.otherText = cfNoString; - param.helpButton = false; - param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton; - param.cancelButton = kAlertStdAlertCancelButton; - } - else - { - param.defaultText = cfYesString; - param.cancelText = NULL; - param.otherText = cfNoString; - param.helpButton = false; - param.defaultButton = style & wxNO_DEFAULT ? kAlertStdAlertOtherButton : kAlertStdAlertOKButton; - param.cancelButton = 0; - } - } - // the MSW implementation even shows an OK button if it is not specified, we'll do the same - else - { - if (style & wxCANCEL) - { - // that's a cancel missing - param.defaultText = cfOKString; - param.cancelText = cfCancelString; - param.otherText = NULL; - param.helpButton = false; - param.defaultButton = kAlertStdAlertOKButton; - param.cancelButton = 0; - } - else - { - param.defaultText = cfOKString; - param.cancelText = NULL; - param.otherText = NULL; - param.helpButton = false; - param.defaultButton = kAlertStdAlertOKButton; - param.cancelButton = 0; - } - } - - param.position = kWindowDefaultPosition; - if ( !skipDialog ) - { - DialogRef alertRef; - CreateStandardAlert( alertType, cfTitle, cfText, ¶m, &alertRef ); - wxDialog::OSXBeginModalDialog(); - RunStandardAlert( alertRef, NULL, &result ); - wxDialog::OSXEndModalDialog(); - } - else - { - return wxID_CANCEL; - } - - if (style & wxOK) - { - switch ( result ) - { - case 1: - resultbutton = wxID_OK; - break; - - case 2: - // TODO: add Cancel button - // if (style & wxCANCEL) - // resultbutton = wxID_CANCEL; - break; - - case 3: - default: - break; - } - } - else if (style & wxYES_NO) - { - switch ( result ) - { - case 1: - resultbutton = wxID_YES; - break; - - case 2: - if (!(style & wxCANCEL)) - resultbutton = wxID_CANCEL; - break; - - case 3: - resultbutton = wxID_NO; - break; - - default: - break; - } - } - } - - SetReturnCode(resultbutton); - - return resultbutton; -} diff --git a/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp b/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp deleted file mode 100644 index f9acf7e4d8..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp +++ /dev/null @@ -1,1692 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/nonownedwnd.cpp -// Purpose: implementation of wxNonOwnedWindow -// Author: Stefan Csomor -// Created: 2008-03-24 -// Copyright: (c) Stefan Csomor 2008 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" -#endif // WX_PRECOMP - -#include "wx/hashmap.h" -#include "wx/evtloop.h" -#include "wx/tooltip.h" -#include "wx/nonownedwnd.h" - -#include "wx/osx/private.h" -#include "wx/settings.h" -#include "wx/frame.h" - -#if wxUSE_SYSTEM_OPTIONS - #include "wx/sysopt.h" -#endif - -// ============================================================================ -// wxNonOwnedWindow implementation -// ============================================================================ - -// unified title and toolbar constant - not in Tiger headers, so we duplicate it here -#define kWindowUnifiedTitleAndToolbarAttribute (1 << 7) - -IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCarbonImpl , wxNonOwnedWindowImpl ) - -WXWindow wxNonOwnedWindowCarbonImpl::GetWXWindow() const -{ - return (WXWindow) m_macWindow; -} -void wxNonOwnedWindowCarbonImpl::Raise() -{ - ::SelectWindow( m_macWindow ) ; -} - -void wxNonOwnedWindowCarbonImpl::Lower() -{ - ::SendBehind( m_macWindow , NULL ) ; -} - -void wxNonOwnedWindowCarbonImpl::ShowWithoutActivating() -{ - bool plainTransition = true; - -#if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) - plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ; -#endif - - if ( plainTransition ) - ::ShowWindow( (WindowRef)m_macWindow ); - else - ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL ); -} - -bool wxNonOwnedWindowCarbonImpl::Show(bool show) -{ - bool plainTransition = true; - -#if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) - plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ; -#endif - - if (show) - { - ShowWithoutActivating(); - ::SelectWindow( (WindowRef)m_macWindow ) ; - } - else - { -#if wxOSX_USE_CARBON - if ( plainTransition ) - ::HideWindow( (WindowRef)m_macWindow ); - else - ::TransitionWindow( (WindowRef)m_macWindow, kWindowZoomTransitionEffect, kWindowHideTransitionAction, NULL ); -#endif - } - return true; -} - -void wxNonOwnedWindowCarbonImpl::Update() -{ - HIWindowFlush(m_macWindow) ; -} - -bool wxNonOwnedWindowCarbonImpl::SetTransparent(wxByte alpha) -{ - OSStatus result = SetWindowAlpha((WindowRef)m_macWindow, (CGFloat)((alpha)/255.0)); - return result == noErr; -} - -bool wxNonOwnedWindowCarbonImpl::SetBackgroundColour(const wxColour& col ) -{ - if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) ) - { - SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ; - m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM); - // call directly if object is not yet completely constructed - if ( m_wxPeer->GetNonOwnedPeer() == NULL ) - SetBackgroundStyle(wxBG_STYLE_SYSTEM); - } - else if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) ) - { - SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ; - m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM); - // call directly if object is not yet completely constructed - if ( m_wxPeer->GetNonOwnedPeer() == NULL ) - SetBackgroundStyle(wxBG_STYLE_SYSTEM); - } - return true; -} - -void wxNonOwnedWindowCarbonImpl::SetExtraStyle( long exStyle ) -{ - if ( m_macWindow != NULL ) - { - bool metal = exStyle & wxFRAME_EX_METAL ; - - if ( MacGetMetalAppearance() != metal ) - { - if ( MacGetUnifiedAppearance() ) - MacSetUnifiedAppearance( !metal ) ; - - MacSetMetalAppearance( metal ) ; - } - } -} - -bool wxNonOwnedWindowCarbonImpl::SetBackgroundStyle(wxBackgroundStyle style) -{ - if ( style == wxBG_STYLE_TRANSPARENT ) - { - OSStatus err = HIWindowChangeFeatures( m_macWindow, 0, kWindowIsOpaque ); - verify_noerr( err ); - err = ReshapeCustomWindow( m_macWindow ); - verify_noerr( err ); - } - - return true ; -} - -bool wxNonOwnedWindowCarbonImpl::CanSetTransparent() -{ - return true; -} - -void wxNonOwnedWindowCarbonImpl::GetContentArea( int &left , int &top , int &width , int &height ) const -{ - Rect content, structure ; - - GetWindowBounds( m_macWindow, kWindowStructureRgn , &structure ) ; - GetWindowBounds( m_macWindow, kWindowContentRgn , &content ) ; - - left = content.left - structure.left ; - top = content.top - structure.top ; - width = content.right - content.left ; - height = content.bottom - content.top ; -} - -void wxNonOwnedWindowCarbonImpl::MoveWindow(int x, int y, int width, int height) -{ - Rect bounds = { y , x , y + height , x + width } ; - verify_noerr(SetWindowBounds( (WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; -} - -void wxNonOwnedWindowCarbonImpl::GetPosition( int &x, int &y ) const -{ - Rect bounds ; - - verify_noerr(GetWindowBounds((WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; - - x = bounds.left ; - y = bounds.top ; -} - -void wxNonOwnedWindowCarbonImpl::GetSize( int &width, int &height ) const -{ - Rect bounds ; - - verify_noerr(GetWindowBounds((WindowRef) m_macWindow, kWindowStructureRgn , &bounds )) ; - - width = bounds.right - bounds.left ; - height = bounds.bottom - bounds.top ; -} - -bool wxNonOwnedWindowCarbonImpl::MacGetUnifiedAppearance() const -{ - return MacGetWindowAttributes() & kWindowUnifiedTitleAndToolbarAttribute ; -} - -void wxNonOwnedWindowCarbonImpl::MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) -{ - ChangeWindowAttributes( m_macWindow, attributesToSet, attributesToClear ) ; -} - -wxUint32 wxNonOwnedWindowCarbonImpl::MacGetWindowAttributes() const -{ - UInt32 attr = 0 ; - GetWindowAttributes( m_macWindow, &attr ) ; - return attr ; -} - -void wxNonOwnedWindowCarbonImpl::MacSetMetalAppearance( bool set ) -{ - if ( MacGetUnifiedAppearance() ) - MacSetUnifiedAppearance( false ) ; - - MacChangeWindowAttributes( set ? kWindowMetalAttribute : kWindowNoAttributes , - set ? kWindowNoAttributes : kWindowMetalAttribute ) ; -} - -bool wxNonOwnedWindowCarbonImpl::MacGetMetalAppearance() const -{ - return MacGetWindowAttributes() & kWindowMetalAttribute ; -} - -void wxNonOwnedWindowCarbonImpl::MacSetUnifiedAppearance( bool set ) -{ - if ( MacGetMetalAppearance() ) - MacSetMetalAppearance( false ) ; - - MacChangeWindowAttributes( set ? kWindowUnifiedTitleAndToolbarAttribute : kWindowNoAttributes , - set ? kWindowNoAttributes : kWindowUnifiedTitleAndToolbarAttribute) ; - - // For some reason, Tiger uses white as the background color for this appearance, - // while most apps using it use the typical striped background. Restore that behaviour - // for wx. - // TODO: Determine if we need this on Leopard as well. (should be harmless either way, - // though) - // since when creating the peering is not yet completely set-up we call both setters - // explicitly - m_wxPeer->SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ; - SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ; -} - - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param); - -WXDLLEXPORT void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ); - -// --------------------------------------------------------------------------- -// Carbon Events -// --------------------------------------------------------------------------- - -static const EventTypeSpec eventList[] = -{ - // TODO: remove control related event like key and mouse (except for WindowLeave events) - - { kEventClassKeyboard, kEventRawKeyDown } , - { kEventClassKeyboard, kEventRawKeyRepeat } , - { kEventClassKeyboard, kEventRawKeyUp } , - { kEventClassKeyboard, kEventRawKeyModifiersChanged } , - - { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , - { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } , - - { kEventClassWindow , kEventWindowShown } , - { kEventClassWindow , kEventWindowActivated } , - { kEventClassWindow , kEventWindowDeactivated } , - { kEventClassWindow , kEventWindowBoundsChanging } , - { kEventClassWindow , kEventWindowBoundsChanged } , - { kEventClassWindow , kEventWindowClose } , - { kEventClassWindow , kEventWindowGetRegion } , - - // we have to catch these events on the toplevel window level, - // as controls don't get the raw mouse events anymore - - { kEventClassMouse , kEventMouseDown } , - { kEventClassMouse , kEventMouseUp } , - { kEventClassMouse , kEventMouseWheelMoved } , - { kEventClassMouse , kEventMouseMoved } , - { kEventClassMouse , kEventMouseDragged } , -} ; - -static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - // call DoFindFocus instead of FindFocus, because for Composite Windows(like WxGenericListCtrl) - // FindFocus does not return the actual focus window, but the enclosing window - wxWindow* focus = wxWindow::DoFindFocus(); - if ( focus == NULL ) - focus = data ? ((wxNonOwnedWindowImpl*) data)->GetWXPeer() : NULL ; - - unsigned char charCode ; - wxChar uniChar[2] ; - uniChar[0] = 0; - uniChar[1] = 0; - - UInt32 keyCode ; - UInt32 modifiers ; - UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - -#if wxUSE_UNICODE - ByteCount dataSize = 0 ; - if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr ) - { - UniChar buf[2] ; - int numChars = dataSize / sizeof( UniChar) + 1; - - UniChar* charBuf = buf ; - - if ( numChars * 2 > 4 ) - charBuf = new UniChar[ numChars ] ; - GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ; - charBuf[ numChars - 1 ] = 0; - - wxMBConvUTF16 converter ; - converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ; - - if ( numChars * 2 > 4 ) - delete[] charBuf ; - } -#endif // wxUSE_UNICODE - - GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode ); - GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); - GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - - UInt32 message = (keyCode << 8) + charCode; - switch ( GetEventKind( event ) ) - { - case kEventRawKeyRepeat : - case kEventRawKeyDown : - { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; - WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; - wxTheApp->MacSetCurrentEvent( event , handler ) ; - if ( /* focus && */ wxTheApp->MacSendKeyDownEvent( - focus , message , modifiers , when , uniChar[0] ) ) - { - result = noErr ; - } - wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; - } - break ; - - case kEventRawKeyUp : - if ( /* focus && */ wxTheApp->MacSendKeyUpEvent( - focus , message , modifiers , when , uniChar[0] ) ) - { - result = noErr ; - } - break ; - - case kEventRawKeyModifiersChanged : - { - wxKeyEvent event(wxEVT_KEY_DOWN); - - event.m_shiftDown = modifiers & shiftKey; - event.m_rawControlDown = modifiers & controlKey; - event.m_altDown = modifiers & optionKey; - event.m_controlDown = event.m_metaDown = modifiers & cmdKey; - -#if wxUSE_UNICODE - event.m_uniChar = uniChar[0] ; -#endif - - event.SetTimestamp(when); - event.SetEventObject(focus); - - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & controlKey ) - { - event.m_keyCode = WXK_RAW_CONTROL ; - event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->HandleWindowEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & shiftKey ) - { - event.m_keyCode = WXK_SHIFT ; - event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->HandleWindowEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & optionKey ) - { - event.m_keyCode = WXK_ALT ; - event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->HandleWindowEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & cmdKey ) - { - event.m_keyCode = WXK_CONTROL; - event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->HandleWindowEvent( event ) ; - } - - wxApp::s_lastModifiers = modifiers ; - } - break ; - - default: - break; - } - - return result ; -} - -// we don't interfere with foreign controls on our toplevel windows, therefore we always give back eventNotHandledErr -// for windows that we didn't create (like eg Scrollbars in a databrowser), or for controls where we did not handle the -// mouse down at all -// -// This handler can also be called from app level where data (ie target window) may be null or a non wx window - -EventMouseButton g_lastButton = 0 ; -bool g_lastButtonWasFakeRight = false ; - -WXDLLEXPORT void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) -{ - UInt32 modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; - Point screenMouseLocation = cEvent.GetParameter(kEventParamMouseLocation) ; - - // these parameters are not given for all events - EventMouseButton button = 0 ; - UInt32 clickCount = 0 ; - UInt32 mouseChord = 0; - - cEvent.GetParameter( kEventParamMouseButton, typeMouseButton , &button ) ; - cEvent.GetParameter( kEventParamClickCount, typeUInt32 , &clickCount ) ; - // the chord is the state of the buttons pressed currently - cEvent.GetParameter( kEventParamMouseChord, typeUInt32 , &mouseChord ) ; - - wxevent.m_x = screenMouseLocation.h; - wxevent.m_y = screenMouseLocation.v; - wxevent.m_shiftDown = modifiers & shiftKey; - wxevent.m_rawControlDown = modifiers & controlKey; - wxevent.m_altDown = modifiers & optionKey; - wxevent.m_controlDown = wxevent.m_metaDown = modifiers & cmdKey; - wxevent.m_clickCount = clickCount; - wxevent.SetTimestamp( cEvent.GetTicks() ) ; - - // a control click is interpreted as a right click - bool thisButtonIsFakeRight = false ; - if ( button == kEventMouseButtonPrimary && (modifiers & controlKey) ) - { - button = kEventMouseButtonSecondary ; - thisButtonIsFakeRight = true ; - } - - // otherwise we report double clicks by connecting a left click with a ctrl-left click - if ( clickCount > 1 && button != g_lastButton ) - clickCount = 1 ; - - // we must make sure that our synthetic 'right' button corresponds in - // mouse down, moved and mouse up, and does not deliver a right down and left up - - if ( cEvent.GetKind() == kEventMouseDown ) - { - g_lastButton = button ; - g_lastButtonWasFakeRight = thisButtonIsFakeRight ; - } - - if ( button == 0 ) - { - g_lastButton = 0 ; - g_lastButtonWasFakeRight = false ; - } - else if ( g_lastButton == kEventMouseButtonSecondary && g_lastButtonWasFakeRight ) - button = g_lastButton ; - - // Adjust the chord mask to remove the primary button and add the - // secondary button. It is possible that the secondary button is - // already pressed, e.g. on a mouse connected to a laptop, but this - // possibility is ignored here: - if( thisButtonIsFakeRight && ( mouseChord & 1U ) ) - mouseChord = ((mouseChord & ~1U) | 2U); - - if(mouseChord & 1U) - wxevent.m_leftDown = true ; - if(mouseChord & 2U) - wxevent.m_rightDown = true ; - if(mouseChord & 4U) - wxevent.m_middleDown = true ; - - // translate into wx types - switch ( cEvent.GetKind() ) - { - case kEventMouseDown : - switch ( button ) - { - case kEventMouseButtonPrimary : - wxevent.SetEventType( clickCount > 1 ? wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN ) ; - break ; - - case kEventMouseButtonSecondary : - wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN ) ; - break ; - - case kEventMouseButtonTertiary : - wxevent.SetEventType( clickCount > 1 ? wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN ) ; - break ; - - default: - break ; - } - break ; - - case kEventMouseUp : - switch ( button ) - { - case kEventMouseButtonPrimary : - wxevent.SetEventType( wxEVT_LEFT_UP ) ; - break ; - - case kEventMouseButtonSecondary : - wxevent.SetEventType( wxEVT_RIGHT_UP ) ; - break ; - - case kEventMouseButtonTertiary : - wxevent.SetEventType( wxEVT_MIDDLE_UP ) ; - break ; - - default: - break ; - } - break ; - // TODO http://developer.apple.com/qa/qa2005/qa1453.html - // add declaration for 10.4 and change to kEventMouseScroll - case kEventMouseWheelMoved : - { - wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ; - - EventMouseWheelAxis axis = cEvent.GetParameter(kEventParamMouseWheelAxis, typeMouseWheelAxis) ; - SInt32 delta = cEvent.GetParameter(kEventParamMouseWheelDelta, typeSInt32) ; - - wxevent.m_wheelRotation = delta; - wxevent.m_wheelDelta = 1; - wxevent.m_linesPerAction = 1; - wxevent.m_columnsPerAction = 1; - if ( axis == kEventMouseWheelAxisX ) - wxevent.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL; - } - break ; - - case kEventMouseEntered : - case kEventMouseExited : - case kEventMouseDragged : - case kEventMouseMoved : - wxevent.SetEventType( wxEVT_MOTION ) ; - break; - default : - break ; - } -} - -#define NEW_CAPTURE_HANDLING 1 - -pascal OSStatus -wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler), - EventRef event, - void *data) -{ - wxNonOwnedWindow* toplevelWindow = data ? ((wxNonOwnedWindowImpl*) data)->GetWXPeer() : NULL ; - - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - Point screenMouseLocation = cEvent.GetParameter(kEventParamMouseLocation) ; - Point windowMouseLocation = screenMouseLocation ; - - WindowRef window = NULL; - short windowPart = ::FindWindow(screenMouseLocation, &window); - - wxWindow* currentMouseWindow = NULL ; - ControlRef control = NULL ; - -#if NEW_CAPTURE_HANDLING - if ( wxApp::s_captureWindow ) - { - window = (WindowRef) wxApp::s_captureWindow->MacGetTopLevelWindowRef() ; - windowPart = inContent ; - } -#endif - - if ( window ) - { - QDGlobalToLocalPoint( GetWindowPort( window ), &windowMouseLocation ); - - if ( wxApp::s_captureWindow -#if !NEW_CAPTURE_HANDLING - && wxApp::s_captureWindow->MacGetTopLevelWindowRef() == (WXWindow) window && windowPart == inContent -#endif - ) - { - currentMouseWindow = wxApp::s_captureWindow ; - } - else if ( (IsWindowActive(window) && windowPart == inContent) ) - { - ControlPartCode part ; - control = FindControlUnderMouse( windowMouseLocation , window , &part ) ; - // if there is no control below the mouse position, send the event to the toplevel window itself - if ( control == 0 ) - { - currentMouseWindow = (wxWindow*) toplevelWindow ; - } - else - { - currentMouseWindow = (wxWindow*) wxFindWindowFromWXWidget( (WXWidget) control ) ; -#ifndef __WXUNIVERSAL__ - if ( currentMouseWindow == NULL && cEvent.GetKind() == kEventMouseMoved ) - { -#if wxUSE_TOOLBAR - // for wxToolBar to function we have to send certaint events to it - // instead of its children (wxToolBarTools) - ControlRef parent ; - GetSuperControl(control, &parent ); - wxWindow *wxparent = (wxWindow*) wxFindWindowFromWXWidget((WXWidget) parent ) ; - if ( wxparent && wxparent->IsKindOf( CLASSINFO( wxToolBar ) ) ) - currentMouseWindow = wxparent ; -#endif - } -#endif - } - - // disabled windows must not get any input messages - if ( currentMouseWindow && !currentMouseWindow->MacIsReallyEnabled() ) - currentMouseWindow = NULL; - } - } - - wxMouseEvent wxevent(wxEVT_LEFT_DOWN); - SetupMouseEvent( wxevent , cEvent ) ; - - // handle all enter / leave events - - if ( currentMouseWindow != g_MacLastWindow ) - { - if ( g_MacLastWindow ) - { - wxMouseEvent eventleave(wxevent); - eventleave.SetEventType( wxEVT_LEAVE_WINDOW ); - g_MacLastWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y ); - eventleave.SetEventObject( g_MacLastWindow ) ; - wxevent.SetId( g_MacLastWindow->GetId() ) ; - -#if wxUSE_TOOLTIPS - wxToolTip::RelayEvent( g_MacLastWindow , eventleave); -#endif - - g_MacLastWindow->HandleWindowEvent(eventleave); - } - - if ( currentMouseWindow ) - { - wxMouseEvent evententer(wxevent); - evententer.SetEventType( wxEVT_ENTER_WINDOW ); - currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y ); - evententer.SetEventObject( currentMouseWindow ) ; - wxevent.SetId( currentMouseWindow->GetId() ) ; - -#if wxUSE_TOOLTIPS - wxToolTip::RelayEvent( currentMouseWindow , evententer ); -#endif - - currentMouseWindow->HandleWindowEvent(evententer); - } - - g_MacLastWindow = currentMouseWindow ; - } - - if ( windowPart == inMenuBar ) - { - // special case menu bar, as we are having a low-level runloop we must do it ourselves - if ( cEvent.GetKind() == kEventMouseDown ) - { - ::MenuSelect( screenMouseLocation ) ; - ::HiliteMenu(0); - result = noErr ; - } - } - else if ( window && windowPart == inProxyIcon ) - { - // special case proxy icon bar, as we are having a low-level runloop we must do it ourselves - if ( cEvent.GetKind() == kEventMouseDown ) - { - if ( ::TrackWindowProxyDrag( window, screenMouseLocation ) != errUserWantsToDragWindow ) - { - // TODO Track change of file path and report back - result = noErr ; - } - } - } - else if ( currentMouseWindow ) - { - wxWindow *currentMouseWindowParent = currentMouseWindow->GetParent(); - - currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ; - - wxevent.SetEventObject( currentMouseWindow ) ; - wxevent.SetId( currentMouseWindow->GetId() ) ; - - // make tooltips current - -#if wxUSE_TOOLTIPS - if ( wxevent.GetEventType() == wxEVT_MOTION ) - wxToolTip::RelayEvent( currentMouseWindow , wxevent ); -#endif - - if ( currentMouseWindow->HandleWindowEvent(wxevent) ) - { - if ( currentMouseWindowParent && - !currentMouseWindowParent->GetChildren().Member(currentMouseWindow) ) - currentMouseWindow = NULL; - - result = noErr; - } - else - { - // if the user code did _not_ handle the event, then perform the - // default processing - if ( wxevent.GetEventType() == wxEVT_LEFT_DOWN ) - { - // ... that is set focus to this window - if (currentMouseWindow->CanAcceptFocus() && wxWindow::FindFocus()!=currentMouseWindow) - currentMouseWindow->SetFocus(); - } - } - - if ( cEvent.GetKind() == kEventMouseUp && wxApp::s_captureWindow ) - { - wxApp::s_captureWindow = NULL ; - // update cursor ? - } - - // update cursor - - wxWindow* cursorTarget = currentMouseWindow ; - wxPoint cursorPoint( wxevent.m_x , wxevent.m_y ) ; - - extern wxCursor gGlobalCursor; - - if (!gGlobalCursor.IsOk()) - { - while ( cursorTarget && !cursorTarget->MacSetupCursor( cursorPoint ) ) - { - cursorTarget = cursorTarget->GetParent() ; - if ( cursorTarget ) - cursorPoint += cursorTarget->GetPosition(); - } - } - - } - else // currentMouseWindow == NULL - { - if (toplevelWindow && !control) - { - extern wxCursor gGlobalCursor; - if (!gGlobalCursor.IsOk()) - { - // update cursor when over toolbar and titlebar etc. - wxSTANDARD_CURSOR->MacInstall() ; - } - } - - // don't mess with controls we don't know about - // for some reason returning eventNotHandledErr does not lead to the correct behaviour - // so we try sending them the correct control directly - if ( cEvent.GetKind() == kEventMouseDown && toplevelWindow && control ) - { - EventModifiers modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; - Point clickLocation = windowMouseLocation ; - - HIPoint hiPoint ; - hiPoint.x = clickLocation.h ; - hiPoint.y = clickLocation.v ; - HIViewConvertPoint( &hiPoint , (ControlRef) toplevelWindow->GetHandle() , control ) ; - clickLocation.h = (int)hiPoint.x ; - clickLocation.v = (int)hiPoint.y ; - - HandleControlClick( control , clickLocation , modifiers , (ControlActionUPP ) -1 ) ; - result = noErr ; - } - } - - return result ; -} - -static pascal OSStatus -wxNonOwnedWindowEventHandler(EventHandlerCallRef WXUNUSED(handler), - EventRef event, - void *data) -{ - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - // WindowRef windowRef = cEvent.GetParameter(kEventParamDirectObject) ; - wxNonOwnedWindow* toplevelWindow = data ? ((wxNonOwnedWindowImpl*) data)->GetWXPeer() : NULL; - - switch ( GetEventKind( event ) ) - { - case kEventWindowActivated : - { - toplevelWindow->HandleActivated( cEvent.GetTicks() , true) ; - // we still sending an eventNotHandledErr in order to allow for default processing - } - break ; - - case kEventWindowDeactivated : - { - toplevelWindow->HandleActivated( cEvent.GetTicks() , false) ; - // we still sending an eventNotHandledErr in order to allow for default processing - } - break ; - - case kEventWindowShown : - toplevelWindow->Refresh() ; - result = noErr ; - break ; - - case kEventWindowClose : - toplevelWindow->Close() ; - result = noErr ; - break ; - - case kEventWindowBoundsChanged : - { - UInt32 attributes = cEvent.GetParameter(kEventParamAttributes, typeUInt32) ; - Rect newRect = cEvent.GetParameter(kEventParamCurrentBounds) ; - wxRect r( newRect.left , newRect.top , newRect.right - newRect.left , newRect.bottom - newRect.top ) ; - if ( attributes & kWindowBoundsChangeSizeChanged ) - { - toplevelWindow->HandleResized(cEvent.GetTicks() ) ; - } - - if ( attributes & kWindowBoundsChangeOriginChanged ) - { - toplevelWindow->HandleMoved(cEvent.GetTicks() ) ; - } - - result = noErr ; - } - break ; - - case kEventWindowBoundsChanging : - { - UInt32 attributes = cEvent.GetParameter(kEventParamAttributes,typeUInt32) ; - Rect newRect = cEvent.GetParameter(kEventParamCurrentBounds) ; - - if ( (attributes & kWindowBoundsChangeSizeChanged) || (attributes & kWindowBoundsChangeOriginChanged) ) - { - // all (Mac) rects are in content area coordinates, all wxRects in structure coordinates - int left , top , width , height ; - // structure width - int swidth, sheight; - - toplevelWindow->GetNonOwnedPeer()->GetContentArea(left, top, width, height); - toplevelWindow->GetNonOwnedPeer()->GetSize(swidth, sheight); - int deltawidth = swidth - width; - int deltaheight = sheight - height; - wxRect adjustR( - newRect.left - left, - newRect.top - top, - newRect.right - newRect.left + deltawidth, - newRect.bottom - newRect.top + deltaheight ) ; - - toplevelWindow->HandleResizing( cEvent.GetTicks(), &adjustR ); - - const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + top + adjustR.height - deltaheight , - adjustR.x + left + adjustR.width - deltawidth } ; - if ( !EqualRect( &newRect , &adjustedRect ) ) - cEvent.SetParameter( kEventParamCurrentBounds , &adjustedRect ) ; - } - - result = noErr ; - } - break ; - - case kEventWindowGetRegion : - { - if ( toplevelWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) - { - WindowRegionCode windowRegionCode ; - - // Fetch the region code that is being queried - GetEventParameter( event, - kEventParamWindowRegionCode, - typeWindowRegionCode, NULL, - sizeof windowRegionCode, NULL, - &windowRegionCode ) ; - - // If it is the opaque region code then set the - // region to empty and return noErr to stop event - // propagation - if ( windowRegionCode == kWindowOpaqueRgn ) { - RgnHandle region; - GetEventParameter( event, - kEventParamRgnHandle, - typeQDRgnHandle, NULL, - sizeof region, NULL, - ®ion) ; - SetEmptyRgn(region) ; - result = noErr ; - } - } - } - break ; - - default : - break ; - } - - return result ; -} - -// mix this in from window.cpp -pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) ; - -static pascal OSStatus wxNonOwnedEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - switch ( GetEventClass( event ) ) - { - case kEventClassTextInput : - { - // TODO remove as soon as all events are on implementation classes only - wxNonOwnedWindow* toplevelWindow = data ? ((wxNonOwnedWindowImpl*) data)->GetWXPeer() : NULL; - - result = wxMacUnicodeTextEventHandler( handler, event , toplevelWindow ) ; - } - break ; - - case kEventClassKeyboard : - result = KeyboardEventHandler( handler, event , data ) ; - break ; - - case kEventClassWindow : - result = wxNonOwnedWindowEventHandler( handler, event , data ) ; - break ; - - case kEventClassMouse : - result = wxMacTopLevelMouseEventHandler( handler, event , data ) ; - break ; - - default : - break ; - } - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxNonOwnedEventHandler ) - -// --------------------------------------------------------------------------- -// Support functions for shaped windows, based on Apple's CustomWindow sample at -// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm -// --------------------------------------------------------------------------- - -static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect) -{ - GetWindowPortBounds(window, inRect); - Point pt = { inRect->top ,inRect->left }; - QDLocalToGlobalPoint( GetWindowPort( window ), &pt ); - inRect->bottom += pt.v - inRect->top; - inRect->right += pt.h - inRect->left; - inRect->top = pt.v; - inRect->left = pt.h; -} - -static SInt32 wxShapedMacWindowGetFeatures(WindowRef WXUNUSED(window), SInt32 param) -{ - /*------------------------------------------------------ - Define which options your custom window supports. - --------------------------------------------------------*/ - //just enable everything for our demo - *(OptionBits*)param = - //kWindowCanGrow | - //kWindowCanZoom | - kWindowCanCollapse | - //kWindowCanGetWindowRegion | - //kWindowHasTitleBar | - //kWindowSupportsDragHilite | - kWindowCanDrawInCurrentPort | - //kWindowCanMeasureTitle | - kWindowWantsDisposeAtProcessDeath | - kWindowSupportsGetGrowImageRegion | - kWindowDefSupportsColorGrafPort; - - return 1; -} - -// The content region is left as a rectangle matching the window size, this is -// so the origin in the paint event, and etc. still matches what the -// programmer expects. -static void wxShapedMacWindowContentRegion(WindowRef window, RgnHandle rgn) -{ - SetEmptyRgn(rgn); - wxNonOwnedWindow* win = wxNonOwnedWindow::GetFromWXWindow((WXWindow)window); - if (win) - { - Rect r ; - wxShapedMacWindowGetPos( window, &r ) ; - RectRgn( rgn , &r ) ; - } -} - -// The structure region is set to the shape given to the SetShape method. -static void wxShapedMacWindowStructureRegion(WindowRef window, RgnHandle rgn) -{ - RgnHandle cachedRegion = (RgnHandle) GetWRefCon(window); - - SetEmptyRgn(rgn); - if (cachedRegion) - { - Rect windowRect; - wxShapedMacWindowGetPos(window, &windowRect); // how big is the window - CopyRgn(cachedRegion, rgn); // make a copy of our cached region - OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window - //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size - } -} - -static SInt32 wxShapedMacWindowGetRegion(WindowRef window, SInt32 param) -{ - GetWindowRegionPtr rgnRec = (GetWindowRegionPtr)param; - - if (rgnRec == NULL) - return paramErr; - - switch (rgnRec->regionCode) - { - case kWindowStructureRgn: - wxShapedMacWindowStructureRegion(window, rgnRec->winRgn); - break; - - case kWindowContentRgn: - wxShapedMacWindowContentRegion(window, rgnRec->winRgn); - break; - - default: - SetEmptyRgn(rgnRec->winRgn); - break; - } - - return noErr; -} - -// Determine the region of the window which was hit -// -static SInt32 wxShapedMacWindowHitTest(WindowRef window, SInt32 param) -{ - Point hitPoint; - static RgnHandle tempRgn = NULL; - - if (tempRgn == NULL) - tempRgn = NewRgn(); - - // get the point clicked - SetPt( &hitPoint, LoWord(param), HiWord(param) ); - - // Mac OS 8.5 or later - wxShapedMacWindowStructureRegion(window, tempRgn); - if (PtInRgn( hitPoint, tempRgn )) //in window content region? - return wInContent; - - // no significant area was hit - return wNoHit; -} - -static pascal long wxShapedMacWindowDef(short WXUNUSED(varCode), WindowRef window, SInt16 message, SInt32 param) -{ - switch (message) - { - case kWindowMsgHitTest: - return wxShapedMacWindowHitTest(window, param); - - case kWindowMsgGetFeatures: - return wxShapedMacWindowGetFeatures(window, param); - - // kWindowMsgGetRegion is sent during CreateCustomWindow and ReshapeCustomWindow - case kWindowMsgGetRegion: - return wxShapedMacWindowGetRegion(window, param); - - default: - break; - } - - return 0; -} - -// implementation - -typedef struct -{ - wxPoint m_position ; - wxSize m_size ; - bool m_wasResizable ; -} FullScreenData ; - -wxNonOwnedWindowCarbonImpl::wxNonOwnedWindowCarbonImpl() -{ -} - -wxNonOwnedWindowCarbonImpl::wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) : wxNonOwnedWindowImpl( nonownedwnd) -{ - m_macEventHandler = NULL; - m_macWindow = NULL; - m_macFullScreenData = NULL ; -} - -wxNonOwnedWindowCarbonImpl::~wxNonOwnedWindowCarbonImpl() -{ -#if wxUSE_TOOLTIPS - wxToolTip::NotifyWindowDelete(m_macWindow) ; -#endif - - if ( m_macEventHandler ) - { - ::RemoveEventHandler((EventHandlerRef) m_macEventHandler); - m_macEventHandler = NULL ; - } - - if ( m_macWindow && !m_wxPeer->IsNativeWindowWrapper()) - DisposeWindow( m_macWindow ); - - FullScreenData *data = (FullScreenData *) m_macFullScreenData ; - delete data ; - m_macFullScreenData = NULL ; - - m_macWindow = NULL; - -} - -void wxNonOwnedWindowCarbonImpl::WillBeDestroyed() -{ - if ( m_macEventHandler ) - { - ::RemoveEventHandler((EventHandlerRef) m_macEventHandler); - m_macEventHandler = NULL ; - } -} - -static void wxNonOwnedWindowInstallTopLevelWindowEventHandler(WindowRef window, EventHandlerRef* handler, void *ref) -{ - InstallWindowEventHandler(window, GetwxNonOwnedEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, ref, handler ); -} - -bool wxNonOwnedWindowCarbonImpl::SetShape(const wxRegion& region) -{ - // Make a copy of the region - RgnHandle shapeRegion = NewRgn(); - HIShapeGetAsQDRgn( region.GetWXHRGN(), shapeRegion ); - - // Dispose of any shape region we may already have - RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef) m_wxPeer->GetWXWindow() ); - if ( oldRgn ) - DisposeRgn(oldRgn); - - // Save the region so we can use it later - SetWRefCon((WindowRef) m_wxPeer->GetWXWindow(), (URefCon)shapeRegion); - - // inform the window manager that the window has changed shape - ReshapeCustomWindow((WindowRef) m_wxPeer->GetWXWindow()); - - return true; -} - - -void wxNonOwnedWindowCarbonImpl::MacInstallTopLevelWindowEventHandler() -{ - if ( m_macEventHandler != NULL ) - { - verify_noerr( ::RemoveEventHandler( (EventHandlerRef) m_macEventHandler ) ) ; - } - wxNonOwnedWindowInstallTopLevelWindowEventHandler(MAC_WXHWND(m_macWindow),(EventHandlerRef *)&m_macEventHandler,this); -} - -void wxNonOwnedWindowCarbonImpl::Create( - wxWindow* WXUNUSED(parent), - WXWindow nativeWindow ) -{ - m_macWindow = nativeWindow; -} - -void wxNonOwnedWindowCarbonImpl::Create( - wxWindow* parent, - const wxPoint& pos, - const wxSize& size, - long style, long extraStyle, - const wxString& WXUNUSED(name) ) -{ - - OSStatus err = noErr ; - Rect theBoundsRect; - - int x = (int)pos.x; - int y = (int)pos.y; - - int w = size.x; - int h = size.y; - - ::SetRect(&theBoundsRect, x, y , x + w, y + h); - - // translate the window attributes in the appropriate window class and attributes - WindowClass wclass = 0; - WindowAttributes attr = kWindowNoAttributes ; - WindowGroupRef group = NULL ; - bool activationScopeSet = false; - WindowActivationScope activationScope = kWindowActivationScopeNone; - - if ( style & wxFRAME_TOOL_WINDOW ) - { - if ( - ( style & wxMINIMIZE_BOX ) || ( style & wxMAXIMIZE_BOX ) || - ( style & wxSYSTEM_MENU ) || ( style & wxCAPTION ) || - ( style & wxTINY_CAPTION) - ) - { - if ( ( style & wxSTAY_ON_TOP ) ) - wclass = kUtilityWindowClass; - else - wclass = kFloatingWindowClass ; - - if ( ( style & wxTINY_CAPTION) ) - attr |= kWindowSideTitlebarAttribute ; - } - else - { - if ( style & wxNO_BORDER ) - { - wclass = kSimpleWindowClass ; - } - else - { - wclass = kPlainWindowClass ; - } - activationScopeSet = true; - activationScope = kWindowActivationScopeNone; - } - } - else if ( ( style & wxPOPUP_WINDOW ) ) - { - if ( ( style & wxBORDER_NONE ) ) - { - wclass = kHelpWindowClass ; // has no border - attr |= kWindowNoShadowAttribute; - } - else - { - wclass = kPlainWindowClass ; // has a single line border, it will have to do for now - } - group = GetWindowGroupOfClass(kFloatingWindowClass) ; - // make sure we don't deactivate something - activationScopeSet = true; - activationScope = kWindowActivationScopeNone; - } - else if ( ( style & wxCAPTION ) ) - { - wclass = kDocumentWindowClass ; - attr |= kWindowInWindowMenuAttribute ; - } - else if ( ( style & wxFRAME_DRAWER ) ) - { - wclass = kDrawerWindowClass; - } - else - { - if ( ( style & wxMINIMIZE_BOX ) || ( style & wxMAXIMIZE_BOX ) || - ( style & wxCLOSE_BOX ) || ( style & wxSYSTEM_MENU ) ) - { - wclass = kDocumentWindowClass ; - } - else if ( ( style & wxNO_BORDER ) ) - { - wclass = kSimpleWindowClass ; - } - else - { - wclass = kPlainWindowClass ; - } - } - - if ( wclass != kPlainWindowClass ) - { - if ( ( style & wxMINIMIZE_BOX ) ) - attr |= kWindowCollapseBoxAttribute ; - - if ( ( style & wxMAXIMIZE_BOX ) ) - attr |= kWindowFullZoomAttribute ; - - if ( ( style & wxRESIZE_BORDER ) ) - attr |= kWindowResizableAttribute ; - - if ( ( style & wxCLOSE_BOX) ) - attr |= kWindowCloseBoxAttribute ; - } - attr |= kWindowLiveResizeAttribute; - - if ( ( style &wxSTAY_ON_TOP) ) - group = GetWindowGroupOfClass(kUtilityWindowClass) ; - - if ( ( style & wxFRAME_FLOAT_ON_PARENT ) ) - group = GetWindowGroupOfClass(kFloatingWindowClass) ; - - if ( group == NULL && parent != NULL ) - { - WindowRef parenttlw = (WindowRef) parent->MacGetTopLevelWindowRef(); - if( parenttlw ) - group = GetWindowGroupParent( GetWindowGroup( parenttlw ) ); - } - - attr |= kWindowCompositingAttribute; -#if 0 // TODO : decide on overall handling of high dpi screens (pixel vs userscale) - attr |= kWindowFrameworkScaledAttribute; -#endif - - if ( ( style &wxFRAME_SHAPED) ) - { - WindowDefSpec customWindowDefSpec; - customWindowDefSpec.defType = kWindowDefProcPtr; - customWindowDefSpec.u.defProc = -#ifdef __LP64__ - (WindowDefUPP) wxShapedMacWindowDef; -#else - NewWindowDefUPP(wxShapedMacWindowDef); -#endif - err = ::CreateCustomWindow( &customWindowDefSpec, wclass, - attr, &theBoundsRect, - (WindowRef*) &m_macWindow); - } - else - { - err = ::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ; - } - - if ( err == noErr && m_macWindow != NULL && group != NULL ) - SetWindowGroup( (WindowRef) m_macWindow , group ) ; - - wxCHECK_RET( err == noErr, wxT("Mac OS error when trying to create new window") ); - - // setup a separate group for each window, so that overlays can be handled easily - - WindowGroupRef overlaygroup = NULL; - verify_noerr( CreateWindowGroup( kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrHideOnCollapse, &overlaygroup )); - verify_noerr( SetWindowGroupParent( overlaygroup, GetWindowGroup( (WindowRef) m_macWindow ))); - verify_noerr( SetWindowGroup( (WindowRef) m_macWindow , overlaygroup )); - - if ( activationScopeSet ) - { - verify_noerr( SetWindowActivationScope( (WindowRef) m_macWindow , activationScope )); - } - - // the create commands are only for content rect, - // so we have to set the size again as structure bounds - SetWindowBounds( m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; - - // Causes the inner part of the window not to be metal - // if the style is used before window creation. -#if 0 // TARGET_API_MAC_OSX - if ( m_macUsesCompositing && m_macWindow != NULL ) - { - if ( GetExtraStyle() & wxFRAME_EX_METAL ) - MacSetMetalAppearance( true ) ; - } -#endif - - if ( m_macWindow != NULL ) - { - MacSetUnifiedAppearance( true ) ; - } - - HIViewRef growBoxRef = 0 ; - err = HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowGrowBoxID, &growBoxRef ); - if ( err == noErr && growBoxRef != 0 ) - HIGrowBoxViewSetTransparent( growBoxRef, true ) ; - - // the frame window event handler - InstallStandardEventHandler( GetWindowEventTarget(m_macWindow) ) ; - MacInstallTopLevelWindowEventHandler() ; - - if ( extraStyle & wxFRAME_EX_METAL) - MacSetMetalAppearance(true); - - if ( ( style &wxFRAME_SHAPED) ) - { - // default shape matches the window size - wxRegion rgn( 0, 0, w, h ); - SetShape( rgn ); - } -} - -bool wxNonOwnedWindowCarbonImpl::ShowWithEffect(bool show, - wxShowEffect effect, - unsigned timeout) -{ - WindowTransitionEffect transition = 0 ; - switch( effect ) - { - case wxSHOW_EFFECT_ROLL_TO_LEFT: - case wxSHOW_EFFECT_ROLL_TO_RIGHT: - case wxSHOW_EFFECT_ROLL_TO_TOP: - case wxSHOW_EFFECT_ROLL_TO_BOTTOM: - case wxSHOW_EFFECT_SLIDE_TO_LEFT: - case wxSHOW_EFFECT_SLIDE_TO_RIGHT: - case wxSHOW_EFFECT_SLIDE_TO_TOP: - case wxSHOW_EFFECT_SLIDE_TO_BOTTOM: - transition = kWindowGenieTransitionEffect; - break; - case wxSHOW_EFFECT_BLEND: - transition = kWindowFadeTransitionEffect; - break; - case wxSHOW_EFFECT_EXPAND: - // having sheets would be fine, but this might lead to a repositioning -#if 0 - if ( GetParent() ) - transition = kWindowSheetTransitionEffect; - else -#endif - transition = kWindowZoomTransitionEffect; - break; - - case wxSHOW_EFFECT_NONE: - // wxNonOwnedWindow is supposed to call Show() itself in this case - wxFAIL_MSG( "ShowWithEffect() shouldn't be called" ); - return false; - - case wxSHOW_EFFECT_MAX: - wxFAIL_MSG( "invalid effect flag" ); - return false; - } - - TransitionWindowOptions options; - options.version = 0; - options.duration = timeout / 1000.0; - options.window = transition == kWindowSheetTransitionEffect ? (WindowRef) m_wxPeer->GetParent()->MacGetTopLevelWindowRef() :0; - options.userData = 0; - - wxSize size = wxGetDisplaySize(); - Rect bounds; - GetWindowBounds( (WindowRef)m_macWindow, kWindowStructureRgn, &bounds ); - CGRect hiBounds = CGRectMake( bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top ); - - switch ( effect ) - { - case wxSHOW_EFFECT_ROLL_TO_RIGHT: - case wxSHOW_EFFECT_SLIDE_TO_RIGHT: - hiBounds.origin.x = 0; - hiBounds.size.width = 0; - break; - - case wxSHOW_EFFECT_ROLL_TO_LEFT: - case wxSHOW_EFFECT_SLIDE_TO_LEFT: - hiBounds.origin.x = size.x; - hiBounds.size.width = 0; - break; - - case wxSHOW_EFFECT_ROLL_TO_TOP: - case wxSHOW_EFFECT_SLIDE_TO_TOP: - hiBounds.origin.y = size.y; - hiBounds.size.height = 0; - break; - - case wxSHOW_EFFECT_ROLL_TO_BOTTOM: - case wxSHOW_EFFECT_SLIDE_TO_BOTTOM: - hiBounds.origin.y = 0; - hiBounds.size.height = 0; - break; - - default: - break; // direction doesn't make sense - } - - ::TransitionWindowWithOptions - ( - (WindowRef)m_macWindow, - transition, - show ? kWindowShowTransitionAction : kWindowHideTransitionAction, - transition == kWindowGenieTransitionEffect ? &hiBounds : NULL, - false, - &options - ); - - if ( show ) - { - ::SelectWindow( (WindowRef)m_macWindow ) ; - } - - return true; -} - -void wxNonOwnedWindowCarbonImpl::SetTitle( const wxString& title, wxFontEncoding encoding ) -{ - SetWindowTitleWithCFString( m_macWindow , wxCFStringRef( title , encoding ) ) ; -} - -bool wxNonOwnedWindowCarbonImpl::IsMaximized() const -{ - return IsWindowInStandardState( m_macWindow , NULL , NULL ) ; -} - -bool wxNonOwnedWindowCarbonImpl::IsIconized() const -{ - return IsWindowCollapsed((WindowRef)GetWXWindow() ) ; -} - -void wxNonOwnedWindowCarbonImpl::Iconize( bool iconize ) -{ - if ( IsWindowCollapsable( m_macWindow ) ) - CollapseWindow( m_macWindow , iconize ) ; -} - -void wxNonOwnedWindowCarbonImpl::Maximize(bool maximize) -{ - Point idealSize = { 0 , 0 } ; - if ( maximize ) - { - HIRect bounds ; - HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal, - &bounds); - idealSize.h = bounds.size.width; - idealSize.v = bounds.size.height; - } - ZoomWindowIdeal( (WindowRef)GetWXWindow() , maximize ? inZoomOut : inZoomIn , &idealSize ) ; -} - -bool wxNonOwnedWindowCarbonImpl::IsFullScreen() const -{ - return m_macFullScreenData != NULL ; -} - -bool wxNonOwnedWindowCarbonImpl::ShowFullScreen(bool show, long style) -{ - if ( show ) - { - FullScreenData *data = (FullScreenData *)m_macFullScreenData ; - delete data ; - data = new FullScreenData() ; - - m_macFullScreenData = data ; - data->m_position = m_wxPeer->GetPosition() ; - data->m_size = m_wxPeer->GetSize() ; -#if wxOSX_USE_CARBON - WindowAttributes attr = 0; - GetWindowAttributes((WindowRef) GetWXWindow(), &attr); - data->m_wasResizable = attr & kWindowResizableAttribute; - if ( style & wxFULLSCREEN_NOMENUBAR ) - HideMenuBar() ; -#endif - - wxRect client = wxGetClientDisplayRect() ; - - int left, top, width, height ; - int x, y, w, h ; - - x = client.x ; - y = client.y ; - w = client.width ; - h = client.height ; - - GetContentArea( left, top, width, height ) ; - int outerwidth, outerheight; - GetSize( outerwidth, outerheight ); - - if ( style & wxFULLSCREEN_NOCAPTION ) - { - y -= top ; - h += top ; - // avoid adding the caption twice to the height - outerheight -= top; - } - - if ( style & wxFULLSCREEN_NOBORDER ) - { - x -= left ; - w += outerwidth - width; - h += outerheight - height; - } - - if ( style & wxFULLSCREEN_NOTOOLBAR ) - { - // TODO - } - - if ( style & wxFULLSCREEN_NOSTATUSBAR ) - { - // TODO - } - - m_wxPeer->SetSize( x , y , w, h ) ; - if ( data->m_wasResizable ) - { -#if wxOSX_USE_CARBON - ChangeWindowAttributes( (WindowRef) GetWXWindow() , kWindowNoAttributes , kWindowResizableAttribute ) ; -#endif - } - } - else if ( m_macFullScreenData != NULL ) - { - FullScreenData *data = (FullScreenData *) m_macFullScreenData ; -#if wxOSX_USE_CARBON - ShowMenuBar() ; - if ( data->m_wasResizable ) - ChangeWindowAttributes( (WindowRef) GetWXWindow() , kWindowResizableAttribute , kWindowNoAttributes ) ; -#endif - m_wxPeer->SetPosition( data->m_position ) ; - m_wxPeer->SetSize( data->m_size ) ; - - delete data ; - m_macFullScreenData = NULL ; - } - - return true; -} - -// Attracts the users attention to this window if the application is -// inactive (should be called when a background event occurs) - -static pascal void wxMacNMResponse( NMRecPtr ptr ) -{ - NMRemove( ptr ) ; - DisposePtr( (Ptr)ptr ) ; -} - -void wxNonOwnedWindowCarbonImpl::RequestUserAttention(int WXUNUSED(flags)) -{ - NMRecPtr notificationRequest = (NMRecPtr) NewPtr( sizeof( NMRec) ) ; - - memset( notificationRequest , 0 , sizeof(*notificationRequest) ) ; - notificationRequest->qType = nmType ; - notificationRequest->nmMark = 1 ; - notificationRequest->nmIcon = 0 ; - notificationRequest->nmSound = 0 ; - notificationRequest->nmStr = NULL ; - notificationRequest->nmResp = wxMacNMResponse ; - - verify_noerr( NMInstall( notificationRequest ) ) ; -} - -void wxNonOwnedWindowCarbonImpl::ScreenToWindow( int *x, int *y ) -{ - HIPoint p = CGPointMake( (x ? *x : 0), (y ? *y : 0) ); - HIViewRef contentView ; - // TODO check toolbar offset - HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ; - HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView ); - if ( x ) - *x = (int)p.x; - if ( y ) - *y = (int)p.y; -} - -void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y ) -{ - HIPoint p = CGPointMake( (x ? *x : 0), (y ? *y : 0) ); - HIViewRef contentView ; - // TODO check toolbar offset - HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ; - HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL ); - if ( x ) - *x = (int)p.x; - if ( y ) - *y = (int)p.y; -} - -bool wxNonOwnedWindowCarbonImpl::IsActive() -{ - return ActiveNonFloatingWindow() == m_macWindow; -} - -wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, - long style, long extraStyle, const wxString& name ) -{ - wxNonOwnedWindowImpl* now = new wxNonOwnedWindowCarbonImpl( wxpeer ); - now->Create( parent, pos, size, style , extraStyle, name ); - return now; -} - -wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow ) -{ - wxNonOwnedWindowCarbonImpl* now = new wxNonOwnedWindowCarbonImpl( wxpeer ); - now->Create( parent, nativeWindow ); - return now; -} - diff --git a/Externals/wxWidgets3/src/osx/carbon/notebmac.cpp b/Externals/wxWidgets3/src/osx/carbon/notebmac.cpp deleted file mode 100644 index 95e277149f..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/notebmac.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/notebmac.cpp -// Purpose: implementation of wxNotebook -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_NOTEBOOK - -#include "wx/notebook.h" - -#ifndef WX_PRECOMP - #include "wx/string.h" - #include "wx/log.h" - #include "wx/app.h" - #include "wx/image.h" -#endif - -#include "wx/string.h" -#include "wx/imaglist.h" -#include "wx/osx/private.h" - - -// check that the page index is valid -#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) - -class wxCarbonTabView : public wxMacControl -{ -public: - wxCarbonTabView( wxWindowMac* peer ) : wxMacControl(peer ) - { - } - - // Added by Mark Newsam - // When a page is added or deleted to the notebook this function updates - // information held in the control so that it matches the order - // the user would expect. - // - void SetupTabs( const wxNotebook& notebook) - { - const size_t countPages = notebook.GetPageCount(); - SetMaximum( countPages ) ; - - wxNotebookPage *page; - ControlTabInfoRecV1 info; - - for (size_t ii = 0; ii < countPages; ii++) - { - page = (wxNotebookPage*) notebook.GetPage(ii); - info.version = kControlTabInfoVersionOne; - info.iconSuiteID = 0; - wxCFStringRef cflabel( page->GetLabel(), page->GetFont().GetEncoding() ) ; - info.name = cflabel ; - SetData( ii + 1, kControlTabInfoTag, &info ) ; - - if ( notebook.GetImageList() && notebook.GetPageImage(ii) >= 0 ) - { - const wxBitmap bmap = notebook.GetImageList()->GetBitmap( notebook.GetPageImage( ii ) ) ; - if ( bmap.IsOk() ) - { - ControlButtonContentInfo info ; - - wxMacCreateBitmapButton( &info, bmap ) ; - - OSStatus err = SetData( ii + 1, kControlTabImageContentTag, &info ); - if ( err != noErr ) - { - wxFAIL_MSG("Error when setting icon on tab"); - } - - wxMacReleaseBitmapButton( &info ) ; - } - } - SetTabEnabled( ii + 1, true ) ; - } - } - - int TabHitTest(const wxPoint & pt, long* flags) - { - int resultV = wxNOT_FOUND; - - wxNotebook *notebookpeer = wxDynamicCast( GetWXPeer() , wxNotebook ); - if ( NULL == notebookpeer ) - return wxNOT_FOUND; - - const int countPages = notebookpeer->GetPageCount(); - - // we have to convert from Client to Window relative coordinates - wxPoint adjustedPt = pt + GetWXPeer()->GetClientAreaOrigin(); - // and now to HIView native ones - adjustedPt.x -= GetWXPeer()->MacGetLeftBorderSize() ; - adjustedPt.y -= GetWXPeer()->MacGetTopBorderSize() ; - - HIPoint hipoint= { adjustedPt.x , adjustedPt.y } ; - HIViewPartCode outPart = 0 ; - OSStatus err = HIViewGetPartHit( GetControlRef(), &hipoint, &outPart ); - - int max = GetMaximum() ; - if ( outPart == 0 && max > 0 ) - { - // this is a hack, as unfortunately a hit on an already selected tab returns 0, - // so we have to go some extra miles to make sure we select something different - // and try again .. - int val = GetValue() ; - int maxval = max ; - if ( max == 1 ) - { - SetMaximum( 2 ) ; - maxval = 2 ; - } - - if ( val == 1 ) - SetValue( maxval ) ; - else - SetValue( 1 ) ; - - err = HIViewGetPartHit( GetControlRef(), &hipoint, &outPart ); - - SetValue( val ) ; - if ( max == 1 ) - SetMaximum( 1 ) ; - } - - if ( outPart >= 1 && outPart <= countPages ) - resultV = outPart - 1 ; - - if (flags != NULL) - { - *flags = 0; - - // we cannot differentiate better - if (resultV >= 0) - *flags |= wxBK_HITTEST_ONLABEL; - else - *flags |= wxBK_HITTEST_NOWHERE; - } - - return resultV; - - } - -}; - -wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - - if ( bounds.right <= bounds.left ) - bounds.right = bounds.left + 100; - if ( bounds.bottom <= bounds.top ) - bounds.bottom = bounds.top + 100; - - UInt16 tabstyle = kControlTabDirectionNorth; - if ( style & wxBK_LEFT ) - tabstyle = kControlTabDirectionWest; - else if ( style & wxBK_RIGHT ) - tabstyle = kControlTabDirectionEast; - else if ( style & wxBK_BOTTOM ) - tabstyle = kControlTabDirectionSouth; - - ControlTabSize tabsize; - switch (wxpeer->GetWindowVariant()) - { - case wxWINDOW_VARIANT_MINI: - tabsize = 3 ; - break; - - case wxWINDOW_VARIANT_SMALL: - tabsize = kControlTabSizeSmall; - break; - - default: - tabsize = kControlTabSizeLarge; - break; - } - - wxMacControl* peer = new wxCarbonTabView( wxpeer ); - - OSStatus err = CreateTabsControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - tabsize, tabstyle, 0, NULL, peer->GetControlRefAddr() ); - verify_noerr( err ); - - return peer; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/popupwin.cpp b/Externals/wxWidgets3/src/osx/carbon/popupwin.cpp index d13810f1c0..42271eebc2 100644 --- a/Externals/wxWidgets3/src/osx/carbon/popupwin.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/popupwin.cpp @@ -55,4 +55,28 @@ bool wxPopupWindow::Create(wxWindow *parent, int flags) } +// under + +bool wxPopupWindow::Show(bool show) +{ + if ( !wxWindow::Show(show) ) + return false; + + if ( m_nowpeer && show) + m_nowpeer->ShowWithoutActivating(); + else if ( m_nowpeer ) + m_nowpeer->Show(false); + + if ( show ) + { + // because apps expect a size event to occur at this moment + wxSizeEvent event(GetSize() , m_windowId); + event.SetEventObject(this); + HandleWindowEvent(event); + } + + return true; +} + + #endif // #if wxUSE_POPUPWIN diff --git a/Externals/wxWidgets3/src/osx/carbon/printdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/printdlg.cpp deleted file mode 100644 index 820f49c6e7..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/printdlg.cpp +++ /dev/null @@ -1,125 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/printdlg.cpp -// Purpose: wxPrintDialog, wxPageSetupDialog -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_PRINTING_ARCHITECTURE - -#include "wx/printdlg.h" - -#ifndef WX_PRECOMP - #include "wx/object.h" - #include "wx/dcprint.h" - #include "wx/msgdlg.h" - #include "wx/textctrl.h" - #include "wx/sizer.h" - #include "wx/stattext.h" -#endif - -#include "wx/osx/printdlg.h" -#include "wx/osx/private/print.h" -#include "wx/osx/private.h" -#include "wx/statline.h" -#include "wx/modalhook.h" - -int wxMacPrintDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - m_printDialogData.GetPrintData().ConvertToNative(); - ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData ); - - int result = wxID_CANCEL; - - OSErr err = noErr; - Boolean accepted; - wxOSXPrintData* nativeData = (wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData(); - wxDialog::OSXBeginModalDialog(); - err = PMSessionPrintDialog(nativeData->GetPrintSession(), nativeData->GetPrintSettings(), - nativeData->GetPageFormat(), &accepted ); - wxDialog::OSXEndModalDialog(); - - if ((err == noErr) && !accepted) - { - // user clicked Cancel button - err = kPMCancel; - } - - if (err == noErr) - { - result = wxID_OK; - } - - if ((err != noErr) && (err != kPMCancel)) - { - wxString message; - - message.Printf( wxT("Print Error %d"), err ); - wxMessageDialog dialog( NULL, message, wxEmptyString, wxICON_HAND | wxOK ); - dialog.ShowModal(); - } - - if (result == wxID_OK) - { - m_printDialogData.GetPrintData().ConvertFromNative(); - ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData ); - } - return result; -} - -int wxMacPageSetupDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - m_pageSetupData.GetPrintData().ConvertToNative(); - wxOSXPrintData* nativeData = (wxOSXPrintData*)m_pageSetupData.GetPrintData().GetNativeData(); - nativeData->TransferFrom( &m_pageSetupData ); - - int result = wxID_CANCEL; - OSErr err = noErr; - Boolean accepted; - - wxDialog::OSXBeginModalDialog(); - err = PMSessionPageSetupDialog( nativeData->GetPrintSession(), nativeData->GetPageFormat(), - &accepted ); - wxDialog::OSXEndModalDialog(); - - if ((err == noErr) && !accepted) - { - // user clicked Cancel button - err = kPMCancel; - } - - // If the user did not cancel, flatten and save the PageFormat object - // with our document. - if (err == noErr) - { - result = wxID_OK; - } - - if ((err != noErr) && (err != kPMCancel)) - { - wxString message; - - message.Printf( wxT("Print Error %d"), err ); - wxMessageDialog dialog( NULL, message, wxEmptyString, wxICON_HAND | wxOK ); - dialog.ShowModal(); - } - - if (result == wxID_OK) - { - m_pageSetupData.GetPrintData().ConvertFromNative(); - m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() ); - nativeData->TransferTo( &m_pageSetupData ); - } - return result; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/radiobut.cpp b/Externals/wxWidgets3/src/osx/carbon/radiobut.cpp deleted file mode 100644 index 1182b127a0..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/radiobut.cpp +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/radiobut.cpp -// Purpose: wxRadioButton -// Author: Stefan Csomor -// Modified by: JS Lair (99/11/15) adding the cyclic group notion for radiobox -// Created: 01/01/98 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_RADIOBTN - -#include "wx/radiobut.h" -#include "wx/osx/private.h" - -wxWidgetImplType* wxWidgetImpl::CreateRadioButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - OSStatus err = CreateRadioButtonControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), - 0, false /* no autotoggle */, peer->GetControlRefAddr() ); - verify_noerr( err ); - - return peer; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/region.cpp b/Externals/wxWidgets3/src/osx/carbon/region.cpp index 8e9ae8cee1..6d4a38ad40 100644 --- a/Externals/wxWidgets3/src/osx/carbon/region.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/region.cpp @@ -20,8 +20,8 @@ #include "wx/osx/private.h" -IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject); #define OSX_USE_SCANLINES 1 diff --git a/Externals/wxWidgets3/src/osx/carbon/renderer.cpp b/Externals/wxWidgets3/src/osx/carbon/renderer.cpp index 4669639e79..1cdb2cc0fd 100644 --- a/Externals/wxWidgets3/src/osx/carbon/renderer.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/renderer.cpp @@ -31,6 +31,7 @@ #include "wx/graphics.h" #include "wx/dcgraph.h" #include "wx/splitter.h" +#include "wx/time.h" #include "wx/osx/private.h" #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP @@ -63,17 +64,17 @@ public: const wxRect& rect, int flags = 0, wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE, - wxHeaderButtonParams* params = NULL ); + wxHeaderButtonParams* params = NULL ) wxOVERRIDE; - virtual int GetHeaderButtonHeight(wxWindow *win); + virtual int GetHeaderButtonHeight(wxWindow *win) wxOVERRIDE; - virtual int GetHeaderButtonMargin(wxWindow *win); + virtual int GetHeaderButtonMargin(wxWindow *win) wxOVERRIDE; // draw the expanded/collapsed icon for a tree control item virtual void DrawTreeItemButton( wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0 ); + int flags = 0 ) wxOVERRIDE; // draw a (vertical) sash virtual void DrawSplitterSash( wxWindow *win, @@ -81,49 +82,63 @@ public: const wxSize& size, wxCoord position, wxOrientation orient, - int flags = 0 ); + int flags = 0 ) wxOVERRIDE; virtual void DrawCheckBox(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; - virtual wxSize GetCheckBoxSize(wxWindow* win); + virtual wxSize GetCheckBoxSize(wxWindow* win) wxOVERRIDE; virtual void DrawComboBoxDropButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; virtual void DrawPushButton(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; + + virtual void DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0) wxOVERRIDE; + + virtual wxSize GetCollapseButtonSize(wxWindow *win, wxDC& dc) wxOVERRIDE; virtual void DrawItemSelectionRect(wxWindow *win, wxDC& dc, const wxRect& rect, - int flags = 0); + int flags = 0) wxOVERRIDE; - virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); + virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0) wxOVERRIDE; - virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; - virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0) wxOVERRIDE; #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP virtual void DrawTitleBarBitmap(wxWindow *win, wxDC& dc, const wxRect& rect, wxTitleBarButton button, - int flags = 0); + int flags = 0) wxOVERRIDE; #endif // wxHAS_DRAW_TITLE_BAR_BITMAP - virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); + virtual void DrawGauge(wxWindow* win, + wxDC& dc, + const wxRect& rect, + int value, + int max, + int flags = 0) wxOVERRIDE; + + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win) wxOVERRIDE; private: void DrawMacThemeButton(wxWindow *win, @@ -517,6 +532,43 @@ wxRendererMac::DrawPushButton(wxWindow *win, kind, kThemeAdornmentNone); } +void wxRendererMac::DrawCollapseButton(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags) +{ + int adornment = (flags & wxCONTROL_EXPANDED) + ? kThemeAdornmentArrowUpArrow + : kThemeAdornmentArrowDownArrow; + + DrawMacThemeButton(win, dc, rect, flags, + kThemeArrowButton, adornment); +} + +wxSize wxRendererMac::GetCollapseButtonSize(wxWindow *WXUNUSED(win), wxDC& WXUNUSED(dc)) +{ + wxSize size; + SInt32 width, height; + OSStatus errStatus; + + errStatus = GetThemeMetric(kThemeMetricDisclosureButtonWidth, &width); + if (errStatus == noErr) + { + size.SetWidth(width); + } + + errStatus = GetThemeMetric(kThemeMetricDisclosureButtonHeight, &height); + if (errStatus == noErr) + { + size.SetHeight(height); + } + + // strict metrics size cutoff the button, increase the size + size.IncBy(1); + + return size; +} + void wxRendererMac::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { @@ -647,181 +699,6 @@ void wxRendererMac::DrawTitleBarBitmap(wxWindow *win, wxTitleBarButton button, int flags) { - // the files below were converted from the originals in art/osx/close*.png - // using misc/scripts/png2c.py script -- we must use PNG and not XPM for - // them because they use transparency and don't look right without it - - /* close.png - 400 bytes */ - static const unsigned char close_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, - 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, - 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, - 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, - 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, - 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, - 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x00, - 0xef, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0xa5, - 0xd2, 0x31, 0x4a, 0x03, 0x41, 0x18, 0xc5, 0xf1, - 0xdf, 0xc6, 0x55, 0x02, 0xb2, 0x18, 0xb0, 0x33, - 0x8d, 0xd8, 0x6e, 0x8a, 0x14, 0xa6, 0xb2, 0xc9, - 0x21, 0x72, 0x0b, 0xdb, 0x5c, 0x45, 0x98, 0x3b, - 0x24, 0xc7, 0x99, 0x6d, 0x2d, 0x04, 0xd3, 0x09, - 0x42, 0x48, 0x65, 0x60, 0x6c, 0x76, 0x65, 0x1c, - 0x14, 0x45, 0x5f, 0x35, 0xfc, 0xe7, 0x3d, 0xe6, - 0x9b, 0x8f, 0x57, 0xf9, 0xac, 0x06, 0x97, 0x98, - 0xe0, 0xbc, 0x67, 0x07, 0xbc, 0xe2, 0x05, 0xfb, - 0xc1, 0x58, 0x65, 0xa1, 0x2b, 0x4c, 0xb3, 0x40, - 0xa9, 0x03, 0x9e, 0xb1, 0x83, 0x93, 0x2c, 0x74, - 0x83, 0xb1, 0xef, 0x75, 0x86, 0x0b, 0x1c, 0xb1, - 0x1f, 0xf5, 0xe3, 0x4d, 0x51, 0x43, 0x08, 0xe1, - 0xb6, 0x4c, 0x64, 0xac, 0xee, 0xbd, 0x0d, 0x5c, - 0x63, 0x89, 0x65, 0x08, 0x61, 0x9d, 0x52, 0x4a, - 0x31, 0xc6, 0xcd, 0xc0, 0x62, 0x8c, 0x9b, 0x94, - 0x52, 0x0a, 0x21, 0xac, 0x07, 0xd6, 0x67, 0xcc, - 0x33, 0xf0, 0x61, 0x8c, 0x31, 0x6e, 0xf2, 0x73, - 0xee, 0xc1, 0xbc, 0xc2, 0x1d, 0x4e, 0xf3, 0xd1, - 0x62, 0x8c, 0xf7, 0x6d, 0xdb, 0xae, 0xa0, 0xeb, - 0xba, 0xed, 0x6c, 0x36, 0x7b, 0x28, 0xa6, 0x7f, - 0x1b, 0xf9, 0xa3, 0xea, 0x7e, 0xcd, 0x93, 0xf2, - 0xb5, 0xae, 0xeb, 0xb6, 0xd0, 0xb6, 0xed, 0x2a, - 0xc6, 0xa8, 0x78, 0xf5, 0xf0, 0xaf, 0xe5, 0x34, - 0x58, 0xe4, 0xe1, 0x62, 0x11, 0x25, 0x5b, 0xa0, - 0x19, 0x9a, 0x33, 0x14, 0xa0, 0xfe, 0xe1, 0x6b, - 0x47, 0x3c, 0x62, 0x37, 0x34, 0x67, 0xdf, 0xc3, - 0x71, 0xdf, 0x90, 0xaf, 0x74, 0xc0, 0x93, 0xbe, - 0x72, 0x55, 0x71, 0xf9, 0xeb, 0x92, 0xbf, 0x03, - 0x70, 0x33, 0x76, 0x58, 0xe5, 0x41, 0xfb, 0x6d, - 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, 0x58, 0x74, - 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, 0x6f, 0x77, - 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, 0x73, 0x74, - 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, 0xda, 0x33, - 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, 0x00, 0xa3, - 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, 0x00, 0x00, - 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 - }; - - /* close_current.png - 421 bytes */ - static const unsigned char close_current_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, - 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, - 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, - 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, - 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, - 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, - 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01, - 0x04, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d, - 0xd2, 0xbd, 0x4a, 0x43, 0x31, 0x00, 0xc5, 0xf1, - 0xdf, 0x8d, 0x56, 0x44, 0x04, 0x45, 0xd0, 0xc5, - 0x55, 0xdc, 0x0a, 0x8e, 0xed, 0xec, 0xe4, 0xec, - 0x24, 0xd4, 0x67, 0x29, 0x59, 0xfa, 0x16, 0x9d, - 0x7c, 0x07, 0x1d, 0x5c, 0xba, 0xa5, 0xa3, 0x28, - 0x22, 0x94, 0xae, 0x2e, 0x1d, 0x4a, 0x5d, 0x55, - 0xb8, 0x2e, 0x09, 0x5c, 0x4b, 0xfd, 0xa0, 0x67, - 0x0a, 0x27, 0x39, 0xc9, 0x49, 0xf2, 0xaf, 0x7c, - 0xd7, 0x01, 0x8e, 0x71, 0x84, 0xfd, 0xec, 0x2d, - 0x30, 0xc3, 0x2b, 0xe6, 0x65, 0x61, 0xd5, 0x08, - 0x9d, 0xe0, 0x14, 0x7b, 0x56, 0xeb, 0x0d, 0x13, - 0x4c, 0x61, 0xa3, 0x11, 0x3a, 0xc3, 0x8e, 0x9f, - 0xb5, 0x9d, 0x9b, 0xbc, 0x63, 0x1e, 0x72, 0xbd, - 0x53, 0xb4, 0x20, 0xc6, 0xd8, 0x5e, 0x4e, 0x34, - 0xbc, 0x56, 0x5e, 0x7b, 0x00, 0x6d, 0x5c, 0xe1, - 0x2a, 0xc6, 0x38, 0xa8, 0xeb, 0xba, 0x4e, 0x29, - 0xdd, 0x16, 0x2f, 0xa5, 0x74, 0x5b, 0xd7, 0x75, - 0x1d, 0x63, 0x1c, 0x14, 0x0f, 0xed, 0x0a, 0xe7, - 0xb9, 0x02, 0x48, 0x29, 0x5d, 0x77, 0x3a, 0x9d, - 0x8b, 0xf1, 0x78, 0x7c, 0x07, 0x65, 0xdc, 0xed, - 0x76, 0x6f, 0x1a, 0x25, 0x66, 0x15, 0x2e, 0xb1, - 0xd5, 0xac, 0x56, 0xc2, 0xb0, 0x22, 0x04, 0xef, - 0xc1, 0x9a, 0xda, 0xcc, 0xff, 0xf4, 0x6b, 0xd5, - 0x94, 0x92, 0xa5, 0x53, 0x17, 0x6b, 0x3f, 0xce, - 0x06, 0x3e, 0x71, 0x88, 0xed, 0xd1, 0x68, 0x34, - 0x0b, 0x21, 0x4c, 0x7a, 0xbd, 0xde, 0x7d, 0xd9, - 0x7a, 0x38, 0x1c, 0x3e, 0x86, 0x10, 0x26, 0xfd, - 0x7e, 0xff, 0xa9, 0x01, 0xc2, 0x4b, 0x21, 0xa7, - 0x00, 0xd0, 0xfa, 0xe3, 0x6a, 0x1f, 0x78, 0xc0, - 0xb4, 0x90, 0x33, 0xcf, 0x44, 0xec, 0x66, 0x42, - 0x56, 0xe9, 0x0d, 0xcf, 0x32, 0x72, 0xd5, 0xd2, - 0xe4, 0xbf, 0x21, 0xff, 0x02, 0x4d, 0xb5, 0x74, - 0x79, 0x60, 0x9f, 0x78, 0x78, 0x00, 0x00, 0x00, - 0x20, 0x7a, 0x54, 0x58, 0x74, 0x74, 0x69, 0x66, - 0x66, 0x3a, 0x72, 0x6f, 0x77, 0x73, 0x2d, 0x70, - 0x65, 0x72, 0x2d, 0x73, 0x74, 0x72, 0x69, 0x70, - 0x00, 0x00, 0x78, 0xda, 0x33, 0xb5, 0x30, 0x05, - 0x00, 0x01, 0x47, 0x00, 0xa3, 0x38, 0xda, 0x77, - 0x3b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, - 0x44, 0xae, 0x42, 0x60, 0x82}; - - /* close_pressed.png - 458 bytes */ - static const unsigned char close_pressed_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, - 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, - 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, - 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, - 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, - 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, - 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, - 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, - 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, - 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01, - 0x29, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d, - 0x92, 0x31, 0x6a, 0xc3, 0x40, 0x14, 0x44, 0x9f, - 0x2c, 0xe1, 0xc2, 0x10, 0x08, 0xc4, 0xe0, 0x22, - 0x76, 0x21, 0x04, 0x29, 0x13, 0xf0, 0x05, 0x54, - 0xa5, 0x8a, 0x0f, 0xb2, 0x8d, 0x0e, 0xa0, 0x23, - 0xa8, 0x56, 0xa3, 0x03, 0xe8, 0x08, 0xba, 0x80, - 0xba, 0xb0, 0x45, 0x0a, 0x97, 0x02, 0x23, 0x58, - 0x83, 0x40, 0x60, 0x61, 0x08, 0x11, 0x04, 0x57, - 0x69, 0xf6, 0xc3, 0x46, 0x38, 0x24, 0x64, 0xca, - 0xd9, 0x19, 0xe6, 0xff, 0xfd, 0xe3, 0xf1, 0x1d, - 0x2b, 0x20, 0x02, 0x36, 0xc0, 0xd2, 0x72, 0x27, - 0xe0, 0x08, 0x1c, 0x80, 0x5e, 0x84, 0x9e, 0x63, - 0x7a, 0x04, 0xb6, 0xc0, 0x1d, 0xd7, 0x31, 0x00, - 0x6f, 0xc0, 0x1e, 0xc0, 0x77, 0x4c, 0x31, 0x70, - 0xc3, 0xcf, 0x58, 0xd8, 0x49, 0x3e, 0x81, 0x7e, - 0x66, 0xc7, 0xdb, 0x02, 0x73, 0x80, 0xdd, 0x6e, - 0xb7, 0x9a, 0x3a, 0x1c, 0x6e, 0x6e, 0xb5, 0x2b, - 0x1f, 0x78, 0x02, 0x1e, 0x44, 0x90, 0x65, 0xd9, - 0x8b, 0xef, 0xfb, 0xef, 0x5a, 0xeb, 0x33, 0x40, - 0x92, 0x24, 0x51, 0x9a, 0xa6, 0xcf, 0xc6, 0x98, - 0xae, 0x69, 0x9a, 0xd1, 0x26, 0x8f, 0x81, 0x8d, - 0x07, 0xa0, 0xaa, 0xaa, 0x3e, 0x0c, 0xc3, 0x5a, - 0x29, 0x15, 0x0b, 0xa7, 0x94, 0x8a, 0x8b, 0xa2, - 0xa8, 0xab, 0xaa, 0xea, 0x9d, 0x21, 0x36, 0x81, - 0xf3, 0x7b, 0x00, 0xe4, 0x79, 0x7e, 0x10, 0x03, - 0x40, 0x51, 0x14, 0xb5, 0x70, 0x0e, 0x96, 0x33, - 0xfe, 0x89, 0xc0, 0xde, 0x69, 0x2d, 0x44, 0x92, - 0x24, 0x91, 0x8c, 0xe7, 0x26, 0x4f, 0x52, 0x4f, - 0x81, 0x3d, 0xee, 0x5a, 0x3e, 0x47, 0x4c, 0xae, - 0x50, 0x29, 0x15, 0xb7, 0x6d, 0xfb, 0xe1, 0xec, - 0x79, 0xf4, 0x81, 0x0b, 0x70, 0x0f, 0x2c, 0x9a, - 0xa6, 0x19, 0x8d, 0x31, 0x5d, 0x59, 0x96, 0x47, - 0x31, 0x69, 0xad, 0xcf, 0xc6, 0x98, 0xce, 0x31, - 0x0d, 0x80, 0x96, 0xe6, 0x48, 0x01, 0xe6, 0xbf, - 0xac, 0x76, 0x01, 0x6a, 0x60, 0x2f, 0xcd, 0xe9, - 0x6d, 0x23, 0x6e, 0xed, 0x9d, 0xae, 0x61, 0x00, - 0x5e, 0xb1, 0x95, 0xf3, 0x26, 0x8f, 0x7f, 0x2e, - 0xf9, 0x17, 0x50, 0x59, 0x74, 0x13, 0x34, 0x41, - 0x04, 0x5a, 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, - 0x58, 0x74, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, - 0x6f, 0x77, 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, - 0x73, 0x74, 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, - 0xda, 0x33, 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, - 0x00, 0xa3, 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, - 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, - 0x60, 0x82}; - // currently we only support the close bitmap here if ( button != wxTITLEBAR_BUTTON_CLOSE ) { @@ -829,38 +706,84 @@ void wxRendererMac::DrawTitleBarBitmap(wxWindow *win, return; } - // choose the correct image depending on flags - const void *data; - size_t len; + wxColour glyphColor; + // The following hard coded RGB values are based the close button in + // XCode 6+ welcome screen + bool drawCircle; if ( flags & wxCONTROL_PRESSED ) { - data = close_pressed_png; - len = WXSIZEOF(close_pressed_png); + drawCircle = true; + glyphColor = wxColour(104, 104, 104); + dc.SetPen(wxPen(wxColour(70, 70, 71), 1)); + dc.SetBrush(wxColour(78, 78, 78)); } else if ( flags & wxCONTROL_CURRENT ) { - data = close_current_png; - len = WXSIZEOF(close_current_png); + drawCircle = true; + glyphColor = *wxWHITE; + dc.SetPen(wxPen(wxColour(163, 165, 166), 1)); + dc.SetBrush(wxColour(182, 184, 187)); } else { - data = close_png; - len = WXSIZEOF(close_png); + drawCircle = false; + glyphColor = wxColour(145, 147, 149); } - // load it - wxMemoryInputStream mis(data, len); - wxImage image(mis, wxBITMAP_TYPE_PNG); - wxBitmap bmp(image); - wxASSERT_MSG( bmp.IsOk(), "failed to load embedded PNG image?" ); + if ( drawCircle ) + { + wxRect circleRect(rect); + circleRect.Deflate(2); - // and draw it centering it in the provided rectangle: we don't scale the - // image because this is really not going to look good for such a small - // (14*14) bitmap - dc.DrawBitmap(bmp, wxRect(bmp.GetSize()).CenterIn(rect).GetPosition()); + dc.DrawEllipse(circleRect); + } + + dc.SetPen(wxPen(glyphColor, 1)); + + wxRect centerRect(rect); + centerRect.Deflate(5); + centerRect.height++; + centerRect.width++; + + dc.DrawLine(centerRect.GetTopLeft(), centerRect.GetBottomRight()); + dc.DrawLine(centerRect.GetTopRight(), centerRect.GetBottomLeft()); } #endif // wxHAS_DRAW_TITLE_BAR_BITMAP +void wxRendererMac::DrawGauge(wxWindow* WXUNUSED(win), + wxDC& dc, + const wxRect& rect, + int value, + int max, + int WXUNUSED(flags)) +{ + const wxCoord x = rect.x; + const wxCoord y = rect.y; + const wxCoord w = rect.width; + const wxCoord h = rect.height; + + HIThemeTrackDrawInfo tdi; + tdi.version = 0; + tdi.min = 0; + tdi.value = value; + tdi.max = max; + tdi.bounds = CGRectMake(x, y, w, h); + tdi.attributes = kThemeTrackHorizontal; + tdi.enableState = kThemeTrackActive; + tdi.kind = kThemeLargeProgressBar; + + int milliSecondsPerStep = 1000 / 60; + wxLongLongNative localTime = wxGetLocalTimeMillis(); + tdi.trackInfo.progress.phase = localTime.GetValue() / milliSecondsPerStep % 32; + + CGContextRef cgContext; + wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl(); + + cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext(); + + HIThemeDrawTrack(&tdi, NULL, cgContext, kHIThemeOrientationNormal); +} + #endif diff --git a/Externals/wxWidgets3/src/osx/carbon/scrolbar.cpp b/Externals/wxWidgets3/src/osx/carbon/scrolbar.cpp deleted file mode 100644 index 006e93a351..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/scrolbar.cpp +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/scrolbar.cpp -// Purpose: wxScrollBar -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/scrolbar.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/log.h" - #include "wx/settings.h" -#endif - -#include "wx/osx/private.h" - -class wxOSXScrollBarCarbonImpl : public wxMacControl -{ -public : - wxOSXScrollBarCarbonImpl( wxWindowMac* peer) : wxMacControl( peer ) - { - } - - void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) - { - SetValue( value ); - SetControlViewSize(m_controlRef , thumbSize ); - } -protected: -}; - -wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - - wxMacControl* peer = new wxOSXScrollBarCarbonImpl( wxpeer ); - OSStatus err = CreateScrollBarControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - 0, 0, 100, 1, true /* liveTracking */, - GetwxMacLiveScrollbarActionProc(), - peer->GetControlRefAddr() ); - verify_noerr( err ); - return peer; -} diff --git a/Externals/wxWidgets3/src/osx/carbon/slider.cpp b/Externals/wxWidgets3/src/osx/carbon/slider.cpp deleted file mode 100644 index e5f6f3f4b5..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/slider.cpp +++ /dev/null @@ -1,69 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/slider.cpp -// Purpose: wxSlider -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_SLIDER - -#include "wx/slider.h" -#include "wx/osx/private.h" - -class wxMacSliderCarbonControl : public wxMacControl -{ -public : - wxMacSliderCarbonControl( wxWindowMac* peer ) : wxMacControl( peer ) - { - } - - // work around an OSX bug : if the control is having the keyboard focus it cannot - // be set to the full max/min values by dragging - virtual bool CanFocus() const - { - return false; - } -}; - - -wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - wxInt32 value, - wxInt32 minimum, - wxInt32 maximum, - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - int tickMarks = 0; - if ( style & wxSL_AUTOTICKS ) - tickMarks = (maximum - minimum) + 1; // +1 for the 0 value - - // keep the number of tickmarks from becoming unwieldy, therefore below it is ok to cast - // it to a UInt16 - while (tickMarks > 20) - tickMarks /= 5; - - - wxMacControl* peer = new wxMacSliderCarbonControl( wxpeer ); - OSStatus err = CreateSliderControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, - value, minimum, maximum, - kControlSliderPointsDownOrRight, - (UInt16) tickMarks, true /* liveTracking */, - GetwxMacLiveScrollbarActionProc(), - peer->GetControlRefAddr() ); - verify_noerr( err ); - - return peer; -} - -#endif // wxUSE_SLIDER diff --git a/Externals/wxWidgets3/src/osx/carbon/spinbutt.cpp b/Externals/wxWidgets3/src/osx/carbon/spinbutt.cpp deleted file mode 100644 index 061956428e..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/spinbutt.cpp +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/spinbutt.cpp -// Purpose: wxSpinButton -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_SPINBTN - -#include "wx/spinbutt.h" -#include "wx/osx/private.h" - - -wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - wxInt32 value, - wxInt32 minimum, - wxInt32 maximum, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ); - - wxMacControl* peer = new wxMacControl( wxpeer ); - OSStatus err = CreateLittleArrowsControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value, - minimum, maximum, 1, peer->GetControlRefAddr() ); - verify_noerr( err ); - - peer->SetActionProc( GetwxMacLiveScrollbarActionProc() ); - return peer ; -} - -#endif // wxUSE_SPINBTN diff --git a/Externals/wxWidgets3/src/osx/carbon/srchctrl.cpp b/Externals/wxWidgets3/src/osx/carbon/srchctrl.cpp deleted file mode 100644 index 56056d95a5..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/srchctrl.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/srchctrl.cpp -// Purpose: implements mac carbon wxSearchCtrl -// Author: Vince Harron -// Created: 2006-02-19 -// Copyright: Vince Harron -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_SEARCHCTRL - -#include "wx/srchctrl.h" - -#ifndef WX_PRECOMP - #include "wx/menu.h" -#endif //WX_PRECOMP - -#if wxUSE_NATIVE_SEARCH_CONTROL - -#include "wx/osx/uma.h" -#include "wx/osx/carbon/private/mactext.h" - -// ============================================================================ -// wxMacSearchFieldControl -// ============================================================================ - -class wxMacSearchFieldControl : public wxMacUnicodeTextControl, public wxSearchWidgetImpl -{ -public : - wxMacSearchFieldControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) ; - - // search field options - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; - - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; - - virtual void SetSearchMenu( wxMenu* menu ); - - virtual void SetDescriptiveText(const wxString& text); - - virtual bool SetFocus(); - -private: -} ; - -static const EventTypeSpec eventList[] = -{ - { kEventClassSearchField, kEventSearchFieldCancelClicked } , - { kEventClassSearchField, kEventSearchFieldSearchClicked } , -}; - -// ============================================================================ -// implementation -// ============================================================================ - -static pascal OSStatus wxMacSearchControlEventHandler( EventHandlerCallRef WXUNUSED(handler) , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - ControlRef controlRef ; - wxSearchCtrl* thisWindow = (wxSearchCtrl*) data ; - cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; - - switch( GetEventKind( event ) ) - { - case kEventSearchFieldCancelClicked : - thisWindow->HandleSearchFieldCancelHit() ; - break ; - case kEventSearchFieldSearchClicked : - thisWindow->HandleSearchFieldSearchHit() ; - break ; - } - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacSearchControlEventHandler ) - -wxMacSearchFieldControl::wxMacSearchFieldControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) : wxMacUnicodeTextControl( wxPeer ) -{ - m_font = wxPeer->GetFont() ; - m_windowStyle = style ; - m_selection.selStart = m_selection.selEnd = 0; - Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - wxCFStringRef cf(st , m_font.GetEncoding()) ; - - m_valueTag = kControlEditTextCFStringTag ; - - OptionBits attributes = kHISearchFieldAttributesSearchIcon; - - HIRect hibounds = { { bounds.left, bounds.top }, { bounds.right-bounds.left, bounds.bottom-bounds.top } }; - verify_noerr( HISearchFieldCreate( - &hibounds, - attributes, - 0, // MenuRef - CFSTR(""), - &m_controlRef - ) ); - HIViewSetVisible (m_controlRef, true); - - verify_noerr( SetData( 0, kControlEditTextCFStringTag , cf ) ) ; - - ::InstallControlEventHandler( m_controlRef, GetwxMacSearchControlEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, wxPeer, NULL); - SetNeedsFrame(false); - wxMacUnicodeTextControl::InstallEventHandlers(); -} - -// search field options -void wxMacSearchFieldControl::ShowSearchButton( bool show ) -{ - OptionBits set = 0; - OptionBits clear = 0; - if ( show ) - { - set |= kHISearchFieldAttributesSearchIcon; - } - else - { - clear |= kHISearchFieldAttributesSearchIcon; - } - HISearchFieldChangeAttributes( m_controlRef, set, clear ); -} - -bool wxMacSearchFieldControl::IsSearchButtonVisible() const -{ - OptionBits attributes = 0; - verify_noerr( HISearchFieldGetAttributes( m_controlRef, &attributes ) ); - return ( attributes & kHISearchFieldAttributesSearchIcon ) != 0; -} - -void wxMacSearchFieldControl::ShowCancelButton( bool show ) -{ - OptionBits set = 0; - OptionBits clear = 0; - if ( show ) - { - set |= kHISearchFieldAttributesCancel; - } - else - { - clear |= kHISearchFieldAttributesCancel; - } - HISearchFieldChangeAttributes( m_controlRef, set, clear ); -} - -bool wxMacSearchFieldControl::IsCancelButtonVisible() const -{ - OptionBits attributes = 0; - verify_noerr( HISearchFieldGetAttributes( m_controlRef, &attributes ) ); - return ( attributes & kHISearchFieldAttributesCancel ) != 0; -} - -void wxMacSearchFieldControl::SetSearchMenu( wxMenu* menu ) -{ - if ( menu ) - { - verify_noerr( HISearchFieldSetSearchMenu( m_controlRef, MAC_WXHMENU(menu->GetHMenu()) ) ); - } - else - { - verify_noerr( HISearchFieldSetSearchMenu( m_controlRef, 0 ) ); - } -} - -void wxMacSearchFieldControl::SetDescriptiveText(const wxString& text) -{ - verify_noerr( HISearchFieldSetDescriptiveText( - m_controlRef, - wxCFStringRef( text, wxFont::GetDefaultEncoding() ))); -} - -bool wxMacSearchFieldControl::SetFocus() -{ - // NB: We have to implement SetFocus a little differently because kControlFocusNextPart - // leads to setting the focus on the search icon rather than the text area. - // We get around this by explicitly telling the control to set focus to the - // text area. - - OSStatus err = SetKeyboardFocus( GetControlOwner( m_controlRef ), m_controlRef, kControlEditTextPart ); - if ( err == errCouldntSetFocus ) - return false ; - SetUserFocusWindow(GetControlOwner( m_controlRef ) ); - return true; -} - -wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer, - wxWindowMac* WXUNUSED(parent), - wxWindowID WXUNUSED(id), - const wxString& str, - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - wxMacControl* peer = new wxMacSearchFieldControl( wxpeer , str , pos , size , style ); - - return peer; -} - -#endif // wxUSE_NATIVE_SEARCH_CONTROL - -#endif // wxUSE_SEARCHCTRL diff --git a/Externals/wxWidgets3/src/osx/carbon/statbmp.cpp b/Externals/wxWidgets3/src/osx/carbon/statbmp.cpp deleted file mode 100644 index 7a4ed047a5..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/statbmp.cpp +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/statbmp.cpp -// Purpose: wxStaticBitmap -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_STATBMP - -#include "wx/statbmp.h" - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" -#endif - -/* - * wxStaticBitmap - */ - -BEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase) - EVT_PAINT(wxStaticBitmap::OnPaint) -END_EVENT_TABLE() - -bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, - const wxBitmap& bitmap, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) -{ - SetName(name); - - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - m_bitmap = bitmap; - if ( id == wxID_ANY ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - m_windowStyle = style; - - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); - SetInitialSize( size ) ; - - return ret; -} - -void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) -{ - m_bitmap = bitmap; - InvalidateBestSize(); - SetSize(GetBestSize()); - Refresh() ; -} - -void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) ) -{ - wxPaintDC dc(this); - PrepareDC(dc); - - if (m_bitmap.IsOk()) - { - dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ; - } -} - -wxSize wxStaticBitmap::DoGetBestSize() const -{ - if ( m_bitmap.IsOk() ) - return DoGetSizeFromClientSize( wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) ); - - // this is completely arbitrary - return DoGetSizeFromClientSize( wxSize(16, 16) ); -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/carbon/statbox.cpp b/Externals/wxWidgets3/src/osx/carbon/statbox.cpp deleted file mode 100644 index 5e5d9027ac..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/statbox.cpp +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/statbox.cpp -// Purpose: wxStaticBox -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_STATBOX - -#include "wx/statbox.h" -#include "wx/osx/private.h" - -wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - - wxMacControl* peer = new wxMacControl( wxpeer ); - OSStatus err = CreateGroupBoxControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), - true /*primary*/, peer->GetControlRefAddr() ); - verify_noerr( err ); - return peer; -} -#endif // wxUSE_STATBOX - diff --git a/Externals/wxWidgets3/src/osx/carbon/statbrma.cpp b/Externals/wxWidgets3/src/osx/carbon/statbrma.cpp index cc7e463ba1..9bc4274227 100644 --- a/Externals/wxWidgets3/src/osx/carbon/statbrma.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/statbrma.cpp @@ -26,9 +26,9 @@ #define wxFIELD_TEXT_MARGIN 2 -BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric) +wxBEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric) EVT_PAINT(wxStatusBarMac::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxStatusBarMac::wxStatusBarMac(wxWindow *parent, @@ -125,27 +125,17 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) wxPaintDC dc(this); dc.Clear(); - int major, minor; - wxGetOsVersion( &major, &minor ); int w, h; GetSize( &w, &h ); if ( MacIsReallyHilited() ) { - wxPen white( *wxWHITE , 1 , wxSOLID ); - if (major >= 10) - { - // Finder statusbar border color: (Project Builder similar is 9B9B9B) - if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL ) - dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID)); - else - dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID)); - } + wxPen white( *wxWHITE , 1 , wxPENSTYLE_SOLID ); + // Finder statusbar border color: (Project Builder similar is 9B9B9B) + if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL ) + dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxPENSTYLE_SOLID)); else - { - wxPen black( *wxBLACK , 1 , wxSOLID ); - dc.SetPen(black); - } + dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxPENSTYLE_SOLID)); dc.DrawLine(0, 0, w, 0); dc.SetPen(white); @@ -153,11 +143,8 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) } else { - if (major >= 10) - // Finder statusbar border color: (Project Builder similar is 9B9B9B) - dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID)); - else - dc.SetPen(wxPen(wxColour(0x80, 0x80, 0x80), 1, wxSOLID)); + // Finder statusbar border color: (Project Builder similar is 9B9B9B) + dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxPENSTYLE_SOLID)); dc.DrawLine(0, 0, w, 0); } diff --git a/Externals/wxWidgets3/src/osx/carbon/statline.cpp b/Externals/wxWidgets3/src/osx/carbon/statline.cpp deleted file mode 100644 index 62a3db302c..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/statline.cpp +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/statline.cpp -// Purpose: wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/statline.h" - -#ifndef WX_PRECOMP - #include "wx/statbox.h" -#endif - -bool wxStaticLine::Create( wxWindow *parent, - wxWindowID id, - const wxPoint &pos, - const wxSize &size, - long style, - const wxString &name ) -{ - if ( !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ) ) - return false; - - // this is ugly but it's better than nothing: - // use a thin static box to emulate static line - - wxSize sizeReal = AdjustSize( size ); - -// m_statbox = new wxStaticBox( parent, id, wxT(""), pos, sizeReal, style, name ); - - return true; -} diff --git a/Externals/wxWidgets3/src/osx/carbon/statlmac.cpp b/Externals/wxWidgets3/src/osx/carbon/statlmac.cpp deleted file mode 100644 index 415d236f5a..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/statlmac.cpp +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/statlmac.cpp -// Purpose: a generic wxStaticLine class -// Author: Vadim Zeitlin -// Created: 28.06.99 -// Copyright: (c) 1998 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_STATLINE - -#include "wx/statline.h" - -#ifndef WX_PRECOMP - #include "wx/statbox.h" -#endif - -#include "wx/osx/private.h" - -// ============================================================================ -// implementation -// ============================================================================ - -wxWidgetImplType* wxWidgetImpl::CreateStaticLine( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, peer->GetControlRefAddr() ) ) ; - return peer; -} - -#endif //wxUSE_STATLINE diff --git a/Externals/wxWidgets3/src/osx/carbon/stattext.cpp b/Externals/wxWidgets3/src/osx/carbon/stattext.cpp deleted file mode 100644 index 8b0c9714c4..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/stattext.cpp +++ /dev/null @@ -1,140 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/stattext.cpp -// Purpose: wxStaticText -// Author: Stefan Csomor -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_STATTEXT - -#include "wx/stattext.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/dc.h" - #include "wx/dcclient.h" - #include "wx/settings.h" -#endif // WX_PRECOMP - -#include "wx/osx/private.h" - -#include - -class wxMacStaticText : public wxMacControl -{ -public: - wxMacStaticText( wxWindowMac* peer ) : wxMacControl(peer) - { - } - void SetLabel(const wxString& title, wxFontEncoding encoding) - { - wxCFStringRef str( title, encoding ); - OSStatus err = SetData(kControlEntireControl, kControlStaticTextCFStringTag, str); - verify_noerr( err ); - } -}; - -wxSize wxStaticText::DoGetBestSize() const -{ - Point bounds; -#if wxOSX_USE_CARBON - Rect bestsize = { 0 , 0 , 0 , 0 } ; - - // try the built-in best size if available - Boolean former = GetPeer()->GetData( kControlStaticTextIsMultilineTag); - GetPeer()->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); - GetPeer()->GetBestRect( &bestsize ) ; - GetPeer()->SetData( kControlStaticTextIsMultilineTag, former ); - - if ( !EmptyRect( &bestsize ) ) - { - bounds.h = bestsize.right - bestsize.left ; - bounds.v = bestsize.bottom - bestsize.top ; - } - else -#endif - { -#if wxOSX_USE_CARBON - ControlFontStyleRec controlFont; - OSStatus err = GetPeer()->GetData( kControlEntireControl, kControlFontStyleTag, &controlFont ); - verify_noerr( err ); - -#if wxOSX_USE_ATSU_TEXT - SInt16 baseline; - if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont ) - { - // GetThemeTextDimensions will cache strings and the documentation - // says not to use the NoCopy string creation calls. - // This also means that we can't use CFSTR without - // -fno-constant-cfstrings if the library might be unloaded, - // as GetThemeTextDimensions may cache a pointer to our - // unloaded segment. - wxCFStringRef str( !m_label.empty() ? m_label : wxString(" "), - GetFont().GetEncoding() ); - - err = GetThemeTextDimensions( - (CFStringRef)str, - m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline ); - verify_noerr( err ); - } - else -#endif -#endif - { - wxClientDC dc(const_cast(this)); - wxCoord width, height ; - dc.GetTextExtent( m_label , &width, &height); - bounds.h = width; - bounds.v = height; - } - - if ( m_label.empty() ) - bounds.h = 0; - } - bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize(); - bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize(); - - return wxSize( bounds.h, bounds.v ); -} - -/* - FIXME: UpdateLabel() should be called on size events when wxST_ELLIPSIZE_START is set - to allow correct dynamic ellipsizing of the label -*/ - -wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); - - wxMacControl* peer = new wxMacStaticText( wxpeer ); - OSStatus err = CreateStaticTextControl( - MAC_WXHWND(parent->MacGetTopLevelWindowRef()), - &bounds, NULL, NULL, peer->GetControlRefAddr() ); - verify_noerr( err ); - - if ( ( style & wxST_ELLIPSIZE_END ) || ( style & wxST_ELLIPSIZE_MIDDLE ) ) - { - TruncCode tCode = truncEnd; - if ( style & wxST_ELLIPSIZE_MIDDLE ) - tCode = truncMiddle; - - err = peer->SetData( kControlStaticTextTruncTag, tCode ); - err = peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); - } - return peer; -} - -#endif //if wxUSE_STATTEXT diff --git a/Externals/wxWidgets3/src/osx/carbon/taskbar.cpp b/Externals/wxWidgets3/src/osx/carbon/taskbar.cpp deleted file mode 100644 index f8a8c4821e..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/taskbar.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/taskbar.cpp -// Purpose: wxTaskBarIcon -// Author: Ryan Norton -// Modified by: -// Created: 09/25/2004 -// Copyright: (c) 2004 Ryan Norton -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TASKBARICON - -#include "wx/taskbar.h" - -#ifndef WX_PRECOMP - #include "wx/dcmemory.h" - #include "wx/menu.h" - #include "wx/toplevel.h" - #include "wx/icon.h" -#endif - -#include "wx/osx/private.h" - -class wxTaskBarIconImpl -{ -public: - wxTaskBarIconImpl(wxTaskBarIcon* parent); - virtual ~wxTaskBarIconImpl(); - - virtual bool IsIconInstalled() const = 0; - virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip) = 0; - virtual bool RemoveIcon() = 0; - virtual bool PopupMenu(wxMenu *menu) = 0; - - wxMenu * CreatePopupMenu() - { return m_parent->CreatePopupMenu(); } - - wxTaskBarIcon *m_parent; - class wxTaskBarIconWindow *m_menuEventWindow; - - wxDECLARE_NO_COPY_CLASS(wxTaskBarIconImpl); -}; - -//----------------------------------------------------------------------------- -// -// wxTaskBarIconWindow -// -// Event handler for menus -// NB: Since wxWindows in Mac HAVE to have parents we need this to be -// a top level window... -//----------------------------------------------------------------------------- - -class wxTaskBarIconWindow : public wxTopLevelWindow -{ -public: - wxTaskBarIconWindow(wxTaskBarIconImpl *impl) - : wxTopLevelWindow(NULL, wxID_ANY, wxEmptyString), m_impl(impl) - { - Connect( - -1, wxEVT_MENU, - wxCommandEventHandler(wxTaskBarIconWindow::OnMenuEvent) ); - } - - void OnMenuEvent(wxCommandEvent& event) - { - m_impl->m_parent->ProcessEvent(event); - } - -private: - wxTaskBarIconImpl *m_impl; -}; - -class wxDockTaskBarIcon : public wxTaskBarIconImpl -{ -public: - wxDockTaskBarIcon(wxTaskBarIcon* parent); - virtual ~wxDockTaskBarIcon(); - - virtual bool IsIconInstalled() const; - virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip); - virtual bool RemoveIcon(); - virtual bool PopupMenu(wxMenu *menu); - - wxMenu* DoCreatePopupMenu(); - - EventHandlerRef m_eventHandlerRef; - EventHandlerUPP m_eventupp; - wxWindow *m_eventWindow; - wxMenu *m_pMenu; - MenuRef m_theLastMenu; - bool m_iconAdded; -}; - -// Forward declarations for utility functions for dock implementation -pascal OSStatus wxDockEventHandler( - EventHandlerCallRef inHandlerCallRef, - EventRef inEvent, void* pData ); -wxMenu * wxDeepCopyMenu( wxMenu *menu ); - - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// -// wxTaskBarIconImpl -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -wxTaskBarIconImpl::wxTaskBarIconImpl(wxTaskBarIcon* parent) - : m_parent(parent), m_menuEventWindow(new wxTaskBarIconWindow(this)) -{ -} - -wxTaskBarIconImpl::~wxTaskBarIconImpl() -{ - delete m_menuEventWindow; -} - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// -// wxDockTaskBarIcon -// -// OS X Dock implementation of wxTaskBarIcon using Carbon -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//----------------------------------------------------------------------------- -// wxDockEventHandler -// -// This is the global Mac/Carbon event handler for the dock. -// We need this for two reasons: -// 1) To handle wxTaskBarIcon menu events (see below for why) -// 2) To handle events from the dock when it requests a menu -//----------------------------------------------------------------------------- -pascal OSStatus -wxDockEventHandler(EventHandlerCallRef WXUNUSED(inHandlerCallRef), - EventRef inEvent, - void *pData) -{ - // Get the parameters we want from the event - wxDockTaskBarIcon* pTB = (wxDockTaskBarIcon*) pData; - const UInt32 eventClass = GetEventClass(inEvent); - const UInt32 eventKind = GetEventKind(inEvent); - - OSStatus err = eventNotHandledErr; - - // Handle wxTaskBar menu events (note that this is a global event handler - // so it will actually get called by all commands/menus) - if ((eventClass == kEventClassCommand) && (eventKind == kEventCommandProcess || eventKind == kEventCommandUpdateStatus )) - { - // if we have no taskbar menu quickly pass it back to wxApp - if (pTB->m_pMenu != NULL) - { - // This is the real reason why we need this. Normally menus - // get handled in wxMacAppEventHandler - // However, in the case of a taskbar menu call - // command.menu.menuRef IS NULL! - // Which causes the wxApp handler just to skip it. - - // get the HICommand from the event - HICommand command; - if (GetEventParameter(inEvent, kEventParamDirectObject, - typeHICommand, NULL,sizeof(HICommand), NULL, &command ) == noErr) - { - // Obtain the REAL menuRef and the menuItemIndex in the real menuRef - // - // NOTE: menuRef is generally used here for submenus, as - // GetMenuItemRefCon could give an incorrect wxMenuItem if we pass - // just the top level wxTaskBar menu - MenuItemIndex menuItemIndex; - MenuRef menuRef; - MenuRef taskbarMenuRef = MAC_WXHMENU(pTB->m_pMenu->GetHMenu()); - - // the next command is only successful if it was a command from the taskbar menu - // otherwise we pass it on - if (GetIndMenuItemWithCommandID(taskbarMenuRef,command.commandID, - 1, &menuRef, &menuItemIndex ) == noErr) - { - wxMenu* itemMenu = wxFindMenuFromMacMenu( menuRef ) ; - int id = wxMacCommandToId( command.commandID ) ; - wxMenuItem *item = NULL; - - if (id != 0) // get the wxMenuItem reference from the MenuRef - GetMenuItemRefCon( menuRef, menuItemIndex, (URefCon*) &item ); - - if (item && itemMenu ) - { - if ( eventKind == kEventCommandProcess ) - { - if ( itemMenu->HandleCommandProcess( item ) ) - err = noErr; - } - else if ( eventKind == kEventCommandUpdateStatus ) - { - if ( itemMenu->HandleCommandUpdateStatus( item ) ) - err = noErr; - } - } - } - } - } //end if noErr on getting HICommand from event - } - else if ((eventClass == kEventClassApplication) && (eventKind == kEventAppGetDockTileMenu )) - { - // process the right click events - // NB: This may result in double or even triple-creation of the menus - // We need to do this for 2.4 compat, however - wxTaskBarIconEvent downevt(wxEVT_TASKBAR_RIGHT_DOWN, NULL); - pTB->m_parent->ProcessEvent(downevt); - - wxTaskBarIconEvent upevt(wxEVT_TASKBAR_RIGHT_UP, NULL); - pTB->m_parent->ProcessEvent(upevt); - - // create popup menu - wxMenu* menu = pTB->DoCreatePopupMenu(); - - if (menu != NULL) - { - // note to self - a MenuRef *is* a MenuHandle - MenuRef hMenu = MAC_WXHMENU(menu->GetHMenu()); - - // When SetEventParameter is called it will decrement - // the reference count of the menu - we need to make - // sure it stays around in the wxMenu class here - CFRetain(hMenu); - - // set the actual dock menu - err = SetEventParameter( - inEvent, kEventParamMenuRef, - typeMenuRef, sizeof(MenuRef), &hMenu ); - verify_noerr( err ); - } - } - - return err; -} - -//----------------------------------------------------------------------------- -// wxDeepCopyMenu -// -// Performs a top-to-bottom copy of the input menu and all of its -// submenus. -// -// This is mostly needed for 2.4 compatibility. However wxPython and others -// still use this way of setting the taskbarmenu. -//----------------------------------------------------------------------------- -wxMenu * wxDeepCopyMenu( wxMenu *menu ) -{ - if (menu == NULL) - return NULL; - - // NB: Here we have to perform a deep copy of the menu, - // copying each and every menu item from menu to m_pMenu. - // Other implementations use wxWindow::PopupMenu here, - // which idle execution until the user selects something, - // but since the Mac handles this internally, we can't - - // and have no way at all to idle it while the dock menu - // is being shown before menu goes out of scope (it may - // not be on the heap, and may expire right after this function - // is done - we need it to last until the carbon event is triggered - - // that's when the user right clicks). - // - // Also, since there is no equal (assignment) operator - // on either wxMenu or wxMenuItem, we have to do all the - // dirty work ourselves. - - // perform a deep copy of the menu - wxMenuItemList& theList = menu->GetMenuItems(); - wxMenuItemList::compatibility_iterator theNode = theList.GetFirst(); - - // create the main menu - wxMenu *m_pMenu = new wxMenu(menu->GetTitle()); - - while (theNode != NULL) - { - wxMenuItem* theItem = theNode->GetData(); - m_pMenu->Append( - new wxMenuItem( - m_pMenu, // parent menu - theItem->GetId(), // id - theItem->GetItemLabel(), // text label - theItem->GetHelp(), // status bar help string - theItem->GetKind(), // menu flags - checkable, separator, etc. - wxDeepCopyMenu(theItem->GetSubMenu()) )); // submenu - - theNode = theNode->GetNext(); - } - - return m_pMenu; -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon ctor -// -// Initializes the dock implementation of wxTaskBarIcon. -// -// Here we create some Mac-specific event handlers and UPPs. -//----------------------------------------------------------------------------- -wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent) - : wxTaskBarIconImpl(parent), - m_eventHandlerRef(NULL), m_pMenu(NULL), - m_theLastMenu(GetApplicationDockTileMenu()), m_iconAdded(false) -{ - // register the events that will return the dock menu - EventTypeSpec tbEventList[] = - { - { kEventClassCommand, kEventProcessCommand }, - { kEventClassCommand, kEventCommandUpdateStatus }, - { kEventClassApplication, kEventAppGetDockTileMenu } - }; - - m_eventupp = NewEventHandlerUPP(wxDockEventHandler); - wxASSERT(m_eventupp != NULL); - - OSStatus err = InstallApplicationEventHandler( - m_eventupp, - GetEventTypeCount(tbEventList), tbEventList, - this, &m_eventHandlerRef); - verify_noerr( err ); -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon Destructor -// -// Cleans up mac events and restores the old icon to the dock -//----------------------------------------------------------------------------- -wxDockTaskBarIcon::~wxDockTaskBarIcon() -{ - // clean up event handler and event UPP - RemoveEventHandler(m_eventHandlerRef); - DisposeEventHandlerUPP(m_eventupp); - - // restore old icon and menu to the dock - RemoveIcon(); -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon::DoCreatePopupMenu -// -// Helper function that handles a request from the dock event handler -// to get the menu for the dock -//----------------------------------------------------------------------------- -wxMenu * wxDockTaskBarIcon::DoCreatePopupMenu() -{ - // get the menu from the parent - wxMenu* theNewMenu = CreatePopupMenu(); - - if (theNewMenu) - { - delete m_pMenu; - m_pMenu = theNewMenu; - m_pMenu->SetInvokingWindow(m_menuEventWindow); - } - - // the return here can be one of three things - // (in order of priority): - // 1) User passed a menu from CreatePopupMenu override - // 2) menu sent to and copied from PopupMenu - // 3) If neither (1) or (2), then NULL - // - return m_pMenu; -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon::IsIconInstalled -// -// Returns whether or not the dock is not using the default image -//----------------------------------------------------------------------------- -bool wxDockTaskBarIcon::IsIconInstalled() const -{ - return m_iconAdded; -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon::SetIcon -// -// Sets the icon for the dock CGImage functions and SetApplicationDockTileImage -//----------------------------------------------------------------------------- -bool wxDockTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& WXUNUSED(tooltip)) -{ - // convert the wxIcon into a wxBitmap so we can perform some - // wxBitmap operations with it - wxBitmap bmp( icon ); - wxASSERT( bmp.IsOk() ); - - // get the CGImageRef for the wxBitmap: - // OSX builds only, but then the dock only exists in OSX - CGImageRef pImage = (CGImageRef) bmp.CreateCGImage(); - wxASSERT( pImage != NULL ); - - // actually set the dock image - OSStatus err = SetApplicationDockTileImage( pImage ); - verify_noerr( err ); - - // free the CGImage, now that it's referenced by the dock - if (pImage != NULL) - CGImageRelease( pImage ); - - bool success = (err == noErr); - m_iconAdded = success; - - return success; -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon::RemoveIcon -// -// Restores the old image for the dock via RestoreApplicationDockTileImage -//----------------------------------------------------------------------------- -bool wxDockTaskBarIcon::RemoveIcon() -{ - wxDELETE(m_pMenu); - - // restore old icon to the dock - OSStatus err = RestoreApplicationDockTileImage(); - verify_noerr( err ); - - // restore the old menu to the dock - SetApplicationDockTileMenu( m_theLastMenu ); - - bool success = (err == noErr); - m_iconAdded = !success; - - return success; -} - -//----------------------------------------------------------------------------- -// wxDockTaskBarIcon::PopupMenu -// -// 2.4 and wxPython method that "pops of the menu in the taskbar". -// -// In reality because of the way the dock menu works in carbon -// we just save the menu, and if the user didn't override CreatePopupMenu -// return the menu passed here, thus sort of getting the same effect. -//----------------------------------------------------------------------------- -bool wxDockTaskBarIcon::PopupMenu(wxMenu *menu) -{ - wxASSERT(menu != NULL); - - delete m_pMenu; - - // start copy of menu - m_pMenu = wxDeepCopyMenu(menu); - - // finish up - m_pMenu->SetInvokingWindow(m_menuEventWindow); - - return true; -} - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// -// wxTaskBarIcon -// -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) - -//----------------------------------------------------------------------------- -// wxTaskBarIcon Constructor -// -// Creates the backend -// -// Note that we only support DOCK currently as others require cocoa and -// also some require hacks and other such things. (MenuExtras are -// actually separate programs that also require a special undocumented id -// hack and other such fun stuff). -//----------------------------------------------------------------------------- -wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType WXUNUSED_UNLESS_DEBUG(nType)) -{ - wxASSERT_MSG( - nType == wxTBI_DOCK, - wxT("Only the wxTBI_DOCK implementation of wxTaskBarIcon on Mac-Carbon is currently supported!") ); - - m_impl = new wxDockTaskBarIcon(this); -} - -//----------------------------------------------------------------------------- -// wxTaskBarIcon Destructor -// -// Destroys the backend -//----------------------------------------------------------------------------- -wxTaskBarIcon::~wxTaskBarIcon() -{ - delete m_impl; -} - -//----------------------------------------------------------------------------- -// wxTaskBarIcon::SetIcon -// wxTaskBarIcon::RemoveIcon -// wxTaskBarIcon::PopupMenu -// -// Just calls the backend version of the said function. -//----------------------------------------------------------------------------- -bool wxTaskBarIcon::IsIconInstalled() const -{ return m_impl->IsIconInstalled(); } - -bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) -{ return m_impl->SetIcon(icon, tooltip); } - -bool wxTaskBarIcon::RemoveIcon() -{ return m_impl->RemoveIcon(); } - -bool wxTaskBarIcon::PopupMenu(wxMenu *menu) -{ return m_impl->PopupMenu(menu); } - -#endif // wxUSE_TASKBARICON diff --git a/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp b/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp deleted file mode 100644 index 53a0f908d0..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp +++ /dev/null @@ -1,1582 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/textctrl.cpp -// Purpose: wxTextCtrl -// Author: Stefan Csomor -// Modified by: Ryan Norton (MLTE GetLineLength and GetLineText) -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TEXTCTRL - -#include "wx/textctrl.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/dc.h" - #include "wx/button.h" - #include "wx/menu.h" - #include "wx/settings.h" - #include "wx/msgdlg.h" - #include "wx/toplevel.h" -#endif - -#ifdef __DARWIN__ - #include - #include -#else - #include -#endif - -#if wxUSE_STD_IOSTREAM - #if wxUSE_IOSTREAMH - #include - #else - #include - #endif -#endif - -#include "wx/filefn.h" -#include "wx/sysopt.h" -#include "wx/thread.h" - -#include "wx/osx/private.h" -#include "wx/osx/carbon/private/mactext.h" - -class wxMacFunctor -{ -public : - wxMacFunctor() {} - virtual ~wxMacFunctor() {} - - virtual void* operator()() = 0 ; - - static void* CallBackProc( void *param ) - { - wxMacFunctor* f = (wxMacFunctor*) param ; - void *result = (*f)() ; - return result ; - } -} ; - -template - -class wxMacObjectFunctor1 : public wxMacFunctor -{ - typedef void (classtype::*function)( param1type p1 ) ; - typedef void (classtype::*ref_function)( const param1type& p1 ) ; -public : - wxMacObjectFunctor1( classtype *obj , function f , param1type p1 ) : - wxMacFunctor() - { - m_object = obj ; - m_function = f ; - m_param1 = p1 ; - } - - wxMacObjectFunctor1( classtype *obj , ref_function f , param1type p1 ) : - wxMacFunctor() - { - m_object = obj ; - m_refFunction = f ; - m_param1 = p1 ; - } - - virtual ~wxMacObjectFunctor1() {} - - virtual void* operator()() - { - (m_object->*m_function)( m_param1 ) ; - return NULL ; - } - -private : - classtype* m_object ; - param1type m_param1 ; - union - { - function m_function ; - ref_function m_refFunction ; - } ; -} ; - -template -void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 ) -{ - wxMacObjectFunctor1 params(object, function, p1) ; - void *result = - MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ; - return result ; -} - -template -void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 ) -{ - wxMacObjectFunctor1 params(object, function, p1) ; - void *result = - MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ; - return result ; -} - -template -void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 ) -{ - wxMutexGuiLeave() ; - void *result = wxMacMPRemoteCall( object , function , p1 ) ; - wxMutexGuiEnter() ; - return result ; -} - -template -void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 ) -{ - wxMutexGuiLeave() ; - void *result = wxMacMPRemoteCall( object , function , p1 ) ; - wxMutexGuiEnter() ; - return result ; -} - -class WXDLLEXPORT wxMacPortSaver -{ - wxDECLARE_NO_COPY_CLASS(wxMacPortSaver); - -public: - wxMacPortSaver( GrafPtr port ); - ~wxMacPortSaver(); -private : - GrafPtr m_port; -}; - - -/* - Clips to the visible region of a control within the current port - */ - -class WXDLLEXPORT wxMacWindowClipper : public wxMacPortSaver -{ - wxDECLARE_NO_COPY_CLASS(wxMacWindowClipper); - -public: - wxMacWindowClipper( const wxWindow* win ); - ~wxMacWindowClipper(); -private: - GrafPtr m_newPort; - RgnHandle m_formerClip; - RgnHandle m_newClip; -}; - -wxMacPortSaver::wxMacPortSaver( GrafPtr port ) -{ - ::GetPort( &m_port ); - ::SetPort( port ); -} - -wxMacPortSaver::~wxMacPortSaver() -{ - ::SetPort( m_port ); -} - -wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) : -wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ) -{ - m_newPort = (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ; - m_formerClip = NewRgn() ; - m_newClip = NewRgn() ; - GetClip( m_formerClip ) ; - - if ( win ) - { - // guard against half constructed objects, this just leads to a empty clip - if ( win->GetPeer() ) - { - int x = 0 , y = 0; - win->MacWindowToRootWindow( &x, &y ) ; - - // get area including focus rect - HIShapeGetAsQDRgn( ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ); - if ( !EmptyRgn( m_newClip ) ) - OffsetRgn( m_newClip , x , y ) ; - } - - SetClip( m_newClip ) ; - } -} - -wxMacWindowClipper::~wxMacWindowClipper() -{ - SetPort( m_newPort ) ; - SetClip( m_formerClip ) ; - DisposeRgn( m_newClip ) ; - DisposeRgn( m_formerClip ) ; -} - -// common parts for implementations based on MLTE - -class wxMacMLTEControl : public wxMacControl, public wxTextWidgetImpl -{ -public : - wxMacMLTEControl( wxTextCtrl *peer ) ; - ~wxMacMLTEControl() {} - - virtual bool CanFocus() const - { return true; } - - virtual wxString GetStringValue() const ; - virtual void SetStringValue( const wxString &str ) ; - - static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ; - - void AdjustCreationAttributes( const wxColour& background, bool visible ) ; - - virtual void SetFont( const wxFont & font, const wxColour& foreground, long windowStyle, bool ignoreBlack ) ; - virtual void SetBackgroundColour(const wxColour& col ); - virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; - virtual void Copy() ; - virtual void Cut() ; - virtual void Paste() ; - virtual bool CanPaste() const ; - virtual void SetEditable( bool editable ) ; - virtual long GetLastPosition() const ; - virtual void Replace( long from, long to, const wxString &str ) ; - virtual void Remove( long from, long to ) ; - virtual void GetSelection( long* from, long* to ) const ; - virtual void SetSelection( long from, long to ) ; - - virtual void WriteText( const wxString& str ) ; - - virtual bool HasOwnContextMenu() const - { - TXNCommandEventSupportOptions options ; - TXNGetCommandEventSupport( m_txn , & options ) ; - return options & kTXNSupportEditCommandProcessing ; - } - - virtual void CheckSpelling(bool check) - { - TXNSetSpellCheckAsYouType( m_txn, (Boolean) check ); - } - virtual void Clear() ; - - virtual bool CanUndo() const ; - virtual void Undo() ; - virtual bool CanRedo() const; - virtual void Redo() ; - virtual int GetNumberOfLines() const ; - virtual long XYToPosition(long x, long y) const ; - virtual bool PositionToXY(long pos, long *x, long *y) const ; - virtual void ShowPosition( long pos ) ; - virtual int GetLineLength(long lineNo) const ; - virtual wxString GetLineText(long lineNo) const ; - - void SetTXNData( const wxString& st , TXNOffset start , TXNOffset end ) ; - TXNObject GetTXNObject() { return m_txn ; } - -protected : - void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ; - - TXNObject m_txn ; -} ; - -// implementation available under OSX - -class wxMacMLTEHIViewControl : public wxMacMLTEControl -{ -public : - wxMacMLTEHIViewControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) ; - virtual ~wxMacMLTEHIViewControl() ; - - virtual bool SetFocus() ; - virtual bool HasFocus() const ; - virtual void SetBackgroundColour(const wxColour& col ) ; - -protected : - HIViewRef m_scrollView ; - HIViewRef m_textView ; -}; - -// 'classic' MLTE implementation - -class wxMacMLTEClassicControl : public wxMacMLTEControl -{ -public : - wxMacMLTEClassicControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) ; - virtual ~wxMacMLTEClassicControl() ; - - virtual void VisibilityChanged(bool shown) ; - virtual void SuperChangedPosition() ; - - virtual void MacControlUserPaneDrawProc(wxInt16 part) ; - virtual wxInt16 MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y) ; - virtual wxInt16 MacControlUserPaneTrackingProc(wxInt16 x, wxInt16 y, void* actionProc) ; - virtual void MacControlUserPaneIdleProc() ; - virtual wxInt16 MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers) ; - virtual void MacControlUserPaneActivateProc(bool activating) ; - virtual wxInt16 MacControlUserPaneFocusProc(wxInt16 action) ; - virtual void MacControlUserPaneBackgroundProc(void* info) ; - - virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) - { - MacControlUserPaneIdleProc(); - return true; - } - - virtual void Move(int x, int y, int width, int height); - -protected : - OSStatus DoCreate(); - - void MacUpdatePosition() ; - void MacActivatePaneText(bool setActive) ; - void MacFocusPaneText(bool setFocus) ; - void MacSetObjectVisibility(bool vis) ; - -private : - TXNFrameID m_txnFrameID ; - GrafPtr m_txnPort ; - WindowRef m_txnWindow ; - // bounds of the control as we last did set the txn frames - Rect m_txnControlBounds ; - Rect m_txnVisBounds ; - - static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ; - static pascal void TXNScrollInfoProc( - SInt32 iValue, SInt32 iMaximumValue, - TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon ) ; - - ControlRef m_sbHorizontal ; - SInt32 m_lastHorizontalValue ; - ControlRef m_sbVertical ; - SInt32 m_lastVerticalValue ; -}; - -wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, - wxWindowMac* WXUNUSED(parent), - wxWindowID WXUNUSED(id), - const wxString& str, - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - return new wxMacMLTEHIViewControl( wxpeer , str , pos , size , style ) ; -} - -// ---------------------------------------------------------------------------- -// standard unicode control implementation -// ---------------------------------------------------------------------------- - -// the current unicode textcontrol implementation has a bug : only if the control -// is currently having the focus, the selection can be retrieved by the corresponding -// data tag. So we have a mirroring using a member variable -// TODO : build event table using virtual member functions for wxMacControl - -static const EventTypeSpec unicodeTextControlEventList[] = -{ - { kEventClassControl , kEventControlSetFocusPart } , -} ; - -static pascal OSStatus wxMacUnicodeTextControlControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - wxMacUnicodeTextControl* focus = (wxMacUnicodeTextControl*) data ; - wxMacCarbonEvent cEvent( event ) ; - - switch ( GetEventKind( event ) ) - { - case kEventControlSetFocusPart : - { - ControlPartCode controlPart = cEvent.GetParameter(kEventParamControlPart , typeControlPartCode ); - if ( controlPart == kControlFocusNoPart ) - { - // about to lose focus -> store selection to field - focus->GetData( 0, kControlEditTextSelectionTag, &focus->m_selection ); - } - result = CallNextEventHandler(handler,event) ; - if ( controlPart != kControlFocusNoPart ) - { - // about to gain focus -> set selection from field - focus->SetData( 0, kControlEditTextSelectionTag, &focus->m_selection ); - } - break; - } - default: - break ; - } - - return result ; -} - -static pascal OSStatus wxMacUnicodeTextControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - switch ( GetEventClass( event ) ) - { - case kEventClassControl : - result = wxMacUnicodeTextControlControlEventHandler( handler , event , data ) ; - break ; - - default : - break ; - } - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacUnicodeTextControlEventHandler ) - -wxMacUnicodeTextControl::wxMacUnicodeTextControl( wxTextCtrl *wxPeer ) - : wxMacControl( wxPeer ), - wxTextWidgetImpl( wxPeer ) -{ -} - -wxMacUnicodeTextControl::wxMacUnicodeTextControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) - : wxMacControl( wxPeer ), - wxTextWidgetImpl( wxPeer ) -{ - m_font = wxPeer->GetFont() ; - m_windowStyle = style ; - m_selection.selStart = m_selection.selEnd = 0; - Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - wxCFStringRef cf(st , m_font.GetEncoding()) ; - - m_valueTag = kControlEditTextCFStringTag ; - Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ; - if ( isPassword ) - { - m_valueTag = kControlEditTextPasswordCFStringTag ; - } - OSStatus err = CreateEditUnicodeTextControl( - MAC_WXHWND(wxPeer->MacGetTopLevelWindowRef()), &bounds , cf , - isPassword , NULL , &m_controlRef ) ; - verify_noerr( err ); - - if ( !(m_windowStyle & wxTE_MULTILINE) ) - SetData( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ; - - InstallEventHandlers(); -} - -void wxMacUnicodeTextControl::InstallEventHandlers() -{ - ::InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(), - GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this, - (EventHandlerRef*) &m_macTextCtrlEventHandler); -} - -wxMacUnicodeTextControl::~wxMacUnicodeTextControl() -{ - ::RemoveEventHandler((EventHandlerRef) m_macTextCtrlEventHandler); -} - -void wxMacUnicodeTextControl::VisibilityChanged(bool shown) -{ - if ( !(m_windowStyle & wxTE_MULTILINE) && shown ) - { - // work around a refresh issue insofar as not always the entire content is shown, - // even if this would be possible - ControlEditTextSelectionRec sel ; - CFStringRef value = NULL ; - - verify_noerr( GetData( 0, kControlEditTextSelectionTag, &sel ) ); - verify_noerr( GetData( 0, m_valueTag, &value ) ); - verify_noerr( SetData( 0, m_valueTag, &value ) ); - verify_noerr( SetData( 0, kControlEditTextSelectionTag, &sel ) ); - - CFRelease( value ) ; - } -} - -wxString wxMacUnicodeTextControl::GetStringValue() const -{ - wxString result ; - CFStringRef value = GetData(0, m_valueTag) ; - if ( value ) - { - wxCFStringRef cf(value) ; - result = cf.AsString() ; - } - -#if '\n' == 10 - wxMacConvertNewlines13To10( &result ) ; -#else - wxMacConvertNewlines10To13( &result ) ; -#endif - - return result ; -} - -void wxMacUnicodeTextControl::SetStringValue( const wxString &str ) -{ - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - wxCFStringRef cf( st , m_font.GetEncoding() ) ; - verify_noerr( SetData( 0, m_valueTag , cf ) ) ; -} - -void wxMacUnicodeTextControl::Copy() -{ - SendHICommand( kHICommandCopy ) ; -} - -void wxMacUnicodeTextControl::Cut() -{ - SendHICommand( kHICommandCut ) ; -} - -void wxMacUnicodeTextControl::Paste() -{ - SendHICommand( kHICommandPaste ) ; -} - -bool wxMacUnicodeTextControl::CanPaste() const -{ - return true ; -} - -void wxMacUnicodeTextControl::SetEditable(bool WXUNUSED(editable)) -{ -#if 0 // leads to problem because text cannot be selected anymore - SetData( kControlEditTextPart , kControlEditTextLockedTag , (Boolean) !editable ) ; -#endif -} - -void wxMacUnicodeTextControl::GetSelection( long* from, long* to ) const -{ - ControlEditTextSelectionRec sel ; - if (HasFocus()) - verify_noerr( GetData( 0, kControlEditTextSelectionTag, &sel ) ) ; - else - sel = m_selection ; - - if ( from ) - *from = sel.selStart ; - if ( to ) - *to = sel.selEnd ; -} - -void wxMacUnicodeTextControl::SetSelection( long from , long to ) -{ - ControlEditTextSelectionRec sel ; - wxString result ; - int textLength = 0 ; - CFStringRef value = GetData(0, m_valueTag) ; - if ( value ) - { - wxCFStringRef cf(value) ; - textLength = cf.AsString().length() ; - } - - if ((from == -1) && (to == -1)) - { - from = 0 ; - to = textLength ; - } - else - { - from = wxMin(textLength,wxMax(from,0)) ; - if ( to == -1 ) - to = textLength; - else - to = wxMax(0,wxMin(textLength,to)) ; - } - - sel.selStart = from ; - sel.selEnd = to ; - if ( HasFocus() ) - SetData( 0, kControlEditTextSelectionTag, &sel ) ; - else - m_selection = sel; -} - -void wxMacUnicodeTextControl::WriteText( const wxString& str ) -{ - // TODO: this MPRemoting will be moved into a remoting peer proxy for any command - if ( !wxIsMainThread() ) - { -#if wxOSX_USE_CARBON - // unfortunately CW 8 is not able to correctly deduce the template types, - // so we have to instantiate explicitly - wxMacMPRemoteGUICall( (wxTextCtrl*) GetWXPeer() , &wxTextCtrl::WriteText , str ) ; -#endif - return ; - } - - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - - if ( HasFocus() ) - { - wxCFStringRef cf(st , m_font.GetEncoding() ) ; - CFStringRef value = cf ; - SetData( 0, kControlEditTextInsertCFStringRefTag, &value ); - } - else - { - wxString val = GetStringValue() ; - long start , end ; - GetSelection( &start , &end ) ; - val.Remove( start , end - start ) ; - val.insert( start , str ) ; - SetStringValue( val ) ; - SetSelection( start + str.length() , start + str.length() ) ; - } -} - -// ---------------------------------------------------------------------------- -// MLTE control implementation (common part) -// ---------------------------------------------------------------------------- - -// if MTLE is read only, no changes at all are allowed, not even from -// procedural API, in order to allow changes via API all the same we must undo -// the readonly status while we are executing, this class helps to do so - -class wxMacEditHelper -{ -public : - wxMacEditHelper( TXNObject txn ) - { - TXNControlTag tag[] = { kTXNIOPrivilegesTag } ; - m_txn = txn ; - TXNGetTXNObjectControls( m_txn , 1 , tag , m_data ) ; - if ( m_data[0].uValue == kTXNReadOnly ) - { - TXNControlData data[] = { { kTXNReadWrite } } ; - TXNSetTXNObjectControls( m_txn , false , 1 , tag , data ) ; - } - } - - ~wxMacEditHelper() - { - TXNControlTag tag[] = { kTXNIOPrivilegesTag } ; - if ( m_data[0].uValue == kTXNReadOnly ) - TXNSetTXNObjectControls( m_txn , false , 1 , tag , m_data ) ; - } - -protected : - TXNObject m_txn ; - TXNControlData m_data[1] ; -} ; - -wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) - : wxMacControl( peer ), - wxTextWidgetImpl( peer ) -{ - SetNeedsFocusRect( true ) ; -} - -wxString wxMacMLTEControl::GetStringValue() const -{ - wxString result ; - OSStatus err ; - Size actualSize = 0; - - { -#if wxUSE_UNICODE - Handle theText ; - err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText, kTXNUnicodeTextData ); - - // all done - if ( err != noErr ) - { - actualSize = 0 ; - } - else - { - actualSize = GetHandleSize( theText ) / sizeof(UniChar) ; - if ( actualSize > 0 ) - { - wxChar *ptr = NULL ; - - SetHandleSize( theText, (actualSize + 1) * sizeof(UniChar) ) ; - HLock( theText ) ; - (((UniChar*)*theText)[actualSize]) = 0 ; - wxMBConvUTF16 converter ; - size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ; - wxASSERT_MSG( noChars != wxCONV_FAILED, wxT("Unable to count the number of characters in this string!") ); - ptr = new wxChar[noChars + 1] ; - - noChars = converter.MB2WC( ptr , (const char*)*theText , noChars + 1 ) ; - wxASSERT_MSG( noChars != wxCONV_FAILED, wxT("Conversion of string failed!") ); - ptr[noChars] = 0 ; - HUnlock( theText ) ; - - ptr[actualSize] = 0 ; - result = wxString( ptr ) ; - delete [] ptr ; - } - - DisposeHandle( theText ) ; - } -#else // !wxUSE_UNICODE - Handle theText ; - err = TXNGetDataEncoded( m_txn , kTXNStartOffset, kTXNEndOffset, &theText, kTXNTextData ); - - // all done - if ( err != noErr ) - { - actualSize = 0 ; - } - else - { - actualSize = GetHandleSize( theText ) ; - if ( actualSize > 0 ) - { - HLock( theText ) ; - result = wxString( *theText , wxConvLocal , actualSize ) ; - HUnlock( theText ) ; - } - - DisposeHandle( theText ) ; - } -#endif // wxUSE_UNICODE/!wxUSE_UNICODE - } - -#if '\n' == 10 - wxMacConvertNewlines13To10( &result ) ; -#else - wxMacConvertNewlines10To13( &result ) ; -#endif - - return result ; -} - -void wxMacMLTEControl::SetStringValue( const wxString &str ) -{ - wxString st = str; - wxMacConvertNewlines10To13( &st ); - - { -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - - { - wxMacEditHelper help( m_txn ); - SetTXNData( st, kTXNStartOffset, kTXNEndOffset ); - } - - TXNSetSelection( m_txn, 0, 0 ); - TXNShowSelection( m_txn, kTXNShowStart ); - } -} - -TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle ) -{ - TXNFrameOptions frameOptions = kTXNDontDrawCaretWhenInactiveMask; - - frameOptions |= kTXNDoFontSubstitutionMask; - - if ( ! (wxStyle & wxTE_NOHIDESEL) ) - frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ; - - if ( wxStyle & (wxHSCROLL | wxTE_DONTWRAP) ) - frameOptions |= kTXNWantHScrollBarMask ; - - if ( wxStyle & wxTE_MULTILINE ) - { - if ( ! (wxStyle & wxTE_DONTWRAP ) ) - frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ; - - if ( !(wxStyle & wxTE_NO_VSCROLL) ) - { - frameOptions |= kTXNWantVScrollBarMask ; - - // The following code causes drawing problems on 10.4. Perhaps it can be restored for - // older versions of the OS, but I'm not sure it's appropriate to put a grow icon here - // anyways, as AFAIK users can't actually use it to resize the text ctrl. -// if ( frameOptions & kTXNWantHScrollBarMask ) -// frameOptions |= kTXNDrawGrowIconMask ; - } - } - else - { - frameOptions |= kTXNSingleLineOnlyMask ; - } - - return frameOptions ; -} - -void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background, - bool WXUNUSED(visible)) -{ - TXNControlTag iControlTags[] = - { - kTXNDoFontSubstitution, - kTXNWordWrapStateTag , - }; - TXNControlData iControlData[] = - { - { true }, - { kTXNNoAutoWrap }, - }; - - int toptag = WXSIZEOF( iControlTags ) ; - - if ( m_windowStyle & wxTE_MULTILINE ) - { - iControlData[1].uValue = - (m_windowStyle & wxTE_DONTWRAP) - ? kTXNNoAutoWrap - : kTXNAutoWrap; - } - - OSStatus err = TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) ; - verify_noerr( err ); - - // setting the default font: - // under 10.2 this causes a visible caret, therefore we avoid it - - Str255 fontName ; - SInt16 fontSize ; - Style fontStyle ; - - GetThemeFont( kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; - - TXNTypeAttributes typeAttr[] = - { - { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } , - { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } , - { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } , - } ; - - err = TXNSetTypeAttributes( - m_txn, WXSIZEOF(typeAttr), - typeAttr, kTXNStartOffset, kTXNEndOffset ); - verify_noerr( err ); - - if ( m_windowStyle & wxTE_PASSWORD ) - { - UniChar c = 0x00A5 ; - err = TXNEchoMode( m_txn , c , 0 , true ); - verify_noerr( err ); - } - - TXNBackground tback; - tback.bgType = kTXNBackgroundTypeRGB; - background.GetRGBColor( &tback.bg.color ); - TXNSetBackground( m_txn , &tback ); - - - TXNCommandEventSupportOptions options ; - if ( TXNGetCommandEventSupport( m_txn, &options ) == noErr ) - { - options |= - kTXNSupportEditCommandProcessing - | kTXNSupportEditCommandUpdating - | kTXNSupportFontCommandProcessing - | kTXNSupportFontCommandUpdating; - - // only spell check when not read-only - // use system options for the default - bool checkSpelling = false ; - if ( !(m_windowStyle & wxTE_READONLY) ) - { -#if wxUSE_SYSTEM_OPTIONS - if ( wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_SPELL_CHECKER ) == 1) ) - { - checkSpelling = true ; - } -#endif - } - - if ( checkSpelling ) - options |= - kTXNSupportSpellCheckCommandProcessing - | kTXNSupportSpellCheckCommandUpdating; - - TXNSetCommandEventSupport( m_txn , options ) ; - } -} - -void wxMacMLTEControl::SetBackgroundColour(const wxColour& col ) -{ - TXNBackground tback; - tback.bgType = kTXNBackgroundTypeRGB; - col.GetRGBColor(&tback.bg.color); - TXNSetBackground( m_txn , &tback ); -} - -static inline int wxConvertToTXN(int x) -{ - return static_cast(x / 254.0 * 72 + 0.5); -} - -void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to ) -{ - TXNTypeAttributes typeAttr[4] ; - RGBColor color ; - size_t typeAttrCount = 0 ; - - TXNMargins margins; - TXNControlTag controlTags[4]; - TXNControlData controlData[4]; - size_t controlAttrCount = 0; - - TXNTab* tabs = NULL; - - bool relayout = false; - wxFont font ; - - if ( style.HasFont() ) - { - wxASSERT( typeAttrCount < WXSIZEOF(typeAttr) ); - font = style.GetFont() ; - typeAttr[typeAttrCount].tag = kTXNATSUIStyle ; - typeAttr[typeAttrCount].size = kTXNATSUIStyleSize ; - typeAttr[typeAttrCount].data.dataPtr = font.MacGetATSUStyle() ; - typeAttrCount++ ; - } - - if ( style.HasTextColour() ) - { - wxASSERT( typeAttrCount < WXSIZEOF(typeAttr) ); - style.GetTextColour().GetRGBColor( &color ); - typeAttr[typeAttrCount].tag = kTXNQDFontColorAttribute ; - typeAttr[typeAttrCount].size = kTXNQDFontColorAttributeSize ; - typeAttr[typeAttrCount].data.dataPtr = (void*) &color ; - typeAttrCount++ ; - } - - if ( style.HasAlignment() ) - { - wxASSERT( controlAttrCount < WXSIZEOF(controlTags) ); - SInt32 align; - - switch ( style.GetAlignment() ) - { - case wxTEXT_ALIGNMENT_LEFT: - align = kTXNFlushLeft; - break; - case wxTEXT_ALIGNMENT_CENTRE: - align = kTXNCenter; - break; - case wxTEXT_ALIGNMENT_RIGHT: - align = kTXNFlushRight; - break; - case wxTEXT_ALIGNMENT_JUSTIFIED: - align = kTXNFullJust; - break; - default : - case wxTEXT_ALIGNMENT_DEFAULT: - align = kTXNFlushDefault; - break; - } - - controlTags[controlAttrCount] = kTXNJustificationTag ; - controlData[controlAttrCount].sValue = align ; - controlAttrCount++ ; - } - - if ( style.HasLeftIndent() || style.HasRightIndent() ) - { - wxASSERT( controlAttrCount < WXSIZEOF(controlTags) ); - controlTags[controlAttrCount] = kTXNMarginsTag; - controlData[controlAttrCount].marginsPtr = &margins; - verify_noerr( TXNGetTXNObjectControls (m_txn, 1 , - &controlTags[controlAttrCount], &controlData[controlAttrCount]) ); - if ( style.HasLeftIndent() ) - { - margins.leftMargin = wxConvertToTXN(style.GetLeftIndent()); - } - if ( style.HasRightIndent() ) - { - margins.rightMargin = wxConvertToTXN(style.GetRightIndent()); - } - controlAttrCount++ ; - } - - if ( style.HasTabs() ) - { - const wxArrayInt& tabarray = style.GetTabs(); - // unfortunately Mac only applies a tab distance, not individually different tabs - controlTags[controlAttrCount] = kTXNTabSettingsTag; - if ( tabarray.size() > 0 ) - controlData[controlAttrCount].tabValue.value = wxConvertToTXN(tabarray[0]); - else - controlData[controlAttrCount].tabValue.value = 72 ; - - controlData[controlAttrCount].tabValue.tabType = kTXNLeftTab; - controlAttrCount++ ; - } - - // unfortunately the relayout is not automatic - if ( controlAttrCount > 0 ) - { - verify_noerr( TXNSetTXNObjectControls (m_txn, false /* don't clear all */, controlAttrCount, - controlTags, controlData) ); - relayout = true; - } - - if ( typeAttrCount > 0 ) - { - verify_noerr( TXNSetTypeAttributes( m_txn , typeAttrCount, typeAttr, from , to ) ); - if (from != to) - relayout = true; - } - - if ( tabs != NULL ) - { - delete[] tabs; - } - - if ( relayout ) - { - TXNRecalcTextLayout( m_txn ); - } -} - -void wxMacMLTEControl::SetFont(const wxFont & font, - const wxColour& foreground, - long WXUNUSED(windowStyle), - bool WXUNUSED(ignoreBlack)) -{ - wxMacEditHelper help( m_txn ) ; - TXNSetAttribute( wxTextAttr( foreground, wxNullColour, font ), kTXNStartOffset, kTXNEndOffset ) ; -} - -void wxMacMLTEControl::SetStyle( long start, long end, const wxTextAttr& style ) -{ - wxMacEditHelper help( m_txn ) ; - TXNSetAttribute( style, start, end ) ; -} - -void wxMacMLTEControl::Copy() -{ - TXNCopy( m_txn ); -} - -void wxMacMLTEControl::Cut() -{ - TXNCut( m_txn ); -} - -void wxMacMLTEControl::Paste() -{ - TXNPaste( m_txn ); -} - -bool wxMacMLTEControl::CanPaste() const -{ - return TXNIsScrapPastable() ; -} - -void wxMacMLTEControl::SetEditable(bool editable) -{ - TXNControlTag tag[] = { kTXNIOPrivilegesTag } ; - TXNControlData data[] = { { editable ? kTXNReadWrite : kTXNReadOnly } } ; - TXNSetTXNObjectControls( m_txn, false, WXSIZEOF(tag), tag, data ) ; -} - -long wxMacMLTEControl::GetLastPosition() const -{ - wxTextPos actualsize = 0 ; - - Handle theText ; -#if wxUSE_UNICODE - OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText, kTXNUnicodeTextData ); - // all done - if ( err == noErr ) - { - actualsize = GetHandleSize( theText )/sizeof(UniChar); - DisposeHandle( theText ) ; - } -#else - OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText, kTXNTextData ); - - // all done - if ( err == noErr ) - { - actualsize = GetHandleSize( theText ) ; - DisposeHandle( theText ) ; - } -#endif - else - { - actualsize = 0 ; - } - - return actualsize ; -} - -void wxMacMLTEControl::Replace( long from , long to , const wxString &str ) -{ - wxString value = str ; - wxMacConvertNewlines10To13( &value ) ; - - wxMacEditHelper help( m_txn ) ; -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - - TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to ) ; - TXNClear( m_txn ) ; - SetTXNData( value, kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ; -} - -void wxMacMLTEControl::Remove( long from , long to ) -{ -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - wxMacEditHelper help( m_txn ) ; - TXNSetSelection( m_txn , from , to ) ; - TXNClear( m_txn ) ; -} - -void wxMacMLTEControl::GetSelection( long* from, long* to) const -{ - TXNOffset f,t ; - TXNGetSelection( m_txn , &f , &t ) ; - *from = f; - *to = t; -} - -void wxMacMLTEControl::SetSelection( long from , long to ) -{ -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - - // change the selection - if ((from == -1) && (to == -1)) - TXNSelectAll( m_txn ); - else - TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to ); - - TXNShowSelection( m_txn, kTXNShowStart ); -} - -void wxMacMLTEControl::WriteText( const wxString& str ) -{ - // TODO: this MPRemoting will be moved into a remoting peer proxy for any command - if ( !wxIsMainThread() ) - { -#if wxOSX_USE_CARBON - // unfortunately CW 8 is not able to correctly deduce the template types, - // so we have to instantiate explicitly - wxMacMPRemoteGUICall( (wxTextCtrl*) GetWXPeer() , &wxTextCtrl::WriteText , str ) ; -#endif - return ; - } - - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - - long start , end , dummy ; - - GetSelection( &start , &dummy ) ; -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - - { - wxMacEditHelper helper( m_txn ) ; - SetTXNData( st, kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ; - } - - GetSelection( &dummy, &end ) ; - - // TODO: SetStyle( start , end , GetDefaultStyle() ) ; -} - -void wxMacMLTEControl::Clear() -{ -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - wxMacEditHelper st( m_txn ) ; - TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ; - TXNClear( m_txn ) ; -} - -bool wxMacMLTEControl::CanUndo() const -{ - return TXNCanUndo( m_txn , NULL ) ; -} - -void wxMacMLTEControl::Undo() -{ - TXNUndo( m_txn ) ; -} - -bool wxMacMLTEControl::CanRedo() const -{ - return TXNCanRedo( m_txn , NULL ) ; -} - -void wxMacMLTEControl::Redo() -{ - TXNRedo( m_txn ) ; -} - -int wxMacMLTEControl::GetNumberOfLines() const -{ - ItemCount lines = 0 ; - TXNGetLineCount( m_txn, &lines ) ; - - return lines ; -} - -long wxMacMLTEControl::XYToPosition(long x, long y) const -{ - Point curpt ; - wxTextPos lastpos ; - - // TODO: find a better implementation : while we can get the - // line metrics of a certain line, we don't get its starting - // position, so it would probably be rather a binary search - // for the start position - long xpos = 0, ypos = 0 ; - int lastHeight = 0 ; - ItemCount n ; - - lastpos = GetLastPosition() ; - for ( n = 0 ; n <= (ItemCount) lastpos ; ++n ) - { - if ( y == ypos && x == xpos ) - return n ; - - TXNOffsetToPoint( m_txn, n, &curpt ) ; - - if ( curpt.v > lastHeight ) - { - xpos = 0 ; - if ( n > 0 ) - ++ypos ; - - lastHeight = curpt.v ; - } - else - ++xpos ; - } - - return 0 ; -} - -bool wxMacMLTEControl::PositionToXY( long pos, long *x, long *y ) const -{ - Point curpt ; - wxTextPos lastpos ; - - if ( y ) - *y = 0 ; - if ( x ) - *x = 0 ; - - lastpos = GetLastPosition() ; - if ( pos <= lastpos ) - { - // TODO: find a better implementation - while we can get the - // line metrics of a certain line, we don't get its starting - // position, so it would probably be rather a binary search - // for the start position - long xpos = 0, ypos = 0 ; - int lastHeight = 0 ; - ItemCount n ; - - for ( n = 0 ; n <= (ItemCount) pos ; ++n ) - { - TXNOffsetToPoint( m_txn, n, &curpt ) ; - - if ( curpt.v > lastHeight ) - { - xpos = 0 ; - if ( n > 0 ) - ++ypos ; - - lastHeight = curpt.v ; - } - else - ++xpos ; - } - - if ( y ) - *y = ypos ; - if ( x ) - *x = xpos ; - } - - return false ; -} - -void wxMacMLTEControl::ShowPosition( long pos ) -{ - Point current, desired ; - TXNOffset selstart, selend; - - TXNGetSelection( m_txn, &selstart, &selend ); - TXNOffsetToPoint( m_txn, selstart, ¤t ); - TXNOffsetToPoint( m_txn, pos, &desired ); - - // TODO: use HIPoints for 10.3 and above - - OSErr theErr = noErr; - long dv = desired.v - current.v; - long dh = desired.h - current.h; - TXNShowSelection( m_txn, kTXNShowStart ) ; // NB: should this be kTXNShowStart or kTXNShowEnd ?? - theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels, &dv, &dh ); - - // there will be an error returned for classic MLTE implementation when the control is - // invisible, but HITextView works correctly, so we don't assert that one - // wxASSERT_MSG( theErr == noErr, wxT("TXNScroll returned an error!") ); -} - -void wxMacMLTEControl::SetTXNData( const wxString& st, TXNOffset start, TXNOffset end ) -{ -#if wxUSE_UNICODE - wxMBConvUTF16 converter ; - ByteCount byteBufferLen = converter.WC2MB( NULL, st.wc_str(), 0 ) ; - wxASSERT_MSG( byteBufferLen != wxCONV_FAILED, - wxT("Conversion to UTF-16 unexpectedly failed") ); - UniChar *unibuf = (UniChar*)malloc( byteBufferLen + 2 ) ; // 2 for NUL in UTF-16 - converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen + 2 ) ; - TXNSetData( m_txn, kTXNUnicodeTextData, (void*)unibuf, byteBufferLen, start, end ) ; - free( unibuf ) ; -#else // !wxUSE_UNICODE - wxCharBuffer text = st.mb_str( wxConvLocal ) ; - TXNSetData( m_txn, kTXNTextData, (void*)text.data(), strlen( text ), start, end ) ; -#endif // wxUSE_UNICODE/!wxUSE_UNICODE -} - -wxString wxMacMLTEControl::GetLineText(long lineNo) const -{ - wxString line ; - - if ( lineNo < GetNumberOfLines() ) - { - Point firstPoint; - Fixed lineWidth, lineHeight, currentHeight; - long ypos ; - - // get the first possible position in the control - TXNOffsetToPoint(m_txn, 0, &firstPoint); - - // Iterate through the lines until we reach the one we want, - // adding to our current y pixel point position - ypos = 0 ; - currentHeight = 0; - while (ypos < lineNo) - { - TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight); - currentHeight += lineHeight; - } - - Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) }; - TXNOffset theOffset; - TXNPointToOffset(m_txn, thePoint, &theOffset); - - wxString content = GetStringValue() ; - Point currentPoint = thePoint; - while (thePoint.v == currentPoint.v && theOffset < content.length()) - { - line += content[theOffset]; - TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint); - } - } - - return line ; -} - -int wxMacMLTEControl::GetLineLength(long lineNo) const -{ - int theLength = 0; - - if ( lineNo < GetNumberOfLines() ) - { - Point firstPoint; - Fixed lineWidth, lineHeight, currentHeight; - long ypos; - - // get the first possible position in the control - TXNOffsetToPoint(m_txn, 0, &firstPoint); - - // Iterate through the lines until we reach the one we want, - // adding to our current y pixel point position - ypos = 0; - currentHeight = 0; - while (ypos < lineNo) - { - TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight); - currentHeight += lineHeight; - } - - Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) }; - TXNOffset theOffset; - TXNPointToOffset(m_txn, thePoint, &theOffset); - - wxString content = GetStringValue() ; - Point currentPoint = thePoint; - while (thePoint.v == currentPoint.v && theOffset < content.length()) - { - ++theLength; - TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint); - } - } - - return theLength ; -} - -// ---------------------------------------------------------------------------- -// MLTE control implementation (OSX part) -// ---------------------------------------------------------------------------- - -// tiger multi-line textcontrols with no CR in the entire content -// don't scroll automatically, so we need a hack. -// This attempt only works 'before' the key (ie before CallNextEventHandler) -// is processed, thus the scrolling always occurs one character too late, but -// better than nothing ... - -static const EventTypeSpec eventList[] = -{ - { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , -} ; - -static pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - wxMacMLTEHIViewControl* focus = (wxMacMLTEHIViewControl*) data ; - - switch ( GetEventKind( event ) ) - { - case kEventTextInputUnicodeForKeyEvent : - { - TXNOffset from , to ; - TXNGetSelection( focus->GetTXNObject() , &from , &to ) ; - if ( from == to ) - TXNShowSelection( focus->GetTXNObject() , kTXNShowStart ); - result = CallNextEventHandler(handler,event); - break; - } - default: - break ; - } - - return result ; -} - -static pascal OSStatus wxMacTextControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - switch ( GetEventClass( event ) ) - { - case kEventClassTextInput : - result = wxMacUnicodeTextEventHandler( handler , event , data ) ; - break ; - - default : - break ; - } - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacTextControlEventHandler ) - -wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer, - const wxString& str, - const wxPoint& pos, - const wxSize& size, long style ) : wxMacMLTEControl( wxPeer ) -{ - m_font = wxPeer->GetFont() ; - m_windowStyle = style ; - Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; - wxString st = str ; - wxMacConvertNewlines10To13( &st ) ; - - HIRect hr = { - { bounds.left , bounds.top }, - { bounds.right - bounds.left, bounds.bottom - bounds.top } } ; - - m_scrollView = NULL ; - TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ; - if (( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask)) || (frameOptions &kTXNSingleLineOnlyMask)) - { - if ( frameOptions & (kTXNWantVScrollBarMask | kTXNWantHScrollBarMask) ) - { - HIScrollViewCreate( - (frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0) - | (frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll : 0) , - &m_scrollView ) ; - } - else - { - HIScrollViewCreate(kHIScrollViewOptionsVertScroll,&m_scrollView); - HIScrollViewSetScrollBarAutoHide(m_scrollView,true); - } - - HIViewSetFrame( m_scrollView, &hr ); - HIViewSetVisible( m_scrollView, true ); - } - - m_textView = NULL ; - HITextViewCreate( NULL , 0, frameOptions , &m_textView ) ; - m_txn = HITextViewGetTXNObject( m_textView ) ; - HIViewSetVisible( m_textView , true ) ; - if ( m_scrollView ) - { - HIViewAddSubview( m_scrollView , m_textView ) ; - m_controlRef = m_scrollView ; - InstallEventHandler( (WXWidget) m_textView ) ; - } - else - { - HIViewSetFrame( m_textView, &hr ); - m_controlRef = m_textView ; - } - - AdjustCreationAttributes( *wxWHITE , true ) ; -#ifndef __LP64__ - wxMacWindowClipper c( GetWXPeer() ) ; -#endif - SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ; - - TXNSetSelection( m_txn, 0, 0 ); - TXNShowSelection( m_txn, kTXNShowStart ); - - ::InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, this, - NULL); -} - -wxMacMLTEHIViewControl::~wxMacMLTEHIViewControl() -{ -} - -bool wxMacMLTEHIViewControl::SetFocus() -{ - return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, kControlFocusNextPart ) == noErr ; -} - -bool wxMacMLTEHIViewControl::HasFocus() const -{ - ControlRef control ; - if ( GetUserFocusWindow() == NULL ) - return false; - - GetKeyboardFocus( GetUserFocusWindow() , &control ) ; - return control == m_textView ; -} - -void wxMacMLTEHIViewControl::SetBackgroundColour(const wxColour& col ) -{ - HITextViewSetBackgroundColor( m_textView, col.GetPixel() ); -} - -#endif // wxUSE_TEXTCTRL diff --git a/Externals/wxWidgets3/src/osx/carbon/tglbtn.cpp b/Externals/wxWidgets3/src/osx/carbon/tglbtn.cpp deleted file mode 100644 index d4593c0a24..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/tglbtn.cpp +++ /dev/null @@ -1,68 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/tglbtn.cpp -// Purpose: Definition of the wxToggleButton class, which implements a -// toggle button under wxMac. -// Author: Stefan Csomor -// Modified by: -// Created: 08.02.01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declatations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#if wxUSE_TOGGLEBTN - -#include "wx/tglbtn.h" -#include "wx/osx/private.h" -// Button - -wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxString& WXUNUSED(label), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - - wxMacControl* peer = new wxMacControl(wxpeer) ; - verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , - kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) ); - return peer; -} - -wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID WXUNUSED(id), - const wxBitmap& label, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* peer = new wxMacControl(wxpeer) ; - - ControlButtonContentInfo info; - wxMacCreateBitmapButton( &info, label ); - verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , - kControlBevelButtonNormalBevel , kControlBehaviorOffsetContents | kControlBehaviorToggles , &info , 0 , 0 , 0 , peer->GetControlRefAddr() ) ); - - wxMacReleaseBitmapButton( &info ) ; - return peer; -} - - -#endif // wxUSE_TOGGLEBTN - diff --git a/Externals/wxWidgets3/src/osx/carbon/thread.cpp b/Externals/wxWidgets3/src/osx/carbon/thread.cpp index dcb7bd778a..f62bd70f4e 100644 --- a/Externals/wxWidgets3/src/osx/carbon/thread.cpp +++ b/Externals/wxWidgets3/src/osx/carbon/thread.cpp @@ -1197,10 +1197,10 @@ public: virtual void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxThreadModule) + wxDECLARE_DYNAMIC_CLASS(wxThreadModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule); bool wxThreadModule::OnInit() { diff --git a/Externals/wxWidgets3/src/osx/carbon/timer.cpp b/Externals/wxWidgets3/src/osx/carbon/timer.cpp deleted file mode 100644 index be218af294..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/timer.cpp +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/timer.cpp -// Purpose: wxTimer implementation -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TIMER - -#ifndef WX_PRECOMP - #include "wx/dynarray.h" -#endif - -#include "wx/osx/private/timer.h" - -#ifdef __WXMAC__ - #include "wx/osx/private.h" -#endif - -struct MacTimerInfo -{ - wxCarbonTimerImpl* m_timer; - EventLoopTimerUPP m_proc; - EventLoopTimerRef m_timerRef; -}; - -static pascal void wxProcessTimer( EventLoopTimerRef WXUNUSED(theTimer), void *data ) -{ - if ( data == NULL ) - return; - - wxCarbonTimerImpl* timer = (wxCarbonTimerImpl*)data; - - if ( timer->IsOneShot() ) - timer->Stop(); - - timer->Notify(); -} - -wxCarbonTimerImpl::wxCarbonTimerImpl(wxTimer *timer) - : wxTimerImpl(timer) -{ - m_info = new MacTimerInfo(); - m_info->m_timer = this; - m_info->m_proc = NULL; - m_info->m_timerRef = kInvalidID; -} - -bool wxCarbonTimerImpl::IsRunning() const -{ - return ( m_info->m_timerRef != kInvalidID ); -} - -wxCarbonTimerImpl::~wxCarbonTimerImpl() -{ - delete m_info; -} - -bool wxCarbonTimerImpl::Start( int milliseconds, bool mode ) -{ - (void)wxTimerImpl::Start(milliseconds, mode); - - wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") ); - wxCHECK_MSG( m_info->m_timerRef == NULL, false, wxT("attempting to restart a timer") ); - - m_info->m_timer = this; - m_info->m_proc = NewEventLoopTimerUPP( &wxProcessTimer ); - - OSStatus err = InstallEventLoopTimer( - GetMainEventLoop(), - m_milli*kEventDurationMillisecond, - IsOneShot() ? 0 : m_milli * kEventDurationMillisecond, - m_info->m_proc, - this, - &m_info->m_timerRef ); - verify_noerr( err ); - - return true; -} - -void wxCarbonTimerImpl::Stop() -{ - if (m_info->m_timerRef) - RemoveEventLoopTimer( m_info->m_timerRef ); - if (m_info->m_proc) - DisposeEventLoopTimerUPP( m_info->m_proc ); - - m_info->m_proc = NULL; - m_info->m_timerRef = kInvalidID; -} - -#endif // wxUSE_TIMER - diff --git a/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp b/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp deleted file mode 100644 index 07121fbd85..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp +++ /dev/null @@ -1,1814 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/toolbar.cpp -// Purpose: wxToolBar -// Author: Stefan Csomor -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TOOLBAR - -#include "wx/toolbar.h" - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "wx/app.h" -#include "wx/osx/private.h" -#include "wx/geometry.h" -#include "wx/sysopt.h" - - -const short kwxMacToolBarToolDefaultWidth = 16; -const short kwxMacToolBarToolDefaultHeight = 16; -const short kwxMacToolBarTopMargin = 4; -const short kwxMacToolBarLeftMargin = 4; -const short kwxMacToolBorder = 0; -const short kwxMacToolSpacing = 6; - -BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) - EVT_PAINT( wxToolBar::OnPaint ) -END_EVENT_TABLE() - - -#pragma mark - -#pragma mark Tool Implementation - -// ---------------------------------------------------------------------------- -// private classes -// ---------------------------------------------------------------------------- - -// We have a dual implementation for each tool, ControlRef and HIToolbarItemRef - -// when embedding native controls in the native toolbar we must make sure the -// control does not get deleted behind our backs, so the retain count gets increased -// (after creation it is 1), first be the creation of the custom HIToolbarItem wrapper -// object, and second by the code 'creating' the custom HIView (which is the same as the -// already existing native control, therefore we just increase the ref count) -// when this view is removed from the native toolbar its count gets decremented again -// and when the HITooolbarItem wrapper object gets destroyed it is decremented as well -// so in the end the control lives with a refcount of one and can be disposed of by the -// wxControl code. For embedded controls on a non-native toolbar this ref count is less -// so we can only test against a range, not a specific value of the refcount. - -class wxToolBarTool : public wxToolBarToolBase -{ -public: - wxToolBarTool( - wxToolBar *tbar, - int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp ); - - wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label) - : wxToolBarToolBase(tbar, control, label) - { - Init(); - if (control != NULL) - SetControlHandle( (ControlRef) control->GetHandle() ); - } - - virtual ~wxToolBarTool() - { - ClearControl(); - } - - WXWidget GetControlHandle() - { - return (WXWidget) m_controlHandle; - } - - void SetControlHandle( ControlRef handle ) - { - m_controlHandle = handle; - } - - void SetPosition( const wxPoint& position ); - - void ClearControl() - { - if ( m_controlHandle ) - { - if ( !IsControl() ) - DisposeControl( m_controlHandle ); - else - { - // the embedded control is not under the responsibility of the tool, it gets disposed of in the - // proper wxControl destructor - } - m_controlHandle = NULL ; - } - -#if wxOSX_USE_NATIVE_TOOLBAR - if ( m_toolbarItemRef ) - { - CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ; - wxTheApp->MacAddToAutorelease(m_toolbarItemRef); - CFRelease(m_toolbarItemRef); - m_toolbarItemRef = NULL; - } -#endif // wxOSX_USE_NATIVE_TOOLBAR - } - - wxSize GetSize() const - { - wxSize curSize; - - if ( IsControl() ) - { - curSize = GetControl()->GetSize(); - } - else if ( IsButton() ) - { - curSize = GetToolBar()->GetToolSize(); - } - else - { - // separator size - curSize = GetToolBar()->GetToolSize(); - if ( GetToolBar()->GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) ) - curSize.y /= 4; - else - curSize.x /= 4; - } - - return curSize; - } - - wxPoint GetPosition() const - { - return wxPoint( m_x, m_y ); - } - - virtual bool Enable( bool enable ); - - void UpdateToggleImage( bool toggle ); - - virtual bool Toggle(bool toggle) - { - if ( wxToolBarToolBase::Toggle( toggle ) == false ) - return false; - - UpdateToggleImage(toggle); - return true; - } - - void UpdateHelpStrings() - { -#if wxOSX_USE_NATIVE_TOOLBAR - if ( m_toolbarItemRef ) - { - wxFontEncoding enc = GetToolBarFontEncoding(); - - HIToolbarItemSetHelpText( - m_toolbarItemRef, - wxCFStringRef( GetShortHelp(), enc ), - wxCFStringRef( GetLongHelp(), enc ) ); - } -#endif - } - - virtual bool SetShortHelp(const wxString& help) - { - if ( wxToolBarToolBase::SetShortHelp( help ) == false ) - return false; - - UpdateHelpStrings(); - return true; - } - - virtual bool SetLongHelp(const wxString& help) - { - if ( wxToolBarToolBase::SetLongHelp( help ) == false ) - return false; - - UpdateHelpStrings(); - return true; - } - - virtual void SetNormalBitmap(const wxBitmap& bmp) - { - wxToolBarToolBase::SetNormalBitmap(bmp); - UpdateToggleImage(CanBeToggled() && IsToggled()); - } - - virtual void SetLabel(const wxString& label) - { - wxToolBarToolBase::SetLabel(label); -#if wxOSX_USE_NATIVE_TOOLBAR - if ( m_toolbarItemRef ) - { - // strip mnemonics from the label for compatibility with the usual - // labels in wxStaticText sense - wxString labelStr = wxStripMenuCodes(label); - - HIToolbarItemSetLabel( - m_toolbarItemRef, - wxCFStringRef(labelStr, GetToolBarFontEncoding()) ); - } -#endif - } - -#if wxOSX_USE_NATIVE_TOOLBAR - void SetToolbarItemRef( HIToolbarItemRef ref ) - { - if ( m_controlHandle ) - HideControl( m_controlHandle ); - if ( m_toolbarItemRef ) - CFRelease( m_toolbarItemRef ); - - m_toolbarItemRef = ref; - UpdateHelpStrings(); - } - - HIToolbarItemRef GetToolbarItemRef() const - { - return m_toolbarItemRef; - } - - void SetIndex( CFIndex idx ) - { - m_index = idx; - } - - CFIndex GetIndex() const - { - return m_index; - } -#endif // wxOSX_USE_NATIVE_TOOLBAR - -private: -#if wxOSX_USE_NATIVE_TOOLBAR - wxFontEncoding GetToolBarFontEncoding() const - { - wxFont f; - if ( GetToolBar() ) - f = GetToolBar()->GetFont(); - return f.IsOk() ? f.GetEncoding() : wxFont::GetDefaultEncoding(); - } -#endif // wxOSX_USE_NATIVE_TOOLBAR - - void Init() - { - m_controlHandle = NULL; - -#if wxOSX_USE_NATIVE_TOOLBAR - m_toolbarItemRef = NULL; - m_index = -1; -#endif - } - - ControlRef m_controlHandle; - wxCoord m_x; - wxCoord m_y; - -#if wxOSX_USE_NATIVE_TOOLBAR - HIToolbarItemRef m_toolbarItemRef; - // position in its toolbar, -1 means not inserted - CFIndex m_index; -#endif -}; - -static const EventTypeSpec eventList[] = -{ - { kEventClassControl, kEventControlHit }, - { kEventClassControl, kEventControlHitTest }, -}; - -static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data ) -{ - OSStatus result = eventNotHandledErr; - ControlRef controlRef; - wxMacCarbonEvent cEvent( event ); - - cEvent.GetParameter( kEventParamDirectObject, &controlRef ); - - switch ( GetEventKind( event ) ) - { - case kEventControlHit: - { - wxToolBarTool *tbartool = (wxToolBarTool*)data; - wxToolBar *tbar = tbartool != NULL ? (wxToolBar*) (tbartool->GetToolBar()) : NULL; - if ((tbartool != NULL) && tbartool->CanBeToggled()) - { - bool shouldToggle; - - shouldToggle = !tbartool->IsToggled(); - - tbar->ToggleTool( tbartool->GetId(), shouldToggle ); - } - - if (tbartool != NULL) - tbar->OnLeftClick( tbartool->GetId(), tbartool->IsToggled() ); - result = noErr; - } - break; - - case kEventControlHitTest: - { - HIPoint pt = cEvent.GetParameter(kEventParamMouseLocation); - HIRect rect; - HIViewGetBounds( controlRef, &rect ); - - ControlPartCode pc = kControlNoPart; - if ( CGRectContainsPoint( rect, pt ) ) - pc = kControlIconPart; - cEvent.SetParameter( kEventParamControlPart, typeControlPartCode, pc ); - result = noErr; - } - break; - - default: - break; - } - - return result; -} - -static pascal OSStatus wxMacToolBarToolEventHandler( EventHandlerCallRef handler, EventRef event, void *data ) -{ - OSStatus result = eventNotHandledErr; - - switch ( GetEventClass( event ) ) - { - case kEventClassControl: - result = wxMacToolBarToolControlEventHandler( handler, event, data ); - break; - - default: - break; - } - - return result; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler ) - -#if wxOSX_USE_NATIVE_TOOLBAR - -static const EventTypeSpec toolBarEventList[] = -{ - { kEventClassToolbarItem, kEventToolbarItemPerformAction }, -}; - -static pascal OSStatus wxMacToolBarCommandEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data ) -{ - OSStatus result = eventNotHandledErr; - - switch ( GetEventKind( event ) ) - { - case kEventToolbarItemPerformAction: - { - wxToolBarTool* tbartool = (wxToolBarTool*) data; - if ( tbartool != NULL ) - { - wxToolBar *tbar = (wxToolBar*)(tbartool->GetToolBar()); - int toolID = tbartool->GetId(); - - if ( tbartool->CanBeToggled() ) - { - if ( tbar != NULL ) - tbar->ToggleTool(toolID, !tbartool->IsToggled() ); - } - - if ( tbar != NULL ) - tbar->OnLeftClick( toolID, tbartool->IsToggled() ); - result = noErr; - } - } - break; - - default: - break; - } - - return result; -} - -static pascal OSStatus wxMacToolBarEventHandler( EventHandlerCallRef handler, EventRef event, void *data ) -{ - OSStatus result = eventNotHandledErr; - - switch ( GetEventClass( event ) ) - { - case kEventClassToolbarItem: - result = wxMacToolBarCommandEventHandler( handler, event, data ); - break; - - default: - break; - } - - return result; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarEventHandler ) - -#endif - -bool wxToolBarTool::Enable( bool enable ) -{ - if ( wxToolBarToolBase::Enable( enable ) == false ) - return false; - - if ( IsControl() ) - { - GetControl()->Enable( enable ); - } - else if ( IsButton() ) - { -#if wxOSX_USE_NATIVE_TOOLBAR - if ( m_toolbarItemRef != NULL ) - HIToolbarItemSetEnabled( m_toolbarItemRef, enable ); -#endif - - if ( m_controlHandle != NULL ) - { - if ( enable ) - EnableControl( m_controlHandle ); - else - DisableControl( m_controlHandle ); - } - } - - return true; -} - -void wxToolBarTool::SetPosition( const wxPoint& position ) -{ - m_x = position.x; - m_y = position.y; - - int mac_x = position.x; - int mac_y = position.y; - - if ( IsButton() ) - { - Rect contrlRect; - GetControlBounds( m_controlHandle, &contrlRect ); - int former_mac_x = contrlRect.left; - int former_mac_y = contrlRect.top; - GetToolBar()->GetToolSize(); - - if ( mac_x != former_mac_x || mac_y != former_mac_y ) - { - ::MoveControl( m_controlHandle, mac_x, mac_y ); - } - } - else if ( IsControl() ) - { - // embedded native controls are moved by the OS -#if wxOSX_USE_NATIVE_TOOLBAR - if ( ((wxToolBar*)GetToolBar())->MacWantsNativeToolbar() == false ) -#endif - { - GetControl()->Move( position ); - } - } - else - { - // separator - Rect contrlRect; - GetControlBounds( m_controlHandle, &contrlRect ); - int former_mac_x = contrlRect.left; - int former_mac_y = contrlRect.top; - - if ( mac_x != former_mac_x || mac_y != former_mac_y ) - ::MoveControl( m_controlHandle, mac_x, mac_y ); - } -} - -void wxToolBarTool::UpdateToggleImage( bool toggle ) -{ - if ( toggle ) - { - int w = m_bmpNormal.GetWidth() + 6; - int h = m_bmpNormal.GetHeight() + 6; - wxBitmap bmp( w, h ); - wxMemoryDC dc; - - dc.SelectObject( bmp ); - wxColour mid_grey_75 = wxColour(128, 128, 128, 196); - wxColour light_grey_75 = wxColour(196, 196, 196, 196); - dc.GradientFillLinear( wxRect(1, 1, w - 1, h-1), - light_grey_75, mid_grey_75, wxNORTH); - wxColour black_50 = wxColour(0, 0, 0, 127); - dc.SetPen( wxPen(black_50) ); - dc.DrawRoundedRectangle( 0, 0, w, h, 1.5 ); - dc.DrawBitmap( m_bmpNormal, 3, 3, true ); - dc.SelectObject( wxNullBitmap ); - ControlButtonContentInfo info; - wxMacCreateBitmapButton( &info, bmp ); - SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info ); -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_toolbarItemRef != NULL) - { - ControlButtonContentInfo info2; - wxMacCreateBitmapButton( &info2, bmp, kControlContentCGImageRef); - HIToolbarItemSetImage( m_toolbarItemRef, info2.u.imageRef ); - wxMacReleaseBitmapButton( &info2 ); - } -#endif - wxMacReleaseBitmapButton( &info ); - } - else - { - ControlButtonContentInfo info; - wxMacCreateBitmapButton( &info, m_bmpNormal ); - SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info ); -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_toolbarItemRef != NULL) - { - ControlButtonContentInfo info2; - wxMacCreateBitmapButton( &info2, m_bmpNormal, kControlContentCGImageRef); - HIToolbarItemSetImage( m_toolbarItemRef, info2.u.imageRef ); - wxMacReleaseBitmapButton( &info2 ); - } -#endif - wxMacReleaseBitmapButton( &info ); - } - - IconTransformType transform = toggle ? kTransformSelected : kTransformNone; - SetControlData( - m_controlHandle, 0, kControlIconTransformTag, - sizeof(transform), (Ptr)&transform ); - HIViewSetNeedsDisplay( m_controlHandle, true ); - -} - -wxToolBarTool::wxToolBarTool( - wxToolBar *tbar, - int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp ) - : - wxToolBarToolBase( - tbar, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp ) -{ - Init(); -} - -#pragma mark - -#pragma mark Toolbar Implementation - -wxToolBarToolBase *wxToolBar::CreateTool( - int id, - const wxString& label, - const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp ) -{ - return new wxToolBarTool( - this, id, label, bmpNormal, bmpDisabled, kind, - clientData, shortHelp, longHelp ); -} - -wxToolBarToolBase * -wxToolBar::CreateTool(wxControl *control, const wxString& label) -{ - return new wxToolBarTool(this, control, label); -} - -void wxToolBar::Init() -{ - m_maxWidth = -1; - m_maxHeight = -1; - m_defaultWidth = kwxMacToolBarToolDefaultWidth; - m_defaultHeight = kwxMacToolBarToolDefaultHeight; - -#if wxOSX_USE_NATIVE_TOOLBAR - m_macToolbar = NULL; - m_macUsesNativeToolbar = false; -#endif -} - -#define kControlToolbarItemClassID CFSTR( "org.wxwidgets.controltoolbaritem" ) - -const EventTypeSpec kEvents[] = -{ - { kEventClassHIObject, kEventHIObjectConstruct }, - { kEventClassHIObject, kEventHIObjectInitialize }, - { kEventClassHIObject, kEventHIObjectDestruct }, - - { kEventClassToolbarItem, kEventToolbarItemCreateCustomView } -}; - -const EventTypeSpec kViewEvents[] = -{ - { kEventClassControl, kEventControlGetSizeConstraints } -}; - -struct ControlToolbarItem -{ - HIToolbarItemRef toolbarItem; - HIViewRef viewRef; - wxSize lastValidSize ; -}; - -static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData ) -{ - OSStatus result = eventNotHandledErr; - ControlToolbarItem* object = (ControlToolbarItem*)inUserData; - - switch ( GetEventClass( inEvent ) ) - { - case kEventClassHIObject: - switch ( GetEventKind( inEvent ) ) - { - case kEventHIObjectConstruct: - { - HIObjectRef toolbarItem; - ControlToolbarItem* item; - - GetEventParameter( inEvent, kEventParamHIObjectInstance, typeHIObjectRef, NULL, - sizeof( HIObjectRef ), NULL, &toolbarItem ); - - item = (ControlToolbarItem*) malloc(sizeof(ControlToolbarItem)) ; - item->toolbarItem = toolbarItem ; - item->lastValidSize = wxSize(-1,-1); - item->viewRef = NULL ; - - SetEventParameter( inEvent, kEventParamHIObjectInstance, typeVoidPtr, sizeof( void * ), &item ); - - result = noErr ; - } - break; - - case kEventHIObjectInitialize: - result = CallNextEventHandler( inCallRef, inEvent ); - if ( result == noErr ) - { - CFDataRef data; - GetEventParameter( inEvent, kEventParamToolbarItemConfigData, typeCFTypeRef, NULL, - sizeof( CFTypeRef ), NULL, &data ); - - HIViewRef viewRef ; - - wxASSERT_MSG( CFDataGetLength( data ) == sizeof( viewRef ) , wxT("Illegal Data passed") ) ; - memcpy( &viewRef , CFDataGetBytePtr( data ) , sizeof( viewRef ) ) ; - - object->viewRef = (HIViewRef) viewRef ; - // make sure we keep that control during our lifetime - CFRetain( object->viewRef ) ; - - verify_noerr(InstallEventHandler( GetControlEventTarget( viewRef ), ControlToolbarItemHandler, - GetEventTypeCount( kViewEvents ), kViewEvents, object, NULL )); - result = noErr ; - } - break; - - case kEventHIObjectDestruct: - { - HIViewRef viewRef = object->viewRef ; - if( viewRef && IsValidControlHandle( viewRef) ) - { - // depending whether the wxControl corresponding to this HIView has already been destroyed or - // not, ref counts differ, so we cannot assert a special value - CFIndex count = CFGetRetainCount( viewRef ) ; - if ( count >= 1 ) - { - CFRelease( viewRef ) ; - } - } - free( object ) ; - result = noErr; - } - break; - } - break; - - case kEventClassToolbarItem: - switch ( GetEventKind( inEvent ) ) - { - case kEventToolbarItemCreateCustomView: - { - HIViewRef viewRef = object->viewRef ; - HIViewRemoveFromSuperview( viewRef ) ; - HIViewSetVisible(viewRef, true) ; - CFRetain( viewRef ) ; - result = SetEventParameter( inEvent, kEventParamControlRef, typeControlRef, sizeof( HIViewRef ), &viewRef ); - } - break; - } - break; - - case kEventClassControl: - switch ( GetEventKind( inEvent ) ) - { - case kEventControlGetSizeConstraints: - { - wxWindow* wxwindow = wxFindWindowFromWXWidget( (WXWidget) object->viewRef ) ; - if ( wxwindow ) - { - // during toolbar layout the native window sometimes gets negative sizes, - // sometimes it just gets shrunk behind our back, so in order to avoid - // ever shrinking more, once a valid size is captured, we keep it - - wxSize sz = object->lastValidSize; - if ( sz.x <= 0 || sz.y <= 0 ) - { - sz = wxwindow->GetSize() ; - sz.x -= wxwindow->MacGetLeftBorderSize() + wxwindow->MacGetRightBorderSize(); - sz.y -= wxwindow->MacGetTopBorderSize() + wxwindow->MacGetBottomBorderSize(); - if ( sz.x > 0 && sz.y > 0 ) - object->lastValidSize = sz ; - else - sz = wxSize(0,0) ; - } - - // Extra width to avoid edge of combobox being cut off - sz.x += 3; - - HISize min, max; - min.width = max.width = sz.x ; - min.height = max.height = sz.y ; - - result = SetEventParameter( inEvent, kEventParamMinimumSize, typeHISize, - sizeof( HISize ), &min ); - - result = SetEventParameter( inEvent, kEventParamMaximumSize, typeHISize, - sizeof( HISize ), &max ); - result = noErr ; - } - } - break; - } - break; - } - - return result; -} - -void RegisterControlToolbarItemClass() -{ - static bool sRegistered; - - if ( !sRegistered ) - { - HIObjectRegisterSubclass( kControlToolbarItemClassID, kHIToolbarItemClassID, 0, - ControlToolbarItemHandler, GetEventTypeCount( kEvents ), kEvents, 0, NULL ); - - sRegistered = true; - } -} - -HIToolbarItemRef CreateControlToolbarItem(CFStringRef inIdentifier, CFTypeRef inConfigData) -{ - RegisterControlToolbarItemClass(); - - OSStatus err; - EventRef event; - UInt32 options = kHIToolbarItemAllowDuplicates; - HIToolbarItemRef result = NULL; - - err = CreateEvent( NULL, kEventClassHIObject, kEventHIObjectInitialize, GetCurrentEventTime(), 0, &event ); - require_noerr( err, CantCreateEvent ); - - SetEventParameter( event, kEventParamAttributes, typeUInt32, sizeof( UInt32 ), &options ); - SetEventParameter( event, kEventParamToolbarItemIdentifier, typeCFStringRef, sizeof( CFStringRef ), &inIdentifier ); - - if ( inConfigData ) - SetEventParameter( event, kEventParamToolbarItemConfigData, typeCFTypeRef, sizeof( CFTypeRef ), &inConfigData ); - - err = HIObjectCreate( kControlToolbarItemClassID, event, (HIObjectRef*)&result ); - check_noerr( err ); - - ReleaseEvent( event ); -CantCreateEvent : - return result ; -} - -#if wxOSX_USE_NATIVE_TOOLBAR -static const EventTypeSpec kToolbarEvents[] = -{ - { kEventClassToolbar, kEventToolbarGetDefaultIdentifiers }, - { kEventClassToolbar, kEventToolbarGetAllowedIdentifiers }, - { kEventClassToolbar, kEventToolbarCreateItemWithIdentifier }, -}; - -static OSStatus ToolbarDelegateHandler(EventHandlerCallRef WXUNUSED(inCallRef), - EventRef inEvent, - void* WXUNUSED(inUserData)) -{ - OSStatus result = eventNotHandledErr; - // Not yet needed - // wxToolBar* toolbar = (wxToolBar*) inUserData ; - CFMutableArrayRef array; - - switch ( GetEventKind( inEvent ) ) - { - case kEventToolbarGetDefaultIdentifiers: - { - GetEventParameter( inEvent, kEventParamMutableArray, typeCFMutableArrayRef, NULL, - sizeof( CFMutableArrayRef ), NULL, &array ); - // not implemented yet - // GetToolbarDefaultItems( array ); - result = noErr; - } - break; - - case kEventToolbarGetAllowedIdentifiers: - { - GetEventParameter( inEvent, kEventParamMutableArray, typeCFMutableArrayRef, NULL, - sizeof( CFMutableArrayRef ), NULL, &array ); - // not implemented yet - // GetToolbarAllowedItems( array ); - result = noErr; - } - break; - case kEventToolbarCreateItemWithIdentifier: - { - HIToolbarItemRef item = NULL; - CFTypeRef data = NULL; - CFStringRef identifier = NULL ; - - GetEventParameter( inEvent, kEventParamToolbarItemIdentifier, typeCFStringRef, NULL, - sizeof( CFStringRef ), NULL, &identifier ); - - GetEventParameter( inEvent, kEventParamToolbarItemConfigData, typeCFTypeRef, NULL, - sizeof( CFTypeRef ), NULL, &data ); - - if ( CFStringCompare( kControlToolbarItemClassID, identifier, kCFCompareBackwards ) == kCFCompareEqualTo ) - { - item = CreateControlToolbarItem( kControlToolbarItemClassID, data ); - if ( item ) - { - SetEventParameter( inEvent, kEventParamToolbarItem, typeHIToolbarItemRef, - sizeof( HIToolbarItemRef ), &item ); - result = noErr; - } - } - - } - break; - } - return result ; -} -#endif // wxOSX_USE_NATIVE_TOOLBAR - -// also for the toolbar we have the dual implementation: -// only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar - -bool wxToolBar::Create( - wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name ) -{ - if ( !wxToolBarBase::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) - return false; - - FixupStyle(); - - OSStatus err = noErr; - -#if wxOSX_USE_NATIVE_TOOLBAR - if (parent->IsKindOf(CLASSINFO(wxFrame)) && wxSystemOptions::GetOptionInt(wxT("mac.toolbar.no-native")) != 1) - { - wxString labelStr = wxString::Format( wxT("%p"), this ); - err = HIToolbarCreate( - wxCFStringRef( labelStr, wxFont::GetDefaultEncoding() ), 0, - (HIToolbarRef*) &m_macToolbar ); - - if (m_macToolbar != NULL) - { - InstallEventHandler( HIObjectGetEventTarget((HIToolbarRef)m_macToolbar ), ToolbarDelegateHandler, - GetEventTypeCount( kToolbarEvents ), kToolbarEvents, this, NULL ); - - HIToolbarDisplayMode mode = kHIToolbarDisplayModeDefault; - HIToolbarDisplaySize displaySize = kHIToolbarDisplaySizeSmall; - - if ( style & wxTB_NOICONS ) - mode = kHIToolbarDisplayModeLabelOnly; - else if ( style & wxTB_TEXT ) - mode = kHIToolbarDisplayModeIconAndLabel; - else - mode = kHIToolbarDisplayModeIconOnly; - - HIToolbarSetDisplayMode( (HIToolbarRef) m_macToolbar, mode ); - HIToolbarSetDisplaySize( (HIToolbarRef) m_macToolbar, displaySize ); - } - } -#endif // wxOSX_USE_NATIVE_TOOLBAR - - return (err == noErr); -} - -wxToolBar::~wxToolBar() -{ -#if wxOSX_USE_NATIVE_TOOLBAR - // We could be not using a native tool bar at all, this happens when we're - // created with something other than the frame as parent for example. - if ( !m_macToolbar ) - return; - - // it might already have been uninstalled due to a previous call to Destroy, but in case - // wasn't, do so now, otherwise redraw events may occur for deleted objects - bool ownToolbarInstalled = false; - MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); - if (ownToolbarInstalled) - { - MacUninstallNativeToolbar(); - } - - CFIndex count = CFGetRetainCount( m_macToolbar ) ; - CFRelease( (HIToolbarRef)m_macToolbar ); - m_macToolbar = NULL; -#endif // wxOSX_USE_NATIVE_TOOLBAR -} - -bool wxToolBar::Show( bool show ) -{ - WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); - bool bResult = (tlw != NULL); - - if (bResult) - { -#if wxOSX_USE_NATIVE_TOOLBAR - bool ownToolbarInstalled = false; - MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); - if (ownToolbarInstalled) - { - bResult = (IsWindowToolbarVisible( tlw ) != show); - if ( bResult ) - ShowHideWindowToolbar( tlw, show, false ); - } - else - bResult = wxToolBarBase::Show( show ); -#else - - bResult = wxToolBarBase::Show( show ); -#endif - } - - return bResult; -} - -bool wxToolBar::IsShown() const -{ - bool bResult; - -#if wxOSX_USE_NATIVE_TOOLBAR - bool ownToolbarInstalled; - - MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); - if (ownToolbarInstalled) - { - WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); - bResult = IsWindowToolbarVisible( tlw ); - } - else - bResult = wxToolBarBase::IsShown(); -#else - - bResult = wxToolBarBase::IsShown(); -#endif - - return bResult; -} - -void wxToolBar::DoGetSize( int *width, int *height ) const -{ -#if wxOSX_USE_NATIVE_TOOLBAR - Rect boundsR; - bool ownToolbarInstalled; - - MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); - if ( ownToolbarInstalled ) - { - // TODO: is this really a control ? - GetControlBounds( (ControlRef) m_macToolbar, &boundsR ); - if ( width != NULL ) - *width = boundsR.right - boundsR.left; - if ( height != NULL ) - *height = boundsR.bottom - boundsR.top; - } - else - wxToolBarBase::DoGetSize( width, height ); - -#else - wxToolBarBase::DoGetSize( width, height ); -#endif -} - -wxSize wxToolBar::DoGetBestSize() const -{ - int width, height; - - DoGetSize( &width, &height ); - - return wxSize( width, height ); -} - -void wxToolBar::SetWindowStyleFlag( long style ) -{ - wxToolBarBase::SetWindowStyleFlag( style ); - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - HIToolbarDisplayMode mode = kHIToolbarDisplayModeDefault; - - if ( style & wxTB_NOICONS ) - mode = kHIToolbarDisplayModeLabelOnly; - else if ( style & wxTB_TEXT ) - mode = kHIToolbarDisplayModeIconAndLabel; - else - mode = kHIToolbarDisplayModeIconOnly; - - HIToolbarSetDisplayMode( (HIToolbarRef) m_macToolbar, mode ); - } -#endif -} - -#if wxOSX_USE_NATIVE_TOOLBAR -bool wxToolBar::MacWantsNativeToolbar() -{ - return m_macUsesNativeToolbar; -} - -bool wxToolBar::MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const -{ - bool bResultV = false; - - if (ownToolbarInstalled != NULL) - *ownToolbarInstalled = false; - - WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); - if (tlw != NULL) - { - HIToolbarRef curToolbarRef = NULL; - OSStatus err = GetWindowToolbar( tlw, &curToolbarRef ); - bResultV = ((err == noErr) && (curToolbarRef != NULL)); - if (bResultV && (ownToolbarInstalled != NULL)) - *ownToolbarInstalled = (curToolbarRef == m_macToolbar); - } - - return bResultV; -} - -bool wxToolBar::MacInstallNativeToolbar(bool usesNative) -{ - bool bResult = false; - - if (usesNative && (m_macToolbar == NULL)) - return bResult; - - if (usesNative && ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT|wxTB_BOTTOM)) != 0)) - return bResult; - - WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); - if (tlw == NULL) - return bResult; - - // check the existing toolbar - HIToolbarRef curToolbarRef = NULL; - OSStatus err = GetWindowToolbar( tlw, &curToolbarRef ); - if (err != noErr) - curToolbarRef = NULL; - - m_macUsesNativeToolbar = usesNative; - - if (m_macUsesNativeToolbar) - { - // only install toolbar if there isn't one installed already - if (curToolbarRef == NULL) - { - bResult = true; - - SetWindowToolbar( tlw, (HIToolbarRef) m_macToolbar ); - - // ShowHideWindowToolbar will make the wxFrame grow - // which we don't want in this case - wxSize sz = GetParent()->GetSize(); - ShowHideWindowToolbar( tlw, true, false ); - // Restore the original size - GetParent()->SetSize( sz ); - - ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 ); - - SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); - - GetPeer()->Move(0,0,0,0 ); - SetSize( wxSIZE_AUTO_WIDTH, 0 ); - GetPeer()->SetVisibility( false ); - wxToolBarBase::Show( false ); - } - } - else - { - // only deinstall toolbar if this is the installed one - if (m_macToolbar == curToolbarRef) - { - bResult = true; - - ShowHideWindowToolbar( tlw, false, false ); - ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute ); - MacUninstallNativeToolbar(); - - GetPeer()->SetVisibility( true ); - } - } - - if (bResult) - InvalidateBestSize(); - -// wxLogDebug( wxT(" --> [%lx] - result [%s]"), (long)this, bResult ? wxT("T") : wxT("F") ); - return bResult; -} - -void wxToolBar::MacUninstallNativeToolbar() -{ - if (!m_macToolbar) - return; - - WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); - if (tlw) - SetWindowToolbar( tlw, NULL ); -} -#endif - -bool wxToolBar::Realize() -{ - if ( !wxToolBarBase::Realize() ) - return false; - - wxSize tlw_sz = GetParent()->GetSize(); - - int maxWidth = 0; - int maxHeight = 0; - - int maxToolWidth = 0; - int maxToolHeight = 0; - - int x = m_xMargin + kwxMacToolBarLeftMargin; - int y = m_yMargin + kwxMacToolBarTopMargin; - - int tw, th; - GetSize( &tw, &th ); - - // find the maximum tool width and height - wxToolBarTool *tool; - wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - while ( node ) - { - tool = (wxToolBarTool *) node->GetData(); - if ( tool != NULL ) - { - wxSize sz = tool->GetSize(); - - if ( sz.x > maxToolWidth ) - maxToolWidth = sz.x; - if ( sz.y > maxToolHeight ) - maxToolHeight = sz.y; - } - - node = node->GetNext(); - } - - bool lastIsRadio = false; - bool curIsRadio = false; - -#if wxOSX_USE_NATIVE_TOOLBAR - CFIndex currentPosition = 0; - bool insertAll = false; - - HIToolbarRef refTB = (HIToolbarRef)m_macToolbar; - wxFont f; - wxFontEncoding enc; - f = GetFont(); - if ( f.IsOk() ) - enc = f.GetEncoding(); - else - enc = wxFont::GetDefaultEncoding(); -#endif - - node = m_tools.GetFirst(); - while ( node ) - { - tool = (wxToolBarTool*) node->GetData(); - if ( tool == NULL ) - { - node = node->GetNext(); - continue; - } - - // set tool position: - // for the moment just perform a single row/column alignment - wxSize cursize = tool->GetSize(); - if ( x + cursize.x > maxWidth ) - maxWidth = x + cursize.x; - if ( y + cursize.y > maxHeight ) - maxHeight = y + cursize.y; - - if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) ) - { - int x1 = x + ( maxToolWidth - cursize.x ) / 2; - tool->SetPosition( wxPoint(x1, y) ); - } - else - { - int y1 = y + ( maxToolHeight - cursize.y ) / 2; - tool->SetPosition( wxPoint(x, y1) ); - } - - // update the item positioning state - if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) ) - y += cursize.y + kwxMacToolSpacing; - else - x += cursize.x + kwxMacToolSpacing; - -#if wxOSX_USE_NATIVE_TOOLBAR - // install in native HIToolbar - if ( refTB ) - { - HIToolbarItemRef hiItemRef = tool->GetToolbarItemRef(); - if ( hiItemRef != NULL ) - { - // since setting the help texts is non-virtual we have to update - // the strings now - if ( insertAll || (tool->GetIndex() != currentPosition) ) - { - OSStatus err = noErr; - if ( !insertAll ) - { - insertAll = true; - - // if this is the first tool that gets newly inserted or repositioned - // first remove all 'old' tools from here to the right, because of this - // all following tools will have to be reinserted (insertAll). - for ( wxToolBarToolsList::compatibility_iterator node2 = m_tools.GetLast(); - node2 != node; - node2 = node2->GetPrevious() ) - { - wxToolBarTool *tool2 = (wxToolBarTool*) node2->GetData(); - - const long idx = tool2->GetIndex(); - if ( idx != -1 ) - { - if ( tool2->IsControl() ) - { - CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ; - if ( count != 3 && count != 2 ) - { - wxFAIL_MSG("Reference count of native tool was illegal before removal"); - } - - wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ; - } - err = HIToolbarRemoveItemAtIndex(refTB, idx); - if ( err != noErr ) - { - wxLogDebug(wxT("HIToolbarRemoveItemAtIndex(%ld) failed [%ld]"), - idx, (long)err); - } - if ( tool2->IsControl() ) - { - CFIndex count = CFGetRetainCount( tool2->GetControl()->GetPeer()->GetControlRef() ) ; - if ( count != 2 ) - { - wxFAIL_MSG("Reference count of native tool was not 2 after removal"); - } - - wxASSERT( IsValidControlHandle(tool2->GetControl()->GetPeer()->GetControlRef() )) ; - } - - tool2->SetIndex(-1); - } - } - } - - err = HIToolbarInsertItemAtIndex( refTB, hiItemRef, currentPosition ); - if (err != noErr) - { - wxLogDebug( wxT("HIToolbarInsertItemAtIndex failed [%ld]"), (long)err ); - } - - tool->SetIndex( currentPosition ); - if ( tool->IsControl() ) - { - CFIndex count = CFGetRetainCount( tool->GetControl()->GetPeer()->GetControlRef() ) ; - if ( count != 3 && count != 2 ) - { - wxFAIL_MSG("Reference count of native tool was illegal before removal"); - } - wxASSERT( IsValidControlHandle(tool->GetControl()->GetPeer()->GetControlRef() )) ; - - wxString label = tool->GetLabel(); - if ( !label.empty() ) - HIToolbarItemSetLabel( hiItemRef, wxCFStringRef(label, GetFont().GetEncoding()) ); - } - } - - currentPosition++; - } - } -#endif - - // update radio button (and group) state - lastIsRadio = curIsRadio; - curIsRadio = ( tool->IsButton() && (tool->GetKind() == wxITEM_RADIO) ); - - if ( !curIsRadio ) - { - if ( tool->IsToggled() ) - DoToggleTool( tool, true ); - } - else - { - if ( !lastIsRadio ) - { - if ( tool->Toggle( true ) ) - { - DoToggleTool( tool, true ); - } - } - else if ( tool->IsToggled() ) - { - if ( tool->IsToggled() ) - DoToggleTool( tool, true ); - - wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); - while ( nodePrev ) - { - wxToolBarToolBase *toggleTool = nodePrev->GetData(); - if ( (toggleTool == NULL) || !toggleTool->IsButton() || (toggleTool->GetKind() != wxITEM_RADIO) ) - break; - - if ( toggleTool->Toggle( false ) ) - DoToggleTool( toggleTool, false ); - - nodePrev = nodePrev->GetPrevious(); - } - } - } - - node = node->GetNext(); - } - - if (m_macUsesNativeToolbar) - GetParent()->SetSize( tlw_sz ); - - if ( GetWindowStyleFlag() & (wxTB_TOP|wxTB_BOTTOM) ) - { - // if not set yet, only one row - if ( m_maxRows <= 0 ) - SetRows( 1 ); - - m_minWidth = maxWidth; - maxHeight += m_yMargin + kwxMacToolBarTopMargin; - m_minHeight = m_maxHeight = maxHeight; - } - else - { - // if not set yet, have one column - if ( (GetToolsCount() > 0) && (m_maxRows <= 0) ) - SetRows( GetToolsCount() ); - - m_minHeight = maxHeight; - maxWidth += m_xMargin + kwxMacToolBarLeftMargin; - m_minWidth = m_maxWidth = maxWidth; - } - -#if 0 - // FIXME: should this be OSX-only? - { - bool wantNativeToolbar, ownToolbarInstalled; - - // attempt to install the native toolbar - wantNativeToolbar = ((GetWindowStyleFlag() & (wxTB_LEFT|wxTB_BOTTOM|wxTB_RIGHT)) == 0); - MacInstallNativeToolbar( wantNativeToolbar ); - (void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); - if (!ownToolbarInstalled) - { - SetSize( maxWidth, maxHeight ); - InvalidateBestSize(); - } - } -#else - SetSize( maxWidth, maxHeight ); - InvalidateBestSize(); -#endif - - SetInitialSize(); - - return true; -} - -void wxToolBar::DoLayout() -{ - // TODO port back osx_cocoa layout solution -} - -void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags) -{ - wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags); - - DoLayout(); -} - -void wxToolBar::SetToolBitmapSize(const wxSize& size) -{ - m_defaultWidth = size.x + kwxMacToolBorder; - m_defaultHeight = size.y + kwxMacToolBorder; - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - int maxs = wxMax( size.x, size.y ); - HIToolbarDisplaySize sizeSpec; - if ( maxs > 32 ) - sizeSpec = kHIToolbarDisplaySizeNormal; - else if ( maxs > 24 ) - sizeSpec = kHIToolbarDisplaySizeDefault; - else - sizeSpec = kHIToolbarDisplaySizeSmall; - - HIToolbarSetDisplaySize( (HIToolbarRef) m_macToolbar, sizeSpec ); - } -#endif -} - -// The button size is bigger than the bitmap size -wxSize wxToolBar::GetToolSize() const -{ - return wxSize(m_defaultWidth + kwxMacToolBorder, m_defaultHeight + kwxMacToolBorder); -} - -void wxToolBar::SetRows(int nRows) -{ - // avoid resizing the frame uselessly - if ( nRows != m_maxRows ) - m_maxRows = nRows; -} - -void wxToolBar::MacSuperChangedPosition() -{ - wxWindow::MacSuperChangedPosition(); - -#if wxOSX_USE_NATIVE_TOOLBAR - if (! m_macUsesNativeToolbar ) - Realize(); -#else - - Realize(); -#endif -} - -void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) -{ - wxToolBarTool* tool = static_cast(FindById(id)); - if ( tool ) - { - wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); - - tool->SetNormalBitmap(bitmap); - - // a side-effect of the UpdateToggleImage function is that it always changes the bitmap used on the button. - tool->UpdateToggleImage( tool->CanBeToggled() && tool->IsToggled() ); - } -} - -void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) -{ - wxToolBarTool* tool = static_cast(FindById(id)); - if ( tool ) - { - wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); - - tool->SetDisabledBitmap(bitmap); - - // TODO: what to do for this one? - } -} - -wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const -{ - wxToolBarTool *tool; - wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); - while ( node ) - { - tool = (wxToolBarTool *)node->GetData(); - if (tool != NULL) - { - wxRect2DInt r( tool->GetPosition(), tool->GetSize() ); - if ( r.Contains( wxPoint( x, y ) ) ) - return tool; - } - - node = node->GetNext(); - } - - return NULL; -} - -wxString wxToolBar::MacGetToolTipString( wxPoint &pt ) -{ - wxToolBarToolBase *tool = FindToolForPosition( pt.x, pt.y ); - if ( tool != NULL ) - return tool->GetShortHelp(); - - return wxEmptyString; -} - -void wxToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(t), bool WXUNUSED(enable)) -{ - // everything already done in the tool's implementation -} - -void wxToolBar::DoToggleTool(wxToolBarToolBase *WXUNUSED(t), bool WXUNUSED(toggle)) -{ - // everything already done in the tool's implementation -} - -bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) -{ - wxToolBarTool *tool = static_cast< wxToolBarTool*>(toolBase ); - if (tool == NULL) - return false; - - WindowRef window = (WindowRef) MacGetTopLevelWindowRef(); - wxSize toolSize = GetToolSize(); - Rect toolrect = { 0, 0, toolSize.y, toolSize.x }; - ControlRef controlHandle = NULL; - OSStatus err = 0; - -#if wxOSX_USE_NATIVE_TOOLBAR - wxString label = tool->GetLabel(); - if (m_macToolbar && !label.empty() ) - { - // strip mnemonics from the label for compatibility - // with the usual labels in wxStaticText sense - label = wxStripMenuCodes(label); - } -#endif // wxOSX_USE_NATIVE_TOOLBAR - - switch (tool->GetStyle()) - { - case wxTOOL_STYLE_SEPARATOR: - { - wxASSERT( tool->GetControlHandle() == NULL ); - toolSize.x /= 4; - toolSize.y /= 4; - if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) ) - toolrect.bottom = toolSize.y; - else - toolrect.right = toolSize.x; - - // in flat style we need a visual separator -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - HIToolbarItemRef item; - err = HIToolbarItemCreate( - kHIToolbarSeparatorIdentifier, - kHIToolbarItemCantBeRemoved | kHIToolbarItemIsSeparator | kHIToolbarItemAllowDuplicates, - &item ); - if (err == noErr) - tool->SetToolbarItemRef( item ); - } - else - err = noErr; -#endif // wxOSX_USE_NATIVE_TOOLBAR - - CreateSeparatorControl( window, &toolrect, &controlHandle ); - tool->SetControlHandle( controlHandle ); - } - break; - - case wxTOOL_STYLE_BUTTON: - { - wxASSERT( tool->GetControlHandle() == NULL ); - - // contrary to the docs this control only works with iconrefs - ControlButtonContentInfo info; - wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef ); - CreateIconControl( window, &toolrect, &info, false, &controlHandle ); - wxMacReleaseBitmapButton( &info ); - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - HIToolbarItemRef item; - wxString labelStr = wxString::Format(wxT("%p"), tool); - err = HIToolbarItemCreate( - wxCFStringRef(labelStr, wxFont::GetDefaultEncoding()), - kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemAllowDuplicates, &item ); - if (err == noErr) - { - ControlButtonContentInfo info2; - wxMacCreateBitmapButton( &info2, tool->GetNormalBitmap(), kControlContentCGImageRef); - - InstallEventHandler( - HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(), - GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL ); - HIToolbarItemSetLabel( item, wxCFStringRef(label, GetFont().GetEncoding()) ); - HIToolbarItemSetImage( item, info2.u.imageRef ); - HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction ); - tool->SetToolbarItemRef( item ); - - wxMacReleaseBitmapButton( &info2 ); - } - } - else - err = noErr; -#endif // wxOSX_USE_NATIVE_TOOLBAR - - wxMacReleaseBitmapButton( &info ); - -#if 0 - SetBevelButtonTextPlacement( m_controlHandle, kControlBevelButtonPlaceBelowGraphic ); - SetControlTitleWithCFString( m_controlHandle , wxCFStringRef( label, wxFont::GetDefaultEncoding() ); -#endif - - InstallControlEventHandler( - (ControlRef) controlHandle, GetwxMacToolBarToolEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, tool, NULL ); - - tool->SetControlHandle( controlHandle ); - } - break; - - case wxTOOL_STYLE_CONTROL: - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - wxCHECK_MSG( tool->GetControl(), false, wxT("control must be non-NULL") ); - HIToolbarItemRef item; - HIViewRef viewRef = (HIViewRef) tool->GetControl()->GetHandle() ; - CFDataRef data = CFDataCreate( kCFAllocatorDefault , (UInt8*) &viewRef , sizeof(viewRef) ) ; - err = HIToolbarCreateItemWithIdentifier((HIToolbarRef) m_macToolbar,kControlToolbarItemClassID, - data , &item ) ; - - if (err == noErr) - { - tool->SetToolbarItemRef( item ); - } - CFRelease( data ) ; - } - else - { - err = noErr; - break; - } -#else - // right now there's nothing to do here -#endif - break; - - default: - break; - } - - if ( err == noErr ) - { - if ( controlHandle ) - { - ControlRef container = (ControlRef) GetHandle(); - wxASSERT_MSG( container != NULL, wxT("No valid Mac container control") ); - - SetControlVisibility( controlHandle, true, true ); - ::EmbedControl( controlHandle, container ); - } - - if ( tool->CanBeToggled() && tool->IsToggled() ) - tool->UpdateToggleImage( true ); - - // nothing special to do here - we relayout in Realize() later - InvalidateBestSize(); - } - else - { - wxFAIL_MSG( wxString::Format( wxT("wxToolBar::DoInsertTool - failure [%ld]"), (long)err ) ); - } - - return (err == noErr); -} - -void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) -{ - // nothing to do -} - -bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase) -{ - wxToolBarTool* tool = static_cast< wxToolBarTool*>(toolbase ); - wxToolBarToolsList::compatibility_iterator node; - for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) - { - wxToolBarToolBase *tool2 = node->GetData(); - if ( tool2 == tool ) - { - // let node point to the next node in the list - node = node->GetNext(); - - break; - } - } - - wxSize sz = ((wxToolBarTool*)tool)->GetSize(); - -#if wxOSX_USE_NATIVE_TOOLBAR - CFIndex removeIndex = tool->GetIndex(); -#endif - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - if ( removeIndex != -1 && m_macToolbar ) - { - HIToolbarRemoveItemAtIndex( (HIToolbarRef) m_macToolbar, removeIndex ); - tool->SetIndex( -1 ); - } - } -#endif - - tool->ClearControl(); - - // and finally reposition all the controls after this one - - for ( /* node -> first after deleted */; node; node = node->GetNext() ) - { - wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData(); - wxPoint pt = tool2->GetPosition(); - - if ( GetWindowStyleFlag() & (wxTB_LEFT|wxTB_RIGHT) ) - pt.y -= sz.y; - else - pt.x -= sz.x; - - tool2->SetPosition( pt ); - -#if wxOSX_USE_NATIVE_TOOLBAR - if (m_macToolbar != NULL) - { - if ( removeIndex != -1 && tool2->GetIndex() > removeIndex ) - tool2->SetIndex( tool2->GetIndex() - 1 ); - } -#endif - } - - InvalidateBestSize(); - - return true; -} - -void wxToolBar::OnPaint(wxPaintEvent& event) -{ -#if wxOSX_USE_NATIVE_TOOLBAR - if ( m_macUsesNativeToolbar ) - { - event.Skip(true); - return; - } -#endif - - wxPaintDC dc(this); - - int w, h; - GetSize( &w, &h ); - - bool drawMetalTheme = MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL; - - if ( !drawMetalTheme ) - { - HIThemePlacardDrawInfo info; - memset( &info, 0, sizeof(info) ); - info.version = 0; - info.state = IsEnabled() ? kThemeStateActive : kThemeStateInactive; - - CGContextRef cgContext = (CGContextRef) MacGetCGContextRef(); - HIRect rect = CGRectMake( 0, 0, w, h ); - HIThemeDrawPlacard( &rect, &info, cgContext, kHIThemeOrientationNormal ); - } - else - { - // leave the background as it is (striped or metal) - } - - event.Skip(); -} - -#endif // wxUSE_TOOLBAR diff --git a/Externals/wxWidgets3/src/osx/carbon/tooltip.cpp b/Externals/wxWidgets3/src/osx/carbon/tooltip.cpp deleted file mode 100644 index 66f99826e0..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/tooltip.cpp +++ /dev/null @@ -1,257 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/tooltip.cpp -// Purpose: wxToolTip implementation -// Author: Stefan Csomor -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_TOOLTIPS - -#include "wx/tooltip.h" - -#ifndef WX_PRECOMP - #include "wx/app.h" - #include "wx/window.h" - #include "wx/dc.h" - #include "wx/timer.h" - #include "wx/nonownedwnd.h" -#endif // WX_PRECOMP - -#include "wx/geometry.h" -#include "wx/osx/uma.h" - -//----------------------------------------------------------------------------- -// global data -//----------------------------------------------------------------------------- - -#if wxUSE_TIMER -class wxMacToolTipTimer : public wxTimer -{ -public: - wxMacToolTipTimer(wxMacToolTip* tip, int iMilliseconds) ; - wxMacToolTipTimer() {} ; - virtual ~wxMacToolTipTimer() {} ; - - void Notify() - { - if ( m_mark == m_tip->GetMark() ) - m_tip->Draw() ; - } - -protected: - wxMacToolTip* m_tip; - long m_mark ; -}; -#endif // wxUSE_TIMER - -//----------------------------------------------------------------------------- -// wxToolTip -//----------------------------------------------------------------------------- -static long s_ToolTipDelay = 500 ; -static bool s_ShowToolTips = true ; -static wxMacToolTip s_ToolTip ; -static wxWindow* s_LastWindowEntered = NULL ; -static wxRect2DInt s_ToolTipArea ; -static WindowRef s_ToolTipWindowRef = NULL ; - -IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) - - -wxToolTip::wxToolTip( const wxString &tip ) -{ - m_text = tip; - m_window = NULL; -} - -wxToolTip::~wxToolTip() -{ -} - -void wxToolTip::SetTip( const wxString &tip ) -{ - m_text = tip; - - if ( m_window ) - { -#if 0 - // update it immediately - wxToolInfo ti(GetHwndOf(m_window)); - ti.lpszText = (wxChar *)m_text.c_str(); - - (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti); -#endif - } -} - -void wxToolTip::SetWindow( wxWindow *win ) -{ - m_window = win ; -} - -void wxToolTip::Enable( bool flag ) -{ - if ( s_ShowToolTips != flag ) - { - s_ShowToolTips = flag ; - - if ( s_ShowToolTips ) - { - } - else - { - s_ToolTip.Clear() ; - } - } -} - -void wxToolTip::SetDelay( long msecs ) -{ - s_ToolTipDelay = msecs ; -} - -void wxToolTip::SetAutoPop( long WXUNUSED(msecs) ) -{ -} - -void wxToolTip::SetReshow( long WXUNUSED(msecs) ) -{ -} - -void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event ) -{ - if ( s_ShowToolTips ) - { - if ( event.GetEventType() == wxEVT_LEAVE_WINDOW ) - { - s_ToolTip.Clear() ; - } - else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION ) - { - wxPoint2DInt where( event.m_x , event.m_y ) ; - if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) ) - { - } - else - { - s_ToolTip.Clear() ; - s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ; - s_LastWindowEntered = win ; - - WindowRef window = MAC_WXHWND( win->MacGetTopLevelWindowRef() ) ; - int x = event.m_x ; - int y = event.m_y ; - wxPoint local( x , y ) ; - win->MacClientToRootWindow( &x, &y ) ; - wxPoint windowlocal( x , y ) ; - s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ; - } - } - } -} - -void wxToolTip::RemoveToolTips() -{ - s_ToolTip.Clear() ; -} - -// --- mac specific -#if wxUSE_TIMER -wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec ) -{ - m_tip = tip; - m_mark = tip->GetMark() ; - Start(msec, true); -} -#endif // wxUSE_TIMER - -wxMacToolTip::wxMacToolTip() -{ - m_window = NULL ; - m_backpict = NULL ; -#if wxUSE_TIMER - m_timer = NULL ; -#endif - m_mark = 0 ; - m_shown = false ; -} - -void wxMacToolTip::Setup( WindowRef win , const wxString& text , const wxPoint& localPosition ) -{ - m_mark++ ; - - Clear() ; - m_position = localPosition ; - m_label = text ; - m_window =win; - s_ToolTipWindowRef = m_window ; - m_backpict = NULL ; -#if wxUSE_TIMER - delete m_timer ; - - m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ; -#endif // wxUSE_TIMER -} - -wxMacToolTip::~wxMacToolTip() -{ -#if wxUSE_TIMER - wxDELETE(m_timer); -#endif // wxUSE_TIMER - if ( m_backpict ) - Clear() ; -} - -const short kTipBorder = 2 ; -const short kTipOffset = 5 ; - -void wxMacToolTip::Draw() -{ - if ( m_label.empty() ) - return ; - - if ( m_window == s_ToolTipWindowRef ) - { - m_shown = true ; - - HMHelpContentRec tag ; - tag.version = kMacHelpVersion; - - int x = m_position.x; - int y = m_position.y; - wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) m_window); - if ( tlw ) - tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y ); - SetRect( &tag.absHotRect , x - 2 , y - 2 , x + 2 , y + 2 ); - - m_helpTextRef = wxCFStringRef( m_label , wxFONTENCODING_DEFAULT ) ; - tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; - tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ; - tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ; - tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ; - tag.tagSide = kHMDefaultSide; - HMDisplayTag( &tag ); - } -} - -void wxToolTip::NotifyWindowDelete( WXHWND win ) -{ - if ( win == s_ToolTipWindowRef ) - s_ToolTipWindowRef = NULL ; -} - -void wxMacToolTip::Clear() -{ - m_mark++ ; -#if wxUSE_TIMER - wxDELETE(m_timer); -#endif // wxUSE_TIMER - if ( !m_shown ) - return ; - - HMHideTag() ; -} - -#endif // wxUSE_TOOLTIPS diff --git a/Externals/wxWidgets3/src/osx/carbon/uma.cpp b/Externals/wxWidgets3/src/osx/carbon/uma.cpp deleted file mode 100644 index 2773665f4a..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/uma.cpp +++ /dev/null @@ -1,281 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/uma.cpp -// Purpose: UMA support -// Author: Stefan Csomor -// Modified by: -// Created: 04/01/98 -// Copyright: (c) Stefan Csomor -// Licence: The wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/osx/uma.h" - -#if wxUSE_GUI - -#include "wx/toplevel.h" -#include "wx/dc.h" - -#include "wx/osx/uma.h" - -// menu manager - -#if wxOSX_USE_CARBON - -MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding ) -{ - wxString str = wxStripMenuCodes( title ) ; - MenuRef menu ; - - CreateNewMenu( id , 0 , &menu ) ; - SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding ) ) ; - - return menu ; -} - -void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding ) -{ - wxString str = wxStripMenuCodes( title ) ; - - SetMenuTitleWithCFString( menu , wxCFStringRef(str , encoding) ) ; -} - -void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding ) -{ - // we don't strip the accels here anymore, must be done before - wxString str = title ; - - SetMenuItemTextWithCFString( menu , item , wxCFStringRef(str , encoding) ) ; -} - -void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable) -{ - if ( enable ) - EnableMenuItem( inMenu , inItem ) ; - else - DisableMenuItem( inMenu , inItem ) ; -} - -void UMAAppendSubMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , MenuRef submenu ) -{ - AppendMenuItemTextWithCFString( menu, - CFSTR("A"), 0, 0,NULL); - UMASetMenuItemText( menu, (SInt16) ::CountMenuItems(menu), title , encoding ); - SetMenuItemHierarchicalMenu( menu , CountMenuItems( menu ) , submenu ) ; - SetMenuTitleWithCFString(submenu , wxCFStringRef(title , encoding) ); -} - -void UMAInsertSubMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , MenuItemIndex item , SInt16 id ) -{ - InsertMenuItemTextWithCFString( menu, - CFSTR("A"), item, 0, 0); - - UMASetMenuItemText( menu, item+1, title , encoding ); - SetMenuItemHierarchicalID( menu , item+1 , id ) ; -} - -void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) -{ - if ( !entry ) - { - SetMenuItemCommandKey(menu, item, false, 0); - return ; - } - - UInt8 modifiers = 0 ; - SInt16 key = entry->GetKeyCode() ; - if ( key ) - { - bool explicitCommandKey = (entry->GetFlags() & wxACCEL_CTRL); - - if (entry->GetFlags() & wxACCEL_ALT) - modifiers |= kMenuOptionModifier ; - - if (entry->GetFlags() & wxACCEL_SHIFT) - modifiers |= kMenuShiftModifier ; - - if (entry->GetFlags() & wxACCEL_RAW_CTRL) - modifiers |= kMenuControlModifier ; - - SInt16 glyph = 0 ; - SInt16 macKey = key ; - if ( key >= WXK_F1 && key <= WXK_F15 ) - { - if ( !explicitCommandKey ) - modifiers |= kMenuNoCommandModifier ; - - // for some reasons this must be 0 right now - // everything else leads to just the first function key item - // to be selected. Thanks to Ryan Wilcox for finding out. - macKey = 0 ; - glyph = kMenuF1Glyph + ( key - WXK_F1 ) ; - if ( key >= WXK_F13 ) - glyph += 12 ; - } - else - { - switch ( key ) - { - case WXK_BACK : - macKey = kBackspaceCharCode ; - glyph = kMenuDeleteLeftGlyph ; - break ; - - case WXK_TAB : - macKey = kTabCharCode ; - glyph = kMenuTabRightGlyph ; - break ; - - case kEnterCharCode : - macKey = kEnterCharCode ; - glyph = kMenuEnterGlyph ; - break ; - - case WXK_RETURN : - macKey = kReturnCharCode ; - glyph = kMenuReturnGlyph ; - break ; - - case WXK_ESCAPE : - macKey = kEscapeCharCode ; - glyph = kMenuEscapeGlyph ; - break ; - - case WXK_SPACE : - macKey = ' ' ; - glyph = kMenuSpaceGlyph ; - break ; - - case WXK_DELETE : - macKey = kDeleteCharCode ; - glyph = kMenuDeleteRightGlyph ; - break ; - - case WXK_CLEAR : - macKey = kClearCharCode ; - glyph = kMenuClearGlyph ; - break ; - - case WXK_PAGEUP : - macKey = kPageUpCharCode ; - glyph = kMenuPageUpGlyph ; - break ; - - case WXK_PAGEDOWN : - macKey = kPageDownCharCode ; - glyph = kMenuPageDownGlyph ; - break ; - - case WXK_LEFT : - macKey = kLeftArrowCharCode ; - glyph = kMenuLeftArrowGlyph ; - break ; - - case WXK_UP : - macKey = kUpArrowCharCode ; - glyph = kMenuUpArrowGlyph ; - break ; - - case WXK_RIGHT : - macKey = kRightArrowCharCode ; - glyph = kMenuRightArrowGlyph ; - break ; - - case WXK_DOWN : - macKey = kDownArrowCharCode ; - glyph = kMenuDownArrowGlyph ; - break ; - - case WXK_HOME : - macKey = kHomeCharCode ; - glyph = kMenuNorthwestArrowGlyph ; - break ; - - case WXK_END : - macKey = kEndCharCode ; - glyph = kMenuSoutheastArrowGlyph ; - break ; - default : - macKey = toupper( key ) ; - break ; - } - - // we now allow non command key shortcuts - // remove in case this gives problems - if ( !explicitCommandKey ) - modifiers |= kMenuNoCommandModifier ; - } - - // 1d and 1e have special meaning to SetItemCmd, so - // do not use for these character codes. - if (key != WXK_UP && key != WXK_RIGHT && key != WXK_DOWN && key != WXK_LEFT) - SetItemCmd( menu, item , macKey ); - - SetMenuItemModifiers( menu, item , modifiers ) ; - - if ( glyph ) - SetMenuItemKeyGlyph( menu, item , glyph ) ; - } -} - -void UMAAppendMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , wxAcceleratorEntry *entry ) -{ - AppendMenuItemTextWithCFString( menu, - CFSTR("A"), 0, 0,NULL); - // don't attempt to interpret metacharacters like a '-' at the beginning (would become a separator otherwise) - ChangeMenuItemAttributes( menu , ::CountMenuItems(menu), kMenuItemAttrIgnoreMeta , 0 ) ; - UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title , encoding ); - UMASetMenuItemShortcut( menu , (SInt16) ::CountMenuItems(menu), entry ) ; -} - -void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry ) -{ - InsertMenuItemTextWithCFString( menu, - CFSTR("A"), item, 0, 0); - - // don't attempt to interpret metacharacters like a '-' at the beginning (would become a separator otherwise) - ChangeMenuItemAttributes( menu , item+1, kMenuItemAttrIgnoreMeta , 0 ) ; - UMASetMenuItemText(menu, item+1 , title , encoding ); - UMASetMenuItemShortcut( menu , item+1 , entry ) ; -} - -static OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex, - bool allowHelpMenuCreation); - -static OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex, - bool allowHelpMenuCreation) -{ - static bool s_createdHelpMenu = false ; - - if ( !s_createdHelpMenu && !allowHelpMenuCreation ) - { - return paramErr ; - } - - OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; - s_createdHelpMenu = ( status == noErr ) ; - return status ; -} - -OSStatus UMAGetHelpMenu( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex) -{ - return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , true ); -} - -OSStatus UMAGetHelpMenuDontCreate( - MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex) -{ - return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , false ); -} - -#endif - -#endif // wxUSE_GUI diff --git a/Externals/wxWidgets3/src/osx/carbon/utils.cpp b/Externals/wxWidgets3/src/osx/carbon/utils.cpp deleted file mode 100644 index 9653ee4191..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/utils.cpp +++ /dev/null @@ -1,1002 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/utils.cpp -// Purpose: Various utilities -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - - -#include "wx/wxprec.h" - -#include "wx/utils.h" - -#ifndef WX_PRECOMP - #include "wx/intl.h" - #include "wx/app.h" - #if wxUSE_GUI - #include "wx/toplevel.h" - #include "wx/font.h" - #endif -#endif - -#include "wx/apptrait.h" - -#include - -#include -#include -#include -#include - -// #include "MoreFilesX.h" - -#include - -#include "wx/osx/private.h" -#if wxUSE_GUI - #include "wx/osx/private/timer.h" -#endif // wxUSE_GUI - -#include "wx/evtloop.h" - -#if wxUSE_GUI - -// Emit a beeeeeep -void wxBell() -{ - if ( AudioServicesPlayAlertSound != NULL ) - AudioServicesPlayAlertSound(kUserPreferredAlert); -} - -wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) -{ - return new wxOSXTimerImpl(timer); -} - -int gs_wxBusyCursorCount = 0; -extern wxCursor gMacCurrentCursor; -wxCursor gMacStoredActiveCursor; - -// Set the cursor to the busy cursor for all windows -void wxBeginBusyCursor(const wxCursor *cursor) -{ - if (gs_wxBusyCursorCount++ == 0) - { - gMacStoredActiveCursor = gMacCurrentCursor; - cursor->MacInstall(); - - wxSetCursor(*cursor); - } - //else: nothing to do, already set -} - -// Restore cursor to normal -void wxEndBusyCursor() -{ - wxCHECK_RET( gs_wxBusyCursorCount > 0, - wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") ); - - if (--gs_wxBusyCursorCount == 0) - { - gMacStoredActiveCursor.MacInstall(); - gMacStoredActiveCursor = wxNullCursor; - - wxSetCursor(wxNullCursor); - } -} - -// true if we're between the above two calls -bool wxIsBusy() -{ - return (gs_wxBusyCursorCount > 0); -} - -#endif // wxUSE_GUI - -#if wxUSE_BASE - -wxString wxMacFindFolderNoSeparator( short vol, - OSType folderType, - Boolean createFolder) -{ - FSRef fsRef; - wxString strDir; - - if ( FSFindFolder( vol, folderType, createFolder, &fsRef) == noErr) - { - strDir = wxMacFSRefToPath( &fsRef ); - } - - return strDir; -} - -wxString wxMacFindFolder( short vol, - OSType folderType, - Boolean createFolder) -{ - return wxMacFindFolderNoSeparator(vol, folderType, createFolder) + wxFILE_SEP_PATH; -} - -#endif // wxUSE_BASE - - -// ============================================================================ -// GUI-only functions from now on -// ============================================================================ - -#if wxUSE_GUI - -// ---------------------------------------------------------------------------- -// Miscellaneous functions -// ---------------------------------------------------------------------------- - -void wxGetMousePosition( int* x, int* y ) -{ - Point pt; - GetGlobalMouse(&pt); - if ( x ) - *x = pt.h; - if ( y ) - *y = pt.v; -}; - -void wxClientDisplayRect(int *x, int *y, int *width, int *height) -{ - HIRect bounds ; - HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal, - &bounds); - if ( x ) - *x = bounds.origin.x; - if ( y ) - *y = bounds.origin.y; - if ( width ) - *width = bounds.size.width; - if ( height ) - *height = bounds.size.height; -} - -#endif // wxUSE_GUI - -#if wxUSE_GUI - -// ---------------------------------------------------------------------------- -// Native Struct Conversions -// ---------------------------------------------------------------------------- - -void wxMacRectToNative( const wxRect *wx , Rect *n ) -{ - n->left = wx->x; - n->top = wx->y; - n->right = wx->x + wx->width; - n->bottom = wx->y + wx->height; -} - -void wxMacNativeToRect( const Rect *n , wxRect* wx ) -{ - wx->x = n->left; - wx->y = n->top; - wx->width = n->right - n->left; - wx->height = n->bottom - n->top; -} - -void wxMacPointToNative( const wxPoint* wx , Point *n ) -{ - n->h = wx->x; - n->v = wx->y; -} - -void wxMacNativeToPoint( const Point *n , wxPoint* wx ) -{ - wx->x = n->h; - wx->y = n->v; -} - -// ---------------------------------------------------------------------------- -// Carbon Event Support -// ---------------------------------------------------------------------------- - -OSStatus wxMacCarbonEvent::GetParameter(EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData) -{ - return ::GetEventParameter( m_eventRef , inName , inDesiredType , NULL , inBufferSize , NULL , outData ); -} - -OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType inType, UInt32 inBufferSize, const void * inData) -{ - return ::SetEventParameter( m_eventRef , inName , inType , inBufferSize , inData ); -} - -// ---------------------------------------------------------------------------- -// Control Access Support -// ---------------------------------------------------------------------------- - - -// ============================================================================ -// DataBrowser Wrapper -// ============================================================================ -// -// basing on DataBrowserItemIDs -// - -IMPLEMENT_ABSTRACT_CLASS( wxMacDataBrowserControl , wxMacControl ) - -pascal void wxMacDataBrowserControl::DataBrowserItemNotificationProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData ) -{ - wxMacDataBrowserControl* ctl = wxDynamicCast(wxMacControl::GetReferenceFromNativeControl( browser ), wxMacDataBrowserControl); - if ( ctl != 0 ) - { - ctl->ItemNotification(itemID, message, itemData); - } -} - -pascal OSStatus wxMacDataBrowserControl::DataBrowserGetSetItemDataProc( - ControlRef browser, - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ) -{ - OSStatus err = errDataBrowserPropertyNotSupported; - wxMacDataBrowserControl* ctl = wxDynamicCast(wxMacControl::GetReferenceFromNativeControl( browser ), wxMacDataBrowserControl); - if ( ctl != 0 ) - { - err = ctl->GetSetItemData(itemID, property, itemData, changeValue); - } - return err; -} - -pascal Boolean wxMacDataBrowserControl::DataBrowserCompareProc( - ControlRef browser, - DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty) -{ - wxMacDataBrowserControl* ctl = wxDynamicCast(wxMacControl::GetReferenceFromNativeControl( browser ), wxMacDataBrowserControl); - if ( ctl != 0 ) - { - return ctl->CompareItems(itemOneID, itemTwoID, sortProperty); - } - return false; -} - -DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL; -DataBrowserItemNotificationUPP gDataBrowserItemNotificationUPP = NULL; -DataBrowserItemCompareUPP gDataBrowserItemCompareUPP = NULL; - -wxMacDataBrowserControl::wxMacDataBrowserControl( wxWindow* peer, - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style)) - : wxMacControl( peer ) -{ - Rect bounds = wxMacGetBoundsForControl( peer, pos, size ); - OSStatus err = ::CreateDataBrowserControl( - MAC_WXHWND(peer->MacGetTopLevelWindowRef()), - &bounds, kDataBrowserListView, &m_controlRef ); - SetReferenceInNativeControl(); - verify_noerr( err ); - if ( gDataBrowserItemCompareUPP == NULL ) - gDataBrowserItemCompareUPP = NewDataBrowserItemCompareUPP(DataBrowserCompareProc); - if ( gDataBrowserItemDataUPP == NULL ) - gDataBrowserItemDataUPP = NewDataBrowserItemDataUPP(DataBrowserGetSetItemDataProc); - if ( gDataBrowserItemNotificationUPP == NULL ) - { - gDataBrowserItemNotificationUPP = - (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc); - } - - DataBrowserCallbacks callbacks; - InitializeDataBrowserCallbacks( &callbacks, kDataBrowserLatestCallbacks ); - - callbacks.u.v1.itemDataCallback = gDataBrowserItemDataUPP; - callbacks.u.v1.itemCompareCallback = gDataBrowserItemCompareUPP; - callbacks.u.v1.itemNotificationCallback = gDataBrowserItemNotificationUPP; - SetCallbacks( &callbacks ); - -} - -OSStatus wxMacDataBrowserControl::GetItemCount( DataBrowserItemID container, - Boolean recurse, - DataBrowserItemState state, - ItemCount *numItems) const -{ - return GetDataBrowserItemCount( m_controlRef, container, recurse, state, numItems ); -} - -OSStatus wxMacDataBrowserControl::GetItems( DataBrowserItemID container, - Boolean recurse, - DataBrowserItemState state, - Handle items) const -{ - return GetDataBrowserItems( m_controlRef, container, recurse, state, items ); -} - -OSStatus wxMacDataBrowserControl::SetSelectionFlags( DataBrowserSelectionFlags options ) -{ - return SetDataBrowserSelectionFlags( m_controlRef, options ); -} - -OSStatus wxMacDataBrowserControl::AddColumn( DataBrowserListViewColumnDesc *columnDesc, - DataBrowserTableViewColumnIndex position ) -{ - return AddDataBrowserListViewColumn( m_controlRef, columnDesc, position ); -} - -OSStatus wxMacDataBrowserControl::GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ) -{ - return GetDataBrowserTableViewColumnProperty( m_controlRef, position, id ); -} - -OSStatus wxMacDataBrowserControl::RemoveColumn( DataBrowserTableViewColumnIndex position ) -{ - DataBrowserTableViewColumnID id; - GetColumnIDFromIndex( position, &id ); - return RemoveDataBrowserTableViewColumn( m_controlRef, id ); -} - -OSStatus wxMacDataBrowserControl::AutoSizeColumns() -{ - return AutoSizeDataBrowserListViewColumns(m_controlRef); -} - -OSStatus wxMacDataBrowserControl::SetHasScrollBars( bool horiz, bool vert ) -{ - return SetDataBrowserHasScrollBars( m_controlRef, horiz, vert ); -} - -OSStatus wxMacDataBrowserControl::SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ) -{ - return SetDataBrowserTableViewHiliteStyle( m_controlRef, hiliteStyle ); -} - -OSStatus wxMacDataBrowserControl::SetHeaderButtonHeight(UInt16 height) -{ - return SetDataBrowserListViewHeaderBtnHeight( m_controlRef, height ); -} - -OSStatus wxMacDataBrowserControl::GetHeaderButtonHeight(UInt16 *height) -{ - return GetDataBrowserListViewHeaderBtnHeight( m_controlRef, height ); -} - -OSStatus wxMacDataBrowserControl::SetCallbacks(const DataBrowserCallbacks *callbacks) -{ - return SetDataBrowserCallbacks( m_controlRef, callbacks ); -} - -OSStatus wxMacDataBrowserControl::UpdateItems( - DataBrowserItemID container, - UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty, - DataBrowserPropertyID propertyID ) const -{ - return UpdateDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty, propertyID ); -} - -bool wxMacDataBrowserControl::IsItemSelected( DataBrowserItemID item ) const -{ - return IsDataBrowserItemSelected( m_controlRef, item ); -} - -OSStatus wxMacDataBrowserControl::AddItems( - DataBrowserItemID container, - UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty ) -{ - return AddDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty ); -} - -OSStatus wxMacDataBrowserControl::RemoveItems( - DataBrowserItemID container, - UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserPropertyID preSortProperty ) -{ - return RemoveDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty ); -} - -OSStatus wxMacDataBrowserControl::RevealItem( - DataBrowserItemID item, - DataBrowserPropertyID propertyID, - DataBrowserRevealOptions options ) const -{ - return RevealDataBrowserItem( m_controlRef, item, propertyID, options ); -} - -OSStatus wxMacDataBrowserControl::SetSelectedItems( - UInt32 numItems, - const DataBrowserItemID *items, - DataBrowserSetOption operation ) -{ - return SetDataBrowserSelectedItems( m_controlRef, numItems, items, operation ); -} - -OSStatus wxMacDataBrowserControl::GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const -{ - return GetDataBrowserSelectionAnchor( m_controlRef, first, last ); -} - -OSStatus wxMacDataBrowserControl::GetItemID( DataBrowserTableViewRowIndex row, DataBrowserItemID * item ) const -{ - return GetDataBrowserTableViewItemID( m_controlRef, row, item ); -} - -OSStatus wxMacDataBrowserControl::GetItemRow( DataBrowserItemID item, DataBrowserTableViewRowIndex * row ) const -{ - return GetDataBrowserTableViewItemRow( m_controlRef, item, row ); -} - -OSStatus wxMacDataBrowserControl::SetDefaultRowHeight( UInt16 height ) -{ - return SetDataBrowserTableViewRowHeight( m_controlRef , height ); -} - -OSStatus wxMacDataBrowserControl::GetDefaultRowHeight( UInt16 * height ) const -{ - return GetDataBrowserTableViewRowHeight( m_controlRef, height ); -} - -OSStatus wxMacDataBrowserControl::SetRowHeight( DataBrowserItemID item , UInt16 height) -{ - return SetDataBrowserTableViewItemRowHeight( m_controlRef, item , height ); -} - -OSStatus wxMacDataBrowserControl::GetRowHeight( DataBrowserItemID item , UInt16 *height) const -{ - return GetDataBrowserTableViewItemRowHeight( m_controlRef, item , height); -} - -OSStatus wxMacDataBrowserControl::GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const -{ - return GetDataBrowserTableViewNamedColumnWidth( m_controlRef , column , width ); -} - -OSStatus wxMacDataBrowserControl::SetColumnWidth( DataBrowserPropertyID column , UInt16 width ) -{ - return SetDataBrowserTableViewNamedColumnWidth( m_controlRef , column , width ); -} - -OSStatus wxMacDataBrowserControl::GetDefaultColumnWidth( UInt16 *width ) const -{ - return GetDataBrowserTableViewColumnWidth( m_controlRef , width ); -} - -OSStatus wxMacDataBrowserControl::SetDefaultColumnWidth( UInt16 width ) -{ - return SetDataBrowserTableViewColumnWidth( m_controlRef , width ); -} - -OSStatus wxMacDataBrowserControl::GetColumnCount(UInt32* numColumns) const -{ - return GetDataBrowserTableViewColumnCount( m_controlRef, numColumns); -} - -OSStatus wxMacDataBrowserControl::GetColumnPosition( DataBrowserPropertyID column, - DataBrowserTableViewColumnIndex *position) const -{ - return GetDataBrowserTableViewColumnPosition( m_controlRef , column , position); -} - -OSStatus wxMacDataBrowserControl::SetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position) -{ - return SetDataBrowserTableViewColumnPosition( m_controlRef , column , position); -} - -OSStatus wxMacDataBrowserControl::GetScrollPosition( UInt32 *top , UInt32 *left ) const -{ - return GetDataBrowserScrollPosition( m_controlRef , top , left ); -} - -OSStatus wxMacDataBrowserControl::SetScrollPosition( UInt32 top , UInt32 left ) -{ - return SetDataBrowserScrollPosition( m_controlRef , top , left ); -} - -OSStatus wxMacDataBrowserControl::GetSortProperty( DataBrowserPropertyID *column ) const -{ - return GetDataBrowserSortProperty( m_controlRef , column ); -} - -OSStatus wxMacDataBrowserControl::SetSortProperty( DataBrowserPropertyID column ) -{ - return SetDataBrowserSortProperty( m_controlRef , column ); -} - -OSStatus wxMacDataBrowserControl::GetSortOrder( DataBrowserSortOrder *order ) const -{ - return GetDataBrowserSortOrder( m_controlRef , order ); -} - -OSStatus wxMacDataBrowserControl::SetSortOrder( DataBrowserSortOrder order ) -{ - return SetDataBrowserSortOrder( m_controlRef , order ); -} - -OSStatus wxMacDataBrowserControl::GetPropertyFlags( DataBrowserPropertyID property, - DataBrowserPropertyFlags *flags ) const -{ - return GetDataBrowserPropertyFlags( m_controlRef , property , flags ); -} - -OSStatus wxMacDataBrowserControl::SetPropertyFlags( DataBrowserPropertyID property, - DataBrowserPropertyFlags flags ) -{ - return SetDataBrowserPropertyFlags( m_controlRef , property , flags ); -} - -OSStatus wxMacDataBrowserControl::GetHeaderDesc( DataBrowserPropertyID property, - DataBrowserListViewHeaderDesc *desc ) const -{ - return GetDataBrowserListViewHeaderDesc( m_controlRef , property , desc ); -} - -OSStatus wxMacDataBrowserControl::SetHeaderDesc( DataBrowserPropertyID property, - DataBrowserListViewHeaderDesc *desc ) -{ - return SetDataBrowserListViewHeaderDesc( m_controlRef , property , desc ); -} - -OSStatus wxMacDataBrowserControl::SetDisclosureColumn( DataBrowserPropertyID property , - Boolean expandableRows ) -{ - return SetDataBrowserListViewDisclosureColumn( m_controlRef, property, expandableRows); -} - -OSStatus wxMacDataBrowserControl::GetItemPartBounds( DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect * bounds ) -{ - return GetDataBrowserItemPartBounds( m_controlRef, item, property, part, bounds); -} - -// ============================================================================ -// Higher-level Databrowser -// ============================================================================ -// -// basing on data item objects -// - -wxMacDataItem::wxMacDataItem() -{ -// m_data = NULL; - - m_order = 0; -// m_colId = kTextColumnId; // for compat with existing wx*ListBox impls. -} - -wxMacDataItem::~wxMacDataItem() -{ -} - -void wxMacDataItem::SetOrder( SInt32 order ) -{ - m_order = order; -} - -SInt32 wxMacDataItem::GetOrder() const -{ - return m_order; -} -/* -void wxMacDataItem::SetData( void* data) -{ - m_data = data; -} - -void* wxMacDataItem::GetData() const -{ - return m_data; -} - -short wxMacDataItem::GetColumn() -{ - return m_colId; -} - -void wxMacDataItem::SetColumn( short col ) -{ - m_colId = col; -} - -void wxMacDataItem::SetLabel( const wxString& str) -{ - m_label = str; - m_cfLabel = wxCFStringRef( str , wxLocale::GetSystemEncoding()); -} - -const wxString& wxMacDataItem::GetLabel() const -{ - return m_label; -} -*/ - -bool wxMacDataItem::IsLessThan(wxMacDataItemBrowserControl *WXUNUSED(owner) , - const wxMacDataItem* rhs, - DataBrowserPropertyID sortProperty) const -{ - bool retval = false; - - if ( sortProperty == kNumericOrderColumnId ) - retval = m_order < rhs->m_order; - - return retval; -} - -OSStatus wxMacDataItem::GetSetData( wxMacDataItemBrowserControl *WXUNUSED(owner) , - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - bool changeValue ) -{ - OSStatus err = errDataBrowserPropertyNotSupported; - if ( !changeValue ) - { - if ( property == kNumericOrderColumnId ) - { - err = ::SetDataBrowserItemDataValue( itemData, m_order ); - err = noErr; - } - } - - return err; -} - -void wxMacDataItem::Notification(wxMacDataItemBrowserControl *WXUNUSED(owner) , - DataBrowserItemNotification WXUNUSED(message), - DataBrowserItemDataRef WXUNUSED(itemData) ) const -{ -} - -IMPLEMENT_DYNAMIC_CLASS( wxMacDataItemBrowserControl , wxMacDataBrowserControl ) - -wxMacDataItemBrowserControl::wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style) : - wxMacDataBrowserControl( peer, pos, size, style ) -{ - m_suppressSelection = false; - m_sortOrder = SortOrder_None; - m_clientDataItemsType = wxClientData_None; -} - -wxMacDataItemBrowserSelectionSuppressor::wxMacDataItemBrowserSelectionSuppressor(wxMacDataItemBrowserControl *browser) -{ - m_former = browser->SuppressSelection(true); - m_browser = browser; -} - -wxMacDataItemBrowserSelectionSuppressor::~wxMacDataItemBrowserSelectionSuppressor() -{ - m_browser->SuppressSelection(m_former); -} - -bool wxMacDataItemBrowserControl::SuppressSelection( bool suppress ) -{ - bool former = m_suppressSelection; - m_suppressSelection = suppress; - - return former; -} - -Boolean wxMacDataItemBrowserControl::CompareItems(DataBrowserItemID itemOneID, - DataBrowserItemID itemTwoID, - DataBrowserPropertyID sortProperty) -{ - wxMacDataItem* itemOne = (wxMacDataItem*) itemOneID; - wxMacDataItem* itemTwo = (wxMacDataItem*) itemTwoID; - - Boolean retval = false; - if ( itemOne != NULL ) - retval = itemOne->IsLessThan( this , itemTwo , sortProperty); - return retval; -} - -OSStatus wxMacDataItemBrowserControl::GetSetItemData( - DataBrowserItemID itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ) -{ - wxMacDataItem* item = (wxMacDataItem*) itemID; - OSStatus err = errDataBrowserPropertyNotSupported; - switch( property ) - { - case kDataBrowserContainerIsClosableProperty : - case kDataBrowserContainerIsSortableProperty : - case kDataBrowserContainerIsOpenableProperty : - // right now default behaviour on these - break; - default : - - if ( item != NULL ){ - err = item->GetSetData( this, property , itemData , changeValue ); - } - break; - - } - return err; -} - -void wxMacDataItemBrowserControl::ItemNotification( - DataBrowserItemID itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData) -{ - wxMacDataItem* item = (wxMacDataItem*) itemID; - if (item != NULL) - item->Notification( this, message, itemData); -} - -unsigned int wxMacDataItemBrowserControl::GetItemCount(const wxMacDataItem* container, - bool recurse , DataBrowserItemState state) const -{ - ItemCount numItems = 0; - verify_noerr( wxMacDataBrowserControl::GetItemCount( (DataBrowserItemID)container, - recurse, state, &numItems ) ); - return numItems; -} - -unsigned int wxMacDataItemBrowserControl::GetSelectedItemCount( const wxMacDataItem* container, - bool recurse ) const -{ - return GetItemCount( container, recurse, kDataBrowserItemIsSelected ); - -} - -void wxMacDataItemBrowserControl::GetItems(const wxMacDataItem* container, - bool recurse , DataBrowserItemState state, wxArrayMacDataItemPtr &items) const -{ - Handle handle = NewHandle(0); - verify_noerr( wxMacDataBrowserControl::GetItems( (DataBrowserItemID)container , - recurse , state, handle) ); - - int itemCount = GetHandleSize(handle)/sizeof(DataBrowserItemID); - HLock( handle ); - wxMacDataItemPtr* itemsArray = (wxMacDataItemPtr*) *handle; - for ( int i = 0; i < itemCount; ++i) - { - items.Add(itemsArray[i]); - } - HUnlock( handle ); - DisposeHandle( handle ); -} - -unsigned int wxMacDataItemBrowserControl::GetLineFromItem(const wxMacDataItem* item) const -{ - DataBrowserTableViewRowIndex row; - OSStatus err = GetItemRow( (DataBrowserItemID) item , &row); - wxCHECK( err == noErr, (unsigned)-1 ); - return row; -} - -wxMacDataItem* wxMacDataItemBrowserControl::GetItemFromLine(unsigned int n) const -{ - DataBrowserItemID id; - OSStatus err = GetItemID( (DataBrowserTableViewRowIndex) n , &id); - wxCHECK( err == noErr, NULL ); - return (wxMacDataItem*) id; -} - -void wxMacDataItemBrowserControl::UpdateItem(const wxMacDataItem *container, - const wxMacDataItem *item , DataBrowserPropertyID property) const -{ - verify_noerr( wxMacDataBrowserControl::UpdateItems((DataBrowserItemID)container, 1, - (DataBrowserItemID*) &item, kDataBrowserItemNoProperty /* notSorted */, property ) ); -} - -void wxMacDataItemBrowserControl::UpdateItems(const wxMacDataItem *container, - wxArrayMacDataItemPtr &itemArray , DataBrowserPropertyID property) const -{ - unsigned int noItems = itemArray.GetCount(); - DataBrowserItemID *items = new DataBrowserItemID[noItems]; - for ( unsigned int i = 0; i < noItems; ++i ) - items[i] = (DataBrowserItemID) itemArray[i]; - - verify_noerr( wxMacDataBrowserControl::UpdateItems((DataBrowserItemID)container, noItems, - items, kDataBrowserItemNoProperty /* notSorted */, property ) ); - delete [] items; -} - -static int column_id_counter = 0; - -void wxMacDataItemBrowserControl::InsertColumn(int col, DataBrowserPropertyType colType, - const wxString& title, SInt16 just, int defaultWidth) -{ - DataBrowserListViewColumnDesc columnDesc; - columnDesc.headerBtnDesc.titleOffset = 0; - columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; - - columnDesc.headerBtnDesc.btnFontStyle.flags = - kControlUseFontMask | kControlUseJustMask; - - columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; - columnDesc.headerBtnDesc.btnFontStyle.just = just; - columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; - columnDesc.headerBtnDesc.btnFontStyle.style = normal; - - // TODO: Why is m_font not defined when we enter wxLC_LIST mode, but is - // defined for other modes? - wxFontEncoding enc; - if ( m_font.IsOk() ) - enc = m_font.GetEncoding(); - else - enc = wxLocale::GetSystemEncoding(); - wxCFStringRef cfTitle( title, enc ); - columnDesc.headerBtnDesc.titleString = cfTitle; - - columnDesc.headerBtnDesc.minimumWidth = 0; - columnDesc.headerBtnDesc.maximumWidth = 30000; - - DataBrowserPropertyID id = kMinColumnId + column_id_counter; - column_id_counter++; - - columnDesc.propertyDesc.propertyID = id; - columnDesc.propertyDesc.propertyType = colType; - columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; - columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; - - verify_noerr( AddColumn( &columnDesc, col ) ); - - if (defaultWidth > 0){ - SetColumnWidth(col, defaultWidth); - } -} - -void wxMacDataItemBrowserControl::SetColumnWidth(int colId, int width) -{ - DataBrowserPropertyID id; - GetColumnIDFromIndex(colId, &id); - verify_noerr( wxMacDataBrowserControl::SetColumnWidth(id, width)); -} - -int wxMacDataItemBrowserControl::GetColumnWidth(int colId) -{ - DataBrowserPropertyID id; - GetColumnIDFromIndex(colId, &id); - UInt16 result; - verify_noerr( wxMacDataBrowserControl::GetColumnWidth(id, &result)); - return result; -} - -void wxMacDataItemBrowserControl::AddItem(wxMacDataItem *container, wxMacDataItem *item) -{ - verify_noerr( wxMacDataBrowserControl::AddItems( (DataBrowserItemID)container, 1, - (DataBrowserItemID*) &item, kDataBrowserItemNoProperty ) ); -} - -void wxMacDataItemBrowserControl::AddItems(wxMacDataItem *container, wxArrayMacDataItemPtr &itemArray ) -{ - unsigned int noItems = itemArray.GetCount(); - DataBrowserItemID *items = new DataBrowserItemID[noItems]; - for ( unsigned int i = 0; i < noItems; ++i ) - items[i] = (DataBrowserItemID) itemArray[i]; - - verify_noerr( wxMacDataBrowserControl::AddItems( (DataBrowserItemID)container, noItems, - (DataBrowserItemID*) items, kDataBrowserItemNoProperty ) ); - delete [] items; -} - -void wxMacDataItemBrowserControl::RemoveItem(wxMacDataItem *container, wxMacDataItem* item) -{ - OSStatus err = wxMacDataBrowserControl::RemoveItems( (DataBrowserItemID)container, 1, - (DataBrowserItemID*) &item, kDataBrowserItemNoProperty ); - verify_noerr( err ); -} - -void wxMacDataItemBrowserControl::RemoveItems(wxMacDataItem *container, wxArrayMacDataItemPtr &itemArray) -{ - unsigned int noItems = itemArray.GetCount(); - DataBrowserItemID *items = new DataBrowserItemID[noItems]; - for ( unsigned int i = 0; i < noItems; ++i ) - items[i] = (DataBrowserItemID) itemArray[i]; - - OSStatus err = wxMacDataBrowserControl::RemoveItems( (DataBrowserItemID)container, noItems, - (DataBrowserItemID*) items, kDataBrowserItemNoProperty ); - verify_noerr( err ); - delete [] items; -} - -void wxMacDataItemBrowserControl::RemoveAllItems(wxMacDataItem *container) -{ - SetScrollPosition(0, 0); - OSStatus err = wxMacDataBrowserControl::RemoveItems( (DataBrowserItemID)container, 0 , NULL , kDataBrowserItemNoProperty ); - verify_noerr( err ); -} - -void wxMacDataItemBrowserControl::SetSelectedItem(wxMacDataItem* item , DataBrowserSetOption option) -{ - verify_noerr(wxMacDataBrowserControl::SetSelectedItems( 1, (DataBrowserItemID*) &item, option )); -} - -void wxMacDataItemBrowserControl::SetSelectedAllItems(DataBrowserSetOption option) -{ - verify_noerr(wxMacDataBrowserControl::SetSelectedItems( 0 , NULL , option )); -} - -void wxMacDataItemBrowserControl::SetSelectedItems(wxArrayMacDataItemPtr &itemArray , DataBrowserSetOption option) -{ - unsigned int noItems = itemArray.GetCount(); - DataBrowserItemID *items = new DataBrowserItemID[noItems]; - for ( unsigned int i = 0; i < noItems; ++i ) - items[i] = (DataBrowserItemID) itemArray[i]; - - verify_noerr(wxMacDataBrowserControl::SetSelectedItems( noItems, (DataBrowserItemID*) items, option )); - delete [] items; -} - -Boolean wxMacDataItemBrowserControl::IsItemSelected( const wxMacDataItem* item) const -{ - return wxMacDataBrowserControl::IsItemSelected( (DataBrowserItemID) item); -} - -void wxMacDataItemBrowserControl::RevealItem( wxMacDataItem* item, DataBrowserRevealOptions options) -{ - verify_noerr(wxMacDataBrowserControl::RevealItem( (DataBrowserItemID) item, kDataBrowserNoItem , options ) ); -} - -void wxMacDataItemBrowserControl::GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const -{ - verify_noerr(wxMacDataBrowserControl::GetSelectionAnchor( (DataBrowserItemID*) first, (DataBrowserItemID*) last) ); -} - -wxClientDataType wxMacDataItemBrowserControl::GetClientDataType() const -{ - return m_clientDataItemsType; -} -void wxMacDataItemBrowserControl::SetClientDataType(wxClientDataType clientDataItemsType) -{ - m_clientDataItemsType = clientDataItemsType; -} - -void wxMacDataItemBrowserControl::MacDelete( unsigned int n ) -{ - wxMacDataItem* item = (wxMacDataItem*)GetItemFromLine( n ); - RemoveItem( wxMacDataBrowserRootContainer, item ); -} - -void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item) -{ - if ( m_sortOrder == SortOrder_None ) - { - - // increase the order of the lines to be shifted - unsigned int lines = MacGetCount(); - for ( unsigned int i = n; i < lines; ++i) - { - wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i); - iter->SetOrder( iter->GetOrder() + 1 ); - } - -#if 0 - // I don't understand what this code is supposed to do, RR. - SInt32 frontLineOrder = 0; - if ( n > 0 ) - { - wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1); - frontLineOrder = iter->GetOrder()+1; - } -#else - item->SetOrder( n ); -#endif - } - - AddItem( wxMacDataBrowserRootContainer, item ); -} - -void wxMacDataItemBrowserControl::MacClear() -{ - wxMacDataItemBrowserSelectionSuppressor suppressor(this); - RemoveAllItems(wxMacDataBrowserRootContainer); -} - -unsigned int wxMacDataItemBrowserControl::MacGetCount() const -{ - return GetItemCount(wxMacDataBrowserRootContainer,false,kDataBrowserItemAnyState); -} - -#endif // wxUSE_GUI - diff --git a/Externals/wxWidgets3/src/osx/carbon/utilscocoa.mm b/Externals/wxWidgets3/src/osx/carbon/utilscocoa.mm index 000f6710a4..34b3003a23 100644 --- a/Externals/wxWidgets3/src/osx/carbon/utilscocoa.mm +++ b/Externals/wxWidgets3/src/osx/carbon/utilscocoa.mm @@ -12,6 +12,7 @@ #ifndef WX_PRECOMP #include "wx/object.h" +#include "wx/math.h" #endif #if wxOSX_USE_COCOA_OR_CARBON @@ -26,21 +27,8 @@ #include "wx/fontutil.h" -#if wxOSX_USE_COCOA -#include "wx/cocoa/string.h" -#endif - #ifdef __WXMAC__ -#if wxOSX_USE_CARBON -bool wxMacInitCocoa() -{ - bool cocoaLoaded = NSApplicationLoad(); - wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa in Carbon Environment")) ; - return cocoaLoaded; -} -#endif - wxMacAutoreleasePool::wxMacAutoreleasePool() { m_pool = [[NSAutoreleasePool alloc] init]; @@ -133,6 +121,7 @@ void wxFont::SetNativeInfoFromNSFont(WX_NSFont theFont, wxNativeFontInfo* info) wxFontStyle fontstyle = wxFONTSTYLE_NORMAL; wxFontWeight fontweight = wxFONTWEIGHT_NORMAL; bool underlined = false; + bool strikethrough = false; int size = (int) ([theFont pointSize]+0.5); @@ -146,8 +135,8 @@ void wxFont::SetNativeInfoFromNSFont(WX_NSFont theFont, wxNativeFontInfo* info) if ( theTraits & NSItalicFontMask ) fontstyle = wxFONTSTYLE_ITALIC ; - info->Init(size,fontFamily,fontstyle,fontweight,underlined, - wxStringWithNSString([theFont familyName]), wxFONTENCODING_DEFAULT); + info->Init(size,fontFamily,fontstyle,fontweight,underlined, strikethrough, + wxCFStringRef::AsString([theFont familyName]), wxFONTENCODING_DEFAULT); } } @@ -191,8 +180,7 @@ WX_NSFont wxFont::OSXCreateNSFont(wxOSXSystemFont font, wxNativeFontInfo* info) return nsfont; } -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -static const NSAffineTransformStruct kSlantNSTransformStruct = { 1, 0, static_cast(tan(DegToRad(11))), 1, 0, 0 }; +static const NSAffineTransformStruct kSlantNSTransformStruct = { 1, 0, static_cast(tan(wxDegToRad(11))), 1, 0, 0 }; WX_NSFont wxFont::OSXCreateNSFont(const wxNativeFontInfo* info) { @@ -314,6 +302,7 @@ WX_UIFont wxFont::OSXCreateUIFont(wxOSXSystemFont font, wxNativeFontInfo* info) wxFontStyle fontstyle = wxFONTSTYLE_NORMAL; wxFontWeight fontweight = wxFONTWEIGHT_NORMAL; bool underlined = false; + bool strikethrough = false; int size = (int) ([uifont pointSize]+0.5); /* @@ -327,8 +316,9 @@ WX_UIFont wxFont::OSXCreateUIFont(wxOSXSystemFont font, wxNativeFontInfo* info) fontstyle = wxFONTSTYLE_ITALIC ; */ wxCFStringRef fontname( wxCFRetain([uifont familyName]) ); - info->Init(size,wxFONTFAMILY_DEFAULT,fontstyle,fontweight,underlined, - fontname.AsString(), wxFONTENCODING_DEFAULT); + info->Init(size, wxFONTFAMILY_DEFAULT, fontstyle, fontweight, + underlined, strikethrough, + fontname.AsString(), wxFONTENCODING_DEFAULT); } return uifont; @@ -400,15 +390,6 @@ double wxOSXGetMainScreenContentScaleFactor() #endif -#if wxOSX_USE_CARBON - -double wxOSXGetMainScreenContentScaleFactor() -{ - return 1.0; -} - -#endif - #if wxOSX_USE_COCOA wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &WXUNUSED(client), const wxSize& WXUNUSED(size)) @@ -418,7 +399,7 @@ wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &WXUNUSED( } // From "Cocoa Drawing Guide:Working with Images" -WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor ) +WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor, bool isTemplate ) { NSRect imageRect = NSMakeRect(0.0, 0.0, 0.0, 0.0); @@ -435,6 +416,8 @@ WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor ) CGContextDrawImage( imageContext, *(CGRect*)&imageRect, image ); [newImage unlockFocus]; + [newImage setTemplate:isTemplate]; + /* // Create a bitmap rep from the image... NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; @@ -447,7 +430,22 @@ WX_NSImage wxOSXGetNSImageFromCGImage( CGImageRef image, double scaleFactor ) return( newImage ); } -CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage) +WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ) +{ + NSImage *newImage = [[NSImage alloc] initWithIconRef:iconref]; + [newImage autorelease]; + return( newImage ); +} + +CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromNSImage( WX_NSImage nsimage, CGRect* r, CGContextRef cg) +{ + NSRect nsRect = NSRectFromCGRect(*r); + return [nsimage CGImageForProposedRect:&nsRect + context:[NSGraphicsContext graphicsContextWithGraphicsPort:cg flipped:YES] + hints:nil]; +} + +CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage nsimage, bool *isTemplate) { // based on http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg18065.html @@ -461,25 +459,24 @@ CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromNSImage( WX_NSImage ns hbitmap = CGBitmapContextCreate(NULL, imageSize.width*scale, imageSize.height*scale, 8, 0, wxMacGetGenericRGBColorSpace(), kCGImageAlphaPremultipliedFirst); CGContextScaleCTM( hbitmap, scale, scale ); + NSGraphicsContext *previousContext = [NSGraphicsContext currentContext]; NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:hbitmap flipped:NO]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:nsGraphicsContext]; [[NSColor whiteColor] setFill]; NSRectFill(NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height)); [nsimage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; - [NSGraphicsContext setCurrentContext:nsGraphicsContext]; + [NSGraphicsContext setCurrentContext:previousContext]; + + if (isTemplate) + *isTemplate = [nsimage isTemplate]; } return hbitmap; } double wxOSXGetMainScreenContentScaleFactor() { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) - if ( [ [NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)] ) - return [[NSScreen mainScreen] backingScaleFactor]; - else -#endif - return 1.0; + return [[NSScreen mainScreen] backingScaleFactor]; } CGImageRef wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage, double *scaleptr ) diff --git a/Externals/wxWidgets3/src/osx/carbon/window.cpp b/Externals/wxWidgets3/src/osx/carbon/window.cpp deleted file mode 100644 index f7085d277f..0000000000 --- a/Externals/wxWidgets3/src/osx/carbon/window.cpp +++ /dev/null @@ -1,1481 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/window.cpp -// Purpose: wxWindowMac -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/window.h" - -#ifndef WX_PRECOMP - #include "wx/log.h" - #include "wx/app.h" - #include "wx/utils.h" - #include "wx/panel.h" - #include "wx/frame.h" - #include "wx/dc.h" - #include "wx/dcclient.h" - #include "wx/button.h" - #include "wx/menu.h" - #include "wx/dialog.h" - #include "wx/settings.h" - #include "wx/msgdlg.h" - #include "wx/scrolbar.h" - #include "wx/statbox.h" - #include "wx/textctrl.h" - #include "wx/toolbar.h" - #include "wx/layout.h" - #include "wx/statusbr.h" - #include "wx/menuitem.h" - #include "wx/treectrl.h" - #include "wx/listctrl.h" -#endif - -#include "wx/tooltip.h" -#include "wx/spinctrl.h" -#include "wx/geometry.h" - -#if wxUSE_LISTCTRL - #include "wx/listctrl.h" -#endif - -#if wxUSE_TREECTRL - #include "wx/treectrl.h" -#endif - -#if wxUSE_CARET - #include "wx/caret.h" -#endif - -#if wxUSE_POPUPWIN - #include "wx/popupwin.h" -#endif - -#if wxUSE_DRAG_AND_DROP -#include "wx/dnd.h" -#endif - -#if wxOSX_USE_CARBON -#include "wx/osx/uma.h" -#else -#include "wx/osx/private.h" -// bring in theming -#include -#endif - -#define MAC_SCROLLBAR_SIZE 15 -#define MAC_SMALL_SCROLLBAR_SIZE 11 - -#include - -#define wxMAC_DEBUG_REDRAW 0 -#ifndef wxMAC_DEBUG_REDRAW -#define wxMAC_DEBUG_REDRAW 0 -#endif - -// Get the window with the focus -WXWidget wxWidgetImpl::FindFocus() -{ - ControlRef control = NULL ; - GetKeyboardFocus( GetUserFocusWindow() , &control ) ; - return control; -} - -// no compositing to take into account under carbon -wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control) -{ - return FindFromWXWidget(control); -} - -// --------------------------------------------------------------------------- -// Carbon Events -// --------------------------------------------------------------------------- - -static const EventTypeSpec eventList[] = -{ - { kEventClassCommand, kEventProcessCommand } , - { kEventClassCommand, kEventCommandUpdateStatus } , - - { kEventClassControl , kEventControlGetClickActivation } , - { kEventClassControl , kEventControlHit } , - - { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , - { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } , - - { kEventClassControl , kEventControlDraw } , - - { kEventClassControl , kEventControlVisibilityChanged } , - { kEventClassControl , kEventControlEnabledStateChanged } , - { kEventClassControl , kEventControlHiliteChanged } , - - { kEventClassControl , kEventControlActivate } , - { kEventClassControl , kEventControlDeactivate } , - - { kEventClassControl , kEventControlSetFocusPart } , - { kEventClassControl , kEventControlFocusPartChanged } , - - { kEventClassService , kEventServiceGetTypes }, - { kEventClassService , kEventServiceCopy }, - { kEventClassService , kEventServicePaste }, - -// { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only -// { kEventClassControl , kEventControlBoundsChanged } , -} ; - -static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - static wxWindowMac* targetFocusWindow = NULL; - static wxWindowMac* formerFocusWindow = NULL; - - wxMacCarbonEvent cEvent( event ) ; - - ControlRef controlRef ; - wxWindowMac* thisWindow = (wxWindowMac*) data ; - - cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; - - switch ( GetEventKind( event ) ) - { - case kEventControlDraw : - { - HIShapeRef updateRgn = NULL ; - HIMutableShapeRef allocatedRgn = NULL ; - wxRegion visRegion = thisWindow->MacGetVisibleRegion() ; - - // according to the docs: redraw entire control if param not present - if ( cEvent.GetParameter(kEventParamShape, &updateRgn) != noErr ) - { - updateRgn = visRegion.GetWXHRGN(); - } - else - { - if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 ) - { - // as this update region is in native window locals we must adapt it to wx window local - allocatedRgn = HIShapeCreateMutableCopy(updateRgn); - HIShapeOffset(allocatedRgn, thisWindow->MacGetLeftBorderSize() , thisWindow->MacGetTopBorderSize()); - // hide the given region by the new region that must be shifted - updateRgn = allocatedRgn ; - } - } - -#if wxMAC_DEBUG_REDRAW - if ( thisWindow->MacIsUserPane() ) - { - static float color = 0.5 ; - static int channel = 0 ; - HIRect bounds; - CGContextRef cgContext = cEvent.GetParameter(kEventParamCGContextRef) ; - - HIViewGetBounds( controlRef, &bounds ); - CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 , - channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 ); - CGContextFillRect( cgContext, bounds ); - color += 0.1 ; - if ( color > 0.9 ) - { - color = 0.5 ; - channel++ ; - if ( channel == 3 ) - channel = 0 ; - } - } -#endif - - { - CGContextRef cgContext = NULL ; - OSStatus err = cEvent.GetParameter(kEventParamCGContextRef, &cgContext) ; - if ( err != noErr ) - { - // for non-composite drawing, since we don't support it ourselves, send it through the - // the default handler - // CallNextEventHandler( handler,event ) ; - // result = noErr ; - if ( allocatedRgn ) - CFRelease( allocatedRgn ) ; - break; - } - - thisWindow->MacSetCGContextRef( cgContext ) ; - - { - wxMacCGContextStateSaver sg( cgContext ) ; - CGFloat alpha = (CGFloat)1.0 ; - { - wxWindow* iter = thisWindow ; - while ( iter ) - { - alpha *= (CGFloat)( iter->GetTransparent()/255.0 ) ; - if ( iter->IsTopLevel() ) - iter = NULL ; - else - iter = iter->GetParent() ; - } - } - CGContextSetAlpha( cgContext, alpha ) ; - - if ( thisWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) - { - HIRect bounds; - HIViewGetBounds( controlRef, &bounds ); - CGContextClearRect( cgContext, bounds ); - } - - if ( !HIShapeIsEmpty(updateRgn) ) - { - // refcount increase because wxRegion constructor takes ownership of the native region - CFRetain(updateRgn); - thisWindow->GetUpdateRegion() = wxRegion(updateRgn); - if ( !thisWindow->MacDoRedraw( cEvent.GetTicks() ) ) - { - // for native controls: call their native paint method - if ( !thisWindow->MacIsUserPane() || - ( thisWindow->IsTopLevel() && thisWindow->GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) ) - { - if ( thisWindow->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) - { - CallNextEventHandler( handler,event ) ; - result = noErr ; - } - } - } - else - { - result = noErr ; - } - thisWindow->MacPaintChildrenBorders(); - } - thisWindow->MacSetCGContextRef( NULL ) ; - } - } - - if ( allocatedRgn ) - CFRelease( allocatedRgn ) ; - } - break ; - - case kEventControlVisibilityChanged : - // we might have two native controls attributed to the same wxWindow instance - // eg a scrollview and an embedded textview, make sure we only fire for the 'outer' - // control, as otherwise native and wx visibility are different - if ( thisWindow->GetPeer() != NULL && thisWindow->GetPeer()->GetControlRef() == controlRef ) - { - thisWindow->MacVisibilityChanged() ; - } - break ; - - case kEventControlEnabledStateChanged : - thisWindow->MacEnabledStateChanged(); - break ; - - case kEventControlHiliteChanged : - thisWindow->MacHiliteChanged() ; - break ; - - case kEventControlActivate : - case kEventControlDeactivate : - // FIXME: we should have a virtual function for this! -#if wxUSE_TREECTRL - if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) ) - thisWindow->Refresh(); -#endif -#if wxUSE_LISTCTRL - if ( thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) ) - thisWindow->Refresh(); -#endif - break ; - - // - // focus handling - // different handling on OS X - // - - case kEventControlFocusPartChanged : - // the event is emulated by wxmac for systems lower than 10.5 - { - ControlPartCode previousControlPart = cEvent.GetParameter(kEventParamControlPreviousPart , typeControlPartCode ); - ControlPartCode currentControlPart = cEvent.GetParameter(kEventParamControlCurrentPart , typeControlPartCode ); - - if ( thisWindow->MacGetTopLevelWindow() && thisWindow->GetPeer()->NeedsFocusRect() ) - { - thisWindow->MacInvalidateBorders(); - } - - if ( currentControlPart == 0 ) - { - // kill focus -#if wxUSE_CARET - if ( thisWindow->GetCaret() ) - thisWindow->GetCaret()->OnKillFocus(); -#endif - - wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast(thisWindow)); - - // remove this as soon as posting the synthesized event works properly - static bool inKillFocusEvent = false ; - - if ( !inKillFocusEvent ) - { - inKillFocusEvent = true ; - wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId()); - event.SetEventObject(thisWindow); - event.SetWindow(targetFocusWindow); - thisWindow->HandleWindowEvent(event) ; - inKillFocusEvent = false ; - targetFocusWindow = NULL; - } - } - else if ( previousControlPart == 0 ) - { - // set focus - // panel wants to track the window which was the last to have focus in it - wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast(thisWindow)); - wxChildFocusEvent eventFocus((wxWindow*)thisWindow); - thisWindow->HandleWindowEvent(eventFocus); - -#if wxUSE_CARET - if ( thisWindow->GetCaret() ) - thisWindow->GetCaret()->OnSetFocus(); -#endif - - wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId()); - event.SetEventObject(thisWindow); - event.SetWindow(formerFocusWindow); - thisWindow->HandleWindowEvent(event) ; - formerFocusWindow = NULL; - } - } - break; - case kEventControlSetFocusPart : - { - Boolean focusEverything = false ; - if ( cEvent.GetParameter(kEventParamControlFocusEverything , &focusEverything ) == noErr ) - { - // put a breakpoint here to catch focus everything events - } - ControlPartCode controlPart = cEvent.GetParameter(kEventParamControlPart , typeControlPartCode ); - if ( controlPart != kControlFocusNoPart ) - { - targetFocusWindow = thisWindow; - wxLogTrace(wxT("Focus"), wxT("focus to be set(%p)"), static_cast(thisWindow)); - } - else - { - formerFocusWindow = thisWindow; - wxLogTrace(wxT("Focus"), wxT("focus to be lost(%p)"), static_cast(thisWindow)); - } - - ControlPartCode previousControlPart = 0; - verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart)); - - if ( thisWindow->MacIsUserPane() ) - { - if ( controlPart != kControlFocusNoPart ) - cEvent.SetParameter( kEventParamControlPart, typeControlPartCode, 1 ) ; - result = noErr ; - } - else - result = CallNextEventHandler(handler, event); - } - break ; - - case kEventControlHit : - result = thisWindow->MacControlHit( handler , event ) ; - break ; - - case kEventControlGetClickActivation : - { - // fix to always have a proper activation for DataBrowser controls (stay in bkgnd otherwise) - WindowRef owner = cEvent.GetParameter(kEventParamWindowRef); - if ( !IsWindowActive(owner) ) - { - cEvent.SetParameter(kEventParamClickActivation,typeClickActivationResult, (UInt32) kActivateAndIgnoreClick) ; - result = noErr ; - } - } - break ; - - default : - break ; - } - - return result ; -} - -static pascal OSStatus -wxMacWindowServiceEventHandler(EventHandlerCallRef WXUNUSED(handler), - EventRef event, - void *data) -{ - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - ControlRef controlRef ; - wxWindowMac* thisWindow = (wxWindowMac*) data ; - wxTextCtrl* textCtrl = wxDynamicCast( thisWindow , wxTextCtrl ) ; - cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; - - switch ( GetEventKind( event ) ) - { - case kEventServiceGetTypes : - if ( textCtrl ) - { - long from, to ; - textCtrl->GetSelection( &from , &to ) ; - - CFMutableArrayRef copyTypes = 0 , pasteTypes = 0; - if ( from != to ) - copyTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServiceCopyTypes , typeCFMutableArrayRef ) ; - if ( textCtrl->IsEditable() ) - pasteTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServicePasteTypes , typeCFMutableArrayRef ) ; - - static const OSType textDataTypes[] = { kTXNTextData /* , 'utxt', 'PICT', 'MooV', 'AIFF' */ }; - for ( size_t i = 0 ; i < WXSIZEOF(textDataTypes) ; ++i ) - { - CFStringRef typestring = CreateTypeStringWithOSType(textDataTypes[i]); - if ( typestring ) - { - if ( copyTypes ) - CFArrayAppendValue(copyTypes, typestring) ; - if ( pasteTypes ) - CFArrayAppendValue(pasteTypes, typestring) ; - - CFRelease( typestring ) ; - } - } - - result = noErr ; - } - break ; - - case kEventServiceCopy : - if ( textCtrl ) - { - long from, to ; - - textCtrl->GetSelection( &from , &to ) ; - wxString val = textCtrl->GetValue() ; - val = val.Mid( from , to - from ) ; - PasteboardRef pasteboard = cEvent.GetParameter( kEventParamPasteboardRef, typePasteboardRef ); - verify_noerr( PasteboardClear( pasteboard ) ) ; - PasteboardSynchronize( pasteboard ); - // TODO add proper conversion - CFDataRef data = CFDataCreate( kCFAllocatorDefault, (const UInt8*)val.c_str(), val.length() ); - PasteboardPutItemFlavor( pasteboard, (PasteboardItemID) 1, CFSTR("com.apple.traditional-mac-plain-text"), data, 0); - CFRelease( data ); - result = noErr ; - } - break ; - - case kEventServicePaste : - if ( textCtrl ) - { - PasteboardRef pasteboard = cEvent.GetParameter( kEventParamPasteboardRef, typePasteboardRef ); - PasteboardSynchronize( pasteboard ); - ItemCount itemCount; - verify_noerr( PasteboardGetItemCount( pasteboard, &itemCount ) ); - for( UInt32 itemIndex = 1; itemIndex <= itemCount; itemIndex++ ) - { - PasteboardItemID itemID; - if ( PasteboardGetItemIdentifier( pasteboard, itemIndex, &itemID ) == noErr ) - { - CFDataRef flavorData = NULL; - if ( PasteboardCopyItemFlavorData( pasteboard, itemID, CFSTR("com.apple.traditional-mac-plain-text"), &flavorData ) == noErr ) - { - CFIndex flavorDataSize = CFDataGetLength( flavorData ); - char *content = new char[flavorDataSize+1] ; - memcpy( content, CFDataGetBytePtr( flavorData ), flavorDataSize ); - content[flavorDataSize]=0; - CFRelease( flavorData ); -#if wxUSE_UNICODE - textCtrl->WriteText( wxString( content , wxConvLocal ) ); -#else - textCtrl->WriteText( wxString( content ) ) ; -#endif - - delete[] content ; - result = noErr ; - } - } - } - } - break ; - - default: - break ; - } - - return result ; -} - -WXDLLEXPORT pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - wxWindowMac* focus = (wxWindowMac*) data ; - - wchar_t* uniChars = NULL ; - UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - - UniChar* charBuf = NULL; - ByteCount dataSize = 0 ; - int numChars = 0 ; - UniChar buf[2] ; - if ( GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr ) - { - numChars = dataSize / sizeof( UniChar) + 1; - charBuf = buf ; - - if ( (size_t) numChars * 2 > sizeof(buf) ) - charBuf = new UniChar[ numChars ] ; - else - charBuf = buf ; - - uniChars = new wchar_t[ numChars ] ; - GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ; - charBuf[ numChars - 1 ] = 0; - // the resulting string will never have more chars than the utf16 version, so this is safe - wxMBConvUTF16 converter ; - numChars = converter.MB2WC( uniChars , (const char*)charBuf , numChars ) ; - } - - switch ( GetEventKind( event ) ) - { - case kEventTextInputUpdateActiveInputArea : - { - // An IME input event may return several characters, but we need to send one char at a time to - // EVT_CHAR - for (int pos=0 ; pos < numChars ; pos++) - { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; - WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; - wxTheApp->MacSetCurrentEvent( event , handler ) ; - - UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?'; -/* - NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent - multiple times to update the active range during inline input, so this handler will often receive - uncommited text, which should usually not trigger side effects. It might be a good idea to check the - kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h). - On the other hand, it can be useful for some applications to react to uncommitted text (for example, - to update a status display), as long as it does not disrupt the inline input session. Ideally, wx - should add new event types to support advanced text input. For now, I would keep things as they are. - - However, the code that was being used caused additional problems: - UInt32 message = (0 << 8) + ((char)uniChars[pos] ); - Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline - input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji - for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB - (still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D - (the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress. - Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only - overlap with Unicode within the (7-bit) ASCII range. - But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks - for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII - characters as they are and replaces the rest with '?', ensuring that update events are triggered. - It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but - I don't have time to look into that right now. - -- CL -*/ - if ( wxTheApp->MacSendCharEvent( focus , message , 0 , when , uniChars[pos] ) ) - { - result = noErr ; - } - - wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; - } - } - break ; - case kEventTextInputUnicodeForKeyEvent : - { - UInt32 keyCode, modifiers ; - EventRef rawEvent ; - unsigned char charCode ; - - GetEventParameter( event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent ) ; - GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode ); - GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); - GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - - UInt32 message = (keyCode << 8) + charCode; - - // An IME input event may return several characters, but we need to send one char at a time to - // EVT_CHAR - for (int pos=0 ; pos < numChars ; pos++) - { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; - WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; - wxTheApp->MacSetCurrentEvent( event , handler ) ; - - if ( wxTheApp->MacSendCharEvent( focus , message , modifiers , when , uniChars[pos] ) ) - { - result = noErr ; - } - - wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; - } - } - break; - default: - break ; - } - - delete [] uniChars ; - if ( charBuf != buf ) - delete [] charBuf ; - - return result ; -} - -static pascal OSStatus -wxMacWindowCommandEventHandler(EventHandlerCallRef WXUNUSED(handler), - EventRef event, - void *data) -{ - OSStatus result = eventNotHandledErr ; - wxWindowMac* focus = (wxWindowMac*) data ; - - HICommand command ; - - wxMacCarbonEvent cEvent( event ) ; - cEvent.GetParameter(kEventParamDirectObject,typeHICommand,&command) ; - - wxMenuItem* item = NULL ; - wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ; - - if ( item ) - { - wxASSERT( itemMenu != NULL ) ; - - switch ( cEvent.GetKind() ) - { - case kEventProcessCommand : - if ( itemMenu->HandleCommandProcess( item, focus ) ) - result = noErr; - break ; - - case kEventCommandUpdateStatus: - if ( itemMenu->HandleCommandUpdateStatus( item, focus ) ) - result = noErr; - break ; - - default : - break ; - } - } - return result ; -} - -pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - EventRef formerEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ; - EventHandlerCallRef formerEventHandlerCallRef = (EventHandlerCallRef) wxTheApp->MacGetCurrentEventHandlerCallRef() ; - wxTheApp->MacSetCurrentEvent( event , handler ) ; - OSStatus result = eventNotHandledErr ; - - switch ( GetEventClass( event ) ) - { - case kEventClassCommand : - result = wxMacWindowCommandEventHandler( handler , event , data ) ; - break ; - - case kEventClassControl : - result = wxMacWindowControlEventHandler( handler, event, data ) ; - break ; - - case kEventClassService : - result = wxMacWindowServiceEventHandler( handler, event , data ) ; - break ; - - case kEventClassTextInput : - result = wxMacUnicodeTextEventHandler( handler , event , data ) ; - break ; - - default : - break ; - } - - wxTheApp->MacSetCurrentEvent( formerEvent, formerEventHandlerCallRef ) ; - - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacWindowEventHandler ) - -// --------------------------------------------------------------------------- -// Scrollbar Tracking for all -// --------------------------------------------------------------------------- - -pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode ) ; -pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode partCode ) -{ - if ( partCode != 0) - { - wxWindow* wx = wxFindWindowFromWXWidget( (WXWidget) control ) ; - if ( wx ) - { - wxEventType scrollEvent = wxEVT_NULL; - switch ( partCode ) - { - case kControlUpButtonPart: - scrollEvent = wxEVT_SCROLL_LINEUP; - break; - - case kControlDownButtonPart: - scrollEvent = wxEVT_SCROLL_LINEDOWN; - break; - - case kControlPageUpPart: - scrollEvent = wxEVT_SCROLL_PAGEUP; - break; - - case kControlPageDownPart: - scrollEvent = wxEVT_SCROLL_PAGEDOWN; - break; - - case kControlIndicatorPart: - scrollEvent = wxEVT_SCROLL_THUMBTRACK; - // when this is called as a live proc, mouse is always still down - // so no need for thumbrelease - // scrollEvent = wxEVT_SCROLL_THUMBRELEASE; - break; - } - wx->TriggerScrollEvent(scrollEvent) ; - } - } -} -wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ; - -wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, - wxWindowMac* WXUNUSED(parent), - wxWindowID WXUNUSED(id), - const wxPoint& pos, - const wxSize& size, - long WXUNUSED(style), - long WXUNUSED(extraStyle)) -{ - OSStatus err = noErr; - Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* c = new wxMacControl(wxpeer, false, true) ; - UInt32 features = 0 - | kControlSupportsEmbedding - | kControlSupportsLiveFeedback - | kControlGetsFocusOnClick -// | kControlHasSpecialBackground -// | kControlSupportsCalcBestRect - | kControlHandlesTracking - | kControlSupportsFocus - | kControlWantsActivate - | kControlWantsIdle ; - - err =::CreateUserPaneControl( MAC_WXHWND(wxpeer->GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , c->GetControlRefAddr() ); - verify_noerr( err ); - return c; -} - - -void wxMacControl::InstallEventHandler( WXWidget control ) -{ - wxWidgetImpl::Associate( control ? control : (WXWidget) m_controlRef , this ) ; - ::InstallControlEventHandler( control ? (ControlRef) control : m_controlRef , GetwxMacWindowEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, GetWXPeer(), NULL); -} - -IMPLEMENT_DYNAMIC_CLASS( wxMacControl , wxWidgetImpl ) - -wxMacControl::wxMacControl() -{ - Init(); -} - -wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl, bool isUserPane ) : - wxWidgetImpl( peer, isRootControl, isUserPane ) -{ - Init(); -} - -wxMacControl::~wxMacControl() -{ - if ( m_controlRef && !IsRootControl() ) - { - wxASSERT_MSG( m_controlRef != NULL , wxT("Control Handle already NULL, Dispose called twice ?") ); - wxASSERT_MSG( IsValidControlHandle(m_controlRef) , wxT("Invalid Control Handle (maybe already released) in Dispose") ); - - wxWidgetImpl::RemoveAssociations( this ) ; - // we cannot check the ref count here anymore, as autorelease objects might delete their refs later - // we can have situations when being embedded, where the control gets deleted behind our back, so only - // CFRelease if we are safe - if ( IsValidControlHandle(m_controlRef) ) - CFRelease(m_controlRef); - } - m_controlRef = NULL; -} - -void wxMacControl::Init() -{ - m_controlRef = NULL; - m_macControlEventHandler = NULL; -} - -void wxMacControl::RemoveFromParent() -{ - // nothing to do here for carbon - HIViewRemoveFromSuperview(m_controlRef); -} - -void wxMacControl::Embed( wxWidgetImpl *parent ) -{ - HIViewAddSubview((ControlRef)parent->GetWXWidget(), m_controlRef); -} - -void wxMacControl::SetNeedsDisplay( const wxRect* rect ) -{ - if ( !IsVisible() ) - return; - - if ( rect != NULL ) - { - HIRect updatearea = CGRectMake( rect->x , rect->y , rect->width , rect->height); - HIViewSetNeedsDisplayInRect( m_controlRef, &updatearea, true ); - } - else - HIViewSetNeedsDisplay( m_controlRef , true ); -} - -void wxMacControl::Raise() -{ - verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderAbove, NULL ) ); -} - -void wxMacControl::Lower() -{ - verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderBelow, NULL ) ); -} - -void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const -{ - HIShapeRef rgn = NULL; - Rect content ; - - if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr) - { - CGRect cgrect; - HIShapeGetBounds(rgn, &cgrect); - content = (Rect){ (short)cgrect.origin.y, - (short)cgrect.origin.x, - (short)(cgrect.origin.y+cgrect.size.height), - (short)(cgrect.origin.x+cgrect.size.width) }; - CFRelease(rgn); - } - else - { - GetControlBounds(m_controlRef, &content); - content.right -= content.left; - content.left = 0; - content.bottom -= content.top; - content.top = 0; - } - - left = content.left; - top = content.top; - - width = content.right - content.left ; - height = content.bottom - content.top ; -} - -void wxMacControl::Move(int x, int y, int width, int height) -{ - UInt32 attr = 0 ; - GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ; - - HIRect hir = CGRectMake(x,y,width,height); - if ( !(attr & kWindowCompositingAttribute) ) - { - HIRect parent; - HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent ); - hir.origin.x += parent.origin.x; - hir.origin.y += parent.origin.y; - } - HIViewSetFrame ( m_controlRef , &hir ); -} - -void wxMacControl::GetPosition( int &x, int &y ) const -{ - Rect r; - GetControlBounds( m_controlRef , &r ); - x = r.left; - y = r.top; - - UInt32 attr = 0 ; - GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ; - - if ( !(attr & kWindowCompositingAttribute) ) - { - HIRect parent; - HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent ); - x -= (int)parent.origin.x; - y -= (int)parent.origin.y; - } - -} - -void wxMacControl::GetSize( int &width, int &height ) const -{ - Rect r; - GetControlBounds( m_controlRef , &r ); - width = r.right - r.left; - height = r.bottom - r.top; -} - -void wxMacControl::SetControlSize( wxWindowVariant variant ) -{ - ControlSize size ; - switch ( variant ) - { - case wxWINDOW_VARIANT_NORMAL : - size = kControlSizeNormal; - break ; - - case wxWINDOW_VARIANT_SMALL : - size = kControlSizeSmall; - break ; - - case wxWINDOW_VARIANT_MINI : - // not always defined in the headers - size = 3 ; - break ; - - case wxWINDOW_VARIANT_LARGE : - size = kControlSizeLarge; - break ; - - default: - wxFAIL_MSG(wxT("unexpected window variant")); - break ; - } - - SetData(kControlEntireControl, kControlSizeTag, &size ) ; -} - -void wxMacControl::ScrollRect( const wxRect *rect, int dx, int dy ) -{ - if (GetNeedsDisplay() ) - { - // because HIViewScrollRect does not scroll the already invalidated area we have two options: - // in case there is already a pending redraw on that area - // either immediate redraw or full invalidate -#if 1 - // is the better overall solution, as it does not slow down scrolling - SetNeedsDisplay() ; -#else - // this would be the preferred version for fast drawing controls - HIViewRender(GetControlRef()) ; -#endif - } - - // note there currently is a bug in OSX (10.3 +?) which makes inefficient refreshes in case an entire control - // area is scrolled, this does not occur if width and height are 2 pixels less, - // TODO: write optimal workaround - - HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height); - HIViewScrollRect ( m_controlRef , &scrollarea , dx ,dy ); - -#if 0 - // this would be the preferred version for fast drawing controls - HIViewRender(GetControlRef()) ; -#endif -} - -bool wxMacControl::CanFocus() const -{ - // TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so - // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning, - // but the value range is nowhere documented - Boolean keyExistsAndHasValidFormat ; - CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue( CFSTR("AppleKeyboardUIMode" ) , - kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat ); - - if ( keyExistsAndHasValidFormat && fullKeyboardAccess > 0 ) - { - return true ; - } - else - { - UInt32 features = 0 ; - GetControlFeatures( m_controlRef, &features ) ; - - return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ; - } -} - -bool wxMacControl::GetNeedsDisplay() const -{ - return HIViewGetNeedsDisplay( m_controlRef ); -} - -void wxWidgetImpl::Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ) -{ - HIPoint hiPoint; - - hiPoint.x = pt->x; - hiPoint.y = pt->y; - HIViewConvertPoint( &hiPoint , (ControlRef) from->GetWXWidget() , (ControlRef) to->GetWXWidget() ); - pt->x = (int)hiPoint.x; - pt->y = (int)hiPoint.y; -} - -bool wxMacControl::SetFocus() -{ - // as we cannot rely on the control features to find out whether we are in full keyboard mode, - // we can only leave in case of an error - - OSStatus err = SetKeyboardFocus( GetControlOwner( m_controlRef ), m_controlRef, kControlFocusNextPart ); - if ( err == errCouldntSetFocus ) - return false ; - SetUserFocusWindow(GetControlOwner( m_controlRef ) ); - - return true; -} - -bool wxMacControl::HasFocus() const -{ - ControlRef control; - GetKeyboardFocus( GetUserFocusWindow() , &control ); - return control == m_controlRef; -} - -void wxMacControl::SetCursor(const wxCursor& cursor) -{ - wxWindowMac *mouseWin = 0 ; - WindowRef window = GetControlOwner( m_controlRef ) ; - - wxNonOwnedWindow* tlwwx = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) window ) ; - if ( tlwwx != NULL ) - { - ControlPartCode part ; - ControlRef control ; - Point pt ; - HIPoint hiPoint ; - HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint); - pt.h = hiPoint.x; - pt.v = hiPoint.y; - control = FindControlUnderMouse( pt , window , &part ) ; - if ( control ) - mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ; - } - - if ( mouseWin == tlwwx && !wxIsBusy() ) - cursor.MacInstall() ; -} - -void wxMacControl::CaptureMouse() -{ -} - -void wxMacControl::ReleaseMouse() -{ -} - -// -// subclass specifics -// - -OSStatus wxMacControl::GetData(ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const -{ - return ::GetControlData( m_controlRef , inPartCode , inTag , inBufferSize , inOutBuffer , outActualSize ); -} - -OSStatus wxMacControl::GetDataSize(ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const -{ - return ::GetControlDataSize( m_controlRef , inPartCode , inTag , outActualSize ); -} - -OSStatus wxMacControl::SetData(ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData) -{ - return ::SetControlData( m_controlRef , inPartCode , inTag , inSize , inData ); -} - -OSStatus wxMacControl::SendEvent( EventRef event , OptionBits inOptions ) -{ - return SendEventToEventTargetWithOptions( event, - HIObjectGetEventTarget( (HIObjectRef) m_controlRef ), inOptions ); -} - -OSStatus wxMacControl::SendHICommand( HICommand &command , OptionBits inOptions ) -{ - wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ); - - event.SetParameter(kEventParamDirectObject,command); - - return SendEvent( event , inOptions ); -} - -OSStatus wxMacControl::SendHICommand( UInt32 commandID , OptionBits inOptions ) -{ - HICommand command; - - memset( &command, 0 , sizeof(command) ); - command.commandID = commandID; - return SendHICommand( command , inOptions ); -} - -void wxMacControl::PerformClick() -{ - HIViewSimulateClick (m_controlRef, kControlButtonPart, 0, NULL ); -} - -wxInt32 wxMacControl::GetValue() const -{ - return ::GetControl32BitValue( m_controlRef ); -} - -wxInt32 wxMacControl::GetMaximum() const -{ - return ::GetControl32BitMaximum( m_controlRef ); -} - -wxInt32 wxMacControl::GetMinimum() const -{ - return ::GetControl32BitMinimum( m_controlRef ); -} - -void wxMacControl::SetValue( wxInt32 v ) -{ - ::SetControl32BitValue( m_controlRef , v ); -} - -void wxMacControl::SetMinimum( wxInt32 v ) -{ - ::SetControl32BitMinimum( m_controlRef , v ); -} - -void wxMacControl::SetMaximum( wxInt32 v ) -{ - ::SetControl32BitMaximum( m_controlRef , v ); -} - -void wxMacControl::SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ) -{ - ::SetControl32BitMinimum( m_controlRef , minimum ); - ::SetControl32BitMaximum( m_controlRef , maximum ); - ::SetControl32BitValue( m_controlRef , value ); -} - -void wxMacControl::VisibilityChanged(bool WXUNUSED(shown)) -{ -} - -void wxMacControl::SuperChangedPosition() -{ -} - -void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack ) -{ - m_font = font; - HIViewPartCode part = 0; - HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault; - if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL ) - flush = kHIThemeTextHorizontalFlushCenter; - else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) - flush = kHIThemeTextHorizontalFlushRight; - HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() ); - HIViewSetTextHorizontalFlush( m_controlRef, part, flush ); - - if ( foreground != *wxBLACK || ignoreBlack == false ) - { - ControlFontStyleRec fontStyle; - foreground.GetRGBColor( &fontStyle.foreColor ); - fontStyle.flags = kControlUseForeColorMask; - ::SetControlFontStyle( m_controlRef , &fontStyle ); - } -#if wxOSX_USE_ATSU_TEXT - ControlFontStyleRec fontStyle; - if ( font.MacGetThemeFontID() != kThemeCurrentPortFont ) - { - switch ( font.MacGetThemeFontID() ) - { - case kThemeSmallSystemFont : - fontStyle.font = kControlFontSmallSystemFont; - break; - - case 109 : // mini font - fontStyle.font = -5; - break; - - case kThemeSystemFont : - fontStyle.font = kControlFontBigSystemFont; - break; - - default : - fontStyle.font = kControlFontBigSystemFont; - break; - } - - fontStyle.flags = kControlUseFontMask; - } - else - { - fontStyle.font = font.MacGetFontNum(); - fontStyle.style = font.MacGetFontStyle(); - fontStyle.size = font.GetPointSize(); - fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask; - } - - fontStyle.just = teJustLeft; - fontStyle.flags |= kControlUseJustMask; - if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL ) - fontStyle.just = teJustCenter; - else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) - fontStyle.just = teJustRight; - - - // we only should do this in case of a non-standard color, as otherwise 'disabled' controls - // won't get grayed out by the system anymore - - if ( foreground != *wxBLACK || ignoreBlack == false ) - { - foreground.GetRGBColor( &fontStyle.foreColor ); - fontStyle.flags |= kControlUseForeColorMask; - } - - ::SetControlFontStyle( m_controlRef , &fontStyle ); -#endif -} - -void wxMacControl::SetBackgroundColour( const wxColour &WXUNUSED(col) ) -{ -// HITextViewSetBackgroundColor( m_textView , color ); -} - -bool wxMacControl::SetBackgroundStyle(wxBackgroundStyle style) -{ - if ( style != wxBG_STYLE_PAINT ) - { - OSStatus err = HIViewChangeFeatures(m_controlRef , 0 , kHIViewIsOpaque); - verify_noerr( err ); - } - else - { - OSStatus err = HIViewChangeFeatures(m_controlRef , kHIViewIsOpaque , 0); - verify_noerr( err ); - } - - return true ; -} - -void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum ) -{ - ::SetControl32BitMinimum( m_controlRef , minimum ); - ::SetControl32BitMaximum( m_controlRef , maximum ); -} - -short wxMacControl::HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ) -{ - return HandleControlKey( m_controlRef , keyCode , charCode , modifiers ); -} - -void wxMacControl::SetActionProc( ControlActionUPP actionProc ) -{ - SetControlAction( m_controlRef , actionProc ); -} - -SInt32 wxMacControl::GetViewSize() const -{ - return GetControlViewSize( m_controlRef ); -} - -bool wxMacControl::IsVisible() const -{ - return IsControlVisible( m_controlRef ); -} - -void wxMacControl::SetVisibility( bool visible ) -{ - SetControlVisibility( m_controlRef , visible, true ); -} - -bool wxMacControl::IsEnabled() const -{ - return IsControlEnabled( m_controlRef ); -} - -bool wxMacControl::IsActive() const -{ - return IsControlActive( m_controlRef ); -} - -void wxMacControl::Enable( bool enable ) -{ - if ( enable ) - EnableControl( m_controlRef ); - else - DisableControl( m_controlRef ); -} - -void wxMacControl::SetDrawingEnabled( bool enable ) -{ - if ( enable ) - { - HIViewSetDrawingEnabled( m_controlRef , true ); - HIViewSetNeedsDisplay( m_controlRef, true); - } - else - { - HIViewSetDrawingEnabled( m_controlRef , false ); - } -} - -void wxMacControl::GetRectInWindowCoords( Rect *r ) -{ - GetControlBounds( m_controlRef , r ) ; - - WindowRef tlwref = GetControlOwner( m_controlRef ) ; - - wxNonOwnedWindow* tlwwx = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) tlwref ) ; - if ( tlwwx != NULL ) - { - ControlRef rootControl = tlwwx->GetPeer()->GetControlRef() ; - HIPoint hiPoint = CGPointMake( 0 , 0 ) ; - HIViewConvertPoint( &hiPoint , HIViewGetSuperview(m_controlRef) , rootControl ) ; - OffsetRect( r , (short) hiPoint.x , (short) hiPoint.y ) ; - } -} - -void wxMacControl::GetBestRect( wxRect *rect ) const -{ - short baselineoffset; - Rect r = {0,0,0,0}; - - GetBestControlRect( m_controlRef , &r , &baselineoffset ); - *rect = wxRect( r.left, r.top, r.right - r.left, r.bottom-r.top ); -} - -void wxMacControl::GetBestRect( Rect *r ) const -{ - short baselineoffset; - GetBestControlRect( m_controlRef , r , &baselineoffset ); -} - -void wxMacControl::SetLabel( const wxString &title , wxFontEncoding encoding) -{ - SetControlTitleWithCFString( m_controlRef , wxCFStringRef( title , encoding ) ); -} - -void wxMacControl::GetFeatures( UInt32 * features ) -{ - GetControlFeatures( m_controlRef , features ); -} - -void wxMacControl::PulseGauge() -{ -} - -// SetNeedsDisplay would not invalidate the children -static void InvalidateControlAndChildren( HIViewRef control ) -{ - HIViewSetNeedsDisplay( control , true ); - UInt16 childrenCount = 0; - OSStatus err = CountSubControls( control , &childrenCount ); - if ( err == errControlIsNotEmbedder ) - return; - - wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ); - - for ( UInt16 i = childrenCount; i >=1; --i ) - { - HIViewRef child; - - err = GetIndexedSubControl( control , i , & child ); - if ( err == errControlIsNotEmbedder ) - return; - - InvalidateControlAndChildren( child ); - } -} - -void wxMacControl::InvalidateWithChildren() -{ - InvalidateControlAndChildren( m_controlRef ); -} - -OSType wxMacCreator = 'WXMC'; -OSType wxMacControlProperty = 'MCCT'; - -void wxMacControl::SetReferenceInNativeControl() -{ - void * data = this; - verify_noerr( SetControlProperty ( m_controlRef , - wxMacCreator,wxMacControlProperty, sizeof(data), &data ) ); -} - -wxMacControl* wxMacControl::GetReferenceFromNativeControl(ControlRef control) -{ - wxMacControl* ctl = NULL; - ByteCount actualSize; - if ( GetControlProperty( control ,wxMacCreator,wxMacControlProperty, sizeof(ctl) , - &actualSize , &ctl ) == noErr ) - { - return ctl; - } - return NULL; -} - -wxBitmap wxMacControl::GetBitmap() const -{ - return wxNullBitmap; -} - -void wxMacControl::SetBitmap( const wxBitmap& WXUNUSED(bmp) ) -{ - // implemented in the respective subclasses -} - -void wxMacControl::SetBitmapPosition( wxDirection WXUNUSED(dir) ) -{ - // implemented in the same subclasses that implement SetBitmap() -} - -void wxMacControl::SetScrollThumb( wxInt32 WXUNUSED(pos), wxInt32 WXUNUSED(viewsize) ) -{ - // implemented in respective subclass -} - -// -// Tab Control -// - -OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable ) -{ - return ::SetTabEnabled( m_controlRef , tabNo , enable ); -} - - - -// Control Factory - -wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) -{ - // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of - // the content view, so we have to retrieve it explicitly - - wxMacControl* contentview = new wxMacControl(now , true /*isRootControl*/); - HIViewFindByID( HIViewGetRoot( (WindowRef) now->GetWXWindow() ) , kHIViewWindowContentID , - contentview->GetControlRefAddr() ) ; - if ( !contentview->IsOk() ) - { - // compatibility mode fallback - GetRootControl( (WindowRef) now->GetWXWindow() , contentview->GetControlRefAddr() ) ; - } - - // the root control level handler - if ( !now->IsNativeWindowWrapper() ) - contentview->InstallEventHandler() ; - - return contentview; -} diff --git a/Externals/wxWidgets3/src/osx/carbon/wxmac.icns b/Externals/wxWidgets3/src/osx/carbon/wxmac.icns index 2c4e6f097d2f4315aaabf16668dbab4f4db6ebd0..5ec807b5d66d0e6f9b78cbee335154826d2e64e0 100644 GIT binary patch literal 45458 zcmeHw1wd3;`}bjnQX0j?0t1moR4_nPL=i!y6vRLgq*QEO7(fXHr35T&30sTzMCe?+w@08RLdcqc z(iq%m-Z-Gq_;yGLLxw?TL@*A75DzhhAbMl~++Isu_jm=)EsHhkl8=Dg_fsac%8qD!MoN=oWmKviAc;x3^_gQ}Fig&I`VZ{H>K_4M?iOtnx~zjf=* zBZ9y+f~dPQ6-u4Zw~j8n1C5Pf9R56vqR1%-+Up_0Vs1G6J9!87>P5a9LWPWcI;=b6jkP>(}Vx{*;T}>q#Vp1;l7-7(_dsiBRbWsK& zX=NojX^AxKVIGge;hu+qJ8|vTr@ubsgd>TZ_aOv&3>QUjLkRlqB{s7|5PiwKq(&H( zvaDl!9eBt8>9{B+k&kJ;Gxv1uVDM>SpJtAuc} z{&GmayW|DG{#+VSbw2;=E-2vLhYugFPd2^y>C>l=2PF`a?b=li?l;rJw{8v775dWA z#k5H?;a=9x-md^3xJvLN)9OcFhTsmQzvpr#xRc;#7*~P;KU{P8QR33MN{{GVbNC^+ z^vA>_`ZJ`;3zBKy-u{(ejkeCf+p(yDrlH5tbgIkS5{WuY*vTrH|lS>Kwjr0 zb~1rPtR)zRaQbB zY*+b`b>LSS@CkHRE%U^5s8aRHTBzTXhpGzjS5}q|wsBfo1RprK4pj{eO@a{Ai%Kmu zG>i%29DD$Q{A-`jQN0>XfJ1%qyQkXAqp(Xm7JPpvvu*gnvZM+ZR6zN*yN9G1PUr*V2VpkXsA1<-!D9}e^*R6W79H2sN3$nc{*`N z1S4>X`;7jvNXa_(%HgfS8amgNM4pts?K^i3W@Y0S%vTXMBO|1>SbXX1EMI7;*sF7;ZxV7{ZlqGnU5hNp0uZ)ki>L}=JdyQV2r!&A5@ zs_s?=CqLiAvS||4@FaR1eRk>mi6e(sX}VkM@aM4?e;!@;+-JeE+p%qidf#5%l*p;< zE1XJ)9XHOCi*VU&t9~>(HJ?42=F>K`GA$f0%Bhpb_h>$?D&(}92A1t#4~uis1XDxh zrpZ+yCwGKH&JMgd#~AAll@CGG6suBGJkuG8B z>#0m{G2L?gH0Dg#1wt=XdC4tJQ{JU}cQrK?#jY}v5(!9JOF?*aZPL3Li9Ru1g4!p3VZ5y<*PaI-3fVuubdc8VF~0 z&w;yJ2-nDC*N*Ir4BfD7uG6HU2=Qk&W@~C??d|)uwGY?tyReI~d8L!}WDC8X2nptP z)xt#!%wo$*6U-8MQGs4|lP%0f4OKy?X>KQumJ30B`>fAi>oV2c%tT+ipFBd%=T-&C z>V8LE#+i-O*B(5eJDl)Z&2HZTZU^j*41n0XyBrOnRue3zqGLO1I1sxj%EBp8zSR`V zDynu@QNYs|idxOFq`Z=>6b(+>?M<;Sd4iMtz7w3NNB;kKo0Pqu4=#R=a8MIbd>_1i zh0E(-Hod4%NLNx$Aq8SMe;U7PK zZPw6AzIeE{_VD8N>F_CqP)_^wJWS7TMvrLeA4$({Mh|J}Up|&!+(fS*jZpJ>BjwSm zYt*w<9orn(CpE(p0H4H#CQClt!gj^Q<#q$Pt{R@jN>eQ@UnQpT*QHzcmV|#q&D+BZ z5Dc1i)1ZCt)d9@-6;ZEr@>=3MUb`@qKuQ_mR|6!|XpSBs`Xf4>d{rV}2f!;=0>3_z zAnM^2QLh8)k<24Ry_%EP&@NL?CtsC_M{sQp*GlyOECU;cmx&MHqdE5RZx-<sj1Kk6Ag{mu3O&H1*+{;A2JDC+J`W&Y&A;olaRBkzoao?HiD(2K83G2ZQG(#Y zD>yg+Oe2_>NAN0cfpr83kYprw@&7`>pwoRv$JSl>Lbl((*#tjP9QQF^1f{jWeI!q| zmn~?i=^o%ixQN@nrj;Hy0F(f)TDK;krGB!#VvVO~EB^VI9q_9Ackcq=#S{wR_H~|~ zBpHA&j(`9S>wq1@UjTqrVgZ1}m`umY3TXD@Qq7eBHQ|wAGMy^R0qr8&J|V+>QmypcUGcp@N$+KRE(bPJ(t4 zI3x9Ae#^l&zj}K5C?m2N^RqDjWDN~XbLfh?ys#bn3C)6bjGvMEp?xx7a&6j;D0U5F zN)N>kei~y$4=_BkT?M0lxZw6;vYBe9TCqRIGb}MT$9AGzOtA{~!eNpFQ5+>wPnv72wnk zrJ7J#{?)f77{N_AEJjO3VzJFs06XBaP)KkUW3!^b)h2;p$G4cD&kb)K@jJBOh7fKC z`kV6uUMmJa=Kd~z(s_~@;M@-U$p|7lE8qrf`J*m{E;~D8c(`?;_%S=iii4eWb#-)f z1x3%LH9L_JMB&mDIP9!LV$TAESyxYR79%lg3{z*M3vp~vuS>CGJee$fk1(LkFX8DJ zGRM9^`9P`{FvB~=4-hx?m=8$vR?JUv13%W^#7?IR_+{Rb0)Sd?&1mAUZov;2H3@J7 zgl$CflPI@aRgh4BHKR#C=5EPPvMU;8{K@yGx|-xC-NC#VgvJ0msh^LbgUp!B=QV=z z5l|coX(zcUKpprYL4X3)F*2@ZYHGgxMa}c)H7{Ir1^ie!6b!&O@LP}x2&8Tb`?jdVY5)@k3zXwhvZ=i;$7LAhl!t>OyybTT^rDJ&L=PgrM=x9Z29H%Pq1@ zoth;eiGCLZ82Il~r;284YQ5vrT;!h^muTwC|Me?xFC2mC8czV2OP~m(uw=zDkA?28 z^Bf&!+1bxdManC@{R8}#FIx(5`aBm$J6p%SNX6YRx~P~{kbUOF@k9Gl5`tz=+ly2^ zLT^02QO+yMJAW$uNb2sC&65oGAk~Gbj~-VQW}nGCc5pACxsh9EjDlA8eRU7Y&OzHg zXp0C9+BhBaIwjWJVWk0IJZ{^tX2m2OXq~ma@Nag7=W^OM2pp|hJaf9W`J_cILCmdZBnq>4B31Lif{KG7 zpw(@<^^~!W$188$48KOZ$l1RGDQml*D@j?uV!4ymK9fT*Y4Z}Sr%--A#N?fj)r;e_H`tu2|p6EJC* zW{(X|`9uj$T?C=HRc&Udn~~m#VVVQg71ln5h|`zGcke&ffwTns9xy!7SJfUdY=~z6 zzCF81t$GTudSgA~1+AevpX7)n6l!dGsHn)xDRh;UM!wGgmjC+pMaWB9!*z%mfsSp2 z-0h25(P~JNhE!7@g#rByM3IDaaOYWe7^0oH@g;N+T9(! zynMYpmn?F3x7V30dVBQt^INfgZQu$&A1|*l<3;U|K1+SJmt4j-j;zxsCyx}hOZs?h zy!xcJoKu*4?qud99Z`FwkH?O?Pp=ha;Tz2%r+)2jnLhKk*F3tAm4RgZ~T z-Z_0-!Y#k`?ck?ozxrMhHDKO)W1*9 zZp!jqq$Ktu1vNEQRb@r_u3coL;Gy;)lI-3^R$7`t16-BdyL*H?n0|y^kh?WcBA=Ox z=tWsPUO1P|V;AM_Mf7u=n&**kX}?}5gquPBl`n9!s4vdi12Ic{v%XRQSIlQ{b-fU` zwYp*n+V13&SKA21Pd74yon4)r93AG&ws)}EiG`vFSsevxLe2h)s-(wx1M= zBQc zx6}$jO3ij#Y+U}mcZ^S=AG>{uTUJRfnGmF;BCA66oI$Tgpk6W z%N(pJP93eGy&$eDdIzfZGTnS`^Gpj;C){8L^;eYvUXlAywa3WyXV*_N8#B^CXE?d6 z6(oUIfv$LpAV&0nQi>MWT17qKf(; zO^t#5`t<0otk6Xo_N(X}DyOWZLf!)LE(=E@cd4|B66`%mS`_+=JJpMfICuF6MVv9X z{eQox%vijLUluO}?6iZ@XaAGe4gB)Dp~hcSti72E)vK*eT3ebCMO4e@Z-@V+2_9aPldZH9L_7TPco-0h z|6cwiia+V!%-?q4$jq9y?p2{npmF={eH;GS0)7aAW0aOGl7dF5Gpz(plX*P?a@%*gZ4ZR^*oM~+BIVk$ zv}}=`EWC#=T0DiHxYClPv-UqS0^X}JGB+j^yF;B~zW0?D5D*x;G<0F8YnW5$EZWRj zj&+c^vpSFwFu>o>*Jru67yRnUk|iFC7cE@iKHtrC-rTt^&Tvd|m}6aw2CiJS3Qi`z ze7>a=+XBosk78rYk#umdpXpeGv;$TI2Ke}{T)TG7>cCYiR|N3YdwMPt*H^6_T&qiilU2V4uz2#+$z!XKzMsF3Pwwq& zHy%E`bNvG86BGMH38e7_Qj!wmV`HOcSz1l3LI%DoJR@taRzG|C;CA&z=md7CrG?$e zSYSu=w&(y0OLOhZ$k1`Q&(h55%a8u`%e~qw6`UrgGSZG7#!l@{-bIN-MT7@gO&D(q zLW{k zu9=W}_#KE7LXxug()8NOrt_K@QR-KRu? zHg8XD2;CQogm1xCHi5|MRjX`9j@HLQ z?(R#^<`+JGcYHk%` zQpDTKYm&Ypo?Pp>F7C%qo_TP$`T{#U^8oG(-%2<*hDFw`B}JBdEnB)|qOO4!7IJo) ze>mgh{X5sni_WL*YZBQKN{OuT_jI2N*ufk}mw5}!N9YZ~LQW2@2aaXjy?v#$;LOq8 z@nl~j!(l3eNh`kYjs@3F4mfHO_`eUJ4vz${>58t_YiJP5~8n-=)6bahAX~VkJ ztCu^^vbO_~X<%lubAf&S_}(26*hY

rfIg)Hn2`BqB(w#WNW>!pm^3Cg|1*Z-sM&JRYWc}uYpVRShfKdyx z=~0DcCA{5SXt{7uSx*@l1Bm9aP%ct27u2pfej;Cz<2?hydeLNkfQ&TY!WXFz~ zlwQK-{rowVka~BM#i?LtqT$9yMkZcC+pk_`ojtNEV*Sbhf8XWai|waT6KFAE{5UgH z-N1TM0-0-JasVMs_p1AV;_`WeNX zdJuh3RKbl#GDXE@Y*umA&Dc9y_ezb2>)FqCW#u1B3|qO-R^YA~>8_!^p3Vp@-4n&! z29SOPhPQ(>uY|?B_vULnG3?36VLG;Ub6I&u6G8&!+q5#PGeTQysCH(P@HQlMj8n!c zd%lYp_KVSw5z}Wl7v&y~3-)uho-hFh7yKP*WM}|3hieTRs;SjNR1%g#@rxv4*w2Q8 zhg(l`WM&`Q8RX+KWh}_yp#@)c!Qil=gEa>ZX(kzkB#&@QSPznkVNXYC44pjHJ}>*g zj?LaqlZ5stxgh`u_1DN~au*~Ed7RSsAXz_gfaZ9sDaUeBqc<*dumC@e!B2s`K?4W$ z>pQT8B%NK(s@_cuUDkJ?!KCra&Zll$x5R!-3oo%0{0>dO^yU`nyo#cGAa}giK#j2z z%mPxjuUk0L(9l3%U<-Wgr{1S`FSXuSZV#dK_2c_DuN&UHdH3NnfoCWR(K!`Gk3h%o zWBc?QHrCW+${ZUrSOuVAI369+ZlB&gd#I`QOamP$gvyt9uU@`*@e=;Mcv=6Zjw#f# zhmbj}rrvj`$tWX+ejhzu9cq9zuMZJ`KbtAi&$#-E7G30}v za-ZJ)we`U~p46d325Sr&&|kf8pI$wCbnm93te}d8cM%d_-fSm@Ik|k{y#(#0yAq>k z|32#du|V%$J$tHwITdAPB}I8TIe^?0j)QC>{A$;$=$5kk2+cPkeH2u?ckiZ32`DIl zNY^g1vNF=rQj(GqU9o5aA@Q+3rln{qAy>I%n6eyZl$DWXC@|!dKu$&m#OO3c%0cM( z!_Jms2Z^q~=I!1d85Oe3dx27jbciG*nn0vL;SAV`BT!>(Oa9}8D7YW$ML;;7} z5DP4EZCDz(#hfT$iOMTvzS>Ek_wntqNC8XUZ(jhb|ME7WJtk>j%74-TF+qvX4T z$&y_4FF$+cAR2z3p`z#^n0v)3;bz7m zsqK0B5U<*oBbisoDa?)`>34wsC%c4~nSkhd`T4AU96ETF37?yP~8LNfEp88XJuy$# zll=fLUYUB~*6mw2F#rsRE?_qR02cxfnsdlN%(M0sPXLG4G4I`~xdtDb7#%L=awsqv zz~0k)^@fUf0H5N&%4Y?$uBQ6tjjJS_%_WiG+$<70K9Q^|=CRz$)!%k($^I4v~K0?`M@ec7; zzJ5!>uU@MC{D*Dn^gfxY)z_ZRPUZ{_8)D50vn?vKY9c4lK(ACPCj>G_cOJ}>pZ ze(bke;=LgGQt|D7{agp|G&7s(`0=AhAjkk{d(y5*J$3cJjt6Kh_Hy4<&bj&f!`s&` zaP#q~3UGM}{!Uof`!65`R*O8{;!Bt{&+gX(5TAqNA^?yJ(C%2kp(7{t6dyydTCl`* zCnxv%uXk@$78jnws5==6;iK+=hergNssW}T9=u@Xws>v~GwbTpx@rLPPg4N{s`~L0f7yID!LnRNdSFp0u_fruF3biMZ zbnkfp^i!xkfT`m&hYj66X8rs1+kx6aQw;1KW^6c=!n${*q~O%yq-coM2o$YZ?d^mevZYXV2qTz}?x)^+ z2WlU3F|eIIeeM2T%)3>^xhD=J@H| zS5SAEo1MNdcB>%luzKZ+MSS0&mn4io*38rhaKatv8{mz>G`p!QlVbAjTx6X;zB@W3 z=qEuO!X1x1KlnkR?W0HO18%tkwTti=m`=6wkB`c}UBNtiBq=J0ilYG7@7g>vF&_NF z$hK~;9^JmBY~+~nzB|Lu*OozqBq4kwM5J)EVY!P9=@r#Q5_BF3=(;wbq2E$wG|JE| zD(vjd(!9+5v7tD)MFlRXAPoeBFy1~I1N8uPYN>Ts`Ia&R69XH+^`~zX;}}ZtDjdyN zzK9>q;A7~dDiYEj(yg2Fx0LA_>rG$ecCdz*4I!1y0lq%op7U&`lA)t!Q2-Lj*B-8^ zs-g(W+JmMH^o(?^7dRzeDmZ&IDRP6a_fj`|D*9nz-UQGCmaBuIUwiVrS#f1&Qe!qR zhYpgF6&x?(t0EC*3Y{J_u&<&*7f{w75@s-5Z}>##nLA5Q?T_B%?P5KpX)y>Q31kNc zLquRezh3h4vO7_GaG8OYj+VKj&5qKO`?hUZ=4gd?4mnhyiHs4Dns96Zqy0VQy2`|g z#?%akju<+A_OzIi6MG}qEuB3HPo7|y$WQ|xya)KdZ|`2+yLOR^MWTT>gTcdxjJ31c zUYxl*VvUEr1*u2SF@6w$kKhBQt|BWV8P^^uZUU# z)Cl2FKu`F@Q<9OU#kYm<3ncT~RY9zC;Gq7)CybroyJf@T$uO7tlt4>^D$0rq zkcKZslemg>AXL#$$83zT=~xp3n6no81^vV9vNFJb9S!dbb2)UR3EVRT@e%$yf%ph^ z26W@7g*08F1`X@l2f`-mLqdkEB4q6)>xel%zy08r;7Jw$`I(4;a#J zI0m8w!y-?GK*$IP9nzWaph5k+cZV=g>qixSxC7!HG>Q92QC?M9MHwrA7)sZ!T^O=R zh5<1YI$c8IDUy)sxSddkRr2Ke1HkX$SU@DKzMkrbO(%&K^PfRK8B0|L&RD@ZDnTfwS$gM-PpSPZCSrM&~LdnPO##i zrWd%ox#H6_|?^%&;yj}%zy(JUj&#RdQ32z=|i-OK?e z`7#Fx?O!6iAaD;SV_~jU3rpCLgFPf%&6;6;f-jXy=se!+FIFm28pU{01wcIZt?dIKEH?Cj10tr|ZRDx8YAft*r z@jwPv>=J8ho2gBLdRbn+{#kc#T)%!5r)|Np9iKj1<}Z;6JV^-RW$l#mYM;JU` zzufEa?ds~g_aQ+D3$mH`yboDS%25O_MsXl55C?HKY1)Yf2sWGvqyKT zFBKOGhK+O;v{I=|g7hDTtLcO>(P-c|P@BzLiYSL0H!NCmzP#k|uMZ#vi<3vr1~mfv zaOzq@Jb*pItfI}XqsN(SM}xiv;G93tW|KqFxPHOn)5V-$AoZ-Wl$mvsI`NWoCCI#L zNwh)1{iI0*8LRy&RyV+5+d z3G1Y13RJIlbx&vJKl~X^|D4>DO=}^MzZS@pG%Aa2#fmvbqYR>u=C=`^qsQ5t;QkPI9!scMt*jNBlSS{x51u+hl@Du=UDej zXV=47XYW3|Sy@te_SgYx_TmJy#~%z*^Kvh5TYV#4(A@#>b3tm=3V0@mZ~9$2UB_T}6dK$C1eBD{W0$_)1Iqp8IPE!+ ze*4~aGRKZTgH%>pFeGiQU$<)cVmBAK%R0@Qzi{dZJ*_A-qyq>jA-Ryts`;`TwENC- zOinviTX(g*=-lzWaCR0fXEJ?l-AWIa+4gpjR|jWaE1R*ybcaTvp&cPW(MRC6ck5FM zs9$b3C-Lavn|G>83QiwRChr#Eg0tq@)k~f5*_Av8$ei_7}eeIu(gZXx2L-H5+^%-e=KZDGEoyR#K7fFB(i|dx7dRD`0+Y@)q6rG zItGY>gAcJGt#=p8h+Qz>#&+B8q-!@Xu+AOd9m8MfIHzuv=WGE`K_iOeRhX*%5vDdPy!ml9TDPEByW7 z`w9d=4cQ+v@}OxnSgj|v^B0gO!*0eV<2G-PymXb94SzZ$n7j-5`M?=ekPT`+0U!x{ zF2ZL7jc#g6VCXMEQ-nbM=cEm>2z|Ju3;nQZ#I$wBv*OpZaZSjZ+R&t9G8-S0q zy;Zt&l>$3r18&&PaIL8`XPzxMmJqta-Nr&N`}|Z*LGmMY*6*PtD~s)jjm3eTp~Hqw zwy`-|a5Ns!h-uIlK>o&XA#lEv&6iwqtZeBJ`0Nao@1`X^d08IF>jWkUHtcVQ<#v+~m1N#jfYc|SezSG2Jix`q? z$wf>}2~Jc6^oAx84SP*|m{7JixI1+8Xd?rLe*dQYSt|DyaGP!z^}!YZP1*sgQe6Bn z4r%r2*SGgT9mp>xbD0GbL4k2tJ^qFXS!pS{1gu7}QN?&Pq&G$e)dxVzF@`O11-q@H zg5fB+F5tPeq$Euu4wkyOIAa1DgaIxLUa1J-DL}x4IldUZN(8UP#~x|Q-McZm_X5}q z6boQ4oH{IpbAV|QNl0uwG8xgO6;zZMDl~x57_tm$B*g&y48F;u6PWxT0w!0J-^5_i z`ArP}Bfk;a=|<-WbdEsh2y~7>=LmF;K<5Z_jzH%Kv>gHEVa6uymXSJr+e-Yv78$$! zb(1C#U=k{!gY!~&n<2tbL zZF1W$^%7}U(0E_<+v>!ncDW+Z{C)2q$*?=vgp@)g^}Hw8NF3rF_*E;`5mo9jtjV(0q%zGWxm`u~0X{kQMG8+-K? zU3w~ryY?}^*z5nzAAgE2&uTLl_7d9#vF!^NqNs~HA914&Kh{1$q>1@gT7R^CB1ciI zIr!oBi3FNB4*YogjT8U7_K9%No0{ZSz;}f`fmGeb-X> zN7UTg*jEXteE%aff1i#v-vMr3^?iarh%2#G|6Rm6;r;+0$ZxG~@?j$Usp9`=X=%Uv z&Ht!zFxJxk`v0`~mi85I{CDk}fB5g(U;7_7-*Wt8{>%2;ep~pz-JuriztjG|eY{&6 z=p6s14<8ZVmfw1~TGs#E8r1SRC1|U-k4S%O{BH}tS6|Qx$=fYG?6CH??ANt9#wqas zuxN*N1q_|`1ycv_;@C zAD#^S;r8ibY~l}&EzJLr{v*Xx?RK{n;p57d=26=}Le)y5RrR)fD+Od#F8cfMt6%1} zmTvtwp<0=1Q@zqoipBWz9ivE3b_{B59xZEQ;oA*a?ZLMa!xu#)B(+~+gJgW0-Yn! KIRZa^1pXfZSr0V; literal 36901 zcmeHP4|r46**`Z)n>3`5u*sgW@O(w8TWlLmVY0Lp($q1met_8!9{gZ)VK$|r+bZo? zwcMNju^@Hm#BQG-6CYZg@>Oh0DB$W+bha`?Y!#5w0G4^>a~Suy5(XRhd*5^KP17`m z^bd2-yt%o5&UxSW_x{fBoZQ@=6DV}wUrflR>u$?iFoO_AM=tl8`zay$TM1eGV?wMi z6Y}jtgxvi@Lay)Jbj@3=E-mecDcAI}E!y~I*ecPXvp)=?vS03x#usRqtJcdEJ9S5*WvOIqqa_5 zw{G3q`v<}&9xvbvo*F18KU7^(^6)@;qG9dox(NT|hYIRS$|LOlr%LKRIRG!QF8M$y zzs7_wKOwJmb$`;aq_D)uw41TK@Ab^vA1Wy=^qWnL8O!^!uUk^bulAeTP3=&AUA;4_ zFAz9lG@B*=YcpGJBFP5E)QU@{85uKQCdo!) ziirXLu6=neXn&=>t7jVK%S&^1oh0E`@_~2Fcfk1ioL(>vzD0=Ua~TJpOOqQq-*!P<<44JvtS`*cTkok{&_YF5kfQ_f9uILv>i>^eFc(uo8w#fQvVhhvJPre>W4ESRH^rhA%)+MvOG}%#Lx&QLK1sGEBqV8dInJur$VcmiB-iHcI z8Zcbs1kJ^efKhrH#h)r$TDFvPGp^H^$WQD0`%d^sr>5+@`yp9u*9gfRm#J$->w zd?Qr7N@FOwV1F-rO5J;^?{}P_YUV?jN1*I9G!GYG_#I$sI1{Xt^L!i%oaj5%+t=H| z2@`(*Vq2SUPum{fo~Cz@1P@;-xc4+YA&@|IFL^@{J`t$g%l@+}pL_@8E~;;K7Zl#> zDJY<&J^Sx*7kFT!rQKck6nIwMTjZgo*8TSu-CI=PxtEr9b=|WH;_m**Jym{``%6Ww z``u`F9pOI~w*WM2a?2vuT`t$6*}D(A?_E{karFkzczM;I0wABNDR&EJ*Wc#z1F(CQ z>qM}UXE4arlz+^A%beM>A9$dkXjKtfI9~IoK3Y~LfUie_H26=Xt?XGi&8EO%Fe;fo(YDR4u>!m zFA=1v=Gf=hr=jpYl%SaDZ9u}XbP)cPhNh;*9ZfqLcRUNitD0<1AUFroWr6TVt2dFy z!@~dgk*Z3v281tu`{<6Qoy|L&nrP|h>E_0!R@i9i{g1%5tJ$}cmX4in_BH#OTAO9t zE{J=!_`6llkTW2B@v+m5Xy0hJJ6%p!zBAw6a2-1d*p0h3{xtY~uTw=Mr#3m?y)GlelKtwQ);+uTg6*^K zJLfs)&zUDiI=fhl<|bRVEt@M%EH3`^`%b5ebuxCUi}PJeMtX)NJ^epGmnMvy53w{- z-{kC?o?*3E(rq?QQ2QWKPKl=UG~6uEa}%11X~tXgC9X7Mh9$#t4a7D6kk7A>)6My# zB|QTJr(-wd&C8#6NB$l2<}Y{`n`p5C(F}{lYNOpyOEzIQ-1n{3MPI1L5BS8(ubAH~ zvJuXow>?ZHl1R8R;)2>E%F&nqY&+(QEp`wl+o^IS-<{z}Nl83>*VgqU zsWIaNl459iwaK_ucYn(doJ3Q%dQ(D5@`H!SCPKE~l$x^DaQM(#J0VEqyVN~BIjPjdfrf8UQ%ANHd=xA z3RK`pcNN z%P=E##)qX(mEK=^kKY8DjX0}B$Oi^zi}R%y?>^gm_IG{;&?k#H?;2VlAoT`tX(#Om zOzlRIPqQKO_H3s!3+j6efMYg^e7X&{WM;NBFF=3e0VB>ziF^#H(1KZTmn3fyQ+qqi zPKo^eGn<{a%&?-r-v~f-mWq&W!wi^sYR-rHcMJ@8%l?L0&6!Th=PmSx1Qh3k$A?8v8`qAph~46DFF8&m{v>DDS{{p z46i`LL3t`tJP+?FTDZ=|Tg2%(oPz9p@k;&;TL?}@()mC*zIi2oZW~z$GlLzS^$1^o z@Jjv{I+z;{c5Fj@Jj9;Ri~s>X=KvnTaf&n!J`7B@igX|-4*bM(2u;~{bjF^bjo`y> z6Y-Hur}rW6Qt#3g53LZ7vDQx-wj`zjJhT-yJ_zvEx2-BdXDiViCebd0c`U~{Pn`HPH*e`*0NPXfomM6hu&J*;NfU{0*3L9%VUTwl z31Mro&t3$4m=DDXUu31fD~!*X`?a}_+$k`(3p2~Kf02})=~q#BoW|9EJ%Udb(NRjd zH66$WU!Cm-tuTKFQ_gh88PY_w*Gxj@X<0D&T61wdyf1KN7q|_XK;JOhMh-!puIEz@c$OkUV`{p zkN}Qhe5@Tod@jMNACBNNA0AV8cwhUsK0gZ#w+>md9opeIf=1OAlU2z<~-bcb_< zKFb}Hk3%Fhz+cr5G%x@=Y!Lr`EtLl-O$+n4S*_@-#$yJAMDU-II1y*&K_HY>(kJ9y z?k)3P@GjxJ7nX7yH_%_pfi+5>n}vNK^AF26_gCi5`;p^Exho$V;-FM0 z3Jjw_p$C^0bhG8zjbFmzLh=S!T-YK^av3)*)DhV9L=Q(=l_u=g=?MHyO?O&#ov>Yp zcBs@7W7ta!!%E4E20|Q$N?s61}lqI{Sqc<8L2d!tT1x?v!JRkJ(lUAgKAWE-?2J4O8Lg*1e6~w@=lm$aU znEem%ylZ;!H6Ls9qKEA-fi{BeXZ5;sbl7&}u;)q}Hiw4 zg!HVKK0)MPiSbhEU_|OrfXV}jp?x$p&kFjWAZ@5XVi_L_Q3`6v0~n0I_|Y=bP%Ws+ zcn}VNc{ZSe_$>k{dvq^ZArH!DE z^&AdQGt};PQ!ICps{;n#z&ij+JW@32wqjt4G$DnnBN(iKg%=nH8uvHt_FT?xvZa=X z0K(%b0*0=RP%v1{s{$CTcIWykE9{8ir~Ci}9S{M`Uv=k)+FWWe*FTAoAxh-kyWmRl7PM zRF5BWx?vM^?)<$SQjIHs0v8!$K9l@nEmVL2Goig+4;|$YJA+ z{}WvH2&^nYZ)n^Wo9$-KX0oLIAp{t$tv=we@kU>$jCB$h=Ty7w2%&c0+*szdm}~%a zlJW#Ba0`}IJ5@BvG`BO&l$IKk!SWaqv$7T(Oqxcqd1}-L7xVy2OWA`9XCYP=kTgEbCO0k#&6vev^IFK% z3PB4PG?CY-w!7q3HPTik&|DHmsLbn3#Fjfn8ELE3z!{n^k$IALNxgwB@?jFONjAVR z`fh|zffI6wJEG{^_P|z3hP43HbUL;dY;ZB|MjYD~dxeDnyb83VV|!}k*!Iw6L1p@6 zn5QbGnkpdQ3+3~bWRd;kv*JHk0a+LMJlHz4B>TlY4|N~3COaf1>_5a3yF&4obPDE?Hdan>gcH{>F^XNEW^6^a7GC{XAw#s$CmqFKYL9r}}MM@Hpcn+y(@CfztV zY|=@(U0MfQx%iSC00)-E$z_(slRJ+4(fRnA5_<073+S@ofwkrB?f&HM-xb^kKZjTC zyY0PNhVdJ^QxCzSqEWLi+i!sSAi z5&HaMoL3*1)(kDgdGmoK>k$4u^U>F3e`@0=F57%hyis<0TR z#h53X1mH{;nF3rcYpZ7$rFHc zEYQ>2b5an3+$ZEOy9D5H_&KhDyaSKrzSfnjhin55zSjy03ku~cPk9^ro&hk*e=sla z_XP!ozxp%Fo8N=-hMd{16{}Z24O0*wz60g;Ia%4i7KGP7VR-|!!>=-*6oh?eS^i64 z|JglRIXPfIdi2QABgcUY*GW!O4#!{P_K{x5yyyLwceb?b#Vh#V&N8|U{;AsV zW!W$ObC}J@E(+bN@ty;pQ$iAm>f{86%bziMnd2KeO&BQZK11sv4(~CZuv7S=EjBhSE%NYHd*E9VFrrkf`+S^kMW&<%83>Y-z1$mHL z=MY1TigR$sSX?ar`vNqdhkqN<*||9E3IEmt*8Udh7)HKFzzSKJ4wj$9dxYafdXIpA zWPtaGOjxnPdx8qqVZd&m;&5caJ>y*Z^|~~M5V#>|wFCF3aFSsz3LnIKz*iqdvou~t zeEL6uC2aCDgf(^zb5*Nn$p+XNyas{hr1cBY{g($cra1g_#l9(!fpDGAPEZoB^ zq#UEQQC<~DPC|$zHF~2=bD-&wxbazOc3>4Nax^v?gIy3yzX777b%+#ed-V<+MPk(BgQsp-6{ch~_Ay>~sy||C~dompGSomtB7w}b^&n|o>pZyMe z)yBN4^{_=7U}roY(do(+tcQWSQuN=dzgikV>C9n@pVyN z6-Z7(kV%c+C^uQADmGoly}T8(4vGU-a^zTT;Vy{QPX->FL!^@1Irys0hni>=2N?!6 zl;s+DHZp9)R`@zip-E9Dp#qE>} z--788kBJrz8fSe_q6+cE)C7^EVGGjYuUUpRa_mMsf z4ET@ffufRK|4b#j1|BG4Ue&g;z74Q5t*xTdl`Gg*{6_i63sG?CgM%0@mBdu>`&2|mYjq<8MauPx$snHu{ngdOb#Es8NvjeMGk)yHE80>;r`V9~rtwW?(+vmaq zMJ3c=_YZ53We|zY^}>&fV29tTu=pDjmka(Ww+pV=NU*CK1J4^%DQ$QF`3T2D6&XVA}Pm}C`5Q6&+@fg)@2FA}~vO4ChJ_YI*L zmm}@7EtTQMZ-BWeEydBb;68!*1H+M81RnTjj z)FD^TL%p~UJd%y{>M`L#y7cE5)w1+3 zt2;`yqJW}+qJW}+qJW}+qJW}+qJW}+qJW}+qQKY`7{Q;nV@otlw30t=1%^>@Y}IjR zALf4$9b5Jh{Z@6Xsba<}?T=f5nEH*iGVbik_#3O#G2<2e<5nQ1eq*hSJG(Oe$0~Kq zct!uX6^N +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_ACTIVITYINDICATOR + +#include "wx/activityindicator.h" + +#include "wx/osx/private.h" + +// ---------------------------------------------------------------------------- +// local helpers +// ---------------------------------------------------------------------------- + +namespace +{ + +// Return the NSProgressIndicator from the given peer. +inline +NSProgressIndicator *GetProgressIndicator(wxWidgetImpl* peer) +{ + return peer ? static_cast(peer->GetWXWidget()) + : NULL; +} + +} // anonymous namespace + +// ============================================================================ +// implementation +// ============================================================================ + +wxIMPLEMENT_DYNAMIC_CLASS(wxActivityIndicator, wxControl); + +bool +wxActivityIndicator::Create(wxWindow* parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + DontCreatePeer(); + + // Notice that we skip wxControl version, we don't need the validator + // support that it adds. + if ( !wxWindow::Create(parent, winid, pos, size, style, name) ) + return false; + + NSRect r = wxOSXGetFrameForControl(this, pos , size); + NSProgressIndicator* w = [[NSProgressIndicator alloc] initWithFrame:r]; + [w setStyle: NSProgressIndicatorSpinningStyle]; + + SetPeer(new wxWidgetCocoaImpl(this, w)); + + MacPostControlCreate(pos, size); + + return true; +} + +void wxActivityIndicator::Start() +{ + if ( m_isRunning ) + return; + + NSProgressIndicator* const ind = GetProgressIndicator(GetPeer()); + wxCHECK_RET( ind, wxS("Must be created first") ); + + [ind startAnimation:nil]; + + m_isRunning = true; +} + +void wxActivityIndicator::Stop() +{ + if ( !m_isRunning ) + return; + + NSProgressIndicator* const ind = GetProgressIndicator(GetPeer()); + wxCHECK_RET( ind, wxS("Must be created first") ); + + [ind stopAnimation:nil]; + + m_isRunning = false; +} + +bool wxActivityIndicator::IsRunning() const +{ + return m_isRunning; +} + +#endif // wxUSE_ACTIVITYINDICATOR diff --git a/Externals/wxWidgets3/src/osx/cocoa/appprogress.mm b/Externals/wxWidgets3/src/osx/cocoa/appprogress.mm new file mode 100644 index 0000000000..7c090d6192 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/appprogress.mm @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/appprogress.mm +// Purpose: wxAppProgressIndicator OSX implemenation +// Author: Tobias Taschner +// Created: 2014-10-22 +// Copyright: (c) 2014 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/appprogress.h" +#include "wx/osx/private.h" + +@interface wxAppProgressDockIcon : NSObject +{ + NSProgressIndicator* m_progIndicator; + NSDockTile* m_dockTile; +} + +- (id)init; + +- (void)setProgress: (double)value; + +@end + +@implementation wxAppProgressDockIcon + +- (id)init +{ + self = [super init]; + if (self) { + m_dockTile = [NSApplication sharedApplication].dockTile; + NSImageView* iv = [[NSImageView alloc] init]; + [iv setImage:[NSApplication sharedApplication].applicationIconImage]; + [m_dockTile setContentView:iv]; + + m_progIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 16.0f, m_dockTile.size.width, 24.)]; + m_progIndicator.style = NSProgressIndicatorBarStyle; + [m_progIndicator setIndeterminate:NO]; + [iv addSubview:m_progIndicator]; + + [m_progIndicator setBezeled:YES]; + [m_progIndicator setMinValue:0]; + [m_progIndicator setMaxValue:1]; + [m_progIndicator release]; + [self setProgress:0.0]; + } + return self; +} + +- (void)setProgress: (double)value +{ + [m_progIndicator setHidden:NO]; + [m_progIndicator setDoubleValue:value]; + + [m_dockTile display]; +} + +- (void)setIndeterminate: (bool)indeterminate +{ + [m_progIndicator setIndeterminate:indeterminate]; + + [m_dockTile display]; +} + +- (void)reset +{ + [m_dockTile setContentView:nil]; +} + +@end + +wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* WXUNUSED(parent), int maxValue ): + m_maxValue(maxValue) +{ + wxAppProgressDockIcon* dockIcon = [[[wxAppProgressDockIcon alloc] init] retain]; + + m_dockIcon = dockIcon; +} + +wxAppProgressIndicator::~wxAppProgressIndicator() +{ + Reset(); + + NSObject* obj = (NSObject*) m_dockIcon; + [obj release]; +} + +bool wxAppProgressIndicator::IsAvailable() const +{ + return true; +} + +void wxAppProgressIndicator::SetValue(int value) +{ + wxAppProgressDockIcon* dockIcon = (wxAppProgressDockIcon*) m_dockIcon; + [dockIcon setProgress:(double)value / (double)m_maxValue]; +} + +void wxAppProgressIndicator::SetRange(int range) +{ + m_maxValue = range; +} + +void wxAppProgressIndicator::Pulse() +{ + wxAppProgressDockIcon* dockIcon = (wxAppProgressDockIcon*) m_dockIcon; + [dockIcon setIndeterminate:true]; +} + +void wxAppProgressIndicator::Reset() +{ + wxAppProgressDockIcon* dockIcon = (wxAppProgressDockIcon*) m_dockIcon; + [dockIcon reset]; +} diff --git a/Externals/wxWidgets3/src/osx/cocoa/button.mm b/Externals/wxWidgets3/src/osx/cocoa/button.mm index 35c2c4d941..d966f738ae 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/button.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/button.mm @@ -37,6 +37,18 @@ } } +- (id) initWithFrame:(NSRect) frame +{ + self = [super initWithFrame:frame]; + + // NSButton uses "Button" as its title by default which is inconvenient as + // wxWidgets expects the control to not have any default label, so reset it + // here to resolve this mismatch. + [self setTitle:@""]; + + return self; +} + - (int) intValue { switch ( [self state] ) @@ -127,11 +139,13 @@ void wxButtonCocoaImpl::SetPressedBitmap( const wxBitmap& bitmap ) { NSButton* button = GetNSButton(); [button setAlternateImage: bitmap.GetNSImage()]; +#if wxUSE_TOGGLEBTN if ( GetWXPeer()->IsKindOf(wxCLASSINFO(wxToggleButton)) ) { [button setButtonType:NSToggleButton]; } else +#endif { [button setButtonType:NSMomentaryChangeButton]; } @@ -157,20 +171,25 @@ void wxButtonCocoaImpl::GetLayoutInset(int &left , int &top , int &right, int &b case NSRegularControlSize: left = right = 6; top = 4; - bottom = 8; + bottom = 7; break; case NSSmallControlSize: left = right = 5; top = 4; - bottom = 7; + bottom = 6; break; case NSMiniControlSize: left = right = 1; top = 0; - bottom = 2; + bottom = 1; break; } } + else if ( [GetNSButton() bezelStyle] == NSSmallSquareBezelStyle ) + { + left = right = 0; + top = bottom = 1; + } } void wxButtonCocoaImpl::SetAcceleratorFromLabel(const wxString& label) @@ -237,7 +256,7 @@ SetBezelStyleFromBorderFlags(NSButton *v, break; case wxBORDER_SIMPLE: - bezel = NSShadowlessSquareBezelStyle; + bezel = NSSmallSquareBezelStyle; break; case wxBORDER_SUNKEN: @@ -247,14 +266,14 @@ SetBezelStyleFromBorderFlags(NSButton *v, default: wxFAIL_MSG( "Unknown border style" ); - // fall through + wxFALLTHROUGH; case 0: case wxBORDER_STATIC: case wxBORDER_RAISED: case wxBORDER_THEME: bezel = isSimpleText ? NSRoundedBezelStyle - : NSRegularSquareBezelStyle; + : NSSmallSquareBezelStyle; break; } @@ -354,155 +373,3 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer, } #endif // wxUSE_BMPBUTTON - -// -// wxDisclosureButton implementation -// - -@interface wxDisclosureNSButton : NSButton -{ - - BOOL isOpen; -} - -- (void) updateImage; - -- (void) toggle; - -+ (NSImage *)rotateImage: (NSImage *)image; - -@end - -static const char * disc_triangle_xpm[] = { -"10 9 4 1", -" c None", -". c #737373", -"+ c #989898", -"- c #c6c6c6", -" .- ", -" ..+- ", -" ....+ ", -" ......- ", -" .......- ", -" ......- ", -" ....+ ", -" ..+- ", -" .- ", -}; - -@implementation wxDisclosureNSButton - -+ (void)initialize -{ - static BOOL initialized = NO; - if (!initialized) - { - initialized = YES; - wxOSXCocoaClassAddWXMethods( self ); - } -} - -- (id) initWithFrame:(NSRect) frame -{ - self = [super initWithFrame:frame]; - isOpen = NO; - [self setImagePosition:NSImageLeft]; - [self updateImage]; - return self; -} - -- (int) intValue -{ - return isOpen ? 1 : 0; -} - -- (void) setIntValue: (int) v -{ - isOpen = ( v != 0 ); - [self updateImage]; -} - -- (void) toggle -{ - isOpen = !isOpen; - [self updateImage]; -} - -wxCFRef downArray ; - -- (void) updateImage -{ - static wxBitmap trianglebm(disc_triangle_xpm); - if ( downArray.get() == NULL ) - { - downArray.reset( [[wxDisclosureNSButton rotateImage:trianglebm.GetNSImage()] retain] ); - } - - if ( isOpen ) - [self setImage:(NSImage*)downArray.get()]; - else - [self setImage:trianglebm.GetNSImage()]; -} - -+ (NSImage *)rotateImage: (NSImage *)image -{ - NSSize imageSize = [image size]; - NSSize newImageSize = NSMakeSize(imageSize.height, imageSize.width); - NSImage* newImage = [[NSImage alloc] initWithSize: newImageSize]; - - [newImage lockFocus]; - - NSAffineTransform* tm = [NSAffineTransform transform]; - [tm translateXBy:newImageSize.width/2 yBy:newImageSize.height/2]; - [tm rotateByDegrees:-90]; - [tm translateXBy:-newImageSize.width/2 yBy:-newImageSize.height/2]; - [tm concat]; - - - [image drawInRect:NSMakeRect(0,0,newImageSize.width, newImageSize.height) - fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; - - [newImage unlockFocus]; - return [newImage autorelease]; -} - -@end - -class wxDisclosureTriangleCocoaImpl : public wxWidgetCocoaImpl -{ -public : - wxDisclosureTriangleCocoaImpl(wxWindowMac* peer , WXWidget w) : - wxWidgetCocoaImpl(peer, w) - { - } - - ~wxDisclosureTriangleCocoaImpl() - { - } - - virtual void controlAction(WXWidget slf, void* _cmd, void *sender) - { - wxDisclosureNSButton* db = (wxDisclosureNSButton*)m_osxView; - [db toggle]; - wxWidgetCocoaImpl::controlAction(slf, _cmd, sender ); - } -}; - -wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer, - wxWindowMac* WXUNUSED(parent), - wxWindowID winid, - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long style, - long WXUNUSED(extraStyle)) -{ - NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; - wxDisclosureNSButton* v = [[wxDisclosureNSButton alloc] initWithFrame:r]; - if ( !label.empty() ) - [v setTitle:wxCFStringRef(label).AsNSString()]; - - SetBezelStyleFromBorderFlags(v, style, winid, label); - - return new wxDisclosureTriangleCocoaImpl( wxpeer, v ); -} diff --git a/Externals/wxWidgets3/src/osx/cocoa/checkbox.mm b/Externals/wxWidgets3/src/osx/cocoa/checkbox.mm index 941ea79a5a..8a8dddeabd 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/checkbox.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/checkbox.mm @@ -28,6 +28,8 @@ wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, wxNSButton* v = [[wxNSButton alloc] initWithFrame:r]; [v setButtonType:NSSwitchButton]; + if (style & wxALIGN_RIGHT) + [v setImagePosition:NSImageRight]; if (style & wxCHK_3STATE) [v setAllowsMixedState:YES]; diff --git a/Externals/wxWidgets3/src/osx/cocoa/choice.mm b/Externals/wxWidgets3/src/osx/cocoa/choice.mm index 0068d5d31d..26dccc9d4b 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/choice.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/choice.mm @@ -63,7 +63,7 @@ public: { } - void GetLayoutInset(int &left , int &top , int &right, int &bottom) const + void GetLayoutInset(int &left , int &top , int &right, int &bottom) const wxOVERRIDE { left = top = right = bottom = 0; NSControlSize size = NSRegularControlSize; @@ -81,12 +81,12 @@ public: case NSRegularControlSize: left = right = 3; top = 2; - bottom = 4; + bottom = 3; break; case NSSmallControlSize: left = right = 3; top = 1; - bottom = 4; + bottom = 3; break; case NSMiniControlSize: left = 1; diff --git a/Externals/wxWidgets3/src/osx/cocoa/colour.mm b/Externals/wxWidgets3/src/osx/cocoa/colour.mm index 73df7fbf01..aca75b9174 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/colour.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/colour.mm @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/osx/cocoa/colour.mm -// Purpose: Cocoa additions to wxColour class -// Author: Kevin Ollivier -// Modified by: -// Created: 2009-10-31 -// Copyright: (c) Kevin Ollivier +// Purpose: Conversions between NSColor and wxColour +// Author: Vadim Zeitlin +// Created: 2015-11-26 (completely replacing the old version of the file) +// Copyright: (c) 2015 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,31 +11,96 @@ #include "wx/colour.h" -#ifndef WX_PRECOMP - #include "wx/gdicmn.h" -#endif - #include "wx/osx/private.h" +// Helper function to avoid writing too many casts in wxColour ctor. +static inline wxColour::ChannelType NSColorChannelToWX(CGFloat c) +{ + return static_cast(c * 255 + 0.5); +} + wxColour::wxColour(WX_NSColor col) { - size_t noComp = [col numberOfComponents]; - - CGFloat components[4]; - CGFloat *p; - if ( noComp < 1 || noComp > WXSIZEOF(components) ) + // Simplest case is when we can directly get the RGBA components: + if ( NSColor* colRGBA = [col colorUsingColorSpaceName:NSCalibratedRGBColorSpace] ) { - // TODO verify whether we really are on a RGB color space - m_alpha = wxALPHA_OPAQUE; - [col getComponents: components]; - p = components; - } - else // Unsupported colour format. - { - p = NULL; + InitRGBA + ( + NSColorChannelToWX([colRGBA redComponent]), + NSColorChannelToWX([colRGBA greenComponent]), + NSColorChannelToWX([colRGBA blueComponent]), + NSColorChannelToWX([colRGBA alphaComponent]) + ); + return; } - InitFromComponents(components, noComp); + // Some colours use patterns, we can handle them with the help of CGColorRef + if ( NSColor* colPat = [col colorUsingColorSpaceName:NSPatternColorSpace] ) + { + NSImage* const nsimage = [colPat patternImage]; + if ( nsimage ) + { + NSSize size = [nsimage size]; + NSRect r = NSMakeRect(0, 0, size.width, size.height); + CGImageRef cgimage = [nsimage CGImageForProposedRect:&r context:nil hints:nil]; + if ( cgimage ) + { + // Callbacks for CGPatternCreate() + struct PatternCreateCallbacks + { + static void Draw(void *info, CGContextRef ctx) + { + CGImageRef image = (CGImageRef) info; + CGContextDrawImage + ( + ctx, + CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), + image + ); + } + + static void Release(void * WXUNUSED(info)) + { + // Do not release the image here, we don't own it as it + // comes from NSImage. + } + }; + + const CGPatternCallbacks callbacks = + { + /* version: */ 0, + &PatternCreateCallbacks::Draw, + &PatternCreateCallbacks::Release + }; + + CGPatternRef pattern = CGPatternCreate + ( + cgimage, + CGRectMake(0, 0, size.width, size.height), + CGAffineTransformMake(1, 0, 0, 1, 0, 0), + size.width, + size.height, + kCGPatternTilingConstantSpacing, + /* isColored: */ true, + &callbacks + ); + CGColorSpaceRef space = CGColorSpaceCreatePattern(NULL); + CGFloat components[1] = { 1.0 }; + CGColorRef cgcolor = CGColorCreateWithPattern(space, pattern, components); + CGColorSpaceRelease(space); + CGPatternRelease(pattern); + + InitCGColorRef(cgcolor); + return; + } + } + } + + // Don't assert here, this will more likely than not result in a crash as + // colours are often created in drawing code which will be called again + // when the assert dialog is shown, resulting in a recursive assertion + // failure and, hence, a crash. + NSLog(@"Failed to convert NSColor \"%@\" to wxColour.", col); } WX_NSColor wxColour::OSXGetNSColor() const diff --git a/Externals/wxWidgets3/src/osx/cocoa/combobox.mm b/Externals/wxWidgets3/src/osx/cocoa/combobox.mm index 112b37b43e..0a4acd1190 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/combobox.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/combobox.mm @@ -24,7 +24,7 @@ // work in progress -@interface wxNSTableDataSource : NSObject wxOSX_10_6_AND_LATER() +@interface wxNSTableDataSource : NSObject { wxNSComboBoxControl* impl; } @@ -90,6 +90,51 @@ } } +- (void)controlTextDidEndEditing:(NSNotification *) aNotification +{ + wxUnusedVar(aNotification); + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if ( impl ) + { + wxNSTextFieldControl* timpl = dynamic_cast(impl); + if ( timpl ) + timpl->UpdateInternalSelectionFromEditor(fieldEditor); + impl->DoNotifyFocusLost(); + } +} + +- (void)comboBoxWillPopUp:(NSNotification *)notification +{ + wxUnusedVar(notification); + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if( impl && impl->ShouldSendEvents() ) + { + wxComboBox* wxpeer = static_cast(impl->GetWXPeer()); + if( wxpeer ) + { + wxCommandEvent event(wxEVT_COMBOBOX_DROPDOWN, wxpeer->GetId()); + event.SetEventObject( wxpeer ); + wxpeer->GetEventHandler()->ProcessEvent( event ); + } + } +} + +- (void)comboBoxWillDismiss:(NSNotification *)notification +{ + wxUnusedVar(notification); + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if( impl && impl->ShouldSendEvents() ) + { + wxComboBox* wxpeer = static_cast(impl->GetWXPeer()); + if( wxpeer ) + { + wxCommandEvent event(wxEVT_COMBOBOX_CLOSEUP, wxpeer->GetId()); + event.SetEventObject( wxpeer ); + wxpeer->GetEventHandler()->ProcessEvent( event ); + } + } +} + - (void)comboBoxSelectionDidChange:(NSNotification *)notification { wxUnusedVar(notification); diff --git a/Externals/wxWidgets3/src/osx/cocoa/dataview.mm b/Externals/wxWidgets3/src/osx/cocoa/dataview.mm index e9df8f2063..28fad9a5b2 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/dataview.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/dataview.mm @@ -179,7 +179,8 @@ inline wxDataViewItem wxDataViewItemFromMaybeNilItem(id item) // not just some arbitrary object, so we serialize the pointer into the // string. Notice the use of NSInteger which is big enough to store a // pointer in both 32 and 64 bit builds. - return [NSString stringWithFormat:@"%lu", reinterpret_cast(column)]; + return [NSString stringWithFormat:@"%lu", + (unsigned long)reinterpret_cast(column)]; } -(id) initWithColumnPointer:(const wxDataViewColumn*)column @@ -494,6 +495,8 @@ initWithModelPtr:(wxDataViewModel*)initModelPtr currentParentItem = nil; + sortDescriptors = nil; + children = [[NSMutableArray alloc] init]; items = [[NSMutableSet alloc] init]; } @@ -502,6 +505,8 @@ initWithModelPtr:(wxDataViewModel*)initModelPtr -(void) dealloc { + [sortDescriptors release]; + [currentParentItem release]; [children release]; @@ -1034,11 +1039,6 @@ outlineView:(NSOutlineView*)outlineView // // children handling // --(void) appendChild:(wxPointerObject*)item -{ - [children addObject:item]; -} - -(void) clearChildren { [children removeAllObjects]; @@ -1054,11 +1054,6 @@ outlineView:(NSOutlineView*)outlineView return [children count]; } --(void) removeChild:(NSUInteger)index -{ - [children removeObjectAtIndex:index]; -} - // // buffer handling // @@ -1629,6 +1624,29 @@ outlineView:(NSOutlineView*)outlineView dvc->GetEventHandler()->ProcessEvent(event); } +// Default enter key behaviour is to begin cell editing. Subclass keyDown to +// provide a keyboard wxEVT_DATAVIEW_ITEM_ACTIVATED event and allow the NSEvent +// to pass if the wxEvent is not processed. +- (void)keyDown:(NSEvent *)event +{ + if( [[event charactersIgnoringModifiers] + characterAtIndex: 0] == NSCarriageReturnCharacter ) + { + wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl(); + + wxDataViewEvent eventDV( wxEVT_DATAVIEW_ITEM_ACTIVATED, dvc->GetId() ); + eventDV.SetEventObject(dvc); + eventDV.SetItem( wxDataViewItem( [[self itemAtRow:[self selectedRow]] pointer]) ); + eventDV.SetModel( dvc->GetModel() ); + + if ( !dvc->GetEventHandler()->ProcessEvent(eventDV) ) + [super keyDown:event]; + } + else + { + [super keyDown:event]; // all other keys + } +} // // contextual menus @@ -1751,7 +1769,7 @@ outlineView:(NSOutlineView*)outlineView return NO; } --(void) outlineView:(wxCocoaOutlineView*)outlineView +-(void) outlineView:(NSOutlineView*)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn item:(id)item @@ -1778,18 +1796,12 @@ outlineView:(NSOutlineView*)outlineView data->SetItem(item); data->SetItemCell(cell); - // use the attributes: notice that we need to do this whether we have them - // or not as even if this cell doesn't have any attributes, the previous - // one might have had some and then we need to reset them back to default - wxDataViewItemAttr attr; - model->GetAttr(dvItem, colIdx, attr); - renderer->OSXApplyAttr(attr); - - // set the state (enabled/disabled) of the item - renderer->OSXApplyEnabled(model->IsEnabled(dvItem, colIdx)); - - // and finally do draw it - renderer->MacRender(); + // check if we have anything to render + if ( renderer->PrepareForItem(model, dvItem, colIdx) ) + { + // and do render it in this case + renderer->MacRender(); + } } // @@ -1881,15 +1893,16 @@ outlineView:(NSOutlineView*)outlineView dvc->FinishCustomItemEditing(); // now, send the event: - wxDataViewEvent - event(wxEVT_DATAVIEW_ITEM_EDITING_STARTED,dvc->GetId()); - - event.SetEventObject(dvc); - event.SetItem( - wxDataViewItemFromItem([self itemAtRow:currentlyEditedRow])); - event.SetColumn(dvc->GetColumnPosition(col)); - event.SetDataViewColumn(col); - dvc->GetEventHandler()->ProcessEvent(event); + wxDataViewRenderer* const renderer = col->GetRenderer(); + if ( renderer ) + { + renderer->NotifyEditingStarted + ( + wxDataViewItemFromItem([self itemAtRow:currentlyEditedRow]) + ); + } + //else: we should always have a renderer but don't crash if for some + // unfathomable reason we don't have it } -(void) textDidEndEditing:(NSNotification*)notification @@ -2044,6 +2057,10 @@ bool wxCocoaDataViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* co // specified position the column is first appended and - if necessary - // moved to its final position: [m_OutlineView addTableColumn:nativeColumn]; + + // it is owned, and kepy alive, by m_OutlineView now + [nativeColumn release]; + if (pos != static_cast([m_OutlineView numberOfColumns]-1)) [m_OutlineView moveColumn:[m_OutlineView numberOfColumns]-1 toColumn:pos]; @@ -2657,11 +2674,14 @@ wxDataViewRenderer::OSXOnCellChanged(NSObject *object, return; } + if ( !Validate(value) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); model->ChangeValue(value, item, col); } -void wxDataViewRenderer::OSXApplyAttr(const wxDataViewItemAttr& attr) +void wxDataViewRenderer::SetAttr(const wxDataViewItemAttr& attr) { wxDataViewRendererNativeData * const data = GetNativeData(); NSCell * const cell = data->GetItemCell(); @@ -2710,11 +2730,7 @@ void wxDataViewRenderer::OSXApplyAttr(const wxDataViewItemAttr& attr) data->SaveOriginalTextColour([(id)cell textColor]); } - const wxColour& c = attr.GetColour(); - colText = [NSColor colorWithCalibratedRed:c.Red() / 255. - green:c.Green() / 255. - blue:c.Blue() / 255. - alpha:c.Alpha() / 255.]; + colText = attr.GetColour().OSXGetNSColor(); } } @@ -2730,12 +2746,12 @@ void wxDataViewRenderer::OSXApplyAttr(const wxDataViewItemAttr& attr) [(id)cell setTextColor:colText]; } -void wxDataViewRenderer::OSXApplyEnabled(bool enabled) +void wxDataViewRenderer::SetEnabled(bool enabled) { [GetNativeData()->GetItemCell() setEnabled:enabled]; } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer, wxDataViewRendererBase); // --------------------------------------------------------- // wxDataViewCustomRenderer @@ -2747,7 +2763,9 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer(const wxString& varianttype, m_editorCtrlPtr(NULL), m_DCPtr(NULL) { - SetNativeData(new wxDataViewRendererNativeData([[wxCustomCell alloc] init])); + wxCustomCell* cell = [[wxCustomCell alloc] init]; + SetNativeData(new wxDataViewRendererNativeData(cell)); + [cell release]; } bool wxDataViewCustomRenderer::MacRender() @@ -2756,19 +2774,7 @@ bool wxDataViewCustomRenderer::MacRender() return true; } -void wxDataViewCustomRenderer::OSXApplyAttr(const wxDataViewItemAttr& attr) -{ - // simply save the attribute so that it could be reused from our Render() - SetAttr(attr); - - // it's not necessary to call the base class version which sets the cell - // properties to correspond to this attribute because we currently don't - // use any NSCell methods in custom renderers anyhow but if we ever start - // doing this (e.g. override RenderText() here to use NSTextFieldCell - // methods), then we should pass it on to wxDataViewRenderer here -} - -IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewTextRenderer @@ -2789,16 +2795,8 @@ wxDataViewTextRenderer::wxDataViewTextRenderer(const wxString& varianttype, bool wxDataViewTextRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - [GetNativeData()->GetItemCell() setObjectValue:wxCFStringRef(GetValue().GetString()).AsNSString()]; - return true; - } - else - { - wxFAIL_MSG(wxString("Text renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; - } + [GetNativeData()->GetItemCell() setObjectValue:wxCFStringRef(GetValue().GetString()).AsNSString()]; + return true; } void @@ -2806,11 +2804,15 @@ wxDataViewTextRenderer::OSXOnCellChanged(NSObject *value, const wxDataViewItem& item, unsigned col) { + wxVariant valueText(ObjectToString(value)); + if ( !Validate(valueText) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); - model->ChangeValue(ObjectToString(value), item, col); + model->ChangeValue(valueText, item, col); } -IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewTextRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewBitmapRenderer @@ -2836,8 +2838,6 @@ wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(const wxString& varianttype, // In all other cases the method returns 'false'. bool wxDataViewBitmapRenderer::MacRender() { - wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString("Bitmap renderer cannot render value; value type: ") << GetValue().GetType()); - wxBitmap bitmap; bitmap << GetValue(); @@ -2846,7 +2846,7 @@ bool wxDataViewBitmapRenderer::MacRender() return true; } -IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewBitmapRenderer, wxDataViewRenderer); // ------------------------------------- // wxDataViewChoiceRenderer @@ -2876,25 +2876,32 @@ wxDataViewChoiceRenderer::OSXOnCellChanged(NSObject *value, { // At least under OS X 10.7 we get the index of the item selected and not // its string. + const long choiceIndex = ObjectToLong(value); + + // We can receive -1 if the selection was cancelled, just ignore it. + if ( choiceIndex == -1 ) + return; + + // If it's not -1, it must be valid, but avoid crashing in GetChoice() + // below if it isn't, for some reason. + wxCHECK_RET( choiceIndex >= 0 && (size_t)choiceIndex < GetChoices().size(), + wxS("Choice index out of range.") ); + + wxVariant valueChoice(GetChoice(choiceIndex)); + if ( !Validate(valueChoice) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); - model->ChangeValue(GetChoice(ObjectToLong(value)), item, col); + model->ChangeValue(valueChoice, item, col); } bool wxDataViewChoiceRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - [((NSPopUpButtonCell*) GetNativeData()->GetItemCell()) selectItemWithTitle:[[wxCFStringRef(GetValue().GetString()).AsNSString() retain] autorelease]]; - return true; - } - else - { - wxFAIL_MSG(wxString("Choice renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; - } + [((NSPopUpButtonCell*) GetNativeData()->GetItemCell()) selectItemWithTitle:[[wxCFStringRef(GetValue().GetString()).AsNSString() retain] autorelease]]; + return true; } -IMPLEMENT_CLASS(wxDataViewChoiceRenderer,wxDataViewRenderer) +wxIMPLEMENT_CLASS(wxDataViewChoiceRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewDateRenderer @@ -2922,61 +2929,50 @@ wxDataViewDateRenderer::wxDataViewDateRenderer(const wxString& varianttype, bool wxDataViewDateRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - if (GetValue().GetDateTime().IsValid()) - { - // -- find best fitting style to show the date -- - // as the style should be identical for all cells a reference date - // instead of the actual cell's date value is used for all cells; - // this reference date is stored in the renderer's native data - // section for speed purposes; otherwise, the reference date's - // string has to be recalculated for each item that may become - // timewise long if a lot of rows using dates exist; the algorithm - // has the preference to display as much information as possible - // in the first instance; but as this is often impossible due to - // space restrictions the style is shortened per loop; finally, if - // the shortest time and date format does not fit into the cell - // the time part is dropped; remark: the time part itself is not - // modified per iteration loop and only uses the short style, - // means that only the hours and minutes are being shown - - // GetObject() returns a date for testing the size of a date object - [GetNativeData()->GetItemCell() setObjectValue:GetNativeData()->GetObject()]; - [[GetNativeData()->GetItemCell() formatter] setTimeStyle:NSDateFormatterShortStyle]; - for (int dateFormatterStyle=4; dateFormatterStyle>0; --dateFormatterStyle) - { - [[GetNativeData()->GetItemCell() formatter] setDateStyle:(NSDateFormatterStyle)dateFormatterStyle]; - if (dateFormatterStyle == 1) - { - // if the shortest style for displaying the date and time - // is too long to be fully visible remove the time part of - // the date: - if ([GetNativeData()->GetItemCell() cellSize].width > [GetNativeData()->GetColumnPtr() width]) - [[GetNativeData()->GetItemCell() formatter] setTimeStyle:NSDateFormatterNoStyle]; - { - // basically not necessary as the loop would end anyway - // but let's save the last comparison - break; - } - } - else if ([GetNativeData()->GetItemCell() cellSize].width <= [GetNativeData()->GetColumnPtr() width]) - break; - } - // set data (the style is set by the previous loop); on OSX the - // date has to be specified with respect to UTC; in wxWidgets the - // date is always entered in the local timezone; so, we have to do - // a conversion from the local to UTC timezone when adding the - // seconds to 1970-01-01 UTC: - [GetNativeData()->GetItemCell() setObjectValue:[NSDate dateWithTimeIntervalSince1970:GetValue().GetDateTime().ToUTC().Subtract(wxDateTime(1,wxDateTime::Jan,1970)).GetSeconds().ToDouble()]]; - } + if (!GetValue().GetDateTime().IsValid()) return true; - } - else + + // -- find best fitting style to show the date -- + // as the style should be identical for all cells a reference date + // instead of the actual cell's date value is used for all cells; + // this reference date is stored in the renderer's native data + // section for speed purposes; otherwise, the reference date's + // string has to be recalculated for each item that may become + // timewise long if a lot of rows using dates exist; the algorithm + // has the preference to display as much information as possible + // in the first instance; but as this is often impossible due to + // space restrictions the style is shortened per loop; finally, if + // the shortest time and date format does not fit into the cell + // the time part is dropped + + // GetObject() returns a date for testing the size of a date object + [GetNativeData()->GetItemCell() setObjectValue:GetNativeData()->GetObject()]; + + bool formatFound = false; + int dateFormatterStyle = kCFDateFormatterFullStyle; + while ( !formatFound && (dateFormatterStyle > 0) ) { - wxFAIL_MSG(wxString("Date renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; + int timeFormatterStyle = dateFormatterStyle; + + while ( !formatFound && (timeFormatterStyle >= dateFormatterStyle - 1) ) + { + [[GetNativeData()->GetItemCell() formatter] setDateStyle:(NSDateFormatterStyle)dateFormatterStyle]; + [[GetNativeData()->GetItemCell() formatter] setTimeStyle:(NSDateFormatterStyle)timeFormatterStyle]; + if ( [GetNativeData()->GetItemCell() cellSize].width <= [GetNativeData()->GetColumnPtr() width] ) + formatFound = true; + else + --timeFormatterStyle; + } + --dateFormatterStyle; } + // set data (the style is set by the previous loop); on OSX the + // date has to be specified with respect to UTC; in wxWidgets the + // date is always entered in the local timezone; so, we have to do + // a conversion from the local to UTC timezone when adding the + // seconds to 1970-01-01 UTC: + [GetNativeData()->GetItemCell() setObjectValue:[NSDate dateWithTimeIntervalSince1970:GetValue().GetDateTime().ToUTC().Subtract(wxDateTime(1,wxDateTime::Jan,1970)).GetSeconds().ToDouble()]]; + + return true; } void @@ -2984,11 +2980,15 @@ wxDataViewDateRenderer::OSXOnCellChanged(NSObject *value, const wxDataViewItem& item, unsigned col) { + wxVariant valueDate(ObjectToDate(value)); + if ( !Validate(valueDate) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); - model->ChangeValue(ObjectToDate(value), item, col); + model->ChangeValue(valueDate, item, col); } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewIconTextRenderer @@ -3009,26 +3009,18 @@ wxDataViewIconTextRenderer::wxDataViewIconTextRenderer(const wxString& variantty bool wxDataViewIconTextRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - wxDataViewIconText iconText; + wxDataViewIconText iconText; - wxImageTextCell* cell; + wxImageTextCell* cell; - cell = (wxImageTextCell*) GetNativeData()->GetItemCell(); - iconText << GetValue(); - if (iconText.GetIcon().IsOk()) - [cell setImage:[[wxBitmap(iconText.GetIcon()).GetNSImage() retain] autorelease]]; - else - [cell setImage:nil]; - [cell setStringValue:[[wxCFStringRef(iconText.GetText()).AsNSString() retain] autorelease]]; - return true; - } + cell = (wxImageTextCell*) GetNativeData()->GetItemCell(); + iconText << GetValue(); + if (iconText.GetIcon().IsOk()) + [cell setImage:[[wxBitmap(iconText.GetIcon()).GetNSImage() retain] autorelease]]; else - { - wxFAIL_MSG(wxString("Icon & text renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; - } + [cell setImage:nil]; + [cell setStringValue:[[wxCFStringRef(iconText.GetText()).AsNSString() retain] autorelease]]; + return true; } void @@ -3039,11 +3031,14 @@ wxDataViewIconTextRenderer::OSXOnCellChanged(NSObject *value, wxVariant valueIconText; valueIconText << wxDataViewIconText(ObjectToString(value)); + if ( !Validate(valueIconText) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); model->ChangeValue(valueIconText, item, col); } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewToggleRenderer @@ -3066,16 +3061,8 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer(const wxString& varianttype, bool wxDataViewToggleRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - [GetNativeData()->GetItemCell() setIntValue:GetValue().GetLong()]; - return true; - } - else - { - wxFAIL_MSG(wxString("Toggle renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; - } + [GetNativeData()->GetItemCell() setIntValue:GetValue().GetLong()]; + return true; } void @@ -3083,11 +3070,15 @@ wxDataViewToggleRenderer::OSXOnCellChanged(NSObject *value, const wxDataViewItem& item, unsigned col) { + wxVariant valueToggle(ObjectToBool(value)); + if ( !Validate(valueToggle) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); - model->ChangeValue(ObjectToBool(value), item, col); + model->ChangeValue(valueToggle, item, col); } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewProgressRenderer @@ -3111,16 +3102,8 @@ wxDataViewProgressRenderer::wxDataViewProgressRenderer(const wxString& label, bool wxDataViewProgressRenderer::MacRender() { - if (GetValue().GetType() == GetVariantType()) - { - [GetNativeData()->GetItemCell() setIntValue:GetValue().GetLong()]; - return true; - } - else - { - wxFAIL_MSG(wxString("Progress renderer cannot render value because of wrong value type; value type: ") << GetValue().GetType()); - return false; - } + [GetNativeData()->GetItemCell() setIntValue:GetValue().GetLong()]; + return true; } void @@ -3128,11 +3111,15 @@ wxDataViewProgressRenderer::OSXOnCellChanged(NSObject *value, const wxDataViewItem& item, unsigned col) { + wxVariant valueProgress(ObjectToLong(value)); + if ( !Validate(valueProgress) ) + return; + wxDataViewModel *model = GetOwner()->GetOwner()->GetModel(); - model->ChangeValue(ObjectToLong(value), item, col); + model->ChangeValue(valueProgress, item, col); } -IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer) +wxIMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer, wxDataViewRenderer); // --------------------------------------------------------- // wxDataViewColumn @@ -3287,20 +3274,24 @@ void wxDataViewColumn::SetWidth(int width) { m_width = width; + if ( !GetOwner() ) + { + // can't set the real width yet + return; + } + switch ( width ) { case wxCOL_WIDTH_AUTOSIZE: - if ( GetOwner() ) { wxCocoaDataViewControl *peer = static_cast(GetOwner()->GetPeer()); peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this)); break; } - // fall through if not yet settable case wxCOL_WIDTH_DEFAULT: width = wxDVC_DEFAULT_WIDTH; - // fall through + wxFALLTHROUGH; default: [m_NativeDataPtr->GetNativeColumnPtr() setWidth:width]; diff --git a/Externals/wxWidgets3/src/osx/cocoa/datetimectrl.mm b/Externals/wxWidgets3/src/osx/cocoa/datetimectrl.mm index 575a8a2b48..19ca20989b 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/datetimectrl.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/datetimectrl.mm @@ -75,7 +75,7 @@ public: { } - virtual void SetDateTime(const wxDateTime& dt) + virtual void SetDateTime(const wxDateTime& dt) wxOVERRIDE { wxDateTime dtFrom, dtTo; @@ -85,12 +85,12 @@ public: [View() setDateValue: NSDateFromWX(dt)]; } - virtual wxDateTime GetDateTime() const + virtual wxDateTime GetDateTime() const wxOVERRIDE { return NSDateToWX([View() dateValue]); } - virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) + virtual void SetDateRange(const wxDateTime& dt1, const wxDateTime& dt2) wxOVERRIDE { // Note that passing nil is ok here so we don't need to test for the // dates validity. @@ -98,7 +98,7 @@ public: [View() setMaxDate: NSDateFromWX(dt2)]; } - virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) + virtual bool GetDateRange(wxDateTime* dt1, wxDateTime* dt2) wxOVERRIDE { bool hasLimits = false; if ( dt1 ) @@ -118,7 +118,7 @@ public: virtual void controlAction(WXWidget WXUNUSED(slf), void* WXUNUSED(cmd), - void* WXUNUSED(sender)) + void* WXUNUSED(sender)) wxOVERRIDE { wxWindow* const wxpeer = GetWXPeer(); if ( wxpeer ) @@ -128,6 +128,26 @@ public: } } + virtual void Enable(bool enable = true) wxOVERRIDE + { + wxNSDatePicker* const nsdatePicker = View(); + + [nsdatePicker setEnabled: enable]; + + if ( enable ) + { + wxWindow* const wxpeer = GetWXPeer(); + if ( wxpeer ) + [nsdatePicker setTextColor: wxpeer->GetForegroundColour().OSXGetNSColor()]; + else + [nsdatePicker setTextColor: [NSColor controlTextColor]]; + } + else + { + [nsdatePicker setTextColor: [NSColor disabledControlTextColor]]; + } + } + private: wxNSDatePicker* View() const { @@ -170,10 +190,17 @@ wxDateTimeWidgetImpl::CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer, [v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle]; + // Avoid a disabled looking transparent background for the text cells. + [v setDrawsBackground: YES]; + if ( dt.IsValid() ) { [v setDateValue: NSDateFromWX(dt)]; } + else + { + [v setDateValue: [NSDate date]]; + } wxDateTimeWidgetImpl* c = new wxDateTimeWidgetCocoaImpl(wxpeer, v); #if !wxOSX_USE_NATIVE_FLIPPED diff --git a/Externals/wxWidgets3/src/osx/cocoa/dirdlg.mm b/Externals/wxWidgets3/src/osx/cocoa/dirdlg.mm index ef8886ac69..c6a4dc9139 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/dirdlg.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/dirdlg.mm @@ -35,7 +35,7 @@ #include "wx/osx/private.h" -IMPLEMENT_CLASS(wxDirDialog, wxDialog) +wxIMPLEMENT_CLASS(wxDirDialog, wxDialog); void wxDirDialog::Init() { @@ -76,6 +76,12 @@ WX_NSOpenPanel wxDirDialog::OSXCreatePanel() const return oPanel; } +// We use several deprecated methods of NSOpenPanel in the code below, we +// should replace them with newer equivalents now that we don't support OS X +// versions which didn't have them (pre 10.6), but until then, get rid of +// the warning. +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + void wxDirDialog::ShowWindowModal() { wxNonOwnedWindow* parentWindow = NULL; @@ -133,4 +139,6 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode) SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED ); } +wxGCC_WARNING_RESTORE(deprecated-declarations) + #endif // wxUSE_DIRDLG diff --git a/Externals/wxWidgets3/src/osx/cocoa/dnd.mm b/Externals/wxWidgets3/src/osx/cocoa/dnd.mm index 47faae9b16..b63834a714 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/dnd.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/dnd.mm @@ -56,11 +56,15 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code) BOOL dragFinished; int resultCode; wxDropSource* impl; + + // Flags for drag and drop operations (wxDrag_* ). + int m_dragFlags; } -- (void)setImplementation: (wxDropSource *)dropSource; +- (void)setImplementation:(wxDropSource *)dropSource flags:(int)flags; - (BOOL)finished; - (NSDragOperation)code; +- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)forLocal; - (void)draggedImage:(NSImage *)anImage movedTo:(NSPoint)aPoint; - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; @end @@ -73,12 +77,14 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code) dragFinished = NO; resultCode = NSDragOperationNone; impl = 0; + m_dragFlags = wxDrag_CopyOnly; return self; } -- (void)setImplementation: (wxDropSource *)dropSource +- (void)setImplementation:(wxDropSource *)dropSource flags:(int)flags { impl = dropSource; + m_dragFlags = flags; } - (BOOL)finished @@ -91,6 +97,31 @@ wxDragResult NSDragOperationToWxDragResult(NSDragOperation code) return resultCode; } +- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)forLocal +{ + /* + By default drag targets receive a mask of NSDragOperationAll (0xf) + which, despite its name, does not include the later added + NSDragOperationMove (0x10) that sometimes is wanted. + Use NSDragOperationEvery instead because it includes all flags. + + Note that this, compared to the previous behaviour, adds + NSDragOperationDelete to the mask which seems harmless. + + We are also keeping NSDragOperationLink and NSDragOperationPrivate + in to preserve previous behaviour. + */ + + NSDragOperation allowedDragOperations = NSDragOperationEvery; + + if (m_dragFlags == wxDrag_CopyOnly) + { + allowedDragOperations &= ~NSDragOperationMove; + } + + return allowedDragOperations; +} + - (void)draggedImage:(NSImage *)anImage movedTo:(NSPoint)aPoint { wxUnusedVar( anImage ); @@ -186,7 +217,7 @@ wxDropSource* wxDropSource::GetCurrentDropSource() return gCurrentSource; } -wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) +wxDragResult wxDropSource::DoDragDrop(int flags) { wxASSERT_MSG( m_data, wxT("Drop source: no data") ); @@ -240,7 +271,7 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) DropSourceDelegate* delegate = [[DropSourceDelegate alloc] init]; - [delegate setImplementation: this]; + [delegate setImplementation:this flags:flags]; [view dragImage:image at:p offset:NSMakeSize(0.0,0.0) event: theEvent pasteboard: pboard source:delegate slideBack: NO]; diff --git a/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm b/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm index 3e43d778dc..5877780322 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm @@ -32,9 +32,24 @@ #include "wx/log.h" #include "wx/scopeguard.h" +#include "wx/vector.h" +#include "wx/hashmap.h" #include "wx/osx/private.h" +struct wxModalSessionStackElement +{ + WXWindow dummyWindow; + void* modalSession; +}; + +typedef wxVector wxModalSessionStack; + +WX_DECLARE_HASH_MAP(wxGUIEventLoop*, wxModalSessionStack*, wxPointerHash, wxPointerEqual, + wxModalSessionStackMap); + +static wxModalSessionStackMap gs_modalSessionStackMap; + // ============================================================================ // wxEventLoop implementation // ============================================================================ @@ -110,6 +125,7 @@ wxGUIEventLoop::wxGUIEventLoop() wxGUIEventLoop::~wxGUIEventLoop() { + wxASSERT( gs_modalSessionStackMap.find( this ) == gs_modalSessionStackMap.end() ); wxASSERT( m_modalSession == nil ); wxASSERT( m_dummyWindow == nil ); wxASSERT( m_modalNestedLevel == 0 ); @@ -202,19 +218,18 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) { if ( [[NSApplication sharedApplication] nextEventMatchingMask: NSAnyEventMask - untilDate: nil + untilDate: [NSDate dateWithTimeIntervalSinceNow: timeout/1000.0] inMode: NSDefaultRunLoopMode dequeue: NO] != nil ) return 1; return -1; } - case NSRunStoppedResponse: case NSRunAbortedResponse: return -1; default: - wxFAIL_MSG("unknown response code"); + // nested native loops may return other codes here, just ignore them break; } return -1; @@ -223,7 +238,7 @@ int wxGUIEventLoop::DoDispatchTimeout(unsigned long timeout) { NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate dateWithTimeIntervalSinceNow: timeout/1000] + untilDate:[NSDate dateWithTimeIntervalSinceNow: timeout/1000.0] inMode:NSDefaultRunLoopMode dequeue: YES]; @@ -397,6 +412,8 @@ wxModalEventLoop::wxModalEventLoop(WXWindow modalNativeWindow) // END move into a evtloop_osx.cpp +#define OSX_USE_MODAL_SESSION 1 + void wxModalEventLoop::OSXDoRun() { wxMacAutoreleasePool pool; @@ -412,8 +429,18 @@ void wxModalEventLoop::OSXDoRun() [NSApp sendEvent:event]; } } - - [NSApp runModalForWindow:m_modalNativeWindow]; +#if OSX_USE_MODAL_SESSION + if ( m_modalWindow ) + { + BeginModalSession(m_modalWindow); + wxCFEventLoop::OSXDoRun(); + EndModalSession(); + } + else +#endif + { + [NSApp runModalForWindow:m_modalNativeWindow]; + } } void wxModalEventLoop::OSXDoStop() @@ -421,58 +448,38 @@ void wxModalEventLoop::OSXDoStop() [NSApp abortModal]; } -// we need our own version of ProcessIdle here in order to -// avoid deletion of pending objects, because ProcessIdle is running -// to soon and ends up in destroying the object too early, ie before -// a stack allocated instance is removed resulting in double deletes -bool wxModalEventLoop::ProcessIdle() -{ - bool needMore = false; - if ( wxTheApp ) - { - // synthesize an idle event and check if more of them are needed - wxIdleEvent event; - event.SetEventObject(wxTheApp); - wxTheApp->ProcessEvent(event); - -#if wxUSE_LOG - // flush the logged messages if any (do this after processing the events - // which could have logged new messages) - wxLog::FlushActive(); -#endif - needMore = event.MoreRequested(); - - wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst(); - while (node) - { - wxWindow* win = node->GetData(); - - // 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(); - } - - wxUpdateUIEvent::ResetUpdateTime(); - - } - return needMore; -} - void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) { WXWindow nsnow = nil; - if ( m_modalNestedLevel > 0 ) + m_modalNestedLevel++; + if ( m_modalNestedLevel > 1 ) { - wxASSERT_MSG( m_modalWindow == modalWindow, "Nested Modal Sessions must be based on same window"); - m_modalNestedLevel++; - return; + wxModalSessionStack* stack = NULL; + + if ( m_modalNestedLevel == 2 ) + { + stack = new wxModalSessionStack; + gs_modalSessionStackMap[this] = stack; + } + else + { + stack = gs_modalSessionStackMap[this]; + } + + wxModalSessionStackElement element; + element.dummyWindow = m_dummyWindow; + element.modalSession = m_modalSession; + + stack->push_back(element); + + // shortcut if nothing changed in this level + + if ( m_modalWindow == modalWindow ) + return; } m_modalWindow = modalWindow; - m_modalNestedLevel = 1; if ( modalWindow ) { @@ -494,8 +501,8 @@ void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow ) backing:NSBackingStoreBuffered defer:YES ]; - [nsnow orderOut:nil]; m_dummyWindow = nsnow; + [nsnow orderOut:nil]; } m_modalSession = [NSApp beginModalSessionForWindow:nsnow]; wxASSERT_MSG(m_modalSession != NULL, "modal session couldn't be started"); @@ -507,7 +514,8 @@ void wxGUIEventLoop::EndModalSession() wxASSERT_MSG(m_modalNestedLevel > 0, "incorrect modal nesting level"); - if ( --m_modalNestedLevel == 0 ) + --m_modalNestedLevel; + if ( m_modalNestedLevel == 0 ) { [NSApp endModalSession:(NSModalSession)m_modalSession]; m_modalSession = nil; @@ -517,6 +525,32 @@ void wxGUIEventLoop::EndModalSession() m_dummyWindow = nil; } } + else + { + wxModalSessionStack* stack = gs_modalSessionStackMap[this]; + wxModalSessionStackElement element = stack->back(); + stack->pop_back(); + + if( m_modalNestedLevel == 1 ) + { + gs_modalSessionStackMap.erase(this); + delete stack; + } + + if ( m_modalSession != element.modalSession ) + { + [NSApp endModalSession:(NSModalSession)m_modalSession]; + m_modalSession = element.modalSession; + } + + if ( m_dummyWindow != element.dummyWindow ) + { + if ( element.dummyWindow ) + [element.dummyWindow release]; + + m_dummyWindow = element.dummyWindow; + } + } } // diff --git a/Externals/wxWidgets3/src/osx/cocoa/filedlg.mm b/Externals/wxWidgets3/src/osx/cocoa/filedlg.mm index 67f58554c4..9501a7be7d 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/filedlg.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/filedlg.mm @@ -52,33 +52,7 @@ // then the delegate method - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename will have to // be implemented -namespace -{ - -bool HasAppKit_10_6() -{ - // Even if we require 10.6, we might be loaded by an application that - // was linked against 10.5. setAllowedFileTypes will still be ignored - // in this case. From NSSavePanel.h: - // NSOpenPanel: On versions less than 10.6, this property is ignored. - // For applications that link against 10.6 and higher, this property will - // determine which files should be enabled in the open panel. - int32_t version = NSVersionOfLinkTimeLibrary("AppKit"); - if (version == -1) - { - // If we're loaded by an application that doesn't link against AppKit, - // use the runtime version instead. This check will not work for the - // case above. - version = NSVersionOfRunTimeLibrary("AppKit"); - } - - // Notice that this still works correctly even if version is -1. - return version >= 0x40e2400 /* version of 10.6 AppKit */; -} - -} // anonymous namespace - -@interface wxOpenPanelDelegate : NSObject wxOSX_10_6_AND_LATER() +@interface wxOpenPanelDelegate : NSObject { wxFileDialog* _dialog; } @@ -112,13 +86,18 @@ bool HasAppKit_10_6() - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { BOOL showObject = YES; - + + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + NSString* resolvedLink = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath:filename]; if ( resolvedLink != nil ) filename = resolvedLink; - + NSDictionary* fileAttribs = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES]; + + wxGCC_WARNING_RESTORE(deprecated-declarations) + if (fileAttribs) { // check for packages @@ -184,13 +163,15 @@ bool HasAppKit_10_6() @end -IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) +wxIMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase); void wxFileDialog::Init() { m_filterIndex = -1; m_delegate = nil; m_sheetDelegate = nil; + m_filterPanel = NULL; + m_filterChoice = NULL; } void wxFileDialog::Create( @@ -333,6 +314,8 @@ void wxFileDialog::ShowWindowModal() wxASSERT_MSG(parentWindow, "Window modal display requires parent."); + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + NSArray* types = GetTypesFromFilter( m_wildCard, m_filterNames, m_filterExtensions ) ; if ( HasFlag(wxFD_SAVE) ) { @@ -376,6 +359,8 @@ void wxFileDialog::ShowWindowModal() didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; } + + wxGCC_WARNING_RESTORE(deprecated-declarations) } // Create a panel with the file type drop down list @@ -457,7 +442,7 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) // for sandboxed app we cannot access the outer structures // this leads to problems with extra controls, so as a temporary // workaround for crashes we don't support those yet - if ( [panel contentView] == nil ) + if ( [panel contentView] == nil || getenv("APP_SANDBOX_CONTAINER_ID") != NULL ) return; wxNonOwnedWindow::Create( GetParent(), nativeWindow ); @@ -474,16 +459,6 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) { m_filterPanel = CreateFilterPanel(extracontrol); accView = m_filterPanel->GetHandle(); - if( HasFlag(wxFD_OPEN) ) - { - if ( UMAGetSystemVersion() < 0x1060 || !HasAppKit_10_6() ) - { - wxOpenPanelDelegate* del = [[wxOpenPanelDelegate alloc]init]; - [del setFileDialog:this]; - [panel setDelegate:del]; - m_delegate = del; - } - } } else { @@ -580,6 +555,8 @@ int wxFileDialog::ShowModal() } } + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + if ( HasFlag(wxFD_SAVE) ) { NSSavePanel* sPanel = [NSSavePanel savePanel]; @@ -629,30 +606,35 @@ int wxFileDialog::ShowModal() [oPanel setMessage:cf.AsNSString()]; [oPanel setAllowsMultipleSelection: (HasFlag(wxFD_MULTIPLE) ? YES : NO )]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - if ( UMAGetSystemVersion() >= 0x1060 && HasAppKit_10_6() ) + // Note that the test here is intentionally different from the one + // above, in the wxFD_SAVE case: we need to call DoOnFilterSelected() + // even for m_firstFileTypeFilter == 0, i.e. when using the default + // filter. + if ( m_firstFileTypeFilter >= 0 ) + { + DoOnFilterSelected(m_firstFileTypeFilter); + } + else { [oPanel setAllowedFileTypes: (m_delegate == nil ? types : nil)]; - if ( !m_dir.IsEmpty() ) - [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() - isDirectory:YES]]; - returnCode = [oPanel runModal]; - } - else -#endif - { - returnCode = [oPanel runModalForDirectory:m_dir.IsEmpty() ? nil : dir.AsNSString() - file:file.AsNSString() types:(m_delegate == nil ? types : nil)]; } + if ( !m_dir.IsEmpty() ) + [oPanel setDirectoryURL:[NSURL fileURLWithPath:dir.AsNSString() + isDirectory:YES]]; + returnCode = [oPanel runModal]; ModalFinishedCallback(oPanel, returnCode); } + wxGCC_WARNING_RESTORE(deprecated-declarations) + return GetReturnCode(); } void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) { + wxGCC_WARNING_SUPPRESS(deprecated-declarations) + int result = wxID_CANCEL; if (HasFlag(wxFD_SAVE)) { @@ -677,6 +659,12 @@ void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) { panel = oPanel; result = wxID_OK; + + if (m_filterChoice) + { + m_filterIndex = m_filterChoice->GetSelection(); + } + NSArray* filenames = [oPanel filenames]; for ( size_t i = 0 ; i < [filenames count] ; ++ i ) { @@ -707,6 +695,8 @@ void wxFileDialog::ModalFinishedCallback(void* panel, int returnCode) if ( m_isNativeWindowWrapper ) UnsubclassWin(); [(NSSavePanel*) panel setAccessoryView:nil]; + + wxGCC_WARNING_RESTORE(deprecated-declarations) } #endif // wxUSE_FILEDLG diff --git a/Externals/wxWidgets3/src/osx/cocoa/gauge.mm b/Externals/wxWidgets3/src/osx/cocoa/gauge.mm index cf82bd434b..c28ddd08f0 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/gauge.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/gauge.mm @@ -50,19 +50,19 @@ public : { } - void SetMaximum(wxInt32 v) + void SetMaximum(wxInt32 v) wxOVERRIDE { SetDeterminateMode(); wxWidgetCocoaImpl::SetMaximum( v ) ; } - void SetValue(wxInt32 v) + void SetValue(wxInt32 v) wxOVERRIDE { SetDeterminateMode(); wxWidgetCocoaImpl::SetValue( v ) ; } - void PulseGauge() + void PulseGauge() wxOVERRIDE { if ( ![(wxNSProgressIndicator*)m_osxView isIndeterminate] ) { @@ -71,7 +71,7 @@ public : } } - void GetLayoutInset(int &left , int &top , int &right, int &bottom) const + void GetLayoutInset(int &left , int &top , int &right, int &bottom) const wxOVERRIDE { left = top = right = bottom = 0; NSControlSize size = [(wxNSProgressIndicator*)m_osxView controlSize]; @@ -81,13 +81,13 @@ public : case NSRegularControlSize: left = right = 2; top = 0; - bottom = 4; + bottom = 3; break; case NSMiniControlSize: case NSSmallControlSize: left = right = 1; top = 0; - bottom = 2; + bottom = 1; break; } } @@ -113,7 +113,7 @@ wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, wxInt32 maximum, const wxPoint& pos, const wxSize& size, - long WXUNUSED(style), + long style, long WXUNUSED(extraStyle)) { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; @@ -123,6 +123,10 @@ wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, [v setMaxValue: maximum]; [v setIndeterminate:FALSE]; [v setDoubleValue: (double) value]; + if (style & wxGA_VERTICAL) + { + [v setBoundsRotation:-90.0]; + } wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v ); return c; } diff --git a/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm b/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm index 9f73bfec91..7afbc6c39e 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm @@ -37,10 +37,6 @@ WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ) { WXGLContext context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext: shareContext]; - if ( !context ) - { - wxFAIL_MSG("NSOpenGLContext creation failed"); - } return context ; } @@ -77,150 +73,42 @@ void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ) } } - -WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) +// Form a list of attributes by joining canvas attributes and context attributes. +// OS X uses just one list to find a suitable pixel format. +WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, + int n1, + const int *ctxAttrs, + int n2) { - NSOpenGLPixelFormatAttribute data[512]; - const NSOpenGLPixelFormatAttribute defaultAttribs[] = - { - NSOpenGLPFADoubleBuffer, - NSOpenGLPFAMinimumPolicy, - NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8, - NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0, - NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8, - NSOpenGLPFAAccelerated, // use hardware accelerated context - (NSOpenGLPixelFormatAttribute)nil - }; - + NSOpenGLPixelFormatAttribute data[128]; const NSOpenGLPixelFormatAttribute *attribs; - if ( !attribList ) - { - attribs = defaultAttribs; - } - else - { - unsigned p = 0; - data[p++] = NSOpenGLPFAMinimumPolicy; // make _SIZE tags behave more like GLX - data[p++] = NSOpenGLPFAAccelerated; // use hardware accelerated context + unsigned p = 0; - for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); ) + // The list should have at least one value and the '0' at end. So the + // minimum size is 2. + if ( GLAttrs && n1 > 1 ) + { + n1--; // skip the ending '0' + while ( p < n1 ) { - switch ( attribList[arg++] ) - { - case WX_GL_RGBA: - //data[p++] = AGL_RGBA; - break; - - case WX_GL_BUFFER_SIZE: - //data[p++] = AGL_BUFFER_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_LEVEL: - //data[p++]=AGL_LEVEL; - //data[p++]=attribList[arg++]; - break; - - case WX_GL_DOUBLEBUFFER: - data[p++] = NSOpenGLPFADoubleBuffer; - break; - - case WX_GL_STEREO: - data[p++] = NSOpenGLPFAStereo; - break; - - case WX_GL_AUX_BUFFERS: - data[p++] = NSOpenGLPFAAuxBuffers; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_MIN_RED: - data[p++] = NSOpenGLPFAColorSize; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_MIN_GREEN: - //data[p++] = AGL_GREEN_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_BLUE: - //data[p++] = AGL_BLUE_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ALPHA: - data[p++] = NSOpenGLPFAAlphaSize; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_DEPTH_SIZE: - data[p++] = NSOpenGLPFADepthSize; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_STENCIL_SIZE: - data[p++] = NSOpenGLPFAStencilSize; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_RED: - data[p++] = NSOpenGLPFAAccumSize; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_GREEN: - //data[p++] = AGL_ACCUM_GREEN_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_BLUE: - //data[p++] = AGL_ACCUM_BLUE_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_MIN_ACCUM_ALPHA: - //data[p++] = AGL_ACCUM_ALPHA_SIZE; - //data[p++] = attribList[arg++]; - break; - - case WX_GL_SAMPLE_BUFFERS: - if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) - { - if ( !attribList[arg++] ) - break; - - return nil; - } - - data[p++] = NSOpenGLPFASampleBuffers; - if ( (data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]) == true ) - { - // don't use software fallback - data[p++] = NSOpenGLPFANoRecovery; - } - break; - - case WX_GL_SAMPLES: - if ( !wxGLCanvas::IsAGLMultiSampleAvailable() ) - { - if ( !attribList[arg++] ) - break; - - return nil; - } - - data[p++] = NSOpenGLPFASamples; - data[p++] = (NSOpenGLPixelFormatAttribute) attribList[arg++]; - break; - } + data[p] = (NSOpenGLPixelFormatAttribute) GLAttrs[p]; + p++; } - - data[p] = (NSOpenGLPixelFormatAttribute)nil; - - attribs = data; } + if ( ctxAttrs && n2 > 1 ) + { + n2--; // skip the ending '0' + unsigned p2 = 0; + while ( p2 < n2 ) + data[p++] = (NSOpenGLPixelFormatAttribute) ctxAttrs[p2++]; + } + + // End the list + data[p] = (NSOpenGLPixelFormatAttribute) 0; + + attribs = data; + return [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute*) attribs]; } @@ -250,34 +138,6 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList) @end -bool wxGLCanvas::Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name, - const int *attribList, - const wxPalette& WXUNUSED(palette)) -{ - m_glFormat = WXGLChoosePixelFormat(attribList); - if ( !m_glFormat ) - return false; - - // DontCreatePeer(); - - if ( !wxWindow::Create(parent, id, pos, size, style, name) ) - return false; - -/* - NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; - wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r]; - m_peer = new wxWidgetCocoaImpl( this, v ); - - MacPostControlCreate(pos, size) ; -*/ - return true; -} - wxGLCanvas::~wxGLCanvas() { if ( m_glFormat ) @@ -297,13 +157,13 @@ bool wxGLCanvas::SwapBuffers() bool wxGLContext::SetCurrent(const wxGLCanvas& win) const { if ( !m_glContext ) - return false; + return false; [m_glContext setView: win.GetHandle() ]; [m_glContext update]; - + [m_glContext makeCurrentContext]; - + return true; } diff --git a/Externals/wxWidgets3/src/osx/cocoa/listbox.mm b/Externals/wxWidgets3/src/osx/cocoa/listbox.mm index 95d36c388e..cad11b0f2e 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/listbox.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/listbox.mm @@ -26,13 +26,11 @@ #include "wx/osx/private.h" -#include - // forward decls class wxListWidgetCocoaImpl; -@interface wxNSTableDataSource : NSObject wxOSX_10_6_AND_LATER() +@interface wxNSTableDataSource : NSObject { wxListWidgetCocoaImpl* impl; } @@ -52,7 +50,7 @@ class wxListWidgetCocoaImpl; @end -@interface wxNSTableView : NSTableView wxOSX_10_6_AND_LATER() +@interface wxNSTableView : NSTableView { } @@ -106,44 +104,46 @@ public : ~wxListWidgetCocoaImpl(); virtual wxListWidgetColumn* InsertTextColumn( unsigned pos, const wxString& title, bool editable = false, - wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) wxOVERRIDE ; virtual wxListWidgetColumn* InsertCheckColumn( unsigned pos , const wxString& title, bool editable = false, - wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) wxOVERRIDE ; // add and remove - virtual void ListDelete( unsigned int n ) ; - virtual void ListInsert( unsigned int n ) ; - virtual void ListClear() ; + virtual void ListDelete( unsigned int n ) wxOVERRIDE ; + virtual void ListInsert( unsigned int n ) wxOVERRIDE ; + virtual void ListClear() wxOVERRIDE ; // selecting - virtual void ListDeselectAll(); + virtual void ListDeselectAll() wxOVERRIDE; - virtual void ListSetSelection( unsigned int n, bool select, bool multi ) ; - virtual int ListGetSelection() const ; + virtual void ListSetSelection( unsigned int n, bool select, bool multi ) wxOVERRIDE ; + virtual int ListGetSelection() const wxOVERRIDE ; - virtual int ListGetSelections( wxArrayInt& aSelections ) const ; + virtual int ListGetSelections( wxArrayInt& aSelections ) const wxOVERRIDE ; - virtual bool ListIsSelected( unsigned int n ) const ; + virtual bool ListIsSelected( unsigned int n ) const wxOVERRIDE ; // display - virtual void ListScrollTo( unsigned int n ) ; + virtual void ListScrollTo( unsigned int n ) wxOVERRIDE ; + + virtual int ListGetTopItem() const wxOVERRIDE; // accessing content - virtual unsigned int ListGetCount() const ; - virtual int DoListHitTest( const wxPoint& inpoint ) const; + virtual unsigned int ListGetCount() const wxOVERRIDE ; + virtual int DoListHitTest( const wxPoint& inpoint ) const wxOVERRIDE; int ListGetColumnType( int col ) { return col; } - virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) ; - virtual void UpdateLineToEnd( unsigned int n); + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ) wxOVERRIDE ; + virtual void UpdateLineToEnd( unsigned int n) wxOVERRIDE; - virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender); + virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; protected : @@ -186,20 +186,20 @@ public : virtual ~wxNSTableViewCellValue() {} - virtual void Set( CFStringRef v ) + virtual void Set( CFStringRef v ) wxOVERRIDE { value = [[(NSString*)v retain] autorelease]; } - virtual void Set( const wxString& value ) + virtual void Set( const wxString& value ) wxOVERRIDE { Set( (CFStringRef) wxCFStringRef( value ) ); } - virtual void Set( int v ) + virtual void Set( int v ) wxOVERRIDE { value = [NSNumber numberWithInt:v]; } - virtual int GetIntValue() const + virtual int GetIntValue() const wxOVERRIDE { if ( [value isKindOfClass:[NSNumber class]] ) return [ (NSNumber*) value intValue ]; @@ -207,7 +207,7 @@ public : return 0; } - virtual wxString GetStringValue() const + virtual wxString GetStringValue() const wxOVERRIDE { if ( [value isKindOfClass:[NSString class]] ) return wxCFStringRef::AsString( (NSString*) value ); @@ -536,6 +536,13 @@ void wxListWidgetCocoaImpl::ListScrollTo( unsigned int n ) [m_tableView scrollRowToVisible:n]; } +int wxListWidgetCocoaImpl::ListGetTopItem() const +{ + NSScrollView *scrollView = [m_tableView enclosingScrollView]; + NSRect visibleRect = scrollView.contentView.visibleRect; + NSRange range = [m_tableView rowsInRect:visibleRect]; + return range.location; +} void wxListWidgetCocoaImpl::UpdateLine( unsigned int WXUNUSED(n), wxListWidgetColumn* WXUNUSED(col) ) { diff --git a/Externals/wxWidgets3/src/osx/cocoa/mediactrl.mm b/Externals/wxWidgets3/src/osx/cocoa/mediactrl.mm index 73624098c5..12c56410a0 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/mediactrl.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/mediactrl.mm @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/cocoa/mediactrl.cpp +// Name: src/osx/cocoa/mediactrl.mm // Purpose: Built-in Media Backends for Cocoa -// Author: Ryan Norton +// Author: Ryan Norton , Stefan Csomor // Modified by: // Created: 02/03/05 -// Copyright: (c) 2004-2005 Ryan Norton, (c) 2005 David Elliot +// Copyright: (c) 2004-2005 Ryan Norton, (c) 2005 David Elliot, (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -36,10 +36,34 @@ #include "wx/osx/private.h" +#ifndef wxOSX_USE_QTKIT + #if wxOSX_USE_IPHONE + #define wxOSX_USE_QTKIT 0 + #define wxOSX_USE_AVFOUNDATION 1 + #else + #define wxOSX_USE_QTKIT 1 + #define wxOSX_USE_AVFOUNDATION 0 + #endif +#else + #if wxOSX_USE_QTKIT + #define wxOSX_USE_AVFOUNDATION 0 + #else + #define wxOSX_USE_AVFOUNDATION 1 + #endif +#endif + +#if wxOSX_USE_AVFOUNDATION && wxOSX_USE_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + #define wxOSX_USE_AVKIT 1 +#else + #define wxOSX_USE_AVKIT 0 +#endif + //=========================================================================== // BACKEND DECLARATIONS //=========================================================================== +#if wxOSX_USE_QTKIT + //--------------------------------------------------------------------------- // // wxQTMediaBackend @@ -51,9 +75,6 @@ //--------------------------------------------------------------------------- #include -#include "wx/cocoa/autorelease.h" -#include "wx/cocoa/string.h" - class WXDLLIMPEXP_FWD_MEDIA wxQTMediaBackend; @interface wxQTMovie : QTMovie { @@ -78,34 +99,34 @@ public: const wxSize& size, long style, const wxValidator& validator, - const wxString& name); + const wxString& name) wxOVERRIDE; - virtual bool Play(); - virtual bool Pause(); - virtual bool Stop(); + virtual bool Play() wxOVERRIDE; + virtual bool Pause() wxOVERRIDE; + virtual bool Stop() wxOVERRIDE; - virtual bool Load(const wxString& fileName); - virtual bool Load(const wxURI& location); + virtual bool Load(const wxString& fileName) wxOVERRIDE; + virtual bool Load(const wxURI& location) wxOVERRIDE; - virtual wxMediaState GetState(); + virtual wxMediaState GetState() wxOVERRIDE; - virtual bool SetPosition(wxLongLong where); - virtual wxLongLong GetPosition(); - virtual wxLongLong GetDuration(); + virtual bool SetPosition(wxLongLong where) wxOVERRIDE; + virtual wxLongLong GetPosition() wxOVERRIDE; + virtual wxLongLong GetDuration() wxOVERRIDE; - virtual void Move(int x, int y, int w, int h); - wxSize GetVideoSize() const; + virtual void Move(int x, int y, int w, int h) wxOVERRIDE; + wxSize GetVideoSize() const wxOVERRIDE; - virtual double GetPlaybackRate(); - virtual bool SetPlaybackRate(double dRate); + virtual double GetPlaybackRate() wxOVERRIDE; + virtual bool SetPlaybackRate(double dRate) wxOVERRIDE; - virtual double GetVolume(); - virtual bool SetVolume(double dVolume); + virtual double GetVolume() wxOVERRIDE; + virtual bool SetVolume(double dVolume) wxOVERRIDE; void Cleanup(); void FinishLoad(); - virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags); + virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags) wxOVERRIDE; private: void DoShowPlayerControls(wxMediaCtrlPlayerControls flags); @@ -115,7 +136,7 @@ private: wxMediaCtrlPlayerControls m_interfaceflags; // Saved interface flags - DECLARE_DYNAMIC_CLASS(wxQTMediaBackend); + wxDECLARE_DYNAMIC_CLASS(wxQTMediaBackend); }; // -------------------------------------------------------------------------- @@ -152,7 +173,7 @@ private: [super dealloc]; } --(wxQTMediaBackend*) backend; +-(wxQTMediaBackend*) backend { return m_backend; } @@ -221,7 +242,7 @@ private: // wxQTMediaBackend // -------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); +wxIMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend); wxQTMediaBackend::wxQTMediaBackend() : m_movie(nil), m_movieview(nil), @@ -433,6 +454,547 @@ void wxQTMediaBackend::DoShowPlayerControls(wxMediaCtrlPlayerControls flags) } } +#endif + +#if wxOSX_USE_AVFOUNDATION + +//--------------------------------------------------------------------------- +// +// wxAVMediaBackend +// +//--------------------------------------------------------------------------- + +#import + +#if wxOSX_USE_AVKIT +#import +#endif + +class WXDLLIMPEXP_FWD_MEDIA wxAVMediaBackend; + +static void *AVSPPlayerItemStatusContext = &AVSPPlayerItemStatusContext; +static void *AVSPPlayerRateContext = &AVSPPlayerRateContext; + +@interface wxAVPlayer : AVPlayer { + + AVPlayerLayer *playerLayer; + + wxAVMediaBackend* m_backend; +} + +-(BOOL)isPlaying; + +@property (retain) AVPlayerLayer *playerLayer; + +@end + +class WXDLLIMPEXP_MEDIA wxAVMediaBackend : public wxMediaBackendCommonBase +{ +public: + + wxAVMediaBackend(); + ~wxAVMediaBackend(); + + virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) wxOVERRIDE; + + virtual bool Play() wxOVERRIDE; + virtual bool Pause() wxOVERRIDE; + virtual bool Stop() wxOVERRIDE; + + virtual bool Load(const wxString& fileName) wxOVERRIDE; + virtual bool Load(const wxURI& location) wxOVERRIDE; + + virtual wxMediaState GetState() wxOVERRIDE; + + virtual bool SetPosition(wxLongLong where) wxOVERRIDE; + virtual wxLongLong GetPosition() wxOVERRIDE; + virtual wxLongLong GetDuration() wxOVERRIDE; + + virtual void Move(int x, int y, int w, int h) wxOVERRIDE; + wxSize GetVideoSize() const wxOVERRIDE; + + virtual double GetPlaybackRate() wxOVERRIDE; + virtual bool SetPlaybackRate(double dRate) wxOVERRIDE; + + virtual double GetVolume() wxOVERRIDE; + virtual bool SetVolume(double dVolume) wxOVERRIDE; + + void Cleanup(); + void FinishLoad(); + + virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags) wxOVERRIDE; +private: + void DoShowPlayerControls(wxMediaCtrlPlayerControls flags); + + wxSize m_bestSize; //Original movie size + wxAVPlayer* m_player; //AVPlayer handle/instance + + wxMediaCtrlPlayerControls m_interfaceflags; // Saved interface flags + + wxDECLARE_DYNAMIC_CLASS(wxAVMediaBackend); +}; + +// -------------------------------------------------------------------------- +// wxAVMediaBackend +// -------------------------------------------------------------------------- + +@implementation wxAVPlayer + +@synthesize playerLayer; + +- (id) init +{ + self = [super init]; + + [self addObserver:self forKeyPath:@"currentItem.status" + options:NSKeyValueObservingOptionNew context:AVSPPlayerItemStatusContext]; + [self addObserver:self forKeyPath:@"rate" + options:NSKeyValueObservingOptionNew context:AVSPPlayerRateContext]; + + return self; +} + +- (void)dealloc +{ + [playerLayer release]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [self removeObserver:self forKeyPath:@"rate" context:AVSPPlayerRateContext]; + [self removeObserver:self forKeyPath:@"currentItem.status" context:AVSPPlayerItemStatusContext]; + + [super dealloc]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if (context == AVSPPlayerItemStatusContext) + { + id val = [change objectForKey:NSKeyValueChangeNewKey]; + if ( val != [NSNull null ] ) + { + AVPlayerStatus status = [ val integerValue]; + + switch (status) + { + case AVPlayerItemStatusUnknown: + break; + case AVPlayerItemStatusReadyToPlay: + [[NSNotificationCenter defaultCenter] + addObserver:self selector:@selector(playerItemDidReachEnd:) + name:AVPlayerItemDidPlayToEndTimeNotification object:self.currentItem]; + m_backend->FinishLoad(); + break; + case AVPlayerItemStatusFailed: + break; + default: + break; + } + } + } + else if (context == AVSPPlayerRateContext) + { + NSNumber* newRate = [change objectForKey:NSKeyValueChangeNewKey]; + if ([newRate intValue] == 0) + { + m_backend->QueuePauseEvent(); + } + else if ( [self isPlaying] == NO ) + { + m_backend->QueuePlayEvent(); + } + } + else + { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +-(wxAVMediaBackend*) backend +{ + return m_backend; +} + +-(void) setBackend:(wxAVMediaBackend*) backend +{ + m_backend = backend; +} + +- (void)playerItemDidReachEnd:(NSNotification *)notification +{ + if ( m_backend ) + { + if ( m_backend->SendStopEvent() ) + m_backend->QueueFinishEvent(); + } +} + +-(BOOL)isPlaying +{ + if ([self rate] == 0) + { + return NO; + } + + return YES; +} + +@end + +#if wxOSX_USE_IPHONE + +@interface wxAVView : UIView +{ +} + +@end + +@implementation wxAVView + ++ (void)initialize +{ + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXIPhoneClassAddWXMethods( self ); + } +} + ++ (Class)layerClass +{ + return [AVPlayerLayer class]; +} + +- (id) initWithFrame:(CGRect)rect player:(wxAVPlayer*) player +{ + if ( !(self=[super initWithFrame:rect]) ) + return nil; + + AVPlayerLayer* playerLayer = (AVPlayerLayer*) [self layer]; + [playerLayer setPlayer: player]; + [player setPlayerLayer:playerLayer]; + + return self; +} + +- (AVPlayerLayer*) playerLayer +{ + return (AVPlayerLayer*) [self layer]; +} +@end + +#else + +#if wxOSX_USE_AVKIT + +@interface wxAVPlayerView : AVPlayerView +{ +} + +@end + +@implementation wxAVPlayerView + ++ (void)initialize +{ + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); + } +} + +- (id) initWithFrame:(NSRect)rect player:(wxAVPlayer*) player +{ + if ( !(self=[super initWithFrame:rect]) ) + return nil; + + self.player = player; + + return self; +} + +- (AVPlayerLayer*) playerLayer +{ + return (AVPlayerLayer*) [[[self layer] sublayers] firstObject]; +} + +@end + +#endif // wxOSX_USE_AVKIT + +@interface wxAVView : NSView +{ +} + +@end + +@implementation wxAVView + ++ (void)initialize +{ + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); + } +} + +- (id) initWithFrame:(NSRect)rect player:(AVPlayer*) player +{ + if ( !(self=[super initWithFrame:rect]) ) + return nil; + + [self setWantsLayer:YES]; + AVPlayerLayer* playerlayer = [[AVPlayerLayer playerLayerWithPlayer: player] retain]; + [player setPlayerLayer:playerlayer]; + + [playerlayer setFrame:[[self layer] bounds]]; + [playerlayer setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable]; + [[self layer] addSublayer:playerlayer]; + + return self; +} + +- (AVPlayerLayer*) playerLayer +{ + return (AVPlayerLayer*) [[[self layer] sublayers] firstObject]; +} + +@end + +#endif + +wxIMPLEMENT_DYNAMIC_CLASS(wxAVMediaBackend, wxMediaBackend); + +wxAVMediaBackend::wxAVMediaBackend() : +m_player(nil), +m_interfaceflags(wxMEDIACTRLPLAYERCONTROLS_NONE) +{ +} + +wxAVMediaBackend::~wxAVMediaBackend() +{ + Cleanup(); +} + +bool wxAVMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent, + wxWindowID wid, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxMediaCtrl* mediactrl = (wxMediaCtrl*) inctrl; + + mediactrl->DontCreatePeer(); + + if ( !mediactrl->wxControl::Create( + parent, wid, pos, size, + wxWindow::MacRemoveBordersFromStyle(style), + validator, name)) + { + return false; + } + + m_player = [[wxAVPlayer alloc] init]; + [m_player setBackend:this]; + + WXRect r = wxOSXGetFrameForControl( mediactrl, pos , size ) ; + + WXWidget view = NULL; +#if wxOSX_USE_AVKIT + if ( NSClassFromString(@"AVPlayerView") ) + { + view = [[wxAVPlayerView alloc] initWithFrame: r player:m_player]; + [(wxAVPlayerView*) view setControlsStyle:AVPlayerViewControlsStyleNone]; + } +#endif + + if ( view == NULL ) + { + view = [[wxAVView alloc] initWithFrame: r player:m_player]; + } + +#if wxOSX_USE_IPHONE + wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl(mediactrl,view); +#else + wxWidgetCocoaImpl* impl = new wxWidgetCocoaImpl(mediactrl,view); +#endif + mediactrl->SetPeer(impl); + + m_ctrl = mediactrl; + return true; +} + +bool wxAVMediaBackend::Load(const wxString& fileName) +{ + return Load( + wxURI( + wxString( wxT("file://") ) + fileName + ) + ); +} + +bool wxAVMediaBackend::Load(const wxURI& location) +{ + wxCFStringRef uri(location.BuildURI()); + NSURL *url = [NSURL URLWithString: uri.AsNSString()]; + + AVAsset* asset = [AVAsset assetWithURL:url]; + if (! asset ) + return false; + + if ( [asset isPlayable] ) + { + AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset]; + [m_player replaceCurrentItemWithPlayerItem:playerItem]; + + return playerItem != nil; + } + return false; +} + +void wxAVMediaBackend::FinishLoad() +{ + DoShowPlayerControls(m_interfaceflags); + + AVPlayerItem *playerItem = [m_player currentItem]; + + CGSize s = [playerItem presentationSize]; + m_bestSize = wxSize(s.width, s.height); + + NotifyMovieLoaded(); +} + +bool wxAVMediaBackend::Play() +{ + [m_player play]; + return true; +} + +bool wxAVMediaBackend::Pause() +{ + [m_player pause]; + return true; +} + +bool wxAVMediaBackend::Stop() +{ + [m_player pause]; + [m_player seekToTime:kCMTimeZero]; + return true; +} + +double wxAVMediaBackend::GetVolume() +{ + return [m_player volume]; +} + +bool wxAVMediaBackend::SetVolume(double dVolume) +{ + [m_player setVolume:dVolume]; + return true; +} +double wxAVMediaBackend::GetPlaybackRate() +{ + return [m_player rate]; +} + +bool wxAVMediaBackend::SetPlaybackRate(double dRate) +{ + [m_player setRate:dRate]; + return true; +} + +bool wxAVMediaBackend::SetPosition(wxLongLong where) +{ + [m_player seekToTime:CMTimeMakeWithSeconds(where.GetValue() / 1000.0, 1) + toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero]; + + return true; +} + +wxLongLong wxAVMediaBackend::GetPosition() +{ + return CMTimeGetSeconds([m_player currentTime])*1000.0; +} + +wxLongLong wxAVMediaBackend::GetDuration() +{ + AVPlayerItem *playerItem = [m_player currentItem]; + + if ([playerItem status] == AVPlayerItemStatusReadyToPlay) + return CMTimeGetSeconds([[playerItem asset] duration])*1000.0; + else + return 0.f; +} + +wxMediaState wxAVMediaBackend::GetState() +{ + if ( [m_player isPlaying] ) + return wxMEDIASTATE_PLAYING; + else + { + if ( GetPosition() == 0 ) + return wxMEDIASTATE_STOPPED; + else + return wxMEDIASTATE_PAUSED; + } +} + +void wxAVMediaBackend::Cleanup() +{ + [m_player pause]; + [m_player release]; + m_player = nil; +} + +wxSize wxAVMediaBackend::GetVideoSize() const +{ + return m_bestSize; +} + +void wxAVMediaBackend::Move(int x, int y, int w, int h) +{ + // as we have a native player, no need to move the video area +} + +bool wxAVMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags) +{ + if ( m_interfaceflags != flags ) + DoShowPlayerControls(flags); + + m_interfaceflags = flags; + return true; +} + +void wxAVMediaBackend::DoShowPlayerControls(wxMediaCtrlPlayerControls flags) +{ +#if wxOSX_USE_AVKIT + NSView* view = m_ctrl->GetHandle(); + if ( [view isKindOfClass:[wxAVPlayerView class]] ) + { + wxAVPlayerView* playerView = (wxAVPlayerView*) view; + if (flags == wxMEDIACTRLPLAYERCONTROLS_NONE ) + playerView.controlsStyle = AVPlayerViewControlsStyleNone; + else + playerView.controlsStyle = AVPlayerViewControlsStyleDefault; + } +#endif +} + +#endif + //in source file that contains stuff you don't directly use #include "wx/html/forcelnk.h" FORCE_LINK_ME(basewxmediabackends); diff --git a/Externals/wxWidgets3/src/osx/cocoa/menu.mm b/Externals/wxWidgets3/src/osx/cocoa/menu.mm index d5fdc23761..23a2002acc 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/menu.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/menu.mm @@ -58,7 +58,7 @@ // and under 10.4, we are not getting a 'close' event however... #define wxOSX_USE_NEEDSUPDATE_HOOK 1 -@interface wxNSMenuController : NSObject wxOSX_10_6_AND_LATER() +@interface wxNSMenuController : NSObject { } @@ -140,9 +140,6 @@ @interface NSApplication(MissingAppleMenuCall) - (void)setAppleMenu:(NSMenu *)menu; -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 -- (void)setHelpMenu:(NSMenu* )menu; -#endif @end class wxMenuCocoaImpl : public wxMenuImpl @@ -165,7 +162,7 @@ public : virtual ~wxMenuCocoaImpl(); - virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) + virtual void InsertOrAppend(wxMenuItem *pItem, size_t pos) wxOVERRIDE { NSMenuItem* nsmenuitem = (NSMenuItem*) pItem->GetPeer()->GetHMenuItem(); // make sure a call of SetSubMenu is also reflected (occurring after Create) @@ -188,12 +185,12 @@ public : [m_osxMenu insertItem:nsmenuitem atIndex:pos]; } - virtual void Remove( wxMenuItem *pItem ) + virtual void Remove( wxMenuItem *pItem ) wxOVERRIDE { [m_osxMenu removeItem:(NSMenuItem*) pItem->GetPeer()->GetHMenuItem()]; } - virtual void MakeRoot() + virtual void MakeRoot() wxOVERRIDE { wxMenu* peer = GetWXPeer(); @@ -230,31 +227,29 @@ public : { } - virtual void SetTitle( const wxString& text ) + virtual void SetTitle( const wxString& text ) wxOVERRIDE { wxCFStringRef cfText(text); [m_osxMenu setTitle:cfText.AsNSString()]; } - virtual void PopUp( wxWindow *win, int x, int y ) + virtual void PopUp( wxWindow *win, int x, int y ) wxOVERRIDE { win->ScreenToClient( &x , &y ) ; NSView *view = win->GetPeer()->GetWXWidget(); - NSRect frame = [view frame]; - frame.origin.x = x; - frame.origin.y = y; - frame.size.width = 1; - frame.size.height = 1; - NSPopUpButtonCell *popUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; - [popUpButtonCell setAutoenablesItems:NO]; - [popUpButtonCell setAltersStateOfSelectedItem:NO]; - [popUpButtonCell setMenu:m_osxMenu]; - [popUpButtonCell selectItem:nil]; - [popUpButtonCell performClickWithFrame:frame inView:view]; - [popUpButtonCell release]; + [m_osxMenu popUpMenuPositioningItem:nil atLocation:NSMakePoint(x, y) inView:view]; } - WXHMENU GetHMenu() { return m_osxMenu; } + virtual void GetMenuBarDimensions(int &x, int &y, int &width, int &height) const wxOVERRIDE + { + NSRect r = [(NSScreen*)[[NSScreen screens] objectAtIndex:0] frame]; + height = [m_osxMenu menuBarHeight]; + x = r.origin.x; + y = r.origin.y; + width = r.size.width; + } + + WXHMENU GetHMenu() wxOVERRIDE { return m_osxMenu; } static wxMenuImpl* Create( wxMenu* peer, const wxString& title ); static wxMenuImpl* CreateRootMenu( wxMenu* peer ); diff --git a/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm b/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm index 578fcefd8e..df189aae79 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm @@ -173,28 +173,28 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry* case WXK_NUMPAD_LEFT : modifiers |= NSNumericPadKeyMask; - // pass through + wxFALLTHROUGH; case WXK_LEFT : shortcut = NSLeftArrowFunctionKey ; break ; case WXK_NUMPAD_UP : modifiers |= NSNumericPadKeyMask; - // pass through + wxFALLTHROUGH; case WXK_UP : shortcut = NSUpArrowFunctionKey ; break ; case WXK_NUMPAD_RIGHT : modifiers |= NSNumericPadKeyMask; - // pass through + wxFALLTHROUGH; case WXK_RIGHT : shortcut = NSRightArrowFunctionKey ; break ; case WXK_NUMPAD_DOWN : modifiers |= NSNumericPadKeyMask; - // pass through + wxFALLTHROUGH; case WXK_DOWN : shortcut = NSDownArrowFunctionKey ; break ; @@ -244,22 +244,22 @@ public : ~wxMenuItemCocoaImpl(); - void SetBitmap( const wxBitmap& bitmap ) + void SetBitmap( const wxBitmap& bitmap ) wxOVERRIDE { [m_osxMenuItem setImage:bitmap.GetNSImage()]; } - void Enable( bool enable ) + void Enable( bool enable ) wxOVERRIDE { [m_osxMenuItem setEnabled:enable]; } - void Check( bool check ) + void Check( bool check ) wxOVERRIDE { [m_osxMenuItem setState:( check ? NSOnState : NSOffState) ]; } - void Hide( bool hide ) + void Hide( bool hide ) wxOVERRIDE { // NB: setHidden is new as of 10.5 so we should not call it below there if ([m_osxMenuItem respondsToSelector:@selector(setHidden:)]) @@ -268,7 +268,7 @@ public : wxLogDebug("wxMenuItemCocoaImpl::Hide not yet supported under OS X < 10.5"); } - void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) + void SetLabel( const wxString& text, wxAcceleratorEntry *entry ) wxOVERRIDE { wxCFStringRef cfText(text); [m_osxMenuItem setTitle:cfText.AsNSString()]; @@ -276,9 +276,9 @@ public : wxMacCocoaMenuItemSetAccelerator( m_osxMenuItem, entry ); } - bool DoDefault(); + bool DoDefault() wxOVERRIDE; - void * GetHMenuItem() { return m_osxMenuItem; } + void * GetHMenuItem() wxOVERRIDE { return m_osxMenuItem; } protected : NSMenuItem* m_osxMenuItem ; diff --git a/Externals/wxWidgets3/src/osx/cocoa/msgdlg.mm b/Externals/wxWidgets3/src/osx/cocoa/msgdlg.mm index fb52f0a7a0..65e56b2e78 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/msgdlg.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/msgdlg.mm @@ -24,23 +24,28 @@ #include "wx/osx/private.h" -IMPLEMENT_CLASS(wxMessageDialog, wxDialog) +wxIMPLEMENT_CLASS(wxMessageDialog, wxDialog); namespace { NSAlertStyle GetAlertStyleFromWXStyle( long style ) { - NSAlertStyle alertType = NSWarningAlertStyle; - if (style & wxICON_EXCLAMATION) - alertType = NSCriticalAlertStyle; - else if (style & wxICON_HAND) - alertType = NSWarningAlertStyle; - else if (style & wxICON_INFORMATION) - alertType = NSInformationalAlertStyle; - else if (style & wxICON_QUESTION) - alertType = NSInformationalAlertStyle; - return alertType; + if (style & wxICON_WARNING) + { + // NSCriticalAlertStyle should only be used for questions where + // caution is needed per the OS X HIG. wxICON_WARNING alone doesn't + // warrant it, but a question with a warning (rather than question) + // icon is something serious. + if (style & (wxYES_NO | wxCANCEL)) + return NSCriticalAlertStyle; + else + return NSWarningAlertStyle; + } + else if (style & wxICON_ERROR) + return NSWarningAlertStyle; + else + return NSInformationalAlertStyle; } } diff --git a/Externals/wxWidgets3/src/osx/cocoa/nativewin.mm b/Externals/wxWidgets3/src/osx/cocoa/nativewin.mm new file mode 100644 index 0000000000..f2be5a7873 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/nativewin.mm @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/nativewin.mm +// Purpose: wxNativeWindow implementation for wxOSX/Cocoa +// Author: Vadim Zeitlin +// Created: 2015-08-01 +// Copyright: (c) 2015 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/nativewin.h" + +#include "wx/osx/private.h" + +// ============================================================================ +// implementation +// ============================================================================ + +bool +wxNativeWindow::Create(wxWindow* parent, + wxWindowID winid, + wxNativeWindowHandle view) +{ + wxCHECK_MSG( view, false, wxS("NULL NSView pointer") ); + + DontCreatePeer(); + + if ( !wxWindow::Create(parent, winid) ) + return false; + + // We have to ensure that the internal label is synchronized with the label + // at the native window, otherwise calling SetLabel() later might not work + // and, even worse, the native label would be reset to match the (empty) wx + // label by SetPeer(). + // + // Notice that the selectors tested here are the same ones currently used + // by wxWidgetCocoaImpl::SetLabel() and this code would need to be updated + // if that method is. + // + // Also note the casts to "id" needed to suppress the "NSView may not + // respond to selector" warnings: we do test that it responds to them, so + // these warnings are not useful here. + if ( [view respondsToSelector:@selector(title)] ) + m_label = wxCFStringRef::AsString([(id)view title]); + else if ( [view respondsToSelector:@selector(stringValue)] ) + m_label = wxCFStringRef::AsString([(id)view stringValue]); + + // As wxWidgets will release the view when this object is destroyed, retain + // it here to avoid destroying the view owned by the user code. + [view retain]; + SetPeer(new wxWidgetCocoaImpl(this, view)); + + // It doesn't seem necessary to use MacPostControlCreate() here as we never + // change the native control geometry here. + + return true; +} + +void wxNativeWindow::DoDisown() +{ + [GetPeer()->GetWXWidget() release]; +} diff --git a/Externals/wxWidgets3/src/osx/cocoa/nonownedwnd.mm b/Externals/wxWidgets3/src/osx/cocoa/nonownedwnd.mm index 9e79c6a458..e5394aeb9a 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/nonownedwnd.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/nonownedwnd.mm @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/osx/cocoa/nonownedwnd.mm // Purpose: non owned window for cocoa -// Author: DavidStefan Csomor +// Author: Stefan Csomor // Modified by: // Created: 2008-06-20 // Copyright: (c) Stefan Csomor @@ -91,6 +91,11 @@ bool shouldHandleSelector(SEL selector) } +static bool IsUsingFullScreenApi(WXWindow macWindow) +{ + return ([macWindow collectionBehavior] & NSWindowCollectionBehaviorFullScreenPrimary); +} + // // wx category for NSWindow (our own and wrapped instances) // @@ -145,6 +150,7 @@ bool shouldHandleSelector(SEL selector) // static NSResponder* s_nextFirstResponder = NULL; +static NSResponder* s_formerFirstResponder = NULL; @interface wxNSWindow : NSWindow { @@ -210,9 +216,13 @@ static NSResponder* s_nextFirstResponder = NULL; - (BOOL)makeFirstResponder:(NSResponder *)aResponder { + NSResponder* tempFormer = s_formerFirstResponder; + NSResponder* tempNext = s_nextFirstResponder; s_nextFirstResponder = aResponder; + s_formerFirstResponder = [[NSApp keyWindow] firstResponder]; BOOL retval = [super makeFirstResponder:aResponder]; - s_nextFirstResponder = nil; + s_nextFirstResponder = tempNext; + s_formerFirstResponder = tempFormer; return retval; } @@ -278,9 +288,13 @@ static NSResponder* s_nextFirstResponder = NULL; - (BOOL)makeFirstResponder:(NSResponder *)aResponder { + NSResponder* tempFormer = s_formerFirstResponder; + NSResponder* tempNext = s_nextFirstResponder; s_nextFirstResponder = aResponder; + s_formerFirstResponder = [[NSApp keyWindow] firstResponder]; BOOL retval = [super makeFirstResponder:aResponder]; - s_nextFirstResponder = nil; + s_nextFirstResponder = tempNext; + s_formerFirstResponder = tempFormer; return retval; } @@ -291,7 +305,7 @@ static NSResponder* s_nextFirstResponder = NULL; // controller // -@interface wxNonOwnedWindowController : NSObject wxOSX_10_6_AND_LATER() +@interface wxNonOwnedWindowController : NSObject { } @@ -300,8 +314,11 @@ static NSResponder* s_nextFirstResponder = NULL; - (void)windowDidResignKey:(NSNotification *)notification; - (void)windowDidBecomeKey:(NSNotification *)notification; - (void)windowDidMove:(NSNotification *)notification; +- (void)windowDidMiniaturize:(NSNotification *)notification; +- (void)windowDidDeminiaturize:(NSNotification *)notification; - (BOOL)windowShouldClose:(id)window; - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; +- (void)windowWillEnterFullScreen:(NSNotification *)notification; @end @@ -388,6 +405,28 @@ extern int wxOSXGetIdFromSelector(SEL action ); [self triggerMenu:_cmd]; } +- (void)windowDidMiniaturize:(NSNotification *)notification +{ + NSWindow* window = (NSWindow*) [notification object]; + wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation]; + if ( windowimpl ) + { + if ( wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer() ) + wxpeer->OSXHandleMiniaturize(0, [window isMiniaturized]); + } +} + +- (void)windowDidDeminiaturize:(NSNotification *)notification +{ + NSWindow* window = (NSWindow*) [notification object]; + wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation]; + if ( windowimpl ) + { + if ( wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer() ) + wxpeer->OSXHandleMiniaturize(0, [window isMiniaturized]); + } +} + - (BOOL)windowShouldClose:(id)nwindow { wxNonOwnedWindowCocoaImpl* windowimpl = [(NSWindow*) nwindow WX_implementation]; @@ -498,6 +537,7 @@ extern int wxOSXGetIdFromSelector(SEL action ); { editor = [[wxNSTextFieldEditor alloc] init]; [editor setFieldEditor:YES]; + [editor setTextField:tf]; [tf setFieldEditor:editor]; [editor release]; } @@ -511,6 +551,7 @@ extern int wxOSXGetIdFromSelector(SEL action ); { editor = [[wxNSTextFieldEditor alloc] init]; [editor setFieldEditor:YES]; + [editor setTextField:cb]; [cb setFieldEditor:editor]; [editor release]; } @@ -534,9 +575,29 @@ extern int wxOSXGetIdFromSelector(SEL action ); return true; } +// work around OS X bug, on a secondary monitor an already fully sized window +// (eg maximized) will not be correctly put to full screen size and keeps a 22px +// title band at the top free, therefore we force the correct content size + +- (void)windowWillEnterFullScreen:(NSNotification *)notification +{ + NSWindow* window = (NSWindow*) [notification object]; + + NSView* view = [window contentView]; + NSRect windowframe = [window frame]; + NSRect viewframe = [view frame]; + NSUInteger stylemask = [window styleMask] | NSFullScreenWindowMask; + NSRect expectedframerect = [NSWindow contentRectForFrameRect: windowframe styleMask: stylemask]; + + if ( !NSEqualSizes(expectedframerect.size, viewframe.size) ) + { + [view setFrameSize: expectedframerect.size]; + } +} + @end -IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl ) +wxIMPLEMENT_DYNAMIC_CLASS(wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl); wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) : wxNonOwnedWindowImpl(nonownedwnd) @@ -562,7 +623,8 @@ wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() if ([m_macWindow parentWindow] != 0) [[m_macWindow parentWindow] removeChildWindow: m_macWindow]; - [m_macWindow release]; + [m_macWindow setReleasedWhenClosed:YES]; + [m_macWindow close]; } } @@ -777,10 +839,7 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) { - [m_macWindow setBackgroundColor:[NSColor colorWithCalibratedRed:(CGFloat) (col.Red() / 255.0) - green:(CGFloat) (col.Green() / 255.0) - blue:(CGFloat) (col.Blue() / 255.0) - alpha:(CGFloat) (col.Alpha() / 255.0)]]; + [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; return true; } @@ -877,6 +936,27 @@ void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding [m_macWindow setTitle:wxCFStringRef( title , encoding ).AsNSString()]; } +bool wxNonOwnedWindowCocoaImpl::EnableCloseButton(bool enable) +{ + [[m_macWindow standardWindowButton:NSWindowCloseButton] setEnabled:enable]; + + return true; +} + +bool wxNonOwnedWindowCocoaImpl::EnableMaximizeButton(bool enable) +{ + [[m_macWindow standardWindowButton:NSWindowZoomButton] setEnabled:enable]; + + return true; +} + +bool wxNonOwnedWindowCocoaImpl::EnableMinimizeButton(bool enable) +{ + [[m_macWindow standardWindowButton:NSWindowMiniaturizeButton] setEnabled:enable]; + + return true; +} + bool wxNonOwnedWindowCocoaImpl::IsMaximized() const { if (([m_macWindow styleMask] & NSResizableWindowMask) != 0) @@ -924,11 +1004,42 @@ typedef struct bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const { + if ( IsUsingFullScreenApi(m_macWindow) ) + { + return [m_macWindow styleMask] & NSFullScreenWindowMask; + } + return m_macFullScreenData != NULL ; } +bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable) +{ + NSUInteger collectionBehavior = [m_macWindow collectionBehavior]; + if (enable) + { + collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary; + } + else + { + collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; + } + [m_macWindow setCollectionBehavior: collectionBehavior]; + + return true; +} + bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) { + if ( IsUsingFullScreenApi(m_macWindow) ) + { + if ( show != IsFullScreen() ) + { + [m_macWindow toggleFullScreen: nil]; + } + + return true; + } + if ( show ) { FullScreenData *data = (FullScreenData *)m_macFullScreenData ; @@ -939,18 +1050,12 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) data->m_formerLevel = [m_macWindow level]; data->m_formerFrame = [m_macWindow frame]; data->m_formerStyleMask = [m_macWindow styleMask]; -#if 0 - // CGDisplayCapture( kCGDirectMainDisplay ); - //[m_macWindow setLevel:NSMainMenuWindowLevel+1/*CGShieldingWindowLevel()*/]; -#endif + NSRect screenframe = [[NSScreen mainScreen] frame]; NSRect frame = NSMakeRect (0, 0, 100, 100); NSRect contentRect; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - if ( [ m_macWindow respondsToSelector:@selector(setStyleMask:) ] ) - [m_macWindow setStyleMask:data->m_formerStyleMask & ~ NSResizableWindowMask]; -#endif + [m_macWindow setStyleMask:data->m_formerStyleMask & ~ NSResizableWindowMask]; contentRect = [NSWindow contentRectForFrameRect: frame styleMask: [m_macWindow styleMask]]; @@ -968,16 +1073,10 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) else if ( m_macFullScreenData != NULL ) { FullScreenData *data = (FullScreenData *) m_macFullScreenData ; -#if 0 - // CGDisplayRelease( kCGDirectMainDisplay ); - // [m_macWindow setLevel:data->m_formerLevel]; -#endif [m_macWindow setFrame:data->m_formerFrame display:YES]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - if ( [ m_macWindow respondsToSelector:@selector(setStyleMask:) ] ) - [m_macWindow setStyleMask:data->m_formerStyleMask]; -#endif + [m_macWindow setStyleMask:data->m_formerStyleMask]; + delete data ; m_macFullScreenData = NULL ; @@ -1065,6 +1164,10 @@ WX_NSResponder wxNonOwnedWindowCocoaImpl::GetNextFirstResponder() return s_nextFirstResponder; } +WX_NSResponder wxNonOwnedWindowCocoaImpl::GetFormerFirstResponder() +{ + return s_formerFirstResponder; +} // // diff --git a/Externals/wxWidgets3/src/osx/cocoa/notebook.mm b/Externals/wxWidgets3/src/osx/cocoa/notebook.mm index d71ca4047c..f0d810275a 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/notebook.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/notebook.mm @@ -29,7 +29,7 @@ // controller // -@interface wxTabViewController : NSObject wxOSX_10_6_AND_LATER() +@interface wxTabViewController : NSObject { } @@ -161,12 +161,6 @@ m_image = image; if(!m_image) return; - [[NSPasteboard generalPasteboard] - declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] - owner:nil]; - [[NSPasteboard generalPasteboard] - setData:[m_image TIFFRepresentation] - forType:NSTIFFPboardType]; } @end // implementation WXCTabViewImageItem : NSTabViewItem @@ -178,7 +172,7 @@ public: { } - void GetContentArea( int &left , int &top , int &width , int &height ) const + void GetContentArea( int &left , int &top , int &width , int &height ) const wxOVERRIDE { wxNSTabView* slf = (wxNSTabView*) m_osxView; NSRect r = [slf contentRect]; @@ -188,17 +182,18 @@ public: height = (int)r.size.height; } - void SetValue( wxInt32 value ) + void SetValue( wxInt32 value ) wxOVERRIDE { wxNSTabView* slf = (wxNSTabView*) m_osxView; // avoid 'changed' events when setting the tab programmatically wxTabViewController* controller = [slf delegate]; [slf setDelegate:nil]; - [slf selectTabViewItemAtIndex:(value-1)]; + if ( value > 0 ) + [slf selectTabViewItemAtIndex:(value-1)]; [slf setDelegate:controller]; } - wxInt32 GetValue() const + wxInt32 GetValue() const wxOVERRIDE { wxNSTabView* slf = (wxNSTabView*) m_osxView; NSTabViewItem* selectedItem = [slf selectedTabViewItem]; @@ -208,7 +203,7 @@ public: return [slf indexOfTabViewItem:selectedItem]+1; } - void SetMaximum( wxInt32 maximum ) + void SetMaximum( wxInt32 maximum ) wxOVERRIDE { wxNSTabView* slf = (wxNSTabView*) m_osxView; int cocoacount = [slf numberOfTabViewItems ]; @@ -236,7 +231,7 @@ public: [slf setDelegate:controller]; } - void SetupTabs( const wxNotebook& notebook) + void SetupTabs( const wxNotebook& notebook) wxOVERRIDE { int pcount = notebook.GetPageCount(); @@ -260,7 +255,7 @@ public: } } - int TabHitTest(const wxPoint & pt, long* flags) + int TabHitTest(const wxPoint & pt, long* flags) wxOVERRIDE { int retval = wxNOT_FOUND; diff --git a/Externals/wxWidgets3/src/osx/cocoa/notifmsg.mm b/Externals/wxWidgets3/src/osx/cocoa/notifmsg.mm new file mode 100644 index 0000000000..bf9132a7b6 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/notifmsg.mm @@ -0,0 +1,256 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/osx/notifmsg.cpp +// Purpose: implementation of wxNotificationMessage for OSX +// Author: Tobias Taschner +// Created: 2015-08-06 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/notifmsg.h" + +#if wxUSE_NOTIFICATION_MESSAGE && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) + +#ifndef WX_PRECOMP + #include "wx/string.h" +#endif // WX_PRECOMP + +#include "wx/osx/private.h" +#include "wx/generic/notifmsg.h" +#include "wx/private/notifmsg.h" +#include "wx/generic/private/notifmsg.h" +#include "wx/timer.h" +#include "wx/platinfo.h" +#include "wx/artprov.h" +#include "wx/vector.h" +#include "wx/stockitem.h" + +#include "wx/utils.h" +#include + +@interface wxUserNotificationHandler : NSObject + +@end + +// ---------------------------------------------------------------------------- +// wxUserNotificationMsgImpl +// ---------------------------------------------------------------------------- + +class wxUserNotificationMsgImpl : public wxNotificationMessageImpl +{ +public: + wxUserNotificationMsgImpl(wxNotificationMessageBase* notification) : + wxNotificationMessageImpl(notification) + { + UseHandler(); + m_notif = [[NSUserNotification alloc] init]; + + // Build Id to unqiuely idendify this notification + m_id = wxString::Format("%d_%d", (int)wxGetProcessId(), ms_notifIdBase++); + + // Register the notification + ms_activeNotifications[m_id] = this; + + wxCFStringRef cfId(m_id); + m_notif.userInfo = @{ + @"wxId" : cfId.AsNSString() + }; + } + + virtual ~wxUserNotificationMsgImpl() + { + ms_activeNotifications[m_id] = NULL; + ReleaseHandler(); + [m_notif release]; + } + + virtual bool Show(int WXUNUSED(timeout)) wxOVERRIDE + { + NSUserNotificationCenter* nc = [NSUserNotificationCenter defaultUserNotificationCenter]; + [nc deliverNotification:m_notif]; + + return true; + } + + virtual bool Close() wxOVERRIDE + { + NSUserNotificationCenter* nc = [NSUserNotificationCenter defaultUserNotificationCenter]; + [nc removeDeliveredNotification:m_notif]; + + return true; + } + + virtual void SetTitle(const wxString& title) wxOVERRIDE + { + wxCFStringRef cftitle(title); + m_notif.title = cftitle.AsNSString(); + } + + virtual void SetMessage(const wxString& message) wxOVERRIDE + { + wxCFStringRef cfmsg(message); + m_notif.informativeText = cfmsg.AsNSString(); + } + + virtual void SetParent(wxWindow *WXUNUSED(parent)) wxOVERRIDE + { + } + + virtual void SetFlags(int WXUNUSED(flags)) wxOVERRIDE + { + // On OS X we do not add an icon based on the flags, + // as this is primarily meant for custom icons + } + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE + { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + // Additional icon in the notification is only supported on OS X 10.9+ + if ([NSUserNotification instancesRespondToSelector:@selector(setContentImage:)]) + m_notif.contentImage = icon.GetNSImage(); +#endif + } + + virtual bool AddAction(wxWindowID actionid, const wxString &label) + { + if (m_actions.size() >= 1) // Currently only 1 actions are supported + return false; + + wxString strLabel = label; + if (strLabel.empty()) + strLabel = wxGetStockLabel(actionid, wxSTOCK_NOFLAGS); + wxCFStringRef cflabel(strLabel); + + m_actions.push_back(actionid); + + if (m_actions.size() == 1) + m_notif.actionButtonTitle = cflabel.AsNSString(); + + return true; + } + + void Activated(NSUserNotificationActivationType activationType) + { + switch (activationType) + { + case NSUserNotificationActivationTypeNone: + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_DISMISSED); + ProcessNotificationEvent(evt); + break; + } + case NSUserNotificationActivationTypeContentsClicked: + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_CLICK); + ProcessNotificationEvent(evt); + Close(); + break; + } + case NSUserNotificationActivationTypeActionButtonClicked: + { + if (m_actions.empty()) + { + // Without actions the action button is handled as a message click + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_CLICK); + ProcessNotificationEvent(evt); + } + else + { + wxCommandEvent evt(wxEVT_NOTIFICATION_MESSAGE_ACTION); + evt.SetId(m_actions[0]); + ProcessNotificationEvent(evt); + } + Close(); + break; + } + + default: + break; + }; + } + + static void NotificationActivated(const wxString& notificationId, NSUserNotificationActivationType activationType) + { + wxUserNotificationMsgImpl* impl = ms_activeNotifications[notificationId]; + if (impl) + impl->Activated(activationType); + } + + static void UseHandler() + { + if (!ms_handler) + { + ms_handler = [wxUserNotificationHandler alloc]; + [NSUserNotificationCenter defaultUserNotificationCenter].delegate = ms_handler; + } + } + + static void ReleaseHandler() + { + + } + +private: + NSUserNotification* m_notif; + wxString m_id; + wxVector m_actions; + + static wxUserNotificationHandler* ms_handler; + static std::map ms_activeNotifications; + static int ms_notifIdBase; +}; + +wxUserNotificationHandler* wxUserNotificationMsgImpl::ms_handler = nil; +std::map wxUserNotificationMsgImpl::ms_activeNotifications; +int wxUserNotificationMsgImpl::ms_notifIdBase = 1000; + +// ---------------------------------------------------------------------------- +// wxUserNotificationHandler +// ---------------------------------------------------------------------------- + +@implementation wxUserNotificationHandler + +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification +{ + NSString* notifId = [notification.userInfo objectForKey:@"wxId"]; + if (notifId) + wxUserNotificationMsgImpl::NotificationActivated(wxCFStringRef::AsString(notifId), notification.activationType); +} + +@end + +// ============================================================================ +// implementation +// ============================================================================ + + +// ---------------------------------------------------------------------------- +// wxNotificationMessage +// ---------------------------------------------------------------------------- + +void wxNotificationMessage::Init() +{ + // Native notifications are not available prior to 10.8, fallback + // to generic ones on 10.7 + if (wxPlatformInfo::Get().CheckOSVersion(10, 8)) + m_impl = new wxUserNotificationMsgImpl(this); + else + m_impl = new wxGenericNotificationMessageImpl(this); +} + +#endif // wxUSE_NOTIFICATION_MESSAGE && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE) diff --git a/Externals/wxWidgets3/src/osx/cocoa/power.mm b/Externals/wxWidgets3/src/osx/cocoa/power.mm new file mode 100644 index 0000000000..28d6b89781 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/power.mm @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/power.mm +// Purpose: wxPowerResource implementation for OSX +// Author: Tobias Taschner +// Created: 2014-08-09 +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#include "wx/power.h" +#include "wx/atomic.h" +#include "wx/platinfo.h" +#include "wx/osx/private.h" + +#include + +// ---------------------------------------------------------------------------- +// wxPowerResource +// ---------------------------------------------------------------------------- + +wxAtomicInt g_powerResourceSystemRefCount = 0; + +IOPMAssertionID g_pmAssertionID = 0; +NSObject* g_processInfoActivity = nil; + +bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason) +{ + if ( g_powerResourceSystemRefCount >= 1 ) + { + wxCFStringRef cfreason(reason); + if( reason.IsEmpty()) + cfreason = wxString("User Activity"); + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + if ( wxPlatformInfo::Get().CheckOSVersion(10, 9) ) + { + // Use NSProcessInfo for 10.9 and newer + if ( !g_processInfoActivity ) + { + NSActivityOptions + options = NSActivityUserInitiated | + NSActivityIdleSystemSleepDisabled; + + if ( kind == wxPOWER_RESOURCE_SCREEN ) + options |= NSActivityIdleDisplaySleepDisabled; + + g_processInfoActivity = [[NSProcessInfo processInfo] + beginActivityWithOptions:options + reason:cfreason.AsNSString()]; + [g_processInfoActivity retain]; + return true; + } + } + else +#endif + if ( !g_pmAssertionID ) + { + CFStringRef assertType; + if ( kind == wxPOWER_RESOURCE_SCREEN ) + assertType = kIOPMAssertionTypeNoDisplaySleep; + else + assertType = kIOPMAssertionTypeNoIdleSleep; + + // Use power manager API for < 10.9 systems + IOReturn success = IOPMAssertionCreateWithName + ( + assertType, + kIOPMAssertionLevelOn, + cfreason, + &g_pmAssertionID + ); + if ( success == kIOReturnSuccess ) + return true; + } + } + else if ( g_powerResourceSystemRefCount == 0 ) + { + // Release power assertion +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 + if ( wxPlatformInfo::Get().CheckOSVersion(10, 9) ) + { + // Use NSProcessInfo for 10.9 and newer + if ( g_processInfoActivity ) + { + [[NSProcessInfo processInfo] + endActivity:(id)g_processInfoActivity]; + g_processInfoActivity = nil; + + return true; + } + } + else +#endif + if ( g_pmAssertionID ) + { + // Use power manager API for < 10.9 systems + IOReturn success = IOPMAssertionRelease(g_pmAssertionID); + g_pmAssertionID = 0; + if (success == kIOReturnSuccess) + return true; + } + } + + return true; +} + +bool wxPowerResource::Acquire(wxPowerResourceKind kind, const wxString& reason) +{ + wxAtomicInc(g_powerResourceSystemRefCount); + + bool success = UpdatePowerResourceUsage(kind, reason); + if (!success) + wxAtomicDec(g_powerResourceSystemRefCount); + + return success; +} + +void wxPowerResource::Release(wxPowerResourceKind kind) +{ + switch ( kind ) + { + case wxPOWER_RESOURCE_SCREEN: + case wxPOWER_RESOURCE_SYSTEM: + if ( g_powerResourceSystemRefCount > 0 ) + { + wxAtomicDec(g_powerResourceSystemRefCount); + } + else + { + wxFAIL_MSG("Power resource was not acquired"); + } + + UpdatePowerResourceUsage(kind, ""); + break; + } +} diff --git a/Externals/wxWidgets3/src/osx/cocoa/preferences.mm b/Externals/wxWidgets3/src/osx/cocoa/preferences.mm index 7b51732bf0..2590bd24df 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/preferences.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/preferences.mm @@ -91,7 +91,7 @@ public: tool->SetClientData(info.get()); } - virtual bool Show(bool show) + virtual bool Show(bool show) wxOVERRIDE { if ( show && !m_toolbarRealized ) { @@ -107,12 +107,12 @@ public: return wxFrame::Show(show); } - virtual bool ShouldPreventAppExit() const { return false; } + virtual bool ShouldPreventAppExit() const wxOVERRIDE { return false; } protected: // Native preferences windows resize when the selected panel changes and // the resizing is animated, so we need to override DoMoveWindow. - virtual void DoMoveWindow(int x, int y, int width, int height) + virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE { NSRect r = wxToNSRect(NULL, wxRect(x, y, width, height)); NSWindow *win = (NSWindow*)GetWXWindow(); @@ -207,12 +207,12 @@ public: m_win->Destroy(); } - virtual void AddPage(wxPreferencesPage* page) + virtual void AddPage(wxPreferencesPage* page) wxOVERRIDE { GetWin()->AddPage(page); } - virtual void Show(wxWindow* WXUNUSED(parent)) + virtual void Show(wxWindow* WXUNUSED(parent)) wxOVERRIDE { // OS X preferences windows don't have parents, they are independent // windows, so we just ignore the 'parent' argument. @@ -221,7 +221,7 @@ public: win->Raise(); } - virtual void Dismiss() + virtual void Dismiss() wxOVERRIDE { // Don't destroy the window, only hide it, because OS X preferences // window typically remember their state even when closed. Reopening diff --git a/Externals/wxWidgets3/src/osx/cocoa/printdlg.mm b/Externals/wxWidgets3/src/osx/cocoa/printdlg.mm index 06c7e15950..2b1c88a6ab 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/printdlg.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/printdlg.mm @@ -28,7 +28,7 @@ #include "wx/osx/private/print.h" #include "wx/osx/private.h" -IMPLEMENT_CLASS(wxOSXCocoaPrintData, wxOSXPrintData) +wxIMPLEMENT_CLASS(wxOSXCocoaPrintData, wxOSXPrintData); wxOSXCocoaPrintData::wxOSXCocoaPrintData() { diff --git a/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm b/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm index a93ae41f15..7f80e3d047 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm @@ -48,12 +48,12 @@ public : m_maximum = 1; } - void SetMaximum(wxInt32 v) + void SetMaximum(wxInt32 v) wxOVERRIDE { m_maximum = (v == 0) ? 1 : v; } - void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) + void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ) wxOVERRIDE { double v = ((double) value)/m_maximum; double t = ((double) thumbSize)/(m_maximum+thumbSize); @@ -61,18 +61,18 @@ public : [(wxNSScroller*) m_osxView setKnobProportion:t]; } - virtual wxInt32 GetValue() const + virtual wxInt32 GetValue() const wxOVERRIDE { return wxRound([(wxNSScroller*) m_osxView floatValue] * m_maximum); } - virtual wxInt32 GetMaximum() const + virtual wxInt32 GetMaximum() const wxOVERRIDE { return m_maximum; } - virtual void controlAction(WXWidget slf, void* _cmd, void *sender); - virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void controlAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; + virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd) wxOVERRIDE; protected: wxInt32 m_maximum; }; diff --git a/Externals/wxWidgets3/src/osx/cocoa/settings.mm b/Externals/wxWidgets3/src/osx/cocoa/settings.mm new file mode 100644 index 0000000000..6ccaf26490 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/settings.mm @@ -0,0 +1,251 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/settings.mm +// Purpose: wxSettings +// Author: David Elliott +// Modified by: Tobias Taschner +// Created: 2005/01/11 +// Copyright: (c) 2005 David Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#include "wx/settings.h" + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/gdicmn.h" +#endif + +#include "wx/osx/core/private.h" +#include "wx/osx/cocoa/private.h" + +#import + +// ---------------------------------------------------------------------------- +// wxSystemSettingsNative +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// colours +// ---------------------------------------------------------------------------- + +wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) +{ + NSColor* sysColor = nil; + switch( index ) + { + case wxSYS_COLOUR_SCROLLBAR: + sysColor = [NSColor scrollBarColor]; // color of slot + break; + case wxSYS_COLOUR_DESKTOP: // No idea how to get desktop background + // fall through, window background is reasonable + case wxSYS_COLOUR_ACTIVECAPTION: // No idea how to get this + // fall through, window background is reasonable + case wxSYS_COLOUR_INACTIVECAPTION: // No idea how to get this + // fall through, window background is reasonable + case wxSYS_COLOUR_MENU: + case wxSYS_COLOUR_MENUBAR: + case wxSYS_COLOUR_WINDOWFRAME: + case wxSYS_COLOUR_ACTIVEBORDER: + case wxSYS_COLOUR_INACTIVEBORDER: + case wxSYS_COLOUR_GRADIENTACTIVECAPTION: + case wxSYS_COLOUR_GRADIENTINACTIVECAPTION: + sysColor = [NSColor windowFrameColor]; + break; + case wxSYS_COLOUR_WINDOW: + return wxColour(wxMacCreateCGColorFromHITheme( 15 /* kThemeBrushDocumentWindowBackground */ )) ; + case wxSYS_COLOUR_BTNFACE: + return wxColour(wxMacCreateCGColorFromHITheme( 3 /* kThemeBrushDialogBackgroundActive */)); + case wxSYS_COLOUR_LISTBOX: + sysColor = [NSColor controlBackgroundColor]; + break; + case wxSYS_COLOUR_BTNSHADOW: + sysColor = [NSColor controlShadowColor]; + break; + case wxSYS_COLOUR_BTNTEXT: + case wxSYS_COLOUR_MENUTEXT: + case wxSYS_COLOUR_WINDOWTEXT: + case wxSYS_COLOUR_CAPTIONTEXT: + case wxSYS_COLOUR_INFOTEXT: + case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + case wxSYS_COLOUR_LISTBOXTEXT: + sysColor = [NSColor controlTextColor]; + break; + case wxSYS_COLOUR_HIGHLIGHT: + sysColor = [NSColor selectedTextBackgroundColor]; + break; + case wxSYS_COLOUR_BTNHIGHLIGHT: + sysColor = [NSColor controlHighlightColor]; + break; + case wxSYS_COLOUR_GRAYTEXT: + sysColor = [NSColor disabledControlTextColor]; + break; + case wxSYS_COLOUR_3DDKSHADOW: + sysColor = [NSColor controlShadowColor]; + break; + case wxSYS_COLOUR_3DLIGHT: + sysColor = [NSColor controlHighlightColor]; + break; + case wxSYS_COLOUR_HIGHLIGHTTEXT: + sysColor = [NSColor selectedTextColor]; + break; + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: + sysColor = [NSColor alternateSelectedControlTextColor]; + break; + case wxSYS_COLOUR_INFOBK: + // tooltip (bogus) + sysColor = [NSColor windowBackgroundColor]; + break; + case wxSYS_COLOUR_APPWORKSPACE: + // MDI window color (bogus) + sysColor = [NSColor windowBackgroundColor]; + break; + case wxSYS_COLOUR_HOTLIGHT: + // OSX doesn't change color on mouse hover + sysColor = [NSColor controlTextColor]; + break; + case wxSYS_COLOUR_MENUHILIGHT: + sysColor = [NSColor selectedMenuItemColor]; + break; + case wxSYS_COLOUR_MAX: + default: + if(index>=wxSYS_COLOUR_MAX) + { + wxFAIL_MSG(wxT("Invalid system colour index")); + return wxColour(); + } + } + + wxCHECK_MSG( sysColor, wxColour(), wxS("Unimplemented system colour") ); + + return wxColour(sysColor); +} + +// ---------------------------------------------------------------------------- +// fonts +// ---------------------------------------------------------------------------- + +wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) +{ + switch (index) + { + case wxSYS_ANSI_VAR_FONT : + case wxSYS_SYSTEM_FONT : + case wxSYS_DEVICE_DEFAULT_FONT : + case wxSYS_DEFAULT_GUI_FONT : + { + return *wxSMALL_FONT ; + } ; + break ; + case wxSYS_OEM_FIXED_FONT : + case wxSYS_ANSI_FIXED_FONT : + case wxSYS_SYSTEM_FIXED_FONT : + default : + { + return *wxNORMAL_FONT ; + } ; + break ; + + } + return *wxNORMAL_FONT; +} + +// ---------------------------------------------------------------------------- +// system metrics/features +// ---------------------------------------------------------------------------- + +// Get a system metric, e.g. scrollbar size +int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow *WXUNUSED(win)) +{ + int value; + + switch ( index ) + { + case wxSYS_MOUSE_BUTTONS: + return 2; // we emulate a two button mouse (ctrl + click = right button ) + + // TODO case wxSYS_BORDER_X: + // TODO case wxSYS_BORDER_Y: + // TODO case wxSYS_CURSOR_X: + // TODO case wxSYS_CURSOR_Y: + // TODO case wxSYS_DCLICK_X: + // TODO case wxSYS_DCLICK_Y: + // TODO case wxSYS_DRAG_X: + // TODO case wxSYS_DRAG_Y: + // TODO case wxSYS_EDGE_X: + // TODO case wxSYS_EDGE_Y: + + case wxSYS_HSCROLL_ARROW_X: + return 16; + case wxSYS_HSCROLL_ARROW_Y: + return 16; + case wxSYS_HTHUMB_X: + return 16; + + // TODO case wxSYS_ICON_X: + // TODO case wxSYS_ICON_Y: + // TODO case wxSYS_ICONSPACING_X: + // TODO case wxSYS_ICONSPACING_Y: + // TODO case wxSYS_WINDOWMIN_X: + // TODO case wxSYS_WINDOWMIN_Y: + + case wxSYS_SCREEN_X: + wxDisplaySize(&value, NULL); + return value; + + case wxSYS_SCREEN_Y: + wxDisplaySize(NULL, &value); + return value; + + // TODO case wxSYS_FRAMESIZE_X: + // TODO case wxSYS_FRAMESIZE_Y: + // TODO case wxSYS_SMALLICON_X: + // TODO case wxSYS_SMALLICON_Y: + + case wxSYS_HSCROLL_Y: + return 16; + case wxSYS_VSCROLL_X: + return 16; + case wxSYS_VSCROLL_ARROW_X: + return 16; + case wxSYS_VSCROLL_ARROW_Y: + return 16; + case wxSYS_VTHUMB_Y: + return 16; + + // TODO case wxSYS_CAPTION_Y: + // TODO case wxSYS_MENU_Y: + // TODO case wxSYS_NETWORK_PRESENT: + + case wxSYS_PENWINDOWS_PRESENT: + return 0; + + // TODO case wxSYS_SHOW_SOUNDS: + + case wxSYS_SWAP_BUTTONS: + return 0; + + case wxSYS_DCLICK_MSEC: + // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway + // but rather rely on the 'click-count' by the system delivered in a mouse event + return 500; + + default: + return -1; // unsupported metric + } + return 0; +} + +bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) +{ + switch (index) + { + case wxSYS_CAN_ICONIZE_FRAME: + case wxSYS_CAN_DRAW_FRAME_DECORATIONS: + return true; + + default: + return false; + } +} diff --git a/Externals/wxWidgets3/src/osx/cocoa/slider.mm b/Externals/wxWidgets3/src/osx/cocoa/slider.mm index 2803fbcd32..607507b99b 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/slider.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/slider.mm @@ -46,8 +46,8 @@ public : { } - virtual void controlAction(WXWidget slf, void* _cmd, void *sender); - virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void controlAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; + virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd) wxOVERRIDE; }; // we will have a mouseDown, then in the native diff --git a/Externals/wxWidgets3/src/osx/cocoa/spinbutt.mm b/Externals/wxWidgets3/src/osx/cocoa/spinbutt.mm index 67675aba9f..e3e197f12d 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/spinbutt.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/spinbutt.mm @@ -47,8 +47,8 @@ public : { } - virtual void controlAction(WXWidget slf, void* _cmd, void *sender); - virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd); + virtual void controlAction(WXWidget slf, void* _cmd, void *sender) wxOVERRIDE; + virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd) wxOVERRIDE; private: int m_formerValue; }; diff --git a/Externals/wxWidgets3/src/osx/cocoa/srchctrl.mm b/Externals/wxWidgets3/src/osx/cocoa/srchctrl.mm index 880d590773..162408426b 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/srchctrl.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/srchctrl.mm @@ -101,7 +101,7 @@ public : ~wxNSSearchFieldControl(); // search field options - virtual void ShowSearchButton( bool show ) + virtual void ShowSearchButton( bool show ) wxOVERRIDE { if ( show ) [m_searchFieldCell resetSearchButtonCell]; @@ -110,12 +110,12 @@ public : [m_searchField setNeedsDisplay:YES]; } - virtual bool IsSearchButtonVisible() const + virtual bool IsSearchButtonVisible() const wxOVERRIDE { return [m_searchFieldCell searchButtonCell] != nil; } - virtual void ShowCancelButton( bool show ) + virtual void ShowCancelButton( bool show ) wxOVERRIDE { if ( show ) [m_searchFieldCell resetCancelButtonCell]; @@ -124,12 +124,12 @@ public : [m_searchField setNeedsDisplay:YES]; } - virtual bool IsCancelButtonVisible() const + virtual bool IsCancelButtonVisible() const wxOVERRIDE { return [m_searchFieldCell cancelButtonCell] != nil; } - virtual void SetSearchMenu( wxMenu* menu ) + virtual void SetSearchMenu( wxMenu* menu ) wxOVERRIDE { if ( menu ) [m_searchFieldCell setSearchMenuTemplate:menu->GetHMenu()]; @@ -138,24 +138,24 @@ public : [m_searchField setNeedsDisplay:YES]; } - virtual void SetDescriptiveText(const wxString& text) + virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE { [m_searchFieldCell setPlaceholderString: wxCFStringRef( text , m_wxPeer->GetFont().GetEncoding() ).AsNSString()]; } - virtual bool SetFocus() + virtual bool SetFocus() wxOVERRIDE { return wxNSTextFieldControl::SetFocus(); } - void controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender)) + void controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender)) wxOVERRIDE { wxSearchCtrl* wxpeer = (wxSearchCtrl*) GetWXPeer(); if ( wxpeer ) { NSString *searchString = [m_searchField stringValue]; - if ( searchString == nil ) + if ( searchString == nil || !searchString.length ) { wxpeer->HandleSearchFieldCancelHit(); } @@ -165,7 +165,25 @@ public : } } } - + + virtual void SetCentredLook( bool centre ) + { + SEL sel = @selector(setCenteredLook:); + if ( [m_searchFieldCell respondsToSelector: sel] ) + { + // all this avoids xcode parsing warnings when using + // [m_searchFieldCell setCenteredLook:NO]; + NSMethodSignature* signature = + [NSSearchFieldCell instanceMethodSignatureForSelector:sel]; + NSInvocation* invocation = + [NSInvocation invocationWithMethodSignature: signature]; + [invocation setTarget: m_searchFieldCell]; + [invocation setSelector:sel]; + [invocation setArgument:¢re atIndex:2]; + [invocation invoke]; + } + } + private: wxNSSearchField* m_searchField; NSSearchFieldCell* m_searchFieldCell; @@ -186,12 +204,17 @@ wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer, { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSSearchField* v = [[wxNSSearchField alloc] initWithFrame:r]; + + // Make it behave consistently with the single line wxTextCtrl + [[v cell] setScrollable:YES]; + [[v cell] setSendsWholeSearchString:YES]; // per wx default cancel is not shown [[v cell] setCancelButtonCell:nil]; wxNSSearchFieldControl* c = new wxNSSearchFieldControl( wxpeer, v ); c->SetNeedsFrame( false ); + c->SetCentredLook( false ); c->SetStringValue( str ); return c; } diff --git a/Externals/wxWidgets3/src/osx/cocoa/statbox.mm b/Externals/wxWidgets3/src/osx/cocoa/statbox.mm index 1a346a4d75..1a18df3ffe 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/statbox.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/statbox.mm @@ -39,7 +39,7 @@ namespace { } - virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) + virtual void SetLabel( const wxString& title, wxFontEncoding encoding ) wxOVERRIDE { if (title.empty()) [GetNSBox() setTitlePosition:NSNoTitle]; @@ -71,6 +71,9 @@ wxWidgetImplType* wxWidgetImpl::CreateGroupBox( wxWindowMac* wxpeer, { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSBox* v = [[wxNSBox alloc] initWithFrame:r]; + NSSize margin = { 0.0, 0.0 }; + [v setContentViewMargins: margin]; + [v sizeToFit]; wxStaticBoxCocoaImpl* c = new wxStaticBoxCocoaImpl( wxpeer, v ); #if !wxOSX_USE_NATIVE_FLIPPED c->SetFlipped(false); diff --git a/Externals/wxWidgets3/src/osx/cocoa/stattext.mm b/Externals/wxWidgets3/src/osx/cocoa/stattext.mm index 832b319017..48b83340e4 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/stattext.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/stattext.mm @@ -32,6 +32,7 @@ @interface wxNSStaticTextView : NSTextField { + NSColor *m_textColor; } @end @@ -47,21 +48,35 @@ } } +- (void)dealloc +{ + [m_textColor release]; + [super dealloc]; +} + - (void) setEnabled:(BOOL) flag -{ +{ + bool wasEnabled = [self isEnabled]; + [super setEnabled: flag]; - if (![self drawsBackground]) { - // Static text is drawn incorrectly when disabled. - // For an explanation, see - // http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028 + if (![self drawsBackground]) { + // Static text is drawn incorrectly when disabled. + // For an explanation, see + // http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028 if (flag) { - [self setTextColor: [NSColor controlTextColor]]; + if (m_textColor) + [self setTextColor: m_textColor]; } else - { - [self setTextColor: [NSColor secondarySelectedControlColor]]; + { + if (wasEnabled) + { + [m_textColor release]; + m_textColor = [[self textColor] retain]; + } + [self setTextColor: [NSColor disabledControlTextColor]]; } } } @@ -76,7 +91,7 @@ public: m_lineBreak = lineBreak; } - virtual void SetLabel(const wxString& title, wxFontEncoding encoding) + virtual void SetLabel(const wxString& title, wxFontEncoding encoding) wxOVERRIDE { wxCFStringRef text( title , encoding ); @@ -87,7 +102,7 @@ public: } #if wxUSE_MARKUP - virtual void SetLabelMarkup( const wxString& markup) + virtual void SetLabelMarkup( const wxString& markup) wxOVERRIDE { wxMarkupToAttrString toAttr(GetWXPeer(), markup); @@ -140,8 +155,8 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer, [v setBezeled:NO]; [v setBordered:NO]; - NSLineBreakMode linebreak = NSLineBreakByWordWrapping; - if ( ((wxStaticText*)wxpeer)->IsEllipsized() ) + NSLineBreakMode linebreak = NSLineBreakByClipping; + if ( style & wxST_ELLIPSIZE_MASK ) { if ( style & wxST_ELLIPSIZE_MIDDLE ) linebreak = NSLineBreakByTruncatingMiddle; diff --git a/Externals/wxWidgets3/src/osx/cocoa/stdpaths.mm b/Externals/wxWidgets3/src/osx/cocoa/stdpaths.mm new file mode 100644 index 0000000000..8c0f0836dc --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/stdpaths.mm @@ -0,0 +1,129 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/stdpaths.mm +// Purpose: wxStandardPaths for Cocoa +// Author: Tobias Taschner +// Created: 2015-09-09 +// Copyright: (c) 2015 wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#if wxUSE_STDPATHS + +#include "wx/stdpaths.h" +#include "wx/osx/private.h" +#include "wx/osx/core/cfstring.h" + +#import + +// ============================================================================ +// implementation +// ============================================================================ + +static wxString GetFMDirectory( + NSSearchPathDirectory directory, + NSSearchPathDomainMask domainMask) +{ + NSURL* url = [[NSFileManager defaultManager] URLForDirectory:directory + inDomain:domainMask + appropriateForURL:nil + create:NO error:nil]; + return wxCFStringRef::AsString((CFStringRef)url.path); +} + +wxStandardPaths::wxStandardPaths() +{ + +} + +wxStandardPaths::~wxStandardPaths() +{ + +} + +wxString wxStandardPaths::GetExecutablePath() const +{ + return wxCFStringRef::AsString((CFStringRef)[NSBundle mainBundle].executablePath); +} + +wxString wxStandardPaths::GetConfigDir() const +{ + return GetFMDirectory(NSLibraryDirectory, NSLocalDomainMask) + "/Preferences"; +} + +wxString wxStandardPaths::GetUserConfigDir() const +{ + return GetFMDirectory(NSLibraryDirectory, NSUserDomainMask) + "/Preferences"; +} + +wxString wxStandardPaths::GetDataDir() const +{ + return wxCFStringRef::AsString((CFStringRef)[NSBundle mainBundle].sharedSupportPath); +} + +wxString wxStandardPaths::GetLocalDataDir() const +{ + return AppendAppInfo(GetFMDirectory(NSApplicationSupportDirectory, NSLocalDomainMask)); +} + +wxString wxStandardPaths::GetUserDataDir() const +{ + return AppendAppInfo(GetFMDirectory(NSApplicationSupportDirectory, NSUserDomainMask)); +} + +wxString wxStandardPaths::GetPluginsDir() const +{ + return wxCFStringRef::AsString((CFStringRef)[NSBundle mainBundle].builtInPlugInsPath); +} + +wxString wxStandardPaths::GetResourcesDir() const +{ + return wxCFStringRef::AsString((CFStringRef)[NSBundle mainBundle].resourcePath); +} + +wxString +wxStandardPaths::GetLocalizedResourcesDir(const wxString& lang, + ResourceCat category) const +{ + return wxStandardPathsBase:: + GetLocalizedResourcesDir(lang, category) + wxT(".lproj"); +} + +wxString wxStandardPaths::GetUserDir(Dir userDir) const +{ + NSSearchPathDirectory dirType; + switch (userDir) + { + case Dir_Desktop: + dirType = NSDesktopDirectory; + break; + case Dir_Downloads: + dirType = NSDownloadsDirectory; + break; + case Dir_Music: + dirType = NSMusicDirectory; + break; + case Dir_Pictures: + dirType = NSPicturesDirectory; + break; + case Dir_Videos: + dirType = NSMoviesDirectory; + break; + default: + dirType = NSDocumentDirectory; + break; + } + + return GetFMDirectory(dirType, NSUserDomainMask); +} + +#endif // wxUSE_STDPATHS diff --git a/Externals/wxWidgets3/src/osx/cocoa/taskbar.mm b/Externals/wxWidgets3/src/osx/cocoa/taskbar.mm index 06342b4e72..8226568231 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/taskbar.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/taskbar.mm @@ -44,7 +44,7 @@ public: private: wxTaskBarIconImpl *m_impl; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; // ============================================================================ @@ -88,9 +88,9 @@ class wxTaskBarIconDockImpl: public wxTaskBarIconImpl public: wxTaskBarIconDockImpl(wxTaskBarIcon *taskBarIcon); virtual ~wxTaskBarIconDockImpl(); - virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - virtual bool RemoveIcon(); - virtual bool PopupMenu(wxMenu *menu); + virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString) wxOVERRIDE; + virtual bool RemoveIcon() wxOVERRIDE; + virtual bool PopupMenu(wxMenu *menu) wxOVERRIDE; static WX_NSMenu OSXGetDockHMenu(); protected: @@ -120,11 +120,11 @@ public: wxTaskBarIconCustomStatusItemImpl(wxTaskBarIcon *taskBarIcon); virtual ~wxTaskBarIconCustomStatusItemImpl(); - virtual bool IsStatusItem() const { return true; } + virtual bool IsStatusItem() const wxOVERRIDE { return true; } - virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - virtual bool RemoveIcon(); - virtual bool PopupMenu(wxMenu *menu); + virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString) wxOVERRIDE; + virtual bool RemoveIcon() wxOVERRIDE; + virtual bool PopupMenu(wxMenu *menu) wxOVERRIDE; protected: NSStatusItem *m_statusItem; wxOSXStatusItemTarget *m_target; @@ -136,7 +136,7 @@ private: // wxTaskBarIcon implementation // The facade class. // ============================================================================ -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType iconType) { @@ -355,18 +355,32 @@ bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxStri m_icon.CopyFromIcon(icon); // status item doesn't scale automatically + // first scale to optimal pixel resolution - int dimension = m_icon.GetHeight(); - if ( m_icon.GetWidth() > dimension ) - dimension = m_icon.GetWidth(); - if ( dimension > 16 ) + int dimension = wxMax( m_icon.GetHeight(), m_icon.GetWidth() ); + int target_dimension = 16 * wxOSXGetMainScreenContentScaleFactor(); + if ( dimension > target_dimension ) { wxImage img = m_icon.ConvertToImage(); - int factor = (dimension+15)/16; + int factor = (dimension+(target_dimension-1))/target_dimension; m_icon = img.ShrinkBy(factor, factor); } - [m_statusItem setImage:m_icon.GetNSImage()]; + NSImage* nsimage = m_icon.GetNSImage(); + NSSize size = [nsimage size]; + + // then scale to optimal point resolution + + dimension = wxMax(size.width,size.height); + if ( dimension > 16 ) + { + int factor = (dimension+15)/16; + size.width /= factor; + size.height /= factor; + [nsimage setSize:size]; + } + [m_statusItem setImage:nsimage]; + wxCFStringRef cfTooltip(tooltip); [m_statusItem setToolTip:cfTooltip.AsNSString()]; return true; @@ -401,10 +415,10 @@ bool wxTaskBarIconCustomStatusItemImpl::PopupMenu(wxMenu *menu) // wxTaskBarIconWindow // ============================================================================ -BEGIN_EVENT_TABLE(wxTaskBarIconWindow, wxWindow) -EVT_MENU(-1, wxTaskBarIconWindow::OnMenuEvent) -EVT_UPDATE_UI(-1, wxTaskBarIconWindow::OnUpdateUIEvent) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxTaskBarIconWindow, wxWindow) + EVT_MENU(-1, wxTaskBarIconWindow::OnMenuEvent) + EVT_UPDATE_UI(-1, wxTaskBarIconWindow::OnUpdateUIEvent) +wxEND_EVENT_TABLE() wxTaskBarIconWindow::wxTaskBarIconWindow(wxTaskBarIconImpl *impl) : m_impl(impl) diff --git a/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm b/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm index bec0c44431..facb561681 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm @@ -116,21 +116,23 @@ protected : NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; -// a minimal NSFormatter that just avoids getting too long entries -@interface wxMaximumLengthFormatter : NSFormatter +// an NSFormatter used to implement SetMaxLength() and ForceUpper() methods +@interface wxTextEntryFormatter : NSFormatter { int maxLength; wxTextEntry* field; + bool forceUpper; } @end -@implementation wxMaximumLengthFormatter +@implementation wxTextEntryFormatter - (id)init { self = [super init]; maxLength = 0; + forceUpper = false; return self; } @@ -139,6 +141,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; maxLength = maxlen; } +- (void) forceUpper +{ + forceUpper = true; +} + - (NSString *)stringForObjectValue:(id)anObject { if(![anObject isKindOfClass:[NSString class]]) @@ -155,12 +162,25 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; - (BOOL)isPartialStringValid:(NSString **)partialStringPtr proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error { - int len = [*partialStringPtr length]; - if ( maxLength > 0 && len > maxLength ) + if ( maxLength > 0 ) { - field->SendMaxLenEvent(); - return NO; + if ( [*partialStringPtr length] > maxLength ) + { + field->SendMaxLenEvent(); + return NO; + } } + + if ( forceUpper ) + { + NSString* upper = [*partialStringPtr uppercaseString]; + if ( ![*partialStringPtr isEqual:upper] ) + { + *partialStringPtr = upper; + return NO; + } + } + return YES; } @@ -196,13 +216,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; wxUnusedVar(aNotification); wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) - { - NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder(); - NSView* otherView = wxOSXGetViewFromResponder(responder); - - wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView); - impl->DoNotifyFocusEvent( false, otherWindow ); - } + impl->DoNotifyFocusLost(); } - (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector @@ -219,17 +233,29 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; { if (commandSelector == @selector(insertNewline:)) { - wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow); - if ( tlw && tlw->GetDefaultItem() ) + if ( wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER ) { - wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); - if ( def && def->IsEnabled() ) + wxCommandEvent event(wxEVT_TEXT_ENTER, wxpeer->GetId()); + event.SetEventObject( wxpeer ); + wxTextWidgetImpl* impl = (wxNSTextFieldControl * ) wxWidgetImpl::FindFromWXWidget( self ); + wxTextEntry * const entry = impl->GetTextEntry(); + event.SetString( entry->GetValue() ); + handled = wxpeer->HandleWindowEvent( event ); + } + else + { + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow); + if ( tlw && tlw->GetDefaultItem() ) { - wxCommandEvent event(wxEVT_BUTTON, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - handled = YES; - } + wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); + if ( def && def->IsEnabled() ) + { + wxCommandEvent event(wxEVT_BUTTON, def->GetId() ); + event.SetEventObject(def); + def->Command(event); + handled = YES; + } + } } } } @@ -296,14 +322,38 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; // programmatically. if ( !wxMacEditHelper::IsCurrentEditor(self) ) { + NSString *text = [str isKindOfClass:[NSAttributedString class]] ? [str string] : str; wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl && lastKeyDownEvent && impl->DoHandleCharEvent(lastKeyDownEvent, str) ) + if ( impl && lastKeyDownEvent && impl->DoHandleCharEvent(lastKeyDownEvent, text) ) return; } [super insertText:str]; } +- (BOOL) resignFirstResponder +{ + return [super resignFirstResponder]; +} + +- (BOOL) becomeFirstResponder +{ + // we need the stored text field, as at this point the delegate is not yet set + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) textField ); + + BOOL r = [super becomeFirstResponder]; + if ( impl != NULL && r ) + impl->DoNotifyFocusSet(); + + return r; +} + +- (void) setTextField:(NSTextField*) field +{ + textField = field; +} + + @end @implementation wxNSTextView @@ -359,13 +409,24 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) + impl->DoNotifyFocusLost(); +} + +-(BOOL)textView:(NSTextView *)aTextView clickedOnLink:(id)link atIndex:(NSUInteger)charIndex +{ + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( aTextView ); + if ( impl ) { - NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder(); - NSView* otherView = wxOSXGetViewFromResponder(responder); - - wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView); - impl->DoNotifyFocusEvent( false, otherWindow ); + wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); + if ( wxpeer ) + { + wxMouseEvent evtMouse( wxEVT_LEFT_DOWN ); + wxTextUrlEvent event( wxpeer->GetId(), evtMouse, (long int)charIndex, (long int)charIndex ); + event.SetEventObject( wxpeer ); + wxpeer->HandleWindowEvent( event ); + } } + return NO; } @end @@ -528,42 +589,64 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; if ( impl ) { wxNSTextFieldControl* timpl = dynamic_cast(impl); - if ( fieldEditor ) - { - NSRange range = [fieldEditor selectedRange]; - timpl->SetInternalSelection(range.location, range.location + range.length); - } - - NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder(); - NSView* otherView = wxOSXGetViewFromResponder(responder); - - wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView); - impl->DoNotifyFocusEvent( false, otherWindow ); + if ( timpl ) + timpl->UpdateInternalSelectionFromEditor(fieldEditor); + impl->DoNotifyFocusLost(); } } @end // wxNSTextViewControl -wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ) +wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style ) : wxWidgetCocoaImpl(wxPeer, w), wxTextWidgetImpl(wxPeer) { wxNSTextScrollView* sv = (wxNSTextScrollView*) w; m_scrollView = sv; - [m_scrollView setHasVerticalScroller:YES]; - [m_scrollView setHasHorizontalScroller:NO]; - // TODO Remove if no regression, this was causing automatic resizes of multi-line textfields when the tlw changed - // [m_scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; - NSSize contentSize = [m_scrollView contentSize]; + const bool hasHScroll = (style & wxHSCROLL) != 0; - wxNSTextView* tv = [[wxNSTextView alloc] initWithFrame: NSMakeRect(0, 0, - contentSize.width, contentSize.height)]; + [m_scrollView setHasVerticalScroller:YES]; + [m_scrollView setHasHorizontalScroller:hasHScroll]; + NSSize contentSize = [m_scrollView contentSize]; + NSRect viewFrame = NSMakeRect( + 0, 0, + hasHScroll ? FLT_MAX : contentSize.width, contentSize.height + ); + + wxNSTextView* const tv = [[wxNSTextView alloc] initWithFrame: viewFrame]; m_textView = tv; [tv setVerticallyResizable:YES]; - [tv setHorizontallyResizable:NO]; + [tv setHorizontallyResizable:hasHScroll]; [tv setAutoresizingMask:NSViewWidthSizable]; + [tv setAutomaticDashSubstitutionEnabled:false]; + [tv setAutomaticQuoteSubstitutionEnabled:false]; + + if ( hasHScroll ) + { + [[tv textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + [[tv textContainer] setWidthTracksTextView:NO]; + } + + if ( style & wxTE_RIGHT) + { + [tv setAlignment:NSRightTextAlignment]; + } + else if ( style & wxTE_CENTRE) + { + [tv setAlignment:NSCenterTextAlignment]; + } + + if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) ) + { + [tv setRichText:NO]; + } + + if ( wxPeer->HasFlag(wxTE_AUTO_URL) ) + { + [tv setAutomaticLinkDetectionEnabled:YES]; + } [m_scrollView setDocumentView: tv]; @@ -586,6 +669,15 @@ bool wxNSTextViewControl::CanFocus() const return true; } +void wxNSTextViewControl::insertText(NSString* text, WXWidget slf, void *_cmd) +{ + if ( m_lastKeyDownEvent ==NULL || !DoHandleCharEvent(m_lastKeyDownEvent, text) ) + { + wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; + superimpl(slf, (SEL)_cmd, text); + } +} + wxString wxNSTextViewControl::GetStringValue() const { if (m_textView) @@ -603,7 +695,14 @@ void wxNSTextViewControl::SetStringValue( const wxString &str) wxMacEditHelper helper(m_textView); if (m_textView) + { [m_textView setString: wxCFStringRef( st , m_wxPeer->GetFont().GetEncoding() ).AsNSString()]; + if ( m_wxPeer->HasFlag(wxTE_AUTO_URL) ) + { + // Make sure that any URLs in the new text are highlighted. + [m_textView checkTextInDocument:nil]; + } + } } void wxNSTextViewControl::Copy() @@ -797,7 +896,7 @@ wxNSTextFieldControl::wxNSTextFieldControl(wxWindow *wxPeer, void wxNSTextFieldControl::Init(WXWidget w) { - NSTextField wxOSX_10_6_AND_LATER() *tf = (NSTextField wxOSX_10_6_AND_LATER()*) w; + NSTextField *tf = (NSTextField *) w; m_textField = tf; [m_textField setDelegate: tf]; m_selStart = m_selEnd = 0; @@ -821,12 +920,30 @@ void wxNSTextFieldControl::SetStringValue( const wxString &str) [m_textField setStringValue: wxCFStringRef( str , m_wxPeer->GetFont().GetEncoding() ).AsNSString()]; } +wxTextEntryFormatter* wxNSTextFieldControl::GetFormatter() +{ + // We only ever call setFormatter with wxTextEntryFormatter, so the cast is + // safe. + wxTextEntryFormatter* + formatter = (wxTextEntryFormatter*)[m_textField formatter]; + if ( !formatter ) + { + formatter = [[[wxTextEntryFormatter alloc] init] autorelease]; + [formatter setTextEntry:GetTextEntry()]; + [m_textField setFormatter:formatter]; + } + + return formatter; +} + void wxNSTextFieldControl::SetMaxLength(unsigned long len) { - wxMaximumLengthFormatter* formatter = [[[wxMaximumLengthFormatter alloc] init] autorelease]; - [formatter setMaxLength:len]; - [formatter setTextEntry:GetTextEntry()]; - [m_textField setFormatter:formatter]; + [GetFormatter() setMaxLength:len]; +} + +void wxNSTextFieldControl::ForceUpper() +{ + [GetFormatter() forceUpper]; } void wxNSTextFieldControl::Copy() @@ -958,6 +1075,15 @@ void wxNSTextFieldControl::SetInternalSelection( long from , long to ) m_selEnd = to; } +void wxNSTextFieldControl::UpdateInternalSelectionFromEditor( wxNSTextFieldEditor* fieldEditor ) +{ + if ( fieldEditor ) + { + NSRange range = [fieldEditor selectedRange]; + SetInternalSelection(range.location, range.location + range.length); + } +} + // as becoming first responder on a window - triggers a resign on the same control, we have to avoid // the resign notification writing back native selection values before we can set our own @@ -968,18 +1094,6 @@ bool wxNSTextFieldControl::becomeFirstResponder(WXWidget slf, void *_cmd) s_widgetBecomingFirstResponder = slf; bool retval = wxWidgetCocoaImpl::becomeFirstResponder(slf, _cmd); s_widgetBecomingFirstResponder = nil; - if ( retval ) - { - NSText* editor = [m_textField currentEditor]; - if ( editor ) - { - long textLength = [[m_textField stringValue] length]; - m_selStart = wxMin(textLength,wxMax(m_selStart,0)) ; - m_selEnd = wxMax(0,wxMin(textLength,m_selEnd)) ; - - [editor setSelectedRange:NSMakeRange(m_selStart, m_selEnd-m_selStart)]; - } - } return retval; } @@ -1025,7 +1139,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, { wxNSTextScrollView* v = nil; v = [[wxNSTextScrollView alloc] initWithFrame:r]; - c = new wxNSTextViewControl( wxpeer, v ); + c = new wxNSTextViewControl( wxpeer, v, style ); c->SetNeedsFocusRect( true ); } else @@ -1060,8 +1174,6 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, // we have to emulate this [v setBezeled:NO]; [v setBordered:NO]; - if ( UMAGetSystemVersion() < 0x1070 ) - c->SetNeedsFocusRect( true ); } else { diff --git a/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm b/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm index 701f3f45b5..c449501144 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm @@ -29,9 +29,9 @@ const short kwxMacToolBarLeftMargin = 4; const short kwxMacToolBorder = 0; const short kwxMacToolSpacing = 6; -BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) +wxBEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) EVT_PAINT( wxToolBar::OnPaint ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #pragma mark - @@ -114,7 +114,8 @@ public: { if ( !IsControl() ) { - [m_controlHandle retain]; + [m_controlHandle removeFromSuperview]; + [m_controlHandle release]; } else { @@ -165,7 +166,7 @@ public: return wxPoint( m_x, m_y ); } - bool Enable( bool enable ); + bool Enable( bool enable ) wxOVERRIDE; void UpdateImages(); @@ -173,7 +174,13 @@ public: void UpdateLabel() { - wxString labelStr = wxStripMenuCodes(m_label); + // Use an empty string if we're not displaying text + wxString labelStr; + wxToolBar *tbar = (wxToolBar*) GetToolBar(); + int style = (tbar ? tbar->GetWindowStyleFlag() : 0); + if ( (style & (wxTB_NOICONS | wxTB_TEXT)) != 0 ) + labelStr = wxStripMenuCodes(m_label); + wxCFStringRef l(labelStr, GetToolBarFontEncoding()); wxCFStringRef sh( GetShortHelp(), GetToolBarFontEncoding() ); #if wxOSX_USE_NATIVE_TOOLBAR @@ -188,7 +195,31 @@ public: } #endif if ( IsButton() ) - [(NSButton*)m_controlHandle setTitle:l.AsNSString()]; + { + NSButton* const btn = (NSButton*)m_controlHandle; + + [btn setTitle:l.AsNSString()]; + + if ( style & wxTB_NOICONS ) + [btn setImagePosition:NSNoImage]; + else if ( style & wxTB_TEXT ) + [btn setImagePosition:NSImageAbove]; + else + [btn setImagePosition:NSImageOnly]; + + if ( (style & (wxTB_NOICONS | wxTB_TEXT)) != 0 ) + { + [btn sizeToFit]; + } + else if (tbar) + { + wxSize toolsize = tbar->GetToolSize(); + NSRect frame = [m_controlHandle frame]; + frame.size.width = toolsize.x; + frame.size.height = toolsize.y + 2; + [btn setFrame:frame]; + } + } if ( m_controlHandle ) { @@ -236,13 +267,13 @@ public: return m_index; } - virtual void SetLabel(const wxString& label) + virtual void SetLabel(const wxString& label) wxOVERRIDE { wxToolBarToolBase::SetLabel(label); UpdateLabel(); } - virtual bool SetShortHelp(const wxString& help) + virtual bool SetShortHelp(const wxString& help) wxOVERRIDE { if ( !wxToolBarToolBase::SetShortHelp(help) ) return false; @@ -300,7 +331,7 @@ private: @end -@interface wxNSToolbarDelegate : NSObject wxOSX_10_6_AND_LATER() +@interface wxNSToolbarDelegate : NSObject { bool m_isSelectable; } @@ -315,6 +346,16 @@ private: - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar; +@end + + +@interface wxNSToolbar : NSToolbar +{ + wxNSToolbarDelegate* toolbarDelegate; +} + +- (id)initWithIdentifier:(NSString *)identifier; +- (void) dealloc; @end @@ -423,6 +464,28 @@ private: @end + +@implementation wxNSToolbar + +- (id)initWithIdentifier:(NSString *)identifier +{ + self = [super initWithIdentifier:identifier]; + if (self) + { + toolbarDelegate = [[wxNSToolbarDelegate alloc] init]; + [self setDelegate:toolbarDelegate]; + } + return self; +} + +- (void)dealloc +{ + [toolbarDelegate release]; + [super dealloc]; +} + +@end + #endif @implementation wxNSToolBarButton @@ -531,15 +594,19 @@ void wxToolBarTool::UpdateImages() if ( CanBeToggled() ) { - int w = m_bmpNormal.GetWidth(); - int h = m_bmpNormal.GetHeight(); - m_alternateBitmap = wxBitmap( w, h ); + int w = m_bmpNormal.GetScaledWidth(); + int h = m_bmpNormal.GetScaledHeight(); + m_alternateBitmap = wxBitmap(); + m_alternateBitmap.CreateScaled(w, h, -1, m_bmpNormal.GetScaleFactor()); wxMemoryDC dc; - dc.SelectObject( m_alternateBitmap ); - dc.SetPen( wxPen(*wxBLACK) ); - dc.SetBrush( wxBrush( *wxLIGHT_GREY )); - dc.DrawRoundedRectangle( 0, 0, w, h, 2 ); + dc.SelectObject(m_alternateBitmap); + // This color corresponds to OS X Yosemite's rendering of selected toolbar items + // See also http://trac.wxwidgets.org/ticket/16645 + wxColour grey(0xB9, 0xB9, 0xB9); + dc.SetPen(grey); + dc.SetBrush(grey); + dc.DrawRoundedRectangle( 0, 0, w, h, 3 ); dc.DrawBitmap( m_bmpNormal, 0, 0, true ); dc.SelectObject( wxNullBitmap ); @@ -551,7 +618,11 @@ void wxToolBarTool::UpdateImages() void wxToolBarTool::UpdateToggleImage( bool toggle ) { #if wxOSX_USE_NATIVE_TOOLBAR - if (m_toolbarItem != NULL ) + // Avoid setting the image if we're not showing icons because the image may + // be invalid. + wxToolBar *tbar = (wxToolBar*) GetToolBar(); + int style = tbar ? tbar->GetWindowStyleFlag() : 0; + if ( m_toolbarItem != NULL && !(style & wxTB_NOICONS) ) { // the native toolbar item only has a 'selected' state (one for one toolbar) // so we emulate the toggle here @@ -560,12 +631,10 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) else [m_toolbarItem setImage:m_bmpNormal.GetNSImage()]; } - else #endif - { - if ( IsButton() ) - [(NSButton*)m_controlHandle setState:(toggle ? NSOnState : NSOffState)]; - } + + if ( IsButton() ) + [(NSButton*)m_controlHandle setState:(toggle ? NSOnState : NSOffState)]; } wxToolBarTool::wxToolBarTool( @@ -645,20 +714,14 @@ bool wxToolBar::Create( if (parent->IsKindOf(CLASSINFO(wxFrame)) && wxSystemOptions::GetOptionInt(wxT("mac.toolbar.no-native")) != 1) { - static wxNSToolbarDelegate* controller = nil; - - if ( controller == nil ) - controller = [[wxNSToolbarDelegate alloc] init]; wxString identifier = wxString::Format( wxT("%p"), this ); wxCFStringRef cfidentifier(identifier); - NSToolbar* tb = [[NSToolbar alloc] initWithIdentifier:cfidentifier.AsNSString()]; + NSToolbar* tb = [[wxNSToolbar alloc] initWithIdentifier:cfidentifier.AsNSString()]; m_macToolbar = tb ; if (m_macToolbar != NULL) { - [tb setDelegate:controller]; - NSToolbarDisplayMode mode = NSToolbarDisplayModeDefault; NSToolbarSizeMode displaySize = NSToolbarSizeModeSmall; @@ -839,6 +902,21 @@ void wxToolBar::SetWindowStyleFlag( long style ) [(NSToolbar*) m_macToolbar setDisplayMode:mode]; } #endif + + wxToolBarTool *tool; + wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); + while ( node ) + { + tool = (wxToolBarTool *) node->GetData(); + if ( tool != NULL ) + { + tool->UpdateLabel(); + } + + node = node->GetNext(); + } + + InvalidateBestSize(); } #if wxOSX_USE_NATIVE_TOOLBAR @@ -1156,12 +1234,7 @@ bool wxToolBar::Realize() if ( tool->IsStretchable() ) nsItemId = NSToolbarFlexibleSpaceItemIdentifier; else - { - if ( UMAGetSystemVersion() < 0x1070 ) - nsItemId = NSToolbarSeparatorItemIdentifier; - else - nsItemId = NSToolbarSpaceItemIdentifier; - } + nsItemId = NSToolbarSpaceItemIdentifier; } else { @@ -1264,10 +1337,9 @@ void wxToolBar::SetToolBitmapSize(const wxSize& size) { int maxs = wxMax( size.x, size.y ); NSToolbarSizeMode sizeSpec; - if ( maxs > 32 ) + + if ( maxs > 24 ) sizeSpec = NSToolbarSizeModeRegular; - else if ( maxs > 24 ) - sizeSpec = NSToolbarSizeModeDefault; else sizeSpec = NSToolbarSizeModeSmall; @@ -1382,7 +1454,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) wxSize toolSize = GetToolSize(); WXWidget controlHandle = NULL; - NSRect toolrect = NSMakeRect(0, 0, toolSize.x, toolSize.y ); + NSRect toolrect = NSMakeRect(0, 0, toolSize.x, toolSize.y + 2 ); #if wxOSX_USE_NATIVE_TOOLBAR wxString label = tool->GetLabel(); @@ -1415,12 +1487,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) if ( tool->IsStretchable() ) nsItemId = NSToolbarFlexibleSpaceItemIdentifier; else - { - if ( UMAGetSystemVersion() < 0x1070 ) - nsItemId = NSToolbarSeparatorItemIdentifier; - else - nsItemId = NSToolbarSpaceItemIdentifier; - } + nsItemId = NSToolbarSpaceItemIdentifier; NSToolbarItem* item = [[NSToolbarItem alloc] initWithItemIdentifier:nsItemId]; tool->SetToolbarItemRef( item ); @@ -1464,14 +1531,6 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) if ( !(style & wxTB_NOICONS) ) tool->UpdateImages(); tool->UpdateLabel(); - - if ( style & wxTB_NOICONS ) - [v setImagePosition:NSNoImage]; - else if ( style & wxTB_TEXT ) - [v setImagePosition:NSImageAbove]; - else - [v setImagePosition:NSImageOnly]; - [v sizeToFit]; #if 0 InstallControlEventHandler( diff --git a/Externals/wxWidgets3/src/osx/cocoa/tooltip.mm b/Externals/wxWidgets3/src/osx/cocoa/tooltip.mm index d36bbeba52..a41aa48501 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/tooltip.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/tooltip.mm @@ -23,6 +23,10 @@ #include "wx/geometry.h" #include "wx/osx/uma.h" +#if wxOSX_USE_COCOA_OR_CARBON + #include +#endif + // FYI a link to help with implementing: http://www.cocoadev.com/index.pl?LittleYellowBox @@ -30,7 +34,7 @@ // wxToolTip //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) +wxIMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject); wxToolTip::wxToolTip( const wxString &tip ) @@ -59,8 +63,12 @@ void wxToolTip::Enable( bool WXUNUSED(flag) ) { } -void wxToolTip::SetDelay( long WXUNUSED(msecs) ) +void wxToolTip::SetDelay( long msecs ) { +#if wxOSX_USE_COCOA_OR_CARBON + [[NSUserDefaults standardUserDefaults] setObject: [NSNumber numberWithInt: msecs] + forKey: @"NSInitialToolTipDelay"]; +#endif } void wxToolTip::SetAutoPop( long WXUNUSED(msecs) ) diff --git a/Externals/wxWidgets3/src/osx/cocoa/utils.mm b/Externals/wxWidgets3/src/osx/cocoa/utils.mm index 664ed5159b..02c18c47f9 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/utils.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/utils.mm @@ -11,6 +11,7 @@ #include "wx/wxprec.h" #include "wx/utils.h" +#include "wx/platinfo.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -34,8 +35,6 @@ #endif #endif // wxUSE_GUI -#if wxOSX_USE_COCOA - #if wxUSE_GUI // Emit a beeeeeep @@ -60,7 +59,10 @@ void wxBell() [appleEventManager setEventHandler:self andSelector:@selector(handleOpenAppEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenApplication]; - + + [appleEventManager setEventHandler:self andSelector:@selector(handleQuitAppEvent:withReplyEvent:) + forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; + wxTheApp->OSXOnWillFinishLaunching(); } @@ -109,7 +111,16 @@ void wxBell() { wxUnusedVar(flag); wxUnusedVar(sender); - wxTheApp->MacReopenApp() ; + if ( wxTheApp->OSXInitWasCalled() ) + wxTheApp->MacReopenApp(); + // else: It's possible that this function was called as the first thing. + // This can happen when OS X restores running apps when starting a new + // user session. Apps that were hidden (dock only) when the previous + // session terminated are only restored in a limited, resources-saving + // way. When the user clicks the icon, applicationShouldHandleReopen: + // is called, but we didn't call OnInit() yet. In this case, we + // shouldn't call MacReopenApp(), but should proceed with normal + // initialization. return NO; } @@ -125,6 +136,16 @@ void wxBell() wxTheApp->OSXStoreOpenURL(cf.AsString()); } +- (void)handleQuitAppEvent:(NSAppleEventDescriptor *)event + withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + if ( wxTheApp->OSXOnShouldTerminate() ) + { + wxTheApp->OSXOnWillTerminate(); + wxTheApp->ExitMainLoop(); + } +} + - (void)handleOpenAppEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { @@ -324,14 +345,12 @@ void wxBell() ProcessSerialNumber psn = { 0, kCurrentProcess }; TransformProcessType(&psn, kProcessTransformToForegroundApplication); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - if ( UMAGetSystemVersion() >= 0x1090 ) + if ( wxPlatformInfo::Get().CheckOSVersion(10, 9) ) { [[NSRunningApplication currentApplication] activateWithOptions: (NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)]; } else -#endif { [self deactivate]; [self activateIgnoringOtherApps:YES]; @@ -391,7 +410,7 @@ bool wxApp::DoInitGui() } appcontroller = OSXCreateAppController(); - [NSApp setDelegate:appcontroller]; + [[NSApplication sharedApplication] setDelegate:(id )appcontroller]; [NSColor setIgnoresAlpha:NO]; // calling finishLaunching so early before running the loop seems to trigger some 'MenuManager compatibility' which leads @@ -480,8 +499,6 @@ void wxGetMousePosition( int* x, int* y ) *y = pt.y; }; -#if wxOSX_USE_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6 - wxMouseState wxGetMouseState() { wxMouseState ms; @@ -505,9 +522,6 @@ wxMouseState wxGetMouseState() return ms; } - -#endif - wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) { return new wxOSXTimerImpl(timer); @@ -572,12 +586,9 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const if (!m_window) return wxNullBitmap; - wxSize sz = m_window->GetSize(); - - int width = subrect != NULL ? subrect->width : sz.x; - int height = subrect != NULL ? subrect->height : sz.y ; - - wxBitmap bitmap(width, height); + const wxSize bitmapSize(subrect ? subrect->GetSize() : m_window->GetSize()); + wxBitmap bitmap; + bitmap.CreateScaled(bitmapSize.x, bitmapSize.y, -1, m_contentScaleFactor); NSView* view = (NSView*) m_window->GetHandle(); if ( [view isHiddenOrHasHiddenAncestor] == NO ) @@ -592,6 +603,12 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const CGImageRef cgImageRef = (CGImageRef)[rep CGImage]; CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); + + // The bitmap created by wxBitmap::CreateScaled() above is scaled, + // so we need to adjust the coordinates for it. + r.size.width /= m_contentScaleFactor; + r.size.height /= m_contentScaleFactor; + // since our context is upside down we dont use CGContextDrawImage wxMacDrawCGImage( (CGContextRef) bitmap.GetHBITMAP() , &r, cgImageRef ) ; } @@ -607,4 +624,3 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const #endif // wxUSE_GUI -#endif // wxOSX_USE_COCOA diff --git a/Externals/wxWidgets3/src/osx/cocoa/utils_base.mm b/Externals/wxWidgets3/src/osx/cocoa/utils_base.mm new file mode 100644 index 0000000000..a37813c016 --- /dev/null +++ b/Externals/wxWidgets3/src/osx/cocoa/utils_base.mm @@ -0,0 +1,151 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/utils_base.mm +// Purpose: various OS X utility functions in the base lib +// (extracted from cocoa/utils.mm) +// Author: Tobias Taschner +// Created: 2016-02-10 +// Copyright: (c) wxWidgets development team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#include "wx/utils.h" +#include "wx/platinfo.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/app.h" +#endif + +#include "wx/apptrait.h" + +#include "wx/osx/private.h" + +#if (defined(__WXOSX_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10) \ + || (defined(__WXOSX_IPHONE__) && defined(__IPHONE_8_0)) + #define wxHAS_NSPROCESSINFO 1 +#endif + +// our OS version is the same in non GUI and GUI cases +wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro) +{ +#ifdef wxHAS_NSPROCESSINFO + if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) + { + NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion; + + if ( verMaj != NULL ) + *verMaj = osVer.majorVersion; + + if ( verMin != NULL ) + *verMin = osVer.minorVersion; + + if ( verMicro != NULL ) + *verMicro = osVer.patchVersion; + } + else +#endif + { + // On OS X versions prior to 10.10 NSProcessInfo does not provide the OS version + // Deprecated Gestalt calls are required instead +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + SInt32 maj, min, micro; +#ifdef __WXOSX_IPHONE__ + maj = 7; + min = 0; + micro = 0; +#else + Gestalt(gestaltSystemVersionMajor, &maj); + Gestalt(gestaltSystemVersionMinor, &min); + Gestalt(gestaltSystemVersionBugFix, µ); +#endif +wxGCC_WARNING_RESTORE() + + if ( verMaj != NULL ) + *verMaj = maj; + + if ( verMin != NULL ) + *verMin = min; + + if ( verMicro != NULL ) + *verMicro = micro; + } + + return wxOS_MAC_OSX_DARWIN; +} + +bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn) +{ +#ifdef wxHAS_NSPROCESSINFO + if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)]) + { + NSOperatingSystemVersion osVer; + osVer.majorVersion = majorVsn; + osVer.minorVersion = minorVsn; + osVer.patchVersion = microVsn; + + return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:osVer] != NO; + } + else +#endif + { + int majorCur, minorCur, microCur; + wxGetOsVersion(&majorCur, &minorCur, µCur); + + return majorCur > majorVsn + || (majorCur == majorVsn && minorCur >= minorVsn) + || (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn); + } +} + +wxString wxGetOsDescription() +{ + + int majorVer, minorVer; + wxGetOsVersion(&majorVer, &minorVer); + +#ifndef __WXOSX_IPHONE__ + // Notice that neither the OS name itself nor the code names seem to be + // ever translated, OS X itself uses the English words even for the + // languages not using Roman alphabet. + wxString osBrand = "OS X"; + wxString osName; + if (majorVer == 10) + { + switch (minorVer) + { + case 7: + osName = "Lion"; + // 10.7 was the last version where the "Mac" prefix was used + osBrand = "Mac OS X"; + break; + case 8: + osName = "Mountain Lion"; + break; + case 9: + osName = "Mavericks"; + break; + case 10: + osName = "Yosemite"; + break; + case 11: + osName = "El Capitan"; + break; + }; + } +#else + wxString osBrand = "iOS"; + wxString osName; +#endif + + wxString osDesc = osBrand; + if (!osName.empty()) + osDesc += " " + osName; + + NSString* osVersionString = [NSProcessInfo processInfo].operatingSystemVersionString; + if (osVersionString) + osDesc += " " + wxCFStringRef::AsString((CFStringRef)osVersionString); + + return osDesc; +} diff --git a/Externals/wxWidgets3/src/osx/cocoa/window.mm b/Externals/wxWidgets3/src/osx/cocoa/window.mm index 1dc97c5b5e..5c824a6adb 100644 --- a/Externals/wxWidgets3/src/osx/cocoa/window.mm +++ b/Externals/wxWidgets3/src/osx/cocoa/window.mm @@ -192,7 +192,7 @@ NSRect wxOSXGetFrameForControl( wxWindowMac* window , const wxPoint& pos , const const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr); if (keyboardLayout) { UInt32 deadKeyState = 0; - UniCharCount maxStringLength = 255; + const UniCharCount maxStringLength = 255; UniCharCount actualStringLength = 0; UniChar unicodeString[maxStringLength]; @@ -232,6 +232,10 @@ long wxOSXTranslateCocoaKey( NSEvent* event, int eventType ) { switch ( [s characterAtIndex:0] ) { + // numpad enter key End-of-text character ETX U+0003 + case 3: + retval = WXK_NUMPAD_ENTER; + break; // backspace key case 0x7F : case 8 : @@ -345,9 +349,6 @@ long wxOSXTranslateCocoaKey( NSEvent* event, int eventType ) case 69: // + retval = WXK_NUMPAD_ADD; break; - case 76: // Enter - retval = WXK_NUMPAD_ENTER; - break; case 65: // . retval = WXK_NUMPAD_DECIMAL; break; @@ -455,6 +456,14 @@ void wxWidgetCocoaImpl::SetupKeyEvent(wxKeyEvent &wxevent , NSEvent * nsEvent, N break ; } } + else + { + long keycode = wxOSXTranslateCocoaKey( nsEvent, wxEVT_CHAR ); + if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START ) + { + keyval = keycode; + } + } if ( !keyval ) { @@ -559,6 +568,9 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve break; } + // Remember value of g_lastButton for later click count adjustment + UInt32 prevLastButton = g_lastButton; + // a control click is interpreted as a right click bool thisButtonIsFakeRight = false ; if ( button == 0 && (modifiers & NSControlKeyMask) ) @@ -567,10 +579,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve thisButtonIsFakeRight = true ; } - // otherwise we report double clicks by connecting a left click with a ctrl-left click - if ( clickCount > 1 && button != g_lastButton ) - clickCount = 1 ; - // we must make sure that our synthetic 'right' button corresponds in // mouse down, moved and mouse up, and does not deliver a right down and left up switch (eventType) @@ -591,6 +599,22 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve else if ( g_lastButton == 1 && g_lastButtonWasFakeRight ) button = g_lastButton ; + // Adjust click count when clicking with different buttons, + // otherwise we report double clicks by connecting a left click with a ctrl-left click + switch (eventType) + { + case NSLeftMouseDown : + case NSRightMouseDown : + case NSOtherMouseDown : + case NSLeftMouseUp : + case NSRightMouseUp : + case NSOtherMouseUp : + clickCount = [nsEvent clickCount]; + if ( clickCount > 1 && button != prevLastButton ) + clickCount = 1 ; + break; + } + // Adjust the chord mask to remove the primary button and add the // secondary button. It is possible that the secondary button is // already pressed, e.g. on a mouse connected to a laptop, but this @@ -611,7 +635,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve case NSLeftMouseDown : case NSRightMouseDown : case NSOtherMouseDown : - clickCount = [nsEvent clickCount]; switch ( button ) { case 0 : @@ -634,7 +657,6 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve case NSLeftMouseUp : case NSRightMouseUp : case NSOtherMouseUp : - clickCount = [nsEvent clickCount]; switch ( button ) { case 0 : @@ -661,39 +683,15 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ; - if ( UMAGetSystemVersion() >= 0x1070 ) + if ( [nsEvent hasPreciseScrollingDeltas] ) { - if ( [nsEvent hasPreciseScrollingDeltas] ) - { - deltaX = [nsEvent scrollingDeltaX]; - deltaY = [nsEvent scrollingDeltaY]; - } - else - { - deltaX = [nsEvent scrollingDeltaX] * 10; - deltaY = [nsEvent scrollingDeltaY] * 10; - } + deltaX = [nsEvent scrollingDeltaX]; + deltaY = [nsEvent scrollingDeltaY]; } else { - const EventRef cEvent = (EventRef) [nsEvent eventRef]; - // see http://developer.apple.com/qa/qa2005/qa1453.html - // for more details on why we have to look for the exact type - - bool isMouseScrollEvent = false; - if ( cEvent ) - isMouseScrollEvent = ::GetEventKind(cEvent) == kEventMouseScroll; - - if ( isMouseScrollEvent ) - { - deltaX = [nsEvent deviceDeltaX]; - deltaY = [nsEvent deviceDeltaY]; - } - else - { - deltaX = ([nsEvent deltaX] * 10); - deltaY = ([nsEvent deltaY] * 10); - } + deltaX = [nsEvent scrollingDeltaX] * 10; + deltaY = [nsEvent scrollingDeltaY] * 10; } wxevent.m_wheelDelta = 10; @@ -728,6 +726,12 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve case NSMouseMoved : wxevent.SetEventType( wxEVT_MOTION ) ; break; + + case NSEventTypeMagnify: + wxevent.SetEventType( wxEVT_MAGNIFY ); + wxevent.m_magnification = [nsEvent magnification]; + break; + default : break ; } @@ -788,7 +792,7 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve [_lastToolTipOwner mouseEntered:fakeEvent]; } -- (void)setToolTip:(NSString *)string; +- (void)setToolTip:(NSString *)string { if (string) { @@ -850,6 +854,15 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve return NO; } +- (NSView *)hitTest:(NSPoint)aPoint; +{ + wxWidgetCocoaImpl* viewimpl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if ( viewimpl && viewimpl->GetWXPeer() && !viewimpl->GetWXPeer()->IsEnabled() ) + return nil; + + return [super hitTest:aPoint]; +} + @end // wxNSView // We need to adopt NSTextInputClient protocol in order to interpretKeyEvents: to work. @@ -1127,13 +1140,36 @@ void wxOSX_controlDoubleAction(NSView* self, SEL _cmd, id sender) impl->controlDoubleAction(self, _cmd, sender); } -unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd)) +#if wxUSE_DRAG_AND_DROP + +namespace +{ + +unsigned int wxOnDraggingEnteredOrUpdated(wxWidgetCocoaImpl* viewImpl, + void *s, bool entered) { id sender = (id ) s; NSPasteboard *pboard = [sender draggingPasteboard]; + /* + sourceDragMask contains a flag field with drag operations permitted by + the source: + NSDragOperationCopy = 1, + NSDragOperationLink = 2, + NSDragOperationGeneric = 4, + NSDragOperationPrivate = 8, + NSDragOperationMove = 16, + NSDragOperationDelete = 32 + + By default, pressing modifier keys changes sourceDragMask: + Control ANDs it with NSDragOperationLink (2) + Option ANDs it with NSDragOperationCopy (1) + Command ANDs it with NSDragOperationGeneric (4) + + The end result can be a mask that's 0 (NSDragOperationNone). + */ NSDragOperation sourceDragMask = [sender draggingSourceOperationMask]; - wxWindow* wxpeer = GetWXPeer(); + wxWindow* wxpeer = viewImpl->GetWXPeer(); if ( wxpeer == NULL ) return NSDragOperationNone; @@ -1141,21 +1177,46 @@ unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget WXUNUSED(slf), if ( target == NULL ) return NSDragOperationNone; - wxDragResult result = wxDragNone; - NSPoint nspoint = [m_osxView convertPoint:[sender draggingLocation] fromView:nil]; - wxPoint pt = wxFromNSPoint( m_osxView, nspoint ); + NSPoint nspoint = [viewImpl->GetWXWidget() convertPoint:[sender draggingLocation] fromView:nil]; + wxPoint pt = wxFromNSPoint( viewImpl->GetWXWidget(), nspoint ); - if ( sourceDragMask & NSDragOperationLink ) - result = wxDragLink; - else if ( sourceDragMask & NSDragOperationCopy ) - result = wxDragCopy; - else if ( sourceDragMask & NSDragOperationMove ) + /* + Convert the incoming mask to wxDragResult. This is a lossy conversion + because wxDragResult contains a single value and not a flag field. + When dragging the bottom part of the DND sample ("Drag text from here!") + sourceDragMask contains copy, link, generic, and private flags. Formerly + this would result in wxDragLink which is not what is expected for text. + Give precedence to the move and copy flag instead. + + TODO: + In order to respect wxDrag_DefaultMove, access to dnd.mm's + DropSourceDelegate will be needed which contains the wxDrag value used. + (The draggingSource method of sender points to a DropSourceDelegate* ). + */ + wxDragResult result = wxDragNone; + + if (sourceDragMask & NSDragOperationMove) result = wxDragMove; + else if ( sourceDragMask & NSDragOperationCopy + || sourceDragMask & NSDragOperationGeneric) + result = wxDragCopy; + else if (sourceDragMask & NSDragOperationLink) + result = wxDragLink; PasteboardRef pboardRef; PasteboardCreate((CFStringRef)[pboard name], &pboardRef); target->SetCurrentDragPasteboard(pboardRef); - result = target->OnEnter(pt.x, pt.y, result); + if (entered) + { + // Drag entered + result = target->OnEnter(pt.x, pt.y, result); + } + else + { + // Drag updated + result = target->OnDragOver(pt.x, pt.y, result); + } + CFRelease(pboardRef); NSDragOperation nsresult = NSDragOperationNone; @@ -1163,16 +1224,29 @@ unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget WXUNUSED(slf), { case wxDragLink: nsresult = NSDragOperationLink; + break; + case wxDragMove: nsresult = NSDragOperationMove; + break; + case wxDragCopy: nsresult = NSDragOperationCopy; + break; + default : break; } return nsresult; } +} // anonymous namespace + +unsigned int wxWidgetCocoaImpl::draggingEntered(void* s, WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd)) +{ + return wxOnDraggingEnteredOrUpdated(this, s, true /*entered*/); +} + void wxWidgetCocoaImpl::draggingExited(void* s, WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd)) { id sender = (id ) s; @@ -1195,48 +1269,7 @@ void wxWidgetCocoaImpl::draggingExited(void* s, WXWidget WXUNUSED(slf), void *WX unsigned int wxWidgetCocoaImpl::draggingUpdated(void* s, WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd)) { - id sender = (id ) s; - NSPasteboard *pboard = [sender draggingPasteboard]; - NSDragOperation sourceDragMask = [sender draggingSourceOperationMask]; - - wxWindow* wxpeer = GetWXPeer(); - if ( wxpeer == NULL ) - return NSDragOperationNone; - - wxDropTarget* target = wxpeer->GetDropTarget(); - if ( target == NULL ) - return NSDragOperationNone; - - wxDragResult result = wxDragNone; - NSPoint nspoint = [m_osxView convertPoint:[sender draggingLocation] fromView:nil]; - wxPoint pt = wxFromNSPoint( m_osxView, nspoint ); - - if ( sourceDragMask & NSDragOperationLink ) - result = wxDragLink; - else if ( sourceDragMask & NSDragOperationCopy ) - result = wxDragCopy; - else if ( sourceDragMask & NSDragOperationMove ) - result = wxDragMove; - - PasteboardRef pboardRef; - PasteboardCreate((CFStringRef)[pboard name], &pboardRef); - target->SetCurrentDragPasteboard(pboardRef); - result = target->OnDragOver(pt.x, pt.y, result); - CFRelease(pboardRef); - - NSDragOperation nsresult = NSDragOperationNone; - switch (result ) - { - case wxDragLink: - nsresult = NSDragOperationLink; - case wxDragMove: - nsresult = NSDragOperationMove; - case wxDragCopy: - nsresult = NSDragOperationCopy; - default : - break; - } - return nsresult; + return wxOnDraggingEnteredOrUpdated(this, s, false /*updated*/); } bool wxWidgetCocoaImpl::performDragOperation(void* s, WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd)) @@ -1252,12 +1285,13 @@ bool wxWidgetCocoaImpl::performDragOperation(void* s, WXWidget WXUNUSED(slf), vo NSPoint nspoint = [m_osxView convertPoint:[sender draggingLocation] fromView:nil]; wxPoint pt = wxFromNSPoint( m_osxView, nspoint ); - if ( sourceDragMask & NSDragOperationLink ) - result = wxDragLink; - else if ( sourceDragMask & NSDragOperationCopy ) - result = wxDragCopy; - else if ( sourceDragMask & NSDragOperationMove ) + if (sourceDragMask & NSDragOperationMove) result = wxDragMove; + else if ( sourceDragMask & NSDragOperationCopy + || sourceDragMask & NSDragOperationGeneric) + result = wxDragCopy; + else if (sourceDragMask & NSDragOperationLink) + result = wxDragLink; PasteboardRef pboardRef; PasteboardCreate((CFStringRef)[pboard name], &pboardRef); @@ -1270,6 +1304,7 @@ bool wxWidgetCocoaImpl::performDragOperation(void* s, WXWidget WXUNUSED(slf), vo return result != wxDragNone; } +#endif // wxUSE_DRAG_AND_DROP void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) { @@ -1292,8 +1327,12 @@ void wxWidgetCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd) superimpl(slf, (SEL)_cmd, event); // super of built-ins keeps the mouse up, as wx expects this event, we have to synthesize it - // only trigger if at this moment the mouse is already up - if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() ) + // only trigger if at this moment the mouse is already up, and the control is still existing after the event has + // been handled (we do this by looking up the native NSView's peer from the hash map, that way we are sure the info + // is current - even when the instance memory of ourselves may have been freed ... + + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( slf ); + if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() && impl != NULL ) { wxMouseEvent wxevent(wxEVT_LEFT_DOWN); SetupMouseEvent(wxevent , event) ; @@ -1348,6 +1387,9 @@ bool wxWidgetCocoaImpl::SetupCursor(WX_NSEvent event) void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd) { + if ( !m_wxPeer->IsEnabled() ) + return; + if ( [event type] == NSKeyDown ) { // there are key equivalents that are not command-combos and therefore not handled by cocoa automatically, @@ -1388,26 +1430,7 @@ void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd) { // If we don't have a corresponding key event (e.g. IME-composed // characters), send wxEVT_CHAR without sending wxEVT_KEY_DOWN. - for (NSUInteger i = 0; i < [text length]; ++i) - { - wxKeyEvent wxevent(wxEVT_CHAR); - wxevent.m_shiftDown = wxevent.m_controlDown = wxevent.m_altDown = wxevent.m_metaDown = false; - wxevent.m_rawCode = 0; - wxevent.m_rawFlags = 0; - wxevent.SetTimestamp(); - unichar aunichar = [text characterAtIndex:i]; -#if wxUSE_UNICODE - wxevent.m_uniChar = aunichar; -#endif - wxevent.m_keyCode = aunichar < 0x80 ? aunichar : WXK_NONE; - wxWindowMac* peer = GetWXPeer(); - if ( peer ) - { - wxevent.SetEventObject(peer); - wxevent.SetId(peer->GetId()); - } - result = GetWXPeer()->OSXHandleKeyEvent(wxevent) || result; - } + result = DoHandleCharEvent(NULL,text); } } if ( !result ) @@ -1431,15 +1454,9 @@ void wxWidgetCocoaImpl::doCommandBySelector(void* sel, WXWidget slf, void* _cmd) { // Generate wxEVT_CHAR if wxEVT_KEY_DOWN is not handled. - long keycode = wxOSXTranslateCocoaKey( m_lastKeyDownEvent, wxEVT_CHAR ); - wxKeyEvent wxevent2(wxevent) ; wxevent2.SetEventType(wxEVT_CHAR); SetupKeyEvent( wxevent2, m_lastKeyDownEvent ); - if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START ) - { - wxevent2.m_keyCode = keycode; - } GetWXPeer()->OSXHandleKeyEvent(wxevent2); } } @@ -1494,15 +1511,9 @@ bool wxWidgetCocoaImpl::acceptsFirstResponder(WXWidget slf, void *_cmd) bool wxWidgetCocoaImpl::becomeFirstResponder(WXWidget slf, void *_cmd) { wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; - // get the current focus before running becomeFirstResponder - NSView* otherView = FindFocus(); - - wxWidgetImpl* otherWindow = FindFromWXWidget(otherView); BOOL r = superimpl(slf, (SEL)_cmd); if ( r ) - { - DoNotifyFocusEvent( true, otherWindow ); - } + DoNotifyFocusSet(); return r; } @@ -1511,23 +1522,13 @@ bool wxWidgetCocoaImpl::resignFirstResponder(WXWidget slf, void *_cmd) { wxOSX_FocusHandlerPtr superimpl = (wxOSX_FocusHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd]; BOOL r = superimpl(slf, (SEL)_cmd); - - NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder(); - NSView* otherView = wxOSXGetViewFromResponder(responder); - - wxWidgetImpl* otherWindow = FindBestFromWXWidget(otherView); - // It doesn't make sense to notify about the loss of focus if it's the same - // control in the end, and just a different subview - if ( otherWindow == this ) - return r; - - // NSTextViews have an editor as true responder, therefore the might get the - // resign notification if their editor takes over, don't trigger any event then + // wxNSTextFields and wxNSComboBoxes have an editor as real responder, therefore they get + // a resign notification when their editor takes over, don't trigger event here, the control + // gets a controlTextDidEndEditing notification which will send a focus kill. if ( r && !m_hasEditor) - { - DoNotifyFocusEvent( false, otherWindow ); - } + DoNotifyFocusLost(); + return r; } @@ -1576,20 +1577,23 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd)) wxRegion clearRgn; if ( tlwParent->GetWindowStyle() & wxFRAME_SHAPED ) { - if ( isTopLevel ) - clearRgn = updateRgn; - - int xoffset = 0, yoffset = 0; wxRegion rgn = tlwParent->GetShape(); - wxpeer->MacRootWindowToWindow( &xoffset, &yoffset ); - rgn.Offset( xoffset, yoffset ); - updateRgn.Intersect(rgn); - - if ( isTopLevel ) + if ( rgn.IsOk() ) { - // Exclude the window shape from the region to be cleared below. - rgn.Xor(wxpeer->GetSize()); - clearRgn.Intersect(rgn); + if ( isTopLevel ) + clearRgn = updateRgn; + + int xoffset = 0, yoffset = 0; + wxpeer->MacRootWindowToWindow( &xoffset, &yoffset ); + rgn.Offset( xoffset, yoffset ); + updateRgn.Intersect(rgn); + + if ( isTopLevel ) + { + // Exclude the window shape from the region to be cleared below. + rgn.Xor(wxpeer->GetSize()); + clearRgn.Intersect(rgn); + } } } @@ -1751,6 +1755,8 @@ void wxOSXCocoaClassAddWXMethods(Class c) wxOSX_CLASS_ADD_METHOD(c, @selector(mouseEntered:), (IMP) wxOSX_mouseEvent, "v@:@" ) wxOSX_CLASS_ADD_METHOD(c, @selector(mouseExited:), (IMP) wxOSX_mouseEvent, "v@:@" ) + wxOSX_CLASS_ADD_METHOD(c, @selector(magnifyWithEvent:), (IMP)wxOSX_mouseEvent, "v@:@") + wxOSX_CLASS_ADD_METHOD(c, @selector(cursorUpdate:), (IMP) wxOSX_cursorUpdate, "v@:@" ) wxOSX_CLASS_ADD_METHOD(c, @selector(keyDown:), (IMP) wxOSX_keyEvent, "v@:@" ) @@ -1799,7 +1805,7 @@ void wxOSXCocoaClassAddWXMethods(Class c) // C++ implementation class // -IMPLEMENT_DYNAMIC_CLASS( wxWidgetCocoaImpl , wxWidgetImpl ) +wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetCocoaImpl , wxWidgetImpl); wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) : wxWidgetImpl( peer, isRootControl, isUserPane ) @@ -1834,6 +1840,9 @@ void wxWidgetCocoaImpl::Init() wxWidgetCocoaImpl::~wxWidgetCocoaImpl() { + if ( GetWXPeer() && GetWXPeer()->IsFrozen() ) + [[m_osxView window] enableFlushWindow]; + RemoveAssociations( this ); if ( !IsRootControl() ) @@ -1859,13 +1868,8 @@ void wxWidgetCocoaImpl::SetVisibility( bool visible ) double wxWidgetCocoaImpl::GetContentScaleFactor() const { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 NSWindow* tlw = [m_osxView window]; - if ( [ tlw respondsToSelector:@selector(backingScaleFactor) ] ) - return [tlw backingScaleFactor]; - else -#endif - return 1.0; + return [tlw backingScaleFactor]; } // ---------------------------------------------------------------------------- @@ -1873,7 +1877,7 @@ double wxWidgetCocoaImpl::GetContentScaleFactor() const // ---------------------------------------------------------------------------- // define a delegate used to refresh the window during animation -@interface wxNSAnimationDelegate : NSObject wxOSX_10_6_AND_LATER() +@interface wxNSAnimationDelegate : NSObject { wxWindow *m_win; bool m_isDone; @@ -2351,6 +2355,7 @@ bool wxWidgetCocoaImpl::SetFocus() return true; } +#if wxUSE_DRAG_AND_DROP void wxWidgetCocoaImpl::SetDropTarget(wxDropTarget* target) { [m_osxView unregisterDraggedTypes]; @@ -2372,6 +2377,7 @@ void wxWidgetCocoaImpl::SetDropTarget(wxDropTarget* target) CFRelease(typesarray); } } +#endif // wxUSE_DRAG_AND_DROP void wxWidgetCocoaImpl::RemoveFromParent() { @@ -2396,10 +2402,7 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col ) if ( [targetView respondsToSelector:@selector(setBackgroundColor:) ] ) { - [targetView setBackgroundColor:[NSColor colorWithCalibratedRed:(CGFloat) (col.Red() / 255.0) - green:(CGFloat) (col.Green() / 255.0) - blue:(CGFloat) (col.Blue() / 255.0) - alpha:(CGFloat) (col.Alpha() / 255.0)]]; + [targetView setBackgroundColor: col.OSXGetNSColor()]; } } @@ -2417,6 +2420,46 @@ bool wxWidgetCocoaImpl::SetBackgroundStyle( wxBackgroundStyle style ) void wxWidgetCocoaImpl::SetLabel( const wxString& title, wxFontEncoding encoding ) { + if ( [m_osxView respondsToSelector:@selector(setAttributedTitle:) ] ) + { + wxFont f = GetWXPeer()->GetFont(); + if ( f.GetStrikethrough() || f.GetUnderlined() ) + { + wxCFStringRef cf(title, encoding ); + + NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] + initWithString:cf.AsNSString()]; + + [attrString beginEditing]; + [attrString setAlignment:NSCenterTextAlignment + range:NSMakeRange(0, [attrString length])]; + + [attrString addAttribute:NSFontAttributeName + value:f.OSXGetNSFont() + range:NSMakeRange(0, [attrString length])]; + if ( f.GetStrikethrough() ) + { + [attrString addAttribute:NSStrikethroughStyleAttributeName + value:@(NSUnderlineStyleSingle) + range:NSMakeRange(0, [attrString length])]; + } + + if ( f.GetUnderlined() ) + { + [attrString addAttribute:NSUnderlineStyleAttributeName + value:@(NSUnderlineStyleSingle) + range:NSMakeRange(0, [attrString length])]; + + } + + [attrString endEditing]; + + [(id)m_osxView setAttributedTitle:attrString]; + + return; + } + } + if ( [m_osxView respondsToSelector:@selector(setTitle:) ] ) { wxCFStringRef cf( title , encoding ); @@ -2589,6 +2632,9 @@ void wxWidgetCocoaImpl::Enable( bool enable ) if ( [targetView respondsToSelector:@selector(setEnabled:) ] ) [targetView setEnabled:enable]; + + if ( !enable && HasFocus() ) + m_wxPeer->Navigate(); } void wxWidgetCocoaImpl::PulseGauge() @@ -2659,10 +2705,7 @@ void wxWidgetCocoaImpl::SetFont(wxFont const& font, wxColour const&col, long, bo if ([targetView respondsToSelector:@selector(setFont:)]) [targetView setFont: font.OSXGetNSFont()]; if ([targetView respondsToSelector:@selector(setTextColor:)]) - [targetView setTextColor:[NSColor colorWithCalibratedRed:(CGFloat) (col.Red() / 255.0) - green:(CGFloat) (col.Green() / 255.0) - blue:(CGFloat) (col.Blue() / 255.0) - alpha:(CGFloat) (col.Alpha() / 255.0)]]; + [targetView setTextColor: col.OSXGetNSColor()]; } void wxWidgetCocoaImpl::SetToolTip(wxToolTip* tooltip) @@ -2707,16 +2750,48 @@ void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control ) bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text) { bool result = false; - - for (NSUInteger i = 0; i < [text length]; ++i) + wxWindowMac* peer = GetWXPeer(); + int length = [text length]; + if ( peer ) { - wxKeyEvent wxevent(wxEVT_CHAR); - unichar c = [text characterAtIndex:i]; - SetupKeyEvent( wxevent, event, [NSString stringWithCharacters:&c length:1]); + const wxString str = wxCFStringRef([text retain]).AsString(); + for ( wxString::const_iterator it = str.begin(); + it != str.end(); + ++it ) + { + wxKeyEvent wxevent(wxEVT_CHAR); - result = GetWXPeer()->OSXHandleKeyEvent(wxevent) || result; + // if we have exactly one character resulting from the event, then + // set the corresponding modifiers and raw data from the nsevent + // otherwise leave these at defaults, as they probably would be incorrect + // anyway (IME input) + + if ( event != nil && length == 1) + { + SetupKeyEvent(wxevent,event,text); + } + else + { + wxevent.m_shiftDown = wxevent.m_controlDown = wxevent.m_altDown = wxevent.m_metaDown = false; + wxevent.m_rawCode = 0; + wxevent.m_rawFlags = 0; + + const wxChar aunichar = *it; +#if wxUSE_UNICODE + wxevent.m_uniChar = aunichar; +#endif + wxevent.m_keyCode = aunichar < 0x80 ? aunichar : WXK_NONE; + + wxevent.SetEventObject(peer); + wxevent.SetId(peer->GetId()); + + if ( event ) + wxevent.SetTimestamp( (int)([event timestamp] * 1000) ) ; + } + + result = peer->OSXHandleKeyEvent(wxevent) || result; + } } - return result; } @@ -2766,6 +2841,30 @@ bool wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event) return result; } +void wxWidgetCocoaImpl::DoNotifyFocusSet() +{ + NSResponder* responder = wxNonOwnedWindowCocoaImpl::GetFormerFirstResponder(); + NSView* otherView = wxOSXGetViewFromResponder(responder); + wxWidgetImpl* otherWindow = FindFromWXWidget(otherView); + + // It doesn't make sense to notify about the focus set if it's the same + // control in the end, and just a different subview + if ( otherWindow != this ) + DoNotifyFocusEvent(true, otherWindow); +} + +void wxWidgetCocoaImpl::DoNotifyFocusLost() +{ + NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder(); + NSView* otherView = wxOSXGetViewFromResponder(responder); + wxWidgetImpl* otherWindow = FindBestFromWXWidget(otherView); + + // It doesn't make sense to notify about the loss of focus if it's the same + // control in the end, and just a different subview + if ( otherWindow != this ) + DoNotifyFocusEvent( false, otherWindow ); +} + void wxWidgetCocoaImpl::DoNotifyFocusEvent(bool receivedFocus, wxWidgetImpl* otherWindow) { wxWindow* thisWindow = GetWXPeer(); diff --git a/Externals/wxWidgets3/src/osx/combobox_osx.cpp b/Externals/wxWidgets3/src/osx/combobox_osx.cpp index faf325a867..f529d019f9 100644 --- a/Externals/wxWidgets3/src/osx/combobox_osx.cpp +++ b/Externals/wxWidgets3/src/osx/combobox_osx.cpp @@ -56,9 +56,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; - wxASSERT_MSG( !(style & wxCB_SORT), - "wxCB_SORT not currently supported by wxOSX/Cocoa"); - SetPeer(wxWidgetImpl::CreateComboBox( this, parent, id, NULL, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); diff --git a/Externals/wxWidgets3/src/osx/core/bitmap.cpp b/Externals/wxWidgets3/src/osx/core/bitmap.cpp index 8ee6127b11..e2d640eebf 100644 --- a/Externals/wxWidgets3/src/osx/core/bitmap.cpp +++ b/Externals/wxWidgets3/src/osx/core/bitmap.cpp @@ -26,18 +26,10 @@ #include "wx/filename.h" -IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject); +wxIMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject); -#if wxOSX_USE_CARBON -#include "wx/osx/uma.h" -#else #include "wx/osx/private.h" -#endif - -#ifndef __WXOSX_IPHONE__ -#include -#endif CGColorSpaceRef wxMacGetGenericRGBColorSpace(); CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); @@ -66,7 +58,7 @@ public: virtual ~wxBitmapRefData(); - virtual bool IsOk() const { return m_ok; } + virtual bool IsOk() const wxOVERRIDE { return m_ok; } void Free(); void SetOk( bool isOk) { m_ok = isOk; } @@ -86,6 +78,9 @@ public: bool HasAlpha() const { return m_hasAlpha; } void UseAlpha( bool useAlpha ); + bool IsTemplate() const { return m_isTemplate; } + void SetTemplate(bool is) { m_isTemplate = is; } + public: #if wxUSE_PALETTE wxPalette m_bitmapPalette; @@ -126,6 +121,7 @@ public: int m_rawAccessCount; bool m_ok; mutable CGImageRef m_cgImageRef; + bool m_isTemplate; #ifndef __WXOSX_IPHONE__ IconRef m_iconRef; @@ -240,6 +236,7 @@ void wxBitmapRefData::Init() m_ok = false ; m_bitmapMask = NULL ; m_cgImageRef = NULL ; + m_isTemplate = false; #ifndef __WXOSX_IPHONE__ m_iconRef = NULL ; @@ -843,93 +840,6 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon) int h = icon.GetHeight() ; Create( w , h ) ; -#ifdef __WXOSX_CARBON__ - if ( w == h && ( w == 16 || w == 32 || w == 48 || w == 128 ) ) - { - IconFamilyHandle iconFamily = NULL ; - Handle imagehandle = NewHandle( 0 ) ; - Handle maskhandle = NewHandle( 0 ) ; - - OSType maskType = 0; - OSType dataType = 0; - IconSelectorValue selector = 0 ; - - switch (w) - { - case 128: - dataType = kThumbnail32BitData ; - maskType = kThumbnail8BitMask ; - selector = kSelectorAllAvailableData ; - break; - - case 48: - dataType = kHuge32BitData ; - maskType = kHuge8BitMask ; - selector = kSelectorHuge32Bit | kSelectorHuge8BitMask ; - break; - - case 32: - dataType = kLarge32BitData ; - maskType = kLarge8BitMask ; - selector = kSelectorLarge32Bit | kSelectorLarge8BitMask ; - break; - - case 16: - dataType = kSmall32BitData ; - maskType = kSmall8BitMask ; - selector = kSelectorSmall32Bit | kSelectorSmall8BitMask ; - break; - - default: - break; - } - - OSStatus err = IconRefToIconFamily( MAC_WXHICON(icon.GetHICON()) , selector , &iconFamily ) ; - - err = GetIconFamilyData( iconFamily , dataType , imagehandle ) ; - err = GetIconFamilyData( iconFamily , maskType , maskhandle ) ; - size_t imagehandlesize = GetHandleSize( imagehandle ) ; - size_t maskhandlesize = GetHandleSize( maskhandle ) ; - - if ( imagehandlesize != 0 && maskhandlesize != 0 ) - { - wxASSERT( GetHandleSize( imagehandle ) == w * 4 * h ) ; - wxASSERT( GetHandleSize( maskhandle ) == w * h ) ; - - UseAlpha() ; - - unsigned char *source = (unsigned char *) *imagehandle ; - unsigned char *sourcemask = (unsigned char *) *maskhandle ; - unsigned char* destination = (unsigned char*) BeginRawAccess() ; - - for ( int y = 0 ; y < h ; ++y ) - { - for ( int x = 0 ; x < w ; ++x ) - { - unsigned char a = *sourcemask++; - *destination++ = a; - source++ ; -#if wxOSX_USE_PREMULTIPLIED_ALPHA - *destination++ = ( (*source++) * a + 127 ) / 255; - *destination++ = ( (*source++) * a + 127 ) / 255; - *destination++ = ( (*source++) * a + 127 ) / 255; -#else - *destination++ = *source++ ; - *destination++ = *source++ ; - *destination++ = *source++ ; -#endif - } - } - - EndRawAccess() ; - DisposeHandle( imagehandle ) ; - DisposeHandle( maskhandle ) ; - created = true ; - } - - DisposeHandle( (Handle) iconFamily ) ; - } -#endif if ( !created ) { wxMemoryDC dc ; @@ -1078,7 +988,11 @@ wxBitmap::wxBitmap(WX_NSImage image) bool wxBitmap::Create(WX_NSImage image) { - return Create(wxOSXCreateBitmapContextFromNSImage(image)); + bool isTemplate; + if (!Create(wxOSXCreateBitmapContextFromNSImage(image, &isTemplate))) + return false; + M_BITMAPDATA->SetTemplate(isTemplate); + return true; } wxBitmap::wxBitmap(CGContextRef bitmapcontext) @@ -1098,7 +1012,7 @@ bool wxBitmap::Create(CGContextRef bitmapcontext) WX_NSImage wxBitmap::GetNSImage() const { wxCFRef< CGImageRef > cgimage(CreateCGImage()); - return wxOSXGetNSImageFromCGImage( cgimage, GetScaleFactor() ); + return wxOSXGetNSImageFromCGImage( cgimage, GetScaleFactor(), M_BITMAPDATA->IsTemplate() ); } #endif @@ -1186,6 +1100,8 @@ bool wxBitmap::Create(int w, int h, int d) { UnRef(); + wxCHECK_MSG(w > 0 && h > 0, false, "invalid bitmap size"); + if ( d < 0 ) d = wxDisplayDepth() ; @@ -1321,7 +1237,7 @@ wxBitmap::wxBitmap(const wxImage& image, int depth, double scale) UseAlpha() ; unsigned char* destinationstart = (unsigned char*) BeginRawAccess() ; - register unsigned char* data = image.GetData(); + unsigned char* data = image.GetData(); if ( destinationstart != NULL && data != NULL ) { const unsigned char *alpha = hasAlpha ? image.GetAlpha() : NULL ; @@ -1413,13 +1329,12 @@ wxImage wxBitmap::ConvertToImage() const for (int yy = 0; yy < height; yy++ , sourcestart += M_BITMAPDATA->GetBytesPerRow() , mask += maskBytesPerRow ) { unsigned char * maskp = mask ; - unsigned char * source = sourcestart; + const wxUint32 * source = (wxUint32*)sourcestart; unsigned char a, r, g, b; - long color; for (int xx = 0; xx < width; xx++) { - color = *((long*) source) ; + const wxUint32 color = *source++; #ifdef WORDS_BIGENDIAN a = ((color&0xFF000000) >> 24) ; r = ((color&0x00FF0000) >> 16) ; @@ -1461,7 +1376,6 @@ wxImage wxBitmap::ConvertToImage() const data[index + 2] = b ; index += 3; - source += 4 ; } } @@ -1817,51 +1731,51 @@ WXHBITMAP wxMask::GetHBITMAP() const class WXDLLEXPORT wxBundleResourceHandler: public wxBitmapHandler { - DECLARE_ABSTRACT_CLASS(wxBundleResourceHandler) + wxDECLARE_ABSTRACT_CLASS(wxBundleResourceHandler); public: inline wxBundleResourceHandler() { - }; + } virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, wxBitmapType type, int desiredWidth, - int desiredHeight); + int desiredHeight) wxOVERRIDE; }; -IMPLEMENT_ABSTRACT_CLASS(wxBundleResourceHandler, wxBitmapHandler); +wxIMPLEMENT_ABSTRACT_CLASS(wxBundleResourceHandler, wxBitmapHandler); class WXDLLEXPORT wxPNGResourceHandler: public wxBundleResourceHandler { - DECLARE_DYNAMIC_CLASS(wxPNGResourceHandler) - + wxDECLARE_DYNAMIC_CLASS(wxPNGResourceHandler); + public: inline wxPNGResourceHandler() { SetName(wxT("PNG resource")); SetExtension("PNG"); SetType(wxBITMAP_TYPE_PNG_RESOURCE); - }; + } }; -IMPLEMENT_DYNAMIC_CLASS(wxPNGResourceHandler, wxBundleResourceHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxPNGResourceHandler, wxBundleResourceHandler); class WXDLLEXPORT wxJPEGResourceHandler: public wxBundleResourceHandler { - DECLARE_DYNAMIC_CLASS(wxJPEGResourceHandler) - + wxDECLARE_DYNAMIC_CLASS(wxJPEGResourceHandler); + public: inline wxJPEGResourceHandler() { SetName(wxT("JPEG resource")); SetExtension("JPEG"); SetType(wxBITMAP_TYPE_JPEG_RESOURCE); - }; + } }; -IMPLEMENT_DYNAMIC_CLASS(wxJPEGResourceHandler, wxBundleResourceHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxJPEGResourceHandler, wxBundleResourceHandler); bool wxBundleResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, diff --git a/Externals/wxWidgets3/src/osx/core/cfstring.cpp b/Externals/wxWidgets3/src/osx/core/cfstring.cpp index 384bf88e72..82b5808aa3 100644 --- a/Externals/wxWidgets3/src/osx/core/cfstring.cpp +++ b/Externals/wxWidgets3/src/osx/core/cfstring.cpp @@ -638,7 +638,7 @@ wxString wxCFStringRef::AsStringWithNormalizationFormC( CFStringRef ref, wxFontE CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, ref); CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); - wxString str = wxCFStringRef::AsString(ref,encoding); + wxString str = wxCFStringRef::AsString(cfMutableString,encoding); CFRelease(cfMutableString); return str; } @@ -693,7 +693,8 @@ wxString wxCFStringRef::AsString(wxFontEncoding encoding) const return AsString( get(), encoding ); } -#if wxOSX_USE_COCOA_OR_IPHONE +#ifdef __WXMAC__ + wxString wxCFStringRef::AsString( NSString* ref, wxFontEncoding encoding ) { return AsString( (CFStringRef) ref, encoding ); @@ -703,8 +704,8 @@ wxString wxCFStringRef::AsStringWithNormalizationFormC( NSString* ref, wxFontEnc { return AsStringWithNormalizationFormC( (CFStringRef) ref, encoding ); } -#endif // wxOSX_USE_COCOA_OR_IPHONE +#endif // // wxMacUniCharBuffer diff --git a/Externals/wxWidgets3/src/osx/core/colour.cpp b/Externals/wxWidgets3/src/osx/core/colour.cpp index e39d215cdc..2fbb616e0d 100644 --- a/Externals/wxWidgets3/src/osx/core/colour.cpp +++ b/Externals/wxWidgets3/src/osx/core/colour.cpp @@ -70,14 +70,11 @@ void wxColour::InitRGBA (ChannelType r, ChannelType g, ChannelType b, ChannelTyp CGColorRef col = 0 ; #if wxOSX_USE_COCOA_OR_CARBON - if ( CGColorCreateGenericRGB != NULL ) - col = CGColorCreateGenericRGB( (CGFloat)(r / 255.0), (CGFloat) (g / 255.0), (CGFloat) (b / 255.0), (CGFloat) (a / 255.0) ); - else + col = CGColorCreateGenericRGB( (CGFloat)(r / 255.0), (CGFloat) (g / 255.0), (CGFloat) (b / 255.0), (CGFloat) (a / 255.0) ); +#else + CGFloat components[4] = { (CGFloat)(r / 255.0), (CGFloat) (g / 255.0), (CGFloat) (b / 255.0), (CGFloat) (a / 255.0) } ; + col = CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ; #endif - { - CGFloat components[4] = { (CGFloat)(r / 255.0), (CGFloat) (g / 255.0), (CGFloat) (b / 255.0), (CGFloat) (a / 255.0) } ; - col = CGColorCreate( wxMacGetGenericRGBColorSpace() , components ) ; - } wxASSERT_MSG(col != NULL, "Invalid CoreGraphics Color"); m_cgColour.reset( col ); } @@ -110,24 +107,20 @@ void wxColour::InitCGColorRef( CGColorRef col ) m_alpha = wxALPHA_OPAQUE; components = CGColorGetComponents( col ); } - InitFromComponents(components, noComp); -} -void wxColour::InitFromComponents(const CGFloat* components, size_t numComponents ) -{ - if ( numComponents < 1 || !components ) + if ( noComp < 1 || !components ) { m_alpha = wxALPHA_OPAQUE; m_red = m_green = m_blue = 0; return; } - if ( numComponents >= 3 ) + if ( noComp >= 3 ) { m_red = (int)(components[0]*255+0.5); m_green = (int)(components[1]*255+0.5); m_blue = (int)(components[2]*255+0.5); - if ( numComponents == 4 ) + if ( noComp == 4 ) m_alpha = (int)(components[3]*255+0.5); } else diff --git a/Externals/wxWidgets3/src/osx/core/dcmemory.cpp b/Externals/wxWidgets3/src/osx/core/dcmemory.cpp index a7a47d6213..aeb700ddff 100644 --- a/Externals/wxWidgets3/src/osx/core/dcmemory.cpp +++ b/Externals/wxWidgets3/src/osx/core/dcmemory.cpp @@ -20,7 +20,7 @@ // wxMemoryDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxPaintDCImpl) +wxIMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxPaintDCImpl); wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) @@ -86,6 +86,8 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) CGContextSetFillColorSpace( bmCtx, genericColorSpace ); CGContextSetStrokeColorSpace( bmCtx, genericColorSpace ); SetGraphicsContext( wxGraphicsContext::CreateFromNative( bmCtx ) ); + if (m_graphicContext) + m_graphicContext->EnableOffset(m_contentScaleFactor <= 1); } m_ok = (m_graphicContext != NULL) ; } diff --git a/Externals/wxWidgets3/src/osx/core/display.cpp b/Externals/wxWidgets3/src/osx/core/display.cpp index b1961bc92e..11696b8d37 100644 --- a/Externals/wxWidgets3/src/osx/core/display.cpp +++ b/Externals/wxWidgets3/src/osx/core/display.cpp @@ -34,6 +34,7 @@ #endif #include "wx/display_impl.h" +#include "wx/scopedarray.h" #include "wx/osx/private.h" #if wxOSX_USE_COCOA_OR_CARBON @@ -51,15 +52,15 @@ public: { } - virtual wxRect GetGeometry() const; - virtual wxRect GetClientArea() const; - virtual wxString GetName() const { return wxString(); } + virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxRect GetClientArea() const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE { return wxString(); } - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const; - virtual wxVideoMode GetCurrentMode() const; - virtual bool ChangeMode(const wxVideoMode& mode); + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; - virtual bool IsPrimary() const; + virtual bool IsPrimary() const wxOVERRIDE; private: CGDirectDisplayID m_id; @@ -72,9 +73,9 @@ class wxDisplayFactoryMacOSX : public wxDisplayFactory public: wxDisplayFactoryMacOSX() {} - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount(); - virtual int GetFromPoint(const wxPoint& pt); + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; protected: wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryMacOSX); @@ -175,18 +176,14 @@ int wxDisplayFactoryMacOSX::GetFromPoint(const wxPoint& p) wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n) { CGDisplayCount theCount = GetCount(); - CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount]; + wxScopedArray theIDs(theCount); - CGDisplayErr err = wxOSXGetDisplayList(theCount, theIDs, &theCount); + CGDisplayErr err = wxOSXGetDisplayList(theCount, theIDs.get(), &theCount); wxCHECK_MSG( err == CGDisplayNoErr, NULL, "wxOSXGetDisplayList() failed" ); - wxASSERT( n < theCount ); + wxCHECK_MSG( n < theCount, NULL, wxS("Invalid display index") ); - wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(n, theIDs[n]); - - delete [] theIDs; - - return display; + return new wxDisplayImplMacOSX(n, theIDs[n]); } // ============================================================================ diff --git a/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp b/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp index 37b22b5909..4bdce90f1e 100644 --- a/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp +++ b/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp @@ -184,45 +184,13 @@ void wxMacWakeUp() #endif -bool wxCFEventLoop::YieldFor(long eventsToProcess) +void wxCFEventLoop::DoYieldFor(long eventsToProcess) { -#if wxUSE_THREADS - // Yielding from a non-gui thread needs to bail out, otherwise we end up - // possibly sending events in the thread too. - if ( !wxThread::IsMain() ) - { - return true; - } -#endif // wxUSE_THREADS - - m_isInsideYield = true; - m_eventsToProcessInsideYield = eventsToProcess; - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); -#endif // wxUSE_LOG - // process all pending events: while ( DoProcessEvents() == 1 ) ; - // it's necessary to call ProcessIdle() to update the frames sizes which - // might have been changed (it also will update other things set from - // OnUpdateUI() which is a nice (and desired) side effect) - while ( ProcessIdle() ) {} - - // if there are pending events, we must process them. - if (wxTheApp) - wxTheApp->ProcessPendingEvents(); - -#if wxUSE_LOG - wxLog::Resume(); -#endif // wxUSE_LOG - m_isInsideYield = false; - - return true; + wxEventLoopBase::DoYieldFor(eventsToProcess); } // implement/override base class pure virtual @@ -243,7 +211,7 @@ int wxCFEventLoop::DoProcessEvents() } else #endif - return DispatchTimeout( 0 ); + return DispatchTimeout( IsYielding() ? 0 : 1000 ); } bool wxCFEventLoop::Dispatch() @@ -299,6 +267,8 @@ void wxCFEventLoop::OSXDoRun() { for ( ;; ) { + OnNextIteration(); + // generate and process idle events for as long as we don't // have anything else to do DoProcessEvents(); diff --git a/Externals/wxWidgets3/src/osx/core/fontenum.cpp b/Externals/wxWidgets3/src/osx/core/fontenum.cpp index 74bf8039e9..2fc33ff908 100644 --- a/Externals/wxWidgets3/src/osx/core/fontenum.cpp +++ b/Externals/wxWidgets3/src/osx/core/fontenum.cpp @@ -45,53 +45,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, CFArrayRef cfFontFamilies = nil; #if wxOSX_USE_COCOA_OR_CARBON -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - if ( UMAGetSystemVersion() >= 0x1060 ) - cfFontFamilies = CTFontManagerCopyAvailableFontFamilyNames(); - else -#endif - { -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) - // - // From Apple's QA 1471 http://developer.apple.com/qa/qa2006/qa1471.html - // - - CFMutableArrayRef atsfontnames = CFArrayCreateMutable(kCFAllocatorDefault,0,&kCFTypeArrayCallBacks);; - - ATSFontFamilyIterator theFontFamilyIterator = NULL; - ATSFontFamilyRef theATSFontFamilyRef = 0; - OSStatus status = noErr; - - // Create the iterator - status = ATSFontFamilyIteratorCreate(kATSFontContextLocal, nil,nil, - kATSOptionFlagsUnRestrictedScope, - &theFontFamilyIterator ); - - while (status == noErr) - { - // Get the next font in the iteration. - status = ATSFontFamilyIteratorNext( theFontFamilyIterator, &theATSFontFamilyRef ); - if(status == noErr) - { - CFStringRef theName = NULL; - ATSFontFamilyGetName(theATSFontFamilyRef, kATSOptionFlagsDefault, &theName); - CFArrayAppendValue(atsfontnames, theName); - CFRelease(theName); - - } - else if (status == kATSIterationScopeModified) // Make sure the font database hasn't changed. - { - // reset the iterator - status = ATSFontFamilyIteratorReset (kATSFontContextLocal, nil, nil, - kATSOptionFlagsUnRestrictedScope, - &theFontFamilyIterator); - CFArrayRemoveAllValues(atsfontnames); - } - } - ATSFontFamilyIteratorRelease(&theFontFamilyIterator); - cfFontFamilies = atsfontnames; -#endif - } + cfFontFamilies = CTFontManagerCopyAvailableFontFamilyNames(); #elif wxOSX_USE_IPHONE cfFontFamilies = CopyAvailableFontFamilyNames(); #endif diff --git a/Externals/wxWidgets3/src/osx/core/glgrab.cpp b/Externals/wxWidgets3/src/osx/core/glgrab.cpp deleted file mode 100644 index 669f2ba6c4..0000000000 --- a/Externals/wxWidgets3/src/osx/core/glgrab.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in - consideration of your agreement to the following terms, and your use, installation or modification - of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, - please do not use, install or modify this Apple software. - - In consideration of your agreement to abide by the following terms, and subject to these - terms, Apple grants you a personal, non-exclusive license, under Apple\xd5s copyrights in - this original Apple software (the "Apple Software"), to use and modify the Apple Software, - with or without modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain this notice and - the following text and disclaimers in all such redistributions of the Apple Software. - Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used - to endorse or promote products derived from the Apple Software without specific prior - written permission from Apple. Except as expressly tated in this notice, no other rights or - licenses, express or implied, are granted by Apple herein, including but not limited - to any patent rights that may be infringed by your derivative works or by other works - in which the Apple Software may be incorporated. - - The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, - EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS - USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - - IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, - REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND - WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR - OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "wx/wxprec.h" - -#if wxOSX_USE_COCOA_OR_CARBON - -#import -#import -#import -#import - -#include "wx/osx/core/private.h" -#include "wx/osx/private/glgrab.h" - -extern CGColorSpaceRef wxMacGetGenericRGBColorSpace(); - -/* - * perform an in-place swap from Quadrant 1 to Quadrant III format - * (upside-down PostScript/GL to right side up QD/CG raster format) - * We do this in-place, which requires more copying, but will touch - * only half the pages. (Display grabs are BIG!) - * - * Pixel reformatting may optionally be done here if needed. - */ -static void swizzleBitmap(void * data, int rowBytes, int height) -{ - int top, bottom; - void * buffer; - void * topP; - void * bottomP; - void * base; - - - top = 0; - bottom = height - 1; - base = data; - buffer = malloc(rowBytes); - - - while ( top < bottom ) - { - topP = (void *)((top * rowBytes) + (intptr_t)base); - bottomP = (void *)((bottom * rowBytes) + (intptr_t)base); - - - /* - * Save and swap scanlines. - * - * This code does a simple in-place exchange with a temp buffer. - * If you need to reformat the pixels, replace the first two bcopy() - * calls with your own custom pixel reformatter. - */ - bcopy( topP, buffer, rowBytes ); - bcopy( bottomP, topP, rowBytes ); - bcopy( buffer, bottomP, rowBytes ); - - ++top; - --bottom; - } - free( buffer ); -} - - -/* - * Given a display ID and a rectangle on that display, generate a CGImageRef - * containing the display contents. - * - * srcRect is display-origin relative. - * - * This function uses a full screen OpenGL read-only context. - * By using OpenGL, we can read the screen using a DMA transfer - * when it's in millions of colors mode, and we can correctly read - * a microtiled full screen OpenGL context, such as a game or full - * screen video display. - * - * Returns a CGImageRef. When you are done with the CGImageRef, release it - * using CFRelease(). - * Returns NULL on an error. - */ - -CGImageRef grabViaOpenGL(CGDirectDisplayID display, CGRect srcRect) -{ - CGContextRef bitmap; - CGImageRef image; - void * data; - long bytewidth; - GLint width, height; - - CGLContextObj glContextObj; - CGLPixelFormatObj pixelFormatObj ; - GLint numPixelFormats ; - CGLPixelFormatAttribute attribs[] = - { - kCGLPFAFullScreen, - kCGLPFADisplayMask, - (CGLPixelFormatAttribute) 0, /* Display mask bit goes here */ - (CGLPixelFormatAttribute) 0 - } ; - - - if ( display == kCGNullDirectDisplay ) - display = CGMainDisplayID(); - attribs[2] = (CGLPixelFormatAttribute) CGDisplayIDToOpenGLDisplayMask(display); - - - /* Build a full-screen GL context */ - CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats ); - if ( pixelFormatObj == NULL ) // No full screen context support - return NULL; - CGLCreateContext( pixelFormatObj, NULL, &glContextObj ) ; - CGLDestroyPixelFormat( pixelFormatObj ) ; - if ( glContextObj == NULL ) - return NULL; - - - CGLSetCurrentContext( glContextObj ) ; - CGLSetFullScreen( glContextObj ) ; - - - glReadBuffer(GL_FRONT); - - - width = (GLint)srcRect.size.width; - height = (GLint)srcRect.size.height; - - - bytewidth = width * 4; // Assume 4 bytes/pixel for now - bytewidth = (bytewidth + 3) & ~3; // Align to 4 bytes - - /* Build bitmap context */ - data = malloc(height * bytewidth); - if ( data == NULL ) - { - CGLSetCurrentContext( NULL ); - CGLClearDrawable( glContextObj ); // disassociate from full screen - CGLDestroyContext( glContextObj ); // and destroy the context - return NULL; - } - bitmap = CGBitmapContextCreate(data, width, height, 8, bytewidth, - wxMacGetGenericRGBColorSpace(), kCGImageAlphaNoneSkipFirst /* XRGB */); - - - /* Read framebuffer into our bitmap */ - glFinish(); /* Finish all OpenGL commands */ - glPixelStorei(GL_PACK_ALIGNMENT, 4); /* Force 4-byte alignment */ - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - - /* - * Fetch the data in XRGB format, matching the bitmap context. - */ - glReadPixels((GLint)srcRect.origin.x, (GLint)srcRect.origin.y, width, height, - GL_BGRA, -#ifdef __BIG_ENDIAN__ - GL_UNSIGNED_INT_8_8_8_8_REV, // for PPC -#else - GL_UNSIGNED_INT_8_8_8_8, // for Intel! http://lists.apple.com/archives/quartz-dev/2006/May/msg00100.html -#endif - data); - /* - * glReadPixels generates a quadrant I raster, with origin in the lower left - * This isn't a problem for signal processing routines such as compressors, - * as they can simply use a negative 'advance' to move between scanlines. - * CGImageRef and CGBitmapContext assume a quadrant III raster, though, so we need to - * invert it. Pixel reformatting can also be done here. - */ - swizzleBitmap(data, bytewidth, height); - - - /* Make an image out of our bitmap; does a cheap vm_copy of the bitmap */ - image = CGBitmapContextCreateImage(bitmap); - - /* Get rid of bitmap */ - CFRelease(bitmap); - free(data); - - - /* Get rid of GL context */ - CGLSetCurrentContext( NULL ); - CGLClearDrawable( glContextObj ); // disassociate from full screen - CGLDestroyContext( glContextObj ); // and destroy the context - - /* Returned image has a reference count of 1 */ - return image; -} - -#endif diff --git a/Externals/wxWidgets3/src/osx/core/hid.cpp b/Externals/wxWidgets3/src/osx/core/hid.cpp index 92c874aa26..ba96d83918 100644 --- a/Externals/wxWidgets3/src/osx/core/hid.cpp +++ b/Externals/wxWidgets3/src/osx/core/hid.cpp @@ -641,15 +641,15 @@ void wxHIDKeyboard::DoBuildCookies(CFArrayRef Array) class wxHIDModule : public wxModule { - DECLARE_DYNAMIC_CLASS(wxHIDModule) + wxDECLARE_DYNAMIC_CLASS(wxHIDModule); - public: +public: static wxArrayPtrVoid sm_keyboards; - virtual bool OnInit() + virtual bool OnInit() wxOVERRIDE { return true; } - virtual void OnExit() + virtual void OnExit() wxOVERRIDE { for(size_t i = 0; i < sm_keyboards.GetCount(); ++i) delete (wxHIDKeyboard*) sm_keyboards[i]; @@ -657,7 +657,7 @@ class wxHIDModule : public wxModule } }; -IMPLEMENT_DYNAMIC_CLASS(wxHIDModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxHIDModule, wxModule); wxArrayPtrVoid wxHIDModule::sm_keyboards; diff --git a/Externals/wxWidgets3/src/osx/core/hidjoystick.cpp b/Externals/wxWidgets3/src/osx/core/hidjoystick.cpp index 4a8273838e..feace2517e 100644 --- a/Externals/wxWidgets3/src/osx/core/hidjoystick.cpp +++ b/Externals/wxWidgets3/src/osx/core/hidjoystick.cpp @@ -77,7 +77,7 @@ public: virtual ~wxHIDJoystick(); bool Create(int nWhich); - virtual void BuildCookies(CFArrayRef Array); + virtual void BuildCookies(CFArrayRef Array) wxOVERRIDE; void MakeCookies(CFArrayRef Array); IOHIDElementCookie* GetCookies(); IOHIDQueueInterface** GetQueue(); @@ -95,7 +95,7 @@ class wxJoystickThread : public wxThread { public: wxJoystickThread(wxHIDJoystick* hid, int joystick); - void* Entry(); + void* Entry() wxOVERRIDE; static void HIDCallback(void* target, IOReturn res, void* context, void* sender); private: @@ -133,7 +133,7 @@ void wxGetIntFromCFDictionary(CFTypeRef cfDict, CFStringRef key, int* pOut) // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject); //--------------------------------------------------------------------------- // wxJoystick Constructor @@ -187,6 +187,14 @@ wxPoint wxJoystick::GetPosition() const if (m_thread) pos = m_thread->m_lastposition; return pos; } +int wxJoystick::GetPosition(unsigned int axis) const +{ + wxCHECK_MSG(axis < (unsigned)GetNumberAxes(), 0, "Invalid joystick axis"); + if (m_thread) + return m_thread->m_axe[axis]; + return 0; + +} int wxJoystick::GetZPosition() const { if (m_thread) @@ -225,6 +233,14 @@ int wxJoystick::GetButtonState() const return 0; } +bool wxJoystick::GetButtonState(unsigned int id) const +{ + if (id > sizeof(int) * 8) + return false; + + return (GetButtonState() & (1 << id)) != 0; +} + //--------------------------------------------------------------------------- // wxJoystick::IsOk // diff --git a/Externals/wxWidgets3/src/osx/core/mimetype.cpp b/Externals/wxWidgets3/src/osx/core/mimetype.cpp index 7d5de4bba9..dce5997464 100644 --- a/Externals/wxWidgets3/src/osx/core/mimetype.cpp +++ b/Externals/wxWidgets3/src/osx/core/mimetype.cpp @@ -699,6 +699,12 @@ bool wxFileTypeImpl::Unassociate(wxFileType *WXUNUSED(ft)) return false; } +wxString +wxFileTypeImpl::GetExpandedCommand(const wxString& WXUNUSED(verb), + const wxFileType::MessageParameters& WXUNUSED(params)) const +{ + return wxString(); +} #endif // wxUSE_MIMETYPE diff --git a/Externals/wxWidgets3/src/osx/core/printmac.cpp b/Externals/wxWidgets3/src/osx/core/printmac.cpp index 148d1b65af..0fa5ba02ce 100644 --- a/Externals/wxWidgets3/src/osx/core/printmac.cpp +++ b/Externals/wxWidgets3/src/osx/core/printmac.cpp @@ -83,7 +83,7 @@ static PMResolution *GetSupportedResolutions(PMPrinter printer, UInt32 *count) -IMPLEMENT_DYNAMIC_CLASS(wxOSXPrintData, wxPrintNativeDataBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxOSXPrintData, wxPrintNativeDataBase); bool wxOSXPrintData::IsOk() const { @@ -198,8 +198,18 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data ) wxString id, name(wxT("Custom paper")); id.Printf(wxT("wxPaperCustom%dx%d"), papersize.x, papersize.y); - PMPaperCreateCustom(printer, wxCFStringRef( id, wxFont::GetDefaultEncoding() ), wxCFStringRef( name, wxFont::GetDefaultEncoding() ), - papersize.x, papersize.y, &margins, &paper); + if ( PMPaperCreateCustom + ( + printer, + wxCFStringRef(id, wxFont::GetDefaultEncoding()), + wxCFStringRef(name, wxFont::GetDefaultEncoding()), + papersize.x, papersize.y, + &margins, + &paper + ) ) + { + bestPaper = paper; + } } if ( bestPaper != kPMNoData ) { @@ -412,7 +422,7 @@ bool wxOSXPrintData::TransferTo( wxPrintData &data ) return true ; } -void wxOSXPrintData::TransferFrom( wxPageSetupDialogData *WXUNUSED(data) ) +void wxOSXPrintData::TransferFrom( const wxPageSetupDialogData *WXUNUSED(data) ) { // should we setup the page rect here ? // since MacOS sometimes has two same paper rects with different @@ -492,7 +502,7 @@ void wxOSXPrintData::TransferTo( wxPrintDialogData* data ) } } -void wxOSXPrintData::TransferFrom( wxPrintDialogData* data ) +void wxOSXPrintData::TransferFrom( const wxPrintDialogData* data ) { // Respect the value of m_printAllPages if ( data->GetAllPages() ) @@ -515,8 +525,6 @@ wxPrintNativeDataBase* wxOSXCreatePrintData() { #if wxOSX_USE_COCOA return new wxOSXCocoaPrintData(); -#elif wxOSX_USE_CARBON - return new wxOSXCarbonPrintData(); #else return NULL; #endif @@ -526,7 +534,7 @@ wxPrintNativeDataBase* wxOSXCreatePrintData() * Printer */ -IMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxMacPrinter, wxPrinterBase); wxMacPrinter::wxMacPrinter(wxPrintDialogData *data): wxPrinterBase(data) @@ -627,10 +635,21 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) } // Only set min and max, because from and to will be - // set by the user + // set by the user if prompted for the print dialog above m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); + // Set from and to pages if bypassing the print dialog + if ( !prompt ) + { + m_printDialogData.SetFromPage(fromPage); + + if( m_printDialogData.GetAllPages() ) + m_printDialogData.SetToPage(maxPage); + else + m_printDialogData.SetToPage(toPage); + } + printout->OnBeginPrinting(); bool keepGoing = true; @@ -711,7 +730,7 @@ bool wxMacPrinter::Setup(wxWindow *WXUNUSED(parent)) * Print preview */ -IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase) +wxIMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase); wxMacPrintPreview::wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, @@ -791,35 +810,4 @@ void wxMacPrintPreview::DetermineScaling(void) // end of print_osx.cpp // -#if wxOSX_USE_CARBON - -IMPLEMENT_DYNAMIC_CLASS(wxOSXCarbonPrintData, wxOSXPrintData) - -wxOSXCarbonPrintData::wxOSXCarbonPrintData() -{ - if ( PMCreateSession( &m_macPrintSession ) == noErr ) - { - if ( PMCreatePageFormat(&m_macPageFormat) == noErr ) - { - PMSessionDefaultPageFormat(m_macPrintSession, - m_macPageFormat); - PMGetPageFormatPaper(m_macPageFormat, &m_macPaper); - } - - if ( PMCreatePrintSettings(&m_macPrintSettings) == noErr ) - { - PMSessionDefaultPrintSettings(m_macPrintSession, - m_macPrintSettings); - } - } -} - -wxOSXCarbonPrintData::~wxOSXCarbonPrintData() -{ - (void)PMRelease(m_macPageFormat); - (void)PMRelease(m_macPrintSettings); - (void)PMRelease(m_macPrintSession); -} -#endif - #endif diff --git a/Externals/wxWidgets3/src/osx/core/sockosx.cpp b/Externals/wxWidgets3/src/osx/core/sockosx.cpp index 9a540058ce..899dce6234 100644 --- a/Externals/wxWidgets3/src/osx/core/sockosx.cpp +++ b/Externals/wxWidgets3/src/osx/core/sockosx.cpp @@ -61,7 +61,7 @@ public: } private: - virtual void DoClose() + virtual void DoClose() wxOVERRIDE { wxSocketManager * const manager = wxSocketManager::Get(); if ( manager ) @@ -183,16 +183,16 @@ private: class wxSocketManagerMac : public wxSocketManager { public: - virtual bool OnInit(); - virtual void OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; - virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) + virtual wxSocketImpl *CreateSocket(wxSocketBase& wxsocket) wxOVERRIDE { return new wxSocketImplMac(wxsocket); } - virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event); - virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event); + virtual void Install_Callback(wxSocketImpl *socket, wxSocketNotify event) wxOVERRIDE; + virtual void Uninstall_Callback(wxSocketImpl *socket, wxSocketNotify event) wxOVERRIDE; private: // return CFSocket callback mask corresponding to the given event (the diff --git a/Externals/wxWidgets3/src/osx/core/sound.cpp b/Externals/wxWidgets3/src/osx/core/sound.cpp index cc6185a33e..f97c11eb2f 100644 --- a/Externals/wxWidgets3/src/osx/core/sound.cpp +++ b/Externals/wxWidgets3/src/osx/core/sound.cpp @@ -34,25 +34,25 @@ class wxOSXAudioToolboxSoundData : public wxSoundData { public: - wxOSXAudioToolboxSoundData(const wxString& fileName); + explicit wxOSXAudioToolboxSoundData(SystemSoundID soundID); - ~wxOSXAudioToolboxSoundData(); + virtual ~wxOSXAudioToolboxSoundData(); - virtual bool Play(unsigned flags); + virtual bool Play(unsigned flags) wxOVERRIDE; - virtual void DoStop(); + virtual void DoStop() wxOVERRIDE; protected: static void CompletionCallback(SystemSoundID mySSID, void * soundRef); void SoundCompleted(); SystemSoundID m_soundID; - wxString m_sndname; //file path + bool m_playing; }; -wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(const wxString& fileName) : - m_soundID(NULL) +wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(SystemSoundID soundID) : + m_soundID(soundID) { - m_sndname = fileName; + m_playing = false; } wxOSXAudioToolboxSoundData::~wxOSXAudioToolboxSoundData() @@ -91,10 +91,10 @@ void wxOSXAudioToolboxSoundData::SoundCompleted() void wxOSXAudioToolboxSoundData::DoStop() { - if (m_soundID) + if ( m_playing ) { + m_playing = false; AudioServicesDisposeSystemSoundID (m_soundID); - m_soundID = NULL; wxSound::SoundStopped(this); } @@ -106,20 +106,15 @@ bool wxOSXAudioToolboxSoundData::Play(unsigned flags) m_flags = flags; - wxCFRef cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(m_sndname))); - CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); - wxCFRef url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); - - AudioServicesCreateSystemSoundID(url, &m_soundID); AudioServicesAddSystemSoundCompletion( m_soundID, CFRunLoopGetCurrent(), NULL, wxOSXAudioToolboxSoundData::CompletionCallback, (void *) this ); - bool sync = !(flags & wxSOUND_ASYNC); + m_playing = true; AudioServicesPlaySystemSound(m_soundID); - if ( sync ) + if ( !(flags & wxSOUND_ASYNC) ) { - while( m_soundID ) + while ( m_playing ) { CFRunLoopRun(); } @@ -139,7 +134,20 @@ bool wxSound::Create(const wxString& fileName, bool isResource) { wxCHECK_MSG( !isResource, false, "not implemented" ); - m_data = new wxOSXAudioToolboxSoundData(fileName); + wxCFRef cfMutableString(CFStringCreateMutableCopy(NULL, 0, wxCFStringRef(fileName))); + CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); + wxCFRef url(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kCFURLPOSIXPathStyle, false)); + + SystemSoundID soundID; + OSStatus err = AudioServicesCreateSystemSoundID(url, &soundID); + if ( err != 0 ) + { + wxLogError(_("Failed to load sound from \"%s\" (error %d)."), fileName, err); + return false; + } + + m_data = new wxOSXAudioToolboxSoundData(soundID); + return true; } diff --git a/Externals/wxWidgets3/src/osx/core/stdpaths_cf.cpp b/Externals/wxWidgets3/src/osx/core/stdpaths_cf.cpp deleted file mode 100644 index 86b34e646c..0000000000 --- a/Externals/wxWidgets3/src/osx/core/stdpaths_cf.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: src/osx/core/stdpaths_cf.cpp -// Purpose: wxStandardPaths implementation for CoreFoundation systems -// Author: David Elliott -// Modified by: -// Created: 2004-10-27 -// Copyright: (c) 2004 David Elliott -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/wxprec.h" - -#if wxUSE_STDPATHS - -#ifndef WX_PRECOMP - #include "wx/intl.h" -#endif //ndef WX_PRECOMP - -#include "wx/stdpaths.h" -#include "wx/filename.h" -#ifdef __WXMAC__ -#include "wx/osx/private.h" -#endif -#include "wx/osx/core/cfstring.h" - -#include -#include - -#define kDefaultPathStyle kCFURLPOSIXPathStyle - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxStandardPathsCF ctors/dtor -// ---------------------------------------------------------------------------- - -wxStandardPathsCF::wxStandardPathsCF() - : m_bundle(CFBundleGetMainBundle()) -{ - CFRetain(m_bundle); -} - -wxStandardPathsCF::wxStandardPathsCF(wxCFBundleRef bundle) - : m_bundle(bundle) -{ - CFRetain(m_bundle); -} - -wxStandardPathsCF::~wxStandardPathsCF() -{ - CFRelease(m_bundle); -} - -// ---------------------------------------------------------------------------- -// wxStandardPathsCF Mac-specific methods -// ---------------------------------------------------------------------------- - -void wxStandardPathsCF::SetBundle(wxCFBundleRef bundle) -{ - CFRetain(bundle); - CFRelease(m_bundle); - m_bundle = bundle; -} - -// ---------------------------------------------------------------------------- -// generic functions in terms of which the other ones are implemented -// ---------------------------------------------------------------------------- - -static wxString BundleRelativeURLToPath(CFURLRef relativeURL) -{ - CFURLRef absoluteURL = CFURLCopyAbsoluteURL(relativeURL); - wxCHECK_MSG(absoluteURL, wxEmptyString, wxT("Failed to resolve relative URL to absolute URL")); - CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kDefaultPathStyle); - CFRelease(absoluteURL); - return wxCFStringRef::AsStringWithNormalizationFormC(cfStrPath); -} - -wxString wxStandardPathsCF::GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const -{ - wxCHECK_MSG(m_bundle, wxEmptyString, - wxT("wxStandardPaths for CoreFoundation only works with bundled apps")); - CFURLRef relativeURL = (*func)(m_bundle); - wxCHECK_MSG(relativeURL, wxEmptyString, wxT("Couldn't get URL")); - wxString ret(BundleRelativeURLToPath(relativeURL)); - CFRelease(relativeURL); - return ret; -} - -wxString wxStandardPathsCF::GetDocumentsDir() const -{ -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - return wxMacFindFolderNoSeparator - ( - kUserDomain, - kDocumentsFolderType, - kCreateFolder - ); -#else - return wxFileName::GetHomeDir() + wxT("/Documents"); -#endif -} - -// ---------------------------------------------------------------------------- -// wxStandardPathsCF public API -// ---------------------------------------------------------------------------- - -wxString wxStandardPathsCF::GetConfigDir() const -{ -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - return wxMacFindFolderNoSeparator((short)kLocalDomain, kPreferencesFolderType, kCreateFolder); -#else - return wxT("/Library/Preferences"); -#endif -} - -wxString wxStandardPathsCF::GetUserConfigDir() const -{ -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - return wxMacFindFolderNoSeparator((short)kUserDomain, kPreferencesFolderType, kCreateFolder); -#else - return wxFileName::GetHomeDir() + wxT("/Library/Preferences"); -#endif -} - -wxString wxStandardPathsCF::GetDataDir() const -{ - return GetFromFunc(CFBundleCopySharedSupportURL); -} - -wxString wxStandardPathsCF::GetExecutablePath() const -{ -#ifdef __WXMAC__ - return GetFromFunc(CFBundleCopyExecutableURL); -#else - return wxStandardPathsBase::GetExecutablePath(); -#endif -} - -wxString wxStandardPathsCF::GetLocalDataDir() const -{ -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - return AppendAppInfo(wxMacFindFolderNoSeparator((short)kLocalDomain, kApplicationSupportFolderType, kCreateFolder)); -#else - return AppendAppInfo(wxT("/Library/Application Support")); -#endif -} - -wxString wxStandardPathsCF::GetUserDataDir() const -{ -#if defined( __WXMAC__ ) && wxOSX_USE_CARBON - return AppendAppInfo(wxMacFindFolderNoSeparator((short)kUserDomain, kApplicationSupportFolderType, kCreateFolder)); -#else - return AppendAppInfo(wxFileName::GetHomeDir() + wxT("/Library/Application Support")); -#endif -} - -wxString wxStandardPathsCF::GetPluginsDir() const -{ - return GetFromFunc(CFBundleCopyBuiltInPlugInsURL); -} - -wxString wxStandardPathsCF::GetResourcesDir() const -{ - return GetFromFunc(CFBundleCopyResourcesDirectoryURL); -} - -wxString -wxStandardPathsCF::GetLocalizedResourcesDir(const wxString& lang, - ResourceCat category) const -{ - return wxStandardPathsBase:: - GetLocalizedResourcesDir(lang, category) + wxT(".lproj"); -} - -#endif // wxUSE_STDPATHS diff --git a/Externals/wxWidgets3/src/osx/core/utilsexc_base.cpp b/Externals/wxWidgets3/src/osx/core/utilsexc_base.cpp index f510abc37a..25d9512a33 100644 --- a/Externals/wxWidgets3/src/osx/core/utilsexc_base.cpp +++ b/Externals/wxWidgets3/src/osx/core/utilsexc_base.cpp @@ -55,58 +55,6 @@ wxSocketManager *wxOSXSocketManagerCF = NULL; #if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON -// have a fast version for mac code that returns the version as a return value - -long UMAGetSystemVersion() -{ - static SInt32 sUMASystemVersion = 0 ; - if ( sUMASystemVersion == 0 ) - { - verify_noerr(Gestalt(gestaltSystemVersion, &sUMASystemVersion)); - } - return sUMASystemVersion ; -} - -// our OS version is the same in non GUI and GUI cases -wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn) -{ - // This returns 10 and 6 for OS X 10.6, consistent with behaviour on - // other platforms. - SInt32 maj, min; - Gestalt(gestaltSystemVersionMajor, &maj); - Gestalt(gestaltSystemVersionMinor, &min); - - if ( majorVsn != NULL ) - *majorVsn = maj; - - if ( minorVsn != NULL ) - *minorVsn = min; - -#if 0 - SInt32 theSystem; - Gestalt(gestaltSystemVersion, &theSystem); - - if ( majorVsn != NULL ) - *majorVsn = (theSystem >> 8); - - if ( minorVsn != NULL ) - *minorVsn = (theSystem & 0xFF); -#endif - return wxOS_MAC_OSX_DARWIN; -} - -#include - -wxString wxGetOsDescription() -{ - struct utsname name; - uname(&name); - return wxString::Format(wxT("Mac OS X (%s %s %s)"), - wxString::FromAscii(name.sysname).c_str(), - wxString::FromAscii(name.release).c_str(), - wxString::FromAscii(name.machine).c_str()); -} - //=========================================================================== // IMPLEMENTATION //=========================================================================== diff --git a/Externals/wxWidgets3/src/osx/core/utilsexc_cf.cpp b/Externals/wxWidgets3/src/osx/core/utilsexc_cf.cpp index 2a8c436223..2614cb4fc4 100644 --- a/Externals/wxWidgets3/src/osx/core/utilsexc_cf.cpp +++ b/Externals/wxWidgets3/src/osx/core/utilsexc_cf.cpp @@ -72,7 +72,7 @@ class wxCFEventLoopSourcesManager : public wxEventLoopSourcesManagerBase { public: wxEventLoopSource * - AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) + AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags) wxOVERRIDE { wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); @@ -152,26 +152,6 @@ wxEventLoopSourcesManagerBase* wxGUIAppTraits::GetEventLoopSourcesManager() ///////////////////////////////////////////////////////////////////////////// -// NOTE: This doesn't really belong here but this was a handy file to -// put it in because it's already compiled for wxCocoa and wxMac GUI lib. -#if wxUSE_STDPATHS -wxStandardPaths& wxGUIAppTraits::GetStandardPaths() -{ - // Derive a class just to be able to create it: wxStandardPaths ctor is - // protected to prevent its misuse, but it also means we can't create an - // object of this class directly. - class wxStandardPathsDefault : public wxStandardPathsCF - { - public: - wxStandardPathsDefault() { } - }; - - static wxStandardPathsDefault gs_stdPaths; - - return gs_stdPaths; -} -#endif - #if wxUSE_SOCKETS // we need to implement this method in a file of the core library as it should diff --git a/Externals/wxWidgets3/src/osx/dataview_osx.cpp b/Externals/wxWidgets3/src/osx/dataview_osx.cpp index 799e752e15..8aa128eca3 100644 --- a/Externals/wxWidgets3/src/osx/dataview_osx.cpp +++ b/Externals/wxWidgets3/src/osx/dataview_osx.cpp @@ -19,9 +19,6 @@ #include "wx/dcclient.h" #include "wx/icon.h" #endif -#if wxOSX_USE_CARBON -#include "wx/osx/carbon/dataview.h" -#endif #include "wx/osx/core/dataview.h" #include "wx/osx/private.h" @@ -62,15 +59,15 @@ public: // // inherited methods from wxDataViewModelNotifier // - virtual bool ItemAdded (wxDataViewItem const &parent, wxDataViewItem const &item); - virtual bool ItemsAdded (wxDataViewItem const& parent, wxDataViewItemArray const& items); - virtual bool ItemChanged (wxDataViewItem const& item); - virtual bool ItemsChanged(wxDataViewItemArray const& items); - virtual bool ItemDeleted (wxDataViewItem const& parent, wxDataViewItem const& item); - virtual bool ItemsDeleted(wxDataViewItem const& parent, wxDataViewItemArray const& items); - virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col); - virtual bool Cleared(); - virtual void Resort(); + virtual bool ItemAdded (wxDataViewItem const &parent, wxDataViewItem const &item) wxOVERRIDE; + virtual bool ItemsAdded (wxDataViewItem const& parent, wxDataViewItemArray const& items) wxOVERRIDE; + virtual bool ItemChanged (wxDataViewItem const& item) wxOVERRIDE; + virtual bool ItemsChanged(wxDataViewItemArray const& items) wxOVERRIDE; + virtual bool ItemDeleted (wxDataViewItem const& parent, wxDataViewItem const& item) wxOVERRIDE; + virtual bool ItemsDeleted(wxDataViewItem const& parent, wxDataViewItemArray const& items) wxOVERRIDE; + virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col) wxOVERRIDE; + virtual bool Cleared() wxOVERRIDE; + virtual void Resort() wxOVERRIDE; protected: // if the dataview control can have a variable row height this method sets the dataview's control row height of @@ -129,6 +126,7 @@ bool wxOSXDataViewModelNotifier::ItemChanged(wxDataViewItem const& item) wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(m_DataViewCtrlPtr); + dataViewEvent.SetModel(m_DataViewCtrlPtr->GetModel()); dataViewEvent.SetItem(item); // sent the equivalent wxWidget event: m_DataViewCtrlPtr->HandleWindowEvent(dataViewEvent); @@ -150,6 +148,7 @@ bool wxOSXDataViewModelNotifier::ItemsChanged(wxDataViewItemArray const& items) dataViewEvent.SetEventObject(m_DataViewCtrlPtr); + dataViewEvent.SetModel(m_DataViewCtrlPtr->GetModel()); for (size_t indexItem=0; indexItemGetDataViewPeer()->Update(GetOwner()->GetParent(items[indexItem]),items[indexItem])) { @@ -215,6 +214,7 @@ bool wxOSXDataViewModelNotifier::ValueChanged(wxDataViewItem const& item, unsign wxDataViewEvent dataViewEvent(wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,m_DataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(m_DataViewCtrlPtr); + dataViewEvent.SetModel(m_DataViewCtrlPtr->GetModel()); dataViewEvent.SetColumn(col); dataViewEvent.SetItem(item); // send the equivalent wxWidget event: @@ -346,7 +346,12 @@ void wxDataViewCustomRenderer::SetDC(wxDC* newDCPtr) wxDataViewCtrl::~wxDataViewCtrl() { - ClearColumns(); + // Notice that we don't call ClearColumns() from here as with Cocoa this + // method actually recreates the entire control which is unnecessary when + // we're about to dsetroy it and results in unexpected side effects (e.g. + // calls to comparison function as the entire contents of the control is + // re-added to it and so possibly re-sorted). + WX_CLEAR_ARRAY(m_ColumnPtrs); // Ensure that the already destructed controls is not notified about changes // in the model any more. @@ -390,7 +395,10 @@ bool wxDataViewCtrl::AssociateModel(wxDataViewModel* model) // We could have been associated with another model previously, break the // association in this case. if ( m_ModelNotifier ) + { m_ModelNotifier->GetOwner()->RemoveNotifier(m_ModelNotifier); + m_ModelNotifier = NULL; + } if (wxDataViewCtrlBase::AssociateModel(model) && dataViewWidgetPtr->AssociateModel(model)) { @@ -423,8 +431,6 @@ bool wxDataViewCtrl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) wxCHECK_MSG(dataViewWidgetPtr != NULL, false,"Pointer to native control must not be NULL."); wxCHECK_MSG(columnPtr != NULL, false,"Column pointer must not be NULL."); wxCHECK_MSG(columnPtr->GetRenderer() != NULL, false,"Column does not have a renderer."); - wxCHECK_MSG(GetModel() != NULL, false,"No model associated with control."); - wxCHECK_MSG(columnPtr->GetModelColumn() < GetModel()->GetColumnCount(),false,"Column's model column has no equivalent in the associated model."); // add column to wxWidget's internal structure: if (wxDataViewCtrlBase::InsertColumn(pos,columnPtr)) @@ -727,60 +733,14 @@ wxSize wxDataViewCtrl::DoGetBestSize() const void wxDataViewCtrl::OnMouse(wxMouseEvent& event) { event.Skip(); - -#if wxOSX_USE_CARBON - if (GetModel() == NULL) - return; - - wxMacDataViewDataBrowserListViewControlPointer MacDataViewListCtrlPtr(dynamic_cast(GetPeer())); - - int NoOfChildren; - wxDataViewItemArray items; - NoOfChildren = GetModel()->GetChildren( wxDataViewItem(), items); - if (NoOfChildren == 0) - return; - wxDataViewItem firstChild = items[0]; - - UInt16 headerHeight = 0; - MacDataViewListCtrlPtr->GetHeaderButtonHeight(&headerHeight); - - - if (event.GetY() < headerHeight) - { - unsigned int col_count = GetColumnCount(); - unsigned int col; - for (col = 0; col < col_count; col++) - { - wxDataViewColumn *column = GetColumn( col ); - if (column->IsHidden()) - continue; - - Rect itemrect; - ::GetDataBrowserItemPartBounds( MacDataViewListCtrlPtr->GetControlRef(), - reinterpret_cast(firstChild.GetID()), column->GetNativeData()->GetPropertyID(), - kDataBrowserPropertyEnclosingPart, &itemrect ); - - if (abs( event.GetX() - itemrect.right) < 3) - { - if (column->GetFlags() & wxDATAVIEW_COL_RESIZABLE) - SetCursor( wxCursor( wxCURSOR_SIZEWE ) ); - else - SetCursor( *wxSTANDARD_CURSOR ); - return; - } - } - - } - SetCursor( *wxSTANDARD_CURSOR ); -#endif } -IMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxDataViewCtrl,wxDataViewCtrlBase); -BEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase) +wxBEGIN_EVENT_TABLE(wxDataViewCtrl,wxDataViewCtrlBase) EVT_SIZE(wxDataViewCtrl::OnSize) EVT_MOTION(wxDataViewCtrl::OnMouse) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #endif // (wxUSE_DATAVIEWCTRL != 0) && (!defined(wxUSE_GENERICDATAVIEWCTRL) || (wxUSE_GENERICDATAVIEWCTRL == 0)) diff --git a/Externals/wxWidgets3/src/osx/dialog_osx.cpp b/Externals/wxWidgets3/src/osx/dialog_osx.cpp index fe870deaed..750e6a2059 100644 --- a/Externals/wxWidgets3/src/osx/dialog_osx.cpp +++ b/Externals/wxWidgets3/src/osx/dialog_osx.cpp @@ -178,5 +178,9 @@ void wxDialog::EndModal(int retCode) SetReturnCode(retCode); Show(false); + + // Prevent app frame from taking z-order precedence + if( GetParent() ) + GetParent()->Raise(); } diff --git a/Externals/wxWidgets3/src/osx/dnd_osx.cpp b/Externals/wxWidgets3/src/osx/dnd_osx.cpp index ab6f153b53..4170c5a5cf 100644 --- a/Externals/wxWidgets3/src/osx/dnd_osx.cpp +++ b/Externals/wxWidgets3/src/osx/dnd_osx.cpp @@ -129,10 +129,9 @@ bool wxDropTarget::GetData() } else { - char *d = new char[size]; - data->GetDataHere( format, (void*)d ); - m_dataObject->SetData( format, size, d ); - delete [] d; + wxCharBuffer d(size); + data->GetDataHere( format, d.data() ); + m_dataObject->SetData( format, size, d.data() ); } } } diff --git a/Externals/wxWidgets3/src/osx/fswatcher_fsevents.cpp b/Externals/wxWidgets3/src/osx/fswatcher_fsevents.cpp new file mode 100644 index 0000000000..849beb97ec --- /dev/null +++ b/Externals/wxWidgets3/src/osx/fswatcher_fsevents.cpp @@ -0,0 +1,509 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/fswatcher_fsevents.cpp +// Purpose: File System watcher that uses the FSEvents API +// of OS X to efficiently watch trees +// Author: Roberto Perpuly +// Created: 2015-04-24 +// Copyright: (c) 2015 Roberto Perpuly +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FSWATCHER && defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS) + +#include "wx/fswatcher.h" +#include "wx/osx/core/cfstring.h" +#include + +// A small class that we will give the FSEvents +// framework, which will be forwarded to the function +// that gets called when files change. +class wxFSEventWatcherContext +{ +public: + + // Watcher pointer will not be owned by this class. + wxFSEventWatcherContext(wxFsEventsFileSystemWatcher* watcher, + int watcherEventFlags, + const wxString& filespec) + : m_watcher(watcher) + , m_watcherEventFlags(watcherEventFlags) + , m_filespec(filespec) + { + + } + + // Will return true if the given event file and flags + // match the filespec and event flags given to the + // AddTree method. + bool IsDesiredEvent(const wxFileName& eventFileName, int eventFlags) + { + // warning and errors are always sent to the event handler + if ( eventFlags & wxFSW_EVENT_ERROR ) + { + return true; + } + if ( eventFlags & wxFSW_EVENT_WARNING ) + { + return true; + } + + if ( (m_watcherEventFlags & eventFlags) == 0 ) + { + // event handler does not want to see this event + return false; + } + + return m_filespec.empty() || + wxMatchWild(m_filespec, eventFileName.GetFullName()); + } + + wxFsEventsFileSystemWatcher* m_watcher; + + // The event flags that the event handler + // desires to be notified of. + int m_watcherEventFlags; + + // The filespec that the event handler + // desires to be notified of. + wxString m_filespec; + +private: + + wxDECLARE_NO_COPY_CLASS(wxFSEventWatcherContext); +}; + +// Translate kFSEventStreamEventFlag* flags +// to wxFSW_EVENT_* flags. +// warning and msg are out parameters, filled in when +// there is an error in the stream. +static int wxFSEventsToWatcherFlags(FSEventStreamEventFlags flags, +wxFSWWarningType& warning, wxString& msg) +{ + msg = ""; + warning = wxFSW_WARNING_NONE; + + // see https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/index.html + // for event flag meanings + int ret = 0; + int warnings = + kFSEventStreamEventFlagMustScanSubDirs + | kFSEventStreamEventFlagUserDropped + | kFSEventStreamEventFlagKernelDropped + | kFSEventStreamEventFlagMount + ; + + int errors = kFSEventStreamEventFlagRootChanged; + + // The following flags are not handled: + // kFSEventStreamEventFlagHistoryDone (we never ask for old events) + // kFSEventStreamEventFlagEventIdsWrapped ( we don't keep track nor + // expose event IDs) + + int created = kFSEventStreamEventFlagItemCreated; + int deleted = kFSEventStreamEventFlagItemRemoved; + int renamed = kFSEventStreamEventFlagItemRenamed; + int modified = kFSEventStreamEventFlagItemModified; + int attrib = kFSEventStreamEventFlagItemChangeOwner + | kFSEventStreamEventFlagItemFinderInfoMod + | kFSEventStreamEventFlagItemInodeMetaMod + | kFSEventStreamEventFlagItemXattrMod; + + if ( created & flags ) + { + ret |= wxFSW_EVENT_CREATE; + } + if ( deleted & flags ) + { + ret |= wxFSW_EVENT_DELETE; + } + if ( renamed & flags ) + { + ret |= wxFSW_EVENT_RENAME; + } + if ( modified & flags ) + { + ret |= wxFSW_EVENT_MODIFY; + } + if ( attrib & flags ) + { + ret |= wxFSW_EVENT_ATTRIB; + } + if ( kFSEventStreamEventFlagUnmount & flags ) + { + ret |= wxFSW_EVENT_UNMOUNT; + } + if ( warnings & flags ) + { + warning = wxFSW_WARNING_GENERAL; + ret |= wxFSW_EVENT_WARNING; + if (flags & kFSEventStreamEventFlagMustScanSubDirs) + { + msg += "Must re-scan sub directories."; + } + if (flags & kFSEventStreamEventFlagUserDropped) + { + msg += "User dropped events"; + warning = wxFSW_WARNING_OVERFLOW; + } + if (flags & kFSEventStreamEventFlagKernelDropped) + { + msg += "Kernel dropped events"; + warning = wxFSW_WARNING_OVERFLOW; + } + if (flags & kFSEventStreamEventFlagMount) + { + msg += "A volume was mounted underneath the watched directory."; + } + } + if ( errors & flags ) + { + ret |= wxFSW_EVENT_ERROR; + msg = "Path being watched has been renamed"; + } + + // don't think that FSEvents tells us about wxFSW_EVENT_ACCESS + return ret; +} + +// Fills in eventFileName appropriately based on whether the +// event was on a file or a directory. +static void FileNameFromEvent(wxFileName& eventFileName, char* path, + FSEventStreamEventFlags flags) +{ + wxString strPath(path); + if ( flags & kFSEventStreamEventFlagItemIsFile ) + { + eventFileName.Assign(strPath); + } + if ( flags & kFSEventStreamEventFlagItemIsDir ) + { + eventFileName.AssignDir(strPath); + } +} + +// This is the function that the FsEvents API +// will call to notify us that a file has been changed. +static void wxFSEventCallback(ConstFSEventStreamRef WXUNUSED(streamRef), void *clientCallBackInfo, + size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], + const FSEventStreamEventId WXUNUSED(eventIds)[]) +{ + wxFSEventWatcherContext* context = + (wxFSEventWatcherContext*) clientCallBackInfo; + + char** paths = (char**) eventPaths; + int lastWxEventFlags = 0; + wxFileName lastEventFileName; + wxString msg; + wxFSWWarningType warning = wxFSW_WARNING_NONE; + wxFileName eventFileName; + for ( size_t i = 0; i < numEvents; i++ ) + { + FSEventStreamEventFlags flags = eventFlags[i]; + FileNameFromEvent(eventFileName, paths[i], flags); + int wxEventFlags = wxFSEventsToWatcherFlags(flags, warning, msg); + if ( context->IsDesiredEvent(eventFileName, wxEventFlags) ) + { + // This is a naive way of looking for file renames + // wx presents a renames with a from and to paths + // but fs events events do not give us this (it only + // provides that a file was renamed, not what the new + // name is). + // We deduce the old and new paths by looking for consecutive + // renames. This is very naive and won't catch simulatenous + // renames inside the latency period, nor renames from/to + // a directory that is not inside the watched paths. + if (wxEventFlags == wxFSW_EVENT_RENAME && lastWxEventFlags == wxFSW_EVENT_RENAME) + { + context->m_watcher->PostChange(lastEventFileName, eventFileName, wxEventFlags); + } + else if (flags == kFSEventStreamEventFlagRootChanged) + { + // send two events: the delete event and the error event + context->m_watcher->PostChange(eventFileName, eventFileName, wxFSW_EVENT_DELETE); + context->m_watcher->PostError(msg); + } + else if (wxEventFlags != wxFSW_EVENT_RENAME) + { + context->m_watcher->PostChange(eventFileName, eventFileName, wxEventFlags); + } + else + { + // This is a "rename" event that we only saw once, meaning that + // a file was renamed to somewhere inside the watched tree + // OR a file was renamed to somewhere outside the watched tree. + if (!eventFileName.IsDir()) + { + int fileEventType = eventFileName.FileExists() ? wxFSW_EVENT_CREATE : wxFSW_EVENT_DELETE; + context->m_watcher->PostChange(eventFileName, eventFileName, fileEventType); + } + if (eventFileName.IsDir()) + { + int dirEventType = eventFileName.DirExists() ? wxFSW_EVENT_CREATE : wxFSW_EVENT_DELETE; + context->m_watcher->PostChange(eventFileName, eventFileName, dirEventType); + } + } + + if (wxEventFlags & wxFSW_EVENT_WARNING) + { + context->m_watcher->PostWarning(warning, msg); + } + + // A single rename (without the second rename) may be due + // to the file being renamed into a directory outside of the + // watch path. + lastWxEventFlags = wxEventFlags; + lastEventFileName = eventFileName; + } + } +} + +static void wxDeleteContext(const void* context) +{ + wxFSEventWatcherContext* watcherContext = + (wxFSEventWatcherContext*) context; + delete watcherContext; +} + +wxFsEventsFileSystemWatcher::wxFsEventsFileSystemWatcher() +: wxKqueueFileSystemWatcher() +{ + +} + +wxFsEventsFileSystemWatcher::wxFsEventsFileSystemWatcher(const wxFileName& path, + int events) +: wxKqueueFileSystemWatcher(path, events) +{ + +} + +wxFsEventsFileSystemWatcher::~wxFsEventsFileSystemWatcher() +{ + +} + +bool wxFsEventsFileSystemWatcher::AddTree(const wxFileName& path, int events, + const wxString& filespec) +{ + if (!path.DirExists()) + { + return false; + } + wxString canonical = GetCanonicalPath(path); + if ( canonical.empty() ) + { + return false; + } + CFRunLoopRef cfLoop = CFRunLoopGetCurrent(); + wxASSERT_MSG( + cfLoop, + "there must be a current event loop; this file watcher needs it." + ); + if ( ! cfLoop ) + { + return false; + } + + if ( m_streams.find(canonical) != m_streams.end() ) + { + // How to take into account filespec + // if client adds a watch for /home/*.cpp + // and then on another call wants to add a + // call to /home/*.h + // Ideally we should not create another watch + // however we would need to keep both filespecs + // around, which we don't do now. + return false; + } + + // Will need to pass the desired event flags + // and filespec to our callback via the context + // we make sure to give the context a cleanup + // callback. + FSEventStreamContext ctx; + wxFSEventWatcherContext* watcherContext = new wxFSEventWatcherContext( + this, events, filespec.Clone() + ); + ctx.version = 0; + ctx.info = watcherContext; + ctx.retain = NULL; + ctx.release = &wxDeleteContext; + ctx.copyDescription = NULL; + CFTimeInterval latency = 0.2; + + wxMacUniCharBuffer pathChars(path.GetPath()); + CFStringRef pathRef = CFStringCreateWithCharacters( + kCFAllocatorDefault, + pathChars.GetBuffer(), + pathChars.GetChars() + ); + CFArrayRef pathRefs = CFArrayCreate( + kCFAllocatorDefault, (const void**)&pathRef, 1, NULL + ); + FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot + | kFSEventStreamCreateFlagFileEvents; + + FSEventStreamRef stream = FSEventStreamCreate( + kCFAllocatorDefault, + &wxFSEventCallback, + &ctx, + pathRefs, kFSEventStreamEventIdSinceNow, + latency, flags); + bool started = false; + if ( stream ) + { + FSEventStreamScheduleWithRunLoop(stream, cfLoop, kCFRunLoopDefaultMode); + started = FSEventStreamStart(stream); + if ( started ) + { + m_streams[canonical] = stream; + } + } + + // cleanup the paths, as we own the pointers + CFRelease(pathRef); + CFRelease(pathRefs); + + wxASSERT_MSG(stream, "could not create FS stream"); + return started; +} + +bool wxFsEventsFileSystemWatcher::RemoveTree(const wxFileName& path) +{ + wxString canonical = GetCanonicalPath(path); + if ( canonical.empty() ) + { + return false; + } + + // Remove any kqueue watches created with Add() + // RemoveTree() should remove all watches no matter + // if they are tree watches or single directory watches. + wxArrayString dirsWatched; + wxKqueueFileSystemWatcher::GetWatchedPaths(&dirsWatched); + for ( size_t i = 0; i < dirsWatched.size(); i++ ) + { + if (dirsWatched[i].Find(canonical) == 0) + { + wxKqueueFileSystemWatcher::Remove(dirsWatched[i]); + } + } + + FSEventStreamRefMap::iterator it = m_streams.find(canonical); + bool removed = false; + if ( it != m_streams.end() ) + { + FSEventStreamStop(it->second); + FSEventStreamInvalidate(it->second); + FSEventStreamRelease(it->second); + m_streams.erase(it); + removed = true; + } + return removed; +} + +bool wxFsEventsFileSystemWatcher::RemoveAll() +{ + // remove all watches created with Add() + bool ret = wxKqueueFileSystemWatcher::RemoveAll(); + FSEventStreamRefMap::iterator it = m_streams.begin(); + while ( it != m_streams.end() ) + { + FSEventStreamStop(it->second); + FSEventStreamInvalidate(it->second); + FSEventStreamRelease(it->second); + it++; + ret |= true; + } + m_streams.clear(); + return ret; +} + +void wxFsEventsFileSystemWatcher::PostChange(const wxFileName& oldFileName, + const wxFileName& newFileName, int event) +{ + wxASSERT_MSG(this->GetOwner(), "owner must exist"); + if ( !this->GetOwner() ) + { + return; + } + + // FSEvents flags are a bit mask, but wx FSW events + // are not, meaning that FSEvent flag might be + // kFSEventStreamEventFlagItemCreated | kFSEventStreamEventFlagItemInodeMetaMod + // this means we must send 2 events not 1. + int allEvents[6] = { + wxFSW_EVENT_CREATE, + wxFSW_EVENT_DELETE, + wxFSW_EVENT_RENAME, + wxFSW_EVENT_MODIFY, + wxFSW_EVENT_ACCESS, + wxFSW_EVENT_ATTRIB + }; + + for ( int i = 0; i < WXSIZEOF(allEvents); i++ ) + { + if ( event & allEvents[i] ) + { + wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent( + allEvents[i], oldFileName, newFileName + ); + wxQueueEvent(this->GetOwner(), evt); + } + } +} + +void wxFsEventsFileSystemWatcher::PostWarning(wxFSWWarningType warning, + const wxString& msg) +{ + wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent( + wxFSW_EVENT_WARNING, warning, msg + ); + wxASSERT_MSG(this->GetOwner(), "owner must exist"); + if (this->GetOwner()) + { + wxQueueEvent(this->GetOwner(), evt); + } +} + +void wxFsEventsFileSystemWatcher::PostError(const wxString& msg) +{ + wxFileSystemWatcherEvent* evt = new wxFileSystemWatcherEvent( + wxFSW_EVENT_ERROR, wxFSW_WARNING_NONE, msg + ); + wxASSERT_MSG(this->GetOwner(), "owner must exist"); + if (this->GetOwner()) + { + wxQueueEvent(this->GetOwner(), evt); + } +} + +int wxFsEventsFileSystemWatcher::GetWatchedPathsCount() const +{ + return m_streams.size() + wxFileSystemWatcherBase::GetWatchedPathsCount(); +} + +int wxFsEventsFileSystemWatcher::GetWatchedPaths(wxArrayString* paths) const +{ + wxCHECK_MSG( paths != NULL, -1, "Null array passed to retrieve paths"); + if ( !paths ) + { + return 0; + } + wxFileSystemWatcherBase::GetWatchedPaths(paths); + FSEventStreamRefMap::const_iterator it = m_streams.begin(); + for ( ; it != m_streams.end(); it++ ) + { + paths->push_back(it->first); + } + return paths->size(); +} + +#endif // wxUSE_FSWATCHER diff --git a/Externals/wxWidgets3/src/osx/gauge_osx.cpp b/Externals/wxWidgets3/src/osx/gauge_osx.cpp index 40e4c71cd8..46ded9dcf2 100644 --- a/Externals/wxWidgets3/src/osx/gauge_osx.cpp +++ b/Externals/wxWidgets3/src/osx/gauge_osx.cpp @@ -14,6 +14,7 @@ #include "wx/gauge.h" +#include "wx/appprogress.h" #include "wx/osx/private.h" bool wxGauge::Create( wxWindow *parent, @@ -66,6 +67,9 @@ int wxGauge::GetValue() const void wxGauge::Pulse() { GetPeer()->PulseGauge(); + + if ( m_appProgressIndicator ) + m_appProgressIndicator->Pulse(); } #endif // wxUSE_GAUGE diff --git a/Externals/wxWidgets3/src/osx/glcanvas_osx.cpp b/Externals/wxWidgets3/src/osx/glcanvas_osx.cpp index 3610ccff48..32630e4c80 100644 --- a/Externals/wxWidgets3/src/osx/glcanvas_osx.cpp +++ b/Externals/wxWidgets3/src/osx/glcanvas_osx.cpp @@ -34,14 +34,368 @@ #include "wx/osx/private.h" +// These 'WX' values are the same as 'NS' ones +// Source: https://developer.apple.com/library/mac/documentation/ +// Cocoa/Reference/ApplicationKit/Classes/NSOpenGLPixelFormat_Class/index.html +#define WXOpenGLPFAAllRenderers 1 +#define WXOpenGLPFATripleBuffer 3 +#define WXOpenGLPFADoubleBuffer 5 +#define WXOpenGLPFAStereo 6 +#define WXOpenGLPFAAuxBuffers 7 +#define WXOpenGLPFAColorSize 8 +#define WXOpenGLPFAAlphaSize 11 +#define WXOpenGLPFADepthSize 12 +#define WXOpenGLPFAStencilSize 13 +#define WXOpenGLPFAAccumSize 14 +#define WXOpenGLPFAMinimumPolicy 51 +#define WXOpenGLPFAMaximumPolicy 52 +#define WXOpenGLPFAOffScreen 53 +#define WXOpenGLPFAFullScreen 54 +#define WXOpenGLPFASampleBuffers 55 +#define WXOpenGLPFASamples 56 +#define WXOpenGLPFAAuxDepthStencil 57 +#define WXOpenGLPFAColorFloat 58 +#define WXOpenGLPFAMultisample 59 +#define WXOpenGLPFASupersample 60 +#define WXOpenGLPFASampleAlpha 61 +#define WXOpenGLPFARendererID 70 +#define WXOpenGLPFASingleRenderer 71 +#define WXOpenGLPFANoRecovery 72 +#define WXOpenGLPFAAccelerated 73 +#define WXOpenGLPFAClosestPolicy 74 +#define WXOpenGLPFARobust 75 +#define WXOpenGLPFABackingStore 76 +#define WXOpenGLPFAMPSafe 78 +#define WXOpenGLPFAWindow 80 +#define WXOpenGLPFAMultiScreen 81 +#define WXOpenGLPFACompliant 83 +#define WXOpenGLPFAScreenMask 84 +#define WXOpenGLPFAPixelBuffer 90 +#define WXOpenGLPFARemotePixelBuffer 91 +#define WXOpenGLPFAAllowOfflineRenderers 96 +#define WXOpenGLPFAAcceleratedCompute 97 +#define WXOpenGLPFAOpenGLProfile 99 +#define WXOpenGLPFAVirtualScreenCount 128 + +#define WXOpenGLProfileVersionLegacy 0x1000 +#define WXOpenGLProfileVersion3_2Core 0x3200 + // ---------------------------------------------------------------------------- -// wxGLCanvas +// wxGLContextAttrs: OpenGL rendering context attributes +// ---------------------------------------------------------------------------- +// OSX specific values + +wxGLContextAttrs& wxGLContextAttrs::CoreProfile() +{ + AddAttribute(WXOpenGLPFAOpenGLProfile); + AddAttribute(WXOpenGLProfileVersion3_2Core); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MajorVersion(int val) +{ + // No effect + wxUnusedVar(val); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MinorVersion(int val) +{ + // No effect + wxUnusedVar(val); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::CompatibilityProfile() +{ + AddAttribute(WXOpenGLPFAOpenGLProfile); + AddAttribute(WXOpenGLProfileVersionLegacy); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ForwardCompatible() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ES2() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::DebugCtx() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::Robust() +{ + // No effect. Somehow similar flag (NSOpenGLPFARobust) is deprecated in OS X v10.5 + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::NoResetNotify() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::LoseOnReset() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ResetIsolation() +{ + // No effect + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ReleaseFlush(int val) +{ + // No effect + wxUnusedVar(val); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::PlatformDefaults() +{ + // No OSX specific defaults + return *this; +} + +void wxGLContextAttrs::EndList() +{ + AddAttribute(0); +} + +// ---------------------------------------------------------------------------- +// wxGLAttributes: pixel format attributes +// ---------------------------------------------------------------------------- +// OSX specific values + +wxGLAttributes& wxGLAttributes::RGBA() +{ + AddAttribute(WXOpenGLPFAColorSize); + AddAttribute(24); + AddAttribute(WXOpenGLPFAAlphaSize); + AddAttribute(8); + return *this; +} + +wxGLAttributes& wxGLAttributes::BufferSize(int val) +{ + // No effect + wxUnusedVar(val); + return *this; +} + +wxGLAttributes& wxGLAttributes::Level(int val) +{ + // No effect + wxUnusedVar(val); + return *this; +} + +wxGLAttributes& wxGLAttributes::DoubleBuffer() +{ + AddAttribute(WXOpenGLPFADoubleBuffer); + return *this; +} + +wxGLAttributes& wxGLAttributes::Stereo() +{ + AddAttribute(WXOpenGLPFAStereo); + return *this; +} + +wxGLAttributes& wxGLAttributes::AuxBuffers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WXOpenGLPFAAuxBuffers); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + int minColorBits = 0; + if ( mRed > minColorBits ) + minColorBits = mRed; + if ( mGreen > minColorBits ) + minColorBits = mGreen; + if ( mBlue > minColorBits ) + minColorBits = mBlue; + if ( minColorBits > 0 ) + { + AddAttribute(WXOpenGLPFAColorSize); + AddAttribute(minColorBits); + } + + if ( mAlpha >= 0 ) + { + AddAttribute(WXOpenGLPFAAlphaSize); + AddAttribute(mAlpha); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Depth(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WXOpenGLPFADepthSize); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Stencil(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WXOpenGLPFAStencilSize); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + int minAcumBits = 0; + if ( mRed > minAcumBits ) + minAcumBits = mRed; + if ( mGreen > minAcumBits ) + minAcumBits = mGreen; + if ( mBlue > minAcumBits ) + minAcumBits = mBlue; + if ( minAcumBits > 0 ) + { + AddAttribute(WXOpenGLPFAAccumSize); + AddAttribute(minAcumBits); + } + + // No effect for Alpha in accumulation buffer + wxUnusedVar(mAlpha); + + return *this; +} + +wxGLAttributes& wxGLAttributes::SampleBuffers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WXOpenGLPFASampleBuffers); + AddAttribute(val); + // Don't use software fallback + AddAttribute(WXOpenGLPFANoRecovery); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Samplers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(WXOpenGLPFASamples); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::FrameBuffersRGB() +{ + // No effect + return *this; +} + +void wxGLAttributes::EndList() +{ + AddAttribute(0); +} + +wxGLAttributes& wxGLAttributes::PlatformDefaults() +{ + AddAttribute(WXOpenGLPFAMinimumPolicy); // use _SIZE tags as minimum sizes + + // Test if we support hardware acceleration, we always want to use it if it + // is available and, apparently, in spite of the Apple docs explicitly + // saying the contrary: + // + // If present, this attribute indicates that only hardware-accelerated + // renderers are considered. If not present, accelerated renderers are + // still preferred. + // + // hardware acceleration is not always used without it, so we do need to + // specify it. But we shouldn't do it if acceleration is really not + // available. + const int attrsAccel[] = { WXOpenGLPFAAccelerated, 0 }; + WXGLPixelFormat testFormat = WXGLChoosePixelFormat(attrsAccel, 2); + if ( testFormat ) + { + // Hardware acceleration is available, use it. + AddAttribute(WXOpenGLPFAAccelerated); + WXGLDestroyPixelFormat(testFormat); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Defaults() +{ + RGBA().Depth(16).DoubleBuffer().SampleBuffers(1).Samplers(4); + return *this; +} + +// ---------------------------------------------------------------------------- +// wxGLContext // ---------------------------------------------------------------------------- -wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext *other) +wxGLContext::wxGLContext(wxGLCanvas *win, + const wxGLContext *other, + const wxGLContextAttrs *ctxAttrs) + : m_glContext(NULL) { - m_glContext = WXGLCreateContext(win->GetWXGLPixelFormat(), - other ? other->m_glContext : NULL); + const int* contextAttribs = NULL; + int ctxSize = 0; + + if ( ctxAttrs ) + { + contextAttribs = ctxAttrs->GetGLAttrs(); + ctxSize = ctxAttrs->GetSize(); + } + else if ( win->GetGLCTXAttrs().GetGLAttrs() ) + { + // If OpenGL context parameters were set at wxGLCanvas ctor, get them now + contextAttribs = win->GetGLCTXAttrs().GetGLAttrs(); + ctxSize = win->GetGLCTXAttrs().GetSize(); + } + // else use GPU driver defaults + + // Join canvas attributes and context attributes to ask for a pixel format + WXGLPixelFormat pf = WXGLChoosePixelFormat(win->GetGLDispAttrs().GetGLAttrs(), + win->GetGLDispAttrs().GetSize(), + contextAttribs, ctxSize); + + m_isOk = false; + + if ( pf ) + { + m_glContext = WXGLCreateContext(pf, other ? other->m_glContext : NULL); + if ( m_glContext ) + { + m_isOk = true; + } + + WXGLDestroyPixelFormat(pf); + } + if ( !m_isOk ) + wxLogMessage(_("Couldn't create OpenGL context")); } wxGLContext::~wxGLContext() @@ -56,13 +410,22 @@ wxGLContext::~wxGLContext() // wxGLCanvas // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGLCanvas, wxWindow) +wxIMPLEMENT_CLASS(wxGLCanvas, wxWindow); -BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) -#if wxOSX_USE_CARBON - EVT_SIZE(wxGLCanvas::OnSize) -#endif -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) +wxEND_EVENT_TABLE() + +wxGLCanvas::wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) +{ + Create(parent, dispAttrs, id, pos, size, style, name, palette); +} wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, @@ -76,6 +439,58 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, Create(parent, id, pos, size, style, name, attribList, palette); } +bool wxGLCanvas::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const int *attribList, + const wxPalette& palette) +{ + // Separate 'pixel format' attributes. + // Also store context attributes for wxGLContext ctor + // If 'attribList' is NULL, ParseAttribList() will set defaults. + wxGLAttributes dispAttrs; + if ( ! ParseAttribList(attribList, dispAttrs, &m_GLCTXAttrs) ) + return false; + + return Create(parent, dispAttrs, id, pos, size, style, name, palette); +} + +bool wxGLCanvas::Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& WXUNUSED(palette)) +{ + m_glFormat = NULL; + // Don't allow an empty list + if ( !dispAttrs.GetGLAttrs() ) + { + wxFAIL_MSG("wxGLAttributes object is empty."); + return false; + } + + // Return false if any attribute is unsupported + if ( ! IsDisplaySupported(dispAttrs) ) + { + wxFAIL_MSG("Can't find a pixel format for the requested attributes"); + return false; + } + + // Make a copy of attributes. Will use at wxGLContext ctor + m_GLAttrs = dispAttrs; + + if ( !wxWindow::Create(parent, id, pos, size, style, name) ) + return false; + + return true; +} + #if WXWIN_COMPATIBILITY_2_8 wxGLCanvas::wxGLCanvas(wxWindow *parent, @@ -131,23 +546,36 @@ bool wxGLCanvas::IsAGLMultiSampleAvailable() return s_isMultiSampleAvailable != 0; } +/* static */ +bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) +{ + WXGLPixelFormat testFormat = WXGLChoosePixelFormat(dispAttrs.GetGLAttrs(), dispAttrs.GetSize()); + if ( testFormat ) + { + WXGLDestroyPixelFormat(testFormat); + } + else + { + return false; + } + return true; +} + /* static */ bool wxGLCanvasBase::IsDisplaySupported(const int *attribList) { - WXGLPixelFormat glFormat = WXGLChoosePixelFormat(attribList); + wxGLAttributes dispAttrs; + ParseAttribList(attribList, dispAttrs); - if ( !glFormat ) - return false; - - WXGLDestroyPixelFormat(glFormat); - - return true; + return IsDisplaySupported(dispAttrs); } bool wxGLCanvasBase::IsExtensionSupported(const char *extension) { - // we need a valid context to query for extensions. - WXGLPixelFormat fmt = WXGLChoosePixelFormat(NULL); + // We need a valid context to query for extensions. Use a default one. + wxGLAttributes dispAttrs; + ParseAttribList(NULL, dispAttrs); // Sets defaults + WXGLPixelFormat fmt = WXGLChoosePixelFormat(dispAttrs.GetGLAttrs(), dispAttrs.GetSize()); WXGLContext ctx = WXGLCreateContext(fmt, NULL); if ( !ctx ) return false; diff --git a/Externals/wxWidgets3/src/osx/imaglist.cpp b/Externals/wxWidgets3/src/osx/imaglist.cpp index 300a143bfd..b057fe3c3f 100644 --- a/Externals/wxWidgets3/src/osx/imaglist.cpp +++ b/Externals/wxWidgets3/src/osx/imaglist.cpp @@ -22,7 +22,7 @@ #include "wx/image.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject); wxImageList::wxImageList( int width, int height, bool mask, int initialCount ) diff --git a/Externals/wxWidgets3/src/osx/iphone/evtloop.mm b/Externals/wxWidgets3/src/osx/iphone/evtloop.mm index 4e179b6241..cc8a3a8f95 100644 --- a/Externals/wxWidgets3/src/osx/iphone/evtloop.mm +++ b/Externals/wxWidgets3/src/osx/iphone/evtloop.mm @@ -80,6 +80,10 @@ wxGUIEventLoop::wxGUIEventLoop() { } +wxGUIEventLoop::~wxGUIEventLoop() +{ +} + void wxGUIEventLoop::OSXDoRun() { if ( IsMain() ) diff --git a/Externals/wxWidgets3/src/osx/iphone/msgdlg.mm b/Externals/wxWidgets3/src/osx/iphone/msgdlg.mm index 3431cb5a91..30d1f58777 100644 --- a/Externals/wxWidgets3/src/osx/iphone/msgdlg.mm +++ b/Externals/wxWidgets3/src/osx/iphone/msgdlg.mm @@ -22,7 +22,7 @@ #include "wx/modalhook.h" -IMPLEMENT_CLASS(wxMessageDialog, wxDialog) +wxIMPLEMENT_CLASS(wxMessageDialog, wxDialog); wxMessageDialog::wxMessageDialog(wxWindow *parent, diff --git a/Externals/wxWidgets3/src/osx/iphone/nonownedwnd.mm b/Externals/wxWidgets3/src/osx/iphone/nonownedwnd.mm index b7082f89c8..2da94aba87 100644 --- a/Externals/wxWidgets3/src/osx/iphone/nonownedwnd.mm +++ b/Externals/wxWidgets3/src/osx/iphone/nonownedwnd.mm @@ -69,7 +69,7 @@ wxPoint wxFromNSPoint( UIView* parent, const CGPoint& p ) // c++ impl // -IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl ) +wxIMPLEMENT_DYNAMIC_CLASS(wxNonOwnedWindowIPhoneImpl , wxNonOwnedWindowImpl); wxNonOwnedWindowIPhoneImpl::wxNonOwnedWindowIPhoneImpl( wxNonOwnedWindow* nonownedwnd) : wxNonOwnedWindowImpl(nonownedwnd) @@ -284,6 +284,11 @@ bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const return m_macFullScreenData != NULL ; } +bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable)) +{ + return true; +} + bool wxNonOwnedWindowIPhoneImpl::ShowFullScreen(bool show, long style) { return true; diff --git a/Externals/wxWidgets3/src/osx/carbon/settings.cpp b/Externals/wxWidgets3/src/osx/iphone/settings.mm similarity index 73% rename from Externals/wxWidgets3/src/osx/carbon/settings.cpp rename to Externals/wxWidgets3/src/osx/iphone/settings.mm index 193da854b3..807e63b0c8 100644 --- a/Externals/wxWidgets3/src/osx/carbon/settings.cpp +++ b/Externals/wxWidgets3/src/osx/iphone/settings.mm @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/settings.cpp +// Name: src/osx/iphone/settings.mm // Purpose: wxSettings -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor +// Author: David Elliott +// Modified by: Tobias Taschner +// Created: 2005/01/11 +// Copyright: (c) 2005 David Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -17,8 +17,9 @@ #include "wx/gdicmn.h" #endif -#include "wx/osx/private.h" -#include "wx/fontenum.h" +#include "wx/osx/core/private.h" + +#include "UIKit/UIKit.h" // ---------------------------------------------------------------------------- // wxSystemSettingsNative @@ -38,11 +39,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) switch ( index ) { case wxSYS_COLOUR_WINDOW: -#if wxOSX_USE_COCOA_OR_CARBON - resultColor = wxColour(wxMacCreateCGColorFromHITheme( 15 /* kThemeBrushDocumentWindowBackground */ )) ; -#else resultColor = *wxWHITE; -#endif break ; case wxSYS_COLOUR_SCROLLBAR : case wxSYS_COLOUR_BACKGROUND: @@ -54,11 +51,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_BTNFACE: case wxSYS_COLOUR_MENUBAR: -#if wxOSX_USE_COCOA_OR_CARBON - resultColor = wxColour(wxMacCreateCGColorFromHITheme( 3 /* kThemeBrushDialogBackgroundActive */)); -#else resultColor = wxColour( 0xBE, 0xBE, 0xBE ) ; -#endif break ; case wxSYS_COLOUR_LISTBOX : @@ -81,17 +74,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_HIGHLIGHT: { -#if wxOSX_USE_COCOA_OR_CARBON -#if 0 - // NB: enable this case as desired - colorBrushID = kThemeBrushAlternatePrimaryHighlightColor; -#else - colorBrushID = -3 /* kThemeBrushPrimaryHighlightColor */; -#endif - resultColor = wxColour( wxMacCreateCGColorFromHITheme(colorBrushID) ); -#else resultColor = wxColor( 0xCC, 0xCC, 0xFF ); -#endif } break ; @@ -110,17 +93,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_HIGHLIGHTTEXT : case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT : -#if wxOSX_USE_COCOA_OR_CARBON - { - wxColour highlightcolor( wxMacCreateCGColorFromHITheme(-3 /* kThemeBrushPrimaryHighlightColor */) ); - if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0) - resultColor = *wxWHITE ; - else - resultColor = *wxBLACK ; - } -#else resultColor = *wxWHITE ; -#endif break ; case wxSYS_COLOUR_INFOBK : @@ -140,15 +113,11 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) resultColor = *wxBLACK; break ; - // case wxSYS_COLOUR_MAX: default: resultColor = *wxWHITE; - // wxCHECK_MSG( index >= wxSYS_COLOUR_MAX, false, wxT("unknown system colour index") ); break ; } - //wxASSERT(resultColor.IsOk()); - return resultColor; } @@ -158,25 +127,27 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) { - wxFont font; - switch (index) { case wxSYS_ANSI_VAR_FONT : case wxSYS_SYSTEM_FONT : case wxSYS_DEVICE_DEFAULT_FONT : case wxSYS_DEFAULT_GUI_FONT : - font = *wxSMALL_FONT ; + { + return *wxSMALL_FONT ; + } ; break ; - + case wxSYS_OEM_FIXED_FONT : + case wxSYS_ANSI_FIXED_FONT : + case wxSYS_SYSTEM_FIXED_FONT : default : - font = *wxNORMAL_FONT ; + { + return *wxNORMAL_FONT ; + } ; break ; + } - - //wxASSERT(font.IsOk() && wxFontEnumerator::IsValidFacename(font.GetFaceName())); - - return font; + return *wxNORMAL_FONT; } // ---------------------------------------------------------------------------- @@ -184,15 +155,14 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) // ---------------------------------------------------------------------------- // Get a system metric, e.g. scrollbar size -int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win)) +int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow *WXUNUSED(win)) { int value; switch ( index ) { case wxSYS_MOUSE_BUTTONS: - // we emulate a two button mouse (ctrl + click = right button) - return 2; + return 2; // we emulate a two button mouse (ctrl + click = right button ) // TODO case wxSYS_BORDER_X: // TODO case wxSYS_BORDER_Y: @@ -206,7 +176,9 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w // TODO case wxSYS_EDGE_Y: case wxSYS_HSCROLL_ARROW_X: + return 16; case wxSYS_HSCROLL_ARROW_Y: + return 16; case wxSYS_HTHUMB_X: return 16; @@ -218,11 +190,11 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w // TODO case wxSYS_WINDOWMIN_Y: case wxSYS_SCREEN_X: - wxDisplaySize( &value, NULL ); + wxDisplaySize(&value, NULL); return value; case wxSYS_SCREEN_Y: - wxDisplaySize( NULL, &value ); + wxDisplaySize(NULL, &value); return value; // TODO case wxSYS_FRAMESIZE_X: @@ -231,37 +203,37 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w // TODO case wxSYS_SMALLICON_Y: case wxSYS_HSCROLL_Y: + return 16; case wxSYS_VSCROLL_X: + return 16; case wxSYS_VSCROLL_ARROW_X: + return 16; case wxSYS_VSCROLL_ARROW_Y: + return 16; case wxSYS_VTHUMB_Y: return 16; + // TODO case wxSYS_CAPTION_Y: + // TODO case wxSYS_MENU_Y: + // TODO case wxSYS_NETWORK_PRESENT: + case wxSYS_PENWINDOWS_PRESENT: return 0; + // TODO case wxSYS_SHOW_SOUNDS: + case wxSYS_SWAP_BUTTONS: return 0; - // TODO: case wxSYS_CAPTION_Y: - // TODO: case wxSYS_MENU_Y: - // TODO: case wxSYS_NETWORK_PRESENT: - // TODO: case wxSYS_SHOW_SOUNDS: - case wxSYS_DCLICK_MSEC: -#if wxOSX_USE_CARBON - return (int)(GetDblTime() * 1000. / 60.); -#else // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway // but rather rely on the 'click-count' by the system delivered in a mouse event return 500; -#endif - default: - // unsupported metric - break; - } - return -1; + default: + return -1; // unsupported metric + } + return 0; } bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) diff --git a/Externals/wxWidgets3/src/osx/iphone/stattext.mm b/Externals/wxWidgets3/src/osx/iphone/stattext.mm index b0994d0733..556d3e85c8 100644 --- a/Externals/wxWidgets3/src/osx/iphone/stattext.mm +++ b/Externals/wxWidgets3/src/osx/iphone/stattext.mm @@ -81,7 +81,7 @@ wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer, v.backgroundColor = [UIColor clearColor]; UILineBreakMode linebreak = UILineBreakModeWordWrap; - if ( ((wxStaticText*)wxpeer)->IsEllipsized() ) + if ( style & wxST_ELLIPSIZE_MASK ) { if ( style & wxST_ELLIPSIZE_MIDDLE ) linebreak = UILineBreakModeMiddleTruncation; diff --git a/Externals/wxWidgets3/src/osx/iphone/textctrl.mm b/Externals/wxWidgets3/src/osx/iphone/textctrl.mm index 8fa70b90ad..da4404938b 100644 --- a/Externals/wxWidgets3/src/osx/iphone/textctrl.mm +++ b/Externals/wxWidgets3/src/osx/iphone/textctrl.mm @@ -601,6 +601,13 @@ bool wxUITextFieldControl::CanPaste() const void wxUITextFieldControl::SetEditable(bool editable) { + if (m_textField) { + if ( !editable ) { + [m_textField resignFirstResponder]; + } + + [m_textField setEnabled: editable]; + } } void wxUITextFieldControl::GetSelection( long* from, long* to) const @@ -733,6 +740,11 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer, if ( style & wxTE_PASSWORD ) [tv setSecureTextEntry:YES]; + if ( style & wxTE_CAPITALIZE ) + [tv setAutocapitalizationType:UITextAutocapitalizationTypeWords]; + else + [tv setAutocapitalizationType:UITextAutocapitalizationTypeSentences]; + if ( !(style & wxTE_MULTILINE) ) { [tv setAutocorrectionType:UITextAutocorrectionTypeNo]; diff --git a/Externals/wxWidgets3/src/osx/iphone/toolbar.mm b/Externals/wxWidgets3/src/osx/iphone/toolbar.mm index 589c3f7028..3af8bca297 100644 --- a/Externals/wxWidgets3/src/osx/iphone/toolbar.mm +++ b/Externals/wxWidgets3/src/osx/iphone/toolbar.mm @@ -26,8 +26,8 @@ #pragma mark - #pragma mark Tool Implementation -BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // private classes diff --git a/Externals/wxWidgets3/src/osx/iphone/utils.mm b/Externals/wxWidgets3/src/osx/iphone/utils.mm index 633c7b72ac..b85cb437e0 100644 --- a/Externals/wxWidgets3/src/osx/iphone/utils.mm +++ b/Externals/wxWidgets3/src/osx/iphone/utils.mm @@ -28,6 +28,7 @@ #include "wx/osx/private.h" #if wxUSE_GUI + #include "wx/private/launchbrowser.h" #include "wx/osx/private/timer.h" #include "wx/osx/dcclient.h" #endif // wxUSE_GUI @@ -102,9 +103,9 @@ void wxBell() // Launch default browser // ---------------------------------------------------------------------------- -bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { - return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:wxCFStringRef(url).AsNSString()]] + return [[UIApplication sharedApplication] openURL:[NSURL URLWithString:wxCFStringRef(params.url).AsNSString()]] == YES; } @@ -316,36 +317,4 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const #endif // wxUSE_GUI -wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) -{ - // get OS version - int major, minor; - - wxString release = wxCFStringRef( wxCFRetain( [ [UIDevice currentDevice] systemVersion] ) ).AsString() ; - - if ( release.empty() || - // TODO use wx method - scanf(release.c_str(), wxT("%d.%d"), &major, &minor) != 2 ) - { - // failed to get version string or unrecognized format - major = - minor = -1; - } - - if ( verMaj ) - *verMaj = major; - if ( verMin ) - *verMin = minor; - - return wxOS_MAC_OSX_DARWIN; -} - -wxString wxGetOsDescription() -{ - wxString release = wxCFStringRef( wxCFRetain([ [UIDevice currentDevice] systemName] )).AsString() ; - - return release; -} - - #endif // wxOSX_USE_IPHONE diff --git a/Externals/wxWidgets3/src/osx/iphone/window.mm b/Externals/wxWidgets3/src/osx/iphone/window.mm index b4b8c4ac36..5872e9dc01 100644 --- a/Externals/wxWidgets3/src/osx/iphone/window.mm +++ b/Externals/wxWidgets3/src/osx/iphone/window.mm @@ -326,7 +326,7 @@ void wxOSXIPhoneClassAddWXMethods(Class c) @end -IMPLEMENT_DYNAMIC_CLASS( wxWidgetIPhoneImpl , wxWidgetImpl ) +wxIMPLEMENT_DYNAMIC_CLASS(wxWidgetIPhoneImpl , wxWidgetImpl); wxWidgetIPhoneImpl::wxWidgetIPhoneImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) : wxWidgetImpl( peer, isRootControl, isUserPane ), m_osxView(w) diff --git a/Externals/wxWidgets3/src/osx/listbox_osx.cpp b/Externals/wxWidgets3/src/osx/listbox_osx.cpp index c48607ea5a..82c9de9d07 100644 --- a/Externals/wxWidgets3/src/osx/listbox_osx.cpp +++ b/Externals/wxWidgets3/src/osx/listbox_osx.cpp @@ -23,8 +23,8 @@ #include "wx/dcclient.h" #endif -BEGIN_EVENT_TABLE(wxListBox, wxControl) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxListBox, wxControl) +wxEND_EVENT_TABLE() #include "wx/osx/private.h" @@ -83,7 +83,7 @@ bool wxListBox::Create( return false; if ( IsSorted() ) - m_strings.sorted = new wxSortedArrayString; + m_strings.sorted = new wxSortedArrayString(wxDictionaryStringSortAscending); else m_strings.unsorted = new wxArrayString; @@ -145,6 +145,11 @@ void wxListBox::EnsureVisible(int n) GetListPeer()->ListScrollTo( n ); } +int wxListBox::GetTopItem() const +{ + return GetListPeer()->ListGetTopItem(); +} + void wxListBox::DoDeleteOneItem(unsigned int n) { wxCHECK_RET( IsValid(n), wxT("invalid index in wxListBox::Delete") ); @@ -191,6 +196,9 @@ void wxListBox::DoSetSelection(int n, bool select) m_blockEvents = false; UpdateOldSelections(); + + if (select) + EnsureVisible(n); } bool wxListBox::IsSelected(int n) const diff --git a/Externals/wxWidgets3/src/osx/menu_osx.cpp b/Externals/wxWidgets3/src/osx/menu_osx.cpp index 97685d31ef..557a613271 100644 --- a/Externals/wxWidgets3/src/osx/menu_osx.cpp +++ b/Externals/wxWidgets3/src/osx/menu_osx.cpp @@ -31,12 +31,13 @@ #endif #include "wx/osx/private.h" +#include "wx/scopedptr.h" // other standard headers // ---------------------- #include -IMPLEMENT_ABSTRACT_CLASS( wxMenuImpl , wxObject ) +wxIMPLEMENT_ABSTRACT_CLASS(wxMenuImpl, wxObject); wxMenuImpl::~wxMenuImpl() { @@ -45,6 +46,8 @@ wxMenuImpl::~wxMenuImpl() // the (popup) menu title has this special menuid static const int idMenuTitle = -3; +wxScopedPtr gs_emptyMenuBar; + // ============================================================================ // implementation // ============================================================================ @@ -451,32 +454,6 @@ bool wxMenu::HandleCommandUpdateStatus( wxMenuItem* item, wxWindow* senderWindow if (event.GetSetEnabled()) Enable(menuid, event.GetEnabled()); } - else - { -#if wxOSX_USE_CARBON - // these two items are also managed by the Carbon Menu Manager, therefore we must - // always reset them ourselves - UInt32 cmd = 0; - - if ( menuid == wxApp::s_macExitMenuItemId ) - { - cmd = kHICommandQuit; - } - else if (menuid == wxApp::s_macPreferencesMenuItemId ) - { - cmd = kHICommandPreferences; - } - - if ( cmd != 0 ) - { - if ( !item->IsEnabled() || wxDialog::OSXHasModalDialogsOpen() ) - DisableMenuCommand( NULL , cmd ) ; - else - EnableMenuCommand( NULL , cmd ) ; - - } -#endif - } return processed; } @@ -515,7 +492,7 @@ void wxMenu::HandleMenuItemHighlighted( wxMenuItem* item ) { int menuid = item ? item->GetId() : 0; wxMenuEvent wxevent(wxEVT_MENU_HIGHLIGHT, menuid, this); - DoHandleMenuEvent( wxevent ); + ProcessMenuEvent(this, wxevent, GetWindow()); } void wxMenu::DoHandleMenuOpenedOrClosed(wxEventType evtType) @@ -526,7 +503,7 @@ void wxMenu::DoHandleMenuOpenedOrClosed(wxEventType evtType) // Set the id to allow wxMenuEvent::IsPopup() to work correctly. int menuid = this == wxCurrentPopupMenu ? wxID_ANY : 0; wxMenuEvent wxevent(evtType, menuid, this); - DoHandleMenuEvent( wxevent ); + ProcessMenuEvent(this, wxevent, GetWindow()); } void wxMenu::HandleMenuOpened() @@ -539,26 +516,6 @@ void wxMenu::HandleMenuClosed() DoHandleMenuOpenedOrClosed(wxEVT_MENU_CLOSE); } -bool wxMenu::DoHandleMenuEvent(wxEvent& wxevent) -{ - wxevent.SetEventObject(this); - wxEvtHandler* handler = GetEventHandler(); - if (handler && handler->ProcessEvent(wxevent)) - { - return true; - } - else - { - wxWindow *win = GetWindow(); - if (win) - { - if ( win->HandleWindowEvent(wxevent) ) - return true; - } - } - return false; -} - // Menu Bar /* @@ -584,8 +541,6 @@ bool wxMenuBar::s_macAutoWindowMenu = true ; WXHMENU wxMenuBar::s_macWindowMenuHandle = NULL ; -wxMenu* emptyMenuBar = NULL; - const int firstMenuPos = 1; // to account for the 0th application menu on mac static wxMenu *CreateAppleMenu() @@ -607,7 +562,6 @@ static wxMenu *CreateAppleMenu() appleMenu->AppendSeparator(); } -#if !wxOSX_USE_CARBON if ( wxApp::s_macPreferencesMenuItemId != wxID_NONE ) { appleMenu->Append( wxApp::s_macPreferencesMenuItemId, @@ -630,17 +584,16 @@ static wxMenu *CreateAppleMenu() wxString quitLabel; quitLabel = wxString::Format(_("Quit %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application")); appleMenu->Append( wxApp::s_macExitMenuItemId, quitLabel + "\tCtrl+Q" ); -#endif // !wxOSX_USE_CARBON return appleMenu; } void wxMenuBar::Init() { - if ( emptyMenuBar == NULL ) + if ( !gs_emptyMenuBar ) { - emptyMenuBar = new wxMenu(); - emptyMenuBar->AppendSubMenu(CreateAppleMenu(), "\x14") ; + gs_emptyMenuBar.reset( new wxMenu() ); + gs_emptyMenuBar->AppendSubMenu(CreateAppleMenu(), "\x14") ; } m_eventHandler = this; @@ -680,11 +633,7 @@ wxMenuBar::~wxMenuBar() if (s_macCommonMenuBar == this) s_macCommonMenuBar = NULL; - if (s_macInstalledMenuBar == this) - { - emptyMenuBar->GetPeer()->MakeRoot(); - s_macInstalledMenuBar = NULL; - } + MacUninstallMenuBar(); wxDELETE( m_rootMenu ); // apple menu is a submenu, therefore we don't have to delete it m_appleMenu = NULL; @@ -699,6 +648,15 @@ void wxMenuBar::Refresh(bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(r wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") ); } +void wxMenuBar::MacUninstallMenuBar() +{ + if (s_macInstalledMenuBar == this) + { + gs_emptyMenuBar->GetPeer()->MakeRoot(); + s_macInstalledMenuBar = NULL; + } +} + void wxMenuBar::MacInstallMenuBar() { if ( s_macInstalledMenuBar == this ) @@ -1021,4 +979,34 @@ void wxMenuBar::Attach(wxFrame *frame) wxMenuBarBase::Attach( frame ) ; } +void wxMenuBar::DoGetPosition(int *x, int *y) const +{ + int _x,_y,_width,_height; + + m_rootMenu->GetPeer()->GetMenuBarDimensions(_x, _y, _width, _height); + + if (x) + *x = _x; + if (y) + *y = _y; +} + +void wxMenuBar::DoGetSize(int *width, int *height) const +{ + int _x,_y,_width,_height; + + m_rootMenu->GetPeer()->GetMenuBarDimensions(_x, _y, _width, _height); + + if (width) + *width = _width; + if (height) + *height = _height; +} + +void wxMenuBar::DoGetClientSize(int *width, int *height) const +{ + DoGetSize(width, height); +} + + #endif // wxUSE_MENUS diff --git a/Externals/wxWidgets3/src/osx/menuitem_osx.cpp b/Externals/wxWidgets3/src/osx/menuitem_osx.cpp index 34a9996173..0d6ba706ba 100644 --- a/Externals/wxWidgets3/src/osx/menuitem_osx.cpp +++ b/Externals/wxWidgets3/src/osx/menuitem_osx.cpp @@ -22,7 +22,7 @@ #include "wx/osx/private.h" -IMPLEMENT_ABSTRACT_CLASS( wxMenuItemImpl , wxObject ) +wxIMPLEMENT_ABSTRACT_CLASS(wxMenuItemImpl, wxObject); wxMenuItemImpl::~wxMenuItemImpl() { @@ -80,9 +80,6 @@ void wxMenuItem::Enable(bool bDoEnable) // avoid changing menuitem state when menu is disabled // eg. BeginAppModalStateForWindow() will disable menus and ignore this change // which in turn causes m_isEnabled to become out of sync with real menuitem state -#if wxOSX_USE_CARBON - && !(m_parentMenu && !IsMenuItemEnabled(MAC_WXHMENU(m_parentMenu->GetHMenu()), 0)) -#endif ) // always update builtin menuitems || ( GetId() == wxApp::s_macPreferencesMenuItemId diff --git a/Externals/wxWidgets3/src/osx/minifram.cpp b/Externals/wxWidgets3/src/osx/minifram.cpp index 0b5e463efd..255a86fc11 100644 --- a/Externals/wxWidgets3/src/osx/minifram.cpp +++ b/Externals/wxWidgets3/src/osx/minifram.cpp @@ -14,6 +14,6 @@ #include "wx/minifram.h" -IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) +wxIMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame); #endif // wxUSE_MINIFRAME diff --git a/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp b/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp index 0e57c7f9f9..dd952320ca 100644 --- a/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp +++ b/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp @@ -91,7 +91,7 @@ void wxNonOwnedWindowImpl::Associate( WXWindow window, wxNonOwnedWindowImpl *imp // wxNonOwnedWindow creation // ---------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS( wxNonOwnedWindowImpl , wxObject ) +wxIMPLEMENT_ABSTRACT_CLASS(wxNonOwnedWindowImpl, wxObject); wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = NULL; @@ -232,14 +232,6 @@ bool wxNonOwnedWindow::OSXShowWithEffect(bool show, wxShowEffect effect, unsigned timeout) { - // Cocoa code needs to manage window visibility on its own and so calls - // wxWindow::Show() as needed but if we already changed the internal - // visibility flag here, Show() would do nothing, so avoid doing it -#if wxOSX_USE_CARBON - if ( !wxWindow::Show(show) ) - return false; -#endif // Carbon - if ( effect == wxSHOW_EFFECT_NONE || !m_nowpeer || !m_nowpeer->ShowWithEffect(show, effect, timeout) ) return Show(show); @@ -552,4 +544,12 @@ bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path) return DoSetRegionShape(wxRegion(bmp)); } +void +wxNonOwnedWindow::OSXHandleMiniaturize(double WXUNUSED(timestampsec), + bool miniaturized) +{ + if ( wxTopLevelWindowMac* top = (wxTopLevelWindowMac*) MacGetTopLevelWindow() ) + top->OSXSetIconizeState(miniaturized); +} + #endif // wxUSE_GRAPHICS_CONTEXT diff --git a/Externals/wxWidgets3/src/osx/notebook_osx.cpp b/Externals/wxWidgets3/src/osx/notebook_osx.cpp index 59a329d5e7..29391e583c 100644 --- a/Externals/wxWidgets3/src/osx/notebook_osx.cpp +++ b/Externals/wxWidgets3/src/osx/notebook_osx.cpp @@ -29,13 +29,11 @@ // check that the page index is valid #define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) -BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) - EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange) - +wxBEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase) EVT_SIZE(wxNotebook::OnSize) EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() bool wxNotebook::Create( wxWindow *parent, wxWindowID id, @@ -102,11 +100,15 @@ int wxNotebook::DoSetSelection(size_t nPage, int flags) return m_selection; } //else: program allows the page change - - SendPageChangedEvent(m_selection, nPage); } - ChangePage(m_selection, nPage); + // m_selection is set to newSel in ChangePage() + // so store its value for event use. + int oldSelection = m_selection; + ChangePage(oldSelection, nPage); + + if ( flags & SetSelection_SendEvent ) + SendPageChangedEvent(oldSelection, nPage); } //else: no change @@ -313,16 +315,6 @@ void wxNotebook::OnSize(wxSizeEvent& event) event.Skip(); } -void wxNotebook::OnSelChange(wxBookCtrlEvent& event) -{ - // is it our tab control? - if ( event.GetEventObject() == this ) - ChangePage(event.GetOldSelection(), event.GetSelection()); - - // we want to give others a chance to process this message as well - event.Skip(); -} - void wxNotebook::OnSetFocus(wxFocusEvent& event) { // set focus to the currently selected page if any @@ -465,26 +457,8 @@ bool wxNotebook::OSXHandleClicked( double WXUNUSED(timestampsec) ) SInt32 newSel = GetPeer()->GetValue() - 1 ; if ( newSel != m_selection ) { - wxBookCtrlEvent changing( - wxEVT_NOTEBOOK_PAGE_CHANGING, m_windowId, - newSel , m_selection ); - changing.SetEventObject( this ); - HandleWindowEvent( changing ); - - if ( changing.IsAllowed() ) - { - wxBookCtrlEvent event( - wxEVT_NOTEBOOK_PAGE_CHANGED, m_windowId, - newSel, m_selection ); - event.SetEventObject( this ); - HandleWindowEvent( event ); - - m_selection = newSel; - } - else - { + if ( DoSetSelection(newSel, SetSelection_SendEvent ) != newSel ) GetPeer()->SetValue( m_selection + 1 ) ; - } status = true ; } diff --git a/Externals/wxWidgets3/src/osx/palette.cpp b/Externals/wxWidgets3/src/osx/palette.cpp index ecd9b2da3c..86ced8bca7 100644 --- a/Externals/wxWidgets3/src/osx/palette.cpp +++ b/Externals/wxWidgets3/src/osx/palette.cpp @@ -15,7 +15,7 @@ #include "wx/palette.h" #include "wx/colour.h" -IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject); // ============================================================================ // wxPaletteRefData @@ -28,7 +28,7 @@ public: wxPaletteRefData(const wxPaletteRefData& data); virtual ~wxPaletteRefData(); - virtual bool IsOk() const { return m_count > 0; } + virtual bool IsOk() const wxOVERRIDE { return m_count > 0; } protected: wxColour* m_palette; diff --git a/Externals/wxWidgets3/src/osx/pen.cpp b/Externals/wxWidgets3/src/osx/pen.cpp index 8f95d03efa..b835196261 100644 --- a/Externals/wxWidgets3/src/osx/pen.cpp +++ b/Externals/wxWidgets3/src/osx/pen.cpp @@ -16,7 +16,7 @@ #include "wx/utils.h" #endif -IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject); class WXDLLEXPORT wxPenRefData : public wxGDIRefData { @@ -111,7 +111,6 @@ wxPen::wxPen(const wxColour& col, int Width, wxPenStyle Style) RealizeResource(); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 wxPen::wxPen(const wxColour& col, int Width, int Style) { m_refData = new wxPenRefData; @@ -126,7 +125,6 @@ wxPen::wxPen(const wxColour& col, int Width, int Style) RealizeResource(); } -#endif wxPen::wxPen(const wxBitmap& stipple, int Width) { diff --git a/Externals/wxWidgets3/src/osx/printdlg_osx.cpp b/Externals/wxWidgets3/src/osx/printdlg_osx.cpp index c84039c272..f1db3b82fd 100644 --- a/Externals/wxWidgets3/src/osx/printdlg_osx.cpp +++ b/Externals/wxWidgets3/src/osx/printdlg_osx.cpp @@ -29,7 +29,7 @@ #include "wx/statline.h" -IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase); wxMacPrintDialog::wxMacPrintDialog() { @@ -77,7 +77,7 @@ wxDC *wxMacPrintDialog::GetPrintDC() return new wxPrinterDC( m_printDialogData.GetPrintData() ); } -IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase) +wxIMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase); wxMacPageSetupDialog::wxMacPageSetupDialog( wxWindow *p, wxPageSetupDialogData *data ) : wxPageSetupDialogBase() @@ -104,7 +104,7 @@ wxPageSetupDialogData& wxMacPageSetupDialog::GetPageSetupDialogData() return m_pageSetupData; } -IMPLEMENT_CLASS(wxMacPageMarginsDialog, wxDialog) +wxIMPLEMENT_CLASS(wxMacPageMarginsDialog, wxDialog); wxMacPageMarginsDialog::wxMacPageMarginsDialog(wxFrame *parent, wxPageSetupDialogData *data) : wxDialog(parent, wxID_ANY, wxString(wxT("Page Margins"))), diff --git a/Externals/wxWidgets3/src/osx/radiobox_osx.cpp b/Externals/wxWidgets3/src/osx/radiobox_osx.cpp index 2aba6e193b..4d0e06b92a 100644 --- a/Externals/wxWidgets3/src/osx/radiobox_osx.cpp +++ b/Externals/wxWidgets3/src/osx/radiobox_osx.cpp @@ -25,12 +25,12 @@ // spacing between InterfaceBuild and the Human Interface Guidelines, we stick // to the latter, as those are also used eg in the System Preferences Dialogs -IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); -BEGIN_EVENT_TABLE(wxRadioBox, wxControl) +wxBEGIN_EVENT_TABLE(wxRadioBox, wxControl) EVT_RADIOBUTTON( wxID_ANY , wxRadioBox::OnRadioButton ) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxRadioBox::OnRadioButton( wxCommandEvent &outer ) @@ -363,12 +363,8 @@ void wxRadioBox::SetFocus() // Simulates the effect of the user issuing a command to the item // -#if wxOSX_USE_CARBON - #define RADIO_SIZE 20 -#else - // Cocoa has an additional border are of about 3 pixels - #define RADIO_SIZE 23 -#endif +// Cocoa has an additional border are of about 3 pixels +#define RADIO_SIZE 23 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) { diff --git a/Externals/wxWidgets3/src/osx/scrolbar_osx.cpp b/Externals/wxWidgets3/src/osx/scrolbar_osx.cpp index 3d6d8f2961..6eea3d4802 100644 --- a/Externals/wxWidgets3/src/osx/scrolbar_osx.cpp +++ b/Externals/wxWidgets3/src/osx/scrolbar_osx.cpp @@ -22,8 +22,8 @@ #if wxUSE_SCROLLBAR -BEGIN_EVENT_TABLE(wxScrollBar, wxControl) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxScrollBar, wxControl) +wxEND_EVENT_TABLE() bool wxScrollBar::Create( wxWindow *parent, diff --git a/Externals/wxWidgets3/src/osx/slider_osx.cpp b/Externals/wxWidgets3/src/osx/slider_osx.cpp index 5d658fe181..8a4cad4a1a 100644 --- a/Externals/wxWidgets3/src/osx/slider_osx.cpp +++ b/Externals/wxWidgets3/src/osx/slider_osx.cpp @@ -15,8 +15,8 @@ #include "wx/slider.h" #include "wx/osx/private.h" -BEGIN_EVENT_TABLE(wxSlider, wxControl) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxSlider, wxControl) +wxEND_EVENT_TABLE() // The dimensions of the different styles of sliders (from Aqua document) #if wxOSX_USE_COCOA @@ -475,7 +475,7 @@ void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) } // yet another hack since this is a composite control - // when wxSlider has it's size hardcoded, we're not allowed to + // when wxSlider has its size hardcoded, we're not allowed to // change the size. But when the control has labels, we DO need // to resize the internal Mac control to accommodate the text labels. diff --git a/Externals/wxWidgets3/src/osx/sound_osx.cpp b/Externals/wxWidgets3/src/osx/sound_osx.cpp index 8543b2c06d..84cde6e878 100644 --- a/Externals/wxWidgets3/src/osx/sound_osx.cpp +++ b/Externals/wxWidgets3/src/osx/sound_osx.cpp @@ -20,43 +20,16 @@ #include "wx/string.h" #include "wx/intl.h" #include "wx/log.h" - #include "wx/timer.h" #endif #include "wx/file.h" #include "wx/vector.h" -class wxSoundTimer : public wxTimer -{ -public: - wxSoundTimer(wxSoundData* snd) - : m_sound(snd) - { - } - - virtual ~wxSoundTimer() - { - Stop(); - if (m_sound) - m_sound->DoStop(); - } - - void Notify() - { - if (m_sound) - m_sound->SoundTask(); - } - -protected: - wxSoundData* m_sound; -}; - wxVector s_soundsPlaying; wxSoundData::wxSoundData() { - m_pTimer = NULL; m_markedForDeletion = false; } @@ -72,21 +45,6 @@ void wxSoundData::MarkForDeletion() void wxSoundData::Stop() { DoStop(); - wxDELETE(m_pTimer); -} - -//Time between timer calls -#define MOVIE_DELAY 100 - -void wxSoundData::SoundTask() -{ -} - -void wxSoundData::CreateAndStartTimer() -{ - //Start timer and play movie asyncronously - m_pTimer = new wxSoundTimer(this); - m_pTimer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS); } wxSound::wxSound() diff --git a/Externals/wxWidgets3/src/osx/spinctrl_osx.cpp b/Externals/wxWidgets3/src/osx/spinctrl_osx.cpp deleted file mode 100644 index 7faecf9367..0000000000 --- a/Externals/wxWidgets3/src/osx/spinctrl_osx.cpp +++ /dev/null @@ -1,437 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/spinctrl_osx.cpp -// Purpose: wxSpinCtrl -// Author: Robert -// Modified by: Mark Newsam (Based on GTK file) -// RCS-ID: $Id: spinctrl_osx.cpp 70698 2012-02-26 15:44:04Z JS $ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxUSE_SPINCTRL - -#include "wx/spinctrl.h" - -#ifndef WX_PRECOMP - #include "wx/textctrl.h" - #include "wx/containr.h" -#endif - -#include "wx/spinbutt.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// the focus rect around a text may have 4 pixels in each direction -// we handle these problems right now in an extended vis region of a window -static const wxCoord TEXTBORDER = 4 ; -// the margin between the text control and the spin -// HIG says 2px between text and stepper control, -// but a value of 3 leads to the same look as the -// spin controls in Apple's apps -static const wxCoord MARGIN = 3; - -// ---------------------------------------------------------------------------- -// wxSpinCtrlText: text control used by spin control -// ---------------------------------------------------------------------------- - -class wxSpinCtrlText : public wxTextCtrl -{ -public: - wxSpinCtrlText(wxSpinCtrl *spin, const wxString& value, int style) - : wxTextCtrl(spin , wxID_ANY, value, wxDefaultPosition, wxSize(40, wxDefaultCoord), style ) - { - m_spin = spin; - - // remove the default minsize, the spinctrl will have one instead - SetMinSize(wxDefaultSize); - } - - bool ProcessEvent(wxEvent &event) - { - // Hand button down events to wxSpinCtrl. Doesn't work. - if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event )) - return true; - - return wxTextCtrl::ProcessEvent( event ); - } - -protected: - void OnSetFocus(wxFocusEvent& event) - { - // delegate to parent control - event.SetEventObject( GetParent() ); - GetParent()->HandleWindowEvent(event); - } - - void OnKillFocus(wxFocusEvent& event) - { - long l; - if ( !GetValue().ToLong(&l) ) - { - // not a number at all - return; - } - - // is within range - if (l < m_spin->GetMin()) - l = m_spin->GetMin(); - if (l > m_spin->GetMax()) - l = m_spin->GetMax(); - - // Update text control - wxString str; - str.Printf( wxT("%d"), (int)l ); - if (str != GetValue()) - SetValue( str ); - - if (l != m_spin->m_oldValue) - { - // set value in spin button - // does that trigger an event? - m_spin->m_btn->SetValue( l ); - - // if not - wxCommandEvent cevent(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId()); - cevent.SetEventObject(m_spin); - cevent.SetInt(l); - m_spin->HandleWindowEvent(cevent); - - m_spin->m_oldValue = l; - } - - // delegate to parent control - event.SetEventObject( GetParent() ); - GetParent()->HandleWindowEvent(event); - } - - void OnTextChange(wxCommandEvent& event) - { - int val; - if ( m_spin->GetTextValue(&val) ) - { - m_spin->GetSpinButton()->SetValue(val); - - // If we're already processing a text update from m_spin, - // don't send it again, since we could end up recursing - // infinitely. - if (event.GetId() == m_spin->GetId()) - { - event.Skip(); - return; - } - - // Send event that the text was manually changed - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_spin->GetId()); - event.SetEventObject(m_spin); - event.SetString(m_spin->GetText()->GetValue()); - event.SetInt(val); - - m_spin->HandleWindowEvent(event); - } - - event.Skip(); - } - -private: - wxSpinCtrl *m_spin; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSpinCtrlText, wxTextCtrl) - EVT_TEXT(wxID_ANY, wxSpinCtrlText::OnTextChange) - EVT_SET_FOCUS(wxSpinCtrlText::OnSetFocus) - EVT_KILL_FOCUS(wxSpinCtrlText::OnKillFocus) -END_EVENT_TABLE() - -// ---------------------------------------------------------------------------- -// wxSpinCtrlButton: spin button used by spin control -// ---------------------------------------------------------------------------- - -class wxSpinCtrlButton : public wxSpinButton -{ -public: - wxSpinCtrlButton(wxSpinCtrl *spin, int style) - : wxSpinButton(spin ) - { - m_spin = spin; - SetWindowStyle(style | wxSP_VERTICAL); - - // TODO: The spin button gets truncated a little bit due to size - // differences so change it's default size a bit. SMALL still gets a - // bit truncated, but MINI seems to be too small... Readdress this - // when the textctrl issues are all sorted out. - //SetWindowVariant(wxWINDOW_VARIANT_SMALL); - - // remove the default minsize, the spinctrl will have one instead - SetMinSize(wxDefaultSize); - } - -protected: - void OnSpinButton(wxSpinEvent& eventSpin) - { - int pos = eventSpin.GetPosition(); - m_spin->SetTextValue(pos); - - wxCommandEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, m_spin->GetId()); - event.SetEventObject(m_spin); - event.SetInt(pos); - - m_spin->HandleWindowEvent(event); - - m_spin->m_oldValue = pos; - } - -private: - wxSpinCtrl *m_spin; - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) - EVT_SPIN(wxID_ANY, wxSpinCtrlButton::OnSpinButton) -END_EVENT_TABLE() - -// ============================================================================ -// implementation -// ============================================================================ - -// ---------------------------------------------------------------------------- -// wxSpinCtrl creation -// ---------------------------------------------------------------------------- - -void wxSpinCtrl::Init() -{ - m_text = NULL; - m_btn = NULL; -} - -bool wxSpinCtrl::Create(wxWindow *parent, - wxWindowID id, - const wxString& value, - const wxPoint& pos, - const wxSize& size, - long style, - int min, - int max, - int initial, - const wxString& name) -{ - if ( !wxControl::Create(parent, id, pos, size, style, - wxDefaultValidator, name) ) - { - return false; - } - - // the string value overrides the numeric one (for backwards compatibility - // reasons and also because it is simpler to satisfy the string value which - // comes much sooner in the list of arguments and leave the initial - // parameter unspecified) - if ( !value.empty() ) - { - long l; - if ( value.ToLong(&l) ) - initial = l; - } - - wxSize csize = size ; - m_text = new wxSpinCtrlText(this, value, style & ( wxTE_PROCESS_ENTER | wxALIGN_MASK ) ); - m_btn = new wxSpinCtrlButton(this, style); - - m_btn->SetRange(min, max); - m_btn->SetValue(initial); - // make it different - m_oldValue = GetMin()-1; - - if ( size.x == wxDefaultCoord ){ - csize.x = m_text->GetSize().x + MARGIN + m_btn->GetSize().x ; - } - - if ( size.y == wxDefaultCoord ) { - csize.y = m_text->GetSize().y + 2 * TEXTBORDER ; //allow for text border highlights - if ( m_btn->GetSize().y > csize.y ) - csize.y = m_btn->GetSize().y ; - } - - //SetSize(csize); - - //MacPostControlCreate(pos, csize); - SetInitialSize(csize); - - return true; -} - -wxSpinCtrl::~wxSpinCtrl() -{ - // delete the controls now, don't leave them alive even though they would - // still be eventually deleted by our parent - but it will be too late, the - // user code expects them to be gone now - wxDELETE(m_text); - wxDELETE(m_btn); -} - -// ---------------------------------------------------------------------------- -// geometry -// ---------------------------------------------------------------------------- - -wxSize wxSpinCtrl::DoGetBestSize() const -{ - if (!m_btn || !m_text) - return GetSize(); - - wxSize sizeBtn = m_btn->GetBestSize(), - sizeText = m_text->GetBestSize(); - - sizeText.y += 2 * TEXTBORDER ; - sizeText.x += 2 * TEXTBORDER ; - - int height; - if (sizeText.y > sizeBtn.y) - height = sizeText.y; - else - height = sizeBtn.y; - - return wxSize(sizeBtn.x + sizeText.x + MARGIN, height ); -} - -void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) -{ - // position the subcontrols inside the client area - wxSize sizeBtn = m_btn->GetSize(); - wxSize sizeText = m_text->GetSize(); - - wxControl::DoMoveWindow(x, y, width, height); - - wxCoord wText = width - sizeBtn.x - MARGIN - 2 * TEXTBORDER; - - m_text->SetSize(TEXTBORDER, (height - sizeText.y) / 2, wText, -1); - m_btn->SetSize(0 + wText + MARGIN + TEXTBORDER , (height - sizeBtn.y) / 2 , -1, -1 ); -} - -// ---------------------------------------------------------------------------- -// operations forwarded to the subcontrols -// ---------------------------------------------------------------------------- - -bool wxSpinCtrl::Enable(bool enable) -{ - if ( !wxControl::Enable(enable) ) - return false; - m_text->Enable(enable); - m_btn->Enable(enable); - return true; -} - -bool wxSpinCtrl::Show(bool show) -{ - if ( !wxControl::Show(show) ) - return false; - return true; -} - -// ---------------------------------------------------------------------------- -// value and range access -// ---------------------------------------------------------------------------- - -bool wxSpinCtrl::GetTextValue(int *val) const -{ - long l; - if ( !m_text->GetValue().ToLong(&l) ) - { - // not a number at all - return false; - } - - if ( l < GetMin() || l > GetMax() ) - { - // out of range - return false; - } - - *val = l; - - return true; -} - -int wxSpinCtrl::GetValue() const -{ - return m_btn ? m_btn->GetValue() : 0; -} - -int wxSpinCtrl::GetMin() const -{ - return m_btn ? m_btn->GetMin() : 0; -} - -int wxSpinCtrl::GetMax() const -{ - return m_btn ? m_btn->GetMax() : 0; -} - -// ---------------------------------------------------------------------------- -// changing value and range -// ---------------------------------------------------------------------------- - -void wxSpinCtrl::SetTextValue(int val) -{ - wxCHECK_RET( m_text, wxT("invalid call to wxSpinCtrl::SetTextValue") ); - - m_text->SetValue(wxString::Format(wxT("%d"), val)); - - // select all text - m_text->SetSelection(0, -1); - - m_text->SetInsertionPointEnd(); - - // and give focus to the control! - // m_text->SetFocus(); Why???? TODO. -} - -void wxSpinCtrl::SetValue(int val) -{ - wxCHECK_RET( m_btn, wxT("invalid call to wxSpinCtrl::SetValue") ); - - SetTextValue(val); - - m_btn->SetValue(val); - m_oldValue = val; -} - -void wxSpinCtrl::SetValue(const wxString& text) -{ - wxCHECK_RET( m_text, wxT("invalid call to wxSpinCtrl::SetValue") ); - - long val; - if ( text.ToLong(&val) && ((val > INT_MIN) && (val < INT_MAX)) ) - { - SetValue((int)val); - } - else // not a number at all or out of range - { - m_text->SetValue(text); - m_text->SetSelection(0, -1); - } -} - -void wxSpinCtrl::SetRange(int min, int max) -{ - wxCHECK_RET( m_btn, wxT("invalid call to wxSpinCtrl::SetRange") ); - - m_btn->SetRange(min, max); -} - -void wxSpinCtrl::SetSelection(long from, long to) -{ - // if from and to are both -1, it means (in wxWidgets) that all text should - // be selected - if ( (from == -1) && (to == -1) ) - { - from = 0; - } - m_text->SetSelection(from, to); -} - -#endif // wxUSE_SPINCTRL diff --git a/Externals/wxWidgets3/src/osx/srchctrl_osx.cpp b/Externals/wxWidgets3/src/osx/srchctrl_osx.cpp index 00d96f1585..928bb9340e 100644 --- a/Externals/wxWidgets3/src/osx/srchctrl_osx.cpp +++ b/Externals/wxWidgets3/src/osx/srchctrl_osx.cpp @@ -26,10 +26,10 @@ #include "wx/osx/private.h" -BEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxSearchCtrl, wxSearchCtrlBase) +wxEND_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase) +wxIMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase); #endif // wxUSE_NATIVE_SEARCH_CONTROL @@ -62,7 +62,9 @@ wxSearchCtrl::wxSearchCtrl(wxWindow *parent, wxWindowID id, void wxSearchCtrl::Init() { +#if wxUSE_MENUS m_menu = 0; +#endif } wxSearchWidgetImpl* wxSearchCtrl::GetSearchPeer() const @@ -72,7 +74,9 @@ wxSearchWidgetImpl* wxSearchCtrl::GetSearchPeer() const wxSearchCtrl::~wxSearchCtrl() { +#if wxUSE_MENUS delete m_menu; +#endif } wxSize wxSearchCtrl::DoGetBestSize() const @@ -85,6 +89,7 @@ wxSize wxSearchCtrl::DoGetBestSize() const return size; } +#if wxUSE_MENUS // search control specific interfaces // wxSearchCtrl owns menu after this call @@ -117,6 +122,8 @@ wxMenu* wxSearchCtrl::GetMenu() return m_menu; } +#endif // wxUSE_MENUS + void wxSearchCtrl::ShowSearchButton( bool show ) { if ( IsSearchButtonVisible() == show ) diff --git a/Externals/wxWidgets3/src/osx/stattext_osx.cpp b/Externals/wxWidgets3/src/osx/stattext_osx.cpp index a9de6772c1..5a291af9f9 100644 --- a/Externals/wxWidgets3/src/osx/stattext_osx.cpp +++ b/Externals/wxWidgets3/src/osx/stattext_osx.cpp @@ -50,7 +50,6 @@ bool wxStaticText::Create( wxWindow *parent, // Normally this is done in SetLabel() below but we avoid doing it when // this style is used, so we need to explicitly do it in the ctor in // this case or otherwise the control would retain its initial tiny size. - InvalidateBestSize(); SetInitialSize(size); } @@ -76,10 +75,11 @@ void wxStaticText::SetLabel(const wxString& label) DoSetLabel(GetEllipsizedLabel()); } + InvalidateBestSize(); + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) && !IsEllipsized() ) // don't resize if we adjust to current size { - InvalidateBestSize(); SetSize( GetBestSize() ); } diff --git a/Externals/wxWidgets3/src/osx/textctrl_osx.cpp b/Externals/wxWidgets3/src/osx/textctrl_osx.cpp index 08346e5adb..9241897c18 100644 --- a/Externals/wxWidgets3/src/osx/textctrl_osx.cpp +++ b/Externals/wxWidgets3/src/osx/textctrl_osx.cpp @@ -47,7 +47,7 @@ #include "wx/osx/private.h" -BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) +wxBEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_CHAR(wxTextCtrl::OnChar) EVT_KEY_DOWN(wxTextCtrl::OnKeyDown) @@ -68,7 +68,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete) EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() void wxTextCtrl::Init() @@ -103,14 +103,6 @@ bool wxTextCtrl::Create( wxWindow *parent, if ( !wxTextCtrlBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) ) return false; - if ( m_windowStyle & wxTE_MULTILINE ) - { - // always turn on this style for multi-line controls - m_windowStyle |= wxTE_PROCESS_ENTER; - style |= wxTE_PROCESS_ENTER ; - } - - SetPeer(wxWidgetImpl::CreateTextControl( this, GetParent(), GetId(), str, pos, size, style, GetExtraStyle() )); MacPostControlCreate(pos, size) ; @@ -136,16 +128,10 @@ bool wxTextCtrl::Create( wxWindow *parent, void wxTextCtrl::MacSuperChangedPosition() { wxWindow::MacSuperChangedPosition() ; -#if wxOSX_USE_CARBON - GetPeer()->SuperChangedPosition() ; -#endif } void wxTextCtrl::MacVisibilityChanged() { -#if wxOSX_USE_CARBON - GetPeer()->VisibilityChanged( GetPeer()->IsVisible() ); -#endif } void wxTextCtrl::MacCheckSpelling(bool check) @@ -366,8 +352,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) bool eat_key = false ; long from, to; - if ( !IsEditable() && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) && - !( key == WXK_RETURN && ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) ) + if ( !IsEditable() && + !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) && + !( (key == WXK_RETURN || key == WXK_NUMPAD_ENTER) && + ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) ) // && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END ) { @@ -382,7 +370,8 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) GetSelection( &from, &to ); if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) && - !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) && + !( (key == WXK_RETURN || key == WXK_NUMPAD_ENTER) && + (m_windowStyle & wxTE_PROCESS_ENTER) ) && from == to ) { // eat it, we don't want to add more than allowed # of characters @@ -398,6 +387,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) switch ( key ) { case WXK_RETURN: + case WXK_NUMPAD_ENTER: if (m_windowStyle & wxTE_PROCESS_ENTER) { wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); @@ -461,18 +451,6 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) } // osx_cocoa sends its event upon insertText -#if wxOSX_USE_CARBON - if ( ( key >= 0x20 && key < WXK_START ) || - ( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) || - key == WXK_RETURN || - key == WXK_DELETE || - key == WXK_BACK) - { - wxCommandEvent event1(wxEVT_TEXT, m_windowId); - event1.SetEventObject( this ); - wxPostEvent( GetEventHandler(), event1 ); - } -#endif } void wxTextCtrl::Command(wxCommandEvent & event) diff --git a/Externals/wxWidgets3/src/osx/textentry_osx.cpp b/Externals/wxWidgets3/src/osx/textentry_osx.cpp index 8a1466ba83..54421bb598 100644 --- a/Externals/wxWidgets3/src/osx/textentry_osx.cpp +++ b/Externals/wxWidgets3/src/osx/textentry_osx.cpp @@ -81,6 +81,23 @@ void wxTextEntry::SetMaxLength(unsigned long len) m_maxLength = len ; } +void wxTextEntry::ForceUpper() +{ + wxTextWidgetImpl* const textPeer = GetTextPeer(); + + wxCHECK_RET( textPeer, "Must create the control first" ); + + if ( textPeer->CanForceUpper() ) + { + ConvertToUpperCase(); + textPeer->ForceUpper(); + } + else + { + wxTextEntryBase::ForceUpper(); + } +} + // Clipboard operations void wxTextEntry::Copy() diff --git a/Externals/wxWidgets3/src/osx/tglbtn_osx.cpp b/Externals/wxWidgets3/src/osx/tglbtn_osx.cpp index f1ba9cd00e..9d1c5568fb 100644 --- a/Externals/wxWidgets3/src/osx/tglbtn_osx.cpp +++ b/Externals/wxWidgets3/src/osx/tglbtn_osx.cpp @@ -29,7 +29,7 @@ // macros // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl); wxDEFINE_EVENT( wxEVT_TOGGLEBUTTON, wxCommandEvent ); // ============================================================================ @@ -104,7 +104,7 @@ bool wxToggleButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) // wxBitmapToggleButton // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton) +wxIMPLEMENT_DYNAMIC_CLASS(wxBitmapToggleButton, wxToggleButton); bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& label, diff --git a/Externals/wxWidgets3/src/osx/toolbar_osx.cpp b/Externals/wxWidgets3/src/osx/toolbar_osx.cpp index 502e1f4573..ff00eddbac 100644 --- a/Externals/wxWidgets3/src/osx/toolbar_osx.cpp +++ b/Externals/wxWidgets3/src/osx/toolbar_osx.cpp @@ -23,7 +23,7 @@ #include "wx/geometry.h" #include "wx/sysopt.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) +wxIMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl); bool wxToolBar::Destroy() { diff --git a/Externals/wxWidgets3/src/osx/toplevel_osx.cpp b/Externals/wxWidgets3/src/osx/toplevel_osx.cpp index b0dc820904..29dbb99b3c 100644 --- a/Externals/wxWidgets3/src/osx/toplevel_osx.cpp +++ b/Externals/wxWidgets3/src/osx/toplevel_osx.cpp @@ -50,8 +50,8 @@ // wxTopLevelWindowMac implementation // ============================================================================ -BEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase) +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- // wxTopLevelWindowMac creation @@ -99,12 +99,6 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac() bool wxTopLevelWindowMac::Destroy() { - // NB: this will get called during destruction if we don't do it now, - // and may fire a kill focus event on a control being destroyed -#if wxOSX_USE_CARBON - if (m_nowpeer && m_nowpeer->GetWXWindow()) - ClearKeyboardFocus( (WindowRef)m_nowpeer->GetWXWindow() ); -#endif // delayed destruction: the tlw will be deleted during the next idle // loop iteration if ( !wxPendingDelete.Member(this) ) @@ -190,6 +184,11 @@ void wxTopLevelWindowMac::ShowWithoutActivating() SendSizeEvent(); } +bool wxTopLevelWindowMac::EnableFullScreenView(bool enable) +{ + return m_nowpeer->EnableFullScreenView(enable); +} + bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) { return m_nowpeer->ShowFullScreen(show, style); @@ -200,6 +199,33 @@ bool wxTopLevelWindowMac::IsFullScreen() const return m_nowpeer->IsFullScreen(); } +bool wxTopLevelWindowMac::EnableCloseButton(bool enable) +{ + // Unlike in wxMSW, wxSYSTEM_MENU is not sufficient to show + // a close button unless combined with one of the resize buttons. + if ( HasFlag(wxCLOSE_BOX) ) + return m_nowpeer->EnableCloseButton( enable); + + return false; +} + +bool wxTopLevelWindowMac::EnableMaximizeButton(bool enable) +{ + // Both wxRESIZE_BORDER and wxMAXIMIZE_BOX create a resize border and + // add a maximize button. + if ( HasFlag(wxMAXIMIZE_BOX) || HasFlag(wxRESIZE_BORDER) ) + return m_nowpeer->EnableMaximizeButton( enable); + return false; +} + +bool wxTopLevelWindowMac::EnableMinimizeButton(bool enable) +{ + if ( HasFlag(wxMINIMIZE_BOX) ) + return m_nowpeer->EnableMinimizeButton( enable); + + return false; +} + void wxTopLevelWindowMac::RequestUserAttention(int flags) { return m_nowpeer->RequestUserAttention(flags); @@ -224,3 +250,12 @@ void wxTopLevelWindowMac::SetRepresentedFilename(const wxString& filename) { m_nowpeer->SetRepresentedFilename(filename); } + +void wxTopLevelWindowMac::OSXSetIconizeState(bool iconize) +{ + if ( iconize != m_iconized ) + { + m_iconized = iconize; + (void)SendIconizeEvent(iconize); + } +} diff --git a/Externals/wxWidgets3/src/osx/uiaction_osx.cpp b/Externals/wxWidgets3/src/osx/uiaction_osx.cpp index c916923a3f..78112ef07e 100644 --- a/Externals/wxWidgets3/src/osx/uiaction_osx.cpp +++ b/Externals/wxWidgets3/src/osx/uiaction_osx.cpp @@ -46,7 +46,7 @@ CGEventType CGEventTypeForMouseButton(int button, bool isDown) // want to check for invalid parameters so assert first default: wxFAIL_MSG("Unsupported button passed in."); - // fall back to the only known remaining case + wxFALLTHROUGH;// fall back to the only known remaining case case wxMOUSE_BTN_MIDDLE: return isDown ? kCGEventOtherMouseDown : kCGEventOtherMouseUp; @@ -69,7 +69,7 @@ CGEventType CGEventTypeForMouseDrag(int button) // want to check for invalid parameters so assert first default: wxFAIL_MSG("Unsupported button passed in."); - // fall back to the only known remaining case + wxFALLTHROUGH;// fall back to the only known remaining case case wxMOUSE_BTN_MIDDLE: return kCGEventOtherMouseDragged; @@ -92,7 +92,7 @@ CGMouseButton CGButtonForMouseButton(int button) // want to check for invalid parameters so assert first default: wxFAIL_MSG("Unsupported button passed in."); - // fall back to the only known remaining case + wxFALLTHROUGH;// fall back to the only known remaining case case wxMOUSE_BTN_MIDDLE: return kCGMouseButtonCenter; diff --git a/Externals/wxWidgets3/src/osx/utils_osx.cpp b/Externals/wxWidgets3/src/osx/utils_osx.cpp index bfcf65f57c..bed8b7691d 100644 --- a/Externals/wxWidgets3/src/osx/utils_osx.cpp +++ b/Externals/wxWidgets3/src/osx/utils_osx.cpp @@ -36,6 +36,10 @@ #include +#if wxUSE_GUI + #include "wx/private/launchbrowser.h" +#endif + #include "wx/osx/private.h" #include "wx/osx/private/timer.h" @@ -71,31 +75,21 @@ int wxDisplayDepth() { int theDepth = 0; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - if ( UMAGetSystemVersion() >= 0x1060 ) - { - CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); - CFStringRef encoding = CGDisplayModeCopyPixelEncoding(currentMode); - - if(CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 32; - else if(CFStringCompare(encoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 16; - else if(CFStringCompare(encoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 8; - else - theDepth = 32; // some reasonable default + CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); + CFStringRef encoding = CGDisplayModeCopyPixelEncoding(currentMode); - CFRelease(encoding); - CGDisplayModeRelease(currentMode); - } + if(CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 32; + else if(CFStringCompare(encoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 16; + else if(CFStringCompare(encoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 8; else -#endif - { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - theDepth = (int) CGDisplayBitsPerPixel(CGMainDisplayID()); -#endif - } + theDepth = 32; // some reasonable default + + CFRelease(encoding); + CGDisplayModeRelease(currentMode); + return theDepth; } @@ -140,11 +134,10 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) // Launch default browser // ---------------------------------------------------------------------------- -bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { - wxUnusedVar(flags); wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault, - wxCFStringRef( url ), NULL ) ); + wxCFStringRef( params.url ), NULL ) ); OSStatus err = LSOpenCFURLRef( curl , NULL ); if (err == noErr) @@ -176,10 +169,12 @@ void wxDisplaySizeMM(int *width, int *height) } -wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const +wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, + int *verMin, + int *verMicro) const { // We suppose that toolkit version is the same as OS version under Mac - wxGetOsVersion(verMaj, verMin); + wxGetOsVersion(verMaj, verMin, verMicro); return wxPORT_OSX; } @@ -193,26 +188,7 @@ wxWindow* wxFindWindowAtPoint(wxWindow* win, const wxPoint& pt); wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { -#if wxOSX_USE_CARBON - - Point screenPoint = { pt.y , pt.x }; - WindowRef windowRef; - - if ( FindWindow( screenPoint , &windowRef ) ) - { - wxNonOwnedWindow *nonOwned = wxNonOwnedWindow::GetFromWXWindow( windowRef ); - - if ( nonOwned ) - return wxFindWindowAtPoint( nonOwned , pt ); - } - - return NULL; - -#else - return wxGenericFindWindowAtPoint( pt ); - -#endif } /* @@ -274,7 +250,7 @@ CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) void wxMacStringToPascal( const wxString&from , unsigned char * to ) { wxCharBuffer buf = from.mb_str( wxConvLocal ); - int len = strlen(buf); + size_t len = buf.length(); if ( len > 255 ) len = 255; diff --git a/Externals/wxWidgets3/src/osx/webview_webkit.mm b/Externals/wxWidgets3/src/osx/webview_webkit.mm index ab7586544f..434c9a806f 100644 --- a/Externals/wxWidgets3/src/osx/webview_webkit.mm +++ b/Externals/wxWidgets3/src/osx/webview_webkit.mm @@ -13,8 +13,7 @@ #include "wx/osx/webview_webkit.h" -#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && (defined(__WXOSX_COCOA__) \ - || defined(__WXOSX_CARBON__)) +#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXOSX__) // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -24,16 +23,22 @@ #endif #include "wx/osx/private.h" -#include "wx/cocoa/string.h" +#include "wx/osx/core/cfref.h" + #include "wx/hashmap.h" #include "wx/filesys.h" +#if wxOSX_USE_IPHONE +#include +#else #include #include #include - +#endif #include +// using native types to get compile errors and warnings + #define DEBUG_WEBKIT_SIZING 0 // ---------------------------------------------------------------------------- @@ -42,261 +47,15 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); -BEGIN_EVENT_TABLE(wxWebViewWebKit, wxControl) -#if defined(__WXMAC__) && wxOSX_USE_CARBON - EVT_SIZE(wxWebViewWebKit::OnSize) -#endif -END_EVENT_TABLE() - -#if defined(__WXOSX__) && wxOSX_USE_CARBON - -// ---------------------------------------------------------------------------- -// Carbon Events handlers -// ---------------------------------------------------------------------------- - -// prototype for function in src/osx/carbon/nonownedwnd.cpp -void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ); - -static const EventTypeSpec eventList[] = -{ - //{ kEventClassControl, kEventControlTrack } , - { kEventClassMouse, kEventMouseUp }, - { kEventClassMouse, kEventMouseDown }, - { kEventClassMouse, kEventMouseMoved }, - { kEventClassMouse, kEventMouseDragged }, - - { kEventClassKeyboard, kEventRawKeyDown } , - { kEventClassKeyboard, kEventRawKeyRepeat } , - { kEventClassKeyboard, kEventRawKeyUp } , - { kEventClassKeyboard, kEventRawKeyModifiersChanged } , - - { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , - { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } , - -#if DEBUG_WEBKIT_SIZING == 1 - { kEventClassControl, kEventControlBoundsChanged } , -#endif -}; - -// mix this in from window.cpp -pascal OSStatus wxMacUnicodeTextEventHandler(EventHandlerCallRef handler, - EventRef event, void *data) ; - -// NOTE: This is mostly taken from KeyboardEventHandler in toplevel.cpp, but -// that expects the data pointer is a top-level window, so I needed to change -// that in this case. However, once 2.8 is out, we should factor out the common -// logic among the two functions and merge them. -static pascal OSStatus wxWebKitKeyEventHandler(EventHandlerCallRef handler, - EventRef event, void *data) -{ - OSStatus result = eventNotHandledErr ; - wxMacCarbonEvent cEvent( event ) ; - - wxWebViewWebKit* thisWindow = (wxWebViewWebKit*) data ; - wxWindow* focus = thisWindow ; - - unsigned char charCode ; - wxChar uniChar[2] ; - uniChar[0] = 0; - uniChar[1] = 0; - - UInt32 keyCode ; - UInt32 modifiers ; - UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - -#if wxUSE_UNICODE - ByteCount dataSize = 0 ; - if ( GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText, - NULL, 0 , &dataSize, NULL ) == noErr) - { - UniChar buf[2] ; - int numChars = dataSize / sizeof( UniChar) + 1; - - UniChar* charBuf = buf ; - - if ( numChars * 2 > 4 ) - charBuf = new UniChar[ numChars ] ; - GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText, NULL, - dataSize , NULL , charBuf) ; - charBuf[ numChars - 1 ] = 0; - -#if SIZEOF_WCHAR_T == 2 - uniChar = charBuf[0] ; -#else - wxMBConvUTF16 converter ; - converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ; -#endif - - if ( numChars * 2 > 4 ) - delete[] charBuf ; - } -#endif - - GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, - 1, NULL, &charCode ); - GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, - sizeof(UInt32), NULL, &keyCode ); - GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, - sizeof(UInt32), NULL, &modifiers ); - - UInt32 message = (keyCode << 8) + charCode; - switch ( GetEventKind( event ) ) - { - case kEventRawKeyRepeat : - case kEventRawKeyDown : - { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; - WXEVENTHANDLERCALLREF formerHandler = - wxTheApp->MacGetCurrentEventHandlerCallRef() ; - - wxTheApp->MacSetCurrentEvent( event , handler ) ; - if ( /* focus && */ wxTheApp->MacSendKeyDownEvent( - focus, message, modifiers, when, uniChar[0])) - { - result = noErr ; - } - wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; - } - break ; - - case kEventRawKeyUp : - if ( /* focus && */ wxTheApp->MacSendKeyUpEvent( - focus , message , modifiers , when , uniChar[0] ) ) - { - result = noErr ; - } - break ; - - case kEventRawKeyModifiersChanged : - { - wxKeyEvent event(wxEVT_KEY_DOWN); - - event.m_shiftDown = modifiers & shiftKey; - event.m_controlDown = modifiers & controlKey; - event.m_altDown = modifiers & optionKey; - event.m_metaDown = modifiers & cmdKey; - -#if wxUSE_UNICODE - event.m_uniChar = uniChar[0] ; -#endif - - event.SetTimestamp(when); - event.SetEventObject(focus); - - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & controlKey ) - { - event.m_keyCode = WXK_CONTROL ; - event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->GetEventHandler()->ProcessEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & shiftKey ) - { - event.m_keyCode = WXK_SHIFT ; - event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->GetEventHandler()->ProcessEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & optionKey ) - { - event.m_keyCode = WXK_ALT ; - event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->GetEventHandler()->ProcessEvent( event ) ; - } - if ( /* focus && */ (modifiers ^ wxApp::s_lastModifiers ) & cmdKey ) - { - event.m_keyCode = WXK_COMMAND ; - event.SetEventType( ( modifiers & cmdKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ; - focus->GetEventHandler()->ProcessEvent( event ) ; - } - - wxApp::s_lastModifiers = modifiers ; - } - break ; - - default: - break; - } - - return result ; -} - -static pascal OSStatus wxWebViewWebKitEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) -{ - OSStatus result = eventNotHandledErr ; - - wxMacCarbonEvent cEvent( event ) ; - - ControlRef controlRef ; - wxWebViewWebKit* thisWindow = (wxWebViewWebKit*) data ; - wxNonOwnedWindow* tlw = NULL; - if (thisWindow) - tlw = thisWindow->MacGetTopLevelWindow(); - - cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ; - - wxWindow* currentMouseWindow = thisWindow ; - - if ( wxApp::s_captureWindow ) - currentMouseWindow = wxApp::s_captureWindow; - - switch ( GetEventClass( event ) ) - { - case kEventClassKeyboard: - { - result = wxWebKitKeyEventHandler(handler, event, data); - break; - } - - case kEventClassTextInput: - { - result = wxMacUnicodeTextEventHandler(handler, event, data); - break; - } - - case kEventClassMouse: - { - switch ( GetEventKind( event ) ) - { - case kEventMouseDragged : - case kEventMouseMoved : - case kEventMouseDown : - case kEventMouseUp : - { - wxMouseEvent wxevent(wxEVT_LEFT_DOWN); - SetupMouseEvent( wxevent , cEvent ) ; - - currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ; - wxevent.SetEventObject( currentMouseWindow ) ; - wxevent.SetId( currentMouseWindow->GetId() ) ; - - if ( currentMouseWindow->GetEventHandler()->ProcessEvent(wxevent) ) - { - result = noErr; - } - - break; // this should enable WebKit to fire mouse dragged and mouse up events... - } - default : - break ; - } - } - default: - break; - } - - result = CallNextEventHandler(handler, event); - return result ; -} - -DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebViewWebKitEventHandler ) - -#endif +wxBEGIN_EVENT_TABLE(wxWebViewWebKit, wxControl) +wxEND_EVENT_TABLE() @interface WebViewLoadDelegate : NSObject { wxWebViewWebKit* webKitWindow; } -- initWithWxWindow: (wxWebViewWebKit*)inWindow; +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow; @end @@ -305,7 +64,7 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebViewWebKitEventHandler ) wxWebViewWebKit* webKitWindow; } -- initWithWxWindow: (wxWebViewWebKit*)inWindow; +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow; @end @@ -314,7 +73,7 @@ DEFINE_ONE_SHOT_HANDLER_GETTER( wxWebViewWebKitEventHandler ) wxWebViewWebKit* webKitWindow; } -- initWithWxWindow: (wxWebViewWebKit*)inWindow; +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow; @end @@ -340,23 +99,17 @@ bool wxWebViewWebKit::Create(wxWindow *parent, const wxString& name) { m_busy = false; + m_nextNavigationIsNewWindow = false; DontCreatePeer(); wxControl::Create(parent, winID, pos, size, style, wxDefaultValidator, name); -#if wxOSX_USE_CARBON - wxMacControl* peer = new wxMacControl(this); - WebInitForCarbon(); - HIWebViewCreate( peer->GetControlRefAddr() ); +#if wxOSX_USE_IPHONE + CGRect r = wxOSXGetFrameForControl( this, pos , size ) ; + m_webView = [[UIWebView alloc] initWithFrame:r]; - m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() ); + SetPeer( new wxWidgetIPhoneImpl( this, m_webView ) ); - HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ; - InstallControlEventHandler(peer->GetControlRef(), - GetwxWebViewWebKitEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, this, - (EventHandlerRef *)&m_webKitCtrlEventHandler); - SetPeer(peer); #else NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; m_webView = [[WebView alloc] initWithFrame:r @@ -367,14 +120,12 @@ bool wxWebViewWebKit::Create(wxWindow *parent, MacPostControlCreate(pos, size); -#if wxOSX_USE_CARBON - HIViewSetVisible( GetPeer()->GetControlRef(), true ); -#endif [m_webView setHidden:false]; - // Register event listener interfaces +#if wxOSX_USE_IPHONE +#else WebViewLoadDelegate* loadDelegate = [[WebViewLoadDelegate alloc] initWithWxWindow: this]; @@ -390,7 +141,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent, [[WebViewUIDelegate alloc] initWithWxWindow: this]; [m_webView setUIDelegate:uiDelegate]; - +#endif //Register our own class for custom scheme handling [NSURLProtocol registerClass:[WebViewCustomProtocol class]]; @@ -400,6 +151,8 @@ bool wxWebViewWebKit::Create(wxWindow *parent, wxWebViewWebKit::~wxWebViewWebKit() { +#if wxOSX_USE_IPHONE +#else WebViewLoadDelegate* loadDelegate = [m_webView frameLoadDelegate]; WebViewPolicyDelegate* policyDelegate = [m_webView policyDelegate]; WebViewUIDelegate* uiDelegate = [m_webView UIDelegate]; @@ -415,6 +168,7 @@ wxWebViewWebKit::~wxWebViewWebKit() if (uiDelegate) [uiDelegate release]; +#endif } // ---------------------------------------------------------------------------- @@ -442,7 +196,7 @@ void wxWebViewWebKit::GoBack() if ( !m_webView ) return; - [(WebView*)m_webView goBack]; + [m_webView goBack]; } void wxWebViewWebKit::GoForward() @@ -450,7 +204,7 @@ void wxWebViewWebKit::GoForward() if ( !m_webView ) return; - [(WebView*)m_webView goForward]; + [m_webView goForward]; } void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags) @@ -505,7 +259,7 @@ wxString wxWebViewWebKit::GetPageSource() const return wxEmptyString; } - return wxStringWithNSString( source ); + return wxCFStringRef::AsString( source ); } return wxEmptyString; @@ -636,7 +390,7 @@ void wxWebViewWebKit::SetScrollPos(int pos) wxString javascript; javascript.Printf(wxT("document.body.scrollTop = %d;"), pos); [[m_webView windowScriptObject] evaluateWebScript: - (NSString*)wxNSStringWithWxString( javascript )]; + wxCFStringRef( javascript ).AsNSString()]; } wxString wxWebViewWebKit::GetSelectedText() const @@ -645,7 +399,7 @@ wxString wxWebViewWebKit::GetSelectedText() const if ( !dr ) return wxString(); - return wxStringWithNSString([dr toString]); + return wxCFStringRef::AsString([dr toString]); } void wxWebViewWebKit::RunScript(const wxString& javascript) @@ -654,112 +408,30 @@ void wxWebViewWebKit::RunScript(const wxString& javascript) return; [[m_webView windowScriptObject] evaluateWebScript: - (NSString*)wxNSStringWithWxString( javascript )]; + wxCFStringRef( javascript ).AsNSString()]; } void wxWebViewWebKit::OnSize(wxSizeEvent &event) { -#if defined(__WXMAC__) && wxOSX_USE_CARBON - // This is a nasty hack because WebKit seems to lose its position when it is - // embedded in a control that is not itself the content view for a TLW. - // I put it in OnSize because these calcs are not perfect, and in fact are - // basically guesses based on reverse engineering, so it's best to give - // people the option of overriding OnSize with their own calcs if need be. - // I also left some test debugging print statements as a convenience if - // a(nother) problem crops up. - - wxWindow* tlw = MacGetTopLevelWindow(); - - NSRect frame = [(WebView*)m_webView frame]; - NSRect bounds = [(WebView*)m_webView bounds]; - -#if DEBUG_WEBKIT_SIZING - fprintf(stderr,"Carbon window x=%d, y=%d, width=%d, height=%d\n", - GetPosition().x, GetPosition().y, GetSize().x, GetSize().y); - fprintf(stderr, "Cocoa window frame x=%G, y=%G, width=%G, height=%G\n", - frame.origin.x, frame.origin.y, - frame.size.width, frame.size.height); - fprintf(stderr, "Cocoa window bounds x=%G, y=%G, width=%G, height=%G\n", - bounds.origin.x, bounds.origin.y, - bounds.size.width, bounds.size.height); -#endif - - // This must be the case that Apple tested with, because well, in this one case - // we don't need to do anything! It just works. ;) - if (GetParent() == tlw) return; - - // since we no longer use parent coordinates, we always want 0,0. - int x = 0; - int y = 0; - - HIRect rect; - rect.origin.x = x; - rect.origin.y = y; - -#if DEBUG_WEBKIT_SIZING - printf("Before conversion, origin is: x = %d, y = %d\n", x, y); -#endif - - // NB: In most cases, when calling HIViewConvertRect, what people want is to - // use GetRootControl(), and this tripped me up at first. But in fact, what - // we want is the root view, because we need to make the y origin relative - // to the very top of the window, not its contents, since we later flip - // the y coordinate for Cocoa. - HIViewConvertRect (&rect, GetPeer()->GetControlRef(), - HIViewGetRoot( - (WindowRef) MacGetTopLevelWindowRef() - )); - - x = (int)rect.origin.x; - y = (int)rect.origin.y; - -#if DEBUG_WEBKIT_SIZING - printf("Moving Cocoa frame origin to: x = %d, y = %d\n", x, y); -#endif - - if (tlw){ - //flip the y coordinate to convert to Cocoa coordinates - y = tlw->GetSize().y - ((GetSize().y) + y); - } - -#if DEBUG_WEBKIT_SIZING - printf("y = %d after flipping value\n", y); -#endif - - frame.origin.x = x; - frame.origin.y = y; - [(WebView*)m_webView setFrame:frame]; - - if (IsShown()) - [(WebView*)m_webView display]; - event.Skip(); -#endif } void wxWebViewWebKit::MacVisibilityChanged(){ -#if defined(__WXMAC__) && wxOSX_USE_CARBON - bool isHidden = !IsControlVisible( GetPeer()->GetControlRef()); - if (!isHidden) - [(WebView*)m_webView display]; - - [m_webView setHidden:isHidden]; -#endif } void wxWebViewWebKit::LoadURL(const wxString& url) { [[m_webView mainFrame] loadRequest:[NSURLRequest requestWithURL: - [NSURL URLWithString:wxNSStringWithWxString(url)]]]; + [NSURL URLWithString:wxCFStringRef(url).AsNSString()]]]; } wxString wxWebViewWebKit::GetCurrentURL() const { - return wxStringWithNSString([m_webView mainFrameURL]); + return wxCFStringRef::AsString([m_webView mainFrameURL]); } wxString wxWebViewWebKit::GetCurrentTitle() const { - return wxStringWithNSString([m_webView mainFrameTitle]); + return wxCFStringRef::AsString([m_webView mainFrameTitle]); } float wxWebViewWebKit::GetWebkitZoom() const @@ -839,9 +511,9 @@ void wxWebViewWebKit::DoSetPage(const wxString& src, const wxString& baseUrl) if ( !m_webView ) return; - [[m_webView mainFrame] loadHTMLString:(NSString*)wxNSStringWithWxString(src) + [[m_webView mainFrame] loadHTMLString:wxCFStringRef( src ).AsNSString() baseURL:[NSURL URLWithString: - wxNSStringWithWxString( baseUrl )]]; + wxCFStringRef( baseUrl ).AsNSString()]]; } void wxWebViewWebKit::Cut() @@ -849,7 +521,7 @@ void wxWebViewWebKit::Cut() if ( !m_webView ) return; - [(WebView*)m_webView cut:m_webView]; + [m_webView cut:m_webView]; } void wxWebViewWebKit::Copy() @@ -857,7 +529,7 @@ void wxWebViewWebKit::Copy() if ( !m_webView ) return; - [(WebView*)m_webView copy:m_webView]; + [m_webView copy:m_webView]; } void wxWebViewWebKit::Paste() @@ -865,7 +537,7 @@ void wxWebViewWebKit::Paste() if ( !m_webView ) return; - [(WebView*)m_webView paste:m_webView]; + [m_webView paste:m_webView]; } void wxWebViewWebKit::DeleteSelection() @@ -873,7 +545,7 @@ void wxWebViewWebKit::DeleteSelection() if ( !m_webView ) return; - [(WebView*)m_webView deleteSelection]; + [m_webView deleteSelection]; } bool wxWebViewWebKit::HasSelection() const @@ -906,14 +578,14 @@ wxString wxWebViewWebKit::GetSelectedSource() const if ( !dr ) return wxString(); - return wxStringWithNSString([dr markupString]); + return wxCFStringRef::AsString([dr markupString]); } wxString wxWebViewWebKit::GetPageText() const { NSString *result = [m_webView stringByEvaluatingJavaScriptFromString: @"document.body.textContent"]; - return wxStringWithNSString(result); + return wxCFStringRef::AsString(result); } void wxWebViewWebKit::EnableHistory(bool enable) @@ -938,8 +610,8 @@ wxVector > wxWebViewWebKit::GetBackwardHistory for(int i = -count; i < 0; i++) { WebHistoryItem* item = [history itemAtIndex:i]; - wxString url = wxStringWithNSString([item URLString]); - wxString title = wxStringWithNSString([item title]); + wxString url = wxCFStringRef::AsString([item URLString]); + wxString title = wxCFStringRef::AsString([item title]); wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(url, title); wxitem->m_histItem = item; wxSharedPtr itemptr(wxitem); @@ -956,8 +628,8 @@ wxVector > wxWebViewWebKit::GetForwardHistory( for(int i = 1; i <= count; i++) { WebHistoryItem* item = [history itemAtIndex:i]; - wxString url = wxStringWithNSString([item URLString]); - wxString title = wxStringWithNSString([item title]); + wxString url = wxCFStringRef::AsString([item URLString]); + wxString title = wxCFStringRef::AsString([item title]); wxWebViewHistoryItem* wxitem = new wxWebViewHistoryItem(url, title); wxitem->m_histItem = item; wxSharedPtr itemptr(wxitem); @@ -1000,6 +672,9 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) // Listener interfaces //------------------------------------------------------------ +#if wxOSX_USE_IPHONE +#else + // NB: I'm still tracking this down, but it appears the Cocoa window // still has these events fired on it while the Carbon control is being // destroyed. Therefore, we must be careful to check both the existence @@ -1007,7 +682,7 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) @implementation WebViewLoadDelegate -- initWithWxWindow: (wxWebViewWebKit*)inWindow +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow { [super init]; webKitWindow = inWindow; // non retained @@ -1026,10 +701,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) if (webKitWindow && frame == [sender mainFrame]){ NSString *url = [[[[frame dataSource] request] URL] absoluteString]; - wxString target = wxStringWithNSString([frame name]); + wxString target = wxCFStringRef::AsString([frame name]); wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED, webKitWindow->GetId(), - wxStringWithNSString( url ), + wxCFStringRef::AsString( url ), target); if (webKitWindow && webKitWindow->GetEventHandler()) @@ -1044,10 +719,10 @@ void wxWebViewWebKit::RegisterHandler(wxSharedPtr handler) if (webKitWindow && frame == [sender mainFrame]){ NSString *url = [[[[frame dataSource] request] URL] absoluteString]; - wxString target = wxStringWithNSString([frame name]); + wxString target = wxCFStringRef::AsString([frame name]); wxWebViewEvent event(wxEVT_WEBVIEW_LOADED, webKitWindow->GetId(), - wxStringWithNSString( url ), + wxCFStringRef::AsString( url ), target); if (webKitWindow && webKitWindow->GetEventHandler()) @@ -1102,9 +777,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) case NSURLErrorUserAuthenticationRequired: case NSURLErrorSecureConnectionFailed: -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 case NSURLErrorClientCertificateRequired: -#endif *out = wxWEBVIEW_NAV_ERR_AUTH; break; @@ -1122,11 +795,11 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) } } - wxString message = wxStringWithNSString([error localizedDescription]); + wxString message = wxCFStringRef::AsString([error localizedDescription]); NSString* detail = [error localizedFailureReason]; if (detail != NULL) { - message = message + " (" + wxStringWithNSString(detail) + ")"; + message = message + " (" + wxCFStringRef::AsString(detail) + ")"; } return message; } @@ -1143,7 +816,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) wxString description = nsErrorToWxHtmlError(error, &type); wxWebViewEvent event(wxEVT_WEBVIEW_ERROR, webKitWindow->GetId(), - wxStringWithNSString( url ), + wxCFStringRef::AsString( url ), wxEmptyString); event.SetString(description); event.SetInt(type); @@ -1169,7 +842,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) wxString description = nsErrorToWxHtmlError(error, &type); wxWebViewEvent event(wxEVT_WEBVIEW_ERROR, webKitWindow->GetId(), - wxStringWithNSString( url ), + wxCFStringRef::AsString( url ), wxEmptyString); event.SetString(description); event.SetInt(type); @@ -1182,13 +855,13 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame { - wxString target = wxStringWithNSString([frame name]); + wxString target = wxCFStringRef::AsString([frame name]); wxWebViewEvent event(wxEVT_WEBVIEW_TITLE_CHANGED, webKitWindow->GetId(), webKitWindow->GetCurrentURL(), target); - event.SetString(wxStringWithNSString(title)); + event.SetString(wxCFStringRef::AsString(title)); if (webKitWindow && webKitWindow->GetEventHandler()) webKitWindow->GetEventHandler()->ProcessEvent(event); @@ -1197,7 +870,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) @implementation WebViewPolicyDelegate -- initWithWxWindow: (wxWebViewWebKit*)inWindow +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow { [super init]; webKitWindow = inWindow; // non retained @@ -1212,12 +885,30 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) { wxUnusedVar(frame); - webKitWindow->m_busy = true; NSString *url = [[request URL] absoluteString]; - wxString target = wxStringWithNSString([frame name]); + if (webKitWindow->m_nextNavigationIsNewWindow) + { + // This navigation has been marked as a new window + // cancel the request here and send an apropriate event + // to the application code + webKitWindow->m_nextNavigationIsNewWindow = false; + + wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW, + webKitWindow->GetId(), + wxCFStringRef::AsString( url ), ""); + + if (webKitWindow && webKitWindow->GetEventHandler()) + webKitWindow->GetEventHandler()->ProcessEvent(event); + + [listener ignore]; + return; + } + + webKitWindow->m_busy = true; + wxString target = wxCFStringRef::AsString([frame name]); wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATING, webKitWindow->GetId(), - wxStringWithNSString( url ), target); + wxCFStringRef::AsString( url ), target); if (webKitWindow && webKitWindow->GetEventHandler()) webKitWindow->GetEventHandler()->ProcessEvent(event); @@ -1244,7 +935,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) NSString *url = [[request URL] absoluteString]; wxWebViewEvent event(wxEVT_WEBVIEW_NEWWINDOW, webKitWindow->GetId(), - wxStringWithNSString( url ), ""); + wxCFStringRef::AsString( url ), ""); if (webKitWindow && webKitWindow->GetEventHandler()) webKitWindow->GetEventHandler()->ProcessEvent(event); @@ -1253,6 +944,8 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) } @end +#endif + @implementation WebViewCustomProtocol + (BOOL)canInitWithRequest:(NSURLRequest *)request @@ -1262,7 +955,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) wxStringToWebHandlerMap::const_iterator it; for( it = g_stringHandlerMap.begin(); it != g_stringHandlerMap.end(); ++it ) { - if(it->first.IsSameAs(wxStringWithNSString(scheme))) + if(it->first.IsSameAs(wxCFStringRef::AsString(scheme))) { return YES; } @@ -1284,8 +977,8 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) id client = [self client]; - wxString wxpath = wxStringWithNSString(path); - wxString scheme = wxStringWithNSString([[request URL] scheme]); + wxString wxpath = wxCFStringRef::AsString(path); + wxString scheme = wxCFStringRef::AsString([[request URL] scheme]); wxFSFile* file = g_stringHandlerMap[scheme]->GetFile(wxpath); if (!file) @@ -1303,7 +996,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[request URL] - MIMEType:wxNSStringWithWxString(file->GetMimeType()) + MIMEType:wxCFStringRef(file->GetMimeType()).AsNSString() expectedContentLength:length textEncodingName:nil]; @@ -1335,13 +1028,22 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) @implementation WebViewUIDelegate -- initWithWxWindow: (wxWebViewWebKit*)inWindow +- (id)initWithWxWindow: (wxWebViewWebKit*)inWindow { [super init]; webKitWindow = inWindow; // non retained return self; } +- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request +{ + // This method is called when window.open() is used in javascript with a target != _self + // request is always nil, so it can't be used for event generation + // Mark the next navigation as "new window" + webKitWindow->m_nextNavigationIsNewWindow = true; + return sender; +} + - (void)webView:(WebView *)sender printFrameView:(WebFrameView *)frameView { wxUnusedVar(sender); diff --git a/Externals/wxWidgets3/src/osx/window_osx.cpp b/Externals/wxWidgets3/src/osx/window_osx.cpp index 0f8f921aae..e07e294b63 100644 --- a/Externals/wxWidgets3/src/osx/window_osx.cpp +++ b/Externals/wxWidgets3/src/osx/window_osx.cpp @@ -34,6 +34,7 @@ #include "wx/menuitem.h" #include "wx/treectrl.h" #include "wx/listctrl.h" + #include "wx/platinfo.h" #endif #include "wx/tooltip.h" @@ -63,11 +64,7 @@ #include "wx/graphics.h" -#if wxOSX_USE_CARBON - #include "wx/osx/uma.h" -#else - #include "wx/osx/private.h" -#endif +#include "wx/osx/private.h" #define MAC_SCROLLBAR_SIZE 15 #define MAC_SMALL_SCROLLBAR_SIZE 11 @@ -75,12 +72,12 @@ #include #ifdef __WXUNIVERSAL__ - IMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase) + wxIMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase); #endif -BEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase) +wxBEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase) EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() #define wxMAC_DEBUG_REDRAW 0 #ifndef wxMAC_DEBUG_REDRAW @@ -156,7 +153,7 @@ public: virtual ~wxBlindPlateWindow(); - virtual bool AcceptsFocus() const + virtual bool AcceptsFocus() const wxOVERRIDE { return false; } @@ -167,18 +164,18 @@ protected: { } - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow) - DECLARE_EVENT_TABLE() + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow); + wxDECLARE_EVENT_TABLE(); }; wxBlindPlateWindow::~wxBlindPlateWindow() { } -IMPLEMENT_DYNAMIC_CLASS(wxBlindPlateWindow, wxWindow) +wxIMPLEMENT_DYNAMIC_CLASS(wxBlindPlateWindow, wxWindow); -BEGIN_EVENT_TABLE(wxBlindPlateWindow, wxWindow) -END_EVENT_TABLE() +wxBEGIN_EVENT_TABLE(wxBlindPlateWindow, wxWindow) +wxEND_EVENT_TABLE() // ---------------------------------------------------------------------------- @@ -356,7 +353,8 @@ void wxWindowMac::SetPeer(wxOSXWidgetImpl* peer) if ( !m_hasFont ) DoSetWindowVariant( m_windowVariant ); - GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; + if ( !m_label.empty() ) + GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; // for controls we want to use best size for wxDefaultSize params ) if ( !GetPeer()->IsUserPane() ) @@ -456,32 +454,15 @@ void wxWindowMac::MacChildAdded() #endif } -void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), +void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& WXUNUSED(size)) { - // todo remove if refactoring works correctly -#if 0 - wxASSERT_MSG( GetPeer() != NULL && GetPeer()->IsOk() , wxT("No valid mac control") ) ; - - if (!GetParent()->GetChildren().Find((wxWindow*)this)) - GetParent()->AddChild( this ); - - GetPeer()->InstallEventHandler(); - GetPeer()->Embed(GetParent()->GetPeer()); - - GetParent()->MacChildAdded() ; - - // adjust font, controlsize etc - DoSetWindowVariant( m_windowVariant ) ; - - GetPeer()->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics), GetFont().GetEncoding() ) ; - - // for controls we want to use best size for wxDefaultSize params ) - if ( !GetPeer()->IsUserPane() ) - SetInitialSize(size); - - SetCursor( *wxSTANDARD_CURSOR ) ; -#endif + // Some controls may have a nonzero layout inset, + // so we may need to adjust control position. + if ( pos.IsFullySpecified() && GetPosition() != pos ) + { + SetPosition(pos); + } } void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) @@ -925,8 +906,6 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) { #ifndef __WXUNIVERSAL__ - menu->UpdateUI(); - if ( x == wxDefaultCoord && y == wxDefaultCoord ) { wxPoint mouse = wxGetMousePosition(); @@ -1233,7 +1212,8 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) GetClientSize( ¤tclientwidth , ¤tclientheight ) ; GetSize( ¤twidth , ¤theight ) ; - DoSetSize( wxDefaultCoord , wxDefaultCoord , currentwidth + clientwidth - currentclientwidth , + // XXX: Dolphin. Do not allow internal semantic call to become visible to derived classes. + wxWindowMac::DoSetSize( wxDefaultCoord , wxDefaultCoord , currentwidth + clientwidth - currentclientwidth , currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ; } } @@ -1337,11 +1317,7 @@ bool wxWindowMac::MacIsReallyEnabled() bool wxWindowMac::MacIsReallyHilited() { -#if wxOSX_USE_CARBON - return GetPeer()->IsActive(); -#else return true; // TODO -#endif } int wxWindowMac::GetCharHeight() const @@ -1438,6 +1414,7 @@ void wxWindowMac::WarpPointer(int x_pos, int y_pos) DoClientToScreen(&x, &y); CGPoint cgpoint = CGPointMake( x, y ); CGWarpMouseCursorPosition( cgpoint ); + CGAssociateMouseAndMouseCursorPosition(true); // At least GTK sends a mouse moved event after WarpMouse wxMouseEvent event(wxEVT_MOTION); @@ -1606,8 +1583,6 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right if ( IsTopLevel() ) return ; - bool hasFocus = GetPeer()->NeedsFocusRect() && HasFocus(); - // back to the surrounding frame rectangle int tx,ty,tw,th; @@ -1615,8 +1590,9 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right GetPeer()->GetPosition( tx, ty ); #if wxOSX_USE_COCOA_OR_CARBON - { + const bool hasFocus = GetPeer()->NeedsFocusRect() && HasFocus(); + CGRect cgrect = CGRectMake( tx-1 , ty-1 , tw+2 , th+2 ) ; @@ -1945,97 +1921,6 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool includeOuterStructures ) void wxWindowMac::MacUpdateClippedRects() const { -#if wxOSX_USE_CARBON - if ( m_cachedClippedRectValid ) - return ; - - // includeOuterStructures is true if we try to draw somthing like a focus ring etc. - // also a window dc uses this, in this case we only clip in the hierarchy for hard - // borders like a scrollwindow, splitter etc otherwise we end up in a paranoia having - // to add focus borders everywhere - - Rect rIncludingOuterStructures ; - - int tx,ty,tw,th; - - GetPeer()->GetSize( tw, th ); - GetPeer()->GetPosition( tx, ty ); - - Rect r = { ty,tx, ty+th, tx+tw }; - - r.left -= MacGetLeftBorderSize() ; - r.top -= MacGetTopBorderSize() ; - r.bottom += MacGetBottomBorderSize() ; - r.right += MacGetRightBorderSize() ; - - r.right -= r.left ; - r.bottom -= r.top ; - r.left = 0 ; - r.top = 0 ; - - rIncludingOuterStructures = r ; - InsetRect( &rIncludingOuterStructures , -4 , -4 ) ; - - wxRect cl = GetClientRect() ; - Rect rClient = { cl.y , cl.x , cl.y + cl.height , cl.x + cl.width } ; - - int x , y ; - wxSize size ; - const wxWindow* child = (wxWindow*) this ; - const wxWindow* parent = NULL ; - - while ( !child->IsTopLevel() && ( parent = child->GetParent() ) != NULL ) - { - if ( parent->MacIsChildOfClientArea(child) ) - { - size = parent->GetClientSize() ; - wxPoint origin = parent->GetClientAreaOrigin() ; - x = origin.x ; - y = origin.y ; - } - else - { - // this will be true for scrollbars, toolbars etc. - size = parent->GetSize() ; - y = parent->MacGetTopBorderSize() ; - x = parent->MacGetLeftBorderSize() ; - size.x -= parent->MacGetLeftBorderSize() + parent->MacGetRightBorderSize() ; - size.y -= parent->MacGetTopBorderSize() + parent->MacGetBottomBorderSize() ; - } - - parent->MacWindowToRootWindow( &x, &y ) ; - MacRootWindowToWindow( &x , &y ) ; - - Rect rparent = { y , x , y + size.y , x + size.x } ; - - // the wxwindow and client rects will always be clipped - SectRect( &r , &rparent , &r ) ; - SectRect( &rClient , &rparent , &rClient ) ; - - // the structure only at 'hard' borders - if ( parent->MacClipChildren() || - ( parent->GetParent() && parent->GetParent()->MacClipGrandChildren() ) ) - { - SectRect( &rIncludingOuterStructures , &rparent , &rIncludingOuterStructures ) ; - } - - child = parent ; - } - - m_cachedClippedRect = wxRect( r.left , r.top , r.right - r.left , r.bottom - r.top ) ; - m_cachedClippedClientRect = wxRect( rClient.left , rClient.top , - rClient.right - rClient.left , rClient.bottom - rClient.top ) ; - m_cachedClippedRectWithOuterStructure = wxRect( - rIncludingOuterStructures.left , rIncludingOuterStructures.top , - rIncludingOuterStructures.right - rIncludingOuterStructures.left , - rIncludingOuterStructures.bottom - rIncludingOuterStructures.top ) ; - - m_cachedClippedRegionWithOuterStructure = wxRegion( m_cachedClippedRectWithOuterStructure ) ; - m_cachedClippedRegion = wxRegion( m_cachedClippedRect ) ; - m_cachedClippedClientRegion = wxRegion( m_cachedClippedClientRect ) ; - - m_cachedClippedRectValid = true ; -#endif } /* @@ -2178,7 +2063,7 @@ WXWindow wxWindowMac::MacGetTopLevelWindowRef() const bool wxWindowMac::MacHasScrollBarCorner() const { -#if wxUSE_SCROLLBAR +#if wxUSE_SCROLLBAR && !wxOSX_USE_IPHONE /* Returns whether the scroll bars in a wxScrolledWindow should be * shortened. Scroll bars should be shortened if either: * @@ -2208,7 +2093,7 @@ bool wxWindowMac::MacHasScrollBarCorner() const if ( frame ) { // starting from 10.7 there are no resize indicators anymore - if ( (frame->GetWindowStyleFlag() & wxRESIZE_BORDER) && UMAGetSystemVersion() < 0x1070) + if ( (frame->GetWindowStyleFlag() & wxRESIZE_BORDER) && !wxPlatformInfo::Get().CheckOSVersion(10, 7) ) { // Parent frame has resize handle wxPoint frameBottomRight = frame->GetScreenRect().GetBottomRight(); @@ -2778,7 +2663,7 @@ bool wxWindowMac::OSXHandleKeyEvent( wxKeyEvent& event ) break; } - if (ancestor->IsTopLevel()) + if (ancestor->IsTopNavigationDomain(wxWindow::Navigation_Accel)) break; ancestor = ancestor->GetParent(); @@ -2856,7 +2741,7 @@ void wxWidgetImpl::RemoveAssociations(wxWidgetImpl* impl) } } -IMPLEMENT_ABSTRACT_CLASS( wxWidgetImpl , wxObject ) +wxIMPLEMENT_ABSTRACT_CLASS(wxWidgetImpl, wxObject); wxWidgetImpl::wxWidgetImpl( wxWindowMac* peer , bool isRootControl, bool isUserPane ) { @@ -2874,6 +2759,7 @@ wxWidgetImpl::wxWidgetImpl() wxWidgetImpl::~wxWidgetImpl() { + m_wxPeer = NULL; } void wxWidgetImpl::Init() diff --git a/Externals/wxWidgets3/src/osx/wxmac.icns b/Externals/wxWidgets3/src/osx/wxmac.icns deleted file mode 100644 index 5ec807b5d66d0e6f9b78cbee335154826d2e64e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45458 zcmeHw1wd3;`}bjnQX0j?0t1moR4_nPL=i!y6vRLgq*QEO7(fXHr35T&30sTzMCe?+w@08RLdcqc z(iq%m-Z-Gq_;yGLLxw?TL@*A75DzhhAbMl~++Isu_jm=)EsHhkl8=Dg_fsac%8qD!MoN=oWmKviAc;x3^_gQ}Fig&I`VZ{H>K_4M?iOtnx~zjf=* zBZ9y+f~dPQ6-u4Zw~j8n1C5Pf9R56vqR1%-+Up_0Vs1G6J9!87>P5a9LWPWcI;=b6jkP>(}Vx{*;T}>q#Vp1;l7-7(_dsiBRbWsK& zX=NojX^AxKVIGge;hu+qJ8|vTr@ubsgd>TZ_aOv&3>QUjLkRlqB{s7|5PiwKq(&H( zvaDl!9eBt8>9{B+k&kJ;Gxv1uVDM>SpJtAuc} z{&GmayW|DG{#+VSbw2;=E-2vLhYugFPd2^y>C>l=2PF`a?b=li?l;rJw{8v775dWA z#k5H?;a=9x-md^3xJvLN)9OcFhTsmQzvpr#xRc;#7*~P;KU{P8QR33MN{{GVbNC^+ z^vA>_`ZJ`;3zBKy-u{(ejkeCf+p(yDrlH5tbgIkS5{WuY*vTrH|lS>Kwjr0 zb~1rPtR)zRaQbB zY*+b`b>LSS@CkHRE%U^5s8aRHTBzTXhpGzjS5}q|wsBfo1RprK4pj{eO@a{Ai%Kmu zG>i%29DD$Q{A-`jQN0>XfJ1%qyQkXAqp(Xm7JPpvvu*gnvZM+ZR6zN*yN9G1PUr*V2VpkXsA1<-!D9}e^*R6W79H2sN3$nc{*`N z1S4>X`;7jvNXa_(%HgfS8amgNM4pts?K^i3W@Y0S%vTXMBO|1>SbXX1EMI7;*sF7;ZxV7{ZlqGnU5hNp0uZ)ki>L}=JdyQV2r!&A5@ zs_s?=CqLiAvS||4@FaR1eRk>mi6e(sX}VkM@aM4?e;!@;+-JeE+p%qidf#5%l*p;< zE1XJ)9XHOCi*VU&t9~>(HJ?42=F>K`GA$f0%Bhpb_h>$?D&(}92A1t#4~uis1XDxh zrpZ+yCwGKH&JMgd#~AAll@CGG6suBGJkuG8B z>#0m{G2L?gH0Dg#1wt=XdC4tJQ{JU}cQrK?#jY}v5(!9JOF?*aZPL3Li9Ru1g4!p3VZ5y<*PaI-3fVuubdc8VF~0 z&w;yJ2-nDC*N*Ir4BfD7uG6HU2=Qk&W@~C??d|)uwGY?tyReI~d8L!}WDC8X2nptP z)xt#!%wo$*6U-8MQGs4|lP%0f4OKy?X>KQumJ30B`>fAi>oV2c%tT+ipFBd%=T-&C z>V8LE#+i-O*B(5eJDl)Z&2HZTZU^j*41n0XyBrOnRue3zqGLO1I1sxj%EBp8zSR`V zDynu@QNYs|idxOFq`Z=>6b(+>?M<;Sd4iMtz7w3NNB;kKo0Pqu4=#R=a8MIbd>_1i zh0E(-Hod4%NLNx$Aq8SMe;U7PK zZPw6AzIeE{_VD8N>F_CqP)_^wJWS7TMvrLeA4$({Mh|J}Up|&!+(fS*jZpJ>BjwSm zYt*w<9orn(CpE(p0H4H#CQClt!gj^Q<#q$Pt{R@jN>eQ@UnQpT*QHzcmV|#q&D+BZ z5Dc1i)1ZCt)d9@-6;ZEr@>=3MUb`@qKuQ_mR|6!|XpSBs`Xf4>d{rV}2f!;=0>3_z zAnM^2QLh8)k<24Ry_%EP&@NL?CtsC_M{sQp*GlyOECU;cmx&MHqdE5RZx-<sj1Kk6Ag{mu3O&H1*+{;A2JDC+J`W&Y&A;olaRBkzoao?HiD(2K83G2ZQG(#Y zD>yg+Oe2_>NAN0cfpr83kYprw@&7`>pwoRv$JSl>Lbl((*#tjP9QQF^1f{jWeI!q| zmn~?i=^o%ixQN@nrj;Hy0F(f)TDK;krGB!#VvVO~EB^VI9q_9Ackcq=#S{wR_H~|~ zBpHA&j(`9S>wq1@UjTqrVgZ1}m`umY3TXD@Qq7eBHQ|wAGMy^R0qr8&J|V+>QmypcUGcp@N$+KRE(bPJ(t4 zI3x9Ae#^l&zj}K5C?m2N^RqDjWDN~XbLfh?ys#bn3C)6bjGvMEp?xx7a&6j;D0U5F zN)N>kei~y$4=_BkT?M0lxZw6;vYBe9TCqRIGb}MT$9AGzOtA{~!eNpFQ5+>wPnv72wnk zrJ7J#{?)f77{N_AEJjO3VzJFs06XBaP)KkUW3!^b)h2;p$G4cD&kb)K@jJBOh7fKC z`kV6uUMmJa=Kd~z(s_~@;M@-U$p|7lE8qrf`J*m{E;~D8c(`?;_%S=iii4eWb#-)f z1x3%LH9L_JMB&mDIP9!LV$TAESyxYR79%lg3{z*M3vp~vuS>CGJee$fk1(LkFX8DJ zGRM9^`9P`{FvB~=4-hx?m=8$vR?JUv13%W^#7?IR_+{Rb0)Sd?&1mAUZov;2H3@J7 zgl$CflPI@aRgh4BHKR#C=5EPPvMU;8{K@yGx|-xC-NC#VgvJ0msh^LbgUp!B=QV=z z5l|coX(zcUKpprYL4X3)F*2@ZYHGgxMa}c)H7{Ir1^ie!6b!&O@LP}x2&8Tb`?jdVY5)@k3zXwhvZ=i;$7LAhl!t>OyybTT^rDJ&L=PgrM=x9Z29H%Pq1@ zoth;eiGCLZ82Il~r;284YQ5vrT;!h^muTwC|Me?xFC2mC8czV2OP~m(uw=zDkA?28 z^Bf&!+1bxdManC@{R8}#FIx(5`aBm$J6p%SNX6YRx~P~{kbUOF@k9Gl5`tz=+ly2^ zLT^02QO+yMJAW$uNb2sC&65oGAk~Gbj~-VQW}nGCc5pACxsh9EjDlA8eRU7Y&OzHg zXp0C9+BhBaIwjWJVWk0IJZ{^tX2m2OXq~ma@Nag7=W^OM2pp|hJaf9W`J_cILCmdZBnq>4B31Lif{KG7 zpw(@<^^~!W$188$48KOZ$l1RGDQml*D@j?uV!4ymK9fT*Y4Z}Sr%--A#N?fj)r;e_H`tu2|p6EJC* zW{(X|`9uj$T?C=HRc&Udn~~m#VVVQg71ln5h|`zGcke&ffwTns9xy!7SJfUdY=~z6 zzCF81t$GTudSgA~1+AevpX7)n6l!dGsHn)xDRh;UM!wGgmjC+pMaWB9!*z%mfsSp2 z-0h25(P~JNhE!7@g#rByM3IDaaOYWe7^0oH@g;N+T9(! zynMYpmn?F3x7V30dVBQt^INfgZQu$&A1|*l<3;U|K1+SJmt4j-j;zxsCyx}hOZs?h zy!xcJoKu*4?qud99Z`FwkH?O?Pp=ha;Tz2%r+)2jnLhKk*F3tAm4RgZ~T z-Z_0-!Y#k`?ck?ozxrMhHDKO)W1*9 zZp!jqq$Ktu1vNEQRb@r_u3coL;Gy;)lI-3^R$7`t16-BdyL*H?n0|y^kh?WcBA=Ox z=tWsPUO1P|V;AM_Mf7u=n&**kX}?}5gquPBl`n9!s4vdi12Ic{v%XRQSIlQ{b-fU` zwYp*n+V13&SKA21Pd74yon4)r93AG&ws)}EiG`vFSsevxLe2h)s-(wx1M= zBQc zx6}$jO3ij#Y+U}mcZ^S=AG>{uTUJRfnGmF;BCA66oI$Tgpk6W z%N(pJP93eGy&$eDdIzfZGTnS`^Gpj;C){8L^;eYvUXlAywa3WyXV*_N8#B^CXE?d6 z6(oUIfv$LpAV&0nQi>MWT17qKf(; zO^t#5`t<0otk6Xo_N(X}DyOWZLf!)LE(=E@cd4|B66`%mS`_+=JJpMfICuF6MVv9X z{eQox%vijLUluO}?6iZ@XaAGe4gB)Dp~hcSti72E)vK*eT3ebCMO4e@Z-@V+2_9aPldZH9L_7TPco-0h z|6cwiia+V!%-?q4$jq9y?p2{npmF={eH;GS0)7aAW0aOGl7dF5Gpz(plX*P?a@%*gZ4ZR^*oM~+BIVk$ zv}}=`EWC#=T0DiHxYClPv-UqS0^X}JGB+j^yF;B~zW0?D5D*x;G<0F8YnW5$EZWRj zj&+c^vpSFwFu>o>*Jru67yRnUk|iFC7cE@iKHtrC-rTt^&Tvd|m}6aw2CiJS3Qi`z ze7>a=+XBosk78rYk#umdpXpeGv;$TI2Ke}{T)TG7>cCYiR|N3YdwMPt*H^6_T&qiilU2V4uz2#+$z!XKzMsF3Pwwq& zHy%E`bNvG86BGMH38e7_Qj!wmV`HOcSz1l3LI%DoJR@taRzG|C;CA&z=md7CrG?$e zSYSu=w&(y0OLOhZ$k1`Q&(h55%a8u`%e~qw6`UrgGSZG7#!l@{-bIN-MT7@gO&D(q zLW{k zu9=W}_#KE7LXxug()8NOrt_K@QR-KRu? zHg8XD2;CQogm1xCHi5|MRjX`9j@HLQ z?(R#^<`+JGcYHk%` zQpDTKYm&Ypo?Pp>F7C%qo_TP$`T{#U^8oG(-%2<*hDFw`B}JBdEnB)|qOO4!7IJo) ze>mgh{X5sni_WL*YZBQKN{OuT_jI2N*ufk}mw5}!N9YZ~LQW2@2aaXjy?v#$;LOq8 z@nl~j!(l3eNh`kYjs@3F4mfHO_`eUJ4vz${>58t_YiJP5~8n-=)6bahAX~VkJ ztCu^^vbO_~X<%lubAf&S_}(26*hY

rfIg)Hn2`BqB(w#WNW>!pm^3Cg|1*Z-sM&JRYWc}uYpVRShfKdyx z=~0DcCA{5SXt{7uSx*@l1Bm9aP%ct27u2pfej;Cz<2?hydeLNkfQ&TY!WXFz~ zlwQK-{rowVka~BM#i?LtqT$9yMkZcC+pk_`ojtNEV*Sbhf8XWai|waT6KFAE{5UgH z-N1TM0-0-JasVMs_p1AV;_`WeNX zdJuh3RKbl#GDXE@Y*umA&Dc9y_ezb2>)FqCW#u1B3|qO-R^YA~>8_!^p3Vp@-4n&! z29SOPhPQ(>uY|?B_vULnG3?36VLG;Ub6I&u6G8&!+q5#PGeTQysCH(P@HQlMj8n!c zd%lYp_KVSw5z}Wl7v&y~3-)uho-hFh7yKP*WM}|3hieTRs;SjNR1%g#@rxv4*w2Q8 zhg(l`WM&`Q8RX+KWh}_yp#@)c!Qil=gEa>ZX(kzkB#&@QSPznkVNXYC44pjHJ}>*g zj?LaqlZ5stxgh`u_1DN~au*~Ed7RSsAXz_gfaZ9sDaUeBqc<*dumC@e!B2s`K?4W$ z>pQT8B%NK(s@_cuUDkJ?!KCra&Zll$x5R!-3oo%0{0>dO^yU`nyo#cGAa}giK#j2z z%mPxjuUk0L(9l3%U<-Wgr{1S`FSXuSZV#dK_2c_DuN&UHdH3NnfoCWR(K!`Gk3h%o zWBc?QHrCW+${ZUrSOuVAI369+ZlB&gd#I`QOamP$gvyt9uU@`*@e=;Mcv=6Zjw#f# zhmbj}rrvj`$tWX+ejhzu9cq9zuMZJ`KbtAi&$#-E7G30}v za-ZJ)we`U~p46d325Sr&&|kf8pI$wCbnm93te}d8cM%d_-fSm@Ik|k{y#(#0yAq>k z|32#du|V%$J$tHwITdAPB}I8TIe^?0j)QC>{A$;$=$5kk2+cPkeH2u?ckiZ32`DIl zNY^g1vNF=rQj(GqU9o5aA@Q+3rln{qAy>I%n6eyZl$DWXC@|!dKu$&m#OO3c%0cM( z!_Jms2Z^q~=I!1d85Oe3dx27jbciG*nn0vL;SAV`BT!>(Oa9}8D7YW$ML;;7} z5DP4EZCDz(#hfT$iOMTvzS>Ek_wntqNC8XUZ(jhb|ME7WJtk>j%74-TF+qvX4T z$&y_4FF$+cAR2z3p`z#^n0v)3;bz7m zsqK0B5U<*oBbisoDa?)`>34wsC%c4~nSkhd`T4AU96ETF37?yP~8LNfEp88XJuy$# zll=fLUYUB~*6mw2F#rsRE?_qR02cxfnsdlN%(M0sPXLG4G4I`~xdtDb7#%L=awsqv zz~0k)^@fUf0H5N&%4Y?$uBQ6tjjJS_%_WiG+$<70K9Q^|=CRz$)!%k($^I4v~K0?`M@ec7; zzJ5!>uU@MC{D*Dn^gfxY)z_ZRPUZ{_8)D50vn?vKY9c4lK(ACPCj>G_cOJ}>pZ ze(bke;=LgGQt|D7{agp|G&7s(`0=AhAjkk{d(y5*J$3cJjt6Kh_Hy4<&bj&f!`s&` zaP#q~3UGM}{!Uof`!65`R*O8{;!Bt{&+gX(5TAqNA^?yJ(C%2kp(7{t6dyydTCl`* zCnxv%uXk@$78jnws5==6;iK+=hergNssW}T9=u@Xws>v~GwbTpx@rLPPg4N{s`~L0f7yID!LnRNdSFp0u_fruF3biMZ zbnkfp^i!xkfT`m&hYj66X8rs1+kx6aQw;1KW^6c=!n${*q~O%yq-coM2o$YZ?d^mevZYXV2qTz}?x)^+ z2WlU3F|eIIeeM2T%)3>^xhD=J@H| zS5SAEo1MNdcB>%luzKZ+MSS0&mn4io*38rhaKatv8{mz>G`p!QlVbAjTx6X;zB@W3 z=qEuO!X1x1KlnkR?W0HO18%tkwTti=m`=6wkB`c}UBNtiBq=J0ilYG7@7g>vF&_NF z$hK~;9^JmBY~+~nzB|Lu*OozqBq4kwM5J)EVY!P9=@r#Q5_BF3=(;wbq2E$wG|JE| zD(vjd(!9+5v7tD)MFlRXAPoeBFy1~I1N8uPYN>Ts`Ia&R69XH+^`~zX;}}ZtDjdyN zzK9>q;A7~dDiYEj(yg2Fx0LA_>rG$ecCdz*4I!1y0lq%op7U&`lA)t!Q2-Lj*B-8^ zs-g(W+JmMH^o(?^7dRzeDmZ&IDRP6a_fj`|D*9nz-UQGCmaBuIUwiVrS#f1&Qe!qR zhYpgF6&x?(t0EC*3Y{J_u&<&*7f{w75@s-5Z}>##nLA5Q?T_B%?P5KpX)y>Q31kNc zLquRezh3h4vO7_GaG8OYj+VKj&5qKO`?hUZ=4gd?4mnhyiHs4Dns96Zqy0VQy2`|g z#?%akju<+A_OzIi6MG}qEuB3HPo7|y$WQ|xya)KdZ|`2+yLOR^MWTT>gTcdxjJ31c zUYxl*VvUEr1*u2SF@6w$kKhBQt|BWV8P^^uZUU# z)Cl2FKu`F@Q<9OU#kYm<3ncT~RY9zC;Gq7)CybroyJf@T$uO7tlt4>^D$0rq zkcKZslemg>AXL#$$83zT=~xp3n6no81^vV9vNFJb9S!dbb2)UR3EVRT@e%$yf%ph^ z26W@7g*08F1`X@l2f`-mLqdkEB4q6)>xel%zy08r;7Jw$`I(4;a#J zI0m8w!y-?GK*$IP9nzWaph5k+cZV=g>qixSxC7!HG>Q92QC?M9MHwrA7)sZ!T^O=R zh5<1YI$c8IDUy)sxSddkRr2Ke1HkX$SU@DKzMkrbO(%&K^PfRK8B0|L&RD@ZDnTfwS$gM-PpSPZCSrM&~LdnPO##i zrWd%ox#H6_|?^%&;yj}%zy(JUj&#RdQ32z=|i-OK?e z`7#Fx?O!6iAaD;SV_~jU3rpCLgFPf%&6;6;f-jXy=se!+FIFm28pU{01wcIZt?dIKEH?Cj10tr|ZRDx8YAft*r z@jwPv>=J8ho2gBLdRbn+{#kc#T)%!5r)|Np9iKj1<}Z;6JV^-RW$l#mYM;JU` zzufEa?ds~g_aQ+D3$mH`yboDS%25O_MsXl55C?HKY1)Yf2sWGvqyKT zFBKOGhK+O;v{I=|g7hDTtLcO>(P-c|P@BzLiYSL0H!NCmzP#k|uMZ#vi<3vr1~mfv zaOzq@Jb*pItfI}XqsN(SM}xiv;G93tW|KqFxPHOn)5V-$AoZ-Wl$mvsI`NWoCCI#L zNwh)1{iI0*8LRy&RyV+5+d z3G1Y13RJIlbx&vJKl~X^|D4>DO=}^MzZS@pG%Aa2#fmvbqYR>u=C=`^qsQ5t;QkPI9!scMt*jNBlSS{x51u+hl@Du=UDej zXV=47XYW3|Sy@te_SgYx_TmJy#~%z*^Kvh5TYV#4(A@#>b3tm=3V0@mZ~9$2UB_T}6dK$C1eBD{W0$_)1Iqp8IPE!+ ze*4~aGRKZTgH%>pFeGiQU$<)cVmBAK%R0@Qzi{dZJ*_A-qyq>jA-Ryts`;`TwENC- zOinviTX(g*=-lzWaCR0fXEJ?l-AWIa+4gpjR|jWaE1R*ybcaTvp&cPW(MRC6ck5FM zs9$b3C-Lavn|G>83QiwRChr#Eg0tq@)k~f5*_Av8$ei_7}eeIu(gZXx2L-H5+^%-e=KZDGEoyR#K7fFB(i|dx7dRD`0+Y@)q6rG zItGY>gAcJGt#=p8h+Qz>#&+B8q-!@Xu+AOd9m8MfIHzuv=WGE`K_iOeRhX*%5vDdPy!ml9TDPEByW7 z`w9d=4cQ+v@}OxnSgj|v^B0gO!*0eV<2G-PymXb94SzZ$n7j-5`M?=ekPT`+0U!x{ zF2ZL7jc#g6VCXMEQ-nbM=cEm>2z|Ju3;nQZ#I$wBv*OpZaZSjZ+R&t9G8-S0q zy;Zt&l>$3r18&&PaIL8`XPzxMmJqta-Nr&N`}|Z*LGmMY*6*PtD~s)jjm3eTp~Hqw zwy`-|a5Ns!h-uIlK>o&XA#lEv&6iwqtZeBJ`0Nao@1`X^d08IF>jWkUHtcVQ<#v+~m1N#jfYc|SezSG2Jix`q? z$wf>}2~Jc6^oAx84SP*|m{7JixI1+8Xd?rLe*dQYSt|DyaGP!z^}!YZP1*sgQe6Bn z4r%r2*SGgT9mp>xbD0GbL4k2tJ^qFXS!pS{1gu7}QN?&Pq&G$e)dxVzF@`O11-q@H zg5fB+F5tPeq$Euu4wkyOIAa1DgaIxLUa1J-DL}x4IldUZN(8UP#~x|Q-McZm_X5}q z6boQ4oH{IpbAV|QNl0uwG8xgO6;zZMDl~x57_tm$B*g&y48F;u6PWxT0w!0J-^5_i z`ArP}Bfk;a=|<-WbdEsh2y~7>=LmF;K<5Z_jzH%Kv>gHEVa6uymXSJr+e-Yv78$$! zb(1C#U=k{!gY!~&n<2tbL zZF1W$^%7}U(0E_<+v>!ncDW+Z{C)2q$*?=vgp@)g^}Hw8NF3rF_*E;`5mo9jtjV(0q%zGWxm`u~0X{kQMG8+-K? zU3w~ryY?}^*z5nzAAgE2&uTLl_7d9#vF!^NqNs~HA914&Kh{1$q>1@gT7R^CB1ciI zIr!oBi3FNB4*YogjT8U7_K9%No0{ZSz;}f`fmGeb-X> zN7UTg*jEXteE%aff1i#v-vMr3^?iarh%2#G|6Rm6;r;+0$ZxG~@?j$Usp9`=X=%Uv z&Ht!zFxJxk`v0`~mi85I{CDk}fB5g(U;7_7-*Wt8{>%2;ep~pz-JuriztjG|eY{&6 z=p6s14<8ZVmfw1~TGs#E8r1SRC1|U-k4S%O{BH}tS6|Qx$=fYG?6CH??ANt9#wqas zuxN*N1q_|`1ycv_;@C zAD#^S;r8ibY~l}&EzJLr{v*Xx?RK{n;p57d=26=}Le)y5RrR)fD+Od#F8cfMt6%1} zmTvtwp<0=1Q@zqoipBWz9ivE3b_{B59xZEQ;oA*a?ZLMa!xu#)B(+~+gJgW0-Yn! KIRZa^1pXfZSr0V; diff --git a/Externals/wxWidgets3/src/unix/apptraits.cpp b/Externals/wxWidgets3/src/unix/apptraits.cpp index d29f9acdbb..ba2c94629e 100644 --- a/Externals/wxWidgets3/src/unix/apptraits.cpp +++ b/Externals/wxWidgets3/src/unix/apptraits.cpp @@ -28,7 +28,7 @@ #include "wx/utils.h" #endif // WX_PRECOMP -#include "wx/unix/execute.h" +#include "wx/unix/private/execute.h" #include "wx/evtloop.h" // ============================================================================ diff --git a/Externals/wxWidgets3/src/unix/appunix.cpp b/Externals/wxWidgets3/src/unix/appunix.cpp index 62f0c79ec9..df1d72e471 100644 --- a/Externals/wxWidgets3/src/unix/appunix.cpp +++ b/Externals/wxWidgets3/src/unix/appunix.cpp @@ -53,7 +53,7 @@ public: ); } - virtual void OnReadWaiting() + virtual void OnReadWaiting() wxOVERRIDE { // The base class wxWakeUpPipe::OnReadWaiting() needs to be called in order // to read the data out of the wake up pipe and clear it for next time. diff --git a/Externals/wxWidgets3/src/unix/dialup.cpp b/Externals/wxWidgets3/src/unix/dialup.cpp index 95d37b22ef..b17b2f98d9 100644 --- a/Externals/wxWidgets3/src/unix/dialup.cpp +++ b/Externals/wxWidgets3/src/unix/dialup.cpp @@ -78,53 +78,53 @@ public: to call this function and check its result before calling any other wxDialUpManager methods. */ - virtual bool IsOk() const + virtual bool IsOk() const wxOVERRIDE { return true; } /** The simplest way to initiate a dial up: this function dials the given ISP (exact meaning of the parameter depends on the platform), returns true on success or false on failure and logs the appropriate error message in the latter case. - @param nameOfISP optional paramater for dial program + @param nameOfISP optional parameter for dial program @param username unused @param password unused */ virtual bool Dial(const wxString& nameOfISP, const wxString& WXUNUSED(username), const wxString& WXUNUSED(password), - bool async); + bool async) wxOVERRIDE; // Hang up the currently active dial up connection. - virtual bool HangUp(); + virtual bool HangUp() wxOVERRIDE; // returns true if the computer is connected to the network: under Windows, // this just means that a RAS connection exists, under Unix we check that // the "well-known host" (as specified by SetWellKnownHost) is reachable - virtual bool IsOnline() const + virtual bool IsOnline() const wxOVERRIDE { CheckStatus(); return m_IsOnline == Net_Connected; } // do we have a constant net connection? - virtual bool IsAlwaysOnline() const; + virtual bool IsAlwaysOnline() const wxOVERRIDE; // returns true if (async) dialing is in progress - virtual bool IsDialing() const + virtual bool IsDialing() const wxOVERRIDE { return m_DialProcess != NULL; } // cancel dialing the number initiated with Dial(async = true) // NB: this won't result in DISCONNECTED event being sent - virtual bool CancelDialing(); + virtual bool CancelDialing() wxOVERRIDE; - size_t GetISPNames(class wxArrayString &) const + size_t GetISPNames(class wxArrayString &) const wxOVERRIDE { return 0; } // sometimes the built-in logic for determining the online status may fail, // so, in general, the user should be allowed to override it. This function // allows to forcefully set the online status - whatever our internal // algorithm may think about it. - virtual void SetOnlineStatus(bool isOnline = true) + virtual void SetOnlineStatus(bool isOnline = true) wxOVERRIDE { m_IsOnline = isOnline ? Net_Connected : Net_No; } // set misc wxDialUpManager options @@ -137,21 +137,21 @@ public: // instantenous. // // Returns false if couldn't set up automatic check for online status. - virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds); + virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds) wxOVERRIDE; // disable automatic check for connection status change - notice that the // wxEVT_DIALUP_XXX events won't be sent any more neither. - virtual void DisableAutoCheckOnlineStatus(); + virtual void DisableAutoCheckOnlineStatus() wxOVERRIDE; // under Unix, the value of well-known host is used to check whether we're // connected to the internet. It's unused under Windows, but this function // is always safe to call. The default value is www.yahoo.com. virtual void SetWellKnownHost(const wxString& hostname, - int portno = 80); + int portno = 80) wxOVERRIDE; /** Sets the commands to start up the network and to hang up again. Used by the Unix implementations only. */ - virtual void SetConnectCommand(const wxString &command, const wxString &hupcmd) + virtual void SetConnectCommand(const wxString &command, const wxString &hupcmd) wxOVERRIDE { m_ConnectCommand = command; m_HangUpCommand = hupcmd; } //private: -- Sun CC 4.2 objects to using NetConnection enum as the return @@ -246,7 +246,7 @@ public: m_dupman = dupman; } - virtual void Notify() + virtual void Notify() wxOVERRIDE { wxLogTrace(wxT("dialup"), wxT("Checking dial up network status.")); @@ -265,7 +265,7 @@ public: m_DupMan = dupman; } void Disconnect() { m_DupMan = NULL; } - virtual void OnTerminate(int WXUNUSED(pid), int WXUNUSED(status)) + virtual void OnTerminate(int WXUNUSED(pid), int WXUNUSED(status)) wxOVERRIDE { if(m_DupMan) { diff --git a/Externals/wxWidgets3/src/unix/displayx11.cpp b/Externals/wxWidgets3/src/unix/displayx11.cpp index 51f1335d19..0310f2c272 100644 --- a/Externals/wxWidgets3/src/unix/displayx11.cpp +++ b/Externals/wxWidgets3/src/unix/displayx11.cpp @@ -23,55 +23,35 @@ #pragma hdrstop #endif -#if wxUSE_DISPLAY - -#include "wx/display.h" - #ifndef WX_PRECOMP - #include "wx/dynarray.h" - #include "wx/gdicmn.h" - #include "wx/string.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" #endif /* WX_PRECOMP */ +#ifdef __WXGTK20__ + #include // GDK_WINDOWING_X11 +#endif +#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) + #include + #include +#endif + +#if wxUSE_DISPLAY + +#include "wx/display.h" #include "wx/display_impl.h" -#ifdef __WXGTK20__ - #include - #include - - // define the struct with the same fields as XineramaScreenInfo (except for - // screen number which we don't need) but which we can use without - // including Xinerama headers - struct ScreenInfo - { - short x_org; - short y_org; - short width; - short height; - }; -#else // use raw Xinerama functions - /* These must be included after the wx files. Otherwise the Data macro in - * Xlibint.h conflicts with a function declaration in wx/list.h. */ - extern "C" - { - #include - #include +#ifndef __WXGTK20__ #include - } typedef XineramaScreenInfo ScreenInfo; -#endif // GTK+/Xinerama // ---------------------------------------------------------------------------- // helper class storing information about all screens // ---------------------------------------------------------------------------- -// the base class provides access to ScreenInfo array, derived class -// initializes it using either GTK+ or Xinerama functions class ScreensInfoBase { public: @@ -84,36 +64,6 @@ protected: int m_num; }; -#ifdef __WXGTK20__ - -class ScreensInfo : public ScreensInfoBase -{ -public: - ScreensInfo() - { - GdkScreen * const screen = gdk_screen_get_default(); - - m_num = gdk_screen_get_n_monitors(screen); - m_screens = new ScreenInfo[m_num]; - for ( int i = 0; i < m_num; i++ ) - { - GdkRectangle rect; - gdk_screen_get_monitor_geometry(screen, i, &rect); - m_screens[i].x_org = rect.x; - m_screens[i].y_org = rect.y; - m_screens[i].width = rect.width; - m_screens[i].height = rect.height; - } - } - - ~ScreensInfo() - { - delete [] m_screens; - } -}; - -#else // Xinerama - class ScreensInfo : public ScreensInfoBase { public: @@ -128,13 +78,11 @@ public: } }; -#endif // GTK+/Xinerama - // ---------------------------------------------------------------------------- // display and display factory classes // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxDisplayImplX11 : public wxDisplayImpl +class wxDisplayImplX11 : public wxDisplayImpl { public: wxDisplayImplX11(unsigned n, const ScreenInfo& info) @@ -143,8 +91,8 @@ public: { } - virtual wxRect GetGeometry() const { return m_rect; } - virtual wxRect GetClientArea() const + virtual wxRect GetGeometry() const wxOVERRIDE { return m_rect; } + virtual wxRect GetClientArea() const wxOVERRIDE { // we intentionally don't cache the result here because the client // display area may change (e.g. the user resized or hid a panel) and @@ -152,11 +100,11 @@ public: return IsPrimary() ? wxGetClientDisplayRect() : m_rect; } - virtual wxString GetName() const { return wxString(); } + virtual wxString GetName() const wxOVERRIDE { return wxString(); } - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const; - virtual wxVideoMode GetCurrentMode() const; - virtual bool ChangeMode(const wxVideoMode& mode); + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; private: wxRect m_rect; @@ -170,9 +118,9 @@ class wxDisplayFactoryX11 : public wxDisplayFactory public: wxDisplayFactoryX11() { } - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount(); - virtual int GetFromPoint(const wxPoint& pt); + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; protected: wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryX11); @@ -211,11 +159,14 @@ wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n) return n < screens.GetCount() ? new wxDisplayImplX11(n, screens[n]) : NULL; } +#endif // !__WXGTK20__ // ============================================================================ // wxDisplayImplX11 implementation // ============================================================================ +#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) + #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H #include @@ -234,13 +185,8 @@ wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n) #define wxCVM2(v, dc, display, nScreen) wxVideoMode(v.hdisplay, v.vdisplay, DefaultDepth(display, nScreen), wxCRR2(v,dc)) #define wxCVM(v, display, nScreen) wxCVM2(v, v.dotclock, display, nScreen) -wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& mode) const +wxArrayVideoModes wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* display, int nScreen) { - //Convenience... - Display* display = (Display*) wxGetDisplay(); //default display - int nScreen = DefaultScreen(display); //default screen of (default) display... - - //Some variables.. XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) int nNumModes; //Number of modes enumerated.... @@ -269,10 +215,8 @@ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& mode) const return Modes; } -wxVideoMode wxDisplayImplX11::GetCurrentMode() const +wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen) { - Display* display = static_cast(wxGetDisplay()); - int nScreen = DefaultScreen(display); XF86VidModeModeLine VM; int nDotClock; XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM); @@ -280,10 +224,8 @@ wxVideoMode wxDisplayImplX11::GetCurrentMode() const return wxCVM2(VM, nDotClock, display, nScreen); } -bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode) +bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen) { - Display* display = static_cast(wxGetDisplay()); - int nScreen = DefaultScreen(display); XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) int nNumModes; //Number of modes enumerated.... @@ -326,18 +268,42 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode) return bRet; } -#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H - +#ifndef __WXGTK20__ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const +{ + Display* display = static_cast(wxGetDisplay()); + int nScreen = DefaultScreen(display); + return wxXF86VidMode_GetModes(modeMatch, display, nScreen); +} + +wxVideoMode wxDisplayImplX11::GetCurrentMode() const +{ + Display* display = static_cast(wxGetDisplay()); + int nScreen = DefaultScreen(display); + return wxXF86VidMode_GetCurrentMode(display, nScreen); +} + +bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode) +{ + Display* display = static_cast(wxGetDisplay()); + int nScreen = DefaultScreen(display); + return wxXF86VidMode_ChangeMode(mode, display, nScreen); +} +#endif // !__WXGTK20__ + +#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H + +wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display) { int count_return; - int* depths = XListDepths((Display*)wxGetDisplay(), 0, &count_return); + int* depths = XListDepths(display, 0, &count_return); wxArrayVideoModes modes; if ( depths ) { + const wxRect rect = impl->GetGeometry(); for ( int x = 0; x < count_return; ++x ) { - wxVideoMode mode(m_rect.GetWidth(), m_rect.GetHeight(), depths[x]); + wxVideoMode mode(rect.width, rect.height, depths[x]); if ( mode.Matches(modeMatch) ) { modes.Add(mode); @@ -349,6 +315,13 @@ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const return modes; } +#ifndef __WXGTK20__ +wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const +{ + Display* display = static_cast(wxGetDisplay()); + return wxX11_GetModes(this, modeMatch, display); +} + wxVideoMode wxDisplayImplX11::GetCurrentMode() const { // Not implemented @@ -360,115 +333,67 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) // Not implemented return false; } - +#endif // !__WXGTK20__ #endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H +#endif // !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) // ============================================================================ // wxDisplay::CreateFactory() // ============================================================================ +#ifndef __WXGTK20__ /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { - // GTK+ screen functions are always available, no need to check for them -#ifndef __WXGTK20__ if ( !XineramaIsActive((Display*)wxGetDisplay()) ) return new wxDisplayFactorySingle; -#endif return new wxDisplayFactoryX11; } +#endif #endif /* wxUSE_DISPLAY */ -#include "wx/utils.h" - -#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2 || !defined(GDK_WINDOWING_X11) - -void wxClientDisplayRect(int *x, int *y, int *width, int *height) +#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) +void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) { - // TODO: don't hardcode display size - if ( x ) - *x = 0; - if ( y ) - *y = 0; - if ( width ) - *width = 672; - if ( height ) - *height = 396; + Display* display = DisplayOfScreen(screen); + Atom property = XInternAtom(display, "_NET_WORKAREA", true); + if (property) + { + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char* data = NULL; + Status status = XGetWindowProperty( + display, RootWindowOfScreen(screen), property, + 0, 4, false, XA_CARDINAL, + &actual_type, &actual_format, &nitems, &bytes_after, &data); + if (status == Success && actual_type == XA_CARDINAL && + actual_format == 32 && nitems == 4) + { + const long* p = (long*)data; + x = p[0]; + y = p[1]; + width = p[2]; + height = p[3]; + } + if (data) + XFree(data); + } } +#endif // !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) -#else // !wxUSE_LIBHILDON || !wxUSE_LIBHILDON2 +#ifndef __WXGTK20__ -#include "wx/log.h" - -#include -#include - -// TODO: make this a full-fledged class and move to a public header -class wxX11Ptr -{ -public: - wxX11Ptr(void *ptr = NULL) : m_ptr(ptr) { } - ~wxX11Ptr() { if ( m_ptr ) XFree(m_ptr); } - -private: - void *m_ptr; - - wxDECLARE_NO_COPY_CLASS(wxX11Ptr); -}; - -// NB: this function is implemented using X11 and not GDK calls as it's shared -// by wxGTK[12], wxX11 and wxMotif ports void wxClientDisplayRect(int *x, int *y, int *width, int *height) { Display * const dpy = wxGetX11Display(); wxCHECK_RET( dpy, wxT("can't be called before initializing the GUI") ); wxRect rectClient; - - const Atom atomWorkArea = XInternAtom(dpy, "_NET_WORKAREA", True); - if ( atomWorkArea ) - { - long *workareas = NULL; - unsigned long numItems; - unsigned long bytesRemaining; - Atom actualType; - int format; - - if ( XGetWindowProperty - ( - dpy, - XDefaultRootWindow(dpy), - atomWorkArea, - 0, // offset of data to retrieve - 4, // number of items to retrieve - False, // don't delete property - XA_CARDINAL, // type of the items to get - &actualType, - &format, - &numItems, - &bytesRemaining, - (unsigned char **)&workareas - ) == Success && workareas ) - { - wxX11Ptr x11ptr(workareas); // ensure it will be freed - - // check that we retrieved the property of the expected type and - // that we did get back 4 longs (32 is the format for long), as - // requested - if ( actualType != XA_CARDINAL || - format != 32 || - numItems != 4 ) - { - wxLogDebug(wxT("XGetWindowProperty(\"_NET_WORKAREA\") failed")); - } - else - { - rectClient = wxRect(workareas[0], workareas[1], - workareas[2], workareas[3]); - } - } - } + wxGetWorkAreaX11(DefaultScreenOfDisplay(dpy), + rectClient.x, rectClient.y, rectClient.width, rectClient.height); // Although _NET_WORKAREA is supposed to return the client size of the // screen, not all implementations are conforming, apparently, see #14419, @@ -502,5 +427,4 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) if ( height ) *height = rectClient.height; } - -#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON +#endif // !__WXGTK20__ diff --git a/Externals/wxWidgets3/src/unix/dlunix.cpp b/Externals/wxWidgets3/src/unix/dlunix.cpp index 74c2277321..1905c97aca 100644 --- a/Externals/wxWidgets3/src/unix/dlunix.cpp +++ b/Externals/wxWidgets3/src/unix/dlunix.cpp @@ -280,5 +280,26 @@ wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded() return dlls; } + +/* static */ +void* wxDynamicLibrary::GetModuleFromAddress(const void* addr, wxString* path) +{ +#ifdef HAVE_DLADDR + Dl_info di = { 0 }; + + // At least under Solaris dladdr() takes non-const void*. + if ( dladdr(const_cast(addr), &di) == 0 ) + return NULL; + + if ( path ) + *path = di.dli_fname; + + return di.dli_fbase; +#endif // HAVE_DLADDR + + return NULL; +} + + #endif // wxUSE_DYNLIB_CLASS diff --git a/Externals/wxWidgets3/src/unix/evtloopunix.cpp b/Externals/wxWidgets3/src/unix/evtloopunix.cpp index daeac691d1..689b1b136a 100644 --- a/Externals/wxWidgets3/src/unix/evtloopunix.cpp +++ b/Externals/wxWidgets3/src/unix/evtloopunix.cpp @@ -109,7 +109,7 @@ class wxConsoleEventLoopSourcesManager : public wxEventLoopSourcesManagerBase public: wxEventLoopSource* AddSourceForFD( int fd, wxEventLoopSourceHandler *handler, - int flags) + int flags) wxOVERRIDE { wxCHECK_MSG( fd != -1, NULL, "can't monitor invalid fd" ); @@ -201,7 +201,11 @@ int wxConsoleEventLoop::DispatchTimeout(unsigned long timeout) void wxConsoleEventLoop::WakeUp() { +#if wxUSE_THREADS m_wakeupPipe->WakeUp(); +#else + m_wakeupPipe->WakeUpNoLock(); +#endif } void wxConsoleEventLoop::OnNextIteration() @@ -210,6 +214,10 @@ void wxConsoleEventLoop::OnNextIteration() wxTheApp->CheckSignal(); } +void wxConsoleEventLoop::DoYieldFor(long eventsToProcess) +{ + wxEventLoopBase::DoYieldFor(eventsToProcess); +} wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop() { diff --git a/Externals/wxWidgets3/src/unix/fontenum.cpp b/Externals/wxWidgets3/src/unix/fontenum.cpp index cc7ee1dad4..a3db802dc1 100644 --- a/Externals/wxWidgets3/src/unix/fontenum.cpp +++ b/Externals/wxWidgets3/src/unix/fontenum.cpp @@ -41,12 +41,9 @@ #if wxUSE_PANGO -#include "pango/pango.h" +#include -#ifdef __WXGTK20__ -#include "gtk/gtk.h" -extern GtkWidget *wxGetRootWindow(); -#endif // __WXGTK20__ +PangoContext* wxGetPangoContext(); extern "C" { @@ -72,13 +69,8 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, PangoFontFamily **families = NULL; gint n_families = 0; - pango_context_list_families ( -#ifdef __WXGTK20__ - gtk_widget_get_pango_context( wxGetRootWindow() ), -#else - wxTheApp->GetPangoContext(), -#endif - &families, &n_families ); + PangoContext* context = wxGetPangoContext(); + pango_context_list_families(context, &families, &n_families); qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies); for ( int i = 0; i < n_families; i++ ) @@ -93,6 +85,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, } } g_free(families); + g_object_unref(context); return true; } diff --git a/Externals/wxWidgets3/src/unix/fontutil.cpp b/Externals/wxWidgets3/src/unix/fontutil.cpp index 4eecb5009a..22f65947f5 100644 --- a/Externals/wxWidgets3/src/unix/fontutil.cpp +++ b/Externals/wxWidgets3/src/unix/fontutil.cpp @@ -40,11 +40,12 @@ #if wxUSE_PANGO -#include "pango/pango.h" +#include + +PangoContext* wxGetPangoContext(); #ifdef __WXGTK20__ #include "wx/gtk/private.h" - extern GtkWidget *wxGetRootWindow(); #define wxPANGO_CONV wxGTK_CONV_SYS #define wxPANGO_CONV_BACK wxGTK_CONV_BACK_SYS @@ -178,13 +179,8 @@ wxFontFamily wxNativeFontInfo::GetFamily() const PangoFontFamily **families; PangoFontFamily *family = NULL; int n_families; - pango_context_list_families( -#ifdef __WXGTK20__ - gtk_widget_get_pango_context( wxGetRootWindow() ), -#else - wxTheApp->GetPangoContext(), -#endif - &families, &n_families); + PangoContext* context = wxGetPangoContext(); + pango_context_list_families(context, &families, &n_families); for (int i = 0; i < n_families; ++i) { @@ -197,6 +193,7 @@ wxFontFamily wxNativeFontInfo::GetFamily() const } g_free(families); + g_object_unref(context); // Some gtk+ systems might query for a non-existing font from // wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) on initialization, @@ -517,9 +514,9 @@ static wxHashTable *g_fontHash = NULL; static bool wxTestFontSpec(const wxString& fontspec); static wxNativeFont wxLoadQueryFont(int pointSize, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool underlined, const wxString& facename, const wxString& xregistry, @@ -1000,9 +997,9 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info) // ---------------------------------------------------------------------------- wxNativeFont wxLoadQueryNearestFont(int pointSize, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool underlined, const wxString &facename, wxFontEncoding encoding, @@ -1079,17 +1076,17 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // first round: search for equal, then for smaller and for larger size // with the given weight and style - int testweight = weight; - int teststyle = style; + wxFontWeight testweight = weight; + wxFontStyle teststyle = style; for ( round = 0; round < 3; round++ ) { // second round: use normal weight if ( round == 1 ) { - if ( testweight != wxNORMAL ) + if ( testweight != wxFONTWEIGHT_NORMAL ) { - testweight = wxNORMAL; + testweight = wxFONTWEIGHT_NORMAL; } else { @@ -1100,9 +1097,9 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // third round: ... and use normal style if ( round == 2 ) { - if ( teststyle != wxNORMAL ) + if ( teststyle != wxFONTSTYLE_NORMAL ) { - teststyle = wxNORMAL; + teststyle = wxFONTSTYLE_NORMAL; } else { @@ -1127,9 +1124,9 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, } // Try default family - if ( !font && family != wxDEFAULT ) + if ( !font && family != wxFONTFAMILY_DEFAULT ) { - font = wxLoadQueryFont(pointSize, wxDEFAULT, style, weight, + font = wxLoadQueryFont(pointSize, wxFONTFAMILY_DEFAULT, style, weight, underlined, facename, info.xregistry, info.xencoding, xFontName ); @@ -1139,7 +1136,8 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // given facename and encoding if ( !font ) { - font = wxLoadQueryFont(120, wxDEFAULT, wxNORMAL, wxNORMAL, + font = wxLoadQueryFont(120, wxFONTFAMILY_DEFAULT, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, underlined, facename, info.xregistry, info.xencoding, xFontName); @@ -1147,7 +1145,8 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // ignore family as well if ( !font ) { - font = wxLoadQueryFont(120, wxDEFAULT, wxNORMAL, wxNORMAL, + font = wxLoadQueryFont(120, wxFONTFAMILY_DEFAULT, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, underlined, wxEmptyString, info.xregistry, info.xencoding, xFontName); @@ -1158,7 +1157,8 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // different from 120 if ( !font ) { - font = wxLoadQueryFont(-1, wxDEFAULT, wxNORMAL, wxNORMAL, + font = wxLoadQueryFont(-1, wxFONTFAMILY_DEFAULT, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString, info.xregistry, info.xencoding, xFontName); @@ -1170,8 +1170,8 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, { wxFAIL_MSG( wxT("this encoding should be available!") ); - font = wxLoadQueryFont(-1, - wxDEFAULT, wxNORMAL, wxNORMAL, + font = wxLoadQueryFont(-1, wxFONTFAMILY_DEFAULT, + wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString, wxT("*"), wxT("*"), xFontName); @@ -1220,41 +1220,40 @@ static bool wxTestFontSpec(const wxString& fontspec) } static wxNativeFont wxLoadQueryFont(int pointSize, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool WXUNUSED(underlined), const wxString& facename, const wxString& xregistry, const wxString& xencoding, wxString* xFontName) { - wxString xfamily; + wxString xfamily("*"); switch (family) { - case wxDECORATIVE: xfamily = wxT("lucida"); break; - case wxROMAN: xfamily = wxT("times"); break; - case wxMODERN: xfamily = wxT("courier"); break; - case wxSWISS: xfamily = wxT("helvetica"); break; - case wxTELETYPE: xfamily = wxT("lucidatypewriter"); break; - case wxSCRIPT: xfamily = wxT("utopia"); break; - default: xfamily = wxT("*"); + case wxFONTFAMILY_DECORATIVE: xfamily = wxT("lucida"); break; + case wxFONTFAMILY_ROMAN: xfamily = wxT("times"); break; + case wxFONTFAMILY_MODERN: xfamily = wxT("courier"); break; + case wxFONTFAMILY_SWISS: xfamily = wxT("helvetica"); break; + case wxFONTFAMILY_TELETYPE: xfamily = wxT("lucidatypewriter"); break; + case wxFONTFAMILY_SCRIPT: xfamily = wxT("utopia"); break; } #if wxUSE_NANOX int xweight; switch (weight) { - case wxBOLD: + case wxFONTWEIGHT_BOLD: { xweight = MWLF_WEIGHT_BOLD; break; } - case wxLIGHT: + case wxFONTWEIGHT_LIGHT: { xweight = MWLF_WEIGHT_LIGHT; break; } - case wxNORMAL: + case wxFONTWEIGHT_NORMAL: { xweight = MWLF_WEIGHT_NORMAL; break; @@ -1289,7 +1288,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, logFont.lfEscapement = 0; logFont.lfOrientation = 0; logFont.lfWeight = xweight; - logFont.lfItalic = (style == wxNORMAL ? 0 : 1) ; + logFont.lfItalic = (style == wxFONTSTYLE_ITALIC ? 0 : 1) ; logFont.lfUnderline = 0; logFont.lfStrikeOut = 0; logFont.lfCharSet = MWLF_CHARSET_DEFAULT; // TODO: select appropriate one @@ -1327,7 +1326,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, wxString xstyle; switch (style) { - case wxSLANT: + case wxFONTSTYLE_SLANT: fontSpec.Printf(wxT("-*-%s-*-o-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); if ( wxTestFontSpec(fontSpec) ) @@ -1335,18 +1334,18 @@ static wxNativeFont wxLoadQueryFont(int pointSize, xstyle = wxT("o"); break; } - // fall through - try wxITALIC now + // fall through - try wxFONTSTYLE_ITALIC now - case wxITALIC: + case wxFONTSTYLE_ITALIC: fontSpec.Printf(wxT("-*-%s-*-i-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); if ( wxTestFontSpec(fontSpec) ) { xstyle = wxT("i"); } - else if ( style == wxITALIC ) // and not wxSLANT + else if ( style == wxFONTSTYLE_ITALIC ) // and not wxFONTSTYLE_SLANT { - // try wxSLANT + // try wxFONTSTYLE_SLANT fontSpec.Printf(wxT("-*-%s-*-o-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); if ( wxTestFontSpec(fontSpec) ) @@ -1365,7 +1364,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, wxFAIL_MSG(wxT("unknown font style")); // fall back to normal - case wxNORMAL: + case wxFONTSTYLE_NORMAL: xstyle = wxT("r"); break; } @@ -1373,7 +1372,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, wxString xweight; switch (weight) { - case wxBOLD: + case wxFONTWEIGHT_BOLD: { fontSpec.Printf(wxT("-*-%s-bold-*-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); @@ -1419,7 +1418,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, } } break; - case wxLIGHT: + case wxFONTWEIGHT_LIGHT: { fontSpec.Printf(wxT("-*-%s-light-*-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); @@ -1437,7 +1436,7 @@ static wxNativeFont wxLoadQueryFont(int pointSize, } } break; - case wxNORMAL: + case wxFONTWEIGHT_NORMAL: { fontSpec.Printf(wxT("-*-%s-medium-*-*-*-*-*-*-*-*-*-*-*"), xfamily.c_str()); @@ -1501,10 +1500,10 @@ public: void OnExit(); private: - DECLARE_DYNAMIC_CLASS(wxFontModule) + wxDECLARE_DYNAMIC_CLASS(wxFontModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxFontModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxFontModule, wxModule); bool wxFontModule::OnInit() { diff --git a/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp b/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp index 694beecedf..6caeb3ab66 100644 --- a/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp +++ b/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp @@ -433,7 +433,7 @@ protected: // If there's a filespec, assume he's not if ( watch.GetFilespec().empty() ) { - // The the only way to know the path for the first event, + // The only way to know the path for the first event, // normally the IN_MOVED_FROM, is to retrieve the watch // corresponding to oldinevt. This is needed for a move // within a watch. diff --git a/Externals/wxWidgets3/src/unix/fswatcher_kqueue.cpp b/Externals/wxWidgets3/src/unix/fswatcher_kqueue.cpp index 2bc1634dfc..0fd8023474 100644 --- a/Externals/wxWidgets3/src/unix/fswatcher_kqueue.cpp +++ b/Externals/wxWidgets3/src/unix/fswatcher_kqueue.cpp @@ -45,9 +45,9 @@ public: m_service(service) { } - virtual void OnReadWaiting(); - virtual void OnWriteWaiting(); - virtual void OnExceptionWaiting(); + virtual void OnReadWaiting() wxOVERRIDE; + virtual void OnWriteWaiting() wxOVERRIDE; + virtual void OnExceptionWaiting() wxOVERRIDE; protected: wxFSWatcherImplKqueue* m_service; @@ -82,7 +82,7 @@ public: delete m_handler; } - bool Init() + bool Init() wxOVERRIDE { wxCHECK_MSG( !IsOk(), false, "Kqueue appears to be already initialized" ); @@ -117,7 +117,7 @@ public: wxDELETE(m_source); } - virtual bool DoAdd(wxSharedPtr watch) + virtual bool DoAdd(wxSharedPtr watch) wxOVERRIDE { wxCHECK_MSG( IsOk(), false, "Kqueue not initialized or invalid kqueue descriptor" ); @@ -140,7 +140,7 @@ public: return true; } - virtual bool DoRemove(wxSharedPtr watch) + virtual bool DoRemove(wxSharedPtr watch) wxOVERRIDE { wxCHECK_MSG( IsOk(), false, "Kqueue not initialized or invalid kqueue descriptor" ); @@ -157,7 +157,7 @@ public: return true; } - virtual bool RemoveAll() + virtual bool RemoveAll() wxOVERRIDE { wxFSWatchEntries::iterator it = m_watches.begin(); for ( ; it != m_watches.end(); ++it ) @@ -279,8 +279,8 @@ protected: { wxASSERT_MSG(e.udata, "Null user data associated with kevent!"); - wxLogTrace(wxTRACE_FSWATCHER, "Event: ident=%d, filter=%d, flags=%u, " - "fflags=%u, data=%d, user_data=%p", + wxLogTrace(wxTRACE_FSWATCHER, "Event: ident=%llu, filter=%d, flags=%u, " + "fflags=%u, data=%lld, user_data=%lp", e.ident, e.filter, e.flags, e.fflags, e.data, e.udata); // for ease of use diff --git a/Externals/wxWidgets3/src/unix/glx11.cpp b/Externals/wxWidgets3/src/unix/glx11.cpp index ec2bd5b098..65346010c4 100644 --- a/Externals/wxWidgets3/src/unix/glx11.cpp +++ b/Externals/wxWidgets3/src/unix/glx11.cpp @@ -36,34 +36,513 @@ #endif #endif // __SGI__ +// ---------------------------------------------------------------------------- +// define possibly missing XGL constants and types +// ---------------------------------------------------------------------------- + +#ifndef GLX_NONE_EXT +#define GLX_NONE_EXT 0x8000 +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_NONE_EXT 0x8000 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#endif + +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_ARB_framebuffer_sRGB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 +#endif + +/* Typedef for the GL 3.0 context creation function */ +typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) + (Display * dpy, GLXFBConfig config, GLXContext share_context, + Bool direct, const int *attrib_list); + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#endif + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#endif + +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif + +#ifndef GLX_ARB_robustness_application_isolation +#define GLX_ARB_robustness_application_isolation +#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008 +#endif +#ifndef GLX_ARB_robustness_share_group_isolation +#define GLX_ARB_robustness_share_group_isolation +#endif + +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif + +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_EXT_create_context_es2_profile +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef GLX_EXT_create_context_es_profile +#define GLX_EXT_create_context_es_profile +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +// ---------------------------------------------------------------------------- +// wxGLContextAttrs: OpenGL rendering context attributes +// ---------------------------------------------------------------------------- +// GLX specific values + +wxGLContextAttrs& wxGLContextAttrs::CoreProfile() +{ + AddAttribBits(GLX_CONTEXT_PROFILE_MASK_ARB, + GLX_CONTEXT_CORE_PROFILE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MajorVersion(int val) +{ + if ( val > 0 ) + { + AddAttribute(GLX_CONTEXT_MAJOR_VERSION_ARB); + AddAttribute(val); + if ( val >= 3 ) + SetNeedsARB(); + } + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::MinorVersion(int val) +{ + if ( val >= 0 ) + { + AddAttribute(GLX_CONTEXT_MINOR_VERSION_ARB); + AddAttribute(val); + } + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::CompatibilityProfile() +{ + AddAttribBits(GLX_CONTEXT_PROFILE_MASK_ARB, + GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ForwardCompatible() +{ + AddAttribBits(GLX_CONTEXT_FLAGS_ARB, + GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ES2() +{ + AddAttribBits(GLX_CONTEXT_PROFILE_MASK_ARB, + GLX_CONTEXT_ES2_PROFILE_BIT_EXT); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::DebugCtx() +{ + AddAttribBits(GLX_CONTEXT_FLAGS_ARB, + GLX_CONTEXT_DEBUG_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::Robust() +{ + AddAttribBits(GLX_CONTEXT_FLAGS_ARB, + GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::NoResetNotify() +{ + AddAttribute(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); + AddAttribute(GLX_NO_RESET_NOTIFICATION_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::LoseOnReset() +{ + AddAttribute(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); + AddAttribute(GLX_LOSE_CONTEXT_ON_RESET_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ResetIsolation() +{ + AddAttribBits(GLX_CONTEXT_FLAGS_ARB, + GLX_CONTEXT_RESET_ISOLATION_BIT_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::ReleaseFlush(int val) +{ + AddAttribute(GLX_CONTEXT_RELEASE_BEHAVIOR_ARB); + if ( val == 1 ) + AddAttribute(GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB); + else + AddAttribute(GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); + SetNeedsARB(); + return *this; +} + +wxGLContextAttrs& wxGLContextAttrs::PlatformDefaults() +{ + renderTypeRGBA = true; + x11Direct = true; + return *this; +} + +void wxGLContextAttrs::EndList() +{ + AddAttribute(None); +} + +// ---------------------------------------------------------------------------- +// wxGLAttributes: Visual/FBconfig attributes +// ---------------------------------------------------------------------------- +// GLX specific values + +// Different versions of GLX API use rather different attributes lists, see +// the following URLs: +// +// - <= 1.2: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseVisual.xml +// - >= 1.3: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseFBConfig.xml +// +// Notice in particular that +// - GLX_RGBA is boolean attribute in the old version of the API but a +// value of GLX_RENDER_TYPE in the new one +// - Boolean attributes such as GLX_DOUBLEBUFFER don't take values in the +// old version but must be followed by True or False in the new one. + +wxGLAttributes& wxGLAttributes::RGBA() +{ + if ( wxGLCanvasX11::GetGLXVersion() >= 13 ) + AddAttribBits(GLX_RENDER_TYPE, GLX_RGBA_BIT); + else + AddAttribute(GLX_RGBA); + return *this; +} + +wxGLAttributes& wxGLAttributes::BufferSize(int val) +{ + if ( val >= 0 ) + { + AddAttribute(GLX_BUFFER_SIZE); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Level(int val) +{ + AddAttribute(GLX_LEVEL); + AddAttribute(val); + return *this; +} + +wxGLAttributes& wxGLAttributes::DoubleBuffer() +{ + AddAttribute(GLX_DOUBLEBUFFER); + if ( wxGLCanvasX11::GetGLXVersion() >= 13 ) + AddAttribute(True); + return *this; +} + +wxGLAttributes& wxGLAttributes::Stereo() +{ + AddAttribute(GLX_STEREO); + if ( wxGLCanvasX11::GetGLXVersion() >= 13 ) + AddAttribute(True); + return *this; +} + +wxGLAttributes& wxGLAttributes::AuxBuffers(int val) +{ + if ( val >= 0 ) + { + AddAttribute(GLX_AUX_BUFFERS); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + if ( mRed >= 0) + { + AddAttribute(GLX_RED_SIZE); + AddAttribute(mRed); + } + if ( mGreen >= 0) + { + AddAttribute(GLX_GREEN_SIZE); + AddAttribute(mGreen); + } + if ( mBlue >= 0) + { + AddAttribute(GLX_BLUE_SIZE); + AddAttribute(mBlue); + } + if ( mAlpha >= 0) + { + AddAttribute(GLX_ALPHA_SIZE); + AddAttribute(mAlpha); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Depth(int val) +{ + if ( val >= 0 ) + { + AddAttribute(GLX_DEPTH_SIZE); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::Stencil(int val) +{ + if ( val >= 0 ) + { + AddAttribute(GLX_STENCIL_SIZE); + AddAttribute(val); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::MinAcumRGBA(int mRed, int mGreen, int mBlue, int mAlpha) +{ + if ( mRed >= 0) + { + AddAttribute(GLX_ACCUM_RED_SIZE); + AddAttribute(mRed); + } + if ( mGreen >= 0) + { + AddAttribute(GLX_ACCUM_GREEN_SIZE); + AddAttribute(mGreen); + } + if ( mBlue >= 0) + { + AddAttribute(GLX_ACCUM_BLUE_SIZE); + AddAttribute(mBlue); + } + if ( mAlpha >= 0) + { + AddAttribute(GLX_ACCUM_ALPHA_SIZE); + AddAttribute(mAlpha); + } + return *this; +} + +wxGLAttributes& wxGLAttributes::SampleBuffers(int val) +{ +#ifdef GLX_SAMPLE_BUFFERS_ARB + if ( val >= 0 && wxGLCanvasX11::IsGLXMultiSampleAvailable() ) + { + AddAttribute(GLX_SAMPLE_BUFFERS_ARB); + AddAttribute(val); + } +#endif + return *this; +} + +wxGLAttributes& wxGLAttributes::Samplers(int val) +{ +#ifdef GLX_SAMPLES_ARB + if ( val >= 0 && wxGLCanvasX11::IsGLXMultiSampleAvailable() ) + { + AddAttribute(GLX_SAMPLES_ARB); + AddAttribute(val); + } +#endif + return *this; +} + +wxGLAttributes& wxGLAttributes::FrameBuffersRGB() +{ + AddAttribute(GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); + AddAttribute(True); + return *this; +} + +void wxGLAttributes::EndList() +{ + AddAttribute(None); +} + +wxGLAttributes& wxGLAttributes::PlatformDefaults() +{ + // No GLX specific values + return *this; +} + +wxGLAttributes& wxGLAttributes::Defaults() +{ + RGBA().DoubleBuffer(); + if ( wxGLCanvasX11::GetGLXVersion() < 13 ) + Depth(1).MinRGBA(1, 1, 1, 0); + else + Depth(16).SampleBuffers(1).Samplers(4); + return *this; +} + + // ============================================================================ // wxGLContext implementation // ============================================================================ -IMPLEMENT_CLASS(wxGLContext, wxObject) - -wxGLContext::wxGLContext(wxGLCanvas *gc, const wxGLContext *other) +// Need this X error handler for the case context creation fails +static bool g_ctxErrorOccurred = false; +static int CTXErrorHandler( Display* WXUNUSED(dpy), XErrorEvent* WXUNUSED(ev) ) { - if ( wxGLCanvas::GetGLXVersion() >= 13 ) - { - GLXFBConfig *fbc = gc->GetGLXFBConfig(); - wxCHECK_RET( fbc, wxT("invalid GLXFBConfig for OpenGL") ); + g_ctxErrorOccurred = true; + return 0; +} - m_glContext = glXCreateNewContext( wxGetX11Display(), fbc[0], GLX_RGBA_TYPE, +wxIMPLEMENT_CLASS(wxGLContext, wxObject); + +wxGLContext::wxGLContext(wxGLCanvas *win, + const wxGLContext *other, + const wxGLContextAttrs *ctxAttrs) + : m_glContext(NULL) +{ + const int* contextAttribs = NULL; + Bool x11Direct = True; + int renderType = GLX_RGBA_TYPE; + bool needsARB = false; + + if ( ctxAttrs ) + { + contextAttribs = ctxAttrs->GetGLAttrs(); + x11Direct = ctxAttrs->x11Direct; + renderType = ctxAttrs->renderTypeRGBA ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; + needsARB = ctxAttrs->NeedsARB(); + } + else if ( win->GetGLCTXAttrs().GetGLAttrs() ) + { + // If OpenGL context parameters were set at wxGLCanvas ctor, get them now + contextAttribs = win->GetGLCTXAttrs().GetGLAttrs(); + x11Direct = win->GetGLCTXAttrs().x11Direct; + renderType = win->GetGLCTXAttrs().renderTypeRGBA ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; + needsARB = win->GetGLCTXAttrs().NeedsARB(); + } + // else use GPU driver defaults and x11Direct renderType ones + + m_isOk = false; + + Display* dpy = wxGetX11Display(); + XVisualInfo *vi = win->GetXVisualInfo(); + wxCHECK_RET( vi, "invalid visual for OpenGL" ); + + // We need to create a temporary context to get the + // glXCreateContextAttribsARB function + GLXContext tempContext = glXCreateContext(dpy, vi, NULL, + win->GetGLCTXAttrs().x11Direct ); + wxCHECK_RET(tempContext, "glXCreateContext failed" ); + + PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB + = (PFNGLXCREATECONTEXTATTRIBSARBPROC) + glXGetProcAddress((GLubyte *)"glXCreateContextAttribsARB"); + + glXDestroyContext( dpy, tempContext ); + + // The preferred way is using glXCreateContextAttribsARB, even for old context + if ( !glXCreateContextAttribsARB && needsARB ) // OpenGL 3 context creation + { + wxLogMessage(_("OpenGL 3.0 or later is not supported by the OpenGL driver.")); + return; + } + + // Install a X error handler, so as to the app doesn't exit (without + // even a warning) if GL >= 3.0 context creation fails + g_ctxErrorOccurred = false; + int (*oldHandler)(Display*, XErrorEvent*) = XSetErrorHandler(&CTXErrorHandler); + + if ( glXCreateContextAttribsARB ) + { + GLXFBConfig *fbc = win->GetGLXFBConfig(); + wxCHECK_RET( fbc, "Invalid GLXFBConfig for OpenGL" ); + + m_glContext = glXCreateContextAttribsARB( dpy, fbc[0], + other ? other->m_glContext : None, + x11Direct, contextAttribs ); + } + else if ( wxGLCanvas::GetGLXVersion() >= 13 ) + { + GLXFBConfig *fbc = win->GetGLXFBConfig(); + wxCHECK_RET( fbc, "Invalid GLXFBConfig for OpenGL" ); + + m_glContext = glXCreateNewContext( dpy, fbc[0], renderType, other ? other->m_glContext : None, - GL_TRUE ); + x11Direct ); } else // GLX <= 1.2 { - XVisualInfo *vi = gc->GetXVisualInfo(); - wxCHECK_RET( vi, wxT("invalid visual for OpenGL") ); - - m_glContext = glXCreateContext( wxGetX11Display(), vi, + m_glContext = glXCreateContext( dpy, vi, other ? other->m_glContext : None, - GL_TRUE ); + x11Direct ); } - wxASSERT_MSG( m_glContext, wxT("Couldn't create OpenGL context") ); + // Sync to ensure any errors generated are processed. + XSync( dpy, False ); + + if ( g_ctxErrorOccurred || !m_glContext ) + wxLogMessage(_("Couldn't create OpenGL context")); + else + m_isOk = true; + + // Restore old error handler + XSetErrorHandler( oldHandler ); } wxGLContext::~wxGLContext() @@ -113,9 +592,14 @@ wxGLCanvasX11::wxGLCanvasX11() m_vi = NULL; } -bool wxGLCanvasX11::InitVisual(const int *attribList) +bool wxGLCanvasX11::InitVisual(const wxGLAttributes& dispAttrs) { - return InitXVisualInfo(attribList, &m_fbc, &m_vi); + bool ret = InitXVisualInfo(dispAttrs, &m_fbc, &m_vi); + if ( !ret ) + { + wxFAIL_MSG("Failed to get a XVisualInfo for the requested attributes."); + } + return ret; } wxGLCanvasX11::~wxGLCanvasX11() @@ -151,215 +635,30 @@ bool wxGLCanvasX11::IsGLXMultiSampleAvailable() return s_isMultiSampleAvailable != 0; } -bool -wxGLCanvasX11::ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n) -{ - wxCHECK_MSG( n >= 16, false, wxT("GL attributes buffer too small") ); - - /* - Different versions of GLX API use rather different attributes lists, see - the following URLs: - - - <= 1.2: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseVisual.xml - - >= 1.3: http://www.opengl.org/sdk/docs/man/xhtml/glXChooseFBConfig.xml - - Notice in particular that - - GLX_RGBA is boolean attribute in the old version of the API but a - value of GLX_RENDER_TYPE in the new one - - Boolean attributes such as GLX_DOUBLEBUFFER don't take values in the - old version but must be followed by True or False in the new one. - */ - - if ( !wxattrs ) - { - size_t i = 0; - - // use double-buffered true colour by default - glattrs[i++] = GLX_DOUBLEBUFFER; - - if ( GetGLXVersion() < 13 ) - { - // default settings if attriblist = 0 - glattrs[i++] = GLX_RGBA; - glattrs[i++] = GLX_DEPTH_SIZE; glattrs[i++] = 1; - glattrs[i++] = GLX_RED_SIZE; glattrs[i++] = 1; - glattrs[i++] = GLX_GREEN_SIZE; glattrs[i++] = 1; - glattrs[i++] = GLX_BLUE_SIZE; glattrs[i++] = 1; - glattrs[i++] = GLX_ALPHA_SIZE; glattrs[i++] = 0; - } - else // recent GLX can choose the defaults on its own just fine - { - // we just need to have a value after GLX_DOUBLEBUFFER - glattrs[i++] = True; - } - - glattrs[i] = None; - - wxASSERT_MSG( i < n, wxT("GL attributes buffer too small") ); - } - else // have non-default attributes - { - size_t p = 0; - for ( int arg = 0; wxattrs[arg] != 0; ) - { - // check if we have any space left, knowing that we may insert 2 - // more elements during this loop iteration and we always need to - // terminate the list with None (hence -3) - if ( p > n - 3 ) - return false; - - // indicates whether we have a boolean attribute - bool isBoolAttr = false; - - switch ( wxattrs[arg++] ) - { - case WX_GL_BUFFER_SIZE: - glattrs[p++] = GLX_BUFFER_SIZE; - break; - - case WX_GL_LEVEL: - glattrs[p++] = GLX_LEVEL; - break; - - case WX_GL_RGBA: - if ( GetGLXVersion() >= 13 ) - { - // this is the default GLX_RENDER_TYPE anyhow - continue; - } - - glattrs[p++] = GLX_RGBA; - isBoolAttr = true; - break; - - case WX_GL_DOUBLEBUFFER: - glattrs[p++] = GLX_DOUBLEBUFFER; - isBoolAttr = true; - break; - - case WX_GL_STEREO: - glattrs[p++] = GLX_STEREO; - isBoolAttr = true; - break; - - case WX_GL_AUX_BUFFERS: - glattrs[p++] = GLX_AUX_BUFFERS; - break; - - case WX_GL_MIN_RED: - glattrs[p++] = GLX_RED_SIZE; - break; - - case WX_GL_MIN_GREEN: - glattrs[p++] = GLX_GREEN_SIZE; - break; - - case WX_GL_MIN_BLUE: - glattrs[p++] = GLX_BLUE_SIZE; - break; - - case WX_GL_MIN_ALPHA: - glattrs[p++] = GLX_ALPHA_SIZE; - break; - - case WX_GL_DEPTH_SIZE: - glattrs[p++] = GLX_DEPTH_SIZE; - break; - - case WX_GL_STENCIL_SIZE: - glattrs[p++] = GLX_STENCIL_SIZE; - break; - - case WX_GL_MIN_ACCUM_RED: - glattrs[p++] = GLX_ACCUM_RED_SIZE; - break; - - case WX_GL_MIN_ACCUM_GREEN: - glattrs[p++] = GLX_ACCUM_GREEN_SIZE; - break; - - case WX_GL_MIN_ACCUM_BLUE: - glattrs[p++] = GLX_ACCUM_BLUE_SIZE; - break; - - case WX_GL_MIN_ACCUM_ALPHA: - glattrs[p++] = GLX_ACCUM_ALPHA_SIZE; - break; - - case WX_GL_SAMPLE_BUFFERS: -#ifdef GLX_SAMPLE_BUFFERS_ARB - if ( IsGLXMultiSampleAvailable() ) - { - glattrs[p++] = GLX_SAMPLE_BUFFERS_ARB; - break; - } -#endif // GLX_SAMPLE_BUFFERS_ARB - // if it was specified just to disable it, no problem - if ( !wxattrs[arg++] ) - continue; - - // otherwise indicate that it's not supported - return false; - - case WX_GL_SAMPLES: -#ifdef GLX_SAMPLES_ARB - if ( IsGLXMultiSampleAvailable() ) - { - glattrs[p++] = GLX_SAMPLES_ARB; - break; - } -#endif // GLX_SAMPLES_ARB - - if ( !wxattrs[arg++] ) - continue; - - return false; - - default: - wxLogDebug(wxT("Unsupported OpenGL attribute %d"), - wxattrs[arg - 1]); - continue; - } - - if ( isBoolAttr ) - { - // as explained above, for pre 1.3 API the attribute just needs - // to be present so we only add its value when using the new API - if ( GetGLXVersion() >= 13 ) - glattrs[p++] = True; - } - else // attribute with real (non-boolean) value - { - // copy attribute value as is - glattrs[p++] = wxattrs[arg++]; - } - } - - glattrs[p] = None; - } - - return true; -} /* static */ -bool -wxGLCanvasX11::InitXVisualInfo(const int *attribList, - GLXFBConfig **pFBC, - XVisualInfo **pXVisual) +bool wxGLCanvasX11::InitXVisualInfo(const wxGLAttributes& dispAttrs, + GLXFBConfig** pFBC, + XVisualInfo** pXVisual) { - int data[512]; - if ( !ConvertWXAttrsToGL(attribList, data, WXSIZEOF(data)) ) + // GLX_XX attributes + const int* attrsListGLX = dispAttrs.GetGLAttrs(); + if ( !attrsListGLX ) + { + wxFAIL_MSG("wxGLAttributes object is empty."); return false; + } - Display * const dpy = wxGetX11Display(); + Display* dpy = wxGetX11Display(); if ( GetGLXVersion() >= 13 ) { int returned; - *pFBC = glXChooseFBConfig(dpy, DefaultScreen(dpy), data, &returned); + *pFBC = glXChooseFBConfig(dpy, DefaultScreen(dpy), attrsListGLX, &returned); if ( *pFBC ) { + // Use the first good match *pXVisual = glXGetVisualFromFBConfig(wxGetX11Display(), **pFBC); if ( !*pXVisual ) { @@ -371,21 +670,20 @@ wxGLCanvasX11::InitXVisualInfo(const int *attribList, else // GLX <= 1.2 { *pFBC = NULL; - *pXVisual = glXChooseVisual(dpy, DefaultScreen(dpy), data); + *pXVisual = glXChooseVisual(dpy, DefaultScreen(dpy), + wx_const_cast(int*, attrsListGLX) ); } return *pXVisual != NULL; } /* static */ -bool -wxGLCanvasBase::IsDisplaySupported(const int *attribList) +bool wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) { GLXFBConfig *fbc = NULL; XVisualInfo *vi = NULL; - const bool - isSupported = wxGLCanvasX11::InitXVisualInfo(attribList, &fbc, &vi); + bool isSupported = wxGLCanvasX11::InitXVisualInfo(dispAttrs, &fbc, &vi); if ( fbc ) XFree(fbc); @@ -395,6 +693,15 @@ wxGLCanvasBase::IsDisplaySupported(const int *attribList) return isSupported; } +/* static */ +bool wxGLCanvasBase::IsDisplaySupported(const int *attribList) +{ + wxGLAttributes dispAttrs; + ParseAttribList(attribList, dispAttrs); + + return IsDisplaySupported(dispAttrs); +} + // ---------------------------------------------------------------------------- // default visual management // ---------------------------------------------------------------------------- @@ -406,8 +713,10 @@ GLXFBConfig *wxGLCanvasX11::ms_glFBCInfo = NULL; bool wxGLCanvasX11::InitDefaultVisualInfo(const int *attribList) { FreeDefaultVisualInfo(); + wxGLAttributes dispAttrs; + ParseAttribList(attribList, dispAttrs); - return InitXVisualInfo(attribList, &ms_glFBCInfo, &ms_glVisualInfo); + return InitXVisualInfo(dispAttrs, &ms_glFBCInfo, &ms_glVisualInfo); } /* static */ diff --git a/Externals/wxWidgets3/src/unix/joystick.cpp b/Externals/wxWidgets3/src/unix/joystick.cpp index cf9cc33b3e..928e9f6fc9 100644 --- a/Externals/wxWidgets3/src/unix/joystick.cpp +++ b/Externals/wxWidgets3/src/unix/joystick.cpp @@ -52,7 +52,7 @@ enum { }; -IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) +wxIMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject); //////////////////////////////////////////////////////////////////////////// @@ -63,7 +63,7 @@ class wxJoystickThread : public wxThread { public: wxJoystickThread(int device, int joystick); - void* Entry(); + void* Entry() wxOVERRIDE; private: void SendEvent(wxEventType type, long ts, int change = 0); @@ -129,7 +129,12 @@ void* wxJoystickThread::Entry() if (wxFD_ISSET(m_device, &read_fds)) { memset(&j_evt, 0, sizeof(j_evt)); - read(m_device, &j_evt, sizeof(j_evt)); + if ( read(m_device, &j_evt, sizeof(j_evt)) == -1 ) + { + // We can hardly do anything other than ignoring the error and + // hope that we read the next event successfully. + continue; + } //printf("time: %d\t value: %d\t type: %d\t number: %d\n", // j_evt.time, j_evt.value, j_evt.type, j_evt.number); @@ -187,7 +192,6 @@ void* wxJoystickThread::Entry() } } - close(m_device); return NULL; } @@ -226,7 +230,8 @@ wxJoystick::~wxJoystick() ReleaseCapture(); if (m_thread) m_thread->Delete(); // It's detached so it will delete itself - m_device = -1; + if (m_device != -1) + close(m_device); } diff --git a/Externals/wxWidgets3/src/unix/mediactrl.cpp b/Externals/wxWidgets3/src/unix/mediactrl.cpp index f01b1f15fd..c38c20efd6 100644 --- a/Externals/wxWidgets3/src/unix/mediactrl.cpp +++ b/Externals/wxWidgets3/src/unix/mediactrl.cpp @@ -11,20 +11,16 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#if wxUSE_MEDIACTRL +#if wxUSE_MEDIACTRL && wxUSE_GSTREAMER && !wxUSE_GSTREAMER_PLAYER #include "wx/mediactrl.h" -#if wxUSE_GSTREAMER - #include // main gstreamer header -// xoverlay/video stuff, gst-gconf for 0.8 -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 -# include +#if GST_CHECK_VERSION(1,0,0) +#include #else -# include -# include // gstreamer glib configuration +#include #endif #ifndef WX_PRECOMP @@ -48,11 +44,11 @@ //----------------------------------------------------------------------------- /* - This is the GStreamer backend for unix. Currently we require 0.8 or - 0.10. Here we use the "playbin" GstElement for ease of use. + This is the GStreamer backend for unix. Currently we require 0.10. + Here we use the "playbin" GstElement for ease of use. - Note that now we compare state change functions to GST_STATE_FAILURE - now rather than GST_STATE_SUCCESS as newer gstreamer versions return + Note that now we compare state change functions to GST_STATE_CHANGE_FAILURE + now rather than GST_STATE_CHANGE_SUCCESS as newer gstreamer versions return non-success values for returns that are otherwise successful but not immediate. @@ -89,44 +85,6 @@ // Declarations //============================================================================= -//----------------------------------------------------------------------------- -// GStreamer (most version compatibility) macros -//----------------------------------------------------------------------------- - -// In 0.9 there was a HUGE change to GstQuery and the -// gst_element_query function changed dramatically and split off -// into two separate ones -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8 -# define wxGst_element_query_duration(e, f, p) \ - gst_element_query(e, GST_QUERY_TOTAL, f, p) -# define wxGst_element_query_position(e, f, p) \ - gst_element_query(e, GST_QUERY_POSITION, f, p) -#elif GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 9 -// However, the actual 0.9 version has a slightly different definition -// and instead of gst_element_query_duration it has two parameters to -// gst_element_query_position instead -# define wxGst_element_query_duration(e, f, p) \ - gst_element_query_position(e, f, 0, p) -# define wxGst_element_query_position(e, f, p) \ - gst_element_query_position(e, f, p, 0) -#else -# define wxGst_element_query_duration \ - gst_element_query_duration -# define wxGst_element_query_position \ - gst_element_query_position -#endif - -// Other 0.10 macros -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 -# define GST_STATE_FAILURE GST_STATE_CHANGE_FAILURE -# define GST_STATE_SUCCESS GST_STATE_CHANGE_SUCCESS -# define GstElementState GstState -# define gst_gconf_get_default_video_sink() \ - gst_element_factory_make ("gconfvideosink", "video-sink"); -# define gst_gconf_get_default_audio_sink() \ - gst_element_factory_make ("gconfaudiosink", "audio-sink"); -#endif - // Max wait time for element state waiting - GST_CLOCK_TIME_NONE for inf #define wxGSTREAMER_TIMEOUT (100 * GST_MSECOND) // Max 100 milliseconds @@ -154,46 +112,46 @@ public: const wxSize& size, long style, const wxValidator& validator, - const wxString& name); + const wxString& name) wxOVERRIDE; - virtual bool Play(); - virtual bool Pause(); - virtual bool Stop(); + virtual bool Play() wxOVERRIDE; + virtual bool Pause() wxOVERRIDE; + virtual bool Stop() wxOVERRIDE; - virtual bool Load(const wxString& fileName); - virtual bool Load(const wxURI& location); + virtual bool Load(const wxString& fileName) wxOVERRIDE; + virtual bool Load(const wxURI& location) wxOVERRIDE; virtual bool Load(const wxURI& location, - const wxURI& proxy) + const wxURI& proxy) wxOVERRIDE { return wxMediaBackendCommonBase::Load(location, proxy); } - virtual wxMediaState GetState(); + virtual wxMediaState GetState() wxOVERRIDE; - virtual bool SetPosition(wxLongLong where); - virtual wxLongLong GetPosition(); - virtual wxLongLong GetDuration(); + virtual bool SetPosition(wxLongLong where) wxOVERRIDE; + virtual wxLongLong GetPosition() wxOVERRIDE; + virtual wxLongLong GetDuration() wxOVERRIDE; - virtual void Move(int x, int y, int w, int h); - wxSize GetVideoSize() const; + virtual void Move(int x, int y, int w, int h) wxOVERRIDE; + wxSize GetVideoSize() const wxOVERRIDE; - virtual double GetPlaybackRate(); - virtual bool SetPlaybackRate(double dRate); + virtual double GetPlaybackRate() wxOVERRIDE; + virtual bool SetPlaybackRate(double dRate) wxOVERRIDE; - virtual wxLongLong GetDownloadProgress(); - virtual wxLongLong GetDownloadTotal(); + virtual wxLongLong GetDownloadProgress() wxOVERRIDE; + virtual wxLongLong GetDownloadTotal() wxOVERRIDE; - virtual bool SetVolume(double dVolume); - virtual double GetVolume(); + virtual bool SetVolume(double dVolume) wxOVERRIDE; + virtual double GetVolume() wxOVERRIDE; //------------implementation from now on----------------------------------- bool CheckForErrors(); bool DoLoad(const wxString& locstring); wxMediaCtrl* GetControl() { return m_ctrl; } // for C Callbacks - void HandleStateChange(GstElementState oldstate, GstElementState newstate); + void HandleStateChange(GstState oldstate, GstState newstate); bool QueryVideoSizeFromElement(GstElement* element); bool QueryVideoSizeFromPad(GstPad* caps); void SetupXOverlay(); - bool SyncStateChange(GstElement* element, GstElementState state, + bool SyncStateChange(GstElement* element, GstState state, gint64 llTimeout = wxGSTREAMER_TIMEOUT); bool TryAudioSink(GstElement* audiosink); bool TryVideoSink(GstElement* videosink); @@ -203,7 +161,11 @@ public: double m_dRate; // Current playback rate - // see GetPlaybackRate for notes wxLongLong m_llPausedPos; // Paused position - see Pause() +#if GST_CHECK_VERSION(1,0,0) + GstVideoOverlay* m_xoverlay; // X Overlay that contains the GST video +#else GstXOverlay* m_xoverlay; // X Overlay that contains the GST video +#endif wxMutex m_asynclock; // See "discussion of internals" class wxGStreamerMediaEventHandler* m_eventHandler; // see below @@ -226,7 +188,7 @@ public: friend class wxGStreamerMediaEventHandler; friend class wxGStreamerLoadWaitTimer; - DECLARE_DYNAMIC_CLASS(wxGStreamerMediaBackend) + wxDECLARE_DYNAMIC_CLASS(wxGStreamerMediaBackend); }; //----------------------------------------------------------------------------- @@ -256,7 +218,7 @@ class wxGStreamerMediaEventHandler : public wxEvtHandler // Implementation //============================================================================= -IMPLEMENT_DYNAMIC_CLASS(wxGStreamerMediaBackend, wxMediaBackend) +wxIMPLEMENT_DYNAMIC_CLASS(wxGStreamerMediaBackend, wxMediaBackend); //----------------------------------------------------------------------------- // @@ -294,7 +256,11 @@ expose_event(GtkWidget* widget, GdkEventExpose* event, wxGStreamerMediaBackend* // GST Doesn't redraw automatically while paused // Plus, the video sometimes doesn't redraw when it looses focus // or is painted over so we just tell it to redraw... +#if GST_CHECK_VERSION(1,0,0) + gst_video_overlay_expose(be->m_xoverlay); +#else gst_x_overlay_expose(be->m_xoverlay); +#endif } else { @@ -334,45 +300,26 @@ static gint gtk_window_realize_callback(GtkWidget* widget, GdkWindow* window = gtk_widget_get_window(widget); wxASSERT(window); +#if GST_CHECK_VERSION(1,0,0) + gst_video_overlay_set_window_handle(be->m_xoverlay, + GDK_WINDOW_XID(window) + ); +#else gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(be->m_xoverlay), GDK_WINDOW_XID(window) ); - g_signal_connect (be->GetControl()->m_wxwindow, -#ifdef __WXGTK3__ - "draw", G_CALLBACK(draw), -#else - "expose_event", G_CALLBACK(expose_event), #endif - be); + GtkWidget* w = be->GetControl()->m_wxwindow; +#ifdef __WXGTK3__ + g_signal_connect(w, "draw", G_CALLBACK(draw), be); +#else + g_signal_connect(w, "expose_event", G_CALLBACK(expose_event), be); +#endif return 0; } } #endif // wxGTK -//----------------------------------------------------------------------------- -// "state-change" from m_playbin/GST_MESSAGE_STATE_CHANGE -// -// Called by gstreamer when the state changes - here we -// send the appropriate corresponding wx event. -// -// 0.8 only as HandleStateChange does this in both versions -//----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 -extern "C" { -static void gst_state_change_callback(GstElement *play, - GstElementState oldstate, - GstElementState newstate, - wxGStreamerMediaBackend* be) -{ - if(be->m_asynclock.TryLock() == wxMUTEX_NO_ERROR) - { - be->HandleStateChange(oldstate, newstate); - be->m_asynclock.Unlock(); - } -} -} -#endif // <0.10 - //----------------------------------------------------------------------------- // "eos" from m_playbin/GST_MESSAGE_EOS // @@ -425,6 +372,7 @@ static void gst_notify_caps_callback(GstPad* pad, } } +#if !GST_CHECK_VERSION(1,0,0) //----------------------------------------------------------------------------- // "notify::stream-info" from m_playbin // @@ -437,7 +385,6 @@ static void gst_notify_caps_callback(GstPad* pad, // // (Undocumented?) //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 extern "C" { static void gst_notify_stream_info_callback(GstElement* WXUNUSED(element), GParamSpec* WXUNUSED(pspec), @@ -449,32 +396,6 @@ static void gst_notify_stream_info_callback(GstElement* WXUNUSED(element), } #endif -//----------------------------------------------------------------------------- -// "desired-size-changed" from m_xoverlay -// -// 0.8-specific this provides us with the video size when it changes - -// even though we get the caps as well this seems to come before the -// caps notification does... -// -// Note it will return 16,16 for an early-bird value or for audio -//----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 -extern "C" { -static void gst_desired_size_changed_callback(GstElement * play, - guint width, guint height, - wxGStreamerMediaBackend* be) -{ - if(!(width == 16 && height == 16)) - { - be->m_videoSize.x = width; - be->m_videoSize.y = height; - } - else - be->QueryVideoSizeFromElement(be->m_playbin); -} -} -#endif - //----------------------------------------------------------------------------- // gst_bus_async_callback [static] // gst_bus_sync_callback [static] @@ -488,7 +409,6 @@ static void gst_desired_size_changed_callback(GstElement * play, // thread before the async version that we use to set the xwindow id of the // XOverlay (NB: This isn't currently used - see CreateControl()). //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 extern "C" { static gboolean gst_bus_async_callback(GstBus* WXUNUSED(bus), GstMessage* message, @@ -538,8 +458,12 @@ static GstBusSyncReply gst_bus_sync_callback(GstBus* bus, { // Pass a non-xwindowid-setting event on to the async handler where it // belongs +#if GST_CHECK_VERSION(1,0,0) + if (!gst_is_video_overlay_prepare_window_handle_message (message)) +#else if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT || !gst_structure_has_name (message->structure, "prepare-xwindow-id")) +#endif { // // NB: Unfortunately, the async callback can be quite @@ -558,7 +482,6 @@ static GstBusSyncReply gst_bus_sync_callback(GstBus* bus, return GST_BUS_DROP; // We handled this message - drop from the queue } } -#endif //----------------------------------------------------------------------------- // @@ -573,8 +496,8 @@ static GstBusSyncReply gst_bus_sync_callback(GstBus* bus, // the async queue in 0.10. (Mostly this is here to avoid locking the // the mutex twice...) //----------------------------------------------------------------------------- -void wxGStreamerMediaBackend::HandleStateChange(GstElementState oldstate, - GstElementState newstate) +void wxGStreamerMediaBackend::HandleStateChange(GstState oldstate, + GstState newstate) { switch(newstate) { @@ -604,6 +527,7 @@ void wxGStreamerMediaBackend::HandleStateChange(GstElementState oldstate, } } +#if !GST_CHECK_VERSION(1,0,0) //----------------------------------------------------------------------------- // wxGStreamerMediaBackend::QueryVideoSizeFromElement // @@ -643,14 +567,6 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) else g_object_get (info, "object", &pad, NULL); -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR <= 8 - // Killed in 0.9, presumely because events and such - // should be pushed on pads regardless of whether they - // are currently linked - pad = (GstPad *) GST_PAD_REALIZE (pad); - wxASSERT(pad); -#endif - if(!QueryVideoSizeFromPad(pad)) { // wait for those caps to get ready @@ -673,6 +589,7 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) return true; } +#endif //----------------------------------------------------------------------------- // wxGStreamerMediaBackend::QueryVideoSizeFromPad @@ -681,7 +598,11 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromElement(GstElement* element) //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::QueryVideoSizeFromPad(GstPad* pad) { +#if GST_CHECK_VERSION(1,0,0) + GstCaps* caps = gst_pad_get_current_caps(pad); +#else const GstCaps* caps = GST_PAD_CAPS(pad); +#endif if ( caps ) { const GstStructure *s = gst_caps_get_structure (caps, 0); @@ -707,11 +628,21 @@ bool wxGStreamerMediaBackend::QueryVideoSizeFromPad(GstPad* pad) m_videoSize.y = (int) ((float) den * m_videoSize.y / num); } - wxLogTrace(wxTRACE_GStreamer, wxT("Adjusted video size: [%i,%i]"), - m_videoSize.x, m_videoSize.y); + wxLogTrace(wxTRACE_GStreamer, wxT("Adjusted video size: [%i,%i]"), + m_videoSize.x, m_videoSize.y); +#if GST_CHECK_VERSION(1,0,0) + gst_caps_unref (caps); +#endif + + NotifyMovieSizeChanged (); + return true; } // end if caps + m_videoSize = wxSize(0,0); + + NotifyMovieSizeChanged (); + return false; // not ready/massive failure } @@ -740,7 +671,11 @@ void wxGStreamerMediaBackend::SetupXOverlay() GdkWindow* window = gtk_widget_get_window(m_ctrl->m_wxwindow); wxASSERT(window); #endif +#if GST_CHECK_VERSION(1,0,0) + gst_video_overlay_set_window_handle(m_xoverlay, +#else gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_xoverlay), +#endif #ifdef __WXGTK__ GDK_WINDOW_XID(window) #else @@ -748,13 +683,12 @@ void wxGStreamerMediaBackend::SetupXOverlay() #endif ); #ifdef __WXGTK__ - g_signal_connect(m_ctrl->m_wxwindow, + GtkWidget* w = m_ctrl->m_wxwindow; #ifdef __WXGTK3__ - "draw", G_CALLBACK(draw), + g_signal_connect(w, "draw", G_CALLBACK(draw), this); #else - "expose_event", G_CALLBACK(expose_event), + g_signal_connect(w, "expose_event", G_CALLBACK(expose_event), this); #endif - this); } // end if GtkPizza realized #endif } @@ -771,9 +705,8 @@ void wxGStreamerMediaBackend::SetupXOverlay() // // PRECONDITION: Assumes m_asynclock is Lock()ed //----------------------------------------------------------------------------- -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, - GstElementState desiredstate, + GstState desiredstate, gint64 llTimeout) { GstBus* bus = gst_element_get_bus(element); @@ -846,23 +779,6 @@ bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, return bSuccess; } -#else // 0.8 implementation -bool wxGStreamerMediaBackend::SyncStateChange(GstElement* element, - GstElementState desiredstate, - gint64 llTimeout) -{ - gint64 llTimeWaited = 0; - while(GST_STATE(element) != desiredstate) - { - if(llTimeWaited >= llTimeout) - break; - llTimeWaited += 10*GST_MSECOND; - wxMilliSleep(10); - } - - return llTimeWaited != llTimeout; -} -#endif //----------------------------------------------------------------------------- // wxGStreamerMediaBackend::TryAudioSink @@ -886,6 +802,31 @@ bool wxGStreamerMediaBackend::TryAudioSink(GstElement* audiosink) bool wxGStreamerMediaBackend::TryVideoSink(GstElement* videosink) { +#if GST_CHECK_VERSION(1,0,0) + // Check if the video sink either is an xoverlay or might contain one... + if( !GST_IS_BIN(videosink) && !GST_IS_VIDEO_OVERLAY(videosink) ) + { + if(G_IS_OBJECT(videosink)) + g_object_unref(videosink); + return false; + } + + // Make our video sink and make sure it supports the x overlay interface + // the x overlay enables us to put the video in our control window + // (i.e. we NEED it!) - also connect to the natural video size change event + if( GST_IS_BIN(videosink) ) + m_xoverlay = (GstVideoOverlay*) + gst_bin_get_by_interface (GST_BIN (videosink), + GST_TYPE_VIDEO_OVERLAY); + else + m_xoverlay = (GstVideoOverlay*) videosink; + + if ( !GST_IS_VIDEO_OVERLAY(m_xoverlay) ) + { + g_object_unref(videosink); + return false; + } +#else // Check if the video sink either is an xoverlay or might contain one... if( !GST_IS_BIN(videosink) && !GST_IS_X_OVERLAY(videosink) ) { @@ -909,7 +850,7 @@ bool wxGStreamerMediaBackend::TryVideoSink(GstElement* videosink) g_object_unref(videosink); return false; } - +#endif return true; } @@ -1048,11 +989,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, //Really init gstreamer gboolean bInited; GError* error = NULL; -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 bInited = gst_init_check(&argcGST, &argvGST, &error); -#else - bInited = gst_init_check(&argcGST, &argvGST); -#endif // Cleanup arguments for unicode case #if wxUSE_UNICODE @@ -1119,29 +1056,25 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, return false; } -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 - // Connect the glib events/callbacks we want to our playbin - g_signal_connect(m_playbin, "eos", - G_CALLBACK(gst_finish_callback), this); - g_signal_connect(m_playbin, "error", - G_CALLBACK(gst_error_callback), this); - g_signal_connect(m_playbin, "state-change", - G_CALLBACK(gst_state_change_callback), this); -#else // GStreamer 0.10+ uses GstBus for this now, connect to the sync // handler as well so we can set the X window id of our xoverlay gst_bus_add_watch (gst_element_get_bus(m_playbin), (GstBusFunc) gst_bus_async_callback, this); +#if GST_CHECK_VERSION(1,0,0) + gst_bus_set_sync_handler(gst_element_get_bus(m_playbin), + (GstBusSyncHandler) gst_bus_sync_callback, this, NULL); +#else gst_bus_set_sync_handler(gst_element_get_bus(m_playbin), (GstBusSyncHandler) gst_bus_sync_callback, this); - g_signal_connect(m_playbin, "notify::stream-info", - G_CALLBACK(gst_notify_stream_info_callback), this); #endif // Get the audio sink - GstElement* audiosink = gst_gconf_get_default_audio_sink(); + GstElement* audiosink; +#if !GST_CHECK_VERSION(1,0,0) + audiosink = gst_element_factory_make ("gconfaudiosink", "audio-sink"); if( !TryAudioSink(audiosink) ) { +#endif // fallback to autodetection, then alsa, then oss as a stopgap audiosink = gst_element_factory_make ("autoaudiosink", "audio-sink"); if( !TryAudioSink(audiosink) ) @@ -1157,13 +1090,18 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, } } } +#if !GST_CHECK_VERSION(1,0,0) } +#endif // Setup video sink - first try gconf, then auto, then xvimage and // then finally plain ximage - GstElement* videosink = gst_gconf_get_default_video_sink(); + GstElement* videosink; +#if !GST_CHECK_VERSION(1,0,0) + videosink = gst_element_factory_make ("gconfvideosink", "video-sink"); if( !TryVideoSink(videosink) ) { +#endif videosink = gst_element_factory_make ("autovideosink", "video-sink"); if( !TryVideoSink(videosink) ) { @@ -1181,13 +1119,19 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, } } } +#if !GST_CHECK_VERSION(1,0,0) } - -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR < 10 - // Not on 0.10... called when video size changes - g_signal_connect(m_xoverlay, "desired-size-changed", - G_CALLBACK(gst_desired_size_changed_callback), this); #endif + +#if GST_CHECK_VERSION(1,0,0) + GstPad *video_sinkpad = gst_element_get_static_pad (videosink, "sink"); + g_signal_connect (video_sinkpad, "notify::caps", G_CALLBACK (gst_notify_caps_callback), this); + gst_object_unref (video_sinkpad); +#else + g_signal_connect(m_playbin, "notify::stream-info", + G_CALLBACK(gst_notify_stream_info_callback), this); +#endif + // Tell GStreamer which window to draw to in 0.8 - 0.10 // sometimes needs this too... SetupXOverlay(); @@ -1223,6 +1167,7 @@ bool wxGStreamerMediaBackend::Load(const wxString& fileName) //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::Load(const wxURI& location) { +#if !GST_CHECK_VERSION(1,0,0) if(location.GetScheme().CmpNoCase(wxT("file")) == 0) { wxString uristring = location.BuildUnescapedURI(); @@ -1234,6 +1179,7 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location) ); } else +#endif return DoLoad(location.BuildURI()); } @@ -1260,7 +1206,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) // Set playbin to ready to stop the current media... if( gst_element_set_state (m_playbin, - GST_STATE_READY) == GST_STATE_FAILURE || + GST_STATE_READY) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_READY)) { CheckForErrors(); @@ -1283,7 +1229,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) // Try to pause media as gstreamer won't let us query attributes // such as video size unless it is paused or playing if( gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE || + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_PAUSED)) { CheckForErrors(); @@ -1314,7 +1260,7 @@ bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) bool wxGStreamerMediaBackend::Play() { if (gst_element_set_state (m_playbin, - GST_STATE_PLAYING) == GST_STATE_FAILURE) + GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { CheckForErrors(); return false; @@ -1334,7 +1280,7 @@ bool wxGStreamerMediaBackend::Pause() { m_llPausedPos = wxGStreamerMediaBackend::GetPosition(); if (gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE) + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) { CheckForErrors(); return false; @@ -1355,7 +1301,7 @@ bool wxGStreamerMediaBackend::Stop() { // begin state lock wxMutexLocker lock(m_asynclock); if(gst_element_set_state (m_playbin, - GST_STATE_PAUSED) == GST_STATE_FAILURE || + GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE || !SyncStateChange(m_playbin, GST_STATE_PAUSED)) { CheckForErrors(); @@ -1419,11 +1365,17 @@ wxLongLong wxGStreamerMediaBackend::GetPosition() else { gint64 pos; +#if GST_CHECK_VERSION(1,0,0) + if (!gst_element_query_position(m_playbin, GST_FORMAT_TIME, &pos) || + pos == -1) + return 0; +#else GstFormat fmtTime = GST_FORMAT_TIME; - if (!wxGst_element_query_position(m_playbin, &fmtTime, &pos) || + if (!gst_element_query_position(m_playbin, &fmtTime, &pos) || fmtTime != GST_FORMAT_TIME || pos == -1) return 0; +#endif return pos / GST_MSECOND ; } } @@ -1448,36 +1400,13 @@ wxLongLong wxGStreamerMediaBackend::GetPosition() //----------------------------------------------------------------------------- bool wxGStreamerMediaBackend::SetPosition(wxLongLong where) { -#if GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 8 \ - && GST_VERSION_MICRO == 0 - // 0.8.0 has no gst_element_seek according to official docs!!! - wxLogSysError(wxT("GStreamer 0.8.0 does not have gst_element_seek") - wxT(" according to official docs")); - return false; -#else // != 0.8.0 + gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME, + (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), + GST_SEEK_TYPE_SET, where.GetValue() * GST_MSECOND, + GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); -# if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 - gst_element_seek (m_playbin, m_dRate, GST_FORMAT_TIME, - (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), - GST_SEEK_TYPE_SET, where.GetValue() * GST_MSECOND, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); -# else - // NB: Some gstreamer versions return false basically all the time - // here - even totem doesn't bother to check the return value here - // so I guess we'll just assume it worked - - // TODO: maybe check the gst error callback??? - gst_element_seek (m_playbin, (GstSeekType) (GST_SEEK_METHOD_SET | - GST_FORMAT_TIME | GST_SEEK_FLAG_FLUSH), - where.GetValue() * GST_MSECOND ); - -# endif // GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 - - { - m_llPausedPos = where; - return true; - } + m_llPausedPos = where; return true; -#endif //== 0.8.0 } //----------------------------------------------------------------------------- @@ -1489,11 +1418,17 @@ bool wxGStreamerMediaBackend::SetPosition(wxLongLong where) wxLongLong wxGStreamerMediaBackend::GetDuration() { gint64 length; +#if GST_CHECK_VERSION(1,0,0) + if(!gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &length) || + length == -1) + return 0; +#else GstFormat fmtTime = GST_FORMAT_TIME; - if(!wxGst_element_query_duration(m_playbin, &fmtTime, &length) || + if(!gst_element_query_duration(m_playbin, &fmtTime, &length) || fmtTime != GST_FORMAT_TIME || length == -1) return 0; +#endif return length / GST_MSECOND ; } @@ -1552,9 +1487,8 @@ double wxGStreamerMediaBackend::GetPlaybackRate() // plugins that support it... } -bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate) +bool wxGStreamerMediaBackend::SetPlaybackRate(double /* dRate */) { -#if GST_VERSION_MAJOR > 0 || GST_VERSION_MINOR >= 10 #if 0 // not tested enough if( gst_element_seek (m_playbin, dRate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT), @@ -1564,9 +1498,6 @@ bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate) m_dRate = dRate; return true; } -#else - wxUnusedVar(dRate); -#endif #endif // failure @@ -1595,11 +1526,17 @@ wxLongLong wxGStreamerMediaBackend::GetDownloadProgress() wxLongLong wxGStreamerMediaBackend::GetDownloadTotal() { gint64 length; +#if GST_CHECK_VERSION(1,0,0) + if (!gst_element_query_duration(m_playbin, GST_FORMAT_BYTES, &length) || + length == -1) + return 0; +#else GstFormat fmtBytes = GST_FORMAT_BYTES; - if (!wxGst_element_query_duration(m_playbin, &fmtBytes, &length) || + if (!gst_element_query_duration(m_playbin, &fmtBytes, &length) || fmtBytes != GST_FORMAT_BYTES || length == -1) return 0; +#endif return length; } @@ -1650,10 +1587,8 @@ double wxGStreamerMediaBackend::GetVolume() return dVolume; } -#endif //wxUSE_GSTREAMER - // Force link into main library so this backend can be loaded #include "wx/html/forcelnk.h" FORCE_LINK_ME(basewxmediabackends) -#endif //wxUSE_MEDIACTRL +#endif // wxUSE_MEDIACTRL && wxUSE_GSTREAMER && !wxUSE_GSTREAMER_PLAYER diff --git a/Externals/wxWidgets3/src/unix/mediactrl_gstplayer.cpp b/Externals/wxWidgets3/src/unix/mediactrl_gstplayer.cpp new file mode 100644 index 0000000000..b7c22c0a04 --- /dev/null +++ b/Externals/wxWidgets3/src/unix/mediactrl_gstplayer.cpp @@ -0,0 +1,514 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/unix/mediactrl.cpp +// Purpose: GStreamer backend for Unix +// Author: Sebastian Dröge +// Created: 2016-02-28 +// Copyright: (c) 2004-2005 Ryan Norton +// (c) 2016 Sebastian Dröge +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if wxUSE_MEDIACTRL && wxUSE_GSTREAMER && wxUSE_GSTREAMER_PLAYER + +#include "wx/mediactrl.h" + +#include // main gstreamer player header + +#ifndef WX_PRECOMP + #include "wx/log.h" // wxLogDebug/wxLogSysError/wxLogTrace + #include "wx/app.h" // wxTheApp->argc, wxTheApp->argv + #include "wx/timer.h" // wxTimer +#endif + +#include "wx/filesys.h" // FileNameToURL() +#include "wx/thread.h" // wxMutex/wxMutexLocker +#include "wx/vector.h" // wxVector + +#ifdef __WXGTK__ + #include + #include + #include "wx/gtk/private/gtk2-compat.h" +#endif + +//============================================================================= +// Declarations +//============================================================================= +//----------------------------------------------------------------------------- +// wxLogTrace mask string +//----------------------------------------------------------------------------- +#define wxTRACE_GStreamer wxT("GStreamer") + +//----------------------------------------------------------------------------- +// +// wxGStreamerMediaBackend +// +//----------------------------------------------------------------------------- +class WXDLLIMPEXP_MEDIA + wxGStreamerMediaBackend : public wxMediaBackendCommonBase +{ +public: + + wxGStreamerMediaBackend(); + virtual ~wxGStreamerMediaBackend(); + + virtual bool CreateControl(wxControl* ctrl, wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) wxOVERRIDE; + + virtual bool Play() wxOVERRIDE; + virtual bool Pause() wxOVERRIDE; + virtual bool Stop() wxOVERRIDE; + + virtual bool Load(const wxString& fileName) wxOVERRIDE; + virtual bool Load(const wxURI& location) wxOVERRIDE; + virtual bool Load(const wxURI& location, + const wxURI& proxy) wxOVERRIDE + { return wxMediaBackendCommonBase::Load(location, proxy); } + + + virtual bool SetPosition(wxLongLong where) wxOVERRIDE; + virtual wxLongLong GetPosition() wxOVERRIDE; + virtual wxLongLong GetDuration() wxOVERRIDE; + + virtual void Move(int x, int y, int w, int h) wxOVERRIDE; + wxSize GetVideoSize() const wxOVERRIDE; + + virtual double GetPlaybackRate() wxOVERRIDE; + virtual bool SetPlaybackRate(double dRate) wxOVERRIDE; + + virtual wxMediaState GetState() wxOVERRIDE; + + virtual bool SetVolume(double dVolume) wxOVERRIDE; + virtual double GetVolume() wxOVERRIDE; + + virtual wxLongLong GetDownloadProgress() wxOVERRIDE; + virtual wxLongLong GetDownloadTotal() wxOVERRIDE; + + bool DoLoad(const wxString& locstring); + wxMediaCtrl* GetControl() { return m_ctrl; } // for C Callbacks + + void VideoDimensionsChanged(int width, int height); + void StateChanged(GstPlayerState state); + void EndOfStream(); + + GstPlayer *m_player; + GstPlayerVideoRenderer *m_video_renderer; + wxSize m_videoSize; + wxMediaState m_last_state; + bool m_loaded; + + wxDECLARE_DYNAMIC_CLASS(wxGStreamerMediaBackend); +}; + +//============================================================================= +// Implementation +//============================================================================= + +wxIMPLEMENT_DYNAMIC_CLASS(wxGStreamerMediaBackend, wxMediaBackend); + +//----------------------------------------------------------------------------- +// +// C Callbacks +// +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// "expose_event" from m_ctrl->m_wxwindow +// +// Handle GTK expose event from our window - here we hopefully +// redraw the video in the case of pausing and other instances... +// (Returns TRUE to pass to other handlers, FALSE if not) +// +//----------------------------------------------------------------------------- +#ifdef __WXGTK__ +static gboolean +#ifdef __WXGTK3__ +draw_callback(GtkWidget* widget, cairo_t* cr, wxGStreamerMediaBackend* be) +#else +expose_event_callback(GtkWidget* widget, GdkEventExpose* event, wxGStreamerMediaBackend* be) +#endif +{ + // If we have actual video..... + if(!(be->m_videoSize.x==0&&be->m_videoSize.y==0)) + { + // GST Doesn't redraw automatically while paused + // Plus, the video sometimes doesn't redraw when it looses focus + // or is painted over so we just tell it to redraw... + gst_player_video_overlay_video_renderer_expose(GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(be->m_video_renderer)); + } + else + { + // draw a black background like some other backends do.... +#ifdef __WXGTK3__ + GtkAllocation a; + gtk_widget_get_allocation(widget, &a); + cairo_rectangle(cr, 0, 0, a.width, a.height); + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_fill(cr); +#else + gdk_draw_rectangle (event->window, widget->style->black_gc, TRUE, 0, 0, + widget->allocation.width, + widget->allocation.height); +#endif + } + + return FALSE; +} +#endif // wxGTK + +//----------------------------------------------------------------------------- +// "realize" from m_ctrl->m_wxwindow +// +// If the window wasn't realized when Load was called, this is the +// callback for when it is - the purpose of which is to tell +// GStreamer to play the video in our control +//----------------------------------------------------------------------------- +#ifdef __WXGTK__ +extern "C" { +static void realize_callback(GtkWidget* widget, wxGStreamerMediaBackend* be) +{ + gdk_flush(); + + GdkWindow* window = gtk_widget_get_window(widget); + wxASSERT(window); + + gst_player_video_overlay_video_renderer_set_window_handle(GST_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER(be->m_video_renderer), + (gpointer) GDK_WINDOW_XID(window) + ); + GtkWidget* w = be->GetControl()->m_wxwindow; +#ifdef __WXGTK3__ + g_signal_connect(w, "draw", G_CALLBACK(draw_callback), be); +#else + g_signal_connect(w, "expose_event", G_CALLBACK(expose_event_callback), be); +#endif +} +} +#endif // wxGTK + +wxGStreamerMediaBackend::wxGStreamerMediaBackend() + : m_player(0), m_video_renderer(0), m_videoSize(0, 0), m_last_state(wxMEDIASTATE_STOPPED), m_loaded(false) +{ + +} + +wxGStreamerMediaBackend::~wxGStreamerMediaBackend() +{ + m_video_renderer = NULL; + if (m_player) + gst_object_unref(m_player); + m_player = NULL; +} + +extern "C" { +static void video_dimensions_changed_callback(GstPlayer * WXUNUSED(player), gint width, gint height, wxGStreamerMediaBackend* be) +{ + be->VideoDimensionsChanged(width, height); +} + +static void state_changed_callback(GstPlayer * WXUNUSED(player), GstPlayerState state, wxGStreamerMediaBackend* be) +{ + be->StateChanged(state); +} + +static void end_of_stream_callback(GstPlayer * WXUNUSED(player), wxGStreamerMediaBackend* be) +{ + be->EndOfStream(); +} +} + +bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + // + //init gstreamer + // + + //Convert arguments to unicode if enabled +#if wxUSE_UNICODE + int i; + char **argvGST = new char*[wxTheApp->argc + 1]; + for ( i = 0; i < wxTheApp->argc; i++ ) + { + argvGST[i] = wxStrdupA(wxTheApp->argv[i].utf8_str()); + } + + argvGST[wxTheApp->argc] = NULL; + + int argcGST = wxTheApp->argc; +#else +#define argcGST wxTheApp->argc +#define argvGST wxTheApp->argv +#endif + + //Really init gstreamer + gboolean bInited; + GError* error = NULL; + bInited = gst_init_check(&argcGST, &argvGST, &error); + + // Cleanup arguments for unicode case +#if wxUSE_UNICODE + for ( i = 0; i < argcGST; i++ ) + { + free(argvGST[i]); + } + + delete [] argvGST; +#endif + + if(!bInited) //gst_init_check fail? + { + if(error) + { + wxLogSysError(wxT("Could not initialize GStreamer\n") + wxT("Error Message:%s"), + (const wxChar*) wxConvUTF8.cMB2WX(error->message) + ); + g_error_free(error); + } + else + wxLogSysError(wxT("Could not initialize GStreamer")); + + return false; + } + + // + // wxControl creation + // + m_ctrl = wxStaticCast(ctrl, wxMediaCtrl); + +#ifdef __WXGTK__ + // We handle our own GTK expose events + m_ctrl->m_noExpose = true; +#endif + + if( !m_ctrl->wxControl::Create(parent, id, pos, size, + style, // TODO: remove borders??? + validator, name) ) + { + wxFAIL_MSG(wxT("Could not create wxControl!!!")); + return false; + } + +#ifdef __WXGTK__ + // Turn off double-buffering so that + // so it doesn't draw over the video and cause sporadic + // disappearances of the video + gtk_widget_set_double_buffered(m_ctrl->m_wxwindow, FALSE); +#endif + + // don't erase the background of our control window + // so that resizing is a bit smoother + m_ctrl->SetBackgroundStyle(wxBG_STYLE_CUSTOM); + + // Tell gstreamer to play in our window + gpointer window_handle = NULL; +#ifdef __WXGTK__ + if (!gtk_widget_get_realized(m_ctrl->m_wxwindow)) + { + // Not realized yet - set to connect at realization time + g_signal_connect (m_ctrl->m_wxwindow, + "realize", + G_CALLBACK (realize_callback), + this); + } + else + { + GdkWindow* window = gtk_widget_get_window(m_ctrl->m_wxwindow); + wxASSERT(window); + window_handle = (gpointer) GDK_WINDOW_XID(window); + + GtkWidget* w = m_ctrl->m_wxwindow; +#ifdef __WXGTK3__ + g_signal_connect(w, "draw", G_CALLBACK(draw_callback), this); +#else + g_signal_connect(w, "expose_event", G_CALLBACK(expose_event_callback), this); +#endif + } +#else + window_handle = ctrl->GetHandle(); +#endif + + m_video_renderer = gst_player_video_overlay_video_renderer_new(window_handle); + m_player = gst_player_new(m_video_renderer, gst_player_g_main_context_signal_dispatcher_new(NULL)); + + g_signal_connect(m_player, "video-dimensions-changed", G_CALLBACK(video_dimensions_changed_callback), this); + g_signal_connect(m_player, "state-changed", G_CALLBACK(state_changed_callback), this); + g_signal_connect(m_player, "end-of-stream", G_CALLBACK(end_of_stream_callback), this); + + return true; +} + +bool wxGStreamerMediaBackend::Play() +{ + gst_player_play(m_player); + + return true; +} + +bool wxGStreamerMediaBackend::Pause() +{ + gst_player_pause(m_player); + + return true; +} + +bool wxGStreamerMediaBackend::Stop() +{ + gst_player_stop(m_player); + + return true; +} + +bool wxGStreamerMediaBackend::Load(const wxString& fileName) +{ + return DoLoad(wxFileSystem::FileNameToURL(fileName)); +} + +bool wxGStreamerMediaBackend::Load(const wxURI& location) +{ + return DoLoad(location.BuildURI()); +} + +bool wxGStreamerMediaBackend::DoLoad(const wxString& locstring) +{ + // Make sure the passed URI is valid and tell playbin to load it + // non-file uris are encoded + wxASSERT(gst_uri_protocol_is_valid("file")); + wxASSERT(gst_uri_is_valid(locstring.mb_str())); + + gst_player_stop(m_player); + m_loaded = false; + gst_player_set_uri(m_player, (const char*)locstring.mb_str()); + gst_player_pause(m_player); + + return true; +} + +void wxGStreamerMediaBackend::VideoDimensionsChanged(int width, int height) +{ + if (m_loaded) { + m_videoSize.x = width; + m_videoSize.y = height; + NotifyMovieSizeChanged(); + } +} + +void wxGStreamerMediaBackend::StateChanged(GstPlayerState state) +{ + switch (state) { + case GST_PLAYER_STATE_BUFFERING: + case GST_PLAYER_STATE_PAUSED: + if (!m_loaded) { + NotifyMovieLoaded(); + m_loaded = true; + } + + m_last_state = wxMEDIASTATE_PAUSED; + QueuePauseEvent(); + break; + case GST_PLAYER_STATE_PLAYING: + m_last_state = wxMEDIASTATE_PLAYING; + QueuePlayEvent(); + break; + case GST_PLAYER_STATE_STOPPED: + default: + m_last_state = wxMEDIASTATE_STOPPED; + QueueStopEvent(); + break; + } +} + +void wxGStreamerMediaBackend::EndOfStream() +{ + if (SendStopEvent()) + QueueFinishEvent(); +} + +bool wxGStreamerMediaBackend::SetPosition(wxLongLong where) +{ + gst_player_seek(m_player, where.GetValue() * GST_MSECOND); + + return true; +} + +wxLongLong wxGStreamerMediaBackend::GetPosition() +{ + GstClockTime position = gst_player_get_position(m_player); + + return GST_CLOCK_TIME_IS_VALID(position) ? position / GST_MSECOND : 0; +} + +wxLongLong wxGStreamerMediaBackend::GetDuration() +{ + GstClockTime duration = gst_player_get_duration(m_player); + + return GST_CLOCK_TIME_IS_VALID(duration) ? duration / GST_MSECOND : 0; +} + +void wxGStreamerMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(w), int WXUNUSED(h)) +{ + /* Nothing to be done here, at least for GTK+. For other toolkits we might + * have to call + * gst_player_video_overlay_video_renderer_set_render_rectangle() here + */ +} + +wxSize wxGStreamerMediaBackend::GetVideoSize() const +{ + return m_videoSize; +} + +double wxGStreamerMediaBackend::GetPlaybackRate() +{ + return gst_player_get_rate(m_player); +} + +bool wxGStreamerMediaBackend::SetPlaybackRate(double dRate) +{ + gst_player_set_rate(m_player, dRate); + return true; +} + +wxMediaState wxGStreamerMediaBackend::GetState() +{ + return m_last_state; +} + +bool wxGStreamerMediaBackend::SetVolume(double dVolume) +{ + gst_player_set_volume(m_player, dVolume); + return true; +} + +double wxGStreamerMediaBackend::GetVolume() +{ + return gst_player_get_volume(m_player); +} + +wxLongLong wxGStreamerMediaBackend::GetDownloadProgress() +{ + return 0; +} + +wxLongLong wxGStreamerMediaBackend::GetDownloadTotal() +{ + return 0; +} + +// Force link into main library so this backend can be loaded +#include "wx/html/forcelnk.h" +FORCE_LINK_ME(basewxmediabackends) + +#endif // wxUSE_MEDIACTRL && wxUSE_GSTREAMER && wxUSE_GSTREAMER_PLAYER diff --git a/Externals/wxWidgets3/src/unix/mimetype.cpp b/Externals/wxWidgets3/src/unix/mimetype.cpp index 265f86aae0..b1c95644ef 100644 --- a/Externals/wxWidgets3/src/unix/mimetype.cpp +++ b/Externals/wxWidgets3/src/unix/mimetype.cpp @@ -229,11 +229,7 @@ void wxMimeTypesManagerImpl::LoadXDGAppsFilesFromDir(const wxString& dirname) cont = dir.GetNext(&filename); } -#if 0 - // RR: I'm not sure this makes any sense. On my system we'll just - // scan the YAST2 and other useless directories - - // Look recursively into subdirs + // Recurse into subdirs, which on KDE may hold most of the .desktop files cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_DIRS); while (cont) { @@ -242,7 +238,6 @@ void wxMimeTypesManagerImpl::LoadXDGAppsFilesFromDir(const wxString& dirname) LoadXDGAppsFilesFromDir( p.GetPath() ); cont = dir.GetNext(&filename); } -#endif } @@ -835,6 +830,7 @@ wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ex InitIfNeeded(); + wxFileType* fileTypeFallback = NULL; size_t count = m_aExtensions.GetCount(); for ( size_t n = 0; n < count; n++ ) { @@ -849,12 +845,32 @@ wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ex wxFileType *fileType = new wxFileType; fileType->m_impl->Init(this, n); - return fileType; + // See if this one has a known open-command. If not, keep + // looking for another one that does, as a file that can't be + // opened is not very useful, but store this one as a fallback. + wxString type, desc, open; + fileType->GetMimeType(&type); + fileType->GetDescription(&desc); + wxFileType::MessageParameters params("filename."+ext, type); + if ( fileType->GetOpenCommand(&open, params) ) + { + delete fileTypeFallback; + return fileType; + } + else + { + // Override the previous fallback, if any, with the new + // one: we consider that later entries have priority. + delete fileTypeFallback; + fileTypeFallback = fileType; + } } } } - return NULL; + // If we couldn't find a filetype with a known open-command, return any + // without one + return fileTypeFallback; } wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) diff --git a/Externals/wxWidgets3/src/unix/net.cpp b/Externals/wxWidgets3/src/unix/net.cpp index 3125aadc2c..318297d92d 100644 --- a/Externals/wxWidgets3/src/unix/net.cpp +++ b/Externals/wxWidgets3/src/unix/net.cpp @@ -84,7 +84,7 @@ public: ISP (exact meaning of the parameter depends on the platform), returns TRUE on success or FALSE on failure and logs the appropriate error message in the latter case. - @param nameOfISP optional paramater for dial program + @param nameOfISP optional parameter for dial program @param username unused @param password unused */ diff --git a/Externals/wxWidgets3/src/unix/snglinst.cpp b/Externals/wxWidgets3/src/unix/snglinst.cpp index f8f1c3b4e0..0c8d4275ef 100644 --- a/Externals/wxWidgets3/src/unix/snglinst.cpp +++ b/Externals/wxWidgets3/src/unix/snglinst.cpp @@ -292,7 +292,13 @@ bool wxSingleInstanceCheckerImpl::Create(const wxString& name) } else { - wxLogMessage(_("Deleted stale lock file '%s'."), + // This may be important to know if something goes + // mysteriously wrong, but as the user can't really do + // anything about here (the most typical reason for this + // message is that the previous instance of the program + // crashed), don't show it by default, i.e. unless the + // program is running with --verbose command line option. + wxLogInfo(_("Deleted stale lock file '%s'."), name.c_str()); // retry now diff --git a/Externals/wxWidgets3/src/unix/sockunix.cpp b/Externals/wxWidgets3/src/unix/sockunix.cpp index 7d47f18e95..78542648ef 100644 --- a/Externals/wxWidgets3/src/unix/sockunix.cpp +++ b/Externals/wxWidgets3/src/unix/sockunix.cpp @@ -20,20 +20,12 @@ #include -#if defined(__WATCOMC__) - #include -#endif - #include #ifdef HAVE_SYS_SELECT_H # include #endif -#ifdef __EMX__ - #include -#endif - #ifndef WX_SOCKLEN_T #ifdef VMS @@ -98,6 +90,11 @@ wxSocketError wxSocketImplUnix::GetLastError() const void wxSocketImplUnix::DoEnableEvents(int flags, bool enable) { + // No events for blocking sockets, they should be usable from the other + // threads and the events only work for the sockets used by the main one. + if ( GetSocketFlags() & wxSOCKET_BLOCK ) + return; + wxSocketManager * const manager = wxSocketManager::Get(); if (!manager) return; @@ -178,7 +175,7 @@ void wxSocketImplUnix::OnReadWaiting() default: wxFAIL_MSG( "unexpected CheckForInput() return value" ); - // fall through + wxFALLTHROUGH; case -1: if ( GetLastError() == wxSOCKET_WOULDBLOCK ) diff --git a/Externals/wxWidgets3/src/unix/sound.cpp b/Externals/wxWidgets3/src/unix/sound.cpp index c6ff1bd420..342a58f7e4 100644 --- a/Externals/wxWidgets3/src/unix/sound.cpp +++ b/Externals/wxWidgets3/src/unix/sound.cpp @@ -78,15 +78,15 @@ wxSoundData::~wxSoundData() class wxSoundBackendNull : public wxSoundBackend { public: - wxString GetName() const { return _("No sound"); } - int GetPriority() const { return 0; } - bool IsAvailable() const { return true; } - bool HasNativeAsyncPlayback() const { return true; } + wxString GetName() const wxOVERRIDE { return _("No sound"); } + int GetPriority() const wxOVERRIDE { return 0; } + bool IsAvailable() const wxOVERRIDE { return true; } + bool HasNativeAsyncPlayback() const wxOVERRIDE { return true; } bool Play(wxSoundData *WXUNUSED(data), unsigned WXUNUSED(flags), - volatile wxSoundPlaybackStatus *WXUNUSED(status)) + volatile wxSoundPlaybackStatus *WXUNUSED(status)) wxOVERRIDE { return true; } - void Stop() {} - bool IsPlaying() const { return false; } + void Stop() wxOVERRIDE {} + bool IsPlaying() const wxOVERRIDE { return false; } }; @@ -103,14 +103,14 @@ public: class wxSoundBackendOSS : public wxSoundBackend { public: - wxString GetName() const { return wxT("Open Sound System"); } - int GetPriority() const { return 10; } - bool IsAvailable() const; - bool HasNativeAsyncPlayback() const { return false; } + wxString GetName() const wxOVERRIDE { return wxT("Open Sound System"); } + int GetPriority() const wxOVERRIDE { return 10; } + bool IsAvailable() const wxOVERRIDE; + bool HasNativeAsyncPlayback() const wxOVERRIDE { return false; } bool Play(wxSoundData *data, unsigned flags, - volatile wxSoundPlaybackStatus *status); - void Stop() {} - bool IsPlaying() const { return false; } + volatile wxSoundPlaybackStatus *status) wxOVERRIDE; + void Stop() wxOVERRIDE {} + bool IsPlaying() const wxOVERRIDE { return false; } private: int OpenDSP(const wxSoundData *data); @@ -278,7 +278,7 @@ public: wxSoundAsyncPlaybackThread(wxSoundSyncOnlyAdaptor *adaptor, wxSoundData *data, unsigned flags) : wxThread(), m_adapt(adaptor), m_data(data), m_flags(flags) {} - virtual ExitCode Entry(); + virtual ExitCode Entry() wxOVERRIDE; protected: wxSoundSyncOnlyAdaptor *m_adapt; @@ -299,26 +299,26 @@ public: { delete m_backend; } - wxString GetName() const + wxString GetName() const wxOVERRIDE { return m_backend->GetName(); } - int GetPriority() const + int GetPriority() const wxOVERRIDE { return m_backend->GetPriority(); } - bool IsAvailable() const + bool IsAvailable() const wxOVERRIDE { return m_backend->IsAvailable(); } - bool HasNativeAsyncPlayback() const + bool HasNativeAsyncPlayback() const wxOVERRIDE { return true; } bool Play(wxSoundData *data, unsigned flags, - volatile wxSoundPlaybackStatus *status); - void Stop(); - bool IsPlaying() const; + volatile wxSoundPlaybackStatus *status) wxOVERRIDE; + void Stop() wxOVERRIDE; + bool IsPlaying() const wxOVERRIDE; private: friend class wxSoundAsyncPlaybackThread; @@ -712,11 +712,11 @@ bool wxSound::LoadWAV(const void* data_, size_t length, bool copyData) class wxSoundCleanupModule: public wxModule { public: - bool OnInit() { return true; } - void OnExit() { wxSound::UnloadBackend(); } - DECLARE_DYNAMIC_CLASS(wxSoundCleanupModule) + bool OnInit() wxOVERRIDE { return true; } + void OnExit() wxOVERRIDE { wxSound::UnloadBackend(); } + wxDECLARE_DYNAMIC_CLASS(wxSoundCleanupModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxSoundCleanupModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxSoundCleanupModule, wxModule); #endif diff --git a/Externals/wxWidgets3/src/unix/sound_sdl.cpp b/Externals/wxWidgets3/src/unix/sound_sdl.cpp index 0fc4ebf3ff..288f5f7bce 100644 --- a/Externals/wxWidgets3/src/unix/sound_sdl.cpp +++ b/Externals/wxWidgets3/src/unix/sound_sdl.cpp @@ -37,9 +37,9 @@ class wxSoundBackendSDLNotification : public wxEvent { public: - DECLARE_DYNAMIC_CLASS(wxSoundBackendSDLNotification) + wxDECLARE_DYNAMIC_CLASS(wxSoundBackendSDLNotification); wxSoundBackendSDLNotification(); - wxEvent *Clone() const { return new wxSoundBackendSDLNotification(*this); } + wxEvent *Clone() const wxOVERRIDE { return new wxSoundBackendSDLNotification(*this); } }; typedef void (wxEvtHandler::*wxSoundBackendSDLNotificationFunction) @@ -54,7 +54,7 @@ wxDECLARE_EVENT(wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotificat wxEVENT_HANDLER_CAST( wxSoundBackendSDLNotificationFunction, func ), \ NULL ), -IMPLEMENT_DYNAMIC_CLASS(wxSoundBackendSDLNotification, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxSoundBackendSDLNotification, wxEvtHandler); wxDEFINE_EVENT( wxEVT_SOUND_BACKEND_SDL_NOTIFICATION, wxSoundBackendSDLNotification ); wxSoundBackendSDLNotification::wxSoundBackendSDLNotification() @@ -114,12 +114,12 @@ private: } wxSoundBackendSDL *m_backend; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxSoundBackendSDLEvtHandler, wxEvtHandler) +wxBEGIN_EVENT_TABLE(wxSoundBackendSDLEvtHandler, wxEvtHandler) EVT_SOUND_BACKEND_SDL_NOTIFICATON(wxSoundBackendSDLEvtHandler::OnNotify) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxSoundBackendSDL::~wxSoundBackendSDL() { diff --git a/Externals/wxWidgets3/src/unix/stackwalk.cpp b/Externals/wxWidgets3/src/unix/stackwalk.cpp index e8cf6edff3..eccb910e11 100644 --- a/Externals/wxWidgets3/src/unix/stackwalk.cpp +++ b/Externals/wxWidgets3/src/unix/stackwalk.cpp @@ -215,6 +215,8 @@ bool ReadLine(FILE* fp, unsigned long num, wxString* line) { if ( !fgets(g_buf, WXSIZEOF(g_buf), fp) ) { + wxUnusedVar(num); // could be unused if debug tracing is disabled + wxLogDebug(wxS("cannot read address information for stack frame #%lu"), num); return false; diff --git a/Externals/wxWidgets3/src/unix/stdpaths.cpp b/Externals/wxWidgets3/src/unix/stdpaths.cpp index 4e0c37b18f..2880ff9f41 100644 --- a/Externals/wxWidgets3/src/unix/stdpaths.cpp +++ b/Externals/wxWidgets3/src/unix/stdpaths.cpp @@ -233,7 +233,7 @@ wxStandardPaths::GetLocalizedResourcesDir(const wxString& lang, return GetInstallPrefix() + wxT("/share/locale/") + lang + wxT("/LC_MESSAGES"); } -wxString wxStandardPaths::GetDocumentsDir() const +wxString wxStandardPaths::GetUserDir(Dir userDir) const { { wxLogNull logNull; @@ -246,6 +246,29 @@ wxString wxStandardPaths::GetDocumentsDir() const wxString dirsFile = configPath + wxT("/user-dirs.dirs"); if (wxFileExists(dirsFile)) { + wxString userDirId; + switch (userDir) + { + case Dir_Desktop: + userDirId = "XDG_DESKTOP_DIR"; + break; + case Dir_Downloads: + userDirId = "XDG_DOWNLOAD_DIR"; + break; + case Dir_Music: + userDirId = "XDG_MUSIC_DIR"; + break; + case Dir_Pictures: + userDirId = "XDG_PICTURES_DIR"; + break; + case Dir_Videos: + userDirId = "XDG_VIDEOS_DIR"; + break; + default: + userDirId = "XDG_DOCUMENTS_DIR"; + break; + } + wxTextFile textFile; if (textFile.Open(dirsFile)) { @@ -253,13 +276,15 @@ wxString wxStandardPaths::GetDocumentsDir() const for (i = 0; i < textFile.GetLineCount(); i++) { wxString line(textFile[i]); - int pos = line.Find(wxT("XDG_DOCUMENTS_DIR")); + int pos = line.Find(userDirId); if (pos != wxNOT_FOUND) { wxString value = line.AfterFirst(wxT('=')); value.Replace(wxT("$HOME"), homeDir); value.Trim(true); value.Trim(false); + // Remove quotes + value.Replace("\"", "", true /* replace all */); if (!value.IsEmpty() && wxDirExists(value)) return value; else @@ -270,7 +295,7 @@ wxString wxStandardPaths::GetDocumentsDir() const } } - return wxStandardPathsBase::GetDocumentsDir(); + return wxStandardPathsBase::GetUserDir(userDir); } #endif // __VMS/!__VMS diff --git a/Externals/wxWidgets3/src/unix/taskbarx11.cpp b/Externals/wxWidgets3/src/unix/taskbarx11.cpp index 146d2ccd9c..5633edbbde 100644 --- a/Externals/wxWidgets3/src/unix/taskbarx11.cpp +++ b/Externals/wxWidgets3/src/unix/taskbarx11.cpp @@ -100,15 +100,15 @@ protected: wxPoint m_pos; wxBitmap m_bmp; - DECLARE_EVENT_TABLE() + wxDECLARE_EVENT_TABLE(); }; -BEGIN_EVENT_TABLE(wxTaskBarIconArea, wxTaskBarIconAreaBase) +wxBEGIN_EVENT_TABLE(wxTaskBarIconArea, wxTaskBarIconAreaBase) EVT_SIZE(wxTaskBarIconArea::OnSizeChange) EVT_MOUSE_EVENTS(wxTaskBarIconArea::OnMouseEvent) EVT_MENU(wxID_ANY, wxTaskBarIconArea::OnMenuEvent) EVT_PAINT(wxTaskBarIconArea::OnPaint) -END_EVENT_TABLE() +wxEND_EVENT_TABLE() wxTaskBarIconArea::wxTaskBarIconArea(wxTaskBarIcon *icon, const wxBitmap &bmp) : wxTaskBarIconAreaBase(), m_icon(icon), m_bmp(bmp) @@ -246,7 +246,7 @@ bool wxTaskBarIconBase::IsAvailable() // wxTaskBarIcon class: // ---------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) +wxIMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler); wxTaskBarIcon::wxTaskBarIcon() : m_iconWnd(NULL) { diff --git a/Externals/wxWidgets3/src/unix/threadpsx.cpp b/Externals/wxWidgets3/src/unix/threadpsx.cpp index 4efe5d56f1..67ec9c3302 100644 --- a/Externals/wxWidgets3/src/unix/threadpsx.cpp +++ b/Externals/wxWidgets3/src/unix/threadpsx.cpp @@ -237,7 +237,7 @@ wxMutexInternal::wxMutexInternal(wxMutexType mutexType) default: wxFAIL_MSG( wxT("unknown mutex type") ); - // fall through + wxFALLTHROUGH; case wxMUTEX_DEFAULT: err = pthread_mutex_init(&m_mutex, NULL); @@ -870,6 +870,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) wxT("Thread %p Entry() returned %lu."), THR_ID(pthread), wxPtrToUInt(pthread->m_exitcode)); } +#ifndef wxNO_EXCEPTIONS #ifdef HAVE_ABI_FORCEDUNWIND // When using common C++ ABI under Linux we must always rethrow this // special exception used to unwind the stack when the thread was @@ -882,7 +883,11 @@ void *wxThreadInternal::PthreadStart(wxThread *thread) throw; } #endif // HAVE_ABI_FORCEDUNWIND - wxCATCH_ALL( wxTheApp->OnUnhandledException(); ) + catch ( ... ) + { + wxTheApp->OnUnhandledException(); + } +#endif // !wxNO_EXCEPTIONS { wxCriticalSectionLocker lock(thread->m_critsect); @@ -1359,36 +1364,67 @@ void wxThread::SetPriority(unsigned int prio) case STATE_RUNNING: case STATE_PAUSED: + { #ifdef HAVE_THREAD_PRIORITY_FUNCTIONS -#if defined(__LINUX__) - // On Linux, pthread_setschedparam with SCHED_OTHER does not allow - // a priority other than 0. Instead, we use the BSD setpriority - // which alllows us to set a 'nice' value between 20 to -20. Only - // super user can set a value less than zero (more negative yields - // higher priority). setpriority set the static priority of a - // process, but this is OK since Linux is configured as a thread - // per process. - // - // FIXME this is not true for 2.6!! + // We map our priority values to pthreads scheduling params as + // follows: + // 0..20 to SCHED_IDLE + // 21..40 to SCHED_BATCH + // 41..60 to SCHED_OTHER + // 61..80 to SCHED_RR + // 81..100 to SCHED_FIFO + // + // For the last two, we can also use the additional priority + // parameter which must be in 1..99 range under Linux (TODO: + // what should be used for the other systems?). + struct sched_param sparam = { 0 }; - // map wx priorites 0..100 to Unix priorities 20..-20 - if ( setpriority(PRIO_PROCESS, 0, -(2*(int)prio)/5 + 20) == -1 ) - { - wxLogError(_("Failed to set thread priority %d."), prio); - } -#else // __LINUX__ - { - struct sched_param sparam; - sparam.sched_priority = prio; + // The only scheduling policy guaranteed to be supported + // everywhere is this one. + int policy = SCHED_OTHER; +#ifdef SCHED_IDLE + if ( prio <= 20 ) + policy = SCHED_IDLE; +#endif +#ifdef SCHED_BATCH + if ( 20 < prio && prio <= 40 ) + policy = SCHED_BATCH; +#endif +#ifdef SCHED_RR + if ( 60 < prio && prio <= 80 ) + policy = SCHED_RR; +#endif +#ifdef SCHED_FIFO + if ( 80 < prio ) + policy = SCHED_FIFO; +#endif + + // This test is not redundant as it takes care of the systems + // where neither SCHED_RR nor SCHED_FIFO are defined. + if ( prio > 60 && policy != SCHED_OTHER ) + { + // There is no good way to map our 20 possible priorities + // (61..80 or 81..100) to the 99 pthread priorities, so we + // do the best that we can and ensure that the extremes of + // our range are mapped to the pthread extremes and all the + // rest fall in between. + + // This gets us to 1..96 range. + sparam.sched_priority = ((prio - 61) % 20)*5 + 1; + + // And we artificially increase our highest priority to the + // highest pthread one. + if ( sparam.sched_priority == 96 ) + sparam.sched_priority = 99; + } if ( pthread_setschedparam(m_internal->GetId(), - SCHED_OTHER, &sparam) != 0 ) + policy, &sparam) != 0 ) { wxLogError(_("Failed to set thread priority %d."), prio); } - } -#endif // __LINUX__ #endif // HAVE_THREAD_PRIORITY_FUNCTIONS + } break; case STATE_EXITED: @@ -1507,7 +1543,7 @@ wxThreadError wxThread::Delete(ExitCode *rc, wxThreadWait WXUNUSED(waitMode)) // PthreadStart() m_internal->SignalRun(); - // fall through + wxFALLTHROUGH; case STATE_EXITED: // nothing to do @@ -1517,7 +1553,7 @@ wxThreadError wxThread::Delete(ExitCode *rc, wxThreadWait WXUNUSED(waitMode)) // resume the thread first m_internal->Resume(); - // fall through + wxFALLTHROUGH; default: if ( !isDetached ) @@ -1559,7 +1595,7 @@ wxThreadError wxThread::Kill() // resume the thread first Resume(); - // fall through + wxFALLTHROUGH; default: #ifdef HAVE_PTHREAD_CANCEL @@ -1741,14 +1777,14 @@ void wxOSXThreadModuleOnExit(); class wxThreadModule : public wxModule { public: - virtual bool OnInit(); - virtual void OnExit(); + virtual bool OnInit() wxOVERRIDE; + virtual void OnExit() wxOVERRIDE; private: - DECLARE_DYNAMIC_CLASS(wxThreadModule) + wxDECLARE_DYNAMIC_CLASS(wxThreadModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule); bool wxThreadModule::OnInit() { diff --git a/Externals/wxWidgets3/src/unix/timerunx.cpp b/Externals/wxWidgets3/src/unix/timerunx.cpp index 1d99805f54..9817804722 100644 --- a/Externals/wxWidgets3/src/unix/timerunx.cpp +++ b/Externals/wxWidgets3/src/unix/timerunx.cpp @@ -44,20 +44,6 @@ WX_DEFINE_LIST(wxTimerList) // trace mask for the debugging messages used here #define wxTrace_Timer wxT("timer") -// ---------------------------------------------------------------------------- -// local functions -// ---------------------------------------------------------------------------- - -// helper function to format wxUsecClock_t -static inline wxString wxUsecClockAsString(wxUsecClock_t usec) -{ - #if wxUSE_LONGLONG - return usec.ToString(); - #else // wxUsecClock_t == double - return wxString::Format(wxT("%.0f"), usec); - #endif -} - // ============================================================================ // wxTimerScheduler implementation // ============================================================================ @@ -96,7 +82,7 @@ void wxTimerScheduler::DoAddTimer(wxTimerSchedule *s) wxLogTrace(wxTrace_Timer, wxT("Inserted timer %d expiring at %s"), s->m_timer->GetId(), - wxUsecClockAsString(s->m_expiration).c_str()); + s->m_expiration.ToString()); } void wxTimerScheduler::RemoveTimer(wxUnixTimerImpl *timer) @@ -252,13 +238,13 @@ class wxTimerUnixModule : public wxModule { public: wxTimerUnixModule() {} - virtual bool OnInit() { return true; } - virtual void OnExit() { wxTimerScheduler::Shutdown(); } + virtual bool OnInit() wxOVERRIDE { return true; } + virtual void OnExit() wxOVERRIDE { wxTimerScheduler::Shutdown(); } - DECLARE_DYNAMIC_CLASS(wxTimerUnixModule) + wxDECLARE_DYNAMIC_CLASS(wxTimerUnixModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxTimerUnixModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxTimerUnixModule, wxModule); // ============================================================================ // global functions diff --git a/Externals/wxWidgets3/src/unix/utilsunx.cpp b/Externals/wxWidgets3/src/unix/utilsunx.cpp index 450966d1fe..fdaa04b17a 100644 --- a/Externals/wxWidgets3/src/unix/utilsunx.cpp +++ b/Externals/wxWidgets3/src/unix/utilsunx.cpp @@ -46,7 +46,7 @@ #include "wx/private/selectdispatcher.h" #include "wx/private/fdiodispatcher.h" -#include "wx/unix/execute.h" +#include "wx/unix/private/execute.h" #include "wx/unix/pipe.h" #include "wx/unix/private.h" @@ -147,20 +147,10 @@ #if !defined(HAVE_USLEEP) && \ ((defined(__SUN__) && !defined(__SunOs_5_6) && \ !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \ - defined(__osf__) || defined(__EMX__)) + defined(__osf__)) extern "C" { - #ifdef __EMX__ - /* I copied this from the XFree86 diffs. AV. */ - #define INCL_DOSPROCESS - #include - inline void usleep(unsigned long delay) - { - DosSleep(delay ? (delay/1000l) : 1l); - } - #else // Unix - int usleep(unsigned int usec); - #endif // __EMX__/Unix + int usleep(unsigned int usec); }; #define HAVE_USLEEP 1 @@ -305,14 +295,14 @@ bool wxPipeInputStream::CanRead() const { case -1: wxLogSysError(_("Impossible to get child process input")); - // fall through + wxFALLTHROUGH; case 0: return false; default: wxFAIL_MSG(wxT("unexpected select() return value")); - // still fall through + wxFALLTHROUGH; case 1: // input available -- or maybe not, as select() returns 1 when a @@ -346,7 +336,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t size) #endif // do not treat it as an error m_file->ClearLastError(); - // fall through + wxFALLTHROUGH; // no error case 0: @@ -410,7 +400,7 @@ public: for ( int i = 0; i < m_argc; i++ ) { - m_argv[i] = wxStrdup(args[i]); + m_argv[i] = wxStrdup(args[i].mb_str(wxConvWhateverWorks)); } } @@ -462,7 +452,7 @@ private: // wxExecute implementations // ---------------------------------------------------------------------------- -#if defined(__DARWIN__) +#if defined(__DARWIN__) && !defined(__WXOSX_IPHONE__) bool wxMacLaunch(char **argv); #endif @@ -587,7 +577,7 @@ long wxExecute(char **argv, int flags, wxProcess *process, wxT("wxExecute() can be called only from the main thread") ); #endif // wxUSE_THREADS -#if defined(__WXCOCOA__) || ( defined(__WXOSX_MAC__) && wxOSX_USE_COCOA_OR_CARBON ) +#if defined(__DARWIN__) && !defined(__WXOSX_IPHONE__) // wxMacLaunch() only executes app bundles and only does it asynchronously. // It returns false if the target is not an app bundle, thus falling // through to the regular code for non app bundles. @@ -659,7 +649,7 @@ long wxExecute(char **argv, int flags, wxProcess *process, // always opened so don't do it any more, after all there doesn't // seem to be any real problem with keeping them opened -#if !defined(__VMS) && !defined(__EMX__) +#if !defined(__VMS) if ( flags & wxEXEC_MAKE_GROUP_LEADER ) { // Set process group to child process' pid. Then killing -pid @@ -697,7 +687,6 @@ long wxExecute(char **argv, int flags, wxProcess *process, // the descriptors do not need to be closed but for now this is better // than never closing them at all as wx code never used FD_CLOEXEC. -#ifdef __DARWIN__ // TODO: Iterating up to FD_SETSIZE is both inefficient (because it may // be quite big) and incorrect (because in principle we could // have more opened descriptions than this number). Unfortunately @@ -705,14 +694,6 @@ long wxExecute(char **argv, int flags, wxProcess *process, // above a certain threshold but non-portable solutions exist for // most platforms, see [http://stackoverflow.com/questions/899038/ // getting-the-highest-allocated-file-descriptor] - // - // Unfortunately, we cannot do this safely on OS X, because libdispatch - // may crash when we do this: - // Exception Type: EXC_BAD_INSTRUCTION (SIGILL) - // Exception Codes: 0x0000000000000001, 0x0000000000000000 - // - // Application Specific Information: - // BUG IN CLIENT OF LIBDISPATCH: Do not close random Unix descriptors for ( int fd = 0; fd < (int)FD_SETSIZE; ++fd ) { if ( fd != STDIN_FILENO && @@ -722,7 +703,6 @@ long wxExecute(char **argv, int flags, wxProcess *process, close(fd); } } -#endif // !__DARWIN__ // Process additional options if we have any @@ -781,8 +761,6 @@ long wxExecute(char **argv, int flags, wxProcess *process, } else // we're in parent { - execData.OnStart(pid); - // prepare for IO redirection #if HAS_PIPE_STREAMS @@ -834,17 +812,24 @@ long wxExecute(char **argv, int flags, wxProcess *process, pipeErr.Close(); } - // For the asynchronous case we don't have to do anything else, just - // let the process run. if ( !(flags & wxEXEC_SYNC) ) { // Ensure that the housekeeping data is kept alive, it will be // destroyed only when the child terminates. execDataPtr.release(); - - return execData.pid; } + // Put the housekeeping data into the child process lookup table. + // Note that when running asynchronously, if the child has already + // finished this call will delete the execData and call any + // wxProcess's OnTerminate() handler immediately. + execData.OnStart(pid); + + // For the asynchronous case we don't have to do anything else, just + // let the process run (if not already finished). + if ( !(flags & wxEXEC_SYNC) ) + return pid; + // If we don't need to dispatch any events, things are relatively // simple and we don't need to delegate to wxAppTraits. @@ -1129,23 +1114,30 @@ wxLinuxDistributionInfo wxGetLinuxDistributionInfo() // these functions are in src/osx/utilsexc_base.cpp for wxMac #ifndef __DARWIN__ -wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) +wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro) { // get OS version - int major, minor; + int major = -1, minor = -1, micro = -1; wxString release = wxGetCommandOutput(wxT("uname -r")); - if ( release.empty() || - wxSscanf(release.c_str(), wxT("%d.%d"), &major, &minor) != 2 ) + if ( !release.empty() ) { - // failed to get version string or unrecognized format - major = - minor = -1; + if ( wxSscanf(release.c_str(), wxT("%d.%d.%d"), &major, &minor, µ ) != 3 ) + { + micro = 0; + if ( wxSscanf(release.c_str(), wxT("%d.%d"), &major, &minor ) != 2 ) + { + // failed to get version string or unrecognized format + major = minor = micro = -1; + } + } } if ( verMaj ) *verMaj = major; if ( verMin ) *verMin = minor; + if ( verMicro ) + *verMicro = micro; // try to understand which OS are we running wxString kernel = wxGetCommandOutput(wxT("uname -s")); @@ -1163,6 +1155,16 @@ wxString wxGetOsDescription() return wxGetCommandOutput(wxT("uname -s -r -m")); } +bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn) +{ + int majorCur, minorCur, microCur; + wxGetOsVersion(&majorCur, &minorCur, µCur); + + return majorCur > majorVsn + || (majorCur == majorVsn && minorCur >= minorVsn) + || (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn); +} + #endif // !__DARWIN__ unsigned long wxGetProcessId() @@ -1177,7 +1179,7 @@ wxMemorySize wxGetFreeMemory() FILE *fp = fopen("/proc/meminfo", "r"); if ( fp ) { - long memFree = -1; + wxMemorySize memFreeBytes = (wxMemorySize)-1; char buf[1024]; if ( fgets(buf, WXSIZEOF(buf), fp) && fgets(buf, WXSIZEOF(buf), fp) ) @@ -1185,33 +1187,46 @@ wxMemorySize wxGetFreeMemory() // /proc/meminfo changed its format in kernel 2.6 if ( wxPlatformInfo().CheckOSVersion(2, 6) ) { - unsigned long cached, buffers; - sscanf(buf, "MemFree: %ld", &memFree); + unsigned long memFree; + if ( sscanf(buf, "MemFree: %lu", &memFree) == 1 ) + { + // We consider memory used by the IO buffers and cache as + // being "free" too as Linux aggressively uses free memory + // for caching and the amount of memory reported as really + // free is far too low for lightly loaded system. + if ( fgets(buf, WXSIZEOF(buf), fp) ) + { + unsigned long buffers; + if ( sscanf(buf, "Buffers: %lu", &buffers) == 1 ) + memFree += buffers; + } - fgets(buf, WXSIZEOF(buf), fp); - sscanf(buf, "Buffers: %lu", &buffers); + if ( fgets(buf, WXSIZEOF(buf), fp) ) + { + unsigned long cached; + if ( sscanf(buf, "Cached: %lu", &cached) == 1 ) + memFree += cached; + } - fgets(buf, WXSIZEOF(buf), fp); - sscanf(buf, "Cached: %lu", &cached); - - // add to "MemFree" also the "Buffers" and "Cached" values as - // free(1) does as otherwise the value never makes sense: for - // kernel 2.6 it's always almost 0 - memFree += buffers + cached; - - // values here are always expressed in kB and we want bytes - memFree *= 1024; + // values here are always expressed in kB and we want bytes + memFreeBytes = memFree; + memFreeBytes *= 1024; + } } else // Linux 2.4 (or < 2.6, anyhow) { - long memTotal, memUsed; - sscanf(buf, "Mem: %ld %ld %ld", &memTotal, &memUsed, &memFree); + long memTotal, memUsed, memFree; + if ( sscanf(buf, "Mem: %ld %ld %ld", + &memTotal, &memUsed, &memFree) == 3 ) + { + memFreeBytes = memFree; + } } } fclose(fp); - return (wxMemorySize)memFree; + return memFreeBytes; } #elif defined(__SGI__) struct rminfo realmem; @@ -1288,10 +1303,10 @@ public: gs_envVars.clear(); } - DECLARE_DYNAMIC_CLASS(wxSetEnvModule) + wxDECLARE_DYNAMIC_CLASS(wxSetEnvModule); }; -IMPLEMENT_DYNAMIC_CLASS(wxSetEnvModule, wxModule) +wxIMPLEMENT_DYNAMIC_CLASS(wxSetEnvModule, wxModule); #endif // USE_PUTENV @@ -1615,9 +1630,21 @@ void wxExecuteData::OnStart(int pid_) if ( process ) process->SetPid(pid); - // Finally, add this object itself to the list of child processes so that + // Add this object itself to the list of child processes so that // we can check for its termination the next time we get SIGCHLD. ms_childProcesses[pid] = this; + + // However, if the child exited before we finished setting up above, + // we may have already missed its SIGCHLD. So we also do an explicit + // check here before returning. + int exitcode; + if ( CheckForChildExit(pid, &exitcode) ) + { + // Handle its termination if it did. + // This call will implicitly remove it from ms_childProcesses + // and, if running asynchronously, it will delete itself. + OnExit(exitcode); + } } void wxExecuteData::OnExit(int exitcode_) diff --git a/Externals/wxWidgets3/src/unix/utilsx11.cpp b/Externals/wxWidgets3/src/unix/utilsx11.cpp index 12ff73e6a3..1f1febc8d4 100644 --- a/Externals/wxWidgets3/src/unix/utilsx11.cpp +++ b/Externals/wxWidgets3/src/unix/utilsx11.cpp @@ -24,6 +24,7 @@ #include "wx/iconbndl.h" #include "wx/apptrait.h" +#include "wx/private/launchbrowser.h" #ifdef __VMS #pragma message disable nosimpint @@ -36,11 +37,15 @@ #endif #ifdef __WXGTK__ -#include +#include #ifdef GDK_WINDOWING_X11 #include +#ifdef __WXGTK20__ +#include "wx/gtk/private/gtk2-compat.h" // gdk_window_get_screen() #endif #endif +GdkWindow* wxGetTopLevelGDK(); +#endif // Only X11 backend is supported for wxGTK here #if !defined(__WXGTK__) || defined(GDK_WINDOWING_X11) @@ -311,7 +316,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature) _NET_SUPPORTING_WM_CHECK, 0, LONG_MAX, False, XA_WINDOW, &type, &format, &nwins, &after, (unsigned char **)&wins); - if ( type != XA_WINDOW || nwins <= 0 || wins[0] == None ) + if ( type != XA_WINDOW || nwins == 0 || wins[0] == None ) return false; XFree(wins); @@ -803,6 +808,1728 @@ WXKeySym wxCharCodeWXToX(int id) return keySym; } +// all Xlib keysym-unicode charactor pair that could +// type from keyboard directly under variety layout +// Credits: This tab just modified around a public domain keysym dataset +// write by Markus G. Kuhn. See the link below. +// http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt +CodePair keySymTab[] = { + {0x0020, 0x0020}, // space + {0x0021, 0x0021}, // exclam + {0x0022, 0x0022}, // quotedbl + {0x0023, 0x0023}, // numbersign + {0x0024, 0x0024}, // dollar + {0x0025, 0x0025}, // percent + {0x0026, 0x0026}, // ampersand + {0x0027, 0x0027}, // apostrophe + {0x0027, 0x0027}, // quoteright /* deprecated */ + {0x0028, 0x0028}, // parenleft + {0x0029, 0x0029}, // parenright + {0x002a, 0x002a}, // asterisk + {0x002b, 0x002b}, // plus + {0x002c, 0x002c}, // comma + {0x002d, 0x002d}, // minus + {0x002e, 0x002e}, // period + {0x002f, 0x002f}, // slash + {0x0030, 0x0030}, // 0 + {0x0031, 0x0031}, // 1 + {0x0032, 0x0032}, // 2 + {0x0033, 0x0033}, // 3 + {0x0034, 0x0034}, // 4 + {0x0035, 0x0035}, // 5 + {0x0036, 0x0036}, // 6 + {0x0037, 0x0037}, // 7 + {0x0038, 0x0038}, // 8 + {0x0039, 0x0039}, // 9 + {0x003a, 0x003a}, // colon + {0x003b, 0x003b}, // semicolon + {0x003c, 0x003c}, // less + {0x003d, 0x003d}, // equal + {0x003e, 0x003e}, // greater + {0x003f, 0x003f}, // question + {0x0040, 0x0040}, // at + {0x0041, 0x0041}, // A + {0x0042, 0x0042}, // B + {0x0043, 0x0043}, // C + {0x0044, 0x0044}, // D + {0x0045, 0x0045}, // E + {0x0046, 0x0046}, // F + {0x0047, 0x0047}, // G + {0x0048, 0x0048}, // H + {0x0049, 0x0049}, // I + {0x004a, 0x004a}, // J + {0x004b, 0x004b}, // K + {0x004c, 0x004c}, // L + {0x004d, 0x004d}, // M + {0x004e, 0x004e}, // N + {0x004f, 0x004f}, // O + {0x0050, 0x0050}, // P + {0x0051, 0x0051}, // Q + {0x0052, 0x0052}, // R + {0x0053, 0x0053}, // S + {0x0054, 0x0054}, // T + {0x0055, 0x0055}, // U + {0x0056, 0x0056}, // V + {0x0057, 0x0057}, // W + {0x0058, 0x0058}, // X + {0x0059, 0x0059}, // Y + {0x005a, 0x005a}, // Z + {0x005b, 0x005b}, // bracketleft + {0x005c, 0x005c}, // backslash + {0x005d, 0x005d}, // bracketright + {0x005e, 0x005e}, // asciicircum + {0x005f, 0x005f}, // underscore + {0x0060, 0x0060}, // grave + {0x0060, 0x0060}, // quoteleft /* deprecated */ + {0x0061, 0x0061}, // a + {0x0062, 0x0062}, // b + {0x0063, 0x0063}, // c + {0x0064, 0x0064}, // d + {0x0065, 0x0065}, // e + {0x0066, 0x0066}, // f + {0x0067, 0x0067}, // g + {0x0068, 0x0068}, // h + {0x0069, 0x0069}, // i + {0x006a, 0x006a}, // j + {0x006b, 0x006b}, // k + {0x006c, 0x006c}, // l + {0x006d, 0x006d}, // m + {0x006e, 0x006e}, // n + {0x006f, 0x006f}, // o + {0x0070, 0x0070}, // p + {0x0071, 0x0071}, // q + {0x0072, 0x0072}, // r + {0x0073, 0x0073}, // s + {0x0074, 0x0074}, // t + {0x0075, 0x0075}, // u + {0x0076, 0x0076}, // v + {0x0077, 0x0077}, // w + {0x0078, 0x0078}, // x + {0x0079, 0x0079}, // y + {0x007a, 0x007a}, // z + {0x007b, 0x007b}, // braceleft + {0x007c, 0x007c}, // bar + {0x007d, 0x007d}, // braceright + {0x007e, 0x007e}, // asciitilde + {0x00a0, 0x00a0}, // nobreakspace + {0x00a1, 0x00a1}, // exclamdown + {0x00a2, 0x00a2}, // cent + {0x00a3, 0x00a3}, // sterling + {0x00a4, 0x00a4}, // currency + {0x00a5, 0x00a5}, // yen + {0x00a6, 0x00a6}, // brokenbar + {0x00a7, 0x00a7}, // section + {0x00a8, 0x00a8}, // diaeresis + {0x00a9, 0x00a9}, // copyright + {0x00aa, 0x00aa}, // ordfeminine + {0x00ab, 0x00ab}, // guillemotleft /* left angle quotation mark */ + {0x00ac, 0x00ac}, // notsign + {0x00ad, 0x00ad}, // hyphen + {0x00ae, 0x00ae}, // registered + {0x00af, 0x00af}, // macron + {0x00b0, 0x00b0}, // degree + {0x00b1, 0x00b1}, // plusminus + {0x00b2, 0x00b2}, // twosuperior + {0x00b3, 0x00b3}, // threesuperior + {0x00b4, 0x00b4}, // acute + {0x00b5, 0x00b5}, // mu + {0x00b6, 0x00b6}, // paragraph + {0x00b7, 0x00b7}, // periodcentered + {0x00b8, 0x00b8}, // cedilla + {0x00b9, 0x00b9}, // onesuperior + {0x00ba, 0x00ba}, // masculine + {0x00bb, 0x00bb}, // guillemotright /* right angle quotation mark */ + {0x00bc, 0x00bc}, // onequarter + {0x00bd, 0x00bd}, // onehalf + {0x00be, 0x00be}, // threequarters + {0x00bf, 0x00bf}, // questiondown + {0x00c0, 0x00c0}, // Agrave + {0x00c1, 0x00c1}, // Aacute + {0x00c2, 0x00c2}, // Acircumflex + {0x00c3, 0x00c3}, // Atilde + {0x00c4, 0x00c4}, // Adiaeresis + {0x00c5, 0x00c5}, // Aring + {0x00c6, 0x00c6}, // AE + {0x00c7, 0x00c7}, // Ccedilla + {0x00c8, 0x00c8}, // Egrave + {0x00c9, 0x00c9}, // Eacute + {0x00ca, 0x00ca}, // Ecircumflex + {0x00cb, 0x00cb}, // Ediaeresis + {0x00cc, 0x00cc}, // Igrave + {0x00cd, 0x00cd}, // Iacute + {0x00ce, 0x00ce}, // Icircumflex + {0x00cf, 0x00cf}, // Idiaeresis + {0x00d0, 0x00d0}, // ETH + {0x00d0, 0x00d0}, // Eth /* deprecated */ + {0x00d1, 0x00d1}, // Ntilde + {0x00d2, 0x00d2}, // Ograve + {0x00d3, 0x00d3}, // Oacute + {0x00d4, 0x00d4}, // Ocircumflex + {0x00d5, 0x00d5}, // Otilde + {0x00d6, 0x00d6}, // Odiaeresis + {0x00d7, 0x00d7}, // multiply + {0x00d8, 0x00d8}, // Ooblique + {0x00d9, 0x00d9}, // Ugrave + {0x00da, 0x00da}, // Uacute + {0x00db, 0x00db}, // Ucircumflex + {0x00dc, 0x00dc}, // Udiaeresis + {0x00dd, 0x00dd}, // Yacute + {0x00de, 0x00de}, // THORN + {0x00de, 0x00de}, // Thorn /* deprecated */ + {0x00df, 0x00df}, // ssharp + {0x00e0, 0x00e0}, // agrave + {0x00e1, 0x00e1}, // aacute + {0x00e2, 0x00e2}, // acircumflex + {0x00e3, 0x00e3}, // atilde + {0x00e4, 0x00e4}, // adiaeresis + {0x00e5, 0x00e5}, // aring + {0x00e6, 0x00e6}, // ae + {0x00e7, 0x00e7}, // ccedilla + {0x00e8, 0x00e8}, // egrave + {0x00e9, 0x00e9}, // eacute + {0x00ea, 0x00ea}, // ecircumflex + {0x00eb, 0x00eb}, // ediaeresis + {0x00ec, 0x00ec}, // igrave + {0x00ed, 0x00ed}, // iacute + {0x00ee, 0x00ee}, // icircumflex + {0x00ef, 0x00ef}, // idiaeresis + {0x00f0, 0x00f0}, // eth + {0x00f1, 0x00f1}, // ntilde + {0x00f2, 0x00f2}, // ograve + {0x00f3, 0x00f3}, // oacute + {0x00f4, 0x00f4}, // ocircumflex + {0x00f5, 0x00f5}, // otilde + {0x00f6, 0x00f6}, // odiaeresis + {0x00f7, 0x00f7}, // division + {0x00f8, 0x00f8}, // oslash + {0x00f9, 0x00f9}, // ugrave + {0x00fa, 0x00fa}, // uacute + {0x00fb, 0x00fb}, // ucircumflex + {0x00fc, 0x00fc}, // udiaeresis + {0x00fd, 0x00fd}, // yacute + {0x00fe, 0x00fe}, // thorn + {0x00ff, 0x00ff}, // ydiaeresis + {0x01a1, 0x0104}, // Aogonek + {0x01a2, 0x02d8}, // breve + {0x01a3, 0x0141}, // Lstroke + {0x01a5, 0x013d}, // Lcaron + {0x01a6, 0x015a}, // Sacute + {0x01a9, 0x0160}, // Scaron + {0x01aa, 0x015e}, // Scedilla + {0x01ab, 0x0164}, // Tcaron + {0x01ac, 0x0179}, // Zacute + {0x01ae, 0x017d}, // Zcaron + {0x01af, 0x017b}, // Zabovedot + {0x01b1, 0x0105}, // aogonek + {0x01b2, 0x02db}, // ogonek + {0x01b3, 0x0142}, // lstroke + {0x01b5, 0x013e}, // lcaron + {0x01b6, 0x015b}, // sacute + {0x01b7, 0x02c7}, // caron + {0x01b9, 0x0161}, // scaron + {0x01ba, 0x015f}, // scedilla + {0x01bb, 0x0165}, // tcaron + {0x01bc, 0x017a}, // zacute + {0x01bd, 0x02dd}, // doubleacute + {0x01be, 0x017e}, // zcaron + {0x01bf, 0x017c}, // zabovedot + {0x01c0, 0x0154}, // Racute + {0x01c3, 0x0102}, // Abreve + {0x01c5, 0x0139}, // Lacute + {0x01c6, 0x0106}, // Cacute + {0x01c8, 0x010c}, // Ccaron + {0x01ca, 0x0118}, // Eogonek + {0x01cc, 0x011a}, // Ecaron + {0x01cf, 0x010e}, // Dcaron + {0x01d0, 0x0110}, // Dstroke + {0x01d1, 0x0143}, // Nacute + {0x01d2, 0x0147}, // Ncaron + {0x01d5, 0x0150}, // Odoubleacute + {0x01d8, 0x0158}, // Rcaron + {0x01d9, 0x016e}, // Uring + {0x01db, 0x0170}, // Udoubleacute + {0x01de, 0x0162}, // Tcedilla + {0x01e0, 0x0155}, // racute + {0x01e3, 0x0103}, // abreve + {0x01e5, 0x013a}, // lacute + {0x01e6, 0x0107}, // cacute + {0x01e8, 0x010d}, // ccaron + {0x01ea, 0x0119}, // eogonek + {0x01ec, 0x011b}, // ecaron + {0x01ef, 0x010f}, // dcaron + {0x01f0, 0x0111}, // dstroke + {0x01f1, 0x0144}, // nacute + {0x01f2, 0x0148}, // ncaron + {0x01f5, 0x0151}, // odoubleacute + {0x01f8, 0x0159}, // rcaron + {0x01f9, 0x016f}, // uring + {0x01fb, 0x0171}, // udoubleacute + {0x01fe, 0x0163}, // tcedilla + {0x01ff, 0x02d9}, // abovedot + {0x02a1, 0x0126}, // Hstroke + {0x02a6, 0x0124}, // Hcircumflex + {0x02a9, 0x0130}, // Iabovedot + {0x02ab, 0x011e}, // Gbreve + {0x02ac, 0x0134}, // Jcircumflex + {0x02b1, 0x0127}, // hstroke + {0x02b6, 0x0125}, // hcircumflex + {0x02b9, 0x0131}, // idotless + {0x02bb, 0x011f}, // gbreve + {0x02bc, 0x0135}, // jcircumflex + {0x02c5, 0x010a}, // Cabovedot + {0x02c6, 0x0108}, // Ccircumflex + {0x02d5, 0x0120}, // Gabovedot + {0x02d8, 0x011c}, // Gcircumflex + {0x02dd, 0x016c}, // Ubreve + {0x02de, 0x015c}, // Scircumflex + {0x02e5, 0x010b}, // cabovedot + {0x02e6, 0x0109}, // ccircumflex + {0x02f5, 0x0121}, // gabovedot + {0x02f8, 0x011d}, // gcircumflex + {0x02fd, 0x016d}, // ubreve + {0x02fe, 0x015d}, // scircumflex + {0x03a2, 0x0138}, // kra + {0x03a3, 0x0156}, // Rcedilla + {0x03a5, 0x0128}, // Itilde + {0x03a6, 0x013b}, // Lcedilla + {0x03aa, 0x0112}, // Emacron + {0x03ab, 0x0122}, // Gcedilla + {0x03ac, 0x0166}, // Tslash + {0x03b3, 0x0157}, // rcedilla + {0x03b5, 0x0129}, // itilde + {0x03b6, 0x013c}, // lcedilla + {0x03ba, 0x0113}, // emacron + {0x03bb, 0x0123}, // gcedilla + {0x03bc, 0x0167}, // tslash + {0x03bd, 0x014a}, // ENG + {0x03bf, 0x014b}, // eng + {0x03c0, 0x0100}, // Amacron + {0x03c7, 0x012e}, // Iogonek + {0x03cc, 0x0116}, // Eabovedot + {0x03cf, 0x012a}, // Imacron + {0x03d1, 0x0145}, // Ncedilla + {0x03d2, 0x014c}, // Omacron + {0x03d3, 0x0136}, // Kcedilla + {0x03d9, 0x0172}, // Uogonek + {0x03dd, 0x0168}, // Utilde + {0x03de, 0x016a}, // Umacron + {0x03e0, 0x0101}, // amacron + {0x03e7, 0x012f}, // iogonek + {0x03ec, 0x0117}, // eabovedot + {0x03ef, 0x012b}, // imacron + {0x03f1, 0x0146}, // ncedilla + {0x03f2, 0x014d}, // omacron + {0x03f3, 0x0137}, // kcedilla + {0x03f9, 0x0173}, // uogonek + {0x03fd, 0x0169}, // utilde + {0x03fe, 0x016b}, // umacron + {0x047e, 0x203e}, // overline + {0x04a1, 0x3002}, // kana_fullstop + {0x04a2, 0x300c}, // kana_openingbracket + {0x04a3, 0x300d}, // kana_closingbracket + {0x04a4, 0x3001}, // kana_comma + {0x04a5, 0x30fb}, // kana_conjunctive + {0x04a6, 0x30f2}, // kana_WO + {0x04a7, 0x30a1}, // kana_a + {0x04a8, 0x30a3}, // kana_i + {0x04a9, 0x30a5}, // kana_u + {0x04aa, 0x30a7}, // kana_e + {0x04ab, 0x30a9}, // kana_o + {0x04ac, 0x30e3}, // kana_ya + {0x04ad, 0x30e5}, // kana_yu + {0x04ae, 0x30e7}, // kana_yo + {0x04af, 0x30c3}, // kana_tsu + {0x04b0, 0x30fc}, // prolongedsound + {0x04b1, 0x30a2}, // kana_A + {0x04b2, 0x30a4}, // kana_I + {0x04b3, 0x30a6}, // kana_U + {0x04b4, 0x30a8}, // kana_E + {0x04b5, 0x30aa}, // kana_O + {0x04b6, 0x30ab}, // kana_KA + {0x04b7, 0x30ad}, // kana_KI + {0x04b8, 0x30af}, // kana_KU + {0x04b9, 0x30b1}, // kana_KE + {0x04ba, 0x30b3}, // kana_KO + {0x04bb, 0x30b5}, // kana_SA + {0x04bc, 0x30b7}, // kana_SHI + {0x04bd, 0x30b9}, // kana_SU + {0x04be, 0x30bb}, // kana_SE + {0x04bf, 0x30bd}, // kana_SO + {0x04c0, 0x30bf}, // kana_TA + {0x04c1, 0x30c1}, // kana_CHI + {0x04c2, 0x30c4}, // kana_TSU + {0x04c3, 0x30c6}, // kana_TE + {0x04c4, 0x30c8}, // kana_TO + {0x04c5, 0x30ca}, // kana_NA + {0x04c6, 0x30cb}, // kana_NI + {0x04c7, 0x30cc}, // kana_NU + {0x04c8, 0x30cd}, // kana_NE + {0x04c9, 0x30ce}, // kana_NO + {0x04ca, 0x30cf}, // kana_HA + {0x04cb, 0x30d2}, // kana_HI + {0x04cc, 0x30d5}, // kana_FU + {0x04cd, 0x30d8}, // kana_HE + {0x04ce, 0x30db}, // kana_HO + {0x04cf, 0x30de}, // kana_MA + {0x04d0, 0x30df}, // kana_MI + {0x04d1, 0x30e0}, // kana_MU + {0x04d2, 0x30e1}, // kana_ME + {0x04d3, 0x30e2}, // kana_MO + {0x04d4, 0x30e4}, // kana_YA + {0x04d5, 0x30e6}, // kana_YU + {0x04d6, 0x30e8}, // kana_YO + {0x04d7, 0x30e9}, // kana_RA + {0x04d8, 0x30ea}, // kana_RI + {0x04d9, 0x30eb}, // kana_RU + {0x04da, 0x30ec}, // kana_RE + {0x04db, 0x30ed}, // kana_RO + {0x04dc, 0x30ef}, // kana_WA + {0x04dd, 0x30f3}, // kana_N + {0x04de, 0x309b}, // voicedsound + {0x04df, 0x309c}, // semivoicedsound + {0x05ac, 0x060c}, // Arabic_comma + {0x05bb, 0x061b}, // Arabic_semicolon + {0x05bf, 0x061f}, // Arabic_question_mark + {0x05c1, 0x0621}, // Arabic_hamza + {0x05c2, 0x0622}, // Arabic_maddaonalef + {0x05c3, 0x0623}, // Arabic_hamzaonalef + {0x05c4, 0x0624}, // Arabic_hamzaonwaw + {0x05c5, 0x0625}, // Arabic_hamzaunderalef + {0x05c6, 0x0626}, // Arabic_hamzaonyeh + {0x05c7, 0x0627}, // Arabic_alef + {0x05c8, 0x0628}, // Arabic_beh + {0x05c9, 0x0629}, // Arabic_tehmarbuta + {0x05ca, 0x062a}, // Arabic_teh + {0x05cb, 0x062b}, // Arabic_theh + {0x05cc, 0x062c}, // Arabic_jeem + {0x05cd, 0x062d}, // Arabic_hah + {0x05ce, 0x062e}, // Arabic_khah + {0x05cf, 0x062f}, // Arabic_dal + {0x05d0, 0x0630}, // Arabic_thal + {0x05d1, 0x0631}, // Arabic_ra + {0x05d2, 0x0632}, // Arabic_zain + {0x05d3, 0x0633}, // Arabic_seen + {0x05d4, 0x0634}, // Arabic_sheen + {0x05d5, 0x0635}, // Arabic_sad + {0x05d6, 0x0636}, // Arabic_dad + {0x05d7, 0x0637}, // Arabic_tah + {0x05d8, 0x0638}, // Arabic_zah + {0x05d9, 0x0639}, // Arabic_ain + {0x05da, 0x063a}, // Arabic_ghain + {0x05e0, 0x0640}, // Arabic_tatweel + {0x05e1, 0x0641}, // Arabic_feh + {0x05e2, 0x0642}, // Arabic_qaf + {0x05e3, 0x0643}, // Arabic_kaf + {0x05e4, 0x0644}, // Arabic_lam + {0x05e5, 0x0645}, // Arabic_meem + {0x05e6, 0x0646}, // Arabic_noon + {0x05e7, 0x0647}, // Arabic_ha + {0x05e8, 0x0648}, // Arabic_waw + {0x05e9, 0x0649}, // Arabic_alefmaksura + {0x05ea, 0x064a}, // Arabic_yeh + {0x05eb, 0x064b}, // Arabic_fathatan + {0x05ec, 0x064c}, // Arabic_dammatan + {0x05ed, 0x064d}, // Arabic_kasratan + {0x05ee, 0x064e}, // Arabic_fatha + {0x05ef, 0x064f}, // Arabic_damma + {0x05f0, 0x0650}, // Arabic_kasra + {0x05f1, 0x0651}, // Arabic_shadda + {0x05f2, 0x0652}, // Arabic_sukun + {0x06a1, 0x0452}, // Serbian_dje + {0x06a2, 0x0453}, // Macedonia_gje + {0x06a3, 0x0451}, // Cyrillic_io + {0x06a4, 0x0454}, // Ukrainian_ie + {0x06a5, 0x0455}, // Macedonia_dse + {0x06a6, 0x0456}, // Ukrainian_i + {0x06a7, 0x0457}, // Ukrainian_yi + {0x06a8, 0x0458}, // Cyrillic_je + {0x06a9, 0x0459}, // Cyrillic_lje + {0x06aa, 0x045a}, // Cyrillic_nje + {0x06ab, 0x045b}, // Serbian_tshe + {0x06ac, 0x045c}, // Macedonia_kje + {0x06ae, 0x045e}, // Byelorussian_shortu + {0x06af, 0x045f}, // Cyrillic_dzhe + {0x06b0, 0x2116}, // numerosign + {0x06b1, 0x0402}, // Serbian_DJE + {0x06b2, 0x0403}, // Macedonia_GJE + {0x06b3, 0x0401}, // Cyrillic_IO + {0x06b4, 0x0404}, // Ukrainian_IE + {0x06b5, 0x0405}, // Macedonia_DSE + {0x06b6, 0x0406}, // Ukrainian_I + {0x06b7, 0x0407}, // Ukrainian_YI + {0x06b8, 0x0408}, // Cyrillic_JE + {0x06b9, 0x0409}, // Cyrillic_LJE + {0x06ba, 0x040a}, // Cyrillic_NJE + {0x06bb, 0x040b}, // Serbian_TSHE + {0x06bc, 0x040c}, // Macedonia_KJE + {0x06be, 0x040e}, // Byelorussian_SHORTU + {0x06bf, 0x040f}, // Cyrillic_DZHE + {0x06c0, 0x044e}, // Cyrillic_yu + {0x06c1, 0x0430}, // Cyrillic_a + {0x06c2, 0x0431}, // Cyrillic_be + {0x06c3, 0x0446}, // Cyrillic_tse + {0x06c4, 0x0434}, // Cyrillic_de + {0x06c5, 0x0435}, // Cyrillic_ie + {0x06c6, 0x0444}, // Cyrillic_ef + {0x06c7, 0x0433}, // Cyrillic_ghe + {0x06c8, 0x0445}, // Cyrillic_ha + {0x06c9, 0x0438}, // Cyrillic_i + {0x06ca, 0x0439}, // Cyrillic_shorti + {0x06cb, 0x043a}, // Cyrillic_ka + {0x06cc, 0x043b}, // Cyrillic_el + {0x06cd, 0x043c}, // Cyrillic_em + {0x06ce, 0x043d}, // Cyrillic_en + {0x06cf, 0x043e}, // Cyrillic_o + {0x06d0, 0x043f}, // Cyrillic_pe + {0x06d1, 0x044f}, // Cyrillic_ya + {0x06d2, 0x0440}, // Cyrillic_er + {0x06d3, 0x0441}, // Cyrillic_es + {0x06d4, 0x0442}, // Cyrillic_te + {0x06d5, 0x0443}, // Cyrillic_u + {0x06d6, 0x0436}, // Cyrillic_zhe + {0x06d7, 0x0432}, // Cyrillic_ve + {0x06d8, 0x044c}, // Cyrillic_softsign + {0x06d9, 0x044b}, // Cyrillic_yeru + {0x06da, 0x0437}, // Cyrillic_ze + {0x06db, 0x0448}, // Cyrillic_sha + {0x06dc, 0x044d}, // Cyrillic_e + {0x06dd, 0x0449}, // Cyrillic_shcha + {0x06de, 0x0447}, // Cyrillic_che + {0x06df, 0x044a}, // Cyrillic_hardsign + {0x06e0, 0x042e}, // Cyrillic_YU + {0x06e1, 0x0410}, // Cyrillic_A + {0x06e2, 0x0411}, // Cyrillic_BE + {0x06e3, 0x0426}, // Cyrillic_TSE + {0x06e4, 0x0414}, // Cyrillic_DE + {0x06e5, 0x0415}, // Cyrillic_IE + {0x06e6, 0x0424}, // Cyrillic_EF + {0x06e7, 0x0413}, // Cyrillic_GHE + {0x06e8, 0x0425}, // Cyrillic_HA + {0x06e9, 0x0418}, // Cyrillic_I + {0x06ea, 0x0419}, // Cyrillic_SHORTI + {0x06eb, 0x041a}, // Cyrillic_KA + {0x06ec, 0x041b}, // Cyrillic_EL + {0x06ed, 0x041c}, // Cyrillic_EM + {0x06ee, 0x041d}, // Cyrillic_EN + {0x06ef, 0x041e}, // Cyrillic_O + {0x06f0, 0x041f}, // Cyrillic_PE + {0x06f1, 0x042f}, // Cyrillic_YA + {0x06f2, 0x0420}, // Cyrillic_ER + {0x06f3, 0x0421}, // Cyrillic_ES + {0x06f4, 0x0422}, // Cyrillic_TE + {0x06f5, 0x0423}, // Cyrillic_U + {0x06f6, 0x0416}, // Cyrillic_ZHE + {0x06f7, 0x0412}, // Cyrillic_VE + {0x06f8, 0x042c}, // Cyrillic_SOFTSIGN + {0x06f9, 0x042b}, // Cyrillic_YERU + {0x06fa, 0x0417}, // Cyrillic_ZE + {0x06fb, 0x0428}, // Cyrillic_SHA + {0x06fc, 0x042d}, // Cyrillic_E + {0x06fd, 0x0429}, // Cyrillic_SHCHA + {0x06fe, 0x0427}, // Cyrillic_CHE + {0x06ff, 0x042a}, // Cyrillic_HARDSIGN + {0x07a1, 0x0386}, // Greek_ALPHAaccent + {0x07a2, 0x0388}, // Greek_EPSILONaccent + {0x07a3, 0x0389}, // Greek_ETAaccent + {0x07a4, 0x038a}, // Greek_IOTAaccent + {0x07a5, 0x03aa}, // Greek_IOTAdiaeresis + {0x07a7, 0x038c}, // Greek_OMICRONaccent + {0x07a8, 0x038e}, // Greek_UPSILONaccent + {0x07a9, 0x03ab}, // Greek_UPSILONdieresis + {0x07ab, 0x038f}, // Greek_OMEGAaccent + {0x07ae, 0x0385}, // Greek_accentdieresis + {0x07af, 0x2015}, // Greek_horizbar + {0x07b1, 0x03ac}, // Greek_alphaaccent + {0x07b2, 0x03ad}, // Greek_epsilonaccent + {0x07b3, 0x03ae}, // Greek_etaaccent + {0x07b4, 0x03af}, // Greek_iotaaccent + {0x07b5, 0x03ca}, // Greek_iotadieresis + {0x07b6, 0x0390}, // Greek_iotaaccentdieresis + {0x07b7, 0x03cc}, // Greek_omicronaccent + {0x07b8, 0x03cd}, // Greek_upsilonaccent + {0x07b9, 0x03cb}, // Greek_upsilondieresis + {0x07ba, 0x03b0}, // Greek_upsilonaccentdieresis + {0x07bb, 0x03ce}, // Greek_omegaaccent + {0x07c1, 0x0391}, // Greek_ALPHA + {0x07c2, 0x0392}, // Greek_BETA + {0x07c3, 0x0393}, // Greek_GAMMA + {0x07c4, 0x0394}, // Greek_DELTA + {0x07c5, 0x0395}, // Greek_EPSILON + {0x07c6, 0x0396}, // Greek_ZETA + {0x07c7, 0x0397}, // Greek_ETA + {0x07c8, 0x0398}, // Greek_THETA + {0x07c9, 0x0399}, // Greek_IOTA + {0x07ca, 0x039a}, // Greek_KAPPA + {0x07cb, 0x039b}, // Greek_LAMBDA + {0x07cb, 0x039b}, // Greek_LAMDA + {0x07cc, 0x039c}, // Greek_MU + {0x07cd, 0x039d}, // Greek_NU + {0x07ce, 0x039e}, // Greek_XI + {0x07cf, 0x039f}, // Greek_OMICRON + {0x07d0, 0x03a0}, // Greek_PI + {0x07d1, 0x03a1}, // Greek_RHO + {0x07d2, 0x03a3}, // Greek_SIGMA + {0x07d4, 0x03a4}, // Greek_TAU + {0x07d5, 0x03a5}, // Greek_UPSILON + {0x07d6, 0x03a6}, // Greek_PHI + {0x07d7, 0x03a7}, // Greek_CHI + {0x07d8, 0x03a8}, // Greek_PSI + {0x07d9, 0x03a9}, // Greek_OMEGA + {0x07e1, 0x03b1}, // Greek_alpha + {0x07e2, 0x03b2}, // Greek_beta + {0x07e3, 0x03b3}, // Greek_gamma + {0x07e4, 0x03b4}, // Greek_delta + {0x07e5, 0x03b5}, // Greek_epsilon + {0x07e6, 0x03b6}, // Greek_zeta + {0x07e7, 0x03b7}, // Greek_eta + {0x07e8, 0x03b8}, // Greek_theta + {0x07e9, 0x03b9}, // Greek_iota + {0x07ea, 0x03ba}, // Greek_kappa + {0x07eb, 0x03bb}, // Greek_lambda + {0x07ec, 0x03bc}, // Greek_mu + {0x07ed, 0x03bd}, // Greek_nu + {0x07ee, 0x03be}, // Greek_xi + {0x07ef, 0x03bf}, // Greek_omicron + {0x07f0, 0x03c0}, // Greek_pi + {0x07f1, 0x03c1}, // Greek_rho + {0x07f2, 0x03c3}, // Greek_sigma + {0x07f3, 0x03c2}, // Greek_finalsmallsigma + {0x07f4, 0x03c4}, // Greek_tau + {0x07f5, 0x03c5}, // Greek_upsilon + {0x07f6, 0x03c6}, // Greek_phi + {0x07f7, 0x03c7}, // Greek_chi + {0x07f8, 0x03c8}, // Greek_psi + {0x07f9, 0x03c9}, // Greek_omega + {0x08a1, 0x23b7}, // leftradical + {0x08a2, 0x250c}, // topleftradical + {0x08a3, 0x2500}, // horizconnector + {0x08a4, 0x2320}, // topintegral + {0x08a5, 0x2321}, // botintegral + {0x08a6, 0x2502}, // vertconnector + {0x08a7, 0x23a1}, // topleftsqbracket + {0x08a8, 0x23a3}, // botleftsqbracket + {0x08a9, 0x23a4}, // toprightsqbracket + {0x08aa, 0x23a6}, // botrightsqbracket + {0x08ab, 0x239b}, // topleftparens + {0x08ac, 0x239d}, // botleftparens + {0x08ad, 0x239e}, // toprightparens + {0x08ae, 0x23a0}, // botrightparens + {0x08af, 0x23a8}, // leftmiddlecurlybrace + {0x08b0, 0x23ac}, // rightmiddlecurlybrace + {0x08b1, 0x0000}, // topleftsummation + {0x08b2, 0x0000}, // botleftsummation + {0x08b3, 0x0000}, // topvertsummationconnector + {0x08b4, 0x0000}, // botvertsummationconnector + {0x08b5, 0x0000}, // toprightsummation + {0x08b6, 0x0000}, // botrightsummation + {0x08b7, 0x0000}, // rightmiddlesummation + {0x08bc, 0x2264}, // lessthanequal + {0x08bd, 0x2260}, // notequal + {0x08be, 0x2265}, // greaterthanequal + {0x08bf, 0x222b}, // integral + {0x08c0, 0x2234}, // therefore + {0x08c1, 0x221d}, // variation + {0x08c2, 0x221e}, // infinity + {0x08c5, 0x2207}, // nabla + {0x08c8, 0x223c}, // approximate + {0x08c9, 0x2243}, // similarequal + {0x08cd, 0x21d4}, // ifonlyif + {0x08ce, 0x21d2}, // implies + {0x08cf, 0x2261}, // identical + {0x08d6, 0x221a}, // radical + {0x08da, 0x2282}, // includedin + {0x08db, 0x2283}, // includes + {0x08dc, 0x2229}, // intersection + {0x08dd, 0x222a}, // union + {0x08de, 0x2227}, // logicaland + {0x08df, 0x2228}, // logicalor + {0x08ef, 0x2202}, // partialderivative + {0x08f6, 0x0192}, // function + {0x08fb, 0x2190}, // leftarrow + {0x08fc, 0x2191}, // uparrow + {0x08fd, 0x2192}, // rightarrow + {0x08fe, 0x2193}, // downarrow + {0x09df, 0x0000}, // blank + {0x09e0, 0x25c6}, // soliddiamond + {0x09e1, 0x2592}, // checkerboard + {0x09e2, 0x2409}, // ht + {0x09e3, 0x240c}, // ff + {0x09e4, 0x240d}, // cr + {0x09e5, 0x240a}, // lf + {0x09e8, 0x2424}, // nl + {0x09e9, 0x240b}, // vt + {0x09ea, 0x2518}, // lowrightcorner + {0x09eb, 0x2510}, // uprightcorner + {0x09ec, 0x250c}, // upleftcorner + {0x09ed, 0x2514}, // lowleftcorner + {0x09ee, 0x253c}, // crossinglines + {0x09ef, 0x23ba}, // horizlinescan1 + {0x09f0, 0x23bb}, // horizlinescan3 + {0x09f1, 0x2500}, // horizlinescan5 + {0x09f2, 0x23bc}, // horizlinescan7 + {0x09f3, 0x23bd}, // horizlinescan9 + {0x09f4, 0x251c}, // leftt + {0x09f5, 0x2524}, // rightt + {0x09f6, 0x2534}, // bott + {0x09f7, 0x252c}, // topt + {0x09f8, 0x2502}, // vertbar + {0x0aa1, 0x2003}, // emspace + {0x0aa2, 0x2002}, // enspace + {0x0aa3, 0x2004}, // em3space + {0x0aa4, 0x2005}, // em4space + {0x0aa5, 0x2007}, // digitspace + {0x0aa6, 0x2008}, // punctspace + {0x0aa7, 0x2009}, // thinspace + {0x0aa8, 0x200a}, // hairspace + {0x0aa9, 0x2014}, // emdash + {0x0aaa, 0x2013}, // endash + {0x0aac, 0x2423}, // signifblank + {0x0aae, 0x2026}, // ellipsis + {0x0aaf, 0x2025}, // doubbaselinedot + {0x0ab0, 0x2153}, // onethird + {0x0ab1, 0x2154}, // twothirds + {0x0ab2, 0x2155}, // onefifth + {0x0ab3, 0x2156}, // twofifths + {0x0ab4, 0x2157}, // threefifths + {0x0ab5, 0x2158}, // fourfifths + {0x0ab6, 0x2159}, // onesixth + {0x0ab7, 0x215a}, // fivesixths + {0x0ab8, 0x2105}, // careof + {0x0abb, 0x2012}, // figdash + {0x0abc, 0x27e8}, // leftanglebracket + {0x0abd, 0x002e}, // decimalpoint + {0x0abe, 0x27e9}, // rightanglebracket + {0x0abf, 0x0000}, // marker + {0x0ac3, 0x215b}, // oneeighth + {0x0ac4, 0x215c}, // threeeighths + {0x0ac5, 0x215d}, // fiveeighths + {0x0ac6, 0x215e}, // seveneighths + {0x0ac9, 0x2122}, // trademark + {0x0aca, 0x2613}, // signaturemark + {0x0acb, 0x0000}, // trademarkincircle + {0x0acc, 0x25c1}, // leftopentriangle + {0x0acd, 0x25b7}, // rightopentriangle + {0x0ace, 0x25cb}, // emopencircle + {0x0acf, 0x25af}, // emopenrectangle + {0x0ad0, 0x2018}, // leftsinglequotemark + {0x0ad1, 0x2019}, // rightsinglequotemark + {0x0ad2, 0x201c}, // leftdoublequotemark + {0x0ad3, 0x201d}, // rightdoublequotemark + {0x0ad4, 0x211e}, // prescription + {0x0ad6, 0x2032}, // minutes + {0x0ad7, 0x2033}, // seconds + {0x0ad9, 0x271d}, // latincross + {0x0ada, 0x0000}, // hexagram + {0x0adb, 0x25ac}, // filledrectbullet + {0x0adc, 0x25c0}, // filledlefttribullet + {0x0add, 0x25b6}, // filledrighttribullet + {0x0ade, 0x25cf}, // emfilledcircle + {0x0adf, 0x25ae}, // emfilledrect + {0x0ae0, 0x25e6}, // enopencircbullet + {0x0ae1, 0x25ab}, // enopensquarebullet + {0x0ae2, 0x25ad}, // openrectbullet + {0x0ae3, 0x25b3}, // opentribulletup + {0x0ae4, 0x25bd}, // opentribulletdown + {0x0ae5, 0x2606}, // openstar + {0x0ae6, 0x2022}, // enfilledcircbullet + {0x0ae7, 0x25aa}, // enfilledsqbullet + {0x0ae8, 0x25b2}, // filledtribulletup + {0x0ae9, 0x25bc}, // filledtribulletdown + {0x0aea, 0x261c}, // leftpointer + {0x0aeb, 0x261e}, // rightpointer + {0x0aec, 0x2663}, // club + {0x0aed, 0x2666}, // diamond + {0x0aee, 0x2665}, // heart + {0x0af0, 0x2720}, // maltesecross + {0x0af1, 0x2020}, // dagger + {0x0af2, 0x2021}, // doubledagger + {0x0af3, 0x2713}, // checkmark + {0x0af4, 0x2717}, // ballotcross + {0x0af5, 0x266f}, // musicalsharp + {0x0af6, 0x266d}, // musicalflat + {0x0af7, 0x2642}, // malesymbol + {0x0af8, 0x2640}, // femalesymbol + {0x0af9, 0x260e}, // telephone + {0x0afa, 0x2315}, // telephonerecorder + {0x0afb, 0x2117}, // phonographcopyright + {0x0afc, 0x2038}, // caret + {0x0afd, 0x201a}, // singlelowquotemark + {0x0afe, 0x201e}, // doublelowquotemark + {0x0aff, 0x0000}, // cursor + {0x0ba3, 0x003c}, // leftcaret + {0x0ba6, 0x003e}, // rightcaret + {0x0ba8, 0x2228}, // downcaret + {0x0ba9, 0x2227}, // upcaret + {0x0bc0, 0x00af}, // overbar + {0x0bc2, 0x22a5}, // downtack + {0x0bc3, 0x2229}, // upshoe + {0x0bc4, 0x230a}, // downstile + {0x0bc6, 0x005f}, // underbar + {0x0bca, 0x2218}, // jot + {0x0bcc, 0x2395}, // quad + {0x0bce, 0x22a4}, // uptack + {0x0bcf, 0x25cb}, // circle + {0x0bd3, 0x2308}, // upstile + {0x0bd6, 0x222a}, // downshoe + {0x0bd8, 0x2283}, // rightshoe + {0x0bda, 0x2282}, // leftshoe + {0x0bdc, 0x22a2}, // lefttack + {0x0bfc, 0x22a3}, // righttack + {0x0cdf, 0x2017}, // hebrew_doublelowline + {0x0ce0, 0x05d0}, // hebrew_aleph + {0x0ce1, 0x05d1}, // hebrew_bet + {0x0ce1, 0x05d1}, // hebrew_beth /* deprecated */ + {0x0ce2, 0x05d2}, // hebrew_gimel + {0x0ce2, 0x05d2}, // hebrew_gimmel /* deprecated */ + {0x0ce3, 0x05d3}, // hebrew_dalet + {0x0ce3, 0x05d3}, // hebrew_daleth /* deprecated */ + {0x0ce4, 0x05d4}, // hebrew_he + {0x0ce5, 0x05d5}, // hebrew_waw + {0x0ce6, 0x05d6}, // hebrew_zain + {0x0ce6, 0x05d6}, // hebrew_zayin /* deprecated */ + {0x0ce7, 0x05d7}, // hebrew_chet + {0x0ce7, 0x05d7}, // hebrew_het /* deprecated */ + {0x0ce8, 0x05d8}, // hebrew_tet + {0x0ce8, 0x05d8}, // hebrew_teth /* deprecated */ + {0x0ce9, 0x05d9}, // hebrew_yod + {0x0cea, 0x05da}, // hebrew_finalkaph + {0x0ceb, 0x05db}, // hebrew_kaph + {0x0cec, 0x05dc}, // hebrew_lamed + {0x0ced, 0x05dd}, // hebrew_finalmem + {0x0cee, 0x05de}, // hebrew_mem + {0x0cef, 0x05df}, // hebrew_finalnun + {0x0cf0, 0x05e0}, // hebrew_nun + {0x0cf1, 0x05e1}, // hebrew_samech + {0x0cf1, 0x05e1}, // hebrew_samekh /* deprecated */ + {0x0cf2, 0x05e2}, // hebrew_ayin + {0x0cf3, 0x05e3}, // hebrew_finalpe + {0x0cf4, 0x05e4}, // hebrew_pe + {0x0cf5, 0x05e5}, // hebrew_finalzade + {0x0cf5, 0x05e5}, // hebrew_finalzadi /* deprecated */ + {0x0cf6, 0x05e6}, // hebrew_zade + {0x0cf6, 0x05e6}, // hebrew_zadi /* deprecated */ + {0x0cf7, 0x05e7}, // hebrew_kuf /* deprecated */ + {0x0cf7, 0x05e7}, // hebrew_qoph + {0x0cf8, 0x05e8}, // hebrew_resh + {0x0cf9, 0x05e9}, // hebrew_shin + {0x0cfa, 0x05ea}, // hebrew_taf /* deprecated */ + {0x0cfa, 0x05ea}, // hebrew_taw + {0x0da1, 0x0e01}, // Thai_kokai + {0x0da2, 0x0e02}, // Thai_khokhai + {0x0da3, 0x0e03}, // Thai_khokhuat + {0x0da4, 0x0e04}, // Thai_khokhwai + {0x0da5, 0x0e05}, // Thai_khokhon + {0x0da6, 0x0e06}, // Thai_khorakhang + {0x0da7, 0x0e07}, // Thai_ngongu + {0x0da8, 0x0e08}, // Thai_chochan + {0x0da9, 0x0e09}, // Thai_choching + {0x0daa, 0x0e0a}, // Thai_chochang + {0x0dab, 0x0e0b}, // Thai_soso + {0x0dac, 0x0e0c}, // Thai_chochoe + {0x0dad, 0x0e0d}, // Thai_yoying + {0x0dae, 0x0e0e}, // Thai_dochada + {0x0daf, 0x0e0f}, // Thai_topatak + {0x0db0, 0x0e10}, // Thai_thothan + {0x0db1, 0x0e11}, // Thai_thonangmontho + {0x0db2, 0x0e12}, // Thai_thophuthao + {0x0db3, 0x0e13}, // Thai_nonen + {0x0db4, 0x0e14}, // Thai_dodek + {0x0db5, 0x0e15}, // Thai_totao + {0x0db6, 0x0e16}, // Thai_thothung + {0x0db7, 0x0e17}, // Thai_thothahan + {0x0db8, 0x0e18}, // Thai_thothong + {0x0db9, 0x0e19}, // Thai_nonu + {0x0dba, 0x0e1a}, // Thai_bobaimai + {0x0dbb, 0x0e1b}, // Thai_popla + {0x0dbc, 0x0e1c}, // Thai_phophung + {0x0dbd, 0x0e1d}, // Thai_fofa + {0x0dbe, 0x0e1e}, // Thai_phophan + {0x0dbf, 0x0e1f}, // Thai_fofan + {0x0dc0, 0x0e20}, // Thai_phosamphao + {0x0dc1, 0x0e21}, // Thai_moma + {0x0dc2, 0x0e22}, // Thai_yoyak + {0x0dc3, 0x0e23}, // Thai_rorua + {0x0dc4, 0x0e24}, // Thai_ru + {0x0dc5, 0x0e25}, // Thai_loling + {0x0dc6, 0x0e26}, // Thai_lu + {0x0dc7, 0x0e27}, // Thai_wowaen + {0x0dc8, 0x0e28}, // Thai_sosala + {0x0dc9, 0x0e29}, // Thai_sorusi + {0x0dca, 0x0e2a}, // Thai_sosua + {0x0dcb, 0x0e2b}, // Thai_hohip + {0x0dcc, 0x0e2c}, // Thai_lochula + {0x0dcd, 0x0e2d}, // Thai_oang + {0x0dce, 0x0e2e}, // Thai_honokhuk + {0x0dcf, 0x0e2f}, // Thai_paiyannoi + {0x0dd0, 0x0e30}, // Thai_saraa + {0x0dd1, 0x0e31}, // Thai_maihanakat + {0x0dd2, 0x0e32}, // Thai_saraaa + {0x0dd3, 0x0e33}, // Thai_saraam + {0x0dd4, 0x0e34}, // Thai_sarai + {0x0dd5, 0x0e35}, // Thai_saraii + {0x0dd6, 0x0e36}, // Thai_saraue + {0x0dd7, 0x0e37}, // Thai_sarauee + {0x0dd8, 0x0e38}, // Thai_sarau + {0x0dd9, 0x0e39}, // Thai_sarauu + {0x0dda, 0x0e3a}, // Thai_phinthu + {0x0dde, 0x0000}, // Thai_maihanakat_maitho + {0x0ddf, 0x0e3f}, // Thai_baht + {0x0de0, 0x0e40}, // Thai_sarae + {0x0de1, 0x0e41}, // Thai_saraae + {0x0de2, 0x0e42}, // Thai_sarao + {0x0de3, 0x0e43}, // Thai_saraaimaimuan + {0x0de4, 0x0e44}, // Thai_saraaimaimalai + {0x0de5, 0x0e45}, // Thai_lakkhangyao + {0x0de6, 0x0e46}, // Thai_maiyamok + {0x0de7, 0x0e47}, // Thai_maitaikhu + {0x0de8, 0x0e48}, // Thai_maiek + {0x0de9, 0x0e49}, // Thai_maitho + {0x0dea, 0x0e4a}, // Thai_maitri + {0x0deb, 0x0e4b}, // Thai_maichattawa + {0x0dec, 0x0e4c}, // Thai_thanthakhat + {0x0ded, 0x0e4d}, // Thai_nikhahit + {0x0df0, 0x0e50}, // Thai_leksun + {0x0df1, 0x0e51}, // Thai_leknung + {0x0df2, 0x0e52}, // Thai_leksong + {0x0df3, 0x0e53}, // Thai_leksam + {0x0df4, 0x0e54}, // Thai_leksi + {0x0df5, 0x0e55}, // Thai_lekha + {0x0df6, 0x0e56}, // Thai_lekhok + {0x0df7, 0x0e57}, // Thai_lekchet + {0x0df8, 0x0e58}, // Thai_lekpaet + {0x0df9, 0x0e59}, // Thai_lekkao + {0x0ea1, 0x3131}, // Hangul_Kiyeog + {0x0ea2, 0x3132}, // Hangul_SsangKiyeog + {0x0ea3, 0x3133}, // Hangul_KiyeogSios + {0x0ea4, 0x3134}, // Hangul_Nieun + {0x0ea5, 0x3135}, // Hangul_NieunJieuj + {0x0ea6, 0x3136}, // Hangul_NieunHieuh + {0x0ea7, 0x3137}, // Hangul_Dikeud + {0x0ea8, 0x3138}, // Hangul_SsangDikeud + {0x0ea9, 0x3139}, // Hangul_Rieul + {0x0eaa, 0x313a}, // Hangul_RieulKiyeog + {0x0eab, 0x313b}, // Hangul_RieulMieum + {0x0eac, 0x313c}, // Hangul_RieulPieub + {0x0ead, 0x313d}, // Hangul_RieulSios + {0x0eae, 0x313e}, // Hangul_RieulTieut + {0x0eaf, 0x313f}, // Hangul_RieulPhieuf + {0x0eb0, 0x3140}, // Hangul_RieulHieuh + {0x0eb1, 0x3141}, // Hangul_Mieum + {0x0eb2, 0x3142}, // Hangul_Pieub + {0x0eb3, 0x3143}, // Hangul_SsangPieub + {0x0eb4, 0x3144}, // Hangul_PieubSios + {0x0eb5, 0x3145}, // Hangul_Sios + {0x0eb6, 0x3146}, // Hangul_SsangSios + {0x0eb7, 0x3147}, // Hangul_Ieung + {0x0eb8, 0x3148}, // Hangul_Jieuj + {0x0eb9, 0x3149}, // Hangul_SsangJieuj + {0x0eba, 0x314a}, // Hangul_Cieuc + {0x0ebb, 0x314b}, // Hangul_Khieuq + {0x0ebc, 0x314c}, // Hangul_Tieut + {0x0ebd, 0x314d}, // Hangul_Phieuf + {0x0ebe, 0x314e}, // Hangul_Hieuh + {0x0ebf, 0x314f}, // Hangul_A + {0x0ec0, 0x3150}, // Hangul_AE + {0x0ec1, 0x3151}, // Hangul_YA + {0x0ec2, 0x3152}, // Hangul_YAE + {0x0ec3, 0x3153}, // Hangul_EO + {0x0ec4, 0x3154}, // Hangul_E + {0x0ec5, 0x3155}, // Hangul_YEO + {0x0ec6, 0x3156}, // Hangul_YE + {0x0ec7, 0x3157}, // Hangul_O + {0x0ec8, 0x3158}, // Hangul_WA + {0x0ec9, 0x3159}, // Hangul_WAE + {0x0eca, 0x315a}, // Hangul_OE + {0x0ecb, 0x315b}, // Hangul_YO + {0x0ecc, 0x315c}, // Hangul_U + {0x0ecd, 0x315d}, // Hangul_WEO + {0x0ece, 0x315e}, // Hangul_WE + {0x0ecf, 0x315f}, // Hangul_WI + {0x0ed0, 0x3160}, // Hangul_YU + {0x0ed1, 0x3161}, // Hangul_EU + {0x0ed2, 0x3162}, // Hangul_YI + {0x0ed3, 0x3163}, // Hangul_I + {0x0ed4, 0x11a8}, // Hangul_J_Kiyeog + {0x0ed5, 0x11a9}, // Hangul_J_SsangKiyeog + {0x0ed6, 0x11aa}, // Hangul_J_KiyeogSios + {0x0ed7, 0x11ab}, // Hangul_J_Nieun + {0x0ed8, 0x11ac}, // Hangul_J_NieunJieuj + {0x0ed9, 0x11ad}, // Hangul_J_NieunHieuh + {0x0eda, 0x11ae}, // Hangul_J_Dikeud + {0x0edb, 0x11af}, // Hangul_J_Rieul + {0x0edc, 0x11b0}, // Hangul_J_RieulKiyeog + {0x0edd, 0x11b1}, // Hangul_J_RieulMieum + {0x0ede, 0x11b2}, // Hangul_J_RieulPieub + {0x0edf, 0x11b3}, // Hangul_J_RieulSios + {0x0ee0, 0x11b4}, // Hangul_J_RieulTieut + {0x0ee1, 0x11b5}, // Hangul_J_RieulPhieuf + {0x0ee2, 0x11b6}, // Hangul_J_RieulHieuh + {0x0ee3, 0x11b7}, // Hangul_J_Mieum + {0x0ee4, 0x11b8}, // Hangul_J_Pieub + {0x0ee5, 0x11b9}, // Hangul_J_PieubSios + {0x0ee6, 0x11ba}, // Hangul_J_Sios + {0x0ee7, 0x11bb}, // Hangul_J_SsangSios + {0x0ee8, 0x11bc}, // Hangul_J_Ieung + {0x0ee9, 0x11bd}, // Hangul_J_Jieuj + {0x0eea, 0x11be}, // Hangul_J_Cieuc + {0x0eeb, 0x11bf}, // Hangul_J_Khieuq + {0x0eec, 0x11c0}, // Hangul_J_Tieut + {0x0eed, 0x11c1}, // Hangul_J_Phieuf + {0x0eee, 0x11c2}, // Hangul_J_Hieuh + {0x0eef, 0x316d}, // Hangul_RieulYeorinHieuh + {0x0ef0, 0x3171}, // Hangul_SunkyeongeumMieum + {0x0ef1, 0x3178}, // Hangul_SunkyeongeumPieub + {0x0ef2, 0x317f}, // Hangul_PanSios + {0x0ef3, 0x3181}, // Hangul_KkogjiDalrinIeung + {0x0ef4, 0x3184}, // Hangul_SunkyeongeumPhieuf + {0x0ef5, 0x3186}, // Hangul_YeorinHieuh + {0x0ef6, 0x318d}, // Hangul_AraeA + {0x0ef7, 0x318e}, // Hangul_AraeAE + {0x0ef8, 0x11eb}, // Hangul_J_PanSios + {0x0ef9, 0x11f0}, // Hangul_J_KkogjiDalrinIeung + {0x0efa, 0x11f9}, // Hangul_J_YeorinHieuh + {0x0eff, 0x20a9}, // Korean_Won + {0x13bc, 0x0152}, // OE + {0x13bd, 0x0153}, // oe + {0x13be, 0x0178}, // Ydiaeresis + {0x20a0, 0x20a0}, // EcuSign + {0x20a1, 0x20a1}, // ColonSign + {0x20a2, 0x20a2}, // CruzeiroSign + {0x20a3, 0x20a3}, // FFrancSign + {0x20a4, 0x20a4}, // LiraSign + {0x20a5, 0x20a5}, // MillSign + {0x20a6, 0x20a6}, // NairaSign + {0x20a7, 0x20a7}, // PesetaSign + {0x20a8, 0x20a8}, // RupeeSign + {0x20a9, 0x20a9}, // WonSign + {0x20aa, 0x20aa}, // NewSheqelSign + {0x20ab, 0x20ab}, // DongSign + {0x20ac, 0x20ac}, // EuroSign + {0xfd01, 0x0000}, // 3270_Duplicate + {0xfd02, 0x0000}, // 3270_FieldMark + {0xfd03, 0x0000}, // 3270_Right2 + {0xfd04, 0x0000}, // 3270_Left2 + {0xfd05, 0x0000}, // 3270_BackTab + {0xfd06, 0x0000}, // 3270_EraseEOF + {0xfd07, 0x0000}, // 3270_EraseInput + {0xfd08, 0x0000}, // 3270_Reset + {0xfd09, 0x0000}, // 3270_Quit + {0xfd0a, 0x0000}, // 3270_PA1 + {0xfd0b, 0x0000}, // 3270_PA2 + {0xfd0c, 0x0000}, // 3270_PA3 + {0xfd0d, 0x0000}, // 3270_Test + {0xfd0e, 0x0000}, // 3270_Attn + {0xfd0f, 0x0000}, // 3270_CursorBlink + {0xfd10, 0x0000}, // 3270_AltCursor + {0xfd11, 0x0000}, // 3270_KeyClick + {0xfd12, 0x0000}, // 3270_Jump + {0xfd13, 0x0000}, // 3270_Ident + {0xfd14, 0x0000}, // 3270_Rule + {0xfd15, 0x0000}, // 3270_Copy + {0xfd16, 0x0000}, // 3270_Play + {0xfd17, 0x0000}, // 3270_Setup + {0xfd18, 0x0000}, // 3270_Record + {0xfd19, 0x0000}, // 3270_ChangeScreen + {0xfd1a, 0x0000}, // 3270_DeleteWord + {0xfd1b, 0x0000}, // 3270_ExSelect + {0xfd1c, 0x0000}, // 3270_CursorSelect + {0xfd1d, 0x0000}, // 3270_PrintScreen + {0xfd1e, 0x0000}, // 3270_Enter + {0xfe01, 0x0000}, // ISO_Lock + {0xfe02, 0x0000}, // ISO_Level2_Latch + {0xfe03, 0x0000}, // ISO_Level3_Shift + {0xfe04, 0x0000}, // ISO_Level3_Latch + {0xfe05, 0x0000}, // ISO_Level3_Lock + {0xfe06, 0x0000}, // ISO_Group_Latch + {0xfe07, 0x0000}, // ISO_Group_Lock + {0xfe08, 0x0000}, // ISO_Next_Group + {0xfe09, 0x0000}, // ISO_Next_Group_Lock + {0xfe0a, 0x0000}, // ISO_Prev_Group + {0xfe0b, 0x0000}, // ISO_Prev_Group_Lock + {0xfe0c, 0x0000}, // ISO_First_Group + {0xfe0d, 0x0000}, // ISO_First_Group_Lock + {0xfe0e, 0x0000}, // ISO_Last_Group + {0xfe0f, 0x0000}, // ISO_Last_Group_Lock + {0xfe20, 0x0000}, // ISO_Left_Tab + {0xfe21, 0x0000}, // ISO_Move_Line_Up + {0xfe22, 0x0000}, // ISO_Move_Line_Down + {0xfe23, 0x0000}, // ISO_Partial_Line_Up + {0xfe24, 0x0000}, // ISO_Partial_Line_Down + {0xfe25, 0x0000}, // ISO_Partial_Space_Left + {0xfe26, 0x0000}, // ISO_Partial_Space_Right + {0xfe27, 0x0000}, // ISO_Set_Margin_Left + {0xfe28, 0x0000}, // ISO_Set_Margin_Right + {0xfe29, 0x0000}, // ISO_Release_Margin_Left + {0xfe2a, 0x0000}, // ISO_Release_Margin_Right + {0xfe2b, 0x0000}, // ISO_Release_Both_Margins + {0xfe2c, 0x0000}, // ISO_Fast_Cursor_Left + {0xfe2d, 0x0000}, // ISO_Fast_Cursor_Right + {0xfe2e, 0x0000}, // ISO_Fast_Cursor_Up + {0xfe2f, 0x0000}, // ISO_Fast_Cursor_Down + {0xfe30, 0x0000}, // ISO_Continuous_Underline + {0xfe31, 0x0000}, // ISO_Discontinuous_Underline + {0xfe32, 0x0000}, // ISO_Emphasize + {0xfe33, 0x0000}, // ISO_Center_Object + {0xfe34, 0x0000}, // ISO_Enter + {0xfe50, 0x0300}, // dead_grave + {0xfe51, 0x0301}, // dead_acute + {0xfe52, 0x0302}, // dead_circumflex + {0xfe53, 0x0303}, // dead_tilde + {0xfe54, 0x0304}, // dead_macron + {0xfe55, 0x0306}, // dead_breve + {0xfe56, 0x0307}, // dead_abovedot + {0xfe57, 0x0308}, // dead_diaeresis + {0xfe58, 0x030a}, // dead_abovering + {0xfe59, 0x030b}, // dead_doubleacute + {0xfe5a, 0x030c}, // dead_caron + {0xfe5b, 0x0327}, // dead_cedilla + {0xfe5c, 0x0328}, // dead_ogonek + {0xfe5d, 0x0345}, // dead_iota + {0xfe5e, 0x3099}, // dead_voiced_sound + {0xfe5f, 0x309a}, // dead_semivoiced_sound + {0xfe70, 0x0000}, // AccessX_Enable + {0xfe71, 0x0000}, // AccessX_Feedback_Enable + {0xfe72, 0x0000}, // RepeatKeys_Enable + {0xfe73, 0x0000}, // SlowKeys_Enable + {0xfe74, 0x0000}, // BounceKeys_Enable + {0xfe75, 0x0000}, // StickyKeys_Enable + {0xfe76, 0x0000}, // MouseKeys_Enable + {0xfe77, 0x0000}, // MouseKeys_Accel_Enable + {0xfe78, 0x0000}, // Overlay1_Enable + {0xfe79, 0x0000}, // Overlay2_Enable + {0xfe7a, 0x0000}, // AudibleBell_Enable + {0xfed0, 0x0000}, // First_Virtual_Screen + {0xfed1, 0x0000}, // Prev_Virtual_Screen + {0xfed2, 0x0000}, // Next_Virtual_Screen + {0xfed4, 0x0000}, // Last_Virtual_Screen + {0xfed5, 0x0000}, // Terminate_Server + {0xfee0, 0x0000}, // Pointer_Left + {0xfee1, 0x0000}, // Pointer_Right + {0xfee2, 0x0000}, // Pointer_Up + {0xfee3, 0x0000}, // Pointer_Down + {0xfee4, 0x0000}, // Pointer_UpLeft + {0xfee5, 0x0000}, // Pointer_UpRight + {0xfee6, 0x0000}, // Pointer_DownLeft + {0xfee7, 0x0000}, // Pointer_DownRight + {0xfee8, 0x0000}, // Pointer_Button_Dflt + {0xfee9, 0x0000}, // Pointer_Button1 + {0xfeea, 0x0000}, // Pointer_Button2 + {0xfeeb, 0x0000}, // Pointer_Button3 + {0xfeec, 0x0000}, // Pointer_Button4 + {0xfeed, 0x0000}, // Pointer_Button5 + {0xfeee, 0x0000}, // Pointer_DblClick_Dflt + {0xfeef, 0x0000}, // Pointer_DblClick1 + {0xfef0, 0x0000}, // Pointer_DblClick2 + {0xfef1, 0x0000}, // Pointer_DblClick3 + {0xfef2, 0x0000}, // Pointer_DblClick4 + {0xfef3, 0x0000}, // Pointer_DblClick5 + {0xfef4, 0x0000}, // Pointer_Drag_Dflt + {0xfef5, 0x0000}, // Pointer_Drag1 + {0xfef6, 0x0000}, // Pointer_Drag2 + {0xfef7, 0x0000}, // Pointer_Drag3 + {0xfef8, 0x0000}, // Pointer_Drag4 + {0xfef9, 0x0000}, // Pointer_EnableKeys + {0xfefa, 0x0000}, // Pointer_Accelerate + {0xfefb, 0x0000}, // Pointer_DfltBtnNext + {0xfefc, 0x0000}, // Pointer_DfltBtnPrev + {0xfefd, 0x0000}, // Pointer_Drag5 + {0xff08, 0x0008}, // BackSpace /* back space, back char */ + {0xff09, 0x0009}, // Tab + {0xff0a, 0x000a}, // Linefeed /* Linefeed, LF */ + {0xff0b, 0x000b}, // Clear + {0xff0d, 0x000d}, // Return /* Return, enter */ + {0xff13, 0x0013}, // Pause /* Pause, hold */ + {0xff14, 0x0014}, // Scroll_Lock + {0xff15, 0x0015}, // Sys_Req + {0xff1b, 0x001b}, // Escape + {0xff20, 0x0000}, // Multi_key + {0xff21, 0x0000}, // Kanji + {0xff22, 0x0000}, // Muhenkan + {0xff23, 0x0000}, // Henkan_Mode + {0xff24, 0x0000}, // Romaji + {0xff25, 0x0000}, // Hiragana + {0xff26, 0x0000}, // Katakana + {0xff27, 0x0000}, // Hiragana_Katakana + {0xff28, 0x0000}, // Zenkaku + {0xff29, 0x0000}, // Hankaku + {0xff2a, 0x0000}, // Zenkaku_Hankaku + {0xff2b, 0x0000}, // Touroku + {0xff2c, 0x0000}, // Massyo + {0xff2d, 0x0000}, // Kana_Lock + {0xff2e, 0x0000}, // Kana_Shift + {0xff2f, 0x0000}, // Eisu_Shift + {0xff30, 0x0000}, // Eisu_toggle + {0xff31, 0x0000}, // Hangul + {0xff32, 0x0000}, // Hangul_Start + {0xff33, 0x0000}, // Hangul_End + {0xff34, 0x0000}, // Hangul_Hanja + {0xff35, 0x0000}, // Hangul_Jamo + {0xff36, 0x0000}, // Hangul_Romaja + {0xff37, 0x0000}, // Codeinput + {0xff38, 0x0000}, // Hangul_Jeonja + {0xff39, 0x0000}, // Hangul_Banja + {0xff3a, 0x0000}, // Hangul_PreHanja + {0xff3b, 0x0000}, // Hangul_PostHanja + {0xff3c, 0x0000}, // SingleCandidate + {0xff3d, 0x0000}, // MultipleCandidate + {0xff3e, 0x0000}, // PreviousCandidate + {0xff3f, 0x0000}, // Hangul_Special + {0xff50, 0x0000}, // Home + {0xff51, 0x0000}, // Left + {0xff52, 0x0000}, // Up + {0xff53, 0x0000}, // Right + {0xff54, 0x0000}, // Down + {0xff55, 0x0000}, // Prior + {0xff56, 0x0000}, // Next + {0xff57, 0x0000}, // End + {0xff58, 0x0000}, // Begin + {0xff60, 0x0000}, // Select + {0xff61, 0x0000}, // Print + {0xff62, 0x0000}, // Execute + {0xff63, 0x0000}, // Insert + {0xff65, 0x0000}, // Undo + {0xff66, 0x0000}, // Redo + {0xff67, 0x0000}, // Menu + {0xff68, 0x0000}, // Find + {0xff69, 0x0000}, // Cancel + {0xff6a, 0x0000}, // Help + {0xff6b, 0x0000}, // Break + {0xff7e, 0x0000}, // Mode_switch + {0xff7f, 0x0000}, // Num_Lock + {0xff80, 0x0020}, // KP_Space /* space */ + {0xff89, 0x0009}, // KP_Tab + {0xff8d, 0x000d}, // KP_Enter /* enter */ + {0xff91, 0x0000}, // KP_F1 + {0xff92, 0x0000}, // KP_F2 + {0xff93, 0x0000}, // KP_F3 + {0xff94, 0x0000}, // KP_F4 + {0xff95, 0x0000}, // KP_Home + {0xff96, 0x0000}, // KP_Left + {0xff97, 0x0000}, // KP_Up + {0xff98, 0x0000}, // KP_Right + {0xff99, 0x0000}, // KP_Down + {0xff9a, 0x0000}, // KP_Prior + {0xff9b, 0x0000}, // KP_Next + {0xff9c, 0x0000}, // KP_End + {0xff9d, 0x0000}, // KP_Begin + {0xff9e, 0x0000}, // KP_Insert + {0xff9f, 0x0000}, // KP_Delete + {0xffaa, 0x002a}, // KP_Multiply + {0xffab, 0x002b}, // KP_Add + {0xffac, 0x002c}, // KP_Separator /* separator, often comma */ + {0xffad, 0x002d}, // KP_Subtract + {0xffae, 0x002e}, // KP_Decimal + {0xffaf, 0x002f}, // KP_Divide + {0xffb0, 0x0030}, // KP_0 + {0xffb1, 0x0031}, // KP_1 + {0xffb2, 0x0032}, // KP_2 + {0xffb3, 0x0033}, // KP_3 + {0xffb4, 0x0034}, // KP_4 + {0xffb5, 0x0035}, // KP_5 + {0xffb6, 0x0036}, // KP_6 + {0xffb7, 0x0037}, // KP_7 + {0xffb8, 0x0038}, // KP_8 + {0xffb9, 0x0039}, // KP_9 + {0xffbd, 0x003d}, // KP_Equal /* equals */ + {0xffbe, 0x0000}, // F1 + {0xffbf, 0x0000}, // F2 + {0xffc0, 0x0000}, // F3 + {0xffc1, 0x0000}, // F4 + {0xffc2, 0x0000}, // F5 + {0xffc3, 0x0000}, // F6 + {0xffc4, 0x0000}, // F7 + {0xffc5, 0x0000}, // F8 + {0xffc6, 0x0000}, // F9 + {0xffc7, 0x0000}, // F10 + {0xffc8, 0x0000}, // F11 + {0xffc9, 0x0000}, // F12 + {0xffca, 0x0000}, // F13 + {0xffcb, 0x0000}, // F14 + {0xffcc, 0x0000}, // F15 + {0xffcd, 0x0000}, // F16 + {0xffce, 0x0000}, // F17 + {0xffcf, 0x0000}, // F18 + {0xffd0, 0x0000}, // F19 + {0xffd1, 0x0000}, // F20 + {0xffd2, 0x0000}, // F21 + {0xffd3, 0x0000}, // F22 + {0xffd4, 0x0000}, // F23 + {0xffd5, 0x0000}, // F24 + {0xffd6, 0x0000}, // F25 + {0xffd7, 0x0000}, // F26 + {0xffd8, 0x0000}, // F27 + {0xffd9, 0x0000}, // F28 + {0xffda, 0x0000}, // F29 + {0xffdb, 0x0000}, // F30 + {0xffdc, 0x0000}, // F31 + {0xffdd, 0x0000}, // F32 + {0xffde, 0x0000}, // F33 + {0xffdf, 0x0000}, // F34 + {0xffe0, 0x0000}, // F35 + {0xffe1, 0x0000}, // Shift_L + {0xffe2, 0x0000}, // Shift_R + {0xffe3, 0x0000}, // Control_L + {0xffe4, 0x0000}, // Control_R + {0xffe5, 0x0000}, // Caps_Lock + {0xffe6, 0x0000}, // Shift_Lock + {0xffe7, 0x0000}, // Meta_L + {0xffe8, 0x0000}, // Meta_R + {0xffe9, 0x0000}, // Alt_L + {0xffea, 0x0000}, // Alt_R + {0xffeb, 0x0000}, // Super_L + {0xffec, 0x0000}, // Super_R + {0xffed, 0x0000}, // Hyper_L + {0xffee, 0x0000}, // Hyper_R + {0xffff, 0x0000}, // Delete + {0xffffff, 0x0000}, // VoidSymbol + + // Various XFree86 extensions since X11R6.4 + // http://cvsweb.xfree86.org/cvsweb/xc/include/keysymdef.h + + // KOI8-U support (Aleksey Novodvorsky, 1999-05-30) + // http://cvsweb.xfree86.org/cvsweb/xc/include/keysymdef.h.diff?r1=1.4&r2=1.5 + // Used in XFree86's /usr/lib/X11/xkb/symbols/ua mappings + + {0x06ad, 0x0491}, // Ukrainian_ghe_with_upturn + {0x06bd, 0x0490}, // Ukrainian_GHE_WITH_UPTURN + + // Support for armscii-8, ibm-cp1133, mulelao-1, viscii1.1-1, + // tcvn-5712, georgian-academy, georgian-ps + // (#2843, Pablo Saratxaga , 1999-06-06) + // http://cvsweb.xfree86.org/cvsweb/xc/include/keysymdef.h.diff?r1=1.6&r2=1.7 + + // Armenian + // (not used in any XFree86 4.4 kbd layouts, where /usr/lib/X11/xkb/symbols/am + // uses directly Unicode-mapped hexadecimal values instead) + {0x14a1, 0x0000}, // Armenian_eternity + {0x14a2, 0x0587}, // Armenian_ligature_ew + {0x14a3, 0x0589}, // Armenian_verjaket + {0x14a4, 0x0029}, // Armenian_parenright + {0x14a5, 0x0028}, // Armenian_parenleft + {0x14a6, 0x00bb}, // Armenian_guillemotright + {0x14a7, 0x00ab}, // Armenian_guillemotleft + {0x14a8, 0x2014}, // Armenian_em_dash + {0x14a9, 0x002e}, // Armenian_mijaket + {0x14aa, 0x055d}, // Armenian_but + {0x14ab, 0x002c}, // Armenian_comma + {0x14ac, 0x2013}, // Armenian_en_dash + {0x14ad, 0x058a}, // Armenian_yentamna + {0x14ae, 0x2026}, // Armenian_ellipsis + {0x14af, 0x055c}, // Armenian_amanak + {0x14b0, 0x055b}, // Armenian_shesht + {0x14b1, 0x055e}, // Armenian_paruyk + {0x14b2, 0x0531}, // Armenian_AYB + {0x14b3, 0x0561}, // Armenian_ayb + {0x14b4, 0x0532}, // Armenian_BEN + {0x14b5, 0x0562}, // Armenian_ben + {0x14b6, 0x0533}, // Armenian_GIM + {0x14b7, 0x0563}, // Armenian_gim + {0x14b8, 0x0534}, // Armenian_DA + {0x14b9, 0x0564}, // Armenian_da + {0x14ba, 0x0535}, // Armenian_YECH + {0x14bb, 0x0565}, // Armenian_yech + {0x14bc, 0x0536}, // Armenian_ZA + {0x14bd, 0x0566}, // Armenian_za + {0x14be, 0x0537}, // Armenian_E + {0x14bf, 0x0567}, // Armenian_e + {0x14c0, 0x0538}, // Armenian_AT + {0x14c1, 0x0568}, // Armenian_at + {0x14c2, 0x0539}, // Armenian_TO + {0x14c3, 0x0569}, // Armenian_to + {0x14c4, 0x053a}, // Armenian_ZHE + {0x14c5, 0x056a}, // Armenian_zhe + {0x14c6, 0x053b}, // Armenian_INI + {0x14c7, 0x056b}, // Armenian_ini + {0x14c8, 0x053c}, // Armenian_LYUN + {0x14c9, 0x056c}, // Armenian_lyun + {0x14ca, 0x053d}, // Armenian_KHE + {0x14cb, 0x056d}, // Armenian_khe + {0x14cc, 0x053e}, // Armenian_TSA + {0x14cd, 0x056e}, // Armenian_tsa + {0x14ce, 0x053f}, // Armenian_KEN + {0x14cf, 0x056f}, // Armenian_ken + {0x14d0, 0x0540}, // Armenian_HO + {0x14d1, 0x0570}, // Armenian_ho + {0x14d2, 0x0541}, // Armenian_DZA + {0x14d3, 0x0571}, // Armenian_dza + {0x14d4, 0x0542}, // Armenian_GHAT + {0x14d5, 0x0572}, // Armenian_ghat + {0x14d6, 0x0543}, // Armenian_TCHE + {0x14d7, 0x0573}, // Armenian_tche + {0x14d8, 0x0544}, // Armenian_MEN + {0x14d9, 0x0574}, // Armenian_men + {0x14da, 0x0545}, // Armenian_HI + {0x14db, 0x0575}, // Armenian_hi + {0x14dc, 0x0546}, // Armenian_NU + {0x14dd, 0x0576}, // Armenian_nu + {0x14de, 0x0547}, // Armenian_SHA + {0x14df, 0x0577}, // Armenian_sha + {0x14e0, 0x0548}, // Armenian_VO + {0x14e1, 0x0578}, // Armenian_vo + {0x14e2, 0x0549}, // Armenian_CHA + {0x14e3, 0x0579}, // Armenian_cha + {0x14e4, 0x054a}, // Armenian_PE + {0x14e5, 0x057a}, // Armenian_pe + {0x14e6, 0x054b}, // Armenian_JE + {0x14e7, 0x057b}, // Armenian_je + {0x14e8, 0x054c}, // Armenian_RA + {0x14e9, 0x057c}, // Armenian_ra + {0x14ea, 0x054d}, // Armenian_SE + {0x14eb, 0x057d}, // Armenian_se + {0x14ec, 0x054e}, // Armenian_VEV + {0x14ed, 0x057e}, // Armenian_vev + {0x14ee, 0x054f}, // Armenian_TYUN + {0x14ef, 0x057f}, // Armenian_tyun + {0x14f0, 0x0550}, // Armenian_RE + {0x14f1, 0x0580}, // Armenian_re + {0x14f2, 0x0551}, // Armenian_TSO + {0x14f3, 0x0581}, // Armenian_tso + {0x14f4, 0x0552}, // Armenian_VYUN + {0x14f5, 0x0582}, // Armenian_vyun + {0x14f6, 0x0553}, // Armenian_PYUR + {0x14f7, 0x0583}, // Armenian_pyur + {0x14f8, 0x0554}, // Armenian_KE + {0x14f9, 0x0584}, // Armenian_ke + {0x14fa, 0x0555}, // Armenian_O + {0x14fb, 0x0585}, // Armenian_o + {0x14fc, 0x0556}, // Armenian_FE + {0x14fd, 0x0586}, // Armenian_fe + {0x14fe, 0x055a}, // Armenian_apostrophe + {0x14ff, 0x00a7}, // Armenian_section_sign + + // Gregorian + // (not used in any XFree86 4.4 kbd layouts, were /usr/lib/X11/xkb/symbols/ge_* + // uses directly Unicode-mapped hexadecimal values instead) + {0x15d0, 0x10d0}, // Georgian_an + {0x15d1, 0x10d1}, // Georgian_ban + {0x15d2, 0x10d2}, // Georgian_gan + {0x15d3, 0x10d3}, // Georgian_don + {0x15d4, 0x10d4}, // Georgian_en + {0x15d5, 0x10d5}, // Georgian_vin + {0x15d6, 0x10d6}, // Georgian_zen + {0x15d7, 0x10d7}, // Georgian_tan + {0x15d8, 0x10d8}, // Georgian_in + {0x15d9, 0x10d9}, // Georgian_kan + {0x15da, 0x10da}, // Georgian_las + {0x15db, 0x10db}, // Georgian_man + {0x15dc, 0x10dc}, // Georgian_nar + {0x15dd, 0x10dd}, // Georgian_on + {0x15de, 0x10de}, // Georgian_par + {0x15df, 0x10df}, // Georgian_zhar + {0x15e0, 0x10e0}, // Georgian_rae + {0x15e1, 0x10e1}, // Georgian_san + {0x15e2, 0x10e2}, // Georgian_tar + {0x15e3, 0x10e3}, // Georgian_un + {0x15e4, 0x10e4}, // Georgian_phar + {0x15e5, 0x10e5}, // Georgian_khar + {0x15e6, 0x10e6}, // Georgian_ghan + {0x15e7, 0x10e7}, // Georgian_qar + {0x15e8, 0x10e8}, // Georgian_shin + {0x15e9, 0x10e9}, // Georgian_chin + {0x15ea, 0x10ea}, // Georgian_can + {0x15eb, 0x10eb}, // Georgian_jil + {0x15ec, 0x10ec}, // Georgian_cil + {0x15ed, 0x10ed}, // Georgian_char + {0x15ee, 0x10ee}, // Georgian_xan + {0x15ef, 0x10ef}, // Georgian_jhan + {0x15f0, 0x10f0}, // Georgian_hae + {0x15f1, 0x10f1}, // Georgian_he + {0x15f2, 0x10f2}, // Georgian_hie + {0x15f3, 0x10f3}, // Georgian_we + {0x15f4, 0x10f4}, // Georgian_har + {0x15f5, 0x10f5}, // Georgian_hoe + {0x15f6, 0x10f6}, // Georgian_fi + + // Pablo Saratxaga's i18n updates for XFree86 that are used in Mandrake 7.2. + // (#4195, Pablo Saratxaga , 2000-10-27) + // http://cvsweb.xfree86.org/cvsweb/xc/include/keysymdef.h.diff?r1=1.9&r2=1.10 + + // Latin-8 + // (the *abovedot keysyms are used in /usr/lib/X11/xkb/symbols/ie) + {0x12a1, 0x1e02}, // Babovedot + {0x12a2, 0x1e03}, // babovedot + {0x12a6, 0x1e0a}, // Dabovedot + {0x12a8, 0x1e80}, // Wgrave + {0x12aa, 0x1e82}, // Wacute + {0x12ab, 0x1e0b}, // dabovedot + {0x12ac, 0x1ef2}, // Ygrave + {0x12b0, 0x1e1e}, // Fabovedot + {0x12b1, 0x1e1f}, // fabovedot + {0x12b4, 0x1e40}, // Mabovedot + {0x12b5, 0x1e41}, // mabovedot + {0x12b7, 0x1e56}, // Pabovedot + {0x12b8, 0x1e81}, // wgrave + {0x12b9, 0x1e57}, // pabovedot + {0x12ba, 0x1e83}, // wacute + {0x12bb, 0x1e60}, // Sabovedot + {0x12bc, 0x1ef3}, // ygrave + {0x12bd, 0x1e84}, // Wdiaeresis + {0x12be, 0x1e85}, // wdiaeresis + {0x12bf, 0x1e61}, // sabovedot + {0x12d0, 0x0174}, // Wcircumflex + {0x12d7, 0x1e6a}, // Tabovedot + {0x12de, 0x0176}, // Ycircumflex + {0x12f0, 0x0175}, // wcircumflex + {0x12f7, 0x1e6b}, // tabovedot + {0x12fe, 0x0177}, // ycircumflex + + // Arabic + // (of these, in XFree86 4.4 only Arabic_superscript_alef, Arabic_madda_above, + // Arabic_hamza_* are actually used, e.g. in /usr/lib/X11/xkb/symbols/syr) + {0x0590, 0x06f0}, // Farsi_0 + {0x0591, 0x06f1}, // Farsi_1 + {0x0592, 0x06f2}, // Farsi_2 + {0x0593, 0x06f3}, // Farsi_3 + {0x0594, 0x06f4}, // Farsi_4 + {0x0595, 0x06f5}, // Farsi_5 + {0x0596, 0x06f6}, // Farsi_6 + {0x0597, 0x06f7}, // Farsi_7 + {0x0598, 0x06f8}, // Farsi_8 + {0x0599, 0x06f9}, // Farsi_9 + {0x05a5, 0x066a}, // Arabic_percent + {0x05a6, 0x0670}, // Arabic_superscript_alef + {0x05a7, 0x0679}, // Arabic_tteh + {0x05a8, 0x067e}, // Arabic_peh + {0x05a9, 0x0686}, // Arabic_tcheh + {0x05aa, 0x0688}, // Arabic_ddal + {0x05ab, 0x0691}, // Arabic_rreh + {0x05ae, 0x06d4}, // Arabic_fullstop + {0x05b0, 0x0660}, // Arabic_0 + {0x05b1, 0x0661}, // Arabic_1 + {0x05b2, 0x0662}, // Arabic_2 + {0x05b3, 0x0663}, // Arabic_3 + {0x05b4, 0x0664}, // Arabic_4 + {0x05b5, 0x0665}, // Arabic_5 + {0x05b6, 0x0666}, // Arabic_6 + {0x05b7, 0x0667}, // Arabic_7 + {0x05b8, 0x0668}, // Arabic_8 + {0x05b9, 0x0669}, // Arabic_9 + {0x05f3, 0x0653}, // Arabic_madda_above + {0x05f4, 0x0654}, // Arabic_hamza_above + {0x05f5, 0x0655}, // Arabic_hamza_below + {0x05f6, 0x0698}, // Arabic_jeh + {0x05f7, 0x06a4}, // Arabic_veh + {0x05f8, 0x06a9}, // Arabic_keheh + {0x05f9, 0x06af}, // Arabic_gaf + {0x05fa, 0x06ba}, // Arabic_noon_ghunna + {0x05fb, 0x06be}, // Arabic_heh_doachashmee + {0x05fc, 0x06cc}, // Farsi_yeh + {0x05fd, 0x06d2}, // Arabic_yeh_baree + {0x05fe, 0x06c1}, // Arabic_heh_goal + + // Cyrillic + // (none of these are actually used in any XFree86 4.4 kbd layouts) + {0x0680, 0x0492}, // Cyrillic_GHE_bar + {0x0681, 0x0496}, // Cyrillic_ZHE_descender + {0x0682, 0x049a}, // Cyrillic_KA_descender + {0x0683, 0x049c}, // Cyrillic_KA_vertstroke + {0x0684, 0x04a2}, // Cyrillic_EN_descender + {0x0685, 0x04ae}, // Cyrillic_U_straight + {0x0686, 0x04b0}, // Cyrillic_U_straight_bar + {0x0687, 0x04b2}, // Cyrillic_HA_descender + {0x0688, 0x04b6}, // Cyrillic_CHE_descender + {0x0689, 0x04b8}, // Cyrillic_CHE_vertstroke + {0x068a, 0x04ba}, // Cyrillic_SHHA + {0x068c, 0x04d8}, // Cyrillic_SCHWA + {0x068d, 0x04e2}, // Cyrillic_I_macron + {0x068e, 0x04e8}, // Cyrillic_O_bar + {0x068f, 0x04ee}, // Cyrillic_U_macron + {0x0690, 0x0493}, // Cyrillic_ghe_bar + {0x0691, 0x0497}, // Cyrillic_zhe_descender + {0x0692, 0x049b}, // Cyrillic_ka_descender + {0x0693, 0x049d}, // Cyrillic_ka_vertstroke + {0x0694, 0x04a3}, // Cyrillic_en_descender + {0x0695, 0x04af}, // Cyrillic_u_straight + {0x0696, 0x04b1}, // Cyrillic_u_straight_bar + {0x0697, 0x04b3}, // Cyrillic_ha_descender + {0x0698, 0x04b7}, // Cyrillic_che_descender + {0x0699, 0x04b9}, // Cyrillic_che_vertstroke + {0x069a, 0x04bb}, // Cyrillic_shha + {0x069c, 0x04d9}, // Cyrillic_schwa + {0x069d, 0x04e3}, // Cyrillic_i_macron + {0x069e, 0x04e9}, // Cyrillic_o_bar + {0x069f, 0x04ef}, // Cyrillic_u_macron + + // Caucasus + // (of these, in XFree86 4.4 only Gcaron, gcaron are actually used, + // e.g. in /usr/lib/X11/xkb/symbols/sapmi; the lack of Unicode + // equivalents for the others suggests that they are bogus) + {0x16a2, 0x0000}, // Ccedillaabovedot + {0x16a3, 0x1e8a}, // Xabovedot + {0x16a5, 0x0000}, // Qabovedot + {0x16a6, 0x012c}, // Ibreve + {0x16a7, 0x0000}, // IE + {0x16a8, 0x0000}, // UO + {0x16a9, 0x01b5}, // Zstroke + {0x16aa, 0x01e6}, // Gcaron + {0x16af, 0x019f}, // Obarred + {0x16b2, 0x0000}, // ccedillaabovedot + {0x16b3, 0x1e8b}, // xabovedot + {0x16b4, 0x0000}, // Ocaron + {0x16b5, 0x0000}, // qabovedot + {0x16b6, 0x012d}, // ibreve + {0x16b7, 0x0000}, // ie + {0x16b8, 0x0000}, // uo + {0x16b9, 0x01b6}, // zstroke + {0x16ba, 0x01e7}, // gcaron + {0x16bd, 0x01d2}, // ocaron + {0x16bf, 0x0275}, // obarred + {0x16c6, 0x018f}, // SCHWA + {0x16f6, 0x0259}, // schwa + + // Inupiak, Guarani + // (none of these are actually used in any XFree86 4.4 kbd layouts, + // and the lack of Unicode equivalents suggests that they are bogus) + {0x16d1, 0x1e36}, // Lbelowdot + {0x16d2, 0x0000}, // Lstrokebelowdot + {0x16d3, 0x0000}, // Gtilde + {0x16e1, 0x1e37}, // lbelowdot + {0x16e2, 0x0000}, // lstrokebelowdot + {0x16e3, 0x0000}, // gtilde + + // Vietnamese + // (none of these are actually used in any XFree86 4.4 kbd layouts; they are + // also pointless, as Vietnamese input methods use dead accent keys + ASCII keys) + {0x1ea0, 0x1ea0}, // Abelowdot + {0x1ea1, 0x1ea1}, // abelowdot + {0x1ea2, 0x1ea2}, // Ahook + {0x1ea3, 0x1ea3}, // ahook + {0x1ea4, 0x1ea4}, // Acircumflexacute + {0x1ea5, 0x1ea5}, // acircumflexacute + {0x1ea6, 0x1ea6}, // Acircumflexgrave + {0x1ea7, 0x1ea7}, // acircumflexgrave + {0x1ea8, 0x1ea8}, // Acircumflexhook + {0x1ea9, 0x1ea9}, // acircumflexhook + {0x1eaa, 0x1eaa}, // Acircumflextilde + {0x1eab, 0x1eab}, // acircumflextilde + {0x1eac, 0x1eac}, // Acircumflexbelowdot + {0x1ead, 0x1ead}, // acircumflexbelowdot + {0x1eae, 0x1eae}, // Abreveacute + {0x1eaf, 0x1eaf}, // abreveacute + {0x1eb0, 0x1eb0}, // Abrevegrave + {0x1eb1, 0x1eb1}, // abrevegrave + {0x1eb2, 0x1eb2}, // Abrevehook + {0x1eb3, 0x1eb3}, // abrevehook + {0x1eb4, 0x1eb4}, // Abrevetilde + {0x1eb5, 0x1eb5}, // abrevetilde + {0x1eb6, 0x1eb6}, // Abrevebelowdot + {0x1eb7, 0x1eb7}, // abrevebelowdot + {0x1eb8, 0x1eb8}, // Ebelowdot + {0x1eb9, 0x1eb9}, // ebelowdot + {0x1eba, 0x1eba}, // Ehook + {0x1ebb, 0x1ebb}, // ehook + {0x1ebc, 0x1ebc}, // Etilde + {0x1ebd, 0x1ebd}, // etilde + {0x1ebe, 0x1ebe}, // Ecircumflexacute + {0x1ebf, 0x1ebf}, // ecircumflexacute + {0x1ec0, 0x1ec0}, // Ecircumflexgrave + {0x1ec1, 0x1ec1}, // ecircumflexgrave + {0x1ec2, 0x1ec2}, // Ecircumflexhook + {0x1ec3, 0x1ec3}, // ecircumflexhook + {0x1ec4, 0x1ec4}, // Ecircumflextilde + {0x1ec5, 0x1ec5}, // ecircumflextilde + {0x1ec6, 0x1ec6}, // Ecircumflexbelowdot + {0x1ec7, 0x1ec7}, // ecircumflexbelowdot + {0x1ec8, 0x1ec8}, // Ihook + {0x1ec9, 0x1ec9}, // ihook + {0x1eca, 0x1eca}, // Ibelowdot + {0x1ecb, 0x1ecb}, // ibelowdot + {0x1ecc, 0x1ecc}, // Obelowdot + {0x1ecd, 0x1ecd}, // obelowdot + {0x1ece, 0x1ece}, // Ohook + {0x1ecf, 0x1ecf}, // ohook + {0x1ed0, 0x1ed0}, // Ocircumflexacute + {0x1ed1, 0x1ed1}, // ocircumflexacute + {0x1ed2, 0x1ed2}, // Ocircumflexgrave + {0x1ed3, 0x1ed3}, // ocircumflexgrave + {0x1ed4, 0x1ed4}, // Ocircumflexhook + {0x1ed5, 0x1ed5}, // ocircumflexhook + {0x1ed6, 0x1ed6}, // Ocircumflextilde + {0x1ed7, 0x1ed7}, // ocircumflextilde + {0x1ed8, 0x1ed8}, // Ocircumflexbelowdot + {0x1ed9, 0x1ed9}, // ocircumflexbelowdot + {0x1eda, 0x1eda}, // Ohornacute + {0x1edb, 0x1edb}, // ohornacute + {0x1edc, 0x1edc}, // Ohorngrave + {0x1edd, 0x1edd}, // ohorngrave + {0x1ede, 0x1ede}, // Ohornhook + {0x1edf, 0x1edf}, // ohornhook + {0x1ee0, 0x1ee0}, // Ohorntilde + {0x1ee1, 0x1ee1}, // ohorntilde + {0x1ee2, 0x1ee2}, // Ohornbelowdot + {0x1ee3, 0x1ee3}, // ohornbelowdot + {0x1ee4, 0x1ee4}, // Ubelowdot + {0x1ee5, 0x1ee5}, // ubelowdot + {0x1ee6, 0x1ee6}, // Uhook + {0x1ee7, 0x1ee7}, // uhook + {0x1ee8, 0x1ee8}, // Uhornacute + {0x1ee9, 0x1ee9}, // uhornacute + {0x1eea, 0x1eea}, // Uhorngrave + {0x1eeb, 0x1eeb}, // uhorngrave + {0x1eec, 0x1eec}, // Uhornhook + {0x1eed, 0x1eed}, // uhornhook + {0x1eee, 0x1eee}, // Uhorntilde + {0x1eef, 0x1eef}, // uhorntilde + {0x1ef0, 0x1ef0}, // Uhornbelowdot + {0x1ef1, 0x1ef1}, // uhornbelowdot + {0x1ef4, 0x1ef4}, // Ybelowdot + {0x1ef5, 0x1ef5}, // ybelowdot + {0x1ef6, 0x1ef6}, // Yhook + {0x1ef7, 0x1ef7}, // yhook + {0x1ef8, 0x1ef8}, // Ytilde + {0x1ef9, 0x1ef9}, // ytilde + + {0x1efa, 0x01a0}, // Ohorn + {0x1efb, 0x01a1}, // ohorn + {0x1efc, 0x01af}, // Uhorn + {0x1efd, 0x01b0}, // uhorn + + //# (Unicode combining characters have no direct equivalence with + //# keysyms, where dead keys are defined instead) + {0x1e9f, 0x0303}, // combining_tilde + {0x1ef2, 0x0300}, // combining_grave + {0x1ef3, 0x0301}, // combining_acute + {0x1efe, 0x0309}, // combining_hook + {0x1eff, 0x0323}, // combining_belowdot + + //# These probably should be added to the X11 standard properly, + //# as they could be of use for Vietnamese input methods. + {0xfe60, 0x0323}, // dead_belowdot + {0xfe61, 0x0309}, // dead_hook + {0xfe62, 0x031b}, // dead_horn +}; +int wxUnicodeCharXToWX(WXKeySym keySym) +{ + int id = wxCharCodeXToWX (keySym); + + /* first check for Latin-1 characters (1:1 mapping) */ + if ( id != WXK_NONE ) + return id; + + int min = 0; + int max = sizeof(keySymTab) / sizeof(CodePair) - 1; + int mid; + + /* also check for directly encoded 24-bit UCS characters */ + if ( (keySym & 0xff000000) == 0x01000000 ) + return keySym & 0x00ffffff; + + /* binary search in table */ + while ( max >= min ) { + mid = (min + max) / 2; + if ( keySymTab[mid].keySym < keySym ) + min = mid + 1; + else if ( keySymTab[mid].keySym > keySym ) + max = mid - 1; + else { + /* found it */ + return keySymTab[mid].uniChar; + } + } + + // no matching keycode value found + return WXK_NONE; +} // ---------------------------------------------------------------------------- // check current state of a key @@ -883,9 +2610,21 @@ bool wxLaunchDefaultApplication(const wxString& document, int flags) // Launch default browser // ---------------------------------------------------------------------------- -bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) +bool +wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) { - wxUnusedVar(flags); +#ifdef __WXGTK__ +#if GTK_CHECK_VERSION(2,14,0) +#ifndef __WXGTK3__ + if (gtk_check_version(2,14,0) == NULL) +#endif + { + GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK()); + if (gtk_show_uri(screen, params.url.utf8_str(), GDK_CURRENT_TIME, NULL)) + return true; + } +#endif // GTK_CHECK_VERSION(2,14,0) +#endif // __WXGTK__ // Our best best is to use xdg-open from freedesktop.org cross-desktop // compatibility suite xdg-utils @@ -897,7 +2636,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) if ( wxGetEnv("PATH", &path) && wxFindFileInPath(&xdg_open, path, "xdg-open") ) { - if ( wxExecute(xdg_open + " " + url) ) + if ( wxExecute(xdg_open + " " + params.GetPathOrURL()) ) return true; } @@ -916,7 +2655,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) if (res >= 0 && errors.GetCount() == 0) { wxString cmd = output[0]; - cmd << wxT(' ') << url; + cmd << wxT(' ') << params.GetPathOrURL(); if (wxExecute(cmd)) return true; } @@ -924,7 +2663,7 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags) else if (desktop == wxT("KDE")) { // kfmclient directly opens the given URL - if (wxExecute(wxT("kfmclient openURL ") + url)) + if (wxExecute(wxT("kfmclient openURL ") + params.GetPathOrURL())) return true; } diff --git a/Externals/wxWidgets3/wx/wxcocoa.h b/Externals/wxWidgets3/wx/wxcocoa.h index e05ccb3909..88d9b19b2a 100644 --- a/Externals/wxWidgets3/wx/wxcocoa.h +++ b/Externals/wxWidgets3/wx/wxcocoa.h @@ -154,6 +154,8 @@ #define WXWIN_COMPATIBILITY_2_8 0 +#define WXWIN_COMPATIBILITY_3_0 1 + #define wxDIALOG_UNIT_COMPATIBILITY 0 @@ -203,6 +205,7 @@ #define wxUSE_PRINTF_POS_PARAMS 1 +#define wxUSE_COMPILER_TLS 1 #define wxUSE_STL 1 @@ -213,6 +216,7 @@ #else #define wxUSE_STD_DEFAULT 0 #endif +#define wxUSE_STD_CONTAINERS_COMPATIBLY 1 #define wxUSE_STD_CONTAINERS 1 @@ -267,7 +271,7 @@ #define wxUSE_SOCKETS 1 -#define wxUSE_IPV6 0 +#define wxUSE_IPV6 1 #define wxUSE_FILESYSTEM 1 @@ -315,7 +319,7 @@ #define wxUSE_SOUND 1 -#define wxUSE_MEDIACTRL 1 +#define wxUSE_MEDIACTRL 0 #define wxUSE_XRC 0 @@ -375,6 +379,7 @@ #define wxUSE_TIPWINDOW 1 +#define wxUSE_ACTIVITYINDICATOR 1 #define wxUSE_ANIMATIONCTRL 1 #define wxUSE_BANNERWINDOW 1 #define wxUSE_BUTTON 1 @@ -448,6 +453,8 @@ #define wxUSE_REARRANGECTRL 1 +#define wxUSE_ADDREMOVECTRL 1 + #define wxUSE_ACCEL 1 @@ -471,6 +478,8 @@ #define wxUSE_NOTIFICATION_MESSAGE 1 +#define wxUSE_PREFERENCES_EDITOR 1 + #define wxUSE_RICHTOOLTIP 1 #define wxUSE_SASH 1 @@ -509,6 +518,8 @@ #define wxUSE_PROGRESSDLG 1 +#define wxUSE_NATIVE_PROGRESSDLG 1 + #define wxUSE_STARTUP_TIPS 1 #define wxUSE_TEXTDLG 1 @@ -524,7 +535,7 @@ #define wxUSE_FILE_HISTORY 1 -#define wxUSE_METAFILE 1 +#define wxUSE_METAFILE 0 #define wxUSE_ENH_METAFILE 0 #define wxUSE_WIN_METAFILES_ALWAYS 0 @@ -535,11 +546,11 @@ #define wxUSE_MDI_ARCHITECTURE 1 -#define wxUSE_PRINTING_ARCHITECTURE 1 +#define wxUSE_PRINTING_ARCHITECTURE 0 #define wxUSE_HTML 0 -#define wxUSE_GLCANVAS 1 +#define wxUSE_GLCANVAS 0 #define wxUSE_RICHTEXT 0 @@ -643,13 +654,18 @@ */ #define wxUSE_GSTREAMER 0 +#define wxUSE_GSTREAMER_PLAYER 0 + /* --- start MSW options --- */ -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +#if defined(_MSC_VER) && _MSC_VER >= 1600 +#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else +#define wxUSE_GRAPHICS_DIRECT2D 0 #endif -#define wxUSE_MFC 0 #define wxUSE_OLE 0 @@ -657,6 +673,12 @@ #define wxUSE_ACTIVEX 0 +#if defined(_MSC_VER) && _MSC_VER >= 1700 +#define wxUSE_WINRT 0 +#else +#define wxUSE_WINRT 0 +#endif + #define wxUSE_DC_CACHEING 0 #define wxUSE_WXDIB 0 @@ -673,6 +695,9 @@ #define wxUSE_TASKBARICON_BALLOONS 0 +#define wxUSE_TASKBARBUTTON 0 + + #define wxUSE_UXTHEME 0 #define wxUSE_INKEDIT 0 @@ -800,25 +825,21 @@ #define wxUSE_PLUGINS 0 /* - * Use GTK print for printing under GTK+ 2.0 + * Use GTK print for printing under GTK+ 2.10+ */ #define wxUSE_GTKPRINT 0 -/* - * Use GNOME print for printing under GTK+ 2.0 - */ -#define wxUSE_LIBGNOMEPRINT 0 /* * Use GNOME VFS for MIME types */ #define wxUSE_LIBGNOMEVFS 0 /* - * Use the Hildon framework + * Use libnotify library. */ -#define wxUSE_LIBHILDON 0 +#define wxUSE_LIBNOTIFY 0 /* - * Use the Hildon 2.0 framework + * Use libnotify 0.7+ API */ -#define wxUSE_LIBHILDON2 0 +#define wxUSE_LIBNOTIFY_0_7 0 /* * Use libXpm */ @@ -839,7 +860,7 @@ /* * Use OpenGL */ -#define wxUSE_OPENGL 1 +#define wxUSE_OPENGL 0 /* * Use MS HTML Help via libmspack (Unix) @@ -1267,8 +1288,5 @@ /* define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK */ /* #undef wxHAS_WORKING_GTK_DC_BLIT */ -#define wxUSE_COMPILER_TLS 1 -#define wxUSE_PREFERENCES_EDITOR 1 - #endif /* __WX_SETUP_H__ */ diff --git a/Externals/wxWidgets3/wx/wxgtk.h b/Externals/wxWidgets3/wx/wxgtk.h index c8c4eba86b..dda1f56769 100644 --- a/Externals/wxWidgets3/wx/wxgtk.h +++ b/Externals/wxWidgets3/wx/wxgtk.h @@ -1,4 +1,4 @@ -/* lib/wx/include/gtk2-unicode-static-2.9/wx/setup.h. Generated from setup.h.in by configure. */ +/* lib/wx/include/gtk2-unicode-static-3.1/wx/setup.h. Generated from setup.h.in by configure. */ /* This define (__WX_SETUP_H__) is used both to ensure setup.h is included * only once and to indicate that we are building using configure. */ #ifndef __WX_SETUP_H__ @@ -15,9 +15,6 @@ #endif /* __cplusplus */ -/* fill in with the string wxGetOsDescription() will return */ -#define WXWIN_OS_DESCRIPTION "FreeBSD 7.4-PRERELEASE i386" - /* the installation location prefix from configure */ #define wxINSTALL_PREFIX "/usr/local" @@ -44,7 +41,7 @@ /* Define this to get extra features from GNU libc. */ #ifndef _GNU_SOURCE -/* #undef _GNU_SOURCE */ +#define _GNU_SOURCE 1 #endif /* Define to `int' if doesn't define. */ @@ -54,24 +51,24 @@ byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ -/* Define this if your version of GTK+ is greater than 1.2 */ -#define __WXGTK12__ 1 - /* Define this if your version of GTK+ is greater than 1.2.7 */ /* #undef __WXGTK127__ */ /* Define this if your version of GTK+ is greater than 2.0 */ #define __WXGTK20__ 1 -/* Define this if your version of GTK+ is greater than 2.6 */ -#define __WXGTK26__ 1 - /* Define this if your version of GTK+ is greater than 2.10 */ #define __WXGTK210__ 1 /* Define this if your version of GTK+ is greater than 2.18 */ #define __WXGTK218__ 1 +/* Define this if your version of GTK+ is greater than 2.20 */ +#define __WXGTK220__ 1 + +/* Define this if your version of GTK+ is >= 3.0 */ +/* #undef __WXGTK3__ */ + /* Define this if you want to use GPE features */ /* #undef __WXGPE__ */ @@ -89,12 +86,12 @@ #define __UNIX__ 1 /* #undef __AIX__ */ -#define __BSD__ 1 +/* #undef __BSD__ */ /* #undef __DARWIN__ */ /* #undef __EMX__ */ -#define __FREEBSD__ 1 +/* #undef __FREEBSD__ */ /* #undef __HPUX__ */ -/* #undef __LINUX__ */ +/* #define __LINUX__ */ /* #undef __NETBSD__ */ /* #undef __OPENBSD__ */ /* #undef __OSF__ */ @@ -117,7 +114,6 @@ /* PowerPC Darwin & Mac OS X */ /* #undef __POWERPC__ */ -/* #undef TARGET_CARBON */ /* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */ /* #undef __Point__ */ @@ -143,9 +139,6 @@ /* #undef WINVER */ #endif -/* OS/2 with EMX */ -/* #undef __OS2__ */ - /* --- start common options --- */ #ifndef wxUSE_GUI @@ -153,17 +146,17 @@ #endif -#define WXWIN_COMPATIBILITY_2_6 0 - #define WXWIN_COMPATIBILITY_2_8 0 +#define WXWIN_COMPATIBILITY_3_0 1 + #define wxDIALOG_UNIT_COMPATIBILITY 0 #define wxUSE_ON_FATAL_EXCEPTION 1 -#define wxUSE_STACKWALKER 0 +#define wxUSE_STACKWALKER 1 #define wxUSE_DEBUGREPORT 1 @@ -186,12 +179,10 @@ #define wxUSE_WCHAR_T 1 -#define wxUSE_EXCEPTIONS 0 +#define wxUSE_EXCEPTIONS 0 #define wxUSE_EXTENDED_RTTI 0 -#define wxUSE_STL 0 - #define wxUSE_LOG 1 #define wxUSE_LOGWINDOW 1 @@ -206,12 +197,16 @@ #define wxUSE_STREAMS 1 -#if defined(__DMC__) || defined(__WATCOMC__) \ - || (defined(_MSC_VER) && _MSC_VER < 1200) - #define wxUSE_STD_DEFAULT 0 -#else - #define wxUSE_STD_DEFAULT 0 -#endif +#define wxUSE_PRINTF_POS_PARAMS 1 + +#define wxUSE_COMPILER_TLS 1 + + +#define wxUSE_STL 0 + +#define wxUSE_STD_DEFAULT 0 + +#define wxUSE_STD_CONTAINERS_COMPATIBLY 1 #define wxUSE_STD_CONTAINERS 0 @@ -223,7 +218,6 @@ #define wxUSE_IOSTREAMH 0 -#define wxUSE_PRINTF_POS_PARAMS 1 #define wxUSE_LONGLONG 1 @@ -235,7 +229,7 @@ #define wxUSE_FILE 1 #define wxUSE_FFILE 1 -#define wxUSE_FSVOLUME 0 +#define wxUSE_FSVOLUME 1 #define wxUSE_STDPATHS 1 @@ -253,13 +247,13 @@ #define wxUSE_STOPWATCH 1 -#define wxUSE_FSWATCHER 0 +#define wxUSE_FSWATCHER 0 #define wxUSE_CONFIG 1 #define wxUSE_CONFIG_NATIVE 1 -#define wxUSE_DIALUP_MANAGER 1 +#define wxUSE_DIALUP_MANAGER 0 #define wxUSE_DYNLIB_CLASS 1 @@ -267,7 +261,7 @@ #define wxUSE_SOCKETS 1 -#define wxUSE_IPV6 0 +#define wxUSE_IPV6 1 #define wxUSE_FILESYSTEM 1 @@ -287,7 +281,7 @@ #define wxUSE_APPLE_IEEE 1 -#define wxUSE_JOYSTICK 0 +#define wxUSE_JOYSTICK 1 #define wxUSE_FONTENUM 1 @@ -309,23 +303,23 @@ #define wxUSE_ANY 1 -#define wxUSE_REGEX 0 +#define wxUSE_REGEX 0 #define wxUSE_SYSTEM_OPTIONS 1 #define wxUSE_SOUND 1 -#define wxUSE_MEDIACTRL 1 +#define wxUSE_MEDIACTRL 0 -#define wxUSE_XRC 0 +#define wxUSE_XRC 0 -#define wxUSE_XML 0 +#define wxUSE_XML wxUSE_XRC #define wxUSE_AUI 1 -#define wxUSE_RIBBON 0 +#define wxUSE_RIBBON 0 -#define wxUSE_PROPGRID 0 +#define wxUSE_PROPGRID 0 #define wxUSE_STC 0 @@ -345,15 +339,7 @@ #ifdef _MSC_VER -# if _MSC_VER >= 1310 - - #define wxUSE_GRAPHICS_CONTEXT 1 -# else - - -# define wxUSE_GRAPHICS_CONTEXT 1 -# endif #else @@ -375,6 +361,7 @@ #define wxUSE_TIPWINDOW 1 +#define wxUSE_ACTIVITYINDICATOR 1 #define wxUSE_ANIMATIONCTRL 1 #define wxUSE_BANNERWINDOW 1 #define wxUSE_BUTTON 1 @@ -448,6 +435,8 @@ #define wxUSE_REARRANGECTRL 1 +#define wxUSE_ADDREMOVECTRL 1 + #define wxUSE_ACCEL 1 @@ -471,6 +460,8 @@ #define wxUSE_NOTIFICATION_MESSAGE 1 +#define wxUSE_PREFERENCES_EDITOR 1 + #define wxUSE_RICHTOOLTIP 1 #define wxUSE_SASH 1 @@ -509,6 +500,8 @@ #define wxUSE_PROGRESSDLG 1 +#define wxUSE_NATIVE_PROGRESSDLG 1 + #define wxUSE_STARTUP_TIPS 1 #define wxUSE_TEXTDLG 1 @@ -535,13 +528,13 @@ #define wxUSE_MDI_ARCHITECTURE 1 -#define wxUSE_PRINTING_ARCHITECTURE 1 +#define wxUSE_PRINTING_ARCHITECTURE 0 -#define wxUSE_HTML 0 +#define wxUSE_HTML 0 -#define wxUSE_GLCANVAS 1 +#define wxUSE_GLCANVAS 0 -#define wxUSE_RICHTEXT 0 +#define wxUSE_RICHTEXT 0 #define wxUSE_CLIPBOARD 1 @@ -587,19 +580,15 @@ #define wxUSE_DC_TRANSFORM_MATRIX 1 -#define REMOVE_UNUSED_ARG 0 - -#define wxUSE_IOSTREAMH 0 - #define wxUSE_IMAGE 1 #define wxUSE_LIBPNG 1 -#define wxUSE_LIBJPEG 0 +#define wxUSE_LIBJPEG 0 -#define wxUSE_LIBTIFF 0 +#define wxUSE_LIBTIFF 0 #define wxUSE_TGA 1 @@ -634,7 +623,7 @@ #define wxUSE_SELECT_DISPATCHER 1 #define wxUSE_EPOLL_DISPATCHER 0 -#define wxUSE_UNICODE_UTF8 1 +#define wxUSE_UNICODE_UTF8 0 #define wxUSE_UTF8_LOCALE_ONLY 0 /* @@ -647,13 +636,19 @@ */ #define wxUSE_GSTREAMER 0 +#define wxUSE_GSTREAMER_PLAYER 0 + /* --- start MSW options --- */ -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 + +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +#if defined(_MSC_VER) && _MSC_VER >= 1600 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 #endif -#define wxUSE_MFC 0 #define wxUSE_OLE 0 @@ -661,6 +656,12 @@ #define wxUSE_ACTIVEX 0 +#if defined(_MSC_VER) && _MSC_VER >= 1700 + #define wxUSE_WINRT 0 +#else + #define wxUSE_WINRT 0 +#endif + #define wxUSE_DC_CACHEING 0 #define wxUSE_WXDIB 0 @@ -675,7 +676,9 @@ #define wxUSE_OWNER_DRAWN 0 -#define wxUSE_TASKBARICON_BALLOONS 0 +#define wxUSE_TASKBARICON_BALLOONS 1 + +#define wxUSE_TASKBARBUTTON 0 #define wxUSE_UXTHEME 0 @@ -686,6 +689,8 @@ #define wxUSE_DATEPICKCTRL_GENERIC 0 +#define wxUSE_TIMEPICKCTRL_GENERIC 0 + #define wxUSE_CRASHREPORT 0 /* --- end MSW options --- */ @@ -710,6 +715,12 @@ */ #define HAVE_VARIADIC_MACROS 1 +/* + * Define if you don't want variadic macros to be used even if they are + * supported by the compiler. + */ +/* #undef wxNO_VARIADIC_MACROS */ + /* * Define if your compiler has std::wstring */ @@ -802,29 +813,21 @@ #define wxUSE_PLUGINS 0 /* - * Use GTK print for printing under GTK+ 2.0 + * Use GTK print for printing under GTK+ 2.10+ */ #define wxUSE_GTKPRINT 0 -/* - * Use GNOME print for printing under GTK+ 2.0 - */ -#define wxUSE_LIBGNOMEPRINT 0 /* * Use GNOME VFS for MIME types */ #define wxUSE_LIBGNOMEVFS 0 /* - * Use the Hildon framework + * Use libnotify library. */ -#define wxUSE_LIBHILDON 0 +#define wxUSE_LIBNOTIFY 0 /* - * Use the Hildon 2.0 framework + * Use libnotify 0.7+ API. */ -#define wxUSE_LIBHILDON2 0 -/* - * Have glibc2 - */ -#define wxHAVE_GLIBC2 0 +#define wxUSE_LIBNOTIFY_0_7 0 /* * Use libXpm */ @@ -845,7 +848,7 @@ /* * Use OpenGL */ -#define wxUSE_OPENGL 1 +#define wxUSE_OPENGL 0 /* * Use MS HTML Help via libmspack (Unix) @@ -881,11 +884,11 @@ /* * use the session manager to detect KDE/GNOME */ -#define wxUSE_DETECT_SM 0 +#define wxUSE_DETECT_SM 1 /* define with the name of timezone variable */ -/* #undef WX_TIMEZONE */ +#define WX_TIMEZONE timezone /* The type of 3rd argument to getsockname() - usually size_t or int */ #define WX_SOCKLEN_T socklen_t @@ -893,6 +896,9 @@ /* The type of 5th argument to getsockopt() - usually size_t or int */ #define SOCKOPTLEN_T socklen_t +/* The type of statvfs(2) argument */ +#define WX_STATFS_T struct statfs + /* The signal handler prototype */ #define wxTYPE_SA_HANDLER int @@ -964,6 +970,15 @@ (defined in the unix98 standard) */ #define HAVE_UNIX98_PRINTF 1 +/* define if you have statfs function */ +#define HAVE_STATFS 1 + +/* define if you have statfs prototype */ +#define HAVE_STATFS_DECL 1 + +/* define if you have statvfs function */ +/* #undef HAVE_STATVFS */ + /* Define if you have strtoull() and strtoll() */ #define HAVE_STRTOULL 1 @@ -980,6 +995,10 @@ * with 'char*' for the 3rd parameter instead of 'const char*' */ /* #undef HAVE_BROKEN_VSNPRINTF_DECL */ +/* Define if you have a _broken_ vsscanf() declaration in the header, + * with 'char*' for the 1st parameter instead of 'const char*' */ +/* #undef HAVE_BROKEN_VSSCANF_DECL */ + /* Define if you have vsscanf() */ #define HAVE_VSSCANF 1 @@ -990,10 +1009,10 @@ /* #undef HAVE_USLEEP */ /* Define if you have wcscasecmp() function */ -/* #undef HAVE_WCSCASECMP */ +#define HAVE_WCSCASECMP 1 /* Define if you have wcsncasecmp() function */ -/* #undef HAVE_WCSNCASECMP */ +#define HAVE_WCSNCASECMP 1 /* Define if you have wcslen function */ #define HAVE_WCSLEN 1 @@ -1005,10 +1024,10 @@ #define HAVE_WCSFTIME 1 /* Define if you have strnlen() function */ -/* #undef HAVE_STRNLEN */ +#define HAVE_STRNLEN 1 /* Define if you have wcsnlen() function */ -/* #undef HAVE_WCSNLEN */ +#define HAVE_WCSNLEN 1 /* Define if you have wcstoull() and wcstoll() */ /* #undef HAVE_WCSTOULL */ @@ -1020,10 +1039,10 @@ #define SIZEOF_INT 4 /* The number of bytes in a pointer. */ -#define SIZEOF_VOID_P 4 +#define SIZEOF_VOID_P 8 /* The number of bytes in a long. */ -#define SIZEOF_LONG 4 +#define SIZEOF_LONG 8 /* The number of bytes in a long long. */ #define SIZEOF_LONG_LONG 8 @@ -1031,11 +1050,14 @@ /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 -#ifdef __LP64__ +/* The number of bytes in a size_t. */ +#define SIZEOF_SIZE_T 8 + +/* Define if size_t on your machine is the same type as unsigned int. */ +/* #undef wxSIZE_T_IS_UINT */ + +/* Define if size_t on your machine is the same type as unsigned long. */ #define wxSIZE_T_IS_ULONG 1 -#else -#define wxSIZE_T_IS_UINT 1 -#endif /* Define if wchar_t is distinct type in your compiler. */ #define wxWCHAR_T_IS_REAL_TYPE 1 @@ -1043,6 +1065,9 @@ /* Define if you have the dlerror function. */ #define HAVE_DLERROR 1 +/* Define if you have the dladdr function. */ +#define HAVE_DLADDR 1 + /* Define if you have Posix fnctl() function. */ #define HAVE_FCNTL 1 @@ -1109,6 +1134,9 @@ /* Define if you have thr_setconcurrency function */ /* #undef HAVE_THR_SETCONCURRENCY */ +/* Define if you have pthread_setconcurrency function */ +#define HAVE_PTHREAD_SET_CONCURRENCY 1 + /* Define if you have the uname function. */ #define HAVE_UNAME 1 @@ -1116,10 +1144,10 @@ #define HAVE_UNSETENV 1 /* Define if you have the header file. */ -/* #undef HAVE_X11_XKBLIB_H */ +#define HAVE_X11_XKBLIB_H 1 /* Define if you have the header file. */ -/* #undef HAVE_X11_EXTENSIONS_XF86VMODE_H */ +#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1 /* Define if you have the header file. */ #define HAVE_SCHED_H 1 @@ -1143,11 +1171,7 @@ #define HAVE_ICONV 1 /* Define as "const" if the declaration of iconv() needs const. */ -#if defined __FreeBSD__ || __NetBSD__ -#define ICONV_CONST const -#else #define ICONV_CONST -#endif /* Define if you have the header file. */ #define HAVE_LANGINFO_H 1 @@ -1167,12 +1191,6 @@ /* Define this if you have fputws() */ #define HAVE_FPUTWS 1 -/* Define this if you have strcasecmp() function in */ -#define HAVE_STRCASECMP_IN_STRING_H 1 - -/* Define this if you have strcasecmp() function in */ -/* #undef HAVE_STRCASECMP_IN_STRINGS_H */ - /* Define this if you have wprintf() and related functions */ #define HAVE_WPRINTF 1 @@ -1206,6 +1224,9 @@ /* Define if you have the header file. */ #define HAVE_SYS_SELECT_H 1 +/* Define if you have abi::__forced_unwind in your . */ +#define HAVE_ABI_FORCEDUNWIND 1 + /* Define if fdopen is available. */ #define HAVE_FDOPEN 1 @@ -1218,8 +1239,17 @@ /* Define if getgrgid_r is available. */ #define HAVE_GETGRGID_R 1 +/* Define if setpriority() is available. */ +#define HAVE_SETPRIORITY 1 + /* Define if locale_t is available */ -/* #undef HAVE_LOCALE_T */ +#define HAVE_LOCALE_T 1 + +/* Define if you have inotify_xxx() functions. */ +/* #undef wxHAS_INOTIFY */ + +/* Define if you have kqueu_xxx() functions. */ +/* #undef wxHAS_KQUEUE */ /* ------------------------------------------------------------------------- Win32 adjustments section @@ -1227,10 +1257,6 @@ #ifdef __WIN32__ -/* we need to define wxUSE_XPM_IN_MSW for MSW compilation for compatibility - with wx/msw/setup.h */ -#define wxUSE_XPM_IN_MSW wxUSE_XPM - /* When using an external jpeg library and the Windows headers already define * boolean, define to the type used by the jpeg library for boolean. */ /* #undef wxHACK_BOOLEAN */ @@ -1256,8 +1282,5 @@ /* define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK */ /* #undef wxHAS_WORKING_GTK_DC_BLIT */ -#define wxUSE_COMPILER_TLS 1 -#define wxUSE_PREFERENCES_EDITOR 1 - #endif /* __WX_SETUP_H__ */ diff --git a/Externals/wxWidgets3/wx/wxmsw.h b/Externals/wxWidgets3/wx/wxmsw.h index 40ad33a41b..5443e75795 100644 --- a/Externals/wxWidgets3/wx/wxmsw.h +++ b/Externals/wxWidgets3/wx/wxmsw.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 01/02/97 -// RCS-ID: $Id: setup0.h 69463 2011-10-18 21:57:02Z VZ $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -27,16 +26,6 @@ // compatibility settings // ---------------------------------------------------------------------------- -// This setting determines the compatibility with 2.6 API: set it to 0 to -// flag all cases of using deprecated functions. -// -// Default is 1 but please try building your code with 0 as the default will -// change to 0 in the next version and the deprecated functions will disappear -// in the version after it completely. -// -// Recommended setting: 0 (please update your code) -#define WXWIN_COMPATIBILITY_2_6 0 - // This setting determines the compatibility with 2.8 API: set it to 0 to // flag all cases of using deprecated functions. // @@ -47,6 +36,16 @@ // Recommended setting: 0 (please update your code) #define WXWIN_COMPATIBILITY_2_8 0 +// This setting determines the compatibility with 3.0 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_3_0 1 + // MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when // default system font is used for wxWindow::GetCharWidth/Height() instead of // the current font. @@ -151,7 +150,7 @@ // In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If // this causes problems (e.g. link errors), set this to 0. You may need to set // this to 0 if using templates (at least for VC++). This switch is currently -// ignored for mingw / cygwin / CodeWarrior +// ignored for MinGW/Cygwin. // // Default is 0 // @@ -267,6 +266,24 @@ // Recommended setting: 1 if you want to support multiple languages #define wxUSE_PRINTF_POS_PARAMS 1 +// Enable the use of compiler-specific thread local storage keyword, if any. +// This is used for wxTLS_XXX() macros implementation and normally should use +// the compiler-provided support as it's simpler and more efficient, but is +// disabled under Windows in wx/msw/chkconf.h as it can't be used if wxWidgets +// is used in a dynamically loaded Win32 DLL (i.e. using LoadLibrary()) under +// XP as this triggers a bug in compiler TLS support that results in crashes +// when any TLS variables are used. +// +// If you're absolutely sure that your build of wxWidgets is never going to be +// used in such situation, either because it's not going to be linked from any +// kind of plugin or because you only target Vista or later systems, you can +// set this to 2 to force the use of compiler TLS even under MSW. +// +// Default is 1 meaning that compiler TLS is used only if it's 100% safe. +// +// Recommended setting: 2 if you want to have maximal performance and don't +// care about the scenario described above. +#define wxUSE_COMPILER_TLS 2 // ---------------------------------------------------------------------------- // Interoperability with the standard library. @@ -283,33 +300,30 @@ #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. +// wxUSE_STD_IOSTREAM, wxUSE_STD_STRING and wxUSE_STD_CONTAINERS_COMPATIBLY. // -// 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). +// Set it to 0 if you want to disable the use of all standard classes +// completely for some reason. +#define wxUSE_STD_DEFAULT 1 + +// Use standard C++ containers where it can be done without breaking backwards +// compatibility. // -// 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 +// This provides better interoperability with the standard library, e.g. with +// this option on it's possible to insert std::vector<> into many wxWidgets +// containers directly. +// +// Default is 1. +// +// Recommended setting is 1 unless you want to avoid all dependencies on the +// standard library. +#define wxUSE_STD_CONTAINERS_COMPATIBLY wxUSE_STD_DEFAULT // 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 @@ -454,14 +468,7 @@ #define wxUSE_XLOCALE 1 // Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which -// allow to manipulate dates, times and time intervals. wxDateTime replaces the -// old wxTime and wxDate classes which are still provided for backwards -// compatibility (and implemented in terms of wxDateTime). -// -// Note that this class is relatively new and is still officially in alpha -// stage because some features are not yet (fully) implemented. It is already -// quite useful though and should only be disabled if you are aiming at -// absolutely minimal version of the library. +// allow to manipulate dates, times and time intervals. // // Requires: wxUSE_LONGLONG // @@ -548,7 +555,7 @@ // Default is 1. // // Recommended setting: 1 if you need IPv6 support -#define wxUSE_IPV6 0 +#define wxUSE_IPV6 1 // Set to 1 to enable virtual file systems (required by wxHTML) #define wxUSE_FILESYSTEM 1 @@ -660,7 +667,7 @@ // Default is 1. // // Recommended setting: 1 -#define wxUSE_MEDIACTRL 1 +#define wxUSE_MEDIACTRL 0 // Use wxWidget's XRC XML-based resource system. Recommended. // @@ -717,51 +724,30 @@ // Default is 1 on MSW // // Recommended setting: 1 -#ifdef __WXMSW__ #define wxUSE_WEBVIEW_IE 0 -#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 0 -#else -#define wxUSE_WEBVIEW_WEBKIT 0 -#endif -// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced -// 2D drawing API. (Still somewhat experimental) -// -// Please note that on Windows gdiplus.dll is loaded dynamically which means -// that nothing special needs to be done as long as you don't use -// wxGraphicsContext at all or only use it on XP and later systems but you -// still do need to distribute it yourself for an application using -// wxGraphicsContext to be runnable on pre-XP systems. +// Enable wxGraphicsContext and related classes for a modern 2D drawing API. // // Default is 1 except if you're using a non-Microsoft compiler under Windows -// as only MSVC7+ is known to ship with gdiplus.h. For other compilers (e.g. -// mingw32) you may need to install the headers (and just the headers) -// yourself. If you do, change the setting below manually. +// as only MSVC is known to ship with at least gdiplus.h which is required to +// compile GDI+-based implementation of wxGraphicsContext (MSVC10 and later +// versions also include d2d1.h required for Direct2D-based implementation). +// For other compilers (e.g. mingw32) you may need to install the headers (and +// just the headers) yourself. If you do, change the setting below manually. // // Recommended setting: 1 if supported by the compilation environment // notice that we can't use wxCHECK_VISUALC_VERSION() here as this file is // included from wx/platform.h before wxCHECK_VISUALC_VERSION() is defined #ifdef _MSC_VER -# if _MSC_VER >= 1310 - // MSVC7.1+ comes with new enough Platform SDK, enable - // wxGraphicsContext support for it -# define wxUSE_GRAPHICS_CONTEXT 1 -# else - // MSVC 6 didn't include GDI+ headers so disable by default, enable it - // here if you use MSVC 6 with a newer SDK -# define wxUSE_GRAPHICS_CONTEXT 0 -# endif +# define wxUSE_GRAPHICS_CONTEXT 1 #else // Disable support for other Windows compilers, enable it if your compiler // comes with new enough SDK or you installed the headers manually. @@ -830,6 +816,7 @@ // Default is 1 // // Recommended setting: 1 +#define wxUSE_ACTIVITYINDICATOR 1 // wxActivityIndicator #define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl #define wxUSE_BANNERWINDOW 1 // wxBannerWindow #define wxUSE_BUTTON 1 // wxButton @@ -999,6 +986,16 @@ // wxHeaderCtrl) #define wxUSE_REARRANGECTRL 1 +// wxAddRemoveCtrl is a composite control containing a control showing some +// items (e.g. wxListBox, wxListCtrl, wxTreeCtrl, wxDataViewCtrl, ...) and "+"/ +// "-" buttons allowing to add and remove items to/from the control. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 if you don't need it (not +// used by the library itself). +#define wxUSE_ADDREMOVECTRL 1 + // ---------------------------------------------------------------------------- // Miscellaneous GUI stuff // ---------------------------------------------------------------------------- @@ -1087,6 +1084,16 @@ // Recommended setting: 1 #define wxUSE_NOTIFICATION_MESSAGE 1 +// wxPreferencesEditor provides a common API for different ways of presenting +// the standard "Preferences" or "Properties" dialog under different platforms +// (e.g. some use modal dialogs, some use modeless ones; some apply the changes +// immediately while others require an explicit "Apply" button). +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_PREFERENCES_EDITOR 1 + // wxRichToolTip is a customizable tooltip class which has more functionality // than the stock (but native, unlike this class) wxToolTip. // @@ -1200,6 +1207,10 @@ // progress dialog class for lengthy operations #define wxUSE_PROGRESSDLG 1 +// Set to 0 to disable the use of the native progress dialog (currently only +// available under MSW and suffering from some bugs there, hence this option). +#define wxUSE_NATIVE_PROGRESSDLG 1 + // support for startup tips (wxShowTip &c) #define wxUSE_STARTUP_TIPS 1 @@ -1273,7 +1284,7 @@ #define wxUSE_MDI_ARCHITECTURE 1 // Set to 0 to disable print/preview architecture code -#define wxUSE_PRINTING_ARCHITECTURE 1 +#define wxUSE_PRINTING_ARCHITECTURE 0 // wxHTML sublibrary allows to display HTML in wxWindow programs and much, // much more. @@ -1290,12 +1301,11 @@ // list of libraries used to link your application (although this is done // implicitly for Microsoft Visual C++ users). // -// Default is 1 unless the compiler is known to ship without the necessary -// headers (Digital Mars) or the platform doesn't support OpenGL (Windows CE). +// Default is 1. // // Recommended setting: 1 if you intend to use OpenGL, can be safely set to 0 // otherwise. -#define wxUSE_GLCANVAS 1 +#define wxUSE_GLCANVAS 0 // wxRichTextCtrl allows editing of styled text. // @@ -1368,7 +1378,7 @@ // // Recommended setting: 1, only set to 0 if you have trouble compiling // wxCHMHelpController (could be a problem with really ancient compilers) -#define wxUSE_MS_HTML_HELP 1 +#define wxUSE_MS_HTML_HELP 0 // Use wxHTML-based help controller? @@ -1478,34 +1488,37 @@ /* --- start MSW options --- */ // ---------------------------------------------------------------------------- -// Windows-only settings +// Graphics backends choices for Windows // ---------------------------------------------------------------------------- -// Set wxUSE_UNICODE_MSLU to 1 if you're compiling wxWidgets in Unicode mode -// and want to run your programs under Windows 9x and not only NT/2000/XP. -// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see -// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note -// that you will have to modify the makefiles to include unicows.lib import -// library as the first library (see installation instructions in install.txt -// to learn how to do it when building the library or samples). +// The options here are only taken into account if wxUSE_GRAPHICS_CONTEXT is 1. + +// Enable support for GDI+-based implementation of wxGraphicsContext. // -// If your compiler doesn't have unicows.lib, you can get a version of it at -// http://libunicows.sourceforge.net +// Default is 1. // -// Default is 0 +// Recommended setting: 1 if you need to support XP, as Direct2D is not +// available there. +#define wxUSE_GRAPHICS_GDIPLUS wxUSE_GRAPHICS_CONTEXT + +// Enable support for Direct2D-based implementation of wxGraphicsContext. // -// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) -#ifndef wxUSE_UNICODE_MSLU - #define wxUSE_UNICODE_MSLU 0 +// Default is 1 for compilers which support it, i.e. VC10+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 for faster and better quality graphics under Windows +// 7 and later systems (if wxUSE_GRAPHICS_GDIPLUS is also enabled, earlier +// systems will fall back on using GDI+). +#if defined(_MSC_VER) && _MSC_VER >= 1600 && 0 + #define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT +#else + #define wxUSE_GRAPHICS_DIRECT2D 0 #endif -// Set this to 1 if you want to use wxWidgets and MFC in the same program. This -// will override some other settings (see below) -// -// Default is 0. -// -// Recommended setting: 0 unless you really have to use MFC -#define wxUSE_MFC 0 +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- // Set this to 1 for generic OLE support: this is required for drag-and-drop, // clipboard, OLE Automation. Only set it to 0 if your compiler is very old and @@ -1530,7 +1543,16 @@ // Default is 1. // // Recommended setting: 1, required by wxMediaCtrl -#define wxUSE_ACTIVEX 1 +#define wxUSE_ACTIVEX 0 + +// Enable WinRT support +// +// Default is 1 for compilers which support it, i.e. VS2012+ currently. If you +// use an earlier MSVC version or another compiler and installed the necessary +// SDK components manually, you need to change this setting. +// +// Recommended setting: 1 +#define wxUSE_WINRT 0 // wxDC caching implementation #define wxUSE_DC_CACHEING 1 @@ -1545,7 +1567,7 @@ // Set to 0 to disable PostScript print/preview architecture code under Windows // (just use Windows printing). -#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1 +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 // Set this to 1 to compile in wxRegKey class. // @@ -1588,6 +1610,15 @@ // Recommended setting: 1, set to 0 for a tiny library size reduction #define wxUSE_TASKBARICON_BALLOONS 1 +// Set this to 1 to enable following functionality added in Windows 7: thumbnail +// representations, thumbnail toolbars, notification and status overlays, +// progress indicators and jump lists. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a tiny library size reduction +#define wxUSE_TASKBARBUTTON 1 + // Set to 1 to compile MS Windows XP theme engine support #define wxUSE_UXTHEME 1 @@ -1631,11 +1662,8 @@ // Default is 1 if supported by the compiler (VC++ and recent BC++ only). // // Recommended setting: 1, set to 0 if your programs never crash -#define wxUSE_CRASHREPORT 1 +#define wxUSE_CRASHREPORT 0 /* --- end MSW options --- */ -#define wxUSE_COMPILER_TLS 1 -#define wxUSE_PREFERENCES_EDITOR 1 - #endif // _WX_SETUP_H_ diff --git a/Source/Core/DolphinWX/AboutDolphin.cpp b/Source/Core/DolphinWX/AboutDolphin.cpp index 71004e9417..2cd29278a4 100644 --- a/Source/Core/DolphinWX/AboutDolphin.cpp +++ b/Source/Core/DolphinWX/AboutDolphin.cpp @@ -117,7 +117,7 @@ AboutDolphin::AboutDolphin(wxWindow* parent, wxWindowID id, const wxString& titl wxBoxSizer* const sFooter = new wxBoxSizer(wxVERTICAL); sFooter->AddSpacer(15); - sFooter->Add(Copyright, 0, wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL); + sFooter->Add(Copyright, 0, wxALIGN_CENTER_HORIZONTAL); sFooter->AddSpacer(5); wxBoxSizer* const sMain = new wxBoxSizer(wxVERTICAL); diff --git a/Source/Core/DolphinWX/Debugger/CodeView.cpp b/Source/Core/DolphinWX/Debugger/CodeView.cpp index 2eb9ad093d..22119b6bac 100644 --- a/Source/Core/DolphinWX/Debugger/CodeView.cpp +++ b/Source/Core/DolphinWX/Debugger/CodeView.cpp @@ -411,15 +411,15 @@ void CCodeView::OnPaint(wxPaintEvent& event) wxPen nullPen(bgColor); wxPen currentPen(*wxBLACK_PEN); wxPen selPen(*wxGREY_PEN); - nullPen.SetStyle(wxTRANSPARENT); - currentPen.SetStyle(wxSOLID); + nullPen.SetStyle(wxPENSTYLE_TRANSPARENT); + currentPen.SetStyle(wxPENSTYLE_SOLID); wxBrush currentBrush(*wxLIGHT_GREY_BRUSH); wxBrush pcBrush(*wxGREEN_BRUSH); wxBrush bpBrush(*wxRED_BRUSH); wxBrush bgBrush(bgColor); wxBrush nullBrush(bgColor); - nullBrush.SetStyle(wxTRANSPARENT); + nullBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT); ctx->SetPen(nullPen); ctx->SetBrush(bgBrush); diff --git a/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp b/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp index 1dc7d4547a..ac4ff03fef 100644 --- a/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp +++ b/Source/Core/DolphinWX/Debugger/DebuggerUIUtil.cpp @@ -6,4 +6,5 @@ #include // The default font -wxFont DebuggerFont = wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false, "monospace"); +wxFont DebuggerFont{9, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, + false, "monospace"}; diff --git a/Source/Core/DolphinWX/Debugger/MemoryView.cpp b/Source/Core/DolphinWX/Debugger/MemoryView.cpp index 2af3dba977..195cd965b3 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryView.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryView.cpp @@ -253,19 +253,19 @@ void CMemoryView::OnPaint(wxPaintEvent& event) // TODO: Add any drawing code here... int width = rc.width; int numRows = (rc.height / rowHeight) / 2 + 2; - dc.SetBackgroundMode(wxTRANSPARENT); + dc.SetBackgroundMode(wxPENSTYLE_TRANSPARENT); const wxColour bgColor = *wxWHITE; wxPen nullPen(bgColor); wxPen currentPen(*wxBLACK_PEN); wxPen selPen(*wxGREY_PEN); - nullPen.SetStyle(wxTRANSPARENT); + nullPen.SetStyle(wxPENSTYLE_TRANSPARENT); wxBrush currentBrush(*wxLIGHT_GREY_BRUSH); wxBrush pcBrush(*wxGREEN_BRUSH); wxBrush mcBrush(*wxBLUE_BRUSH); wxBrush bgBrush(bgColor); wxBrush nullBrush(bgColor); - nullBrush.SetStyle(wxTRANSPARENT); + nullBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT); dc.SetPen(nullPen); dc.SetBrush(bgBrush); diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj b/Source/Core/DolphinWX/DolphinWX.vcxproj index ba66d9a20c..56a434ae64 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcxproj +++ b/Source/Core/DolphinWX/DolphinWX.vcxproj @@ -1,4 +1,4 @@ - + @@ -50,6 +50,9 @@ + + true + diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 44de0e8e99..b46efcb715 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -554,7 +554,7 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar) // Delete and recreate the toolbar void CFrame::RecreateToolbar() { - static const long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT; + static const long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT | wxTB_FLAT; if (m_ToolBar != nullptr) { diff --git a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp index 4f3725e222..a2652d2d2f 100644 --- a/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetPlaySetupFrame.cpp @@ -142,9 +142,9 @@ NetPlaySetupFrame::NetPlaySetupFrame(wxWindow* const parent, const CGameListCtrl wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL); - top_szr->Add(m_ip_lbl, 0, wxCENTER | wxRIGHT, 5); + top_szr->Add(m_ip_lbl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); top_szr->Add(m_connect_ip_text, 3); - top_szr->Add(m_client_port_lbl, 0, wxCENTER | wxRIGHT | wxLEFT, 5); + top_szr->Add(m_client_port_lbl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5); top_szr->Add(m_connect_port_text, 1); wxBoxSizer* const con_szr = new wxBoxSizer(wxVERTICAL); @@ -195,7 +195,7 @@ NetPlaySetupFrame::NetPlaySetupFrame(wxWindow* const parent, const CGameListCtrl top_szr->Add(m_host_port_text, 0); #ifdef USE_UPNP m_upnp_chk = new wxCheckBox(host_tab, wxID_ANY, _("Forward port (UPnP)")); - top_szr->Add(m_upnp_chk, 0, wxALL | wxALIGN_RIGHT, 5); + top_szr->Add(m_upnp_chk, 0, wxALL, 5); #endif wxBoxSizer* const bottom_szr = new wxBoxSizer(wxHORIZONTAL); bottom_szr->Add(m_traversal_listen_port_enabled, 0, wxCENTER | wxLEFT, 5); diff --git a/Source/Core/DolphinWX/TASInputDlg.cpp b/Source/Core/DolphinWX/TASInputDlg.cpp index edad81cc59..f732f65871 100644 --- a/Source/Core/DolphinWX/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/TASInputDlg.cpp @@ -263,9 +263,7 @@ wxBoxSizer* TASInputDlg::CreateCCLayout() m_cc_r_stick_szr = CreateStickLayout(&m_cc_r_stick, _("Right stick")); m_cc_l = CreateControl(wxSL_VERTICAL, -1, 100, false, 31, 0); - ; m_cc_r = CreateControl(wxSL_VERTICAL, -1, 100, false, 31, 0); - ; wxStaticBoxSizer* const shoulder_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Shoulder Buttons")); @@ -289,7 +287,8 @@ wxBoxSizer* TASInputDlg::CreateCCLayout() cc_buttons_dpad->AddSpacer(20); for (auto button : m_cc_buttons) - cc_buttons_grid->Add(button.checkbox); + if (!button.checkbox->GetContainingSizer()) + cc_buttons_grid->Add(button.checkbox); cc_buttons_grid->AddSpacer(5); cc_buttons_box->Add(cc_buttons_grid); @@ -442,26 +441,23 @@ TASInputDlg::Stick TASInputDlg::CreateStick(int id_stick, int xRange, int yRange tempStick.bitmap->Bind(wxEVT_RIGHT_UP, &TASInputDlg::OnMouseUpR, this); tempStick.x_cont = CreateControl(wxSL_HORIZONTAL | (reverseX ? wxSL_INVERSE : 0), 120, -1, reverseX, xRange, defaultX); - tempStick.y_cont = CreateControl(wxSL_VERTICAL | (reverseY ? wxSL_INVERSE : 0), -1, 120, reverseY, - yRange, defaultY); + tempStick.y_cont = CreateControl(wxSL_VERTICAL | wxSL_LEFT | (reverseY ? wxSL_INVERSE : 0), -1, + 120, reverseY, yRange, defaultY); return tempStick; } wxStaticBoxSizer* TASInputDlg::CreateStickLayout(Stick* tempStick, const wxString& title) { wxStaticBoxSizer* const temp_box = new wxStaticBoxSizer(wxHORIZONTAL, this, title); - wxBoxSizer* const temp_xslider_box = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* const temp_yslider_box = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* const temp_stick_box = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer* grid = new wxFlexGridSizer(2, 3, 3); - temp_xslider_box->Add(tempStick->x_cont.slider, 0, wxALIGN_TOP); - temp_xslider_box->Add(tempStick->x_cont.text, 0, wxALIGN_TOP); - temp_stick_box->Add(temp_xslider_box); - temp_stick_box->Add(tempStick->bitmap, 0, wxALL | wxALIGN_CENTER, 3); - temp_box->Add(temp_stick_box); - temp_yslider_box->Add(tempStick->y_cont.slider, 0, wxALIGN_CENTER_VERTICAL); - temp_yslider_box->Add(tempStick->y_cont.text, 0, wxALIGN_CENTER_VERTICAL); - temp_box->Add(temp_yslider_box); + grid->Add(tempStick->x_cont.slider, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_BOTTOM); + grid->Add(tempStick->x_cont.text, 0, wxEXPAND); + grid->Add(tempStick->bitmap, 0, wxALL | wxALIGN_CENTER, 3); + grid->Add(tempStick->y_cont.slider, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT); + grid->Add(1, 1); + grid->Add(tempStick->y_cont.text, 0, wxEXPAND); + temp_box->Add(grid, 1, wxEXPAND | wxALL, 3); return temp_box; } @@ -473,12 +469,12 @@ wxStaticBoxSizer* TASInputDlg::CreateAccelLayout(Control* x, Control* y, Control wxStaticBoxSizer* const yBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Y")); wxStaticBoxSizer* const zBox = new wxStaticBoxSizer(wxVERTICAL, this, _("Z")); - xBox->Add(x->slider, 0, wxALIGN_CENTER_VERTICAL); - xBox->Add(x->text, 0, wxALIGN_CENTER_VERTICAL); - yBox->Add(y->slider, 0, wxALIGN_CENTER_VERTICAL); - yBox->Add(y->text, 0, wxALIGN_CENTER_VERTICAL); - zBox->Add(z->slider, 0, wxALIGN_CENTER_VERTICAL); - zBox->Add(z->text, 0, wxALIGN_CENTER_VERTICAL); + xBox->Add(x->slider, 0, wxALIGN_CENTER_HORIZONTAL); + xBox->Add(x->text, 0, wxALIGN_CENTER_HORIZONTAL); + yBox->Add(y->slider, 0, wxALIGN_CENTER_HORIZONTAL); + yBox->Add(y->text, 0, wxALIGN_CENTER_HORIZONTAL); + zBox->Add(z->slider, 0, wxALIGN_CENTER_HORIZONTAL); + zBox->Add(z->text, 0, wxALIGN_CENTER_HORIZONTAL); temp_box->Add(xBox, 0, wxLEFT | wxBOTTOM | wxRIGHT, 5); temp_box->Add(yBox, 0, wxRIGHT, 5); temp_box->Add(zBox, 0, wxRIGHT, 5); @@ -1208,13 +1204,9 @@ wxBitmap TASInputDlg::CreateStickBitmap(int x, int y) memDC.SetBackground(*wxLIGHT_GREY_BRUSH); memDC.Clear(); memDC.SetBrush(*wxWHITE_BRUSH); - memDC.DrawCircle(65, 65, 64); - memDC.SetBrush(*wxRED_BRUSH); + memDC.DrawCircle(64, 64, 64); + memDC.SetPen(wxPen(*wxBLACK, 3, wxPENSTYLE_SOLID)); memDC.DrawLine(64, 64, x, y); - memDC.DrawLine(63, 64, x - 1, y); - memDC.DrawLine(65, 64, x + 1, y); - memDC.DrawLine(64, 63, x, y - 1); - memDC.DrawLine(64, 65, x, y + 1); memDC.SetPen(*wxBLACK_PEN); memDC.CrossHair(64, 64); memDC.SetBrush(*wxBLUE_BRUSH);